
var isArray=function isArray(xValue)
{return('array'==typeof xValue||xValue instanceof Array);};var isBoolean=function isBoolean(xValue)
{return('boolean'==typeof xValue||xValue instanceof Boolean);};var isDefined=function isDefined(xValue)
{return(undefined!==xValue)};var isFloat=function isFloat(xValue)
{return(isNumber(xValue)&&0!=xValue%1);};var isFunction=function isFunction(xValue)
{return('function'==typeof xValue||xValue instanceof Function);};var isInteger=function isInteger(xValue)
{return(isNumber(xValue)&&0==xValue%1);};var isNumber=function isNumber(xValue)
{return('number'==typeof xValue||xValue instanceof Number);};var isObject=function isObject(xValue)
{return('object'==typeof xValue||xValue instanceof Object);};var isString=function isString(xValue)
{return('string'==typeof xValue||xValue instanceof String);};Array.prototype.has=function has(xNeedle)
{return(false!==this.search(xNeedle));};Array.prototype.map=function map(fHandler)
{var iLength=this.length;var aOutput=[];for(var i=0;i<iLength;i++)
{aOutput[i]=fHandler(this[i]);}
return aOutput;};Array.prototype.max=function max()
{var iLength=this.length;var iMax=Number(this[0]);for(var i=1;i<iLength;i++)
{iMax=Math.max(iMax,this[i]);}
return iMax;};Array.prototype.min=function min()
{var iLength=this.length;var iMin=Number(this[0]);for(var i=1;i<iLength;i++)
{iMin=Math.min(iMin,this[i]);}
return iMin;};Array.prototype.search=function search(xNeedle)
{var iLength=this.length;for(var i=0;i<iLength;i++)
{if(xNeedle===this[i])
{return i;}}
return false;};String.prototype.ltrim=function ltrim()
{return this.replace(/^\s+/,'');};String.prototype.pad=function pad(iLength,sPadding,iType)
{if(!isDefined(sPadding))
{sPadding=' ';}
if(!isDefined(iType))
{iType=String.PAD_RIGHT;}
iLength=Math.max(0,iLength-this.length);if(0===iLength)
{return this;}
var sPad=sPadding.repeat(Math.ceil(iLength/sPadding.length)+1).substr(0,iLength);if(String.PAD_LEFT===iType)
{return sPad+this;}
else if(String.PAD_BOTH===iType)
{return sPad.substr(0,Math.ceil(iLength/2))+this+sPad.substr(0,Math.floor(iLength/2));}
else
{return this+sPad;}};String.PAD_LEFT=0x01;String.PAD_RIGHT=0x02;String.PAD_BOTH=0x03;String.prototype.repeat=function repeat(iMultiplier)
{return(new Array(Math.max(0,iMultiplier)+1)).join(this);};String.prototype.rtrim=function rtrim()
{return this.replace(/\s+$/,'');};String.prototype.trim=function trim()
{return this.replace(/^\s+|\s+$/g,'');};Object.prototype.begetObject=function begetObject()
{var F=function F()
{};F.prototype=this;return new F();};Object.prototype.getKeys=function getKeys(bOwnKeys)
{bOwnKeys=Boolean(bOwnKeys);var aKeys=new Array();for(var sKey in this)
{if(bOwnKeys&&!this.hasOwnProperty(sKey))
{continue;}
aKeys.push(sKey);};return aKeys;};Object.prototype.getValues=function getValues(bOwnKeys)
{bOwnKeys=Boolean(bOwnKeys);var aValues=new Array();for(var sKey in this)
{if(bOwnKeys&&!this.hasOwnProperty(sKey))
{continue;}
aValues.push(this[sKey]);};return aValues;};window.getHeight=function getHeight()
{var oHtml=document.documentElement;if(self.innerHeight)
{return self.innerHeight;}
if(oHtml&&oHtml.clientHeight)
{return document.documentElement.clientHeight;}
if(document.body)
{return document.body.clientHeight;}
return-1;};window.getScrollLeft=function getScrollLeft()
{var oHtml=document.documentElement;if(window.innerHeight)
{return window.pageXOffset;}
if(oHtml&&oHtml.scrollLeft)
{return oHtml.scrollLeft;}
if(document.body)
{return document.body.scrollLeft;}};window.getScrollTop=function getScrollTop()
{var oHtml=document.documentElement;if(window.innerHeight)
{return window.pageYOffset;}
if(oHtml&&oHtml.scrollTop)
{return oHtml.scrollTop;}
if(document.body)
{return document.body.scrollTop;}};window.getWidth=function getWidth()
{var oHtml=document.documentElement;if(self.innerWidth)
{return self.innerWidth;}
if(oHtml&&oHtml.clientWidth)
{return document.documentElement.clientWidth;}
if(document.body)
{return document.body.clientWidth;}
return-1;};var dom={getX:function(oNode)
{var iX=0;if(oNode.offsetParent)
{iX=oNode.offsetLeft;while((oNode=oNode.offsetParent))
{iX+=oNode.offsetLeft;}}
return iX;},getY:function(oNode)
{var iY=0;if(oNode.offsetParent)
{iY=oNode.offsetTop;while((oNode=oNode.offsetParent))
{iY+=oNode.offsetTop;}}
return iY;},hasClass:function(oNode,sClassName)
{var aClassNames=oNode.className.split(' ');return aClassNames.has(sClassName);},setClass:function(oNode,sClassName)
{if(!this.hasClass(oNode,sClassName))
{oNode.className=(oNode.className+' '+sClassName).trim();}},unsetClass:function(oNode,sClassName)
{var aClassNames=oNode.className.split(' ');var iIndex=aClassNames.search(sClassName);if(false!==iIndex)
{aClassNames.splice(iIndex,1);oNode.className=aClassNames.join(' ').trim();}},toString:function()
{return'[object dom]';}};var getCookie=function getCookie(sName)
{var aCookie=document.cookie.split(';');var iCookie=aCookie.length;var sCookie='';for(var i=0;i<iCookie;i++)
{sCookie=aCookie[i].trim();if(0===sCookie.indexOf(sName+'='))
{return sCookie.substr(sName.length+1);}}
return null;};var object=function object(oObject)
{var F=function F()
{};F.prototype=oObject;return new F();};var setCookie=function setCookie(sName,sValue,iDays)
{var oDate;var sExpired='';if(iDays)
{oDate=new Date();oDate.setTime(oDate.getTime()+(iDays*24*60*60*1000));sExpired='; expires='+oDate.toGMTString();}
document.cookie=sName+'='+sValue+sExpired+'; path=/';};var sprintf=function sprintf(sFormat)
{var aArgs=arguments;var iArgs=aArgs.length-1;var iCurrentArg=0;var rExp=/^([^%]*)%(\d\$)?(\+)?(\-)?('.|0|\x20)?(\d+)?(\.\d+)?([%b-fosuxX])([\D\d]*)$/;var sOutput='';var aBases={'b':2,'o':8,'u':10,'x':16,'X':16};var iBase;var aMatch;var iArg;var sParam;var sReplacement;var iMax=Math.pow(2,32);while(aMatch=rExp.exec(sFormat))
{iArg=0;if(aMatch[2])
{iArg=parseInt(aMatch[2].substr(0,aMatch[2].length-1));}
if(!iArg&&'%'!=aMatch[8])
{iArg=++iCurrentArg;}
if(iArg>iArgs)
{throw new Error('not enough arguments');}
sParam=aArgs[iArg];var bSign=Boolean(aMatch[3]);var iPrecision=6;if(aMatch[7])
{iPrecision=parseInt(aMatch[7].substr(1));}
var sType=aMatch[8];sReplacement='';if('%'===sType)
{sReplacement='%';}
else if('c'===sType)
{sReplacement=String.fromCharCode(parseInt(sParam)%iMax);}
else if('d'===sType)
{var iParam=Math.max(-iMax/2,parseInt(sParam))%iMax;if(iParam>iMax/2)
{iParam-=iMax;}
sReplacement=iParam;if(bSign&&0<iParam)
{sReplacement='+'+sReplacement;}}
else if('e'===sType)
{var fParam=parseFloat(sParam);var iExpo=Math.floor(Math.log(Math.abs(fParam))/Math.log(10));fParam/=Math.pow(10,iExpo);sReplacement=sprintf('%08.6fe%+d',fParam,iExpo);}
else if('f'===sType)
{var iPow=Math.pow(10,iPrecision);var fFloat=Math.round(iPow*parseFloat(sParam))/iPow;var sDec=String(Math.abs(fFloat)%1).substr(2).pad(iPrecision,'0',2).substr(0,iPrecision);sReplacement=parseInt(fFloat)+'.'+sDec;if(bSign&&0<fFloat)
{sReplacement='+'+sReplacement;}}
else if('s'===sType)
{sReplacement=sParam;}
else if(iBase=aBases[sType])
{var iParam=parseInt(sParam);if(0>iParam)
{iParam=Math.abs(iParam);if(iParam>iMax/2)
{iParam=iMax/2;}
else
{iParam=iMax-iParam;}
sReplacement=(iParam).toString(iBase);}
else
{sReplacement=(iParam%iMax).toString(iBase);}
if('X'===sType)
{sReplacement=sReplacement.toUpperCase();}}
var iPadPos=Boolean(aMatch[4])+1;var sPadChar=aMatch[5];var iPadLength=parseInt(aMatch[6]);if(!sPadChar)
{sPadChar=' ';}
if(2===sPadChar.length)
{sPadChar=sPadChar[1];}
if(iPadLength)
{sReplacement=String(sReplacement).pad(iPadLength,sPadChar,iPadPos);}
sOutput+=aMatch[1]+sReplacement;sFormat=aMatch[9];}
return sOutput+sFormat;};var unsetCookie=function unsetCookie(sName)
{setCookie(sName,'',-1);};var Subject=function()
{var _oObservers={};return{addObserver:function(oObserver,sTopic)
{if(!_oObservers[sTopic])
{_oObservers[sTopic]=[];};_oObservers[sTopic].push(oObserver);},notify:function(sTopic)
{if(!_oObservers[sTopic])
{return 0;};var aArgs=[];var argv=arguments;var argc=argv.length;for(var i=1;i<argc;i++)
{aArgs.push(argv[i]);};var oObservers=_oObservers[sTopic];var iLength=oObservers.length;var iNotified=0;for(var i=0;i<iLength;i++)
{if(!oObservers[i].observe)
{continue;};oObservers[i].observe(this,sTopic,aArgs);iNotified++;};return iNotified;}};};
var addEvent = function addEvent(oNode, sEventType, fCallback)
{
    if (oNode.addEventListener)
    {
        oNode.addEventListener(sEventType, fCallback, false);
        return true;
    }
    if (oNode.attachEvent)
    {
        return oNode.attachEvent('on'+sEventType, fCallback);
    }
    return false;
};
