﻿var MUtils=new Object();MUtils.AttachEvent=function(obj,dp,dL){if(obj.attachEvent){obj.attachEvent("on"+dp,dL);}else if(obj.addEventListener){obj.addEventListener(dp,dL,false);}else{obj["on"+dp]=dL;}};MUtils.iU=function(obj,dp,dL){if(obj.detachEvent){obj.detachEvent("on"+dp,dL);}else if(obj.removeEventListener){obj.removeEventListener(dp,dL,true);}else{obj["on"+dp]=null;}};MUtils.hz=function(e){if(!e)var e=window.event;if(e.stopPropagation){e.stopPropagation();e.preventDefault();}else{e.cancelBubble=true;e.returnValue=false;}return false;};MUtils.SpliceArgs=function(){return Function.prototype.call.apply(Array.prototype.slice,arguments)};MUtils.callbackArgs=function(obj,method){var c=MUtils.SpliceArgs(arguments,2);return function(){return method.apply(obj,c)}};MUtils.gG=function(){var x=null;try{x=new XMLHttpRequest();}catch(e){try{x=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{x=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}}return x;};MUtils.ck=function(url,onload){var x=MUtils.gG();if(x==null){alert("Your browser does not support AJAX!");return;}x.onreadystatechange=function(){var fy=false;try{if(x.readyState==4&&x.status==200){fy=true;}}catch(e){}if(fy)onload(x);};x.open("GET",url,true);x.send(null);return x;};MUtils.LoadScript=function(id,url){if($(id)[0])return;var s=document.createElement('script');s.id=id;s.type='text/javascript';s.src=url;document.body.appendChild(s);};function Event(){this.dA=new Array();};Event.prototype.subscribe=function(ff){this.dA.push(ff);};Event.prototype.iY=function(ff){for(var i=this.dA.length-1;i>=0;i--){if(this.dA[i]==ff){this.dA.splice(i,1);break;}}};Event.prototype.raise=function(bI){for(var i=0;i<this.dA.length;i++){this.dA[i](bI);}};MUtils.cc=function(ct,className){if(typeof ct.className!="undefined"){var cF=ct.className.split(' ');if(cF[0]=='')cF.splice(0,1);for(var i=0;i<cF.length;i++){if(cF[i]==className){return;}}cF.push(className);ct.className=cF.join(' ');}else{ct.className=className;}};MUtils.bZ=function(ct,className){if(typeof ct.className!="undefined"){var cF=ct.className.split(' ');if(cF[0]=='')cF.splice(0,1);for(var i=cF.length-1;i>=0;i--){if(cF[i]==className){cF.splice(i,1);break;}}ct.className=cF.join(' ');}};MUtils.iI=function(ct,className){ct.className=className;};MUtils.je=function(ct,gV,gR){ct.style[gV]=gR;};MUtils.gN=function(fP,hs){for(var du in fP){hs[du]=fP[du];}};MUtils.Clone=function(obj){var o=new Object();MUtils.gN(obj,o);return o;};MUtils.GetInnerWindowSize=function(){var x,y;if(self.innerHeight){x=self.innerWidth;y=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){x=document.documentElement.clientWidth;y=document.documentElement.clientHeight;}else if(document.body){x=document.body.clientWidth;y=document.body.clientHeight;}return{x:x,y:y}};MUtils.gd=function(ct){var cT=ct.style;var gQ=cT.visibility;var gP=cT.position;var gz=cT.display;cT.visibility='hidden';cT.display='block';var originalWidth=ct.clientWidth;var dh=ct.clientHeight;cT.display=gz;cT.position=gP;cT.visibility=gQ;return{width:originalWidth,height:dh};};MUtils.IsMouseLeaveOrEnter=function(e,gf){if(e.type!='mouseout'&&e.type!='mouseover')return false;var dT=e.relatedTarget?e.relatedTarget:e.type=='mouseout'?e.toElement:e.fromElement;while(dT&&dT!=gf)dT=dT.parentNode;return(dT!=gf);};MUtils.bA=function(e){if(e&&e.keyCode==13){return true;}return false;};MUtils.IsTextChangeKeyCode=function(e){var is=false;if(e){var c=e.keyCode;if(c==9||c==13||(c>=16&&c<=20)||c==27||(c>=33&&c<=40)||c==91||c==92||c==93||(c>=112&&c<=123)||c==182||c==183||c==144||c==145){is=false;}else{is=true;}}return is;};MUtils.createCookie=function(name,value,fI){if(fI){var date=new Date();date.setTime(date.getTime()+(fI*24*60*60*1000));var expires="; expires="+date.toGMTString();}else var expires="";document.cookie=name+"="+value+expires+"; path=/";};MUtils.readCookie=function(name){var fE=name+"=";var fR=document.cookie.split(';');for(var i=0;i<fR.length;i++){var c=fR[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(fE)==0)return c.substring(fE.length,c.length);}return null;};MUtils.gI=function(name){MUtils.createCookie(name,"",-1);};MUtils.getUrlParam=function(name){name=name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");var regexS="[\\?&]"+name+"=([^&#]*)";var regex=new RegExp(regexS);var results=regex.exec(window.location.href);if(results==null)return null;else return results[1];};MUtils.formatHelp=function(help){var split=help.split("&-&");helpTitle=split[0];helpText=split[1];var text="";text+="<h1>"+helpTitle+"</h1>";text+="<hr class=\"dotted_bottom\"/>"+helpText;return text;};MUtils.preparePrint=function(which){if(typeof(which)!=undefined){var urlSplit=location.href.split('#');var url=urlSplit[0];var hash=urlSplit.length>1?urlSplit[1]:"";var printUrl=url+'?print='+which+'#'+hash;window.open(printUrl,'print','width=800,height=600,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,resizable=yes');}};var cs=20;var bY;var ee=Math.PI;var move=1;var divide=2;var dY=10;var dh=0;MUtils.eG=function(collapse,ia,height,cq){var div=$('#'+ia)[0];bY=cs-1;dh=height;if(collapse){div.style.height=dh+"px";hide(div,cs,cq);}else{div.style.height="0px";div.style.display="";show(div,cs,cq);}};function hide(div,bY,cq){div.style.display="none";if(cq){cq();}};function show(div,bY,cq){div.style.height=dh+"px";if(cq){cq();}};Date.prototype.toYYYYMMDDString=function(){return isNaN(this)?'NaN':[this.getFullYear(),this.getMonth()>8?this.getMonth()+1:'0'+(this.getMonth()+1),this.getDate()>9?this.getDate():'0'+this.getDate()].join('-');};Date.prototype.toHHMMString=function(){return isNaN(this)?'NaN':[this.getHours()>9?this.getHours():'0'+this.getHours(),this.getMinutes()>9?this.getMinutes():'0'+this.getMinutes()].join(':');}