var Utils={setCookie:function(name,value,expires,path,domain,secure){var _cookie=[];_cookie.push(name+"="+escape(value));if(typeof expires==="string"&&/^\d+$/.test(expires))expires=parseInt(expires,10);if(expires instanceof Date)expires=expires.toGMTString();else if(typeof expires==="number")expires=(new Date(expires*1E3)).toGMTString();else expires=null;if(expires!=null)_cookie.push("expires="+expires);if(path!=null)_cookie.push("path="+escape(path));if(domain!=null)_cookie.push("domain="+escape(domain));
if(secure)_cookie.push("secure");try{document.cookie=_cookie.join(";")}catch(err){}return true},getCookie:function(name){var search=name+"=";var defcook="";if(document.cookie.length>0){offset=document.cookie.indexOf(search);if(offset!=-1){offset+=search.length;end=document.cookie.indexOf(";",offset);if(end==-1)end=document.cookie.length;defcook=unescape(document.cookie.substring(offset,end));if(defcook!="")return defcook}}return null},strtotime:function(str,now){var i,match,s,strTmp="",parse="";strTmp=
str;strTmp=strTmp.replace(/\s{2,}|^\s|\s$/g," ");strTmp=strTmp.replace(/[\t\r\n]/g,"");if(strTmp=="now")return(new Date).getTime()/1E3;else if(!isNaN(parse=Date.parse(strTmp)))return parse/1E3;else if(now)now=new Date(now*1E3);else now=new Date;strTmp=strTmp.toLowerCase();var __is={day:{"sun":0,"mon":1,"tue":2,"wed":3,"thu":4,"fri":5,"sat":6},mon:{"jan":0,"feb":1,"mar":2,"apr":3,"may":4,"jun":5,"jul":6,"aug":7,"sep":8,"oct":9,"nov":10,"dec":11}};var process=function(m){var ago=m[2]&&m[2]=="ago";var num=
(num=m[0]=="last"?-1:1)*(ago?-1:1);switch(m[0]){case "last":case "next":switch(m[1].substring(0,3)){case "yea":now.setFullYear(now.getFullYear()+num);break;case "mon":now.setMonth(now.getMonth()+num);break;case "wee":now.setDate(now.getDate()+num*7);break;case "day":now.setDate(now.getDate()+num);break;case "hou":now.setHours(now.getHours()+num);break;case "min":now.setMinutes(now.getMinutes()+num);break;case "sec":now.setSeconds(now.getSeconds()+num);break;default:var day;if(typeof(day=__is.day[m[1].substring(0,
3)])!="undefined"){var diff=day-now.getDay();if(diff==0)diff=7*num;else if(diff>0){if(m[0]=="last")diff-=7}else if(m[0]=="next")diff+=7;now.setDate(now.getDate()+diff)}}break;default:if(/\d+/.test(m[0])){num*=parseInt(m[0],10);switch(m[1].substring(0,3)){case "yea":now.setFullYear(now.getFullYear()+num);break;case "mon":now.setMonth(now.getMonth()+num);break;case "wee":now.setDate(now.getDate()+num*7);break;case "day":now.setDate(now.getDate()+num);break;case "hou":now.setHours(now.getHours()+num);
break;case "min":now.setMinutes(now.getMinutes()+num);break;case "sec":now.setSeconds(now.getSeconds()+num);break}}else return false;break}return true};match=strTmp.match(/^(\d{2,4}-\d{2}-\d{2})(?:\s(\d{1,2}:\d{2}(:\d{2})?)?(?:\.(\d+))?)?$/);if(match!=null){if(!match[2])match[2]="00:00:00";else if(!match[3])match[2]+=":00";s=match[1].split(/-/g);for(i in __is.mon)if(__is.mon[i]==s[1]-1)s[1]=i;s[0]=parseInt(s[0],10);s[0]=s[0]>=0&&s[0]<=69?"20"+(s[0]<10?"0"+s[0]:s[0]+""):s[0]>=70&&s[0]<=99?"19"+s[0]:
s[0]+"";return parseInt(Utils.strtotime(s[2]+" "+s[1]+" "+s[0]+" "+match[2])+(match[4]?match[4]/1E3:""),10)}var regex="([+-]?\\d+\\s"+"(years?|months?|weeks?|days?|hours?|min|minutes?|sec|seconds?"+"|sun\\.?|sunday|mon\\.?|monday|tue\\.?|tuesday|wed\\.?|wednesday"+"|thu\\.?|thursday|fri\\.?|friday|sat\\.?|saturday)"+"|(last|next)\\s"+"(years?|months?|weeks?|days?|hours?|min|minutes?|sec|seconds?"+"|sun\\.?|sunday|mon\\.?|monday|tue\\.?|tuesday|wed\\.?|wednesday"+"|thu\\.?|thursday|fri\\.?|friday|sat\\.?|saturday))"+
"(\\sago)?";match=strTmp.match(new RegExp(regex,"gi"));if(match==null)return false;for(i=0;i<match.length;i++)if(!process(match[i].split(" ")))return false;return now.getTime()/1E3},str_pad:function(input,pad_length,pad_string,pad_type){var half="",pad_to_go;var str_pad_repeater=function(s,len){var collect="",i;while(collect.length<len)collect+=s;collect=collect.substr(0,len);return collect};input+="";pad_string=pad_string!==undefined?pad_string:" ";if(pad_type!="STR_PAD_LEFT"&&pad_type!="STR_PAD_RIGHT"&&
pad_type!="STR_PAD_BOTH")pad_type="STR_PAD_RIGHT";if((pad_to_go=pad_length-input.length)>0)if(pad_type=="STR_PAD_LEFT")input=str_pad_repeater(pad_string,pad_to_go)+input;else if(pad_type=="STR_PAD_RIGHT")input=input+str_pad_repeater(pad_string,pad_to_go);else if(pad_type=="STR_PAD_BOTH"){half=str_pad_repeater(pad_string,Math.ceil(pad_to_go/2));input=half+input+half;input=input.substr(0,pad_length)}return input},utf8_decode:function(str_data){var i=0,ac=0,c1=0,c2=0,c3=0,tmp_arr=Array();str_data+="";
while(i<str_data.length){c1=str_data.charCodeAt(i);if(c1<128){tmp_arr[ac++]=String.fromCharCode(c1);i++}else if(c1>191&&c1<224){c2=str_data.charCodeAt(i+1);tmp_arr[ac++]=String.fromCharCode((c1&31)<<6|c2&63);i+=2}else{c2=str_data.charCodeAt(i+1);c3=str_data.charCodeAt(i+2);tmp_arr[ac++]=String.fromCharCode((c1&15)<<12|(c2&63)<<6|c3&63);i+=3}}return tmp_arr.join("")},htmlspecialchars_decode:function(string,quote_style){var c={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#039;":"'"};return string.replace(/&amp;|&lt;|&gt;|&quot;|&#039;/g,
function(a){return c[a]})}};

