if(!window.console){var i,names=["log","debug","info","warn","error","assert","dir","dirxml","group","groupEnd","time","timeEnd","count","trace","profile","profileEnd"];window.console={};for(i=0;i<names.length;++i){window.console[names[i]]=function(){};}}function storageSetObject(storage,key,val){if(storage){storage.setItem(key,JSON.stringify(val));}}function storageGetObject(storage,key){if(storage){var val=storage.getItem(key);return val&&JSON.parse(val);}return null;}function isEmpty(ob){var i;for(i in ob){if(ob.hasOwnProperty(i)){return false;}}return true;}function deepDecode(obj){var t=typeof(obj),key;if(t=="number"||t=="boolean"||t=="function"){return obj;}if(t==="string"){return decodeURIComponent(obj);}for(key in obj){if(obj.hasOwnProperty(key)&&typeof obj[key]!=="function"){obj[key]=deepDecode(obj[key]);}}return obj;}function parseTime(tm){var d=new Date(),t=tm.match(/(\d+):(\d\d):(\d\d)?/);d.setHours(parseInt(t[1],10));d.setMinutes(parseInt(t[2],10));if(t[3]){d.setSeconds(parseInt(t[3],10));}return d;}function parseDMY(tm){if(!tm){return new Date();}var d=new Date(),t=tm.match(/(\d?\d)\/(\d?\d)\/(\d?\d?\d\d)/);d.setDate(parseInt(t[1],10));d.setMonth(parseInt(t[2],10)-1);d.setFullYear(parseInt(t[3],10));return d;}function formatTime(t){var h=t.getHours(),m=t.getMinutes(),s=t.getSeconds();if(h<10){h="0"+h;}if(m<10){m="0"+m;}if(s<10){s="0"+s;}return h+":"+m+":"+s;}function formatDate(d,dot){var i,arr=[d.getDate(),d.getMonth()+1,d.getFullYear()%100,d.getHours(),d.getMinutes(),d.getSeconds()],l=arr.length;for(i=0;i<l;i++){if(arr[i]<10){arr[i]="0"+arr[i];}}return arr[0]+"/"+arr[1]+"/"+arr[2]+" "+arr[3]+((dot>0)?".":":")+arr[4];}function getSelectedText(){var txt="";if(window.getSelection){txt=window.getSelection();}else{if(document.getSelection){txt=document.getSelection();}else{if(document.selection){txt=document.selection.createRange().text;}}}return txt;}function merge(left,right,comparison){var result=[];while((left.length>0)&&(right.length>0)){if(comparison(left[0],right[0])<0){result.push(left.shift());}else{result.push(right.shift());}}while(left.length>0){result.push(left.shift());}while(right.length>0){result.push(right.shift());}return result;}function merge_sort(array,comparison){if(array.length<2){return array;}var middle=Math.ceil(array.length/2);return merge(merge_sort(array.slice(0,middle),comparison),merge_sort(array.slice(middle),comparison),comparison);}(function(){try{if(!Array.prototype.indexOf){Array.prototype.indexOf=function(elt,from){var len=this.length;from=from||0;from=(from<0)?Math.ceil(from):Math.floor(from);if(from<0){from+=len;}for(;from<len;from++){if(from in this&&this[from]===elt){return from;}}return -1;};}}catch(err){console.log("extending array: "+err);}try{if(!Date.prototype.addDays){Date.prototype.addDays=function(days){var then=new Date(this);then.setDate(this.getDate()+days);return then;};}if(!Date.prototype.diffDays){Date.prototype.diffDays=function(otherDay){var one_day=1000*60*60*24,first=Date.UTC(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0,0),second=Date.UTC(otherDay.getFullYear(),otherDay.getMonth(),otherDay.getDate(),0,0,0,0);return Math.ceil((second-first)/one_day);};}if(!Date.prototype.toStr){Date.prototype.toStr=function(){var d=(this.getDate()>=10)?this.getDate():("0"+this.getDate()),m=(this.getMonth()+1),mm=(m>=10)?m:("0"+m);return this.getFullYear()+"-"+mm+"-"+d;};}if(!Date.prototype.toShortStr){Date.prototype.toShortStr=function(){var d=(this.getDate()>=10)?this.getDate():("0"+this.getDate()),m=(this.getMonth()+1),mm=(m>=10)?m:("0"+m);return d+"/"+mm;};}var origParse=Date.parse;Date.parse=function(date){var timestamp=origParse(date),minutesOffset=0,struct;if(isNaN(timestamp)&&(struct=/([\d]{4})-?([\d]{2})-?([\d]{2})/.exec(date))){if(struct[8]!=="Z"){minutesOffset=+struct[10]*60+(+struct[11]);if(struct[9]==="+"){minutesOffset=-minutesOffset;}}timestamp=Date.UTC(+struct[1],+struct[2]-1,+struct[3],0,0,0,0);}return timestamp;};}catch(err2){console.log("extending date: "+err2);}}());function strToDate(str){var arr=str.split("/");return new Date(arr[2],arr[1]-1,arr[0]);}jQuery.extend({gups:function(query){if(!query){query=window.location.search.substr(1);}if(!query){return false;}var res={};this.each(query.split("&"),function(){var parts=this.split("=",2);res[parts[0]]=(parts.length>1)?parts[1]:"";});return res;},gup:function(nm,query){return this.gups(query)[nm];}});if(!jQuery.saveForm){jQuery.extend({saveForm:function(form,cook){if(typeof(form)=="undefined"){return false;}var theForm=$(form),data="f="+theForm.attr("id"),inputs=theForm.find("input[type!=password]").not(".cls_nosave"),selects=theForm.find("select").not(".cls_nosave"),tareas=theForm.find("textarea").not(".cls_nosave");inputs.each(function(){var t=$(this),tp=t.attr("type"),sval=t.val();if(!t.attr("name")){return true;}if(tp=="checkbox"){sval=t.prop("checked");if(!sval||sval==="false"){return true;}sval=t.val();}if(tp=="radio"){sval=t.prop("checked");if(!sval||sval==="false"){return true;}sval=t.val();}if(!t.val()||!sval||sval==="false"){return true;}data+="&"+t.attr("name")+"="+encodeURIComponent(sval);return true;});selects.each(function(){var t=$(this),sval=t.children("option:selected").attr("value");if(!t.attr("name")){return true;}if(!sval){return true;}data+="&"+t.attr("name")+"="+encodeURIComponent(sval);return true;});tareas.each(function(){var t=$(this);if(!t.attr("name")){return true;}if(!t.val()){return true;}data+="&"+t.attr("name")+"="+encodeURIComponent(t.val());return true;});if(window.sessionStorage){window.sessionStorage.setItem(cook,data);}else{jQuery.cookie(cook,data,{expires:1});}return true;},restoreForm:function(form,cook){var theForm=$(form),fid=theForm.attr("id"),data=window.sessionStorage?window.sessionStorage.getItem(cook):jQuery.cookie(cook),fields=false,p1="";if(!data){return;}fields=data.split("&");p1=fields[0].split("=",2);if(p1[1]!=fid){return;}jQuery.each(fields,function(index,item){var parts=item.split("=",2),sval=decodeURIComponent(parts[1]),fld=theForm.find("[name="+parts[0]+"]").not(".cls_nosave");if(fld.is("textarea")){fld.val(sval);}else{if(fld.is("select")){fld.children("option[value="+sval+"]").attr("selected","true");}else{if(fld.is("input[type=checkbox]")&&sval&&sval!=="false"&&sval==fld.val()){fld.attr("checked","true");}else{if(fld.is("input[type=radio]")&&sval&&sval!=="false"){fld.filter("[value="+sval+"]").attr("checked","true");}else{if(fld.is("input")){fld.val(sval);}}}}}});if(window.sessionStorage){window.sessionStorage.removeItem(cook);}else{jQuery.cookie(cook,null);}}});}(function($){$.fn.datasort=function(options){var defaults={datatype:"alpha",sortElement:false,sortAttr:false,reverse:false},settings=$.extend({},defaults,options),datatypes={alpha:function(a,b){var o=base.extract(a,b);return base.alpha(o.a,o.b);},number:function(a,b){var e,o=base.extract(a,b);for(e in o){o[e]=o[e].replace(/[$]?(-?\d+.?\d+)/,"$1");}return base.number(o.a,o.b);},date:function(a,b){var e,o=base.extract(a,b);for(e in o){o[e]=o[e].replace(/-/g,"").replace(/january|jan/i,"01").replace(/february|feb/i,"02").replace(/march|mar/i,"03").replace(/april|apr/i,"04").replace(/may/i,"05").replace(/june|jun/i,"06").replace(/july|jul/i,"07").replace(/august|aug/i,"08").replace(/september|sept|sep/i,"09").replace(/october|oct/i,"10").replace(/november|nov/i,"11").replace(/december|dec/i,"12").replace(/(\d{2}) (\d{2}), (\d{4})/,"$3$1$2").replace(/(\d{2})\/(\d{2})\/(\d{4})/,"$3$2$1");}return base.number(o.a,o.b);},time:function(a,b){var e,o=base.extract(a,b),afternoon=/^(.+) PM$/i;for(e in o){o[e]=o[e].split(":");var last=o[e].length-1;if(afternoon.test(o[e][last])){o[e][0]=(parseInt(o[e][0],10)+12).toString();o[e][last]=o[e][last].replace(afternoon,"$1");}if(parseInt(o[e][0],10)<10&&o[e][0].length===1){o[e][0]="0"+o[e][0];}o[e][last]=o[e][last].replace(/^(.+) AM$/i,"$1");o[e]=o[e].join("");}return base.alpha(o.a,o.b);}},base={alpha:function(a,b){a=a.toUpperCase();b=b.toUpperCase();return(a<b)?-1:((a>b)?1:0);},number:function(a,b){a=parseFloat(a);b=parseFloat(b);return a-b;},extract:function(a,b){var get=function(i){var o=$(i);if(settings.sortElement){o=o.find(settings.sortElement);}if(settings.sortAttr){o=o.attr(settings.sortAttr);}else{o=o.text();}return o;};return{a:get(a),b:get(b)};}},that=this;if(typeof settings.datatype==="string"){that.sort(datatypes[settings.datatype]);}if(typeof settings.datatype==="function"){that.sort(settings.datatype);}if(settings.reverse){that=$($.makeArray(this).reverse());}$.each(that,function(index,element){that.parent().append(element);});};}(jQuery));function createSWFEmbedTag(src){var objectBeginTag='<object classid="clsid:27CDB6E-AE6D-11cf-96B8-444553540000" width="1px" height="1px">',objectEndTag="</object>",paramTags=['<param name="src" value="'+src+'"/>','<param name="hidden" value="true"/>','<param name="loop" value="false"/>','<param name="height" value="1px"/>','<param name="width" value="1px"/>','<param name="wmode" value="window"/>','<param name="autostart" value="true"/>'],embedTag=['<embed src="',src,'" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" wmode="window" loop="false" hidden="true" autostart="true"></embed>'];var str=[objectBeginTag,paramTags.join(""),embedTag.join(""),objectEndTag].join("");return str;}function doSound(path,tout){var soundObject=$(createSWFEmbedTag(path)).appendTo("body");if(isNaN(tout)){tout=3000;}setTimeout(function(){if(soundObject){soundObject.remove();}soundObject=false;},tout);}function getErrorMessage(err){if(err&&err.message){return err.message;}else{return err;}}var myErrorFlag=true;function myErrorHandler(errObj,errFunc){if(!myErrorFlag){return;}try{if(!errFunc){console.log(getErrorMessage(errObj));}else{if(typeof(errFunc)==="function"){errFunc(errObj);}else{if(errObj){console.log(errFunc+": "+getErrorMessage(errObj));}else{console.log(errFunc);}}}}catch(err){console.log("err func: "+getErrorMessage(err));}}(function(){var blinkAssets={},doBlink=function(){if(blinkAssets.count>blinkAssets.blinks){blinkAssets.elt.removeClass(blinkAssets.css);clearInterval(blinkAssets.timer);blinkAssets.timer=false;return;}if(blinkAssets.count%2==0){blinkAssets.elt.addClass(blinkAssets.css);}else{blinkAssets.elt.removeClass(blinkAssets.css);}blinkAssets.count++;};jQuery.fn.blink=function(css,blinks,speed){if(typeof(blinks)=="undefined"){blinks=4;}if(typeof(speed)=="undefined"){speed=250;}blinkAssets={elt:$(this),css:css,blinks:blinks,count:0,speed:speed,timer:false};blinkAssets.timer=setInterval(doBlink,blinkAssets.speed);return this;};}());$.fn.asMenu=function(ops){var clickHandler=function(evt){var t=$(ops.target).show(ops.effect);trigger.unbind("click",clickHandler);evt.stopPropagation();if(!ops.propagate){evt.stopImmediatePropagation();}$("body").click();setTimeout(function(){$("body").click(function(evt){if($(evt.target).parents().index(t)>=0){return true;}$("body").unbind("click",arguments.callee);trigger.bind("click",clickHandler);t.hide(ops.effect);evt.stopPropagation();return false;});},50);},trigger=$(this).click(clickHandler);return this;};jQuery.fn.sortElements=(function(){var sort=[].sort,inverse=1,defComp={string:function(a,b){return($(a).text()>$(b).text()?1:-1)*inverse;},numeric:function(a,b){return(parseInt($(a).text(),10)>parseInt($(b).text(),10)?1:-1)*inverse;},auto:function(a,b){a=$(a).text();b=$(b).text();return(((isNaN(a)||isNaN(b))?a>b:+a>+b)?-1:1)*inverse;}};return function(comparator,order,getSortable){getSortable=getSortable||function(){return this;};comparator=(typeof comparator=="function")?comparator:defComp[comparator];inverse=order?((order>0)?1:-1):1;var placements=this.map(function(){var sortElement=getSortable.call(this),parentNode=sortElement.parentNode,nextSibling=parentNode.insertBefore(document.createTextNode(""),sortElement.nextSibling);return function(){if(parentNode===this){throw new Error("You can't sort elements if any one is a descendant of another.");}parentNode.insertBefore(this,nextSibling);parentNode.removeChild(nextSibling);};});return sort.call(this,comparator).each(function(i){placements[i].call(getSortable.call(this));});};}());function breakLongWords(text,len){return String(text).replace(new RegExp("(\\w{"+len+"})","g"),"$1&#x200B;");}var fireEvent=function(element,event){var evt;if(!element||typeof element!="object"){return false;}if(document.createEventObject){evt=document.createEventObject();return element.fireEvent("on"+event,evt);}else{evt=document.createEvent("HTMLEvents");evt.initEvent(event,true,true);return !element.dispatchEvent(evt);}};function printHtml(value,css,handlers){var div=$("<div></div>").addClass("my-print-div").html(value).appendTo("body"),lnk=false,onPrintEnd=function(evt){alert("hey "+evt.type);if(lnk){lnk.remove();}$("body").unbind("mousemove focusin",onPrintEnd);if(handlers&&handlers.after){handlers.after();}div.remove();};if(css){lnk=$("<link/>").attr({href:css,rel:"stylesheet",type:"text/css",media:"print"}).appendTo("head");}if(handlers&&handlers.before){handlers.before();}window.print();$("body").bind("focusin",onPrintEnd);}
