if (typeof(GSLCore) == 'undefined') {

/**
 * GSLCore
 */
GSLCore = {
    ERR_TYPES:{UNKNOWN:1, INVALID_ARG:10},
    OBJ_TYPES:{UNDEF:'undefined', OBJ:'object', FUNC:'function', BOOL:'boolean', NBR:'number', STR:'string', ARY:'array'},
    isDef:function(oObj) {
        return((oObj != null) && ((typeof(oObj) != this.OBJ_TYPES.UNDEF) && (oObj != undefined)));
    },
    isObj:function(oObj) {
        return(this.isDef(oObj) && ((typeof(oObj) == this.OBJ_TYPES.OBJ) || (oObj instanceof Object)));
    },
    isFunc:function(oObj) {
        return(this.isDef(oObj) && ((typeof(oObj) == this.OBJ_TYPES.FUNC) || (oObj instanceof Function)));
    },
    isBool:function(oObj) {
        return(this.isDef(oObj) && ((typeof(oObj) == this.OBJ_TYPES.BOOL) || (oObj instanceof Boolean)));
    },
    isNbr:function(oObj) {
        return(this.isDef(oObj) && ((typeof(oObj) == this.OBJ_TYPES.NBR) || (oObj instanceof Number)));
    },
    isStr:function(oObj) {
        return(this.isDef(oObj) && ((typeof(oObj) == this.OBJ_TYPES.STR) || (oObj instanceof String)));
    },
    isAry:function(oObj) {
        return(this.isDef(oObj) && ((typeof(oObj) == this.OBJ_TYPES.ARY) || (oObj instanceof Array) || (this.isDef(oObj.length))));
    },
    isStyleObj:function(oObj) {
        return(this.isObj(oObj) && this.isObj(oObj.style));
    },
    newClass:function() {
        var oSuper = null;
        if (arguments.length > 0) {
            oSuper = arguments[0];
            if (!this.isFunc(oSuper)) {
                if (!this.isObj(oSuper)) {
                    throw new GSLEx(10, ['GSLCore.newClass: Super [', oSuper, '] is no function'].join(''));
                }
                oSuper = null;
            }
        }
        var oClass = function() {
            if (GSLCore.isDef(oSuper)) {
                oSuper.apply(this, arguments);
            }
            oClass.prototype.init.apply(this, arguments);
        };
        if (this.isDef(oSuper)) {
            oClass.prototype = new oSuper();
            oClass.prototype.constructor = oClass;
            oClass.superclass = oSuper.prototype;
        }
        oClass.prototype.init = function() {
        };
        var oStartIdx = this.isDef(oSuper)?1:0;
        for (var oIdx = oStartIdx; oIdx < arguments.length; oIdx++) {
            var oType = arguments[oIdx];
            if (this.isObj(oType)) {
                for (var oProp in oType) {
                    oClass.prototype[oProp] = oType[oProp];
                }
            } else {
                throw new GSLEx(10, ['GSLCore.newClass: Type(', oIdx, ')[', oType, '] is no object'].join(''));
            }
        }
        return(oClass);
    },
    createTimeout:function() {
	    var oContext = window;
	    var oArgsStart = 2;
	    var oFunction = (arguments.length > 0)?arguments[0]:null;
	    var oDelay = (arguments.length > 1)?arguments[1]:null;
	    if (!this.isFunc(oFunction) && !this.isStr(oFunction)) {
		    oContext = oFunction;
		    oFunction = oDelay;
		    oDelay = (arguments.length > 2)?arguments[2]:null;
		    oArgsStart++;
	    }
	    if (this.isObj(oContext) && this.isStr(oFunction)) {
		    oFunction = oContext[oFunction];
	    }
	    var oTimeout = null;
	    if (this.isObj(oContext) && this.isFunc(oFunction) && this.isInt(oDelay)) {
	        var oArgs = [];
	        for (var oIdx = oArgsStart; oIdx < arguments.length; oIdx++) {
		        oArgs.push(arguments[oIdx]);
    	    }
    	    oTimeout = function() {
    	        oFunction.apply(oContext, oArgs);
    	    }
    	    oTimeout = setTimeout(oTimeout, oDelay);
	    }
	    return(oTimeout);
    },
    createInterval:function() {
	    var oContext = window;
	    var oArgsStart = 2;
	    var oFunction = (arguments.length > 0)?arguments[0]:null;
	    var oDelay = (arguments.length > 1)?arguments[1]:null;
	    if (!this.isFunc(oFunction) && !this.isStr(oFunction)) {
		    oContext = oFunction;
		    oFunction = oDelay;
		    oDelay = (arguments.length > 2)?arguments[2]:null;
		    oArgsStart++;
	    }
	    if (this.isObj(oContext) && this.isStr(oFunction)) {
		    oFunction = oContext[oFunction];
	    }
	    var oInterval = null;
	    if (this.isObj(oContext) && this.isFunc(oFunction) && this.isInt(oDelay)) {
	        var oArgs = [];
	        for (var oIdx = oArgsStart; oIdx < arguments.length; oIdx++) {
		        oArgs.push(arguments[oIdx]);
    	    }
    	    oInterval = function() {
    	        oFunction.apply(oContext, oArgs);
    	    }
    	    oInterval = setInterval(oInterval, oDelay);
	    }
	    return(oInterval);
    },    
    styleObj:function(oObj) {
        oObj = this.isStr(oObj)?document.getElementById(oObj):oObj;
        return(this.isStyleObj(oObj)?oObj:null);
    },
    isHex:function(oHex) {
        return(this.isDef(oHex) && !isNaN(['0x', oHex].join('')) && !isNaN(parseInt(['0x', oHex].join(''))));
    },
    isInt:function(oInt) {
        return(this.isDef(oInt) && !isNaN(oInt) && !isNaN(parseInt(oInt)) && (parseInt(oInt) == parseFloat(oInt)));
    },
    isFloat:function(oFloat) {
        return(this.isDef(oFloat) && !isNaN(oFloat) && !isNaN(parseFloat(oFloat)));
    },
    fromHex:function(oHex) {
        return(this.isHex(oHex)?parseInt(['0x', oHex].join('')):null);
    },
    fromInt:function(oInt) {
        return(this.isInt(oInt)?parseInt(oInt):null);
    },
    fromFloat:function(oFloat) {
        return(this.isFloat(oFloat)?parseFloat(oFloat):null);
    },
    toHex:function(oInt, oMin) {
        oInt = this.fromInt(oInt);
        oHex = (this.isDef(oInt) && (oInt >= 0))?(new Number(oInt)).toString(16):null;
        if (this.isDef(oHex)) {
            oMin = this.fromInt(oMin);
            if (this.isDef(oMin)) {
                while (oHex.length < oMin) {
                    oHex = ['0', oHex].join('');
                }
            }
        }
        return(oHex);
    },
    trim:function(oStr, oPos) {
        oStr = this.isStr(oStr)?oStr:null;
        if (this.isDef(oStr)) {
            oPos = this.fromInt(oPos);
            oPos = this.isDef(oPos)?oPos:0;
            var oRE = (oPos < 0)?(/^\s+/):(oPos > 0)?(/\s+$/):(/^\s+|\s+$/g);
            oStr = oStr.replace(oRE, '');
        }
        return(oStr);
    },
    trimL:function(oStr) {
        return(this.trim(oStr, -1));
    },
    trimR:function(oStr) {
        return(this.trim(oStr, 1));
    },
    pad:function(oStr, oLen, oChr, oPos) {
        oStr = this.isStr(oStr)?oStr:null;
        if (this.isDef(oStr)) {
            oLen = this.fromInt(oLen);
            if (this.isDef(oLen)) {
                oChr = (this.isStr(oChr) && (oChr.length > 0))?oChr.charAt(0):' ';
                oPos = this.fromInt(oPos);
                oPos = (this.isDef(oPos))?oPos:0;
                while(oLen > oStr.length) {
                    if (oPos < 0) {
                        oStr = [oChr, oStr].join('');
                    } else {
                        oStr = [oStr, oChr].join('');
                    }
                }
            }
        }
        return(oStr);
    },
    padL:function(oStr, oLen, oChr) {
        return(this.pad(oStr, oLen, oChr, -1));
    },
    padR:function(oStr, oLen, oChr) {
        return(this.pad(oStr, oLen, oChr, 1));
    },
    showAlert:function(oAlert) {
        alert(oAlert);
    },
    popupPhoto:function(oL, oT, oW, oH) { 
        var oP = open(oL,oT,'height='+oH+',width='+oW+',left=0,top=0,screenX=0,screenY=0,menubar=no,location=no,resizable=yes,status=no,toolbar=no,scrollbars=yes');
        oP.focus();
        return(oP);
    }    
}

/**
 * GSLCss
 */
GSLCss = {
    setMarginLeft:function(oObj, oLeft) {
        oObj = GSLCore.styleObj(oObj);
        if (!GSLCore.isStyleObj(oObj)) {
            return;
        }        
        oLeft = GSLCore.fromInt(oLeft);
        if (GSLCore.isInt(oLeft)) {
            oObj.style.marginLeft = oLeft + 'px';
        }        
    },
    setMarginTop:function(oObj, oTop) {
        oObj = GSLCore.styleObj(oObj);
        if (!GSLCore.isStyleObj(oObj)) {
            return;
        }        
        oTop = GSLCore.fromInt(oTop);
        if (GSLCore.isInt(oTop)) {           
            oObj.style.marginTop = oTop + 'px';
        }        
    },    
    setWidthPixel:function(oObj, oWidth) {
        oObj = GSLCore.styleObj(oObj);
        if (!GSLCore.isStyleObj(oObj)) {
            return;
        }
        oWidth = GSLCore.fromInt(oWidth);
        if (GSLCore.isInt(oWidth)) {
            oWidth = (oWidth >= 0)?oWidth:0;
            oObj.style.width = oWidth + 'px';
        }
    }, 
    setHeightPixel:function(oObj, oHeight) {
        oObj = GSLCore.styleObj(oObj);
        if (!GSLCore.isStyleObj(oObj)) {
            return;
        }
        oHeight = GSLCore.fromInt(oHeight);
        if (GSLCore.isInt(oHeight)) {
            oHeight = (oHeight >= 0)?oHeight:0;
            oObj.style.height = oHeight + 'px';
        }
    },     
    setVisible:function(oObj, oVisible) {
        oObj = GSLCore.styleObj(oObj);
        if (!GSLCore.isStyleObj(oObj) && !GSLCore.isBool(oVisible)) {
            return;
        }
        if (oVisible) {
            oObj.style.display = 'block';
            oObj.style.visibility = 'visible';
        } else {
            oObj.style.display = 'none';
            oObj.style.visibility = 'hidden';
        }
    },
    setOpacity:function(oObj, oOpacity) {
        oObj = GSLCore.styleObj(oObj);
        if (!GSLCore.isStyleObj(oObj)) {
            return;
        }
        oOpacity = GSLCore.fromFloat(oOpacity);
        if (GSLCore.isFloat(oOpacity)) {
            oOpacity = (oOpacity >= 0.0)?oOpacity:0.0;
            oOpacity = (oOpacity <= 1.0)?oOpacity:1.0;
            try {
                oObj.style.filter = 'Alpha(Opacity=' + (oOpacity*100) + ')';
            } catch (e1) {
            }
            try {
                oObj.style.opacity = oOpacity;
                oObj.style.MozOpacity = oOpacity;
            } catch (e2) {
            }
        }
    },
    setBackgroundImage:function(oObj, oImage) {
        oObj = GSLCore.styleObj(oObj);
        if (!GSLCore.isStyleObj(oObj)) {
            return;
        }
        if (GSLCore.isStr(oImage) && oImage.length > 0) {
            oObj.style.backgroundImage='url(' + oImage + ')';
        } else {
            oObj.style.backgroundImage='none';
        }    
    },
    setBackgroundColor:function(oObj, oColor) {
        oObj = GSLCore.styleObj(oObj);
        if (!GSLCore.isStyleObj(oObj)) {
            return;
        }
        if (GSLCore.isStr(oColor) && oColor.length > 0) {
            oObj.style.backgroundColor='#' + oColor;
        }    
    }    
}

/**
 * GSLAni
 */    
GSLAni = { 
    fadeIn:function(oObj, oOpacity) {
        var oTimeout = null;
        oObj = GSLCore.styleObj(oObj);
        if (!GSLCore.isStyleObj(oObj)) {
            return(oTimeout);
        }          
        var oMinOpacity = 0.0;
        var oMaxOpacity = 1.0;
        var oStep = 0.1;
        var oDelay = 20;
        if ((!GSLCore.isFloat(oOpacity)) ||
            (oMinOpacity > oOpacity)) {
            GSLCss.setVisible(oObj, true);
            oOpacity = oMinOpacity;
        }        
        oOpacity += oStep;
        GSLCss.setOpacity(oObj, oOpacity);               
        if (oOpacity < oMaxOpacity) {
            oTimeout = GSLCore.createTimeout(this, 'fadeIn', oDelay, oObj, oOpacity);
        }
        return(oTimeout);
    }         
}

/**
 * GSLEx
 */
GSLExType = {
    init:function() {
        if (arguments.length > 0) {
            var oStartIdx = 0;
            if (GSLCore.isInt(arguments[0])) {
                this.m_oErrType = GSLCore.fromInt(arguments[0]);
                oStartIdx++;
            } else {
                this.m_oErrType = GSLCore.ERR_TYPES.UNKNOWN;
            }
            for (var oIdx = oStartIdx; oIdx < arguments.length; oIdx++) {
                if ((GSLCore.isStr(arguments[oIdx])) && (arguments[oIdx].length > 0)) {
                    this.m_oErrMsg = [GSLCore.isDef(this.m_oErrMsg)?this.m_oErrMsg:'', arguments[oIdx]].join('');
                }
            }
        } else {
            this.m_oErrType = GSLCore.ERR_TYPES.UNKNOWN;
        }
    },
    toString:function() {
        return(['GSLEx->ErrType=[', GSLCore.isDef(this.m_oErrType)?this.m_oErrType:'',
                '], ErrMsg=[', GSLCore.isDef(this.m_oErrMsg)?this.m_oErrMsg:'', ']'].join(''));
    }
}
GSLEx = GSLCore.newClass(GSLExType);

}




