window.strNullToken='<![[NULL]]>';window.strNotNullToken='<![[!NULL]]>';function $N(el){var retval=false;if(typeof(el)=='string'){retval=document.getElementsByName(el);}else if($type(el)=="element"){retval=[el];}else{retval=el;}if(!retval||retval.length===0){retval=$(el);}else{$each(retval,function(element){element=$(element);});if(retval.length==1){retval=retval[0];}}return retval;}String.prototype.escapeHTML=function(use_nbsps){var chr=this.toString();var encChr='';var storeUniQty=0;var storeUniChar=[];for(var x=0;x<chr.length;x++){encChr+="&#"+chr.charCodeAt(x)+";";if(parseInt(chr.charCodeAt(x))>255){storeUniChar[storeUniQty]=chr.charAt(x);storeUniQty++;}}return encChr;};String.prototype.convertMSWordCharacters=function(){var string=this.toString();string=string.replace(eval("/"+String.fromCharCode(8220)+"/g"),"\"");string=string.replace(eval("/"+String.fromCharCode(8221)+"/g"),"\"");string=string.replace(eval("/"+String.fromCharCode(8222)+"/g"),"\"");string=string.replace(eval("/"+String.fromCharCode(8218)+"/g"),"'");string=string.replace(eval("/"+String.fromCharCode(8216)+"/g"),"'");string=string.replace(eval("/"+String.fromCharCode(8217)+"/g"),"'");string=string.replace(eval("/"+String.fromCharCode(8226)+"/g"),"*");string=string.replace(eval("/"+String.fromCharCode(8211)+"/g"),"-");string=string.replace(eval("/"+String.fromCharCode(8212)+"/g"),"-");return string;};String.prototype.formatAsMoney=Number.prototype.format=function(decimals,dec_point,thousands_sep){var n=!isFinite(+this)?0:+this,prec=!isFinite(+decimals)?0:Math.abs(decimals),sep=(typeof thousands_sep==='undefined')?',':thousands_sep,dec=(typeof dec_point==='undefined')?'.':dec_point,s='',toFixedFix=function(n,prec){var k=Math.pow(10,prec);return''+Math.round(n*k)/k;};s=(prec?toFixedFix(n,prec):''+Math.round(n)).split('.');if(s[0].length>3){s[0]=s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,sep);}if((s[1]||'').length<prec){s[1]=s[1]||'';s[1]+=new Array(prec-s[1].length+1).join('0');}return s.join(dec);};String.prototype.strip_tags=function(allowed_tags){var str=this,key='',allowed=false;var matches=[];var allowed_array=[];var allowed_tag='';var i=0;var k='';var html='';var replacer=function(search,replace,str){return str.split(search).join(replace);};if(allowed_tags){allowed_array=allowed_tags.match(/([a-zA-Z0-9]+)/gi);}str+='';matches=str.match(/(<\/?[\S][^>]*>)/gi);for(key in matches){if(isNaN(key)){continue;}html=matches[key].toString();allowed=false;for(k in allowed_array){allowed_tag=allowed_array[k];i=-1;if(i!=0){i=html.toLowerCase().indexOf('<'+allowed_tag+'>');}if(i!=0){i=html.toLowerCase().indexOf('<'+allowed_tag+' ');}if(i!=0){i=html.toLowerCase().indexOf('</'+allowed_tag);}if(i==0){allowed=true;break;}}if(!allowed){str=replacer(html,"",str);}}return str;};Date.prototype.toMySQLString=function(bIncludeTimeString){if(typeof(bIncludeTimeString)=='undefined'||bIncludeTimeString==null||bIncludeTimeString!==false)bIncludeTimeString=true;return this.getUTCFullYear()+'-'+(this.getUTCMonth()+1)+'-'+this.getUTCDate()+(bIncludeTimeString?" "+this.getUTCHours()+":"+this.getUTCMinutes()+":"+this.getUTCSeconds():"");};Object.count=function(theObj){var i=0,j;if(theObj&&typeof(theObj)=="object"&&theObj.constructor==Array){return theObj.length;}else{for(j in theObj){if(theObj[j]===Object.prototype[j]){continue;}++i;}return i;}};Object.dump=function(theObj,use_alert,depth,maxdepth){var output="";var props=[];if(typeof(depth)=="undefined"){depth=0;}if(typeof(maxdepth)=="undefined"){maxdepth=5;}if(depth>maxdepth){return"";}var padding="";for(var i=0;i<depth;++i){padding+="    ";}for(i in theObj){if(typeof(theObj[i])=="undefined"||theObj[i]===Object.prototype[i]||i=='prototype'){continue;}props.push(i);}props.sort();for(i=0;i<props.length;i++){if(typeof(props[i])=="undefined"||props[i]===Object.prototype[i]){continue;}output+=padding+props[i];try{if(typeof(theObj[props[i]])=="string"){output+=" => "+theObj[props[i]]+"\n";}else{output+=": (obj)\n"+padding+"{\n"+Object.dump(theObj[props[i]],use_alert,depth+1,maxdepth)+padding+"}\n";}}catch(e){}}if(depth===0){if(Communication&&Communication.outputDebugInfo){Communication.outputDebugInfo(output,use_alert);}else{alert(output);}}else{return output;}};Object.merge=function(objA,objB){return $merge(objB,objA);};Object.copy=function(obj,copyflag){var retobj={};for(var i in obj){if(obj[i]===Object.prototype[i]){continue;}if(typeof(obj[i])==="object"&&copyflag!==false&&obj[i]!==null){retobj[i]=Object.copy(obj[i]);}else{retobj[i]=obj[i];}}return retobj;};Element.implement({hasClassRegex:function(className){return this.className.test('(?:^|\\s)'+className+'(?:\\s|$)');}});function setUTCTimeZoneCookie(){var rightNow=new Date();var date1=new Date(rightNow.getFullYear(),0,1,0,0,0,0);var date2=new Date(rightNow.getFullYear(),6,1,0,0,0,0);var temp=date1.toGMTString();var date3=new Date(temp.substring(0,temp.lastIndexOf(" ")-1));temp=date2.toGMTString();var date4=new Date(temp.substring(0,temp.lastIndexOf(" ")-1));var hoursDiffStdTime=(date1-date3)/(1000*60*60);var hoursDiffDaylightTime=(date2-date4)/(1000*60*60);if(hoursDiffStdTime==hoursDiffDaylightTime){Cookie.write("dst","false",{duration:false});}else{Cookie.write("dst","true",{duration:false});}var aTZ=(hoursDiffStdTime.toString()).split(".");if(typeof(aTZ[1])=='undefined'){aTZ[1]=0;}var utc_timezone=(100*aTZ[0])+(60*aTZ[1])+"";if(utc_timezone.length<5&&utc_timezone!="0000"){aTZ=utc_timezone.split("");aTZ.splice(1,0,"0");while(aTZ.length<4)aTZ.push("0");utc_timezone=aTZ.join("");}Cookie.write("utc_timezone",utc_timezone,{duration:false});};function enumCellIndexes(table){var tr,td,iRow,iCell;for(iRow=0;table&&iRow<table.rows.length;iRow++){tr=table.rows[iRow];for(iCell=0;iCell<tr.cells.length;iCell++){td=tr.cells[iCell];$(td).setProperty("_cellIndex",iCell);}}}function getAbsoluteIndex(t,relIndex){var countnotvisible=0;var countvisible=0;for(i=0;i<t.cells.length;i++){cell=t.cells(i);if(cell.style.display=='none')countnotvisible++;else countvisible++;if(countvisible>relIndex)return i;}return i;}function resizeDimensions(width,height,max){if(max==null||max=='')max=75;width=parseInt(width);height=parseInt(height);if(width>=height&&width>max){height=max*height/width;width=max;}else if(height>=width&&height>max){width=max*width/height;height=max;}return{width:Math.floor(width),height:Math.floor(height)};};Element.implement({resizeDimensions:function(options){options=$merge({max:75},options);var oDim=this.getDimensions(),oNewDim={};width=parseInt(oDim.width);height=parseInt(oDim.height);if(width>=height&&width>options.max){oNewDim.height=Math.floor(options.max*height/width);oNewDim.width=options.max;}else if(height>=width&&height>options.max){oNewDim.width=Math.floor(options.max*width/height);oNewDim.height=options.max;}this.setStyles(oNewDim);},getDimensions:function(options){options=$merge({computeSize:false},options);var dim={};function getSize(el,options){if(options.computeSize)dim=el.getComputedSize(options);else{dim.width=el.getSize().x;dim.height=el.getSize().y;}return dim;}try{dim=getSize(this,options);}catch(e){}if(this.getStyle('display')=='none'||this.offsetWidth==0){clone=this.clone();clone.id=null;clone.setStyles({visibility:'hidden',display:'block',position:'absolute'});clone.injectInside(document.body);dim=getSize(clone,options);clone.remove();delete clone;}return $merge(dim,{x:dim.width,y:dim.height});},getComputedSize:function(options){options=$merge({styles:['padding','border'],plains:{height:['top','bottom'],width:['left','right']},mode:'both'},options);var size={width:0,height:0};switch(options.mode){case'vertical':delete size.width;delete options.plains.width;break;case'horizontal':delete size.height;delete options.plains.height;break;}var getStyles=[];$each(options.plains,function(plain,key){plain.each(function(edge){options.styles.each(function(style){getStyles.push((style=="border")?style+'-'+edge+'-'+'width':style+'-'+edge);});});});var styles=this.getStyles.apply(this,getStyles);var subtracted=[];$each(options.plains,function(plain,key){size['total'+key.capitalize()]=0;size['computed'+key.capitalize()]=0;plain.each(function(edge){size['computed'+edge.capitalize()]=0;getStyles.each(function(style,i){if(style.test(edge)){styles[style]=styles[style].toInt();if(isNaN(styles[style]))styles[style]=0;size['total'+key.capitalize()]=size['total'+key.capitalize()]+styles[style];size['computed'+edge.capitalize()]=size['computed'+edge.capitalize()]+styles[style];}if(style.test(edge)&&key!=style&&(style.test('border')||style.test('padding'))&&!subtracted.test(style)){subtracted.push(style);size['computed'+key.capitalize()]=size['computed'+key.capitalize()]-styles[style];}});});});if($chk(size.width)){size.width=size.width+this.offsetWidth+size.computedWidth;size.totalWidth=size.width+size.totalWidth;delete size.computedWidth;}if($chk(size.height)){size.height=size.height+this.offsetHeight+size.computedHeight;size.totalHeight=size.height+size.totalHeight;delete size.computedHeight;}return $merge(styles,size);}});var FastDOM=new Class({element:null,parent:null,initialize:function(object){return this.evaluate(object);},evaluate:function(object){var parent=new Element(object[0]);var current=parent;!$defined(this.element)?this.element=this.parent=parent:this.parent.adopt(parent);for(var i=1;i<object.length;i++){this.parent=current;if($type(object[i])==="string")parent.set("html",object[i]);if($type(object[i])==="object")parent.set(object[i]);if($type(object[i])==="array")this.evaluate(object[i]);}return this.element;}});function fillTemplateUsingIDs(mParams,strPrefix){if(!['object','array'].contains($type(mParams)))return;$each(mParams,function(mParam,strKey){var fillElem=$(strPrefix+strKey);if(fillElem&&fillElem.tagName){switch(fillElem.getProperty("data_type")){case"bool":{if(mParam==1){mParam="Yes";}else{mParam="No";}break;}default:{break;}}switch(fillElem.tagName.toLowerCase()){case"a":{fillElem.setProperties({"href":mParam});if(!fillElem.getProperty('preserve_innerhtml')||fillElem.getProperty('preserve_innerhtml')=="false"){fillElem.set("html",mParam)}break;}case"ul":{fillElem.empty();$each(mParam,function(mLI,strKey){var bContinue=true;if(js=fillElem.getProperty("js")){eval(js);}if(bContinue){fillElem.adopt(new Element("LI").set("html",mLI));}});break;}case"img":{if(js=fillElem.getProperty("js")){eval(js);}fillElem.src=mParam;break;}case"input":{if(js=fillElem.getProperty("js")){eval(js);}switch(fillElem.type){case"hidden":case"text":{fillElem.value=mParam;break;}}break;}case"div":case"span":default:{if(js=fillElem.getProperty("js")){eval(js);}fillElem.set("html",mParam);break;}}}var strNextPrefix=strPrefix+strKey+"_";fillTemplateUsingIDs(mParam,strNextPrefix);});return;};Element.Properties.name={get:function(){if(Browser.Engine.trident&&typeof this.name!='undefined'){return this.name;}else{return this.getProperty("name");}},set:function(strName){if(Browser.Engine.trident){this.name=strName;}this.setProperty("name",strName);}};Date.rangeToArray=function(strDateRange){var aRetval=[],oDate=new Date(),iQuarterHour;switch(strDateRange){case"last_3_quarter_hours":{aRetval.unshift(oDate.format("Y-m-d H:i:s"));oDate.setTime(oDate.getTime()-(45000*60));iQuarterHour=parseInt(oDate.format("i"),10);aRetval.unshift(oDate.format("Y-m-d H:"+(iQuarterHour<15?"0":"")+(iQuarterHour-(iQuarterHour%15))+":00"));break;}case"last_45_minutes":{aRetval.unshift(oDate.format("Y-m-d H:i:s"));oDate.setTime(oDate.getTime()-(45000*60));aRetval.unshift(oDate.format("Y-m-d H:i:s"));break;}case"today":{aRetval.push(oDate.format("Y-m-d 00:00:00"));aRetval.push(oDate.format("Y-m-d H:i:s"));break;}case"yesterday":{oDate.setTime(oDate.getTime()-86400000);aRetval.push(oDate.format("Y-m-d 00:00:00"));aRetval.push(oDate.format("Y-m-d 23:59:59"));break;}case"last_7_days":{oDate.setTime(oDate.getTime()-604800000);aRetval.push(oDate.format("Y-m-d 00:00:00"));oDate.setTime(oDate.getTime()+518400000);aRetval.push(oDate.format("Y-m-d 23:59:59"));break;}case"month_to_date":{oDate.setTime(oDate.getTime()-604800000);aRetval.push(oDate.format("Y-m-d 00:00:00"));oDate.setTime(oDate.getTime()+518400000);aRetval.push(oDate.format("Y-m-d 23:59:59"));break;}case"last_month":{oDate.setTime(oDate.getTime()-604800000);aRetval.push(oDate.format("Y-m-d 00:00:00"));oDate.setTime(oDate.getTime()+518400000);aRetval.push(oDate.format("Y-m-d 23:59:59"));break;}default:{if(strDateRange.indexOf("|")!=-1){aRetval=strDateRange.split("|");if(aRetval[0].indexOf(":")==-1){aRetval[0]+=" 00:00:00";}if(aRetval[1].indexOf(":")==-1){if(aRetval[1]==oDate.format("Y-m-d")){aRetval[1]+=" "+oDate.format("H:i:s");}else{aRetval[1]+=" 23:59:59";}}}}}return aRetval;};function booyah_datetime_enum_range(strFromDate,strToDate,strResolution,iResolutionFactor,bPadResult){strResolution=strResolution||"day";iResolutionFactor=iResolutionFactor||1;bPadResult=$pick(bPadResult,true);var mRetval=[],oFromDate,iFromDate,oToDate,iToDate,bDesc=true,iTmpDate,iYearFactor,iMonthFactor,iDayFactor,iHourFactor,iMinFactor,iSecFactor,strDateFormat="",iDateTime,iIdx,iSampling;if(strToDate=="date_range"){var aDateRange=Date.rangeToArray(strFromDate);strFromDate=aDateRange[0];strToDate=aDateRange[1];}iFromDate=Date.parseMySQL(strFromDate);iToDate=Date.parseMySQL(strToDate);bDesc=iToDate<iFromDate;if(bDesc){iTmpDate=iToDate;iToDate=iFromDate;iFromDate=iTmpDate;}oFromDate=new Date(iFromDate);oToDate=new Date(iToDate);iYear=parseInt(oFromDate.getUTCFullYear(),10);iYearFactor=0;iMonth=parseInt(oFromDate.getUTCMonth(),10)+1;iMonthFactor=0;iDay=parseInt(oFromDate.getUTCDate(),10);iDayFactor=0;iHour=0;iHourFactor=0;iMin=0;iMinFactor=0;iSec=0;iSecFactor=0;iSampling=booyah_datetime_calc_sampling(strFromDate,strToDate,strResolution,iResolutionFactor);switch(strResolution.toLowerCase()){case("year"):{iYearFactor=iResolutionFactor;iDay=1;iMonth=1;strDateFormat="Y";break;}case("month"):{iMonthFactor=iResolutionFactor;iDay=1;strDateFormat="Y-m";break;}case("hour"):{iHour=parseInt(oFromDate.format("H"),10);iHourFactor=iResolutionFactor;strDateFormat="Y-m-d H"+(bPadResult?":00:00":"");break;}case("min"):{iHour=parseInt(oFromDate.format("H"),10);iMin=parseInt(oFromDate.format("i"),10);iMinFactor=iResolutionFactor;strDateFormat="Y-m-d H:i"+(bPadResult?":00":"");break;}case("sec"):{iHour=parseInt(oFromDate.format("H"),10);iMin=parseInt(oFromDate.format("i"),10);iSec=parseInt(oFromDate.format("s"),10);iSecFactor=iResolutionFactor;strDateFormat="Y-m-d H:i:s";break;}case("day"):default:{iDayFactor=iResolutionFactor;strDateFormat="Y-m-d";break;}}for(iIdx=0;iSampling>iIdx;iIdx++){iDateTime=Date.mktime(iHour+(iIdx*iHourFactor),iMin+(iIdx*iMinFactor),iSec+(iIdx*iSecFactor),iMonth+(iIdx*iMonthFactor),iDay+(iIdx*iDayFactor),iYear+(iIdx*iYearFactor))*1000;mRetval.push((new Date(iDateTime)).format(strDateFormat));}if(bDesc){mRetval.reverse();}return mRetval;}function booyah_datetime_calc_sampling(mFromDate,mToDate,strResolution,iResolutionFactor){var iRetval=false,iFromDate,oFromDate,iToDate,oToDate,iTmpFrom,bDesc,iFromYear,iToYear,iFromMonth,iToMonth,iFromDay,iToDay,iFromHour,iToHour,iFromMin,iToMin,iFromSec,iToSec,iDaysInFromMonth,iCompFromTime,iCompToTime,oCompFromDate,oCompToDate;strResolution=strResolution||"day";iResolutionFactor=iResolutionFactor||1;if(!isNaN(mFromDate)){iFromDate=mFromDate;}else{iFromDate=Date.parseMySQL(mFromDate);}if(!isNaN(mToDate)){iToDate=mToDate;}else{iToDate=Date.parseMySQL(mToDate);}bDesc=iToDate<iFromDate;if(bDesc){iTmpFrom=iFromDate;iFromDate=iToDate;iToDate=iTmpFrom;}oFromDate=new Date(iFromDate);oToDate=new Date(iToDate);switch(strResolution.toLowerCase()){case("year"):{iRetval=parseInt(oToDate.getUTCFullYear(),10)-parseInt(oFromDate.getUTCFullYear(),10);break;}case("month"):{iFromYear=parseInt(oFromDate.getUTCFullYear(),10);iToYear=parseInt(oToDate.getUTCFullYear(),10);if(iFromYear==iToYear){iRetval=parseInt(oToDate.getUTCMonth(),10)-parseInt(oFromDate.getUTCMonth(),10);}else{iRetval=11-parseInt(oFromDate.getUTCMonth(),10);iRetval+=parseInt(oToDate.getUTCMonth(),10)+1;if(1<(iToYear-iFromYear)){iRetval+=12*((iToYear-1)-(iFromYear+1));}}break;}case("hour"):{iFromHour=parseInt(oFromDate.getUTCHours(),10);iToHour=parseInt(oToDate.getUTCHours(),10);if(oToDate.format("Y-m-d")==oFromDate.format("Y-m-d")){iRetval=iToHour-iFromHour;}else{iRetval=24-iFromHour;iRetval+=iToHour;if((oToDate.format("Y-m")!=oFromDate.format("Y-m"))||((oToDate.format("Y-m")==oFromDate.format("Y-m"))&&(1<(parseInt(oToDate.format("d"),10)-parseInt(oFromDate.format("d"),10))))){iCompFromTime=Date.parse(oFromDate.format("M ")+(parseInt(oFromDate.format("d"),10)+1)+oFromDate.format(" Y 00:00:00"));iCompToTime=Date.parse(oToDate.format("M ")+(parseInt(oToDate.format("d"),10)-1)+oToDate.format(" Y 23:59:59"));iRetval+=(iCompToTime-iCompFromTime)/(60*60*1000);}}break;}case("min"):{iFromMin=parseInt(oFromDate.format("i"),10);iToMin=parseInt(oToDate.format("i"),10);if(oToDate.format("Y-m-d H")==oFromDate.format("Y-m-d H")){iRetval=iToMin-iFromMin;}else{iRetval=60-iFromMin;iRetval+=iToMin;if((oToDate.format("Y-m-d")!=oFromDate.format("Y-m-d"))||((oToDate.format("Y-m-d")==oFromDate.format("Y-m-d"))&&(1<(parseInt(oToDate.format("H"),10)-parseInt(oFromDate.format("H"),10))))){iCompFromTime=Date.parse(oFromDate.format("M d Y ")+(parseInt(oFromDate.format("H"),10)+1)+":00:00");iCompToTime=Date.parse(oToDate.format("M d Y ")+(parseInt(oToDate.format("H"),10)-1)+":59:59");iRetval+=(iCompToTime-iCompFromTime)/(60*1000);}}break;}case("sec"):case("date"):{iFromSec=parseInt(oFromDate.format("s"),10);iToSec=parseInt(oToDate.format("s"),10);if(oToDate.format("Y-m-d H:i")==oFromDate.format("Y-m-d H:i")){iRetval=iToSec-iFromSec;}else{iRetval=60-iFromSec;iRetval+=iToSec;if((oToDate.format("Y-m-d H")!=oFromDate.format("Y-m-d H"))||((oToDate.format("Y-m-d H")==oFromDate.format("Y-m-d H"))&&(1<(parseInt(oToDate.format("i"),10)-parseInt(oFromDate.format("i"),10))))){iCompFromTime=Date.parse(oFromDate.format("M d Y H:")+(parseInt(oFromDate.format("i"),10)+1)+":00");iCompToTime=Date.parse(oToDate.format("M d Y H:")+(parseInt(oToDate.format("i"),10)-1)+":59");iRetval+=(iCompToTime-iCompFromTime)/1000;}}break;}case("day"):default:{iFromDay=parseInt(oFromDate.format("d"),10);iToDay=parseInt(oToDate.format("d"),10);if(oToDate.format("Y-m")==oFromDate.format("Y-m")){iRetval=iToDay-iFromDay;}else{iDaysInFromMonth=parseInt(oFromDate.format("t"),10);iRetval=iDaysInFromMonth-iFromDay;iRetval+=iToDay;if((oToDate.format("Y")!=oFromDate.format("Y"))||((oToDate.format("Y")==oFromDate.format("Y"))&&(1<(parseInt(oToDate.format("m"),10)-parseInt(oFromDate.format("m"),10))))){oCompFromDate=new Date(oFromDate.getTime()-((oFromDate.getUTCDay()+1)*86400000));iCompFromTime=Date.parse(oCompFromDate.format("M d Y 00:00:00"));oCompToDate=new Date(oToDate.getTime()-((oToDate.getUTCDay()+1)*86400000));iCompToTime=Date.parse(oCompToDate.format("M d Y 23:59:59"));iRetval+=(iCompToTime-iCompFromTime)/(60*60*24*1000);}}break;}}iRetval+=1;iRetval=Math.round(iRetval/iResolutionFactor);return iRetval;}Date.parseMySQL=function(strDate){var iRetval=0,oDate=new Date(),aMatches=strDate.match(/^(\d{4})-(\d{1,2})-(\d{1,2})(?: (\d{2}):(\d{2}):(\d{2}))?$/);if(aMatches==null){iRetval=Date.parse(strDate);}else if(aMatches.length>0){aMatches[3]=aMatches[3].replace(/^0/,'');aMatches[2]=aMatches[2].replace(/^0/,'');oDate.setUTCFullYear(parseInt(aMatches[1],10));oDate.setUTCMonth(parseInt(aMatches[2],10)-1);oDate.setUTCDate(parseInt(aMatches[3],10));if(aMatches[4]!=null){oDate.setUTCHours(aMatches[4]);oDate.setUTCMinutes(aMatches[5]);oDate.setUTCSeconds(aMatches[6]);}iRetval=oDate.getTime();}return iRetval;};Date.prototype.format=function(format,iTimeStamp){if(iTimeStamp!=null){this.constructor(iTimeStamp);}var returnStr='';var replace=Date.replaceChars;for(var i=0;i<format.length;i++){var curChar=format.charAt(i);if(replace[curChar]){returnStr+=replace[curChar].call(this);}else{returnStr+=curChar;}}return returnStr;};Date.replaceChars={shortMonths:['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],longMonths:['January','February','March','April','May','June','July','August','September','October','November','December'],shortDays:['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],longDays:['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],d:function(){return(this.getUTCDate()<10?'0':'')+this.getUTCDate();},D:function(){return Date.replaceChars.shortDays[this.getUTCDay()];},j:function(){return this.getUTCDate();},l:function(){return Date.replaceChars.longDays[this.getUTCDay()];},N:function(){return this.getUTCDay()+1;},S:function(){return(this.getUTCDate()%10==1&&this.getUTCDate()!=11?'st':(this.getUTCDate()%10==2&&this.getUTCDate()!=12?'nd':(this.getUTCDate()%10==3&&this.getUTCDate()!=13?'rd':'th')));},w:function(){return this.getUTCDay();},z:function(){return"Not Yet Supported";},W:function(){return"Not Yet Supported";},F:function(){return Date.replaceChars.longMonths[this.getUTCMonth()];},m:function(){return(this.getUTCMonth()<9?'0':'')+(this.getUTCMonth()+1);},M:function(){return Date.replaceChars.shortMonths[this.getUTCMonth()];},n:function(){return this.getUTCMonth()+1;},t:function(){var iMonth=this.getUTCMonth(),iRetval=Date.replaceChars.daysInMonth[iMonth];if(iMonth==1&&this.format("L")==1){iRetval=29;}return iRetval;},L:function(){return(((this.getUTCFullYear()%4==0)&&(this.getUTCFullYear()%100!=0))||(this.getUTCFullYear()%400==0))?'1':'0';},o:function(){return"Not Supported";},Y:function(){return this.getUTCFullYear();},y:function(){return(''+this.getUTCFullYear()).substr(2);},a:function(){return this.getUTCHours()<12?'am':'pm';},A:function(){return this.getUTCHours()<12?'AM':'PM';},B:function(){return"Not Yet Supported";},g:function(){return this.getUTCHours()%12||12;},G:function(){return this.getUTCHours();},h:function(){return((this.getUTCHours()%12||12)<10?'0':'')+(this.getUTCHours()%12||12);},H:function(){return(this.getUTCHours()<10?'0':'')+this.getUTCHours();},i:function(){return(this.getUTCMinutes()<10?'0':'')+this.getUTCMinutes();},s:function(){return(this.getSeconds()<10?'0':'')+this.getSeconds();},e:function(){return"Not Yet Supported";},I:function(){return"Not Supported";},O:function(){return(-this.getTimezoneOffset()<0?'-':'+')+(Math.abs(this.getTimezoneOffset()/60)<10?'0':'')+(Math.abs(this.getTimezoneOffset()/60))+'00';},P:function(){return(-this.getTimezoneOffset()<0?'-':'+')+(Math.abs(this.getTimezoneOffset()/60)<10?'0':'')+(Math.abs(this.getTimezoneOffset()/60))+':'+(Math.abs(this.getTimezoneOffset()%60)<10?'0':'')+(Math.abs(this.getTimezoneOffset()%60));},T:function(){var m=this.getUTCMonth();this.setUTCMonth(0);var result=this.toTimeString().replace(/^.+ \(?([^\)]+)\)?$/,'$1');this.setUTCMonth(m);return result;},Z:function(){return-this.getTimezoneOffset()*60;},c:function(){return this.format("Y-m-d")+"T"+this.format("H:i:sP");},r:function(){return this.toString();},U:function(){return this.getTime()/1000;}};Date.mktime=function(){var d=new Date(),r=arguments,i=0,e=['Hours','Minutes','Seconds','Month','Date','FullYear'];for(i=0;i<e.length;i++){if(typeof r[i]==='undefined'){r[i]=d['getUTC'+e[i]]();r[i]+=(i===3);}else{r[i]=parseInt(r[i],10);if(isNaN(r[i])){return false;}}}r[5]+=(r[5]>=0?(r[5]<=69?2e3:(r[5]<=100?1900:0)):0);d.setUTCFullYear(r[5],r[3]-1,r[4]);d.setUTCHours(r[0],r[1],r[2]);return(d.getTime()/1e3>>0)-(d.getTime()<0);};Number.prototype.toShortString=function(){var iThisValue=this,oSteps={1000000000000:{name:"T"},1000000000:{name:"B"},1000000:{name:"MM"},1000:{name:"K"}},oStep={name:""},iDecimals=0;for(var iNum in oSteps){iNum=parseInt(iNum,10);if(iThisValue>=iNum){iThisValue/=iNum;if(iThisValue<10){iDecimals=2;}else if(iThisValue<100){iDecimals=1;}oStep=oSteps[iNum];break;}}if(arguments.length>=1){if(arguments[0]=="auto"){arguments[0]=iDecimals;}iThisValue=iThisValue.format.apply(iThisValue,arguments);}return iThisValue.toString()+oStep.name;};
//------------------------
