// START OF MESSAGE SCRIPT //

var MSGTIMER = 5;
var MSGSPEED = 100;
var MSGOFFSET = -1;
var MSGHIDE = 3;
var oldtarget="";

// build out the divs, set attributes and call the fade function //
function inlineMsg(target,type,autohide,string) 
{
	//alert("cocuou");
	
	var msg;
	var msgcontent;
	msg = document.getElementById('msgtoto');
	msgcontent = document.getElementById('msgcontent');
	consoleinfo("inlineMsg:"+target+"-"+type+"-"+string+"-msg.classname:"+msg.className+"-oldtarget:"+oldtarget);	
	
	if((document.getElementById(target+'_ok').style.display=="none" && msg.className=="msg2") ||  target==oldtarget)
	{	
	  	oldtarget=target;
		msg.className="msg"+type;
	  	msgcontent.className="msgcontent"+type;
	  	
	  	/*if(!document.getElementById('msg')) 
		{
		    msg = document.createElement('div');
		    msg.id = 'msg';
		    msg.className="msg"+type;
		    msgcontent = document.createElement('div');
		    msgcontent.id = 'msgcontent';
		    msgcontent.className="msgcontent"+type;
		    document.body.appendChild(msg);
		    msg.appendChild(msgcontent);
		    msg.style.filter = 'alpha(opacity=0)';
		    msg.style.opacity = 0;
		    msg.alpha = 0;
		} 
		else 
		{
		 	msg = document.getElementById('msg');
			msg.className="msg"+type;
			if(!document.getElementById('msgcontent')) 
			{
				msgcontent = document.createElement('div');
		    	msgcontent.id = 'msgcontent';
		    	msgcontent.className="msgcontent"+type;
		    	msg.appendChild(msgcontent);
			}
			else
			{
		    	msgcontent = document.getElementById('msgcontent');
				msgcontent.className="msgcontent"+type;
			}
		}*/
	  	//consoleinfo(type);
	  	if(string=="" || string==null)
	  	{
		  	if(type==1)
		  	{
				msgcontent.innerHTML = document.getElementById(target+'_error').innerHTML;
				document.getElementById(target).style.backgroundColor="#FBD4D7";
		  	}
			else
			{
				msgcontent.innerHTML = document.getElementById(target+'_comment').innerHTML;
				document.getElementById(target).style.backgroundColor="#ffffff";
			}
	  	}
	  	else
	  	{
			if(type==1)
		  	{
		  		document.getElementById(target).style.backgroundColor="#FBD4D7";	
		  	}
		  	else
		  	{
		  		document.getElementById(target).style.backgroundColor="#ffffff";
		  	}
	  		msgcontent.innerHTML = string;
	  	}
		msg.style.display = 'block';
		var msgheight = msg.offsetHeight;
		
		
		var el =Ext.get(target);
		var targetheight = el.getHeight();
		var targetwidth = el.getWidth();
		
		var topposition = el.getTop() - ((msgheight - targetheight) / 2);
		var leftposition = el.getLeft() + targetwidth + MSGOFFSET;
		
		/*var targetdiv = document.getElementById(target);
		//targetdiv.focus();
		var targetheight = targetdiv.offsetHeight;
		var targetwidth = targetdiv.offsetWidth;
		var topposition = topPosition(targetdiv) - ((msgheight - targetheight) / 2);
		var leftposition = leftPosition(targetdiv) + targetwidth + MSGOFFSET;*/
		msg.style.top = topposition + 'px';
		msg.style.left = leftposition + 'px';

		clearInterval(msg.timer);
		msg.timer = setInterval("fadeMsg(1)", MSGTIMER);
		if(!autohide) 
		{
			autohide = MSGHIDE;  
	  	}
	  	window.setTimeout("hideMsg()", (autohide * 1000));
	}
	else
	{
		try
		{
			var targetdiv = document.getElementById(oldtarget);
			//targetdiv.focus();
			consoleinfo("inlineMsg il y avait une erreur avant oldtarget: "+oldtarget);
			msgcontent.innerHTML = document.getElementById(oldtarget+'_error').innerHTML;
			document.getElementById(oldtarget).style.backgroundColor="#FBD4D7";
			msgcontent.className="msgcontent1";
			msg.className="msg1";
		}
		catch(e)
		{
			consoleinfo("inlineMsg firsttime");
		}
	}
}

// hide the form alert //
function hideMsg(msg) {
  var msg = document.getElementById('msgtoto');
  if(!msg.timer) {
    msg.timer = setInterval("fadeMsg(0)", MSGTIMER);
  }
}

// face the message box //
function fadeMsg(flag) {
  if(flag == null) {
    flag = 1;
  }
  var msg = document.getElementById('msgtoto');
  var value;
  if(flag == 1) {
    value = msg.alpha + MSGSPEED;
  } else {
    value = msg.alpha - MSGSPEED;
  }
  msg.alpha = value;
  msg.style.opacity = (value / 100);
  msg.style.filter = 'alpha(opacity=' + value + ')';
  if(value >= 99) {
    clearInterval(msg.timer);
    msg.timer = null;
  } else if(value <= 1) {
    msg.style.display = "none";
    clearInterval(msg.timer);
  }
}

// calculate the position of the element in relation to the left of the browser //
function leftPosition(target) {
  var left = 0;
  if(target.offsetParent) {
    while(1) {
      left += target.offsetLeft;
      if(!target.offsetParent) {
        break;
      }
      target = target.offsetParent;
    }
  } else if(target.x) {
    left += target.x;
  }
  return left;
}

// calculate the position of the element in relation to the top of the browser window //
function topPosition(target) {
  var top = 0;
  if(target.offsetParent) {
    while(1) {
      top += target.offsetTop;
      if(!target.offsetParent) {
        break;
      }
      target = target.offsetParent;
    }
  } else if(target.y) {
    top += target.y;
  }
  return top;
}

// preload the arrow //
/*if(document.images) {
  arrow = new Image(7,80); 
  arrow.src = "images/TURFEZ/msg_arrow.gif"; 
}*/

function debug(str)
{
	consoleerror(str);
}

function viewAbout(defaultapi)
{
	consoleinfo(1);
	var omyajax=new myajax();
	omyajax.setrequestheader("ABOUT","GETABOUT","templates");
	omyajax.setparams("mainaction","ABOUT");
	if (defaultapi!="")
	{
		omyajax.setparams("defaultmainaction","ABOUT");
		omyajax.setparams("defaultminoraction",defaultapi);
	}
	consoleinfo(2);
	windowOpener("about:blank","info","height=700,width=776,status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=1");
	consoleinfo(3);
	document.aboutfrm.msg.value=omyajax.getmsg();
	consoleinfo(4);
	document.aboutfrm.submit();
	try{pageTracker._trackEvent('Navigation', 'About');}catch(e){}
}


function viewHelp(defaultapi)
{
	
	var omyajax=new myajax();
	omyajax.setrequestheader("HELP","GETHELP","templates");
	omyajax.setparams("mainaction","HELP");
	if (defaultapi!="")
	{
		omyajax.setparams("defaultmainaction","HELP");
		omyajax.setparams("defaultminoraction",defaultapi);
	}
	windowOpener("about:blank","info","height=700,width=776,status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=1");
	document.helpfrm.msg.value=omyajax.getmsg();
	document.helpfrm.submit();
	try{pageTracker._trackEvent('Navigation', 'Help');}catch(e){}
}

function forgotPassword()
{
	
	var omyajax=new myajax();
	omyajax.setrequestheader("ACCOUNTSECURE","GETFORGOTPASSWORDUSERNAME","templates");
	windowOpener("about:blank","my_account","height=900,width=650,status=no,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=0");
	document.forgotme.msg.value=omyajax.getmsg();
	document.forgotme.submit();
	try{pageTracker._trackEvent('Client', 'Forgot Password');}catch(e){}
}

function viewAccount()
{
	
	var omyajax=new myajax();
	omyajax.setrequestheader("ACCOUNT","GETMYACCOUNT","templates");
	omyajax.setparams("defaultpathconnection","CLIENTSECURE");
	omyajax.setparams("defaultmainaction","ACCOUNTSECURE");
	omyajax.setparams("defaultminoraction","ACCOUNTSUMMARY");
	omyajax.setparams("defaulttemplatenumber",1);
	windowOpener("about:blank","my_account","height=700,width=776,status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes");
	document.myaccountmesecure.msg.value=omyajax.getmsg();
	document.myaccountmesecure.submit();
	try{pageTracker._trackEvent('Client', 'View Account');}catch(e){}
}

function viewCashier()
{
	
	var omyajax=new myajax();
	omyajax.setrequestheader("ACCOUNT","GETCASHIER","templates");
	omyajax.setparams("defaultpathconnection","CLIENTSECURE");
	omyajax.setparams("defaultmainaction","CASHIER");
	omyajax.setparams("defaultminoraction","GETDEPOSITCC");
	omyajax.setparams("defaulttemplatenumber",1);
	windowOpener("about:blank","my_account","fullscreen=yes,status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes");
	/*windowOpener("about:blank","my_account","height=700,width=776,status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes");*/
	document.myaccountmesecure.msg.value=omyajax.getmsg();
	document.myaccountmesecure.submit();
	try{pageTracker._trackEvent('Cashier', 'Cashier_request');}catch(e){}
}

function inviteRefer()
{
	if(conn.getvariable("providertype")!="GU")
	{
		var omyajax=new myajax();
		omyajax.setrequestheader("ACCOUNT","GETMYACCOUNT","templates");
		omyajax.setparams("defaultpathconnection","CLIENTSECURE");
		omyajax.setparams("defaultmainaction","ACCOUNTSECURE");
		omyajax.setparams("defaultminoraction","GETINVITEFRIEND");
		omyajax.setparams("defaulttemplatenumber",1);
		windowOpener("about:blank","my_account","height=700,width=776,status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes");
		document.myaccountmesecure.msg.value=omyajax.getmsg();
		document.myaccountmesecure.submit();
		try{pageTracker._trackEvent('Signup', 'inviteafriend_request');}catch(e){}
	}
	else
	{
		alert(otransJS.translate("youhavetosubscribetoenjoythisoption"));
		gojoin('inviteRefer');
	}
}

/*function viewdeposit(fromto)
{
	loadmenulinksecure("CASHIER","GETDEPOSIT","template",1,otransJS.translate("deposit"));
	try{pageTracker._trackEvent('Cashier', 'Deposit_request_'+fromto);}catch(e){}
}

function getbettingguide()
{
	hidehomeeast3();
	loadmenulink('HELP','GETBETTINGGUIDES','templates',1,otransJS.translate('bettingguides'));
	try{pageTracker._trackEvent('Navigation', 'Betting Guide');}catch(e){}
}*/

function showloading()
{
	document.getElementById("loadingmask").style.display="";
}

function hideloading()
{
	document.getElementById("loadingmask").style.display="none";
}


var popupWins = new Array();

function windowOpener(url, name, args) 
{
	try
	{
		if ( popupWins[name]==null  || typeof( popupWins[name] ) != "object"   )
			popupWins[name] = window.open(url,name,args);
		else 
		{
			if (!popupWins[name].closed)
				popupWins[name].location.href = url;
			else 
				popupWins[name] = window.open(url, name,args);
		}
	}
	catch(e)
	{
		try
		{
			popupWins[name] = window.open(url,name,args);
		}
		catch(e)
		{
			window.open(url,name,args);
		}
	}
	try
	{
		popupWins[name].focus();
	}
	catch(e){}
}

function openme(url,name,w,h)
{
	var param="height="+h+",width="+w+",status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=0";
	windowOpener(url,name,param);
}

function MM_openBrWindow(theURL,winName,features) 
{
	window.open(theURL,winName,features);
}

Ext={};window["undefined"]=window["undefined"];Ext.apply=function(o,c,_3){if(_3){Ext.apply(o,_3);}if(o&&c&&typeof c=="object"){for(var p in c){o[p]=c[p];}}return o;};(function(){var _5=0;var ua=navigator.userAgent.toLowerCase();var _7=document.compatMode=="CSS1Compat",_8=ua.indexOf("opera")>-1,_9=(/webkit|khtml/).test(ua),_a=ua.indexOf("msie")>-1,_b=ua.indexOf("msie 7")>-1,_c=!_9&&ua.indexOf("gecko")>-1,_d=_a&&!_7,_e=(ua.indexOf("windows")!=-1||ua.indexOf("win32")!=-1),_f=(ua.indexOf("macintosh")!=-1||ua.indexOf("mac os x")!=-1),_10=(ua.indexOf("linux")!=-1),_11=window.location.href.toLowerCase().indexOf("https")===0;if(_a&&!_b){try{document.execCommand("BackgroundImageCache",false,true);}catch(e){}}Ext.apply(Ext,{isStrict:_7,isSecure:_11,isReady:false,enableGarbageCollector:true,enableListenerCollection:false,SSL_SECURE_URL:"javascript:false",BLANK_IMAGE_URL:"http:/"+"/extjs.com/s.gif",emptyFn:function(){},applyIf:function(o,c){if(o&&c){for(var p in c){if(typeof o[p]=="undefined"){o[p]=c[p];}}}return o;},addBehaviors:function(o){if(!Ext.isReady){Ext.onReady(function(){Ext.addBehaviors(o);});return;}var _16={};for(var b in o){var _18=b.split("@");if(_18[1]){var s=_18[0];if(!_16[s]){_16[s]=Ext.select(s);}_16[s].on(_18[1],o[b]);}}_16=null;},id:function(el,_1b){_1b=_1b||"ext-gen";el=Ext.getDom(el);var id=_1b+(++_5);return el?(el.id?el.id:(el.id=id)):id;},extend:function(){var io=function(o){for(var m in o){this[m]=o[m];}};return function(sb,sp,_22){if(typeof sp=="object"){_22=sp;sp=sb;sb=function(){sp.apply(this,arguments);};}var F=function(){},sbp,spp=sp.prototype;F.prototype=spp;sbp=sb.prototype=new F();sbp.constructor=sb;sb.superclass=spp;if(spp.constructor==Object.prototype.constructor){spp.constructor=sp;}sb.override=function(o){Ext.override(sb,o);};sbp.override=io;Ext.override(sb,_22);return sb;};}(),override:function(_27,_28){if(_28){var p=_27.prototype;for(var _2a in _28){p[_2a]=_28[_2a];}}},namespace:function(){var a=arguments,o=null,i,j,d,rt;for(i=0;i<a.length;++i){d=a[i].split(".");rt=d[0];eval("if (typeof "+rt+" == \"undefined\"){"+rt+" = {};} o = "+rt+";");for(j=1;j<d.length;++j){o[d[j]]=o[d[j]]||{};o=o[d[j]];}}},urlEncode:function(o){if(!o){return"";}var buf=[];for(var key in o){var ov=o[key];var _35=typeof ov;if(_35=="undefined"){buf.push(encodeURIComponent(key),"=&");}else{if(_35!="function"&&_35!="object"){buf.push(encodeURIComponent(key),"=",encodeURIComponent(ov),"&");}else{if(ov instanceof Array){for(var i=0,len=ov.length;i<len;i++){buf.push(encodeURIComponent(key),"=",encodeURIComponent(ov[i]===undefined?"":ov[i]),"&");}}}}}buf.pop();return buf.join("");},urlDecode:function(_38,_39){if(!_38||!_38.length){return{};}var obj={};var _3b=_38.split("&");var _3c,_3d,_3e;for(var i=0,len=_3b.length;i<len;i++){_3c=_3b[i].split("=");_3d=decodeURIComponent(_3c[0]);_3e=decodeURIComponent(_3c[1]);if(_39!==true){if(typeof obj[_3d]=="undefined"){obj[_3d]=_3e;}else{if(typeof obj[_3d]=="string"){obj[_3d]=[obj[_3d]];obj[_3d].push(_3e);}else{obj[_3d].push(_3e);}}}else{obj[_3d]=_3e;}}return obj;},each:function(_41,fn,_43){if(typeof _41.length=="undefined"||typeof _41=="string"){_41=[_41];}for(var i=0,len=_41.length;i<len;i++){if(fn.call(_43||_41[i],_41[i],i,_41)===false){return i;}}},combine:function(){var as=arguments,l=as.length,r=[];for(var i=0;i<l;i++){var a=as[i];if(a instanceof Array){r=r.concat(a);}else{if(a.length!==undefined&&!a.substr){r=r.concat(Array.prototype.slice.call(a,0));}else{r.push(a);}}}return r;},escapeRe:function(s){return s.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1");},callback:function(cb,_4d,_4e,_4f){if(typeof cb=="function"){if(_4f){cb.defer(_4f,_4d,_4e||[]);}else{cb.apply(_4d,_4e||[]);}}},getDom:function(el){if(!el){return null;}return el.dom?el.dom:(typeof el=="string"?document.getElementById(el):el);},getCmp:function(id){return Ext.ComponentMgr.get(id);},num:function(v,_53){if(typeof v!="number"){return _53;}return v;},destroy:function(){for(var i=0,a=arguments,len=a.length;i<len;i++){var as=a[i];if(as){if(as.dom){as.removeAllListeners();as.remove();continue;}if(typeof as.purgeListeners=="function"){as.purgeListeners();}if(typeof as.destroy=="function"){as.destroy();}}}},type:function(o){if(o===undefined||o===null){return false;}if(o.htmlElement){return"element";}var t=typeof o;if(t=="object"&&o.nodeName){switch(o.nodeType){case 1:return"element";case 3:return(/\S/).test(o.nodeValue)?"textnode":"whitespace";}}if(t=="object"||t=="function"){switch(o.constructor){case Array:return"array";case RegExp:return"regexp";}if(typeof o.length=="number"&&typeof o.item=="function"){return"nodelist";}}return t;},isEmpty:function(v,_5b){return v===null||v===undefined||(!_5b?v==="":false);},isOpera:_8,isSafari:_9,isIE:_a,isIE7:_b,isGecko:_c,isBorderBox:_d,isWindows:_e,isLinux:_10,isMac:_f,useShims:((_a&&!_b)||(_c&&_f))});})();Ext.namespace("Ext","Ext.util","Ext.grid","Ext.dd","Ext.tree","Ext.data","Ext.form","Ext.menu","Ext.state","Ext.lib","Ext.layout","Ext.app","Ext.ux");Ext.apply(Function.prototype,{createCallback:function(){var _5c=arguments;var _5d=this;return function(){return _5d.apply(window,_5c);};},createDelegate:function(obj,_5f,_60){var _61=this;return function(){var _62=_5f||arguments;if(_60===true){_62=Array.prototype.slice.call(arguments,0);_62=_62.concat(_5f);}else{if(typeof _60=="number"){_62=Array.prototype.slice.call(arguments,0);var _63=[_60,0].concat(_5f);Array.prototype.splice.apply(_62,_63);}}return _61.apply(obj||window,_62);};},defer:function(_64,obj,_66,_67){var fn=this.createDelegate(obj,_66,_67);if(_64){return setTimeout(fn,_64);}fn();return 0;},createSequence:function(fcn,_6a){if(typeof fcn!="function"){return this;}var _6b=this;return function(){var _6c=_6b.apply(this||window,arguments);fcn.apply(_6a||this||window,arguments);return _6c;};},createInterceptor:function(fcn,_6e){if(typeof fcn!="function"){return this;}var _6f=this;return function(){fcn.target=this;fcn.method=_6f;if(fcn.apply(_6e||this||window,arguments)===false){return;}return _6f.apply(this||window,arguments);};}});Ext.applyIf(String,{escape:function(_70){return _70.replace(/('|\\)/g,"\\$1");},leftPad:function(val,_72,ch){var _74=new String(val);if(ch===null||ch===undefined||ch===""){ch=" ";}while(_74.length<_72){_74=ch+_74;}return _74;},format:function(_75){var _76=Array.prototype.slice.call(arguments,1);return _75.replace(/\{(\d+)\}/g,function(m,i){return _76[i];});}});String.prototype.toggle=function(_79,_7a){return this==_79?_7a:_79;};Ext.applyIf(Number.prototype,{constrain:function(min,max){return Math.min(Math.max(this,min),max);}});Ext.applyIf(Array.prototype,{indexOf:function(o){for(var i=0,len=this.length;i<len;i++){if(this[i]==o){return i;}}return-1;},remove:function(o){var _81=this.indexOf(o);if(_81!=-1){this.splice(_81,1);}}});Date.prototype.getElapsed=function(_82){return Math.abs((_82||new Date()).getTime()-this.getTime());};
(function(){var _1;Ext.lib.Dom={getViewWidth:function(_2){return _2?this.getDocumentWidth():this.getViewportWidth();},getViewHeight:function(_3){return _3?this.getDocumentHeight():this.getViewportHeight();},getDocumentHeight:function(){var _4=(document.compatMode!="CSS1Compat")?document.body.scrollHeight:document.documentElement.scrollHeight;return Math.max(_4,this.getViewportHeight());},getDocumentWidth:function(){var _5=(document.compatMode!="CSS1Compat")?document.body.scrollWidth:document.documentElement.scrollWidth;return Math.max(_5,this.getViewportWidth());},getViewportHeight:function(){var _6=self.innerHeight;var _7=document.compatMode;if((_7||Ext.isIE)&&!Ext.isOpera){_6=(_7=="CSS1Compat")?document.documentElement.clientHeight:document.body.clientHeight;}return _6;},getViewportWidth:function(){var _8=self.innerWidth;var _9=document.compatMode;if(_9||Ext.isIE){_8=(_9=="CSS1Compat")?document.documentElement.clientWidth:document.body.clientWidth;}return _8;},isAncestor:function(p,c){p=Ext.getDom(p);c=Ext.getDom(c);if(!p||!c){return false;}if(p.contains&&!Ext.isSafari){return p.contains(c);}else{if(p.compareDocumentPosition){return!!(p.compareDocumentPosition(c)&16);}else{var _c=c.parentNode;while(_c){if(_c==p){return true;}else{if(!_c.tagName||_c.tagName.toUpperCase()=="HTML"){return false;}}_c=_c.parentNode;}return false;}}},getRegion:function(el){return Ext.lib.Region.getRegion(el);},getY:function(el){return this.getXY(el)[1];},getX:function(el){return this.getXY(el)[0];},getXY:function(el){var p,pe,b,_14,bd=document.body;el=Ext.getDom(el);if(el.getBoundingClientRect){b=el.getBoundingClientRect();_14=fly(document).getScroll();return[b.left+_14.left,b.top+_14.top];}var x=0,y=0;p=el;var _18=fly(el).getStyle("position")=="absolute";while(p){x+=p.offsetLeft;y+=p.offsetTop;if(!_18&&fly(p).getStyle("position")=="absolute"){_18=true;}if(Ext.isGecko){pe=fly(p);var bt=parseInt(pe.getStyle("borderTopWidth"),10)||0;var bl=parseInt(pe.getStyle("borderLeftWidth"),10)||0;x+=bl;y+=bt;if(p!=el&&pe.getStyle("overflow")!="visible"){x+=bl;y+=bt;}}p=p.offsetParent;}if(Ext.isSafari&&_18){x-=bd.offsetLeft;y-=bd.offsetTop;}if(Ext.isGecko&&!_18){var dbd=fly(bd);x+=parseInt(dbd.getStyle("borderLeftWidth"),10)||0;y+=parseInt(dbd.getStyle("borderTopWidth"),10)||0;}p=el.parentNode;while(p&&p!=bd){if(!(Ext.isOpera&&p.tagName!="TR"&&fly(p).getStyle("display")!="inline")){x-=p.scrollLeft;y-=p.scrollTop;}p=p.parentNode;}return[x,y];},setXY:function(el,xy){el=Ext.fly(el,"_setXY");el.position();var pts=el.translatePoints(xy);if(xy[0]!==false){el.dom.style.left=pts.left+"px";}if(xy[1]!==false){el.dom.style.top=pts.top+"px";}},setX:function(el,x){this.setXY(el,[x,false]);},setY:function(el,y){this.setXY(el,[false,y]);}};Ext.lib.Event=function(){var _23=false;var _24=[];var _25=[];var _26=0;var _27=[];var _28=0;var _29=null;return{POLL_RETRYS:200,POLL_INTERVAL:20,EL:0,TYPE:1,FN:2,WFN:3,OBJ:3,ADJ_SCOPE:4,_interval:null,startInterval:function(){if(!this._interval){var _2a=this;var _2b=function(){_2a._tryPreloadAttach();};this._interval=setInterval(_2b,this.POLL_INTERVAL);}},onAvailable:function(_2c,_2d,_2e,_2f){_27.push({id:_2c,fn:_2d,obj:_2e,override:_2f,checkReady:false});_26=this.POLL_RETRYS;this.startInterval();},addListener:function(el,_31,fn){el=Ext.getDom(el);if(!el||!fn){return false;}if("unload"==_31){_25[_25.length]=[el,_31,fn];return true;}var _33=function(e){return fn(Ext.lib.Event.getEvent(e));};var li=[el,_31,fn,_33];var _36=_24.length;_24[_36]=li;this.doAdd(el,_31,_33,false);return true;},removeListener:function(el,_38,fn){var i,len;el=Ext.getDom(el);if(!fn){return this.purgeElement(el,false,_38);}if("unload"==_38){for(i=0,len=_25.length;i<len;i++){var li=_25[i];if(li&&li[0]==el&&li[1]==_38&&li[2]==fn){_25.splice(i,1);return true;}}return false;}var _3d=null;var _3e=arguments[3];if("undefined"==typeof _3e){_3e=this._getCacheIndex(el,_38,fn);}if(_3e>=0){_3d=_24[_3e];}if(!el||!_3d){return false;}this.doRemove(el,_38,_3d[this.WFN],false);delete _24[_3e][this.WFN];delete _24[_3e][this.FN];_24.splice(_3e,1);return true;},getTarget:function(ev,_40){ev=ev.browserEvent||ev;var t=ev.target||ev.srcElement;return this.resolveTextNode(t);},resolveTextNode:function(_42){if(Ext.isSafari&&_42&&3==_42.nodeType){return _42.parentNode;}else{return _42;}},getPageX:function(ev){ev=ev.browserEvent||ev;var x=ev.pageX;if(!x&&0!==x){x=ev.clientX||0;if(Ext.isIE){x+=this.getScroll()[1];}}return x;},getPageY:function(ev){ev=ev.browserEvent||ev;var y=ev.pageY;if(!y&&0!==y){y=ev.clientY||0;if(Ext.isIE){y+=this.getScroll()[0];}}return y;},getXY:function(ev){ev=ev.browserEvent||ev;return[this.getPageX(ev),this.getPageY(ev)];},getRelatedTarget:function(ev){ev=ev.browserEvent||ev;var t=ev.relatedTarget;if(!t){if(ev.type=="mouseout"){t=ev.toElement;}else{if(ev.type=="mouseover"){t=ev.fromElement;}}}return this.resolveTextNode(t);},getTime:function(ev){ev=ev.browserEvent||ev;if(!ev.time){var t=new Date().getTime();try{ev.time=t;}catch(ex){this.lastError=ex;return t;}}return ev.time;},stopEvent:function(ev){this.stopPropagation(ev);this.preventDefault(ev);},stopPropagation:function(ev){ev=ev.browserEvent||ev;if(ev.stopPropagation){ev.stopPropagation();}else{ev.cancelBubble=true;}},preventDefault:function(ev){ev=ev.browserEvent||ev;if(ev.preventDefault){ev.preventDefault();}else{ev.returnValue=false;}},getEvent:function(e){var ev=e||window.event;if(!ev){var c=this.getEvent.caller;while(c){ev=c.arguments[0];if(ev&&Event==ev.constructor){break;}c=c.caller;}}return ev;},getCharCode:function(ev){ev=ev.browserEvent||ev;return ev.charCode||ev.keyCode||0;},_getCacheIndex:function(el,_54,fn){for(var i=0,len=_24.length;i<len;++i){var li=_24[i];if(li&&li[this.FN]==fn&&li[this.EL]==el&&li[this.TYPE]==_54){return i;}}return-1;},elCache:{},getEl:function(id){return document.getElementById(id);},clearCache:function(){},_load:function(e){_23=true;var EU=Ext.lib.Event;if(Ext.isIE){EU.doRemove(window,"load",EU._load);}},_tryPreloadAttach:function(){if(this.locked){return false;}this.locked=true;var _5c=!_23;if(!_5c){_5c=(_26>0);}var _5d=[];for(var i=0,len=_27.length;i<len;++i){var _60=_27[i];if(_60){var el=this.getEl(_60.id);if(el){if(!_60.checkReady||_23||el.nextSibling||(document&&document.body)){var _62=el;if(_60.override){if(_60.override===true){_62=_60.obj;}else{_62=_60.override;}}_60.fn.call(_62,_60.obj);_27[i]=null;}}else{_5d.push(_60);}}}_26=(_5d.length===0)?0:_26-1;if(_5c){this.startInterval();}else{clearInterval(this._interval);this._interval=null;}this.locked=false;return true;},purgeElement:function(el,_64,_65){var _66=this.getListeners(el,_65);if(_66){for(var i=0,len=_66.length;i<len;++i){var l=_66[i];this.removeListener(el,l.type,l.fn);}}if(_64&&el&&el.childNodes){for(i=0,len=el.childNodes.length;i<len;++i){this.purgeElement(el.childNodes[i],_64,_65);}}},getListeners:function(el,_6b){var _6c=[],_6d;if(!_6b){_6d=[_24,_25];}else{if(_6b=="unload"){_6d=[_25];}else{_6d=[_24];}}for(var j=0;j<_6d.length;++j){var _6f=_6d[j];if(_6f&&_6f.length>0){for(var i=0,len=_6f.length;i<len;++i){var l=_6f[i];if(l&&l[this.EL]===el&&(!_6b||_6b===l[this.TYPE])){_6c.push({type:l[this.TYPE],fn:l[this.FN],obj:l[this.OBJ],adjust:l[this.ADJ_SCOPE],index:i});}}}}return(_6c.length)?_6c:null;},_unload:function(e){var EU=Ext.lib.Event,i,j,l,len,_79;for(i=0,len=_25.length;i<len;++i){l=_25[i];if(l){var _7a=window;if(l[EU.ADJ_SCOPE]){if(l[EU.ADJ_SCOPE]===true){_7a=l[EU.OBJ];}else{_7a=l[EU.ADJ_SCOPE];}}l[EU.FN].call(_7a,EU.getEvent(e),l[EU.OBJ]);_25[i]=null;l=null;_7a=null;}}_25=null;if(_24&&_24.length>0){j=_24.length;while(j){_79=j-1;l=_24[_79];if(l){EU.removeListener(l[EU.EL],l[EU.TYPE],l[EU.FN],_79);}j=j-1;}l=null;EU.clearCache();}EU.doRemove(window,"unload",EU._unload);},getScroll:function(){var dd=document.documentElement,db=document.body;if(dd&&(dd.scrollTop||dd.scrollLeft)){return[dd.scrollTop,dd.scrollLeft];}else{if(db){return[db.scrollTop,db.scrollLeft];}else{return[0,0];}}},doAdd:function(){if(window.addEventListener){return function(el,_7e,fn,_80){el.addEventListener(_7e,fn,(_80));};}else{if(window.attachEvent){return function(el,_82,fn,_84){el.attachEvent("on"+_82,fn);};}else{return function(){};}}}(),doRemove:function(){if(window.removeEventListener){return function(el,_86,fn,_88){el.removeEventListener(_86,fn,(_88));};}else{if(window.detachEvent){return function(el,_8a,fn){el.detachEvent("on"+_8a,fn);};}else{return function(){};}}}()};}();var E=Ext.lib.Event;E.on=E.addListener;E.un=E.removeListener;if(document&&document.body){E._load();}else{E.doAdd(window,"load",E._load);}E.doAdd(window,"unload",E._unload);E._tryPreloadAttach();Ext.lib.Ajax={request:function(_8d,uri,cb,_90,_91){if(_91){var hs=_91.headers;if(hs){for(var h in hs){if(hs.hasOwnProperty(h)){this.initHeader(h,hs[h],false);}}}if(_91.xmlData){this.initHeader("Content-Type","text/xml",false);_8d="POST";_90=_91.xmlData;}}return this.asyncRequest(_8d,uri,cb,_90);},serializeForm:function(_94){if(typeof _94=="string"){_94=(document.getElementById(_94)||document.forms[_94]);}var el,_96,val,_98,_99="",_9a=false;for(var i=0;i<_94.elements.length;i++){el=_94.elements[i];_98=_94.elements[i].disabled;_96=_94.elements[i].name;val=_94.elements[i].value;if(!_98&&_96){switch(el.type){case"select-one":case"select-multiple":for(var j=0;j<el.options.length;j++){if(el.options[j].selected){if(Ext.isIE){_99+=encodeURIComponent(_96)+"="+encodeURIComponent(el.options[j].attributes["value"].specified?el.options[j].value:el.options[j].text)+"&";}else{_99+=encodeURIComponent(_96)+"="+encodeURIComponent(el.options[j].hasAttribute("value")?el.options[j].value:el.options[j].text)+"&";}}}break;case"radio":case"checkbox":if(el.checked){_99+=encodeURIComponent(_96)+"="+encodeURIComponent(val)+"&";}break;case"file":case undefined:case"reset":case"button":break;case"submit":if(_9a==false){_99+=encodeURIComponent(_96)+"="+encodeURIComponent(val)+"&";_9a=true;}break;default:_99+=encodeURIComponent(_96)+"="+encodeURIComponent(val)+"&";break;}}}_99=_99.substr(0,_99.length-1);return _99;},headers:{},hasHeaders:false,useDefaultHeader:true,defaultPostHeader:"application/x-www-form-urlencoded",useDefaultXhrHeader:true,defaultXhrHeader:"XMLHttpRequest",hasDefaultHeaders:true,defaultHeaders:{},poll:{},timeout:{},pollInterval:50,transactionId:0,setProgId:function(id){this.activeX.unshift(id);},setDefaultPostHeader:function(b){this.useDefaultHeader=b;},setDefaultXhrHeader:function(b){this.useDefaultXhrHeader=b;},setPollingInterval:function(i){if(typeof i=="number"&&isFinite(i)){this.pollInterval=i;}},createXhrObject:function(_a1){var obj,_a3;try{_a3=new XMLHttpRequest();obj={conn:_a3,tId:_a1};}catch(e){for(var i=0;i<this.activeX.length;++i){try{_a3=new ActiveXObject(this.activeX[i]);obj={conn:_a3,tId:_a1};break;}catch(e){}}}finally{return obj;}},getConnectionObject:function(){var o;var tId=this.transactionId;try{o=this.createXhrObject(tId);if(o){this.transactionId++;}}catch(e){}finally{return o;}},asyncRequest:function(_a7,uri,_a9,_aa){var o=this.getConnectionObject();if(!o){return null;}else{o.conn.open(_a7,uri,true);if(this.useDefaultXhrHeader){if(!this.defaultHeaders["X-Requested-With"]){this.initHeader("X-Requested-With",this.defaultXhrHeader,true);}}if(_aa&&this.useDefaultHeader){this.initHeader("Content-Type",this.defaultPostHeader);}if(this.hasDefaultHeaders||this.hasHeaders){this.setHeader(o);}this.handleReadyState(o,_a9);o.conn.send(_aa||null);return o;}},handleReadyState:function(o,_ad){var _ae=this;if(_ad&&_ad.timeout){this.timeout[o.tId]=window.setTimeout(function(){_ae.abort(o,_ad,true);},_ad.timeout);}this.poll[o.tId]=window.setInterval(function(){if(o.conn&&o.conn.readyState==4){window.clearInterval(_ae.poll[o.tId]);delete _ae.poll[o.tId];if(_ad&&_ad.timeout){window.clearTimeout(_ae.timeout[o.tId]);delete _ae.timeout[o.tId];}_ae.handleTransactionResponse(o,_ad);}},this.pollInterval);},handleTransactionResponse:function(o,_b0,_b1){if(!_b0){this.releaseObject(o);return;}var _b2,_b3;try{if(o.conn.status!==undefined&&o.conn.status!=0){_b2=o.conn.status;}else{_b2=13030;}}catch(e){_b2=13030;}if(_b2>=200&&_b2<300){_b3=this.createResponseObject(o,_b0.argument);if(_b0.success){if(!_b0.scope){_b0.success(_b3);}else{_b0.success.apply(_b0.scope,[_b3]);}}}else{switch(_b2){case 12002:case 12029:case 12030:case 12031:case 12152:case 13030:_b3=this.createExceptionObject(o.tId,_b0.argument,(_b1?_b1:false));if(_b0.failure){if(!_b0.scope){_b0.failure(_b3);}else{_b0.failure.apply(_b0.scope,[_b3]);}}break;default:_b3=this.createResponseObject(o,_b0.argument);if(_b0.failure){if(!_b0.scope){_b0.failure(_b3);}else{_b0.failure.apply(_b0.scope,[_b3]);}}}}this.releaseObject(o);_b3=null;},createResponseObject:function(o,_b5){var obj={};var _b7={};try{var _b8=o.conn.getAllResponseHeaders();var _b9=_b8.split("\n");for(var i=0;i<_b9.length;i++){var _bb=_b9[i].indexOf(":");if(_bb!=-1){_b7[_b9[i].substring(0,_bb)]=_b9[i].substring(_bb+2);}}}catch(e){}obj.tId=o.tId;obj.status=o.conn.status;obj.statusText=o.conn.statusText;obj.getResponseHeader=_b7;obj.getAllResponseHeaders=_b8;obj.responseText=o.conn.responseText;obj.responseXML=o.conn.responseXML;if(typeof _b5!==undefined){obj.argument=_b5;}return obj;},createExceptionObject:function(tId,_bd,_be){var _bf=0;var _c0="communication failure";var _c1=-1;var _c2="transaction aborted";var obj={};obj.tId=tId;if(_be){obj.status=_c1;obj.statusText=_c2;}else{obj.status=_bf;obj.statusText=_c0;}if(_bd){obj.argument=_bd;}return obj;},initHeader:function(_c4,_c5,_c6){var _c7=(_c6)?this.defaultHeaders:this.headers;if(_c7[_c4]===undefined){_c7[_c4]=_c5;}else{_c7[_c4]=_c5+","+_c7[_c4];}if(_c6){this.hasDefaultHeaders=true;}else{this.hasHeaders=true;}},setHeader:function(o){if(this.hasDefaultHeaders){for(var _c9 in this.defaultHeaders){if(this.defaultHeaders.hasOwnProperty(_c9)){o.conn.setRequestHeader(_c9,this.defaultHeaders[_c9]);}}}if(this.hasHeaders){for(var _c9 in this.headers){if(this.headers.hasOwnProperty(_c9)){o.conn.setRequestHeader(_c9,this.headers[_c9]);}}this.headers={};this.hasHeaders=false;}},resetDefaultHeaders:function(){delete this.defaultHeaders;this.defaultHeaders={};this.hasDefaultHeaders=false;},abort:function(o,_cb,_cc){if(this.isCallInProgress(o)){o.conn.abort();window.clearInterval(this.poll[o.tId]);delete this.poll[o.tId];if(_cc){delete this.timeout[o.tId];}this.handleTransactionResponse(o,_cb,true);return true;}else{return false;}},isCallInProgress:function(o){if(o&&o.conn){return o.conn.readyState!=4&&o.conn.readyState!=0;}else{return false;}},releaseObject:function(o){o.conn=null;o=null;},activeX:["MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"]};Ext.lib.Region=function(t,r,b,l){this.top=t;this[1]=t;this.right=r;this.bottom=b;this.left=l;this[0]=l;};Ext.lib.Region.prototype={contains:function(_d3){return(_d3.left>=this.left&&_d3.right<=this.right&&_d3.top>=this.top&&_d3.bottom<=this.bottom);},getArea:function(){return((this.bottom-this.top)*(this.right-this.left));},intersect:function(_d4){var t=Math.max(this.top,_d4.top);var r=Math.min(this.right,_d4.right);var b=Math.min(this.bottom,_d4.bottom);var l=Math.max(this.left,_d4.left);if(b>=t&&r>=l){return new Ext.lib.Region(t,r,b,l);}else{return null;}},union:function(_d9){var t=Math.min(this.top,_d9.top);var r=Math.max(this.right,_d9.right);var b=Math.max(this.bottom,_d9.bottom);var l=Math.min(this.left,_d9.left);return new Ext.lib.Region(t,r,b,l);},adjust:function(t,l,b,r){this.top+=t;this.left+=l;this.right+=r;this.bottom+=b;return this;}};Ext.lib.Region.getRegion=function(el){var p=Ext.lib.Dom.getXY(el);var t=p[1];var r=p[0]+el.offsetWidth;var b=p[1]+el.offsetHeight;var l=p[0];return new Ext.lib.Region(t,r,b,l);};Ext.lib.Point=function(x,y){if(x instanceof Array){y=x[1];x=x[0];}this.x=this.right=this.left=this[0]=x;this.y=this.top=this.bottom=this[1]=y;};Ext.lib.Point.prototype=new Ext.lib.Region();Ext.lib.Anim={scroll:function(el,_eb,_ec,_ed,cb,_ef){this.run(el,_eb,_ec,_ed,cb,_ef,Ext.lib.Scroll);},motion:function(el,_f1,_f2,_f3,cb,_f5){this.run(el,_f1,_f2,_f3,cb,_f5,Ext.lib.Motion);},color:function(el,_f7,_f8,_f9,cb,_fb){this.run(el,_f7,_f8,_f9,cb,_fb,Ext.lib.ColorAnim);},run:function(el,_fd,_fe,_ff,cb,_101,type){type=type||Ext.lib.AnimBase;if(typeof _ff=="string"){_ff=Ext.lib.Easing[_ff];}var anim=new type(el,_fd,_fe,_ff);anim.animateX(function(){Ext.callback(cb,_101);});return anim;}};function fly(el){if(!_1){_1=new Ext.Element.Flyweight();}_1.dom=el;return _1;}if(Ext.isIE){function fnCleanUp(){var p=Function.prototype;delete p.createSequence;delete p.defer;delete p.createDelegate;delete p.createCallback;delete p.createInterceptor;window.detachEvent("onunload",fnCleanUp);}window.attachEvent("onunload",fnCleanUp);}Ext.lib.AnimBase=function(el,_107,_108,_109){if(el){this.init(el,_107,_108,_109);}};Ext.lib.AnimBase.prototype={toString:function(){var el=this.getEl();var id=el.id||el.tagName;return("Anim "+id);},patterns:{noNegatives:/width|height|opacity|padding/i,offsetAttribute:/^((width|height)|(top|left))$/,defaultUnit:/width|height|top$|bottom$|left$|right$/i,offsetUnit:/\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i},doMethod:function(attr,_10d,end){return this.method(this.currentFrame,_10d,end-_10d,this.totalFrames);},setAttribute:function(attr,val,unit){if(this.patterns.noNegatives.test(attr)){val=(val>0)?val:0;}Ext.fly(this.getEl(),"_anim").setStyle(attr,val+unit);},getAttribute:function(attr){var el=this.getEl();var val=fly(el).getStyle(attr);if(val!=="auto"&&!this.patterns.offsetUnit.test(val)){return parseFloat(val);}var a=this.patterns.offsetAttribute.exec(attr)||[];var pos=!!(a[3]);var box=!!(a[2]);if(box||(fly(el).getStyle("position")=="absolute"&&pos)){val=el["offset"+a[0].charAt(0).toUpperCase()+a[0].substr(1)];}else{val=0;}return val;},getDefaultUnit:function(attr){if(this.patterns.defaultUnit.test(attr)){return"px";}return"";},animateX:function(_119,_11a){var f=function(){this.onComplete.removeListener(f);if(typeof _119=="function"){_119.call(_11a||this,this);}};this.onComplete.addListener(f,this);this.animate();},setRuntimeAttribute:function(attr){var _11d;var end;var _11f=this.attributes;this.runtimeAttributes[attr]={};var _120=function(prop){return(typeof prop!=="undefined");};if(!_120(_11f[attr]["to"])&&!_120(_11f[attr]["by"])){return false;}_11d=(_120(_11f[attr]["from"]))?_11f[attr]["from"]:this.getAttribute(attr);if(_120(_11f[attr]["to"])){end=_11f[attr]["to"];}else{if(_120(_11f[attr]["by"])){if(_11d.constructor==Array){end=[];for(var i=0,len=_11d.length;i<len;++i){end[i]=_11d[i]+_11f[attr]["by"][i];}}else{end=_11d+_11f[attr]["by"];}}}this.runtimeAttributes[attr].start=_11d;this.runtimeAttributes[attr].end=end;this.runtimeAttributes[attr].unit=(_120(_11f[attr].unit))?_11f[attr]["unit"]:this.getDefaultUnit(attr);},init:function(el,_125,_126,_127){var _128=false;var _129=null;var _12a=0;el=Ext.getDom(el);this.attributes=_125||{};this.duration=_126||1;this.method=_127||Ext.lib.Easing.easeNone;this.useSeconds=true;this.currentFrame=0;this.totalFrames=Ext.lib.AnimMgr.fps;this.getEl=function(){return el;};this.isAnimated=function(){return _128;};this.getStartTime=function(){return _129;};this.runtimeAttributes={};this.animate=function(){if(this.isAnimated()){return false;}this.currentFrame=0;this.totalFrames=(this.useSeconds)?Math.ceil(Ext.lib.AnimMgr.fps*this.duration):this.duration;Ext.lib.AnimMgr.registerElement(this);};this.stop=function(_12b){if(_12b){this.currentFrame=this.totalFrames;this._onTween.fire();}Ext.lib.AnimMgr.stop(this);};var _12c=function(){this.onStart.fire();this.runtimeAttributes={};for(var attr in this.attributes){this.setRuntimeAttribute(attr);}_128=true;_12a=0;_129=new Date();};var _12e=function(){var data={duration:new Date()-this.getStartTime(),currentFrame:this.currentFrame};data.toString=function(){return("duration: "+data.duration+", currentFrame: "+data.currentFrame);};this.onTween.fire(data);var _130=this.runtimeAttributes;for(var attr in _130){this.setAttribute(attr,this.doMethod(attr,_130[attr].start,_130[attr].end),_130[attr].unit);}_12a+=1;};var _132=function(){var _133=(new Date()-_129)/1000;var data={duration:_133,frames:_12a,fps:_12a/_133};data.toString=function(){return("duration: "+data.duration+", frames: "+data.frames+", fps: "+data.fps);};_128=false;_12a=0;this.onComplete.fire(data);};this._onStart=new Ext.util.Event(this);this.onStart=new Ext.util.Event(this);this.onTween=new Ext.util.Event(this);this._onTween=new Ext.util.Event(this);this.onComplete=new Ext.util.Event(this);this._onComplete=new Ext.util.Event(this);this._onStart.addListener(_12c);this._onTween.addListener(_12e);this._onComplete.addListener(_132);}};Ext.lib.AnimMgr=new function(){var _135=null;var _136=[];var _137=0;this.fps=1000;this.delay=1;this.registerElement=function(_138){_136[_136.length]=_138;_137+=1;_138._onStart.fire();this.start();};this.unRegister=function(_139,_13a){_139._onComplete.fire();_13a=_13a||_13b(_139);if(_13a!=-1){_136.splice(_13a,1);}_137-=1;if(_137<=0){this.stop();}};this.start=function(){if(_135===null){_135=setInterval(this.run,this.delay);}};this.stop=function(_13c){if(!_13c){clearInterval(_135);for(var i=0,len=_136.length;i<len;++i){if(_136[0].isAnimated()){this.unRegister(_136[0],0);}}_136=[];_135=null;_137=0;}else{this.unRegister(_13c);}};this.run=function(){for(var i=0,len=_136.length;i<len;++i){var _141=_136[i];if(!_141||!_141.isAnimated()){continue;}if(_141.currentFrame<_141.totalFrames||_141.totalFrames===null){_141.currentFrame+=1;if(_141.useSeconds){_142(_141);}_141._onTween.fire();}else{Ext.lib.AnimMgr.stop(_141,i);}}};var _13b=function(anim){for(var i=0,len=_136.length;i<len;++i){if(_136[i]==anim){return i;}}return-1;};var _142=function(_146){var _147=_146.totalFrames;var _148=_146.currentFrame;var _149=(_146.currentFrame*_146.duration*1000/_146.totalFrames);var _14a=(new Date()-_146.getStartTime());var _14b=0;if(_14a<_146.duration*1000){_14b=Math.round((_14a/_149-1)*_146.currentFrame);}else{_14b=_147-(_148+1);}if(_14b>0&&isFinite(_14b)){if(_146.currentFrame+_14b>=_147){_14b=_147-(_148+1);}_146.currentFrame+=_14b;}};};Ext.lib.Bezier=new function(){this.getPosition=function(_14c,t){var n=_14c.length;var tmp=[];for(var i=0;i<n;++i){tmp[i]=[_14c[i][0],_14c[i][1]];}for(var j=1;j<n;++j){for(i=0;i<n-j;++i){tmp[i][0]=(1-t)*tmp[i][0]+t*tmp[parseInt(i+1,10)][0];tmp[i][1]=(1-t)*tmp[i][1]+t*tmp[parseInt(i+1,10)][1];}}return[tmp[0][0],tmp[0][1]];};};(function(){Ext.lib.ColorAnim=function(el,_153,_154,_155){Ext.lib.ColorAnim.superclass.constructor.call(this,el,_153,_154,_155);};Ext.extend(Ext.lib.ColorAnim,Ext.lib.AnimBase);var Y=Ext.lib;var _157=Y.ColorAnim.superclass;var _158=Y.ColorAnim.prototype;_158.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return("ColorAnim "+id);};_158.patterns.color=/color$/i;_158.patterns.rgb=/^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i;_158.patterns.hex=/^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i;_158.patterns.hex3=/^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i;_158.patterns.transparent=/^transparent|rgba\(0, 0, 0, 0\)$/;_158.parseColor=function(s){if(s.length==3){return s;}var c=this.patterns.hex.exec(s);if(c&&c.length==4){return[parseInt(c[1],16),parseInt(c[2],16),parseInt(c[3],16)];}c=this.patterns.rgb.exec(s);if(c&&c.length==4){return[parseInt(c[1],10),parseInt(c[2],10),parseInt(c[3],10)];}c=this.patterns.hex3.exec(s);if(c&&c.length==4){return[parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16),parseInt(c[3]+c[3],16)];}return null;};_158.getAttribute=function(attr){var el=this.getEl();if(this.patterns.color.test(attr)){var val=fly(el).getStyle(attr);if(this.patterns.transparent.test(val)){var _160=el.parentNode;val=fly(_160).getStyle(attr);while(_160&&this.patterns.transparent.test(val)){_160=_160.parentNode;val=fly(_160).getStyle(attr);if(_160.tagName.toUpperCase()=="HTML"){val="#fff";}}}}else{val=_157.getAttribute.call(this,attr);}return val;};_158.doMethod=function(attr,_162,end){var val;if(this.patterns.color.test(attr)){val=[];for(var i=0,len=_162.length;i<len;++i){val[i]=_157.doMethod.call(this,attr,_162[i],end[i]);}val="rgb("+Math.floor(val[0])+","+Math.floor(val[1])+","+Math.floor(val[2])+")";}else{val=_157.doMethod.call(this,attr,_162,end);}return val;};_158.setRuntimeAttribute=function(attr){_157.setRuntimeAttribute.call(this,attr);if(this.patterns.color.test(attr)){var _168=this.attributes;var _169=this.parseColor(this.runtimeAttributes[attr].start);var end=this.parseColor(this.runtimeAttributes[attr].end);if(typeof _168[attr]["to"]==="undefined"&&typeof _168[attr]["by"]!=="undefined"){end=this.parseColor(_168[attr].by);for(var i=0,len=_169.length;i<len;++i){end[i]=_169[i]+end[i];}}this.runtimeAttributes[attr].start=_169;this.runtimeAttributes[attr].end=end;}};})();Ext.lib.Easing={easeNone:function(t,b,c,d){return c*t/d+b;},easeIn:function(t,b,c,d){return c*(t/=d)*t+b;},easeOut:function(t,b,c,d){return-c*(t/=d)*(t-2)+b;},easeBoth:function(t,b,c,d){if((t/=d/2)<1){return c/2*t*t+b;}return-c/2*((--t)*(t-2)-1)+b;},easeInStrong:function(t,b,c,d){return c*(t/=d)*t*t*t+b;},easeOutStrong:function(t,b,c,d){return-c*((t=t/d-1)*t*t*t-1)+b;},easeBothStrong:function(t,b,c,d){if((t/=d/2)<1){return c/2*t*t*t*t+b;}return-c/2*((t-=2)*t*t*t-2)+b;},elasticIn:function(t,b,c,d,a,p){if(t==0){return b;}if((t/=d)==1){return b+c;}if(!p){p=d*0.3;}if(!a||a<Math.abs(c)){a=c;var s=p/4;}else{var s=p/(2*Math.PI)*Math.asin(c/a);}return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;},elasticOut:function(t,b,c,d,a,p){if(t==0){return b;}if((t/=d)==1){return b+c;}if(!p){p=d*0.3;}if(!a||a<Math.abs(c)){a=c;var s=p/4;}else{var s=p/(2*Math.PI)*Math.asin(c/a);}return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b;},elasticBoth:function(t,b,c,d,a,p){if(t==0){return b;}if((t/=d/2)==2){return b+c;}if(!p){p=d*(0.3*1.5);}if(!a||a<Math.abs(c)){a=c;var s=p/4;}else{var s=p/(2*Math.PI)*Math.asin(c/a);}if(t<1){return-0.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;}return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*0.5+c+b;},backIn:function(t,b,c,d,s){if(typeof s=="undefined"){s=1.70158;}return c*(t/=d)*t*((s+1)*t-s)+b;},backOut:function(t,b,c,d,s){if(typeof s=="undefined"){s=1.70158;}return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b;},backBoth:function(t,b,c,d,s){if(typeof s=="undefined"){s=1.70158;}if((t/=d/2)<1){return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;}return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b;},bounceIn:function(t,b,c,d){return c-Ext.lib.Easing.bounceOut(d-t,0,c,d)+b;},bounceOut:function(t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b;}else{if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+0.75)+b;}else{if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+0.9375)+b;}}}return c*(7.5625*(t-=(2.625/2.75))*t+0.984375)+b;},bounceBoth:function(t,b,c,d){if(t<d/2){return Ext.lib.Easing.bounceIn(t*2,0,c,d)*0.5+b;}return Ext.lib.Easing.bounceOut(t*2-d,0,c,d)*0.5+c*0.5+b;}};(function(){Ext.lib.Motion=function(el,_1ba,_1bb,_1bc){if(el){Ext.lib.Motion.superclass.constructor.call(this,el,_1ba,_1bb,_1bc);}};Ext.extend(Ext.lib.Motion,Ext.lib.ColorAnim);var Y=Ext.lib;var _1be=Y.Motion.superclass;var _1bf=Y.Motion.prototype;_1bf.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return("Motion "+id);};_1bf.patterns.points=/^points$/i;_1bf.setAttribute=function(attr,val,unit){if(this.patterns.points.test(attr)){unit=unit||"px";_1be.setAttribute.call(this,"left",val[0],unit);_1be.setAttribute.call(this,"top",val[1],unit);}else{_1be.setAttribute.call(this,attr,val,unit);}};_1bf.getAttribute=function(attr){if(this.patterns.points.test(attr)){var val=[_1be.getAttribute.call(this,"left"),_1be.getAttribute.call(this,"top")];}else{val=_1be.getAttribute.call(this,attr);}return val;};_1bf.doMethod=function(attr,_1c8,end){var val=null;if(this.patterns.points.test(attr)){var t=this.method(this.currentFrame,0,100,this.totalFrames)/100;val=Y.Bezier.getPosition(this.runtimeAttributes[attr],t);}else{val=_1be.doMethod.call(this,attr,_1c8,end);}return val;};_1bf.setRuntimeAttribute=function(attr){if(this.patterns.points.test(attr)){var el=this.getEl();var _1ce=this.attributes;var _1cf;var _1d0=_1ce["points"]["control"]||[];var end;var i,len;if(_1d0.length>0&&!(_1d0[0]instanceof Array)){_1d0=[_1d0];}else{var tmp=[];for(i=0,len=_1d0.length;i<len;++i){tmp[i]=_1d0[i];}_1d0=tmp;}Ext.fly(el).position();if(_1d5(_1ce["points"]["from"])){Ext.lib.Dom.setXY(el,_1ce["points"]["from"]);}else{Ext.lib.Dom.setXY(el,Ext.lib.Dom.getXY(el));}_1cf=this.getAttribute("points");if(_1d5(_1ce["points"]["to"])){end=_1d6.call(this,_1ce["points"]["to"],_1cf);var _1d7=Ext.lib.Dom.getXY(this.getEl());for(i=0,len=_1d0.length;i<len;++i){_1d0[i]=_1d6.call(this,_1d0[i],_1cf);}}else{if(_1d5(_1ce["points"]["by"])){end=[_1cf[0]+_1ce["points"]["by"][0],_1cf[1]+_1ce["points"]["by"][1]];for(i=0,len=_1d0.length;i<len;++i){_1d0[i]=[_1cf[0]+_1d0[i][0],_1cf[1]+_1d0[i][1]];}}}this.runtimeAttributes[attr]=[_1cf];if(_1d0.length>0){this.runtimeAttributes[attr]=this.runtimeAttributes[attr].concat(_1d0);}this.runtimeAttributes[attr][this.runtimeAttributes[attr].length]=end;}else{_1be.setRuntimeAttribute.call(this,attr);}};var _1d6=function(val,_1d9){var _1da=Ext.lib.Dom.getXY(this.getEl());val=[val[0]-_1da[0]+_1d9[0],val[1]-_1da[1]+_1d9[1]];return val;};var _1d5=function(prop){return(typeof prop!=="undefined");};})();(function(){Ext.lib.Scroll=function(el,_1dd,_1de,_1df){if(el){Ext.lib.Scroll.superclass.constructor.call(this,el,_1dd,_1de,_1df);}};Ext.extend(Ext.lib.Scroll,Ext.lib.ColorAnim);var Y=Ext.lib;var _1e1=Y.Scroll.superclass;var _1e2=Y.Scroll.prototype;_1e2.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return("Scroll "+id);};_1e2.doMethod=function(attr,_1e6,end){var val=null;if(attr=="scroll"){val=[this.method(this.currentFrame,_1e6[0],end[0]-_1e6[0],this.totalFrames),this.method(this.currentFrame,_1e6[1],end[1]-_1e6[1],this.totalFrames)];}else{val=_1e1.doMethod.call(this,attr,_1e6,end);}return val;};_1e2.getAttribute=function(attr){var val=null;var el=this.getEl();if(attr=="scroll"){val=[el.scrollLeft,el.scrollTop];}else{val=_1e1.getAttribute.call(this,attr);}return val;};_1e2.setAttribute=function(attr,val,unit){var el=this.getEl();if(attr=="scroll"){el.scrollLeft=val[0];el.scrollTop=val[1];}else{_1e1.setAttribute.call(this,attr,val,unit);}};})();})();
Ext.util.Observable=function(){if(this.listeners){this.on(this.listeners);delete this.listeners;}};Ext.util.Observable.prototype={fireEvent:function(){var ce=this.events[arguments[0].toLowerCase()];if(typeof ce=="object"){return ce.fire.apply(ce,Array.prototype.slice.call(arguments,1));}else{return true;}},filterOptRe:/^(?:scope|delay|buffer|single)$/,addListener:function(_2,fn,_4,o){if(typeof _2=="object"){o=_2;for(var e in o){if(this.filterOptRe.test(e)){continue;}if(typeof o[e]=="function"){this.addListener(e,o[e],o.scope,o);}else{this.addListener(e,o[e].fn,o[e].scope,o[e]);}}return;}o=(!o||typeof o=="boolean")?{}:o;_2=_2.toLowerCase();var ce=this.events[_2]||true;if(typeof ce=="boolean"){ce=new Ext.util.Event(this,_2);this.events[_2]=ce;}ce.addListener(fn,_4,o);},removeListener:function(_8,fn,_a){var ce=this.events[_8.toLowerCase()];if(typeof ce=="object"){ce.removeListener(fn,_a);}},purgeListeners:function(){for(var _c in this.events){if(typeof this.events[_c]=="object"){this.events[_c].clearListeners();}}},relayEvents:function(o,_e){var _f=function(_10){return function(){return this.fireEvent.apply(this,Ext.combine(_10,Array.prototype.slice.call(arguments,0)));};};for(var i=0,len=_e.length;i<len;i++){var _13=_e[i];if(!this.events[_13]){this.events[_13]=true;}o.on(_13,_f(_13),this);}},addEvents:function(o){if(!this.events){this.events={};}Ext.applyIf(this.events,o);},hasListener:function(_15){var e=this.events[_15];return typeof e=="object"&&e.listeners.length>0;}};Ext.util.Observable.prototype.on=Ext.util.Observable.prototype.addListener;Ext.util.Observable.prototype.un=Ext.util.Observable.prototype.removeListener;Ext.util.Observable.capture=function(o,fn,_19){o.fireEvent=o.fireEvent.createInterceptor(fn,_19);};Ext.util.Observable.releaseCapture=function(o){o.fireEvent=Ext.util.Observable.prototype.fireEvent;};(function(){var _1b=function(h,o,_1e){var _1f=new Ext.util.DelayedTask();return function(){_1f.delay(o.buffer,h,_1e,Array.prototype.slice.call(arguments,0));};};var _20=function(h,e,fn,_24){return function(){e.removeListener(fn,_24);return h.apply(_24,arguments);};};var _25=function(h,o,_28){return function(){var _29=Array.prototype.slice.call(arguments,0);setTimeout(function(){h.apply(_28,_29);},o.delay||10);};};Ext.util.Event=function(obj,_2b){this.name=_2b;this.obj=obj;this.listeners=[];};Ext.util.Event.prototype={addListener:function(fn,_2d,_2e){var o=_2e||{};_2d=_2d||this.obj;if(!this.isListening(fn,_2d)){var l={fn:fn,scope:_2d,options:o};var h=fn;if(o.delay){h=_25(h,o,_2d);}if(o.single){h=_20(h,this,fn,_2d);}if(o.buffer){h=_1b(h,o,_2d);}l.fireFn=h;if(!this.firing){this.listeners.push(l);}else{this.listeners=this.listeners.slice(0);this.listeners.push(l);}}},findListener:function(fn,_33){_33=_33||this.obj;var ls=this.listeners;for(var i=0,len=ls.length;i<len;i++){var l=ls[i];if(l.fn==fn&&l.scope==_33){return i;}}return-1;},isListening:function(fn,_39){return this.findListener(fn,_39)!=-1;},removeListener:function(fn,_3b){var _3c;if((_3c=this.findListener(fn,_3b))!=-1){if(!this.firing){this.listeners.splice(_3c,1);}else{this.listeners=this.listeners.slice(0);this.listeners.splice(_3c,1);}return true;}return false;},clearListeners:function(){this.listeners=[];},fire:function(){var ls=this.listeners,_3e,len=ls.length;if(len>0){this.firing=true;var _40=Array.prototype.slice.call(arguments,0);for(var i=0;i<len;i++){var l=ls[i];if(l.fireFn.apply(l.scope||this.obj||window,arguments)===false){this.firing=false;return false;}}this.firing=false;}return true;}};})();
Ext.EventManager=function(){var _1,_2,_3=false;var _4,_5,_6,_7;var E=Ext.lib.Event;var D=Ext.lib.Dom;var _a=function(){if(!_3){_3=true;Ext.isReady=true;if(_2){clearInterval(_2);}if(Ext.isGecko||Ext.isOpera){document.removeEventListener("DOMContentLoaded",_a,false);}if(_1){_1.fire();_1.clearListeners();}}};var _b=function(){_1=new Ext.util.Event();if(Ext.isGecko||Ext.isOpera){document.addEventListener("DOMContentLoaded",_a,false);}else{if(Ext.isIE){document.write("<s"+"cript id=\"ie-deferred-loader\" defer=\"defer\" src=\"/"+"/:\"></s"+"cript>");var _c=document.getElementById("ie-deferred-loader");_c.onreadystatechange=function(){if(this.readyState=="complete"){_a();_c.onreadystatechange=null;_c.parentNode.removeChild(_c);}};}else{if(Ext.isSafari){_2=setInterval(function(){var rs=document.readyState;if(rs=="complete"){_a();}},10);}}}E.on(window,"load",_a);};var _e=function(h,o){var _11=new Ext.util.DelayedTask(h);return function(e){e=new Ext.EventObjectImpl(e);_11.delay(o.buffer,h,null,[e]);};};var _13=function(h,el,_16,fn){return function(e){Ext.EventManager.removeListener(el,_16,fn);h(e);};};var _19=function(h,o){return function(e){e=new Ext.EventObjectImpl(e);setTimeout(function(){h(e);},o.delay||10);};};var _1d=function(_1e,_1f,opt,fn,_22){var o=(!opt||typeof opt=="boolean")?{}:opt;fn=fn||o.fn;_22=_22||o.scope;var el=Ext.getDom(_1e);if(!el){throw"Error listening for \""+_1f+"\". Element \""+_1e+"\" doesn't exist.";}var h=function(e){e=Ext.EventObject.setEvent(e);var t;if(o.delegate){t=e.getTarget(o.delegate,el);if(!t){return;}}else{t=e.target;}if(o.stopEvent===true){e.stopEvent();}if(o.preventDefault===true){e.preventDefault();}if(o.stopPropagation===true){e.stopPropagation();}if(o.normalized===false){e=e.browserEvent;}fn.call(_22||el,e,t,o);};if(o.delay){h=_19(h,o);}if(o.single){h=_13(h,el,_1f,fn);}if(o.buffer){h=_e(h,o);}fn._handlers=fn._handlers||[];fn._handlers.push([Ext.id(el),_1f,h]);E.on(el,_1f,h);if(_1f=="mousewheel"&&el.addEventListener){el.addEventListener("DOMMouseScroll",h,false);E.on(window,"unload",function(){el.removeEventListener("DOMMouseScroll",h,false);});}if(_1f=="mousedown"&&el==document){Ext.EventManager.stoppedMouseDownEvent.addListener(h);}return h;};var _28=function(el,_2a,fn){var id=Ext.id(el),hds=fn._handlers,hd=fn;if(hds){for(var i=0,len=hds.length;i<len;i++){var h=hds[i];if(h[0]==id&&h[1]==_2a){hd=h[2];hds.splice(i,1);break;}}}E.un(el,_2a,hd);el=Ext.getDom(el);if(_2a=="mousewheel"&&el.addEventListener){el.removeEventListener("DOMMouseScroll",hd,false);}if(_2a=="mousedown"&&el==document){Ext.EventManager.stoppedMouseDownEvent.removeListener(hd);}};var _32=/^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/;var pub={wrap:function(fn,_35,_36){return function(e){Ext.EventObject.setEvent(e);fn.call(_36?_35||window:window,Ext.EventObject,_35);};},addListener:function(_38,_39,fn,_3b,_3c){if(typeof _39=="object"){var o=_39;for(var e in o){if(_32.test(e)){continue;}if(typeof o[e]=="function"){_1d(_38,e,o,o[e],o.scope);}else{_1d(_38,e,o[e]);}}return;}return _1d(_38,_39,_3c,fn,_3b);},removeListener:function(_3f,_40,fn){return _28(_3f,_40,fn);},onDocumentReady:function(fn,_43,_44){if(_3){fn.call(_43||window,_43);return;}if(!_1){_b();}_1.addListener(fn,_43,_44);},onWindowResize:function(fn,_46,_47){if(!_4){_4=new Ext.util.Event();_5=new Ext.util.DelayedTask(function(){_4.fire(D.getViewWidth(),D.getViewHeight());});E.on(window,"resize",function(){if(Ext.isIE){_5.delay(50);}else{_4.fire(D.getViewWidth(),D.getViewHeight());}});}_4.addListener(fn,_46,_47);},onTextResize:function(fn,_49,_4a){if(!_6){_6=new Ext.util.Event();var _4b=new Ext.Element(document.createElement("div"));_4b.dom.className="x-text-resize";_4b.dom.innerHTML="X";_4b.appendTo(document.body);_7=_4b.dom.offsetHeight;setInterval(function(){if(_4b.dom.offsetHeight!=_7){_6.fire(_7,_7=_4b.dom.offsetHeight);}},this.textResizeInterval);}_6.addListener(fn,_49,_4a);},removeResizeListener:function(fn,_4d){if(_4){_4.removeListener(fn,_4d);}},fireResize:function(){if(_4){_4.fire(D.getViewWidth(),D.getViewHeight());}},ieDeferSrc:false,textResizeInterval:50};pub.on=pub.addListener;pub.un=pub.removeListener;pub.stoppedMouseDownEvent=new Ext.util.Event();return pub;}();Ext.onReady=Ext.EventManager.onDocumentReady;Ext.onReady(function(){var bd=Ext.get(document.body);if(!bd){return;}var cls=[Ext.isIE?"ext-ie":Ext.isGecko?"ext-gecko":Ext.isOpera?"ext-opera":Ext.isSafari?"ext-safari":""];if(Ext.isMac){cls.push("ext-mac");}if(Ext.isLinux){cls.push("ext-linux");}if(Ext.isBorderBox){cls.push("ext-border-box");}if(Ext.isStrict){var p=bd.dom.parentNode;if(p){p.className=p.className?" ext-strict":"ext-strict";}}bd.addClass(cls.join(" "));});Ext.EventObject=function(){var E=Ext.lib.Event;var _52={63234:37,63235:39,63232:38,63233:40,63276:33,63277:34,63272:46,63273:36,63275:35};var _53=Ext.isIE?{1:0,4:1,2:2}:(Ext.isSafari?{1:0,2:1,3:2}:{0:0,1:1,2:2});Ext.EventObjectImpl=function(e){if(e){this.setEvent(e.browserEvent||e);}};Ext.EventObjectImpl.prototype={browserEvent:null,button:-1,shiftKey:false,ctrlKey:false,altKey:false,BACKSPACE:8,TAB:9,RETURN:13,ENTER:13,SHIFT:16,CONTROL:17,ESC:27,SPACE:32,PAGEUP:33,PAGEDOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46,F5:116,setEvent:function(e){if(e==this||(e&&e.browserEvent)){return e;}this.browserEvent=e;if(e){this.button=e.button?_53[e.button]:(e.which?e.which-1:-1);if(e.type=="click"&&this.button==-1){this.button=0;}this.type=e.type;this.shiftKey=e.shiftKey;this.ctrlKey=e.ctrlKey||e.metaKey;this.altKey=e.altKey;this.keyCode=e.keyCode;this.charCode=e.charCode;this.target=E.getTarget(e);this.xy=E.getXY(e);}else{this.button=-1;this.shiftKey=false;this.ctrlKey=false;this.altKey=false;this.keyCode=0;this.charCode=0;this.target=null;this.xy=[0,0];}return this;},stopEvent:function(){if(this.browserEvent){if(this.browserEvent.type=="mousedown"){Ext.EventManager.stoppedMouseDownEvent.fire(this);}E.stopEvent(this.browserEvent);}},preventDefault:function(){if(this.browserEvent){E.preventDefault(this.browserEvent);}},isNavKeyPress:function(){var k=this.keyCode;k=Ext.isSafari?(_52[k]||k):k;return(k>=33&&k<=40)||k==this.RETURN||k==this.TAB||k==this.ESC;},isSpecialKey:function(){var k=this.keyCode;return(this.type=="keypress"&&this.ctrlKey)||k==9||k==13||k==40||k==27||(k==16)||(k==17)||(k>=18&&k<=20)||(k>=33&&k<=35)||(k>=36&&k<=39)||(k>=44&&k<=45);},stopPropagation:function(){if(this.browserEvent){if(this.type=="mousedown"){Ext.EventManager.stoppedMouseDownEvent.fire(this);}E.stopPropagation(this.browserEvent);}},getCharCode:function(){return this.charCode||this.keyCode;},getKey:function(){var k=this.keyCode||this.charCode;return Ext.isSafari?(_52[k]||k):k;},getPageX:function(){return this.xy[0];},getPageY:function(){return this.xy[1];},getTime:function(){if(this.browserEvent){return E.getTime(this.browserEvent);}return null;},getXY:function(){return this.xy;},getTarget:function(_59,_5a,_5b){return _59?Ext.fly(this.target).findParent(_59,_5a,_5b):this.target;},getRelatedTarget:function(){if(this.browserEvent){return E.getRelatedTarget(this.browserEvent);}return null;},getWheelDelta:function(){var e=this.browserEvent;var _5d=0;if(e.wheelDelta){_5d=e.wheelDelta/120;if(window.opera){_5d=-_5d;}}else{if(e.detail){_5d=-e.detail/3;}}return _5d;},hasModifier:function(){return!!((this.ctrlKey||this.altKey)||this.shiftKey);},within:function(el,_5f){var t=this[_5f?"getRelatedTarget":"getTarget"]();return t&&Ext.fly(el).contains(t);},getPoint:function(){return new Ext.lib.Point(this.xy[0],this.xy[1]);}};return new Ext.EventObjectImpl();}();
(function(){var D=Ext.lib.Dom;var E=Ext.lib.Event;var A=Ext.lib.Anim;var _4={};var _5=/(-[a-z])/gi;var _6=function(m,a){return a.charAt(1).toUpperCase();};var _9=document.defaultView;Ext.Element=function(_a,_b){var _c=typeof _a=="string"?document.getElementById(_a):_a;if(!_c){return null;}var id=_c.id;if(_b!==true&&id&&Ext.Element.cache[id]){return Ext.Element.cache[id];}this.dom=_c;this.id=id||Ext.id(_c);};var El=Ext.Element;El.prototype={originalDisplay:"",visibilityMode:1,defaultUnit:"px",setVisibilityMode:function(_f){this.visibilityMode=_f;return this;},enableDisplayMode:function(_10){this.setVisibilityMode(El.DISPLAY);if(typeof _10!="undefined"){this.originalDisplay=_10;}return this;},findParent:function(_11,_12,_13){var p=this.dom,b=document.body,_16=0,dq=Ext.DomQuery,_18;_12=_12||50;if(typeof _12!="number"){_18=Ext.getDom(_12);_12=10;}while(p&&p.nodeType==1&&_16<_12&&p!=b&&p!=_18){if(dq.is(p,_11)){return _13?Ext.get(p):p;}_16++;p=p.parentNode;}return null;},findParentNode:function(_19,_1a,_1b){var p=Ext.fly(this.dom.parentNode,"_internal");return p?p.findParent(_19,_1a,_1b):null;},up:function(_1d,_1e){return this.findParentNode(_1d,_1e,true);},is:function(_1f){return Ext.DomQuery.is(this.dom,_1f);},animate:function(_20,_21,_22,_23,_24){this.anim(_20,{duration:_21,callback:_22,easing:_23},_24);return this;},anim:function(_25,opt,_27,_28,_29,cb){_27=_27||"run";opt=opt||{};var _2b=Ext.lib.Anim[_27](this.dom,_25,(opt.duration||_28)||0.35,(opt.easing||_29)||"easeOut",function(){Ext.callback(cb,this);Ext.callback(opt.callback,opt.scope||this,[this,opt]);},this);opt.anim=_2b;return _2b;},preanim:function(a,i){return!a[i]?false:(typeof a[i]=="object"?a[i]:{duration:a[i+1],callback:a[i+2],easing:a[i+3]});},clean:function(_2e){if(this.isCleaned&&_2e!==true){return this;}var ns=/\S/;var d=this.dom,n=d.firstChild,ni=-1;while(n){var nx=n.nextSibling;if(n.nodeType==3&&!ns.test(n.nodeValue)){d.removeChild(n);}else{n.nodeIndex=++ni;}n=nx;}this.isCleaned=true;return this;},calcOffsetsTo:function(el){el=Ext.get(el);var d=el.dom;var _36=false;if(el.getStyle("position")=="static"){el.position("relative");_36=true;}var x=0,y=0;var op=this.dom;while(op&&op!=d&&op.tagName!="HTML"){x+=op.offsetLeft;y+=op.offsetTop;op=op.offsetParent;}if(_36){el.position("static");}return[x,y];},scrollIntoView:function(_3a,_3b){var c=Ext.getDom(_3a)||document.body;var el=this.dom;var o=this.calcOffsetsTo(c),l=o[0],t=o[1],b=t+el.offsetHeight,r=l+el.offsetWidth;var ch=c.clientHeight;var ct=parseInt(c.scrollTop,10);var cl=parseInt(c.scrollLeft,10);var cb=ct+ch;var cr=cl+c.clientWidth;if(t<ct){c.scrollTop=t;}else{if(b>cb){c.scrollTop=b-ch;}}if(_3b!==false){if(l<cl){c.scrollLeft=l;}else{if(r>cr){c.scrollLeft=r-c.clientWidth;}}}return this;},scrollChildIntoView:function(_48,_49){Ext.fly(_48,"_scrollChildIntoView").scrollIntoView(this,_49);},autoHeight:function(_4a,_4b,_4c,_4d){var _4e=this.getHeight();this.clip();this.setHeight(1);setTimeout(function(){var _4f=parseInt(this.dom.scrollHeight,10);if(!_4a){this.setHeight(_4f);this.unclip();if(typeof _4c=="function"){_4c();}}else{this.setHeight(_4e);this.setHeight(_4f,_4a,_4b,function(){this.unclip();if(typeof _4c=="function"){_4c();}}.createDelegate(this),_4d);}}.createDelegate(this),0);return this;},contains:function(el){if(!el){return false;}return D.isAncestor(this.dom,el.dom?el.dom:el);},isVisible:function(_51){var vis=!(this.getStyle("visibility")=="hidden"||this.getStyle("display")=="none");if(_51!==true||!vis){return vis;}var p=this.dom.parentNode;while(p&&p.tagName.toLowerCase()!="body"){if(!Ext.fly(p,"_isVisible").isVisible()){return false;}p=p.parentNode;}return true;},select:function(_54,_55){return El.select(_54,_55,this.dom);},query:function(_56,_57){return Ext.DomQuery.select(_56,this.dom);},child:function(_58,_59){var n=Ext.DomQuery.selectNode(_58,this.dom);return _59?n:Ext.get(n);},down:function(_5b,_5c){var n=Ext.DomQuery.selectNode(" > "+_5b,this.dom);return _5c?n:Ext.get(n);},initDD:function(_5e,_5f,_60){var dd=new Ext.dd.DD(Ext.id(this.dom),_5e,_5f);return Ext.apply(dd,_60);},initDDProxy:function(_62,_63,_64){var dd=new Ext.dd.DDProxy(Ext.id(this.dom),_62,_63);return Ext.apply(dd,_64);},initDDTarget:function(_66,_67,_68){var dd=new Ext.dd.DDTarget(Ext.id(this.dom),_66,_67);return Ext.apply(dd,_68);},setVisible:function(_6a,_6b){if(!_6b||!A){if(this.visibilityMode==El.DISPLAY){this.setDisplayed(_6a);}else{this.fixDisplay();this.dom.style.visibility=_6a?"visible":"hidden";}}else{var dom=this.dom;var _6d=this.visibilityMode;if(_6a){this.setOpacity(0.01);this.setVisible(true);}this.anim({opacity:{to:(_6a?1:0)}},this.preanim(arguments,1),null,0.35,"easeIn",function(){if(!_6a){if(_6d==El.DISPLAY){dom.style.display="none";}else{dom.style.visibility="hidden";}Ext.get(dom).setOpacity(1);}});}return this;},isDisplayed:function(){return this.getStyle("display")!="none";},toggle:function(_6e){this.setVisible(!this.isVisible(),this.preanim(arguments,0));return this;},setDisplayed:function(_6f){if(typeof _6f=="boolean"){_6f=_6f?this.originalDisplay:"none";}this.setStyle("display",_6f);return this;},focus:function(){try{this.dom.focus();}catch(e){}return this;},blur:function(){try{this.dom.blur();}catch(e){}return this;},addClass:function(_70){if(_70 instanceof Array){for(var i=0,len=_70.length;i<len;i++){this.addClass(_70[i]);}}else{if(_70&&!this.hasClass(_70)){this.dom.className=this.dom.className+" "+_70;}}return this;},radioClass:function(_73){var _74=this.dom.parentNode.childNodes;for(var i=0;i<_74.length;i++){var s=_74[i];if(s.nodeType==1){Ext.get(s).removeClass(_73);}}this.addClass(_73);return this;},removeClass:function(_77){if(!_77||!this.dom.className){return this;}if(_77 instanceof Array){for(var i=0,len=_77.length;i<len;i++){this.removeClass(_77[i]);}}else{if(this.hasClass(_77)){var re=this.classReCache[_77];if(!re){re=new RegExp("(?:^|\\s+)"+_77+"(?:\\s+|$)","g");this.classReCache[_77]=re;}this.dom.className=this.dom.className.replace(re," ");}}return this;},classReCache:{},toggleClass:function(_7b){if(this.hasClass(_7b)){this.removeClass(_7b);}else{this.addClass(_7b);}return this;},hasClass:function(_7c){return _7c&&(" "+this.dom.className+" ").indexOf(" "+_7c+" ")!=-1;},replaceClass:function(_7d,_7e){this.removeClass(_7d);this.addClass(_7e);return this;},getStyles:function(){var a=arguments,len=a.length,r={};for(var i=0;i<len;i++){r[a[i]]=this.getStyle(a[i]);}return r;},getStyle:function(){return _9&&_9.getComputedStyle?function(_83){var el=this.dom,v,cs,_87;if(_83=="float"){_83="cssFloat";}if(v=el.style[_83]){return v;}if(cs=_9.getComputedStyle(el,"")){if(!(_87=_4[_83])){_87=_4[_83]=_83.replace(_5,_6);}return cs[_87];}return null;}:function(_88){var el=this.dom,v,cs,_8c;if(_88=="opacity"){if(typeof el.style.filter=="string"){var m=el.style.filter.match(/alpha\(opacity=(.*)\)/i);if(m){var fv=parseFloat(m[1]);if(!isNaN(fv)){return fv?fv/100:0;}}}return 1;}else{if(_88=="float"){_88="styleFloat";}}if(!(_8c=_4[_88])){_8c=_4[_88]=_88.replace(_5,_6);}if(v=el.style[_8c]){return v;}if(cs=el.currentStyle){return cs[_8c];}return null;};}(),setStyle:function(_8f,_90){if(typeof _8f=="string"){var _91;if(!(_91=_4[_8f])){_91=_4[_8f]=_8f.replace(_5,_6);}if(_91=="opacity"){this.setOpacity(_90);}else{this.dom.style[_91]=_90;}}else{for(var _92 in _8f){if(typeof _8f[_92]!="function"){this.setStyle(_92,_8f[_92]);}}}return this;},applyStyles:function(_93){Ext.DomHelper.applyStyles(this.dom,_93);return this;},getX:function(){return D.getX(this.dom);},getY:function(){return D.getY(this.dom);},getXY:function(){return D.getXY(this.dom);},setX:function(x,_95){if(!_95||!A){D.setX(this.dom,x);}else{this.setXY([x,this.getY()],this.preanim(arguments,1));}return this;},setY:function(y,_97){if(!_97||!A){D.setY(this.dom,y);}else{this.setXY([this.getX(),y],this.preanim(arguments,1));}return this;},setLeft:function(_98){this.setStyle("left",this.addUnits(_98));return this;},setTop:function(top){this.setStyle("top",this.addUnits(top));return this;},setRight:function(_9a){this.setStyle("right",this.addUnits(_9a));return this;},setBottom:function(_9b){this.setStyle("bottom",this.addUnits(_9b));return this;},setXY:function(pos,_9d){if(!_9d||!A){D.setXY(this.dom,pos);}else{this.anim({points:{to:pos}},this.preanim(arguments,1),"motion");}return this;},setLocation:function(x,y,_a0){this.setXY([x,y],this.preanim(arguments,2));return this;},moveTo:function(x,y,_a3){this.setXY([x,y],this.preanim(arguments,2));return this;},getRegion:function(){return D.getRegion(this.dom);},getHeight:function(_a4){var h=this.dom.offsetHeight||0;return _a4!==true?h:h-this.getBorderWidth("tb")-this.getPadding("tb");},getWidth:function(_a6){var w=this.dom.offsetWidth||0;return _a6!==true?w:w-this.getBorderWidth("lr")-this.getPadding("lr");},getComputedHeight:function(){var h=Math.max(this.dom.offsetHeight,this.dom.clientHeight);if(!h){h=parseInt(this.getStyle("height"),10)||0;if(!this.isBorderBox()){h+=this.getFrameWidth("tb");}}return h;},getComputedWidth:function(){var w=Math.max(this.dom.offsetWidth,this.dom.clientWidth);if(!w){w=parseInt(this.getStyle("width"),10)||0;if(!this.isBorderBox()){w+=this.getFrameWidth("lr");}}return w;},getSize:function(_aa){return{width:this.getWidth(_aa),height:this.getHeight(_aa)};},getViewSize:function(){var d=this.dom,doc=document,aw=0,ah=0;if(d==doc||d==doc.body){return{width:D.getViewWidth(),height:D.getViewHeight()};}else{return{width:d.clientWidth,height:d.clientHeight};}},getValue:function(_af){return _af?parseInt(this.dom.value,10):this.dom.value;},adjustWidth:function(_b0){if(typeof _b0=="number"){if(this.autoBoxAdjust&&!this.isBorderBox()){_b0-=(this.getBorderWidth("lr")+this.getPadding("lr"));}if(_b0<0){_b0=0;}}return _b0;},adjustHeight:function(_b1){if(typeof _b1=="number"){if(this.autoBoxAdjust&&!this.isBorderBox()){_b1-=(this.getBorderWidth("tb")+this.getPadding("tb"));}if(_b1<0){_b1=0;}}return _b1;},setWidth:function(_b2,_b3){_b2=this.adjustWidth(_b2);if(!_b3||!A){this.dom.style.width=this.addUnits(_b2);}else{this.anim({width:{to:_b2}},this.preanim(arguments,1));}return this;},setHeight:function(_b4,_b5){_b4=this.adjustHeight(_b4);if(!_b5||!A){this.dom.style.height=this.addUnits(_b4);}else{this.anim({height:{to:_b4}},this.preanim(arguments,1));}return this;},setSize:function(_b6,_b7,_b8){if(typeof _b6=="object"){_b7=_b6.height;_b6=_b6.width;}_b6=this.adjustWidth(_b6);_b7=this.adjustHeight(_b7);if(!_b8||!A){this.dom.style.width=this.addUnits(_b6);this.dom.style.height=this.addUnits(_b7);}else{this.anim({width:{to:_b6},height:{to:_b7}},this.preanim(arguments,2));}return this;},setBounds:function(x,y,_bb,_bc,_bd){if(!_bd||!A){this.setSize(_bb,_bc);this.setLocation(x,y);}else{_bb=this.adjustWidth(_bb);_bc=this.adjustHeight(_bc);this.anim({points:{to:[x,y]},width:{to:_bb},height:{to:_bc}},this.preanim(arguments,4),"motion");}return this;},setRegion:function(_be,_bf){this.setBounds(_be.left,_be.top,_be.right-_be.left,_be.bottom-_be.top,this.preanim(arguments,1));return this;},addListener:function(_c0,fn,_c2,_c3){Ext.EventManager.on(this.dom,_c0,fn,_c2||this,_c3);},removeListener:function(_c4,fn){Ext.EventManager.removeListener(this.dom,_c4,fn);return this;},removeAllListeners:function(){E.purgeElement(this.dom);return this;},relayEvent:function(_c6,_c7){this.on(_c6,function(e){_c7.fireEvent(_c6,e);});},setOpacity:function(_c9,_ca){if(!_ca||!A){var s=this.dom.style;if(Ext.isIE){s.zoom=1;s.filter=(s.filter||"").replace(/alpha\([^\)]*\)/gi,"")+(_c9==1?"":"alpha(opacity="+_c9*100+")");}else{s.opacity=_c9;}}else{this.anim({opacity:{to:_c9}},this.preanim(arguments,1),null,0.35,"easeIn");}return this;},getLeft:function(_cc){if(!_cc){return this.getX();}else{return parseInt(this.getStyle("left"),10)||0;}},getRight:function(_cd){if(!_cd){return this.getX()+this.getWidth();}else{return(this.getLeft(true)+this.getWidth())||0;}},getTop:function(_ce){if(!_ce){return this.getY();}else{return parseInt(this.getStyle("top"),10)||0;}},getBottom:function(_cf){if(!_cf){return this.getY()+this.getHeight();}else{return(this.getTop(true)+this.getHeight())||0;}},position:function(pos,_d1,x,y){if(!pos){if(this.getStyle("position")=="static"){this.setStyle("position","relative");}}else{this.setStyle("position",pos);}if(_d1){this.setStyle("z-index",_d1);}if(x!==undefined&&y!==undefined){this.setXY([x,y]);}else{if(x!==undefined){this.setX(x);}else{if(y!==undefined){this.setY(y);}}}},clearPositioning:function(_d4){_d4=_d4||"";this.setStyle({"left":_d4,"right":_d4,"top":_d4,"bottom":_d4,"z-index":"","position":"static"});return this;},getPositioning:function(){var l=this.getStyle("left");var t=this.getStyle("top");return{"position":this.getStyle("position"),"left":l,"right":l?"":this.getStyle("right"),"top":t,"bottom":t?"":this.getStyle("bottom"),"z-index":this.getStyle("z-index")};},getBorderWidth:function(_d7){return this.addStyles(_d7,El.borders);},getPadding:function(_d8){return this.addStyles(_d8,El.paddings);},setPositioning:function(pc){this.applyStyles(pc);if(pc.right=="auto"){this.dom.style.right="";}if(pc.bottom=="auto"){this.dom.style.bottom="";}return this;},fixDisplay:function(){if(this.getStyle("display")=="none"){this.setStyle("visibility","hidden");this.setStyle("display",this.originalDisplay);if(this.getStyle("display")=="none"){this.setStyle("display","block");}}},setLeftTop:function(_da,top){this.dom.style.left=this.addUnits(_da);this.dom.style.top=this.addUnits(top);return this;},move:function(_dc,_dd,_de){var xy=this.getXY();_dc=_dc.toLowerCase();switch(_dc){case"l":case"left":this.moveTo(xy[0]-_dd,xy[1],this.preanim(arguments,2));break;case"r":case"right":this.moveTo(xy[0]+_dd,xy[1],this.preanim(arguments,2));break;case"t":case"top":case"up":this.moveTo(xy[0],xy[1]-_dd,this.preanim(arguments,2));break;case"b":case"bottom":case"down":this.moveTo(xy[0],xy[1]+_dd,this.preanim(arguments,2));break;}return this;},clip:function(){if(!this.isClipped){this.isClipped=true;this.originalClip={"o":this.getStyle("overflow"),"x":this.getStyle("overflow-x"),"y":this.getStyle("overflow-y")};this.setStyle("overflow","hidden");this.setStyle("overflow-x","hidden");this.setStyle("overflow-y","hidden");}return this;},unclip:function(){if(this.isClipped){this.isClipped=false;var o=this.originalClip;if(o.o){this.setStyle("overflow",o.o);}if(o.x){this.setStyle("overflow-x",o.x);}if(o.y){this.setStyle("overflow-y",o.y);}}return this;},getAnchorXY:function(_e1,_e2,s){var w,h,vp=false;if(!s){var d=this.dom;if(d==document.body||d==document){vp=true;w=D.getViewWidth();h=D.getViewHeight();}else{w=this.getWidth();h=this.getHeight();}}else{w=s.width;h=s.height;}var x=0,y=0,r=Math.round;switch((_e1||"tl").toLowerCase()){case"c":x=r(w*0.5);y=r(h*0.5);break;case"t":x=r(w*0.5);y=0;break;case"l":x=0;y=r(h*0.5);break;case"r":x=w;y=r(h*0.5);break;case"b":x=r(w*0.5);y=h;break;case"tl":x=0;y=0;break;case"bl":x=0;y=h;break;case"br":x=w;y=h;break;case"tr":x=w;y=0;break;}if(_e2===true){return[x,y];}if(vp){var sc=this.getScroll();return[x+sc.left,y+sc.top];}var o=this.getXY();return[x+o[0],y+o[1]];},getAlignToXY:function(el,p,o){el=Ext.get(el);var d=this.dom;if(!el.dom){throw"Element.alignTo with an element that doesn't exist";}var c=false;var p1="",p2="";o=o||[0,0];if(!p){p="tl-bl";}else{if(p=="?"){p="tl-bl?";}else{if(p.indexOf("-")==-1){p="tl-"+p;}}}p=p.toLowerCase();var m=p.match(/^([a-z]+)-([a-z]+)(\?)?$/);if(!m){throw"Element.alignTo with an invalid alignment "+p;}p1=m[1];p2=m[2];c=!!m[3];var a1=this.getAnchorXY(p1,true);var a2=el.getAnchorXY(p2,false);var x=a2[0]-a1[0]+o[0];var y=a2[1]-a1[1]+o[1];if(c){var w=this.getWidth(),h=this.getHeight(),r=el.getRegion();var dw=D.getViewWidth()-5,dh=D.getViewHeight()-5;var p1y=p1.charAt(0),p1x=p1.charAt(p1.length-1);var p2y=p2.charAt(0),p2x=p2.charAt(p2.length-1);var _102=((p1y=="t"&&p2y=="b")||(p1y=="b"&&p2y=="t"));var _103=((p1x=="r"&&p2x=="l")||(p1x=="l"&&p2x=="r"));var doc=document;var _105=(doc.documentElement.scrollLeft||doc.body.scrollLeft||0)+5;var _106=(doc.documentElement.scrollTop||doc.body.scrollTop||0)+5;if((x+w)>dw+_105){x=_103?r.left-w:dw+_105-w;}if(x<_105){x=_103?r.right:_105;}if((y+h)>dh+_106){y=_102?r.top-h:dh+_106-h;}if(y<_106){y=_102?r.bottom:_106;}}return[x,y];},getConstrainToXY:function(){var os={top:0,left:0,bottom:0,right:0};return function(el,_109,_10a,_10b){el=Ext.get(el);_10a=_10a?Ext.applyIf(_10a,os):os;var vw,vh,vx=0,vy=0;if(el.dom==document.body||el.dom==document){vw=Ext.lib.Dom.getViewWidth();vh=Ext.lib.Dom.getViewHeight();}else{vw=el.dom.clientWidth;vh=el.dom.clientHeight;if(!_109){var vxy=el.getXY();vx=vxy[0];vy=vxy[1];}}var s=el.getScroll();vx+=_10a.left+s.left;vy+=_10a.top+s.top;vw-=_10a.right;vh-=_10a.bottom;var vr=vx+vw;var vb=vy+vh;var xy=_10b||(!_109?this.getXY():[this.getLeft(true),this.getTop(true)]);var x=xy[0],y=xy[1];var w=this.dom.offsetWidth,h=this.dom.offsetHeight;var _119=false;if((x+w)>vr){x=vr-w;_119=true;}if((y+h)>vb){y=vb-h;_119=true;}if(x<vx){x=vx;_119=true;}if(y<vy){y=vy;_119=true;}return _119?[x,y]:false;};}(),adjustForConstraints:function(xy,_11b,_11c){return this.getConstrainToXY(_11b||document,false,_11c,xy)||xy;},alignTo:function(_11d,_11e,_11f,_120){var xy=this.getAlignToXY(_11d,_11e,_11f);this.setXY(xy,this.preanim(arguments,3));return this;},anchorTo:function(el,_123,_124,_125,_126,_127){var _128=function(){this.alignTo(el,_123,_124,_125);Ext.callback(_127,this);};Ext.EventManager.onWindowResize(_128,this);var tm=typeof _126;if(tm!="undefined"){Ext.EventManager.on(window,"scroll",_128,this,{buffer:tm=="number"?_126:50});}_128.call(this);return this;},clearOpacity:function(){if(window.ActiveXObject){if(typeof this.dom.style.filter=="string"&&(/alpha/i).test(this.dom.style.filter)){this.dom.style.filter="";}}else{this.dom.style.opacity="";this.dom.style["-moz-opacity"]="";this.dom.style["-khtml-opacity"]="";}return this;},hide:function(_12a){this.setVisible(false,this.preanim(arguments,0));return this;},show:function(_12b){this.setVisible(true,this.preanim(arguments,0));return this;},addUnits:function(size){return Ext.Element.addUnits(size,this.defaultUnit);},beginMeasure:function(){var el=this.dom;if(el.offsetWidth||el.offsetHeight){return this;}var _12e=[];var p=this.dom,b=document.body;while((!el.offsetWidth&&!el.offsetHeight)&&p&&p.tagName&&p!=b){var pe=Ext.get(p);if(pe.getStyle("display")=="none"){_12e.push({el:p,visibility:pe.getStyle("visibility")});p.style.visibility="hidden";p.style.display="block";}p=p.parentNode;}this._measureChanged=_12e;return this;},endMeasure:function(){var _132=this._measureChanged;if(_132){for(var i=0,len=_132.length;i<len;i++){var r=_132[i];r.el.style.visibility=r.visibility;r.el.style.display="none";}this._measureChanged=null;}return this;},update:function(html,_137,_138){if(typeof html=="undefined"){html="";}if(_137!==true){this.dom.innerHTML=html;if(typeof _138=="function"){_138();}return this;}var id=Ext.id();var dom=this.dom;html+="<span id=\""+id+"\"></span>";E.onAvailable(id,function(){var hd=document.getElementsByTagName("head")[0];var re=/(?:<script([^>]*)?>)((\n|\r|.)*?)(?:<\/script>)/ig;var _13d=/\ssrc=([\'\"])(.*?)\1/i;var _13e=/\stype=([\'\"])(.*?)\1/i;var _13f;while(_13f=re.exec(html)){var _140=_13f[1];var _141=_140?_140.match(_13d):false;if(_141&&_141[2]){var s=document.createElement("script");s.src=_141[2];var _143=_140.match(_13e);if(_143&&_143[2]){s.type=_143[2];}hd.appendChild(s);}else{if(_13f[2]&&_13f[2].length>0){eval(_13f[2]);}}}var el=document.getElementById(id);if(el){el.parentNode.removeChild(el);}if(typeof _138=="function"){_138();}});dom.innerHTML=html.replace(/(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig,"");return this;},load:function(){var um=this.getUpdateManager();um.update.apply(um,arguments);return this;},getUpdateManager:function(){if(!this.updateManager){this.updateManager=new Ext.UpdateManager(this);}return this.updateManager;},unselectable:function(){this.dom.unselectable="on";this.swallowEvent("selectstart",true);this.applyStyles("-moz-user-select:none;-khtml-user-select:none;");this.addClass("x-unselectable");return this;},getCenterXY:function(){return this.getAlignToXY(document,"c-c");},center:function(_146){this.alignTo(_146||document,"c-c");return this;},isBorderBox:function(){return _147[this.dom.tagName.toLowerCase()]||Ext.isBorderBox;},getBox:function(_148,_149){var xy;if(!_149){xy=this.getXY();}else{var left=parseInt(this.getStyle("left"),10)||0;var top=parseInt(this.getStyle("top"),10)||0;xy=[left,top];}var el=this.dom,w=el.offsetWidth,h=el.offsetHeight,bx;if(!_148){bx={x:xy[0],y:xy[1],0:xy[0],1:xy[1],width:w,height:h};}else{var l=this.getBorderWidth("l")+this.getPadding("l");var r=this.getBorderWidth("r")+this.getPadding("r");var t=this.getBorderWidth("t")+this.getPadding("t");var b=this.getBorderWidth("b")+this.getPadding("b");bx={x:xy[0]+l,y:xy[1]+t,0:xy[0]+l,1:xy[1]+t,width:w-(l+r),height:h-(t+b)};}bx.right=bx.x+bx.width;bx.bottom=bx.y+bx.height;return bx;},getFrameWidth:function(_155,_156){return _156&&Ext.isBorderBox?0:(this.getPadding(_155)+this.getBorderWidth(_155));},setBox:function(box,_158,_159){var w=box.width,h=box.height;if((_158&&!this.autoBoxAdjust)&&!this.isBorderBox()){w-=(this.getBorderWidth("lr")+this.getPadding("lr"));h-=(this.getBorderWidth("tb")+this.getPadding("tb"));}this.setBounds(box.x,box.y,w,h,this.preanim(arguments,2));return this;},repaint:function(){var dom=this.dom;this.addClass("x-repaint");setTimeout(function(){Ext.get(dom).removeClass("x-repaint");},1);return this;},getMargins:function(side){if(!side){return{top:parseInt(this.getStyle("margin-top"),10)||0,left:parseInt(this.getStyle("margin-left"),10)||0,bottom:parseInt(this.getStyle("margin-bottom"),10)||0,right:parseInt(this.getStyle("margin-right"),10)||0};}else{return this.addStyles(side,El.margins);}},addStyles:function(_15e,_15f){var val=0,v,w;for(var i=0,len=_15e.length;i<len;i++){v=this.getStyle(_15f[_15e.charAt(i)]);if(v){w=parseInt(v,10);if(w){val+=w;}}}return val;},createProxy:function(_165,_166,_167){if(_166){_166=Ext.getDom(_166);}else{_166=document.body;}_165=typeof _165=="object"?_165:{tag:"div",cls:_165};var _168=Ext.DomHelper.append(_166,_165,true);if(_167){_168.setBox(this.getBox());}return _168;},mask:function(msg,_16a){if(this.getStyle("position")=="static"){this.setStyle("position","relative");}if(!this._mask){this._mask=Ext.DomHelper.append(this.dom,{cls:"ext-el-mask"},true);}this.addClass("x-masked");this._mask.setDisplayed(true);if(typeof msg=="string"){if(!this._maskMsg){this._maskMsg=Ext.DomHelper.append(this.dom,{cls:"ext-el-mask-msg",cn:{tag:"div"}},true);}var mm=this._maskMsg;mm.dom.className=_16a?"ext-el-mask-msg "+_16a:"ext-el-mask-msg";mm.dom.firstChild.innerHTML=msg;mm.setDisplayed(true);mm.center(this);}if(Ext.isIE&&!(Ext.isIE7&&Ext.isStrict)&&this.getStyle("height")=="auto"){this._mask.setHeight(this.getHeight());}return this._mask;},unmask:function(_16c){if(this._mask){if(_16c===true){this._mask.remove();delete this._mask;if(this._maskMsg){this._maskMsg.remove();delete this._maskMsg;}}else{this._mask.setDisplayed(false);if(this._maskMsg){this._maskMsg.setDisplayed(false);}}}this.removeClass("x-masked");},isMasked:function(){return this._mask&&this._mask.isVisible();},createShim:function(){var el=document.createElement("iframe");el.frameBorder="no";el.className="ext-shim";if(Ext.isIE&&Ext.isSecure){el.src=Ext.SSL_SECURE_URL;}var shim=Ext.get(this.dom.parentNode.insertBefore(el,this.dom));shim.autoBoxAdjust=false;return shim;},remove:function(){if(this.dom.parentNode){this.dom.parentNode.removeChild(this.dom);}delete El.cache[this.dom.id];},addClassOnOver:function(_16f,_170){this.on("mouseover",function(){Ext.fly(this,"_internal").addClass(_16f);},this.dom);var _171=function(e){if(_170!==true||!e.within(this,true)){Ext.fly(this,"_internal").removeClass(_16f);}};this.on("mouseout",_171,this.dom);return this;},addClassOnFocus:function(_173){this.on("focus",function(){Ext.fly(this,"_internal").addClass(_173);},this.dom);this.on("blur",function(){Ext.fly(this,"_internal").removeClass(_173);},this.dom);return this;},addClassOnClick:function(_174){var dom=this.dom;this.on("mousedown",function(){Ext.fly(dom,"_internal").addClass(_174);var d=Ext.get(document);var fn=function(){Ext.fly(dom,"_internal").removeClass(_174);d.removeListener("mouseup",fn);};d.on("mouseup",fn);});return this;},swallowEvent:function(_178,_179){var fn=function(e){e.stopPropagation();if(_179){e.preventDefault();}};if(_178 instanceof Array){for(var i=0,len=_178.length;i<len;i++){this.on(_178[i],fn);}return this;}this.on(_178,fn);return this;},fitToParentDelegate:Ext.emptyFn,fitToParent:function(_17e,_17f){Ext.EventManager.removeResizeListener(this.fitToParentDelegate);this.fitToParentDelegate=Ext.emptyFn;if(_17e===true&&!this.dom.parentNode){return;}var p=Ext.get(_17f||this.dom.parentNode);this.setSize(p.getComputedWidth()-p.getFrameWidth("lr"),p.getComputedHeight()-p.getFrameWidth("tb"));if(_17e===true){this.fitToParentDelegate=this.fitToParent.createDelegate(this,[true,_17f]);Ext.EventManager.onWindowResize(this.fitToParentDelegate);}return this;},getNextSibling:function(){var n=this.dom.nextSibling;while(n&&n.nodeType!=1){n=n.nextSibling;}return n;},getPrevSibling:function(){var n=this.dom.previousSibling;while(n&&n.nodeType!=1){n=n.previousSibling;}return n;},appendChild:function(el){el=Ext.get(el);el.appendTo(this);return this;},createChild:function(_184,_185,_186){_184=_184||{tag:"div"};if(_185){return Ext.DomHelper.insertBefore(_185,_184,_186!==true);}return Ext.DomHelper[!this.dom.firstChild?"overwrite":"append"](this.dom,_184,_186!==true);},appendTo:function(el){el=Ext.getDom(el);el.appendChild(this.dom);return this;},insertBefore:function(el){el=Ext.getDom(el);el.parentNode.insertBefore(this.dom,el);return this;},insertAfter:function(el){el=Ext.getDom(el);el.parentNode.insertBefore(this.dom,el.nextSibling);return this;},insertFirst:function(el,_18b){el=el||{};if(typeof el=="object"&&!el.nodeType){return this.createChild(el,this.dom.firstChild,_18b);}else{el=Ext.getDom(el);this.dom.insertBefore(el,this.dom.firstChild);return!_18b?Ext.get(el):el;}},insertSibling:function(el,_18d,_18e){_18d=_18d?_18d.toLowerCase():"before";el=el||{};var rt,_190=_18d=="before"?this.dom:this.dom.nextSibling;if(typeof el=="object"&&!el.nodeType){if(_18d=="after"&&!this.dom.nextSibling){rt=Ext.DomHelper.append(this.dom.parentNode,el,!_18e);}else{rt=Ext.DomHelper[_18d=="after"?"insertAfter":"insertBefore"](this.dom,el,!_18e);}}else{rt=this.dom.parentNode.insertBefore(Ext.getDom(el),_18d=="before"?this.dom:this.dom.nextSibling);if(!_18e){rt=Ext.get(rt);}}return rt;},wrap:function(_191,_192){if(!_191){_191={tag:"div"};}var _193=Ext.DomHelper.insertBefore(this.dom,_191,!_192);_193.dom?_193.dom.appendChild(this.dom):_193.appendChild(this.dom);return _193;},replace:function(el){el=Ext.get(el);this.insertBefore(el);el.remove();return this;},insertHtml:function(_195,html,_197){var el=Ext.DomHelper.insertHtml(_195,this.dom,html);return _197?Ext.get(el):el;},set:function(o,_19a){var el=this.dom;_19a=typeof _19a=="undefined"?(el.setAttribute?true:false):_19a;for(var attr in o){if(attr=="style"||typeof o[attr]=="function"){continue;}if(attr=="cls"){el.className=o["cls"];}else{if(_19a){el.setAttribute(attr,o[attr]);}else{el[attr]=o[attr];}}}if(o.style){Ext.DomHelper.applyStyles(el,o.style);}return this;},addKeyListener:function(key,fn,_19f){var _1a0;if(typeof key!="object"||key instanceof Array){_1a0={key:key,fn:fn,scope:_19f};}else{_1a0={key:key.key,shift:key.shift,ctrl:key.ctrl,alt:key.alt,fn:fn,scope:_19f};}return new Ext.KeyMap(this,_1a0);},addKeyMap:function(_1a1){return new Ext.KeyMap(this,_1a1);},isScrollable:function(){var dom=this.dom;return dom.scrollHeight>dom.clientHeight||dom.scrollWidth>dom.clientWidth;},scrollTo:function(side,_1a4,_1a5){var prop=side.toLowerCase()=="left"?"scrollLeft":"scrollTop";if(!_1a5||!A){this.dom[prop]=_1a4;}else{var to=prop=="scrollLeft"?[_1a4,this.dom.scrollTop]:[this.dom.scrollLeft,_1a4];this.anim({scroll:{"to":to}},this.preanim(arguments,2),"scroll");}return this;},scroll:function(_1a8,_1a9,_1aa){if(!this.isScrollable()){return;}var el=this.dom;var l=el.scrollLeft,t=el.scrollTop;var w=el.scrollWidth,h=el.scrollHeight;var cw=el.clientWidth,ch=el.clientHeight;_1a8=_1a8.toLowerCase();var _1b2=false;var a=this.preanim(arguments,2);switch(_1a8){case"l":case"left":if(w-l>cw){var v=Math.min(l+_1a9,w-cw);this.scrollTo("left",v,a);_1b2=true;}break;case"r":case"right":if(l>0){var v=Math.max(l-_1a9,0);this.scrollTo("left",v,a);_1b2=true;}break;case"t":case"top":case"up":if(t>0){var v=Math.max(t-_1a9,0);this.scrollTo("top",v,a);_1b2=true;}break;case"b":case"bottom":case"down":if(h-t>ch){var v=Math.min(t+_1a9,h-ch);this.scrollTo("top",v,a);_1b2=true;}break;}return _1b2;},translatePoints:function(x,y){if(typeof x=="object"||x instanceof Array){y=x[1];x=x[0];}var p=this.getStyle("position");var o=this.getXY();var l=parseInt(this.getStyle("left"),10);var t=parseInt(this.getStyle("top"),10);if(isNaN(l)){l=(p=="relative")?0:this.dom.offsetLeft;}if(isNaN(t)){t=(p=="relative")?0:this.dom.offsetTop;}return{left:(x-o[0]+l),top:(y-o[1]+t)};},getScroll:function(){var d=this.dom,doc=document;if(d==doc||d==doc.body){var l=window.pageXOffset||doc.documentElement.scrollLeft||doc.body.scrollLeft||0;var t=window.pageYOffset||doc.documentElement.scrollTop||doc.body.scrollTop||0;return{left:l,top:t};}else{return{left:d.scrollLeft,top:d.scrollTop};}},getColor:function(attr,_1c0,_1c1){var v=this.getStyle(attr);if(!v||v=="transparent"||v=="inherit"){return _1c0;}var _1c3=typeof _1c1=="undefined"?"#":_1c1;if(v.substr(0,4)=="rgb("){var rvs=v.slice(4,v.length-1).split(",");for(var i=0;i<3;i++){var h=parseInt(rvs[i]).toString(16);if(h<16){h="0"+h;}_1c3+=h;}}else{if(v.substr(0,1)=="#"){if(v.length==4){for(var i=1;i<4;i++){var c=v.charAt(i);_1c3+=c+c;}}else{if(v.length==7){_1c3+=v.substr(1);}}}}return(_1c3.length>5?_1c3.toLowerCase():_1c0);},boxWrap:function(cls){cls=cls||"x-box";var el=Ext.get(this.insertHtml("beforeBegin",String.format("<div class=\"{0}\">"+El.boxMarkup+"</div>",cls)));el.child("."+cls+"-mc").dom.appendChild(this.dom);return el;},getAttributeNS:Ext.isIE?function(ns,name){var d=this.dom;var type=typeof d[ns+":"+name];if(type!="undefined"&&type!="unknown"){return d[ns+":"+name];}return d[name];}:function(ns,name){var d=this.dom;return d.getAttributeNS(ns,name)||d.getAttribute(ns+":"+name)||d.getAttribute(name)||d[name];}};var ep=El.prototype;ep.on=ep.addListener;ep.mon=ep.addListener;ep.un=ep.removeListener;ep.autoBoxAdjust=true;El.unitPattern=/\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i;El.addUnits=function(v,_1d3){if(v===""||v=="auto"){return v;}if(v===undefined){return"";}if(typeof v=="number"||!El.unitPattern.test(v)){return v+(_1d3||"px");}return v;};El.boxMarkup="<div class=\"{0}-tl\"><div class=\"{0}-tr\"><div class=\"{0}-tc\"></div></div></div><div class=\"{0}-ml\"><div class=\"{0}-mr\"><div class=\"{0}-mc\"></div></div></div><div class=\"{0}-bl\"><div class=\"{0}-br\"><div class=\"{0}-bc\"></div></div></div>";El.VISIBILITY=1;El.DISPLAY=2;El.borders={l:"border-left-width",r:"border-right-width",t:"border-top-width",b:"border-bottom-width"};El.paddings={l:"padding-left",r:"padding-right",t:"padding-top",b:"padding-bottom"};El.margins={l:"margin-left",r:"margin-right",t:"margin-top",b:"margin-bottom"};El.cache={};var _1d4;El.get=function(el){var ex,elm,id;if(!el){return null;}if(typeof el=="string"){if(!(elm=document.getElementById(el))){return null;}if(ex=El.cache[el]){ex.dom=elm;}else{ex=El.cache[el]=new El(elm);}return ex;}else{if(el.tagName){if(!(id=el.id)){id=Ext.id(el);}if(ex=El.cache[id]){ex.dom=el;}else{ex=El.cache[id]=new El(el);}return ex;}else{if(el instanceof El){if(el!=_1d4){el.dom=document.getElementById(el.id)||el.dom;El.cache[el.id]=el;}return el;}else{if(el.isComposite){return el;}else{if(el instanceof Array){return El.select(el);}else{if(el==document){if(!_1d4){var f=function(){};f.prototype=El.prototype;_1d4=new f();_1d4.dom=document;}return _1d4;}}}}}}return null;};El.uncache=function(el){for(var i=0,a=arguments,len=a.length;i<len;i++){if(a[i]){delete El.cache[a[i].id||a[i]];}}};El.garbageCollect=function(){if(!Ext.enableGarbageCollector){clearInterval(El.collectorThread);return;}for(var eid in El.cache){var el=El.cache[eid],d=el.dom;if(!d||!d.parentNode||(!d.offsetParent&&!document.getElementById(eid))){delete El.cache[eid];if(d&&Ext.enableListenerCollection){E.purgeElement(d);}}}};El.collectorThreadId=setInterval(El.garbageCollect,30000);El.Flyweight=function(dom){this.dom=dom;};El.Flyweight.prototype=El.prototype;El._flyweights={};El.fly=function(el,_1e3){_1e3=_1e3||"_global";el=Ext.getDom(el);if(!el){return null;}if(!El._flyweights[_1e3]){El._flyweights[_1e3]=new El.Flyweight();}El._flyweights[_1e3].dom=el;return El._flyweights[_1e3];};Ext.get=El.get;Ext.fly=El.fly;var _147=Ext.isStrict?{select:1}:{input:1,select:1,textarea:1};if(Ext.isIE||Ext.isGecko){_147["button"]=1;}Ext.EventManager.on(window,"unload",function(){delete El.cache;delete El._flyweights;});})();
Ext.data.Connection=function(_1){Ext.apply(this,_1);this.addEvents({"beforerequest":true,"requestcomplete":true,"requestexception":true});Ext.data.Connection.superclass.constructor.call(this);};Ext.extend(Ext.data.Connection,Ext.util.Observable,{timeout:30000,autoAbort:false,disableCaching:true,request:function(o){if(this.fireEvent("beforerequest",this,o)!==false){var p=o.params;if(typeof p=="function"){p=p.call(o.scope||window,o);}if(typeof p=="object"){p=Ext.urlEncode(o.params);}if(this.extraParams){var _4=Ext.urlEncode(this.extraParams);p=p?(p+"&"+_4):_4;}var _5=o.url||this.url;if(typeof _5=="function"){_5=_5.call(o.scope||window,o);}if(o.form){var _6=Ext.getDom(o.form);_5=_5||_6.action;var _7=_6.getAttribute("enctype");if(o.isUpload||(_7&&_7.toLowerCase()=="multipart/form-data")){return this.doFormUpload(o,p,_5);}var f=Ext.lib.Ajax.serializeForm(_6);p=p?(p+"&"+f):f;}var hs=o.headers;if(this.defaultHeaders){hs=Ext.apply(hs||{},this.defaultHeaders);if(!o.headers){o.headers=hs;}}var cb={success:this.handleResponse,failure:this.handleFailure,scope:this,argument:{options:o},timeout:this.timeout};var _b=o.method||this.method||(p?"POST":"GET");if(_b=="GET"&&(this.disableCaching&&o.disableCaching!==false)||o.disableCaching===true){_5+=(_5.indexOf("?")!=-1?"&":"?")+"_dc="+(new Date().getTime());}if(typeof o.autoAbort=="boolean"){if(o.autoAbort){this.abort();}}else{if(this.autoAbort!==false){this.abort();}}if((_b=="GET"&&p)||o.xmlData){_5+=(_5.indexOf("?")!=-1?"&":"?")+p;p="";}this.transId=Ext.lib.Ajax.request(_b,_5,cb,p,o);return this.transId;}else{Ext.callback(o.callback,o.scope,[o,null,null]);return null;}},isLoading:function(_c){if(_c){return Ext.lib.Ajax.isCallInProgress(_c);}else{return this.transId?true:false;}},abort:function(_d){if(_d||this.isLoading()){Ext.lib.Ajax.abort(_d||this.transId);}},handleResponse:function(_e){this.transId=false;var _f=_e.argument.options;_e.argument=_f?_f.argument:null;this.fireEvent("requestcomplete",this,_e,_f);Ext.callback(_f.success,_f.scope,[_e,_f]);Ext.callback(_f.callback,_f.scope,[_f,true,_e]);},handleFailure:function(_10,e){this.transId=false;var _12=_10.argument.options;_10.argument=_12?_12.argument:null;this.fireEvent("requestexception",this,_10,_12,e);Ext.callback(_12.failure,_12.scope,[_10,_12]);Ext.callback(_12.callback,_12.scope,[_12,false,_10]);},doFormUpload:function(o,ps,url){var id=Ext.id();var _17=document.createElement("iframe");_17.id=id;_17.name=id;_17.className="x-hidden";if(Ext.isIE){_17.src=Ext.SSL_SECURE_URL;}document.body.appendChild(_17);if(Ext.isIE){document.frames[id].name=id;}var _18=Ext.getDom(o.form);_18.target=id;_18.method="POST";_18.enctype=_18.encoding="multipart/form-data";if(url){_18.action=url;}var _19,hd;if(ps){_19=[];ps=Ext.urlDecode(ps,false);for(var k in ps){if(ps.hasOwnProperty(k)){hd=document.createElement("input");hd.type="hidden";hd.name=k;hd.value=ps[k];_18.appendChild(hd);_19.push(hd);}}}function cb(){var r={responseText:"",responseXML:null};r.argument=o?o.argument:null;try{var doc;if(Ext.isIE){doc=_17.contentWindow.document;}else{doc=(_17.contentDocument||window.frames[id].document);}if(doc&&doc.body){r.responseText=doc.body.innerHTML;}if(doc&&doc.XMLDocument){r.responseXML=doc.XMLDocument;}else{r.responseXML=doc;}}catch(e){}Ext.EventManager.removeListener(_17,"load",cb,this);this.fireEvent("requestcomplete",this,r,o);Ext.callback(o.success,o.scope,[r,o]);Ext.callback(o.callback,o.scope,[o,true,r]);setTimeout(function(){document.body.removeChild(_17);},100);}Ext.EventManager.on(_17,"load",cb,this);_18.submit();if(_19){for(var i=0,len=_19.length;i<len;i++){_18.removeChild(_19[i]);}}}});Ext.Ajax=new Ext.data.Connection({autoAbort:false,serializeForm:function(_20){return Ext.lib.Ajax.serializeForm(_20);}});
Ext.util.JSON=new(function(){var _1={}.hasOwnProperty?true:false;var _2=function(n){return n<10?"0"+n:n;};var m={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\"":"\\\"","\\":"\\\\"};var _5=function(s){if(/["\\\x00-\x1f]/.test(s)){return"\""+s.replace(/([\x00-\x1f\\"])/g,function(a,b){var c=m[b];if(c){return c;}c=b.charCodeAt();return"\\u00"+Math.floor(c/16).toString(16)+(c%16).toString(16);})+"\"";}return"\""+s+"\"";};var _a=function(o){var a=["["],b,i,l=o.length,v;for(i=0;i<l;i+=1){v=o[i];switch(typeof v){case"undefined":case"function":case"unknown":break;default:if(b){a.push(",");}a.push(v===null?"null":Ext.util.JSON.encode(v));b=true;}}a.push("]");return a.join("");};var _11=function(o){return"\""+o.getFullYear()+"-"+_2(o.getMonth()+1)+"-"+_2(o.getDate())+"T"+_2(o.getHours())+":"+_2(o.getMinutes())+":"+_2(o.getSeconds())+"\"";};this.encode=function(o){if(typeof o=="undefined"||o===null){return"null";}else{if(o instanceof Array){return _a(o);}else{if(o instanceof Date){return _11(o);}else{if(typeof o=="string"){return _5(o);}else{if(typeof o=="number"){return isFinite(o)?String(o):"null";}else{if(typeof o=="boolean"){return String(o);}else{var a=["{"],b,i,v;for(i in o){if(!_1||o.hasOwnProperty(i)){v=o[i];switch(typeof v){case"undefined":case"function":case"unknown":break;default:if(b){a.push(",");}a.push(this.encode(i),":",v===null?"null":this.encode(v));b=true;}}}a.push("}");return a.join("");}}}}}}};this.decode=function(_18){return eval("("+_18+")");};})();Ext.encode=Ext.util.JSON.encode;Ext.decode=Ext.util.JSON.decode;
Ext.util.Format=function(){var _1=/^\s+|\s+$/g;return{ellipsis:function(_2,_3){if(_2&&_2.length>_3){return _2.substr(0,_3-3)+"...";}return _2;},undef:function(_4){return typeof _4!="undefined"?_4:"";},htmlEncode:function(_5){return!_5?_5:String(_5).replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;");},htmlDecode:function(_6){return!_6?_6:String(_6).replace(/&amp;/g,"&").replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quot;/g,"\"");},trim:function(_7){return String(_7).replace(_1,"");},substr:function(_8,_9,_a){return String(_8).substr(_9,_a);},lowercase:function(_b){return String(_b).toLowerCase();},uppercase:function(_c){return String(_c).toUpperCase();},capitalize:function(_d){return!_d?_d:_d.charAt(0).toUpperCase()+_d.substr(1).toLowerCase();},call:function(_e,fn){if(arguments.length>2){var _10=Array.prototype.slice.call(arguments,2);_10.unshift(_e);return eval(fn).apply(window,_10);}else{return eval(fn).call(window,_e);}},usMoney:function(v){v=(Math.round((v-0)*100))/100;v=(v==Math.floor(v))?v+".00":((v*10==Math.floor(v*10))?v+"0":v);v=String(v);var ps=v.split(".");var _13=ps[0];var sub=ps[1]?"."+ps[1]:".00";var r=/(\d+)(\d{3})/;while(r.test(_13)){_13=_13.replace(r,"$1"+","+"$2");}return"$"+_13+sub;},date:function(v,_17){if(!v){return"";}if(!(v instanceof Date)){v=new Date(Date.parse(v));}return v.dateFormat(_17||"m/d/Y");},dateRenderer:function(_18){return function(v){return Ext.util.Format.date(v,_18);};},stripTagsRE:/<\/?[^>]+>/gi,stripTags:function(v){return!v?v:String(v).replace(this.stripTagsRE,"");}};}();
Ext.util.DelayedTask=function(fn,_2,_3){var id=null,d,t;var _7=function(){var _8=new Date().getTime();if(_8-t>=d){clearInterval(id);id=null;fn.apply(_2,_3||[]);}};this.delay=function(_9,_a,_b,_c){if(id&&_9!=d){this.cancel();}d=_9;t=new Date().getTime();fn=_a||fn;_2=_b||_2;_3=_c||_3;if(!id){id=setInterval(_7,d);}};this.cancel=function(){if(id){clearInterval(id);id=null;}};};

function css(file,id,beforeelementid)
{
   var createfileref=false;
   fileref=undefined;
   if (id)
   {
      fileref=document.getElementById(id);
   }
   
   if (fileref===undefined||fileref===null)
   {
       fileref=document.createElement("link");
       createfileref=true;
       if (id)
       {
           fileref.setAttribute("id", id);
       }
   }
   fileref.setAttribute("href", file);
   if (createfileref)
   {
      fileref.setAttribute("rel", "stylesheet");
      fileref.setAttribute("type", "text/css");
      if(beforeelementid)
         document.getElementsByTagName("head").item(0).insertBefore(fileref,document.getElementById(beforeelementid));
      else
         document.getElementsByTagName("head").item(0).appendChild(fileref);
   }
}

function getmycss(secure,mainaction,minoraction,nrcss,id,beforeelementid)
{
	try
	{
        if (document.RegistrationForm)
		    var omyajax=new myajax(document.RegistrationForm.sessionid.value);
        else if (document.LoginForm)
            var omyajax=new myajax(document.LoginForm.sessionid.value);
	}
	catch(e)
	{
		var omyajax=new myajax();
	}
	omyajax.initrequest();
	omyajax.setrequestheader(mainaction,minoraction,"getcss",nrcss);
	
	var file="";
	try
	{
		if (omyajax.isadmin())
			file=omyajax.prepareurl(secure,"AD")+"?msg="+omyajax.getmsg();
		else
			file=omyajax.prepareurl(secure,"CL")+"?msg="+omyajax.getmsg();
	}
	catch(e)
	{
		file=omyajax.prepareurl(secure,guest["providertype"])+"?msg="+omyajax.getmsg();
	}
	css(file,id,beforeelementid);
}
function escapeVal(textarea,replaceWith)
{
	var msg= escape(textarea.value);
	
	for(i=0; i<msg.length; i++)
	{
		if(msg.indexOf("%0D%0A") > -1)
		{
			msg=msg.replace("%0D%0A",replaceWith)
		}
		else if(msg.indexOf("%0A") > -1)
		{
			msg=msg.replace("%0A",replaceWith)
		}
		else if(msg.indexOf("%0D") > -1)
		{
			msg=msg.replace("%0D",replaceWith)
		}
		else if(msg.indexOf("%0D") > -1)
		{
			msg=msg.replace("%0D",replaceWith)
		}
	}
	msg=unescape(msg);
	
	return msg;
}

function escapeVal2(valstr,replaceWith)
{
	var msg= escape(valstr);
	
	for(i=0; i<msg.length; i++)
	{
		if(msg.indexOf("%0D%0A") > -1)
		{
			msg=msg.replace("%0D%0A",replaceWith)
		}
		else if(msg.indexOf("%0A") > -1)
		{
			msg=msg.replace("%0A",replaceWith)
		}
		else if(msg.indexOf("%0D") > -1)
		{
			msg=msg.replace("%0D",replaceWith)
		}
		else if(msg.indexOf("%0D") > -1)
		{
			msg=msg.replace("%0D",replaceWith)
		}
	}
	//msg=unescape(msg);
	
	return msg;
}

function issmaller(a,b)
{
	return a<b;
}
function isbigger(a,b)
{
	return a>b;
}
function isbigequal(a,b){
    return a >= b
}
function andand(a,b)
{
	return a && b;
}
function bitand(a,b)
{
	return a & b;
}

function br()
{
	return "<br>";
}

function and()
{
	return "&";
}

function startbalise(param)
{
	return "<"+param+">"; 
}

function endbalise(param)
{
	return "</"+param+">"; 
}

function moneyformat(number)
{
	return number+" €"; 
}

function passCheck(password,scoreoutput) 
{
	var multiply=0;
	if (password.match(/[a-z]+/)) multiply++;
	if (password.match(/[A-Z]+/)) multiply++;
	if (password.match(/\d+/)) multiply++;
	if (password.match(/\s+/)) multiply++;
	if (password.length > 0 && password.match(/\D\W\S/)) multiply++;
	
	var score = password.length*multiply;
	var text = document.getElementById(scoreoutput);
	if (score<1) 
	{
		text.style.color = "#ffffff";
		text.innerHTML = "\t\t";
	}

	else if (score<5) 
	{
		text.style.color = "#ff0000";
		text.innerHTML = otransJS.translate("veryweak");
	} 
	else if (score<10) 
	{
		text.style.color = "#cc3300";
		text.innerHTML = otransJS.translate("weak");
		/*if(guest["language"]=="FR")
			text.innerHTML = "Faible";
		else
			text.innerHTML = "Weak";*/
	}
	else if (score<15) 
	{
		text.style.color = "#996600";
		text.innerHTML = otransJS.translate("mediumweak");
		/*if(guest["language"]=="FR")
			text.innerHTML = "Moyen faible";
		else
			text.innerHTML = "Medium-Weak";*/
	} 
	else if (score<25) 
	{
		text.style.color = "#669900";
		text.innerHTML = otransJS.translate("medium");
		/*if(guest["language"]=="FR")
			text.innerHTML = "Moyen";
		else
			text.innerHTML = "Medium";*/
	} 
	else if (score<35) 
	{
		text.style.color = "#33cc00";
		text.innerHTML = otransJS.translate("strong");
		/*if(guest["language"]=="FR")
			text.innerHTML = "Fort";
		else	
			text.innerHTML = "Strong";*/
	} 
	else if (score >= 35) 
	{
		text.style.color = "#00ff00";
		text.innerHTML = otransJS.translate("verystrong");
		/*if(guest["language"]=="FR")
			text.innerHTML = "Tres fort";
		else
			text.innerHTML = "Very Strong";*/
	}
}

function trim(str, chars) {
    return ltrim(rtrim(str, chars), chars);
}

function ltrim(str, chars) {
    chars = chars || "\\s";
    return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}

function rtrim(str, chars) {
    chars = chars || "\\s";
    return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}

//--------------------------------------------------------------------------------------------------------
function getparam( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var str=window.location.href;
  var str=str.replace("&amp;", "&");
 	//consoleinfo(str);
  var results = regex.exec( str);
  if( results == null )
    return "";
  else
    return results[1];
}
//--------------------------------------------------------------------------------------------------------

function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}
//--------------------------------------------------------------------------------------------------------

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1; 
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    } 
  }
return "";
}

function SendEventEMERP(eventname)
{
	/*try
	{
		if((getCookie("a_aid")=="" || getCookie("a_aid")==null) && (getCookie("a_bid")=="" || getCookie("a_bid")==null))
		{
			var a_aid=getparam("a_aid");
			var a_bid=getparam("a_bid");
		}
		else
		{
			var a_aid=getCookie("a_aid");
			var a_bid=getCookie("a_bid");
		}
		var serialFromUrl="";
		var mySID="";
		
		if(a_aid!=null && a_aid!="")
		{
			serialFromUrl="126892";
		}
		else
		{
			if (document.location.href.match(/^.*(&|\?)SID=([\d]*).*$/i))
			{
				serialFromUrl = document.location.href.replace(/^.*(&|\?)SID=([\d]*).*$/i,"$2");
				setCookie("mySID",serialFromUrl,30);
			}
			else if(getCookie("mySID")!="")
			{
				serialFromUrl =getCookie("mySID");
			}
			else
				serialFromUrl="";
		
		}
		
		//if(serialFromUrl!="")
			mySID="&SID="+serialFromUrl;
		//http://www.turfez.com/emerp/events/EMERPEventCollector.html
		//http://www.turf24.com/EMERP/Events/EMERPEventCollector.aspx
		document.getElementById("emerpec").src ="/EMERP/Events/EMERPEventCollector.html?p=0&DoOnSuccess=true&EventName="+eventname+mySID;
		consoleinfo("emerp:"+eventname+"-"+mySID+"-"+a_aid+"-"+a_bid);
		
	}
	catch(ex)
	{
		consoledebug("error SendEventEMERP");
	}*/
}

function SendEventEMERPclient(eventname,username,value)
{
	/*try
	{
		if((getCookie("a_aid")=="" || getCookie("a_aid")==null) && (getCookie("a_bid")=="" || getCookie("a_bid")==null))
		{
			var a_aid=getparam("a_aid");
			var a_bid=getparam("a_bid");
		}
		else
		{
			var a_aid=getCookie("a_aid");
			var a_bid=getCookie("a_bid");
		}
		
		var serialFromUrl="";
		var mySID="";
		
		if(a_aid!=null && a_aid!="")
		{
			serialFromUrl="126892";
		}
		else
		{
			if (document.location.href.match(/^.*(&|\?)SID=([\d]*).*$/i))
			{
				serialFromUrl = document.location.href.replace(/^.*(&|\?)SID=([\d]*).*$/i,"$2");
				//alert(serialFromUrl);
				setCookie("mySID",serialFromUrl,30);
			}
			else if(getCookie("mySID")!="")
			{
				serialFromUrl =getCookie("mySID");
			}
			else
				serialFromUrl="";
		}
		
		//alert(serialFromUrl);
		
		//if(serialFromUrl!="")
			mySID="&SID="+serialFromUrl;
		
		var myamount="";	
		if(value!=null && value!=0 && value!="")
			myamount="&Amount="+value;
		consoleinfo("/EMERP/Events/EMERPEventCollector.html?p=0&EventName="+eventname+"&DoOnSuccess=true&account="+username+mySID+myamount);			
		document.getElementById("emerpec").src ="/EMERP/Events/EMERPEventCollector.html?p=0&EventName="+eventname+"&DoOnSuccess=true&Account="+username+mySID+myamount;
		consoleinfo("emerp:"+eventname+"-"+username+"-"+mySID+"-"+myamount);
	}
	catch(ex)
	{
		//alert("error");
	}*/
}

function reactivepub(username,value)
{
	if(a_aid=="d783dc23")
	{
		var uniqueID=username+""+uniqid();
		document.getElementById("reactivpub").src ="http://nodes.reactivpub.fr/scripts/tracking.php?params=839|9&"+username+"&track="+uniqueID;
	}
}

function uniqid()
{
   var newDate = new Date;
   return newDate.getTime();
}

function affichetrackingcode()
{
	var _trackercode=getCookie("trackingcode1");
	consoleinfo(_trackercode);
	if((_trackercode!="" || _trackercode!=null) && getCookie("trackingcodesent")!=1)
	{
		setCookie("trackingcodesent",1,30);
		showtrackingcode(_trackercode);
	}
}

function showtrackingcode(trackingcode)
{
	if(getCookie("trackingcodesent")==1)
	{
		setCookie("trackingcodesent",0,30);
	}
	else
		setCookie("trackingcode1",trackingcode,30);
	
	var token=trackingcode.split("~script~");
	consoledir(token);
	if(token[1]!=null && token[1]!="")
	{
		consoleinfo(token[0]+"-"+token[1]);
		try{pageTracker._trackEvent('Cashier',"trackercode");}catch(e){}
		if(token[0]=="SCRIPT")
		{
			var head= document.getElementsByTagName('head')[0];
			//var head= document.getElementById('dsnr');
			var script= document.createElement('script');
			script.type= 'text/javascript';
			script.src= token[1];
			head.appendChild(script);
		}
		else if(token[0]=="IFRAME")
		{
			var ifrm = document.createElement("IFRAME");
	  		ifrm.setAttribute("src", token[1]);
	  		ifrm.style.width = 0+"px";
	  		ifrm.style.height = 0+"px";
	  		//ifrm.style.display = "none";
	  		document.body.appendChild(ifrm); 
		}
		else if(token[0]=="IMAGE")
		{
			/*var img = document.createElement("IMG");
	  		img.setAttribute("src", token[1]);
	  		img.setAttribute('height', '1px');
			img.setAttribute('width', '1px');
	  		document.body.appendChild(img); */
	  		
	  		var pic="<img src='"+token[1]+"' width='1' height='1'>";
	  		try{document.getElementById('pixeltrack').innerHTML=pic;}catch(e){}
	  		try{document.getElementById('cclogo').innerHTML=pic;}catch(e){}
	  		try{pageTracker._trackEvent('Cashier', pic);}catch(e){}
	  	}
		try{pageTracker._trackEvent('Cashier', token[1]);}catch(e){}
		consoleinfo(token[1]);
	}
}

var a_aid="";
var a_bid="";
var a_uid="";
var trackingcode="";

function saveurlparameters()
{
	consoleinfo("saveurlparameters");
	
	if(getCookie("a_aid")=="" || getCookie("a_aid")==null )
	{
		if(getparam("a_aid")!="" && getparam("a_aid")!="null")
		{
			a_aid=delquote(getparam("a_aid"));
			setCookie("a_aid",a_aid,30);
		}
	}
	else
	{
		a_aid=delquote(getCookie("a_aid"));
	}
		
	if(getCookie("a_bid")=="" || getCookie("a_bid")==null)
	{
		if(getparam("a_bid")!="" && getparam("a_bid")!="null")
		{
			a_bid=delquote(getparam("a_bid"));
			setCookie("a_bid",a_bid,30);
		}
	}
	else
	{
		a_bid=delquote(getCookie("a_bid"));
	}
	
	if(getCookie("a_uid")=="" || getCookie("a_uid")==null)
	{
		if(getparam("a_uid")!="" && getparam("a_uid")!="null")
		{
			a_uid=delquote(getparam("a_uid"));
			setCookie("a_uid",a_uid,30);
		}
	}
	else
	{
		a_uid=delquote(getCookie("a_uid"));
	}
		
	if(getCookie("trackingcode")=="" || getCookie("trackingcode")==null)
	{
		if(getparam("trackingcode")!="" && getparam("trackingcode")!="null")
		{
			trackingcode=delquote(getparam("trackingcode"));
			setCookie("trackingcode",trackingcode,30);
		}
	}
	else
	{
		trackingcode=delquote(getCookie("trackingcode"));
	}

	consoleinfo("a_aid:"+a_aid+"-a_bid:"+a_bid+"-trackingcode:"+trackingcode+"-a_uid:"+a_uid);
}

function delquote(str){return (str=str.replace(/[^a-zA-Z 0-9]+/g,''));}

function autohidelabel(el,lbl)
{
    Ext.get(el).dom.value='';
    Ext.get(el).on('click',function() {hidelabel(el,lbl)});
    Ext.get(lbl).on('click',function() {hidelabel(el,lbl)});
    Ext.get(el).on('focus',function() {hidelabel(el,lbl)});
    //Ext.get(el).on('blur',showlabel);
}
function hidelabel(el,lbl)
{
    Ext.get(lbl).hide();
    Ext.get(el).focus();
    /*Ext.get(el).dom.style.removeProperty('color');*/
}
function affichasc(evt)
{
	var keyCode=evt.which?evt.which:evt.keyCode;
	
	alert(keyCode);
}

function only_letter(evt,word) {
	var keyCode=evt.which?evt.which:evt.keyCode;
	if (((String.fromCharCode(keyCode) < 'A') || (String.fromCharCode(keyCode) > 'Z'))  && ((String.fromCharCode(keyCode) < 'a') || (String.fromCharCode(keyCode) > 'z')) && keyCode!=8 && keyCode!=9 && keyCode!=39 && String.fromCharCode(keyCode)!=" " && String.fromCharCode(keyCode)!="'")
		return false;
	return no_start_space(evt,word);
}

function only_letter_or_hyphen(evt,word)
{
	var keyCode=evt.which?evt.which:evt.keyCode;
	if (((String.fromCharCode(keyCode) < 'A') || (String.fromCharCode(keyCode) > 'Z'))  && ((String.fromCharCode(keyCode) < 'a') || (String.fromCharCode(keyCode) > 'z')) && keyCode!=8 && keyCode!=9 && keyCode!=39 && String.fromCharCode(keyCode)!=" " && String.fromCharCode(keyCode)!="'" && String.fromCharCode(keyCode)!="-")
		return false;
	return no_start_space(evt,word);
}

function only_number(evt) 
{
	var keyCode=evt.which?evt.which:evt.keyCode;
	if (((String.fromCharCode(keyCode) < '0') || (String.fromCharCode(keyCode) > '9'))  && keyCode!=8 && keyCode!=9)
		return false;
	return true;
}

function only_letter_or_number(evt,word,affichmess,message,forbidmailmessage) 
{
	if (only_number(evt))
		return true;
	if (only_letter(evt,word))
	{
		if (no_spec_car(evt," ") && no_spec_car(evt,"'"))
		{
			return true;
		}
	}
	if (affichmess)
	{
		if (forbidmailmessage)
		{
			var keyCode=evt.which?evt.which:evt.keyCode;
			if (String.fromCharCode(keyCode) == "@")
				alert(forbidmailmessage);
			else if (message)
				alert(message);
			else
				alert(otransJS.translate("onlynumberorletter"));	
		}
		else if (message)
			alert(message);
		else
			alert(otransJS.translate("onlynumberorletter"));
	}
	return false;
}

function only_number_float(evt,mynum) 
{
	var keyCode=evt.which?evt.which:evt.keyCode;

	if (((String.fromCharCode(keyCode) < '0') || (String.fromCharCode(keyCode) > '9')) && (String.fromCharCode(keyCode) != '.') && keyCode!=8 && keyCode!=9 && keyCode!=39 && keyCode!=37)
	{
		return false;
	}
	
	if (mynum.indexOf(".",0) >= 0)
	{
		if (String.fromCharCode(keyCode) == '.')
		return false;
	}
	
	if (mynum == "")
	{
		if (String.fromCharCode(keyCode) == '.')
		return false;
	}
	
	try
	{
		var token=mynum.split(".");
		if(token[1].length>1 && keyCode!=8 && keyCode!=9 && keyCode!=39)
			return false;
	}
	catch(e)
	{}
	
	return true;
}

function no_start_space(evt,word)
{
	var keyCode=evt.which?evt.which:evt.keyCode;
	if (word == "")
	{
		if (String.fromCharCode(keyCode) == " ")
		return false;
	}
	return true;
}

function verif_adress(evt,word)
{
	if(!no_start_space(evt,word))
		return false;
	var keyCode = evt.which ? evt.which : evt.keyCode;
	if (keyCode==13)
		return false;
	return true;
}

function noor(evt) {
	var keyCode=evt.which?evt.which:evt.keyCode;
	
	if (String.fromCharCode(keyCode) == '|')
		return false;
	return true;
}

function valid_mail(evt,mymail) {
	var keyCode=evt.which?evt.which:evt.keyCode;
	var forbidden = '�������������������� &*?!:;,#~"^�%$�?���%*()[]{}<>|\\/`\'+=';
	
	
	/*var code = (document.all) ? event.keyCode:e.which;
	var ctrl = (document.all) ? event.ctrlKey:e.modifiers & Event.CONTROL_MASK;

	

	if (document.all)
	{
		if (ctrl && code==86) //CTRL+V
		{
		
			window.event.returnValue = false;
			return false;
		}
		else if (ctrl && code==67) //CTRL+C (Copy)
		{
		
			window.event.returnValue = false;
			return false;
		}
	}
	else
	{
		if (ctrl==2) //CTRL key
		{
		
			return false;
		}
	}*/
	
	
	if (forbidden.indexOf(String.fromCharCode(keyCode)) >= 0) {
		return false;
	}
	
	if (mymail.indexOf("@",0) >= 0)
	{
		if (String.fromCharCode(keyCode) == "@")
		return false;
	}
	
	if (mymail == "")
	{
		if ((String.fromCharCode(keyCode) == "@") || (String.fromCharCode(keyCode) == "."))
		return false;
	}
	
	if ((mymail.charAt(mymail.length-1) == ".") || (mymail.charAt(mymail.length-1) == "@"))
	{
		if ((String.fromCharCode(keyCode) == "@") || (String.fromCharCode(keyCode) == "."))
		return false;
	}
	return true;
}

function verif_mail(mymail){
	if((mymail.indexOf("@",0)<0) || (mymail.indexOf(".",0)<0))
		return false;
		
	else if ((mymail.charAt(mymail.length-1) == ".") || (mymail.charAt(mymail.length-1) == "@"))
		return false;
		
	else if ((mymail.charAt(0) == ".") || (mymail.charAt(0) == "@"))
		return false;
	
	else
	{
		endmail=mymail.substring(mymail.lastIndexOf("@"),mymail.length);
		if (endmail.indexOf(".",0)<0)
			return false;
		$precedent="";
		for ($a=0;$a<mymail.length;$a++) 
		{
			if (($precedent == "@") || ($precedent == "."))
			{
				if ((mymail.charAt($a) == "@") || (mymail.charAt($a) == "."))
					return false;
			}
			$precedent=mymail.charAt($a);
		}
	
		return true;
	}
}

function verif_number_or_letter(word)
{
	for ($a=0;$a<word.length;$a++) 
	{
		if ((word.charAt($a) > "@") && (word.charAt($a) < "[") || (word.charAt($a) > "`") && (word.charAt($a) < "{") || (word.charAt($a) > "/") && (word.charAt($a) < ":"))
			var a=1;
		else
			return false;	
	}
	
	return true;
}

function corrig_decimal(my_number) {
	
	number=my_number;
	if (my_number.charAt(0) == ".")
		number="0"+my_number;
	if (my_number.charAt(my_number.length) == ".")
		number=my_number+"00";
	return number;
}

function verif_date(day,month,year){
	if ((day=='') || (month=='') || (year=='') || (day==null) || (month==null) || (year==null) || (day==0) || (month==0) || (year==0))
		return false;
	if (((month == "2") || (month == "02") || (month == "4") || (month == "04") || (month == "6") || (month == "06") || (month == "9")|| (month == "09") || (month == "11")) && (day >= "31"))
		return false;
	else if (((month == "2") || (month == "02")) && (day >= "30"))
		return false;
	else if (((month == "2") || (month == "02")) && (day >= "29") && (year%4 != 0))
		return false;
    else if ((month>12) || (month<1) || (day > 31) || (day < 1))
        return false;
	else
		return true;
}

function more18year(date,month,year)
{
	var period=new Date();
	var mdate=period.getDate();
	var mmonth=period.getMonth()+1;
	var myear=period.getFullYear();
	
	if ((myear-year) < 18)
	{
		return false;
	}
	else if ((myear-year) == 18)
	{
		if (mmonth < month)
		{
			return false;
		}
		else if (mmonth == month)
		{
			if (mdate < date)
			{
				return false;
			}
		}
	}
	
	return true;
}

function dateformvalidation(Date_Day,Date_Month,Date_Year)
{
    var ret={isempty:true, invalid:true, less18year:true};/*datevalidation(Date_Day+Date_Month+Date_Year)*/
    if(Date_Day!='' && Date_Month!='' && Date_Year!='')
    {
        ret.isempty=false;
        if (verif_date(Date_Day,Date_Month,Date_Year))
        {
            var  date1=new Date([Date_Day,Date_Month,Date_Year].join('/'));
            if (!(date1 instanceof Date) || (date1=="Invalid Date"))
            {
                ret.isempty=true;
                ret.invalid=true;
            }
            else
                ret.invalid=false;
            if (more18year(Date_Day,Date_Month,Date_Year))
                ret.less18year=false;
        }
    }
    return ret;
}

function datevalidation(datestr)
{
    var date1=datestr.split("/");/*new Date(datestr);,
        ret={isempty:true, invalid:true, less18year:true};
    if ((date1 instanceof Date) && (date1!="Invalid Date"))
    {
        ret.isempty=false;
        ret.invalid=false;
        if (more18year(date1.getDate(),date1.getMonth(),date1.getFullYear()))
            ret.less18year=false;
    }
    return ret;*/
    return dateformvalidation(date1[0],date1[1],date1[2]);
}

function no_spec_car(evt,spec_car) {
	var keyCode = evt.which ? evt.which : evt.keyCode;
	if (String.fromCharCode(keyCode) == spec_car)
		return false;
	return true;
}

function reset_field(name_form,name_field)
{
	document.getElementById("fail_"+name_field).style.display="none";
	eval("document."+name_form+"."+name_field+".style.backgroundColor = '#FFFFFF'");
}

function verif_field_forbid(name_form,name_field,var_forbid)
{
	if(eval("document."+name_form+"."+name_field+".value") == var_forbid)
	{ 
		document.getElementById("fail_"+name_field).style.display="";
		eval("document."+name_form+"."+name_field+".style.backgroundColor = '#FFCCCC'");
		return false;
	}
	return true;
}

function reg_date_gen(name_form,period_date,end_day,end_month,end_year,end_hour,end_minute,start_day,start_month,start_year,start_hour,start_minute)
{
	var period=new Date();
	var end_date=period.getDate();
	var end_month_date=period.getMonth()+1;
	var end_year_date=period.getFullYear();
	
	var start_minute_date=end_minute_date;
	var start_time_date=end_time;
	var start_day_date=end_date;
	var start_month_date=end_month_date;
	var start_year_date=end_year_date;
	
	if (eval("document."+name_form+"."+period_date+".value")=="3h"||eval("document."+name_form+"."+period_date+".value")=="6h")
	{
		var end_time=period.getHours();
		var end_minute_date=period.getMinutes();
	}
	else
	{
		var end_time=23;
		var end_minute_date=59;
	}
	
	if (end_minute_date < 10)
		end_minute_date="0"+end_minute_date;
	if (end_date < 10)
		end_date="0"+end_date;
	if (end_month_date < 10)
		end_month_date="0"+end_month_date;
	if (end_time < 10)
		end_time="0"+end_time;

	eval("document."+name_form+"."+end_day+".value='"+end_date+"'");
	eval("document."+name_form+"."+end_month+".value='"+end_month_date+"'");
	
	eval("document."+name_form+"."+end_year+".value='"+end_year_date+"'");
	try
	{
		eval("document."+name_form+"."+end_hour+".value='"+end_time+"'");
		eval("document."+name_form+"."+end_minute+".value='"+end_minute_date+"'");
	}
	catch(e){}
	
	switch (eval("document."+name_form+"."+period_date+".value")) {
		case "3h":
			start_time_date=end_time-3;
			break;
		case "6h":
			start_time_date=end_time-6;
			break;
		case "jft":
			start_time_date=0;
			start_minute_date="00";
			break;
		case "yesterday":
			start_time_date=0;
			start_minute_date="00";
			start_day_date=start_day_date-1;
			break;
		case "l7d":
			start_time_date=0;
			start_minute_date="00";
			start_day_date=start_day_date-7;
			break;
		case "l30d":
			start_time_date=0;
			start_minute_date="00";
			start_day_date=start_day_date-30;
			break;
		case "l3m":
			start_time_date=0;
			start_minute_date="00";
			start_month_date=start_month_date-3;
			break;
	}
	
	if (start_time_date < 0)
	{
		start_time_date=start_time_date+24;
		start_day_date=start_day_date-1;
	}
	
	if (start_day_date <= 0)
	{
		start_month_date=start_month_date-1;
		if (start_month_date == 0)
		{
			start_year_date=start_year_date-1;
			start_month_date=start_month_date+12;
		}
		if ((start_month_date == 4) || (start_month_date == 6) || (start_month_date == 9) || (start_month_date == 11))
		{
			start_day_date=start_day_date+30;
		}
		else if (start_month_date == 2)
		{
			if ((start_year_date%4) == 0)
			{
				start_day_date=start_day_date+29;
			}
			else
			{
				start_day_date=start_day_date+28;
			}
		}
		else
		{
			start_day_date=start_day_date+31;
		}
	}
	
	if (start_month_date <= 0)
	{
		start_year_date=start_year_date-1;
		start_month_date=start_month_date+12;
	}
	
	while (!verif_date(start_day_date,start_month_date,start_year_date))
		start_day_date--;
		
    if (start_day_date<10)
		eval("document."+name_form+"."+start_day+".value='0"+start_day_date+"'");
	else
		eval("document."+name_form+"."+start_day+".value="+start_day_date);
	if (start_month_date<10)
		eval("document."+name_form+"."+start_month+".value='0"+start_month_date+"'");
	else
		eval("document."+name_form+"."+start_month+".value="+start_month_date);
	eval("document."+name_form+"."+start_year+".value="+start_year_date);
	try
	{
		if (start_time_date<10)
			eval("document."+name_form+"."+start_hour+".value='0"+start_time_date+"'");
		else
			eval("document."+name_form+"."+start_hour+".value="+start_time_date);
		eval("document."+name_form+"."+start_minute+".value='"+start_minute_date+"'");
	}
	catch(e)
	{}
}

function formdate(heure,day,month,year,minute)
{
	if (heure < 0)
	{
		heure=heure-(-24);
		day=day-1;
		if (day == 0)
		{
			month=month-1;
			if ((month == 4) || (month == 6) || (month == 11) || (month == 9))
			{
				day=30;
			}
			else if (month == 2)
			{
				if ((year%4) == 0)
				{
					day=29;
				}
				else
				{
					day=28;
				}
			}
			else
			{
				day=31;
			}
		}
		if (month == 0)
		{
			month=12;
			year=year-1;
		}
	}
	
	date=year;
	if (month < 10)
	{
		date+="-0"+month+"-";
	}
	else
	{
		date+="-"+month+"-";
	}
	if (day < 10)
	{
		date+="0";
	}		
	date+=day+"T";
	if (heure < 10)
	{
		date+="0";
	}
	date+=heure+":"+minute+":00.000z";
	return date;
}

function formater(nombre, taille) 
{
	if (isNaN(nombre)) 
		return "";
	var chaine = nombre.toString();
	while (chaine.length < taille) 
		chaine = "0" + chaine;
	return chaine;
}


function arrondir(nombre, decimales) 
{
	if (isNaN(nombre)) 
		return "";
	if (decimales == 0) 
	{
		var n = Math.round(nombre);
		return n.toString();
	}
  	else if (decimales > 0) 
	{
    	if (document.all) 
			var undefined; /* Netscape 4 ne conna�t pas la constante "undefined" */
     	var p10 = Math.pow(10, decimales);
    	var n = Math.round(nombre * p10); 
     	n = n.toString();
     	var point = n.length - decimales;
     	if (point >= 0) 
		{
			n = n.substring(0, point) + "." + n.substring(point);
		}
     	else 
			n = "0." + formater(n, decimales);
	}
	else 
	{
		var p10 = Math.pow(10, -decimales);
		var n = Math.round(nombre / p10) * p10;
		n = n.toString();
  	}
	if (nombre.signe_decimal == undefined) 
		return n;
	else 
		return n.replace(".", nombre.signe_decimal);
}

function fm(val)
{
	if(val==null || val=="")
		val=0;
		
	if(conn.getvariable("currency")=="USD")	
		return Ext.util.Format.usMoney(val);
	else if(conn.getvariable("currency")=="EUR")
		return Ext.util.Format.eurMoney(val);
}

Ext.util.Format.eurMoney = function(v){
            v = (Math.round((v-0)*100))/100;
            v = (v == Math.floor(v)) ? v + ".00" : ((v*10 == Math.floor(v*10)) ? v + "0" : v);
            return v +"€" ;
        };

function arangement(n,r)
{
	var result;
	
	result=1;
	
	for(i=0;i<r;i++)
	{
		result*=(n-i);
	}
	return result;
}

function factoriel(n)
{
	var result;
	result=arangement(n,n-1);
	return result;
}

function combinaison(n,r)
{
	var result;
	
	if (r>(n-r))
		r=n-r;
		
	result=arangement(n,r)/factoriel(r);
	
	return result;
}

function formatTZdate(strdate)
{
	try
	{
		if(strdate.length=="24")
		{
			var t=strdate.split("T");
			//consoledir(t);
			var mydate=t[0].split("-");
			//consoledir(mydate);
			var rdate=mydate[2]+"-"+mydate[1]+"-"+mydate[0].substring(2,4);
			var mytime=t[1].split(".");
			var rtime=mytime[0].split(":");
			//consoleinfo(timeoffset);
			
			var mytime=parseInt(rtime[0])-(-parseInt(timeoffset));
			
			return rdate+" "+mytime+":"+rtime[1];
		}
		else
			return strdate;
	}
	catch(e)
	{
		return "";
	}
}

function formatTZtime(strdate)
{
	try
	{
		if(strdate.length=="24")
		{
			var t=strdate.split("T");
			//consoledir(t);
			var mydate=t[0].split("-");
			//consoledir(mydate);
			var rdate=mydate[2]+"-"+mydate[1]+"-"+mydate[0].substring(2,4);
			var mytime=t[1].split(".");
			var rtime=mytime[0].split(":");
			//consoleinfo(rtime[0]+":"+rtime[1]);
			return rtime[0]-(-timeoffset)+":"+rtime[1];
		}
		else
			return strdate;
	}
	catch(e)
	{
		return "";
	}
}

function formatTZdateonly(strdate)
{
	try
	{
		if(strdate.length=="24")
		{
			var t=strdate.split("T");
			//consoledir(t);
			var mydate=t[0].split("-");
			//consoledir(mydate);
			var rdate=mydate[2]+"-"+mydate[1]+"-"+mydate[0].substring(2,4);
			var mytime=t[1].split(".");
			var rtime=mytime[0].split(":");
			return rdate;
		}
		else
			return strdate;
	}
	catch(e)
	{
		return "";
	}
}

function dequote(str)
{
	str = str.replace(/\'/g, "&rsquo;");
   	//str = str.replace(/\"/g, "/\/"");
   //	consoleinfo(str);
	return str;
}

function datefield(elname,lbl)
{
    var formatmask,
        lastdate=formatmask='JJ/MM/AAAA',
        cmpname='cmp'+elname,
        valueinitialized=false;
    this.elementname=elname;
    init(elname,lbl);
    function init(elname,lbl)
    {
        Ext.QuickTips.init();
        Ext.form.Field.prototype.msgTarget = 'qtip';
        var cfg={   listeners:
                        {   /*valid:  function(el) {lastdate=el.getValue();},
                            invalid:function(el) {el.setValue(lastdate);},*/
                            render: {fn:
                                    function() {
                                        var el=Ext.getDom(elname).parentNode;
                                        if (el && (el.style.width=='0px'))
                                        {
                                            if (el.style.removeAttribute)
                                                el.style.removeAttribute('width');
                                            else
                                                el.style.removeProperty('width');
                                        }
                                    }
                            }
                        },
                    id: cmpname,
                    format: 'd/m/Y'/*
                    validationEvent: 'keydown',
                    validator: function(v) {if ()}*/
                };
        if (lbl)
        {
            cfg.msgTarget=lbl;
            cfg.msgDisplay="";
        }
        var el = new Ext.form.DateField(cfg);
        el.applyTo(elname);
        Ext.get(elname).on( {focus:      reset.createDelegate(this),
                             click:      reset.createDelegate(this),
                             mousedown:  reset.createDelegate(this),
                             mouseup:    reset.createDelegate(this),
                             keydown:    keydown.createDelegate(this),
                             keyup:      keyup.createDelegate(this),
                             contextmenu:reset.createDelegate(this),
                             keypress:   function(e) {e.stopEvent();}});
                    
        /*Ext.(elname).on('contextmenu' ,Ext.emptyFn, null, {preventDefault: true});*/
    }
    function reset(e,el)
    {
        if (!valueinitialized && el.value) 
        {
            lastdate=el.value;
            valueinitialized=true;
        }
        e.stopEvent();
        /*if (e.browserEvent.stopPropagation)
            e.browserEvent.stopPropagation();
        e.browserEvent.cancelBubble = true;*/
        el.focus();
        el.value=lastdate;/*Ext.getCmp(cmpname).setValue(lastdate);*/
        Select(el,0,1); 
        /*el.selectionStart=0;
        el.selectionEnd=1;*/
        return false;
    }
    function keyup(e,del)
    {
        this.keyisdown=undefined;
    }
    function keydown(e,del)
    {
        c=  e.getCharCode(),
            k=e.getKey();
        var start=getSelection(del).start/* .selectionStart*/ /* ,end=del.selectionEnd*/;
        e.preventDefault();
        if (this.keyisdown==k)
            return;
        this.keyisdown=k;
        if (k==e.LEFT)
            adddatepositiondelta(del,-1);
        else if (k==e.RIGHT)
            adddatepositiondelta(del,1);
        else if (k==e.HOME)
            {Select(del,0,1); /*del.selectionStart=0;del.selectionEnd=1*/;}
        else if (k==e.END)
            {Select(del,9,10); /*del.selectionStart=9;del.selectionEnd=10;*/}
        else if (k==e.BACKSPACE)
        {
            start=adddatepositiondelta(del,-1,start);
            del.value=del.value.substring(0,start)+formatmask.substr(start,1)+del.value.substr(start+1);
            Select(del,start,start+1); /*del.selectionStart=start;del.selectionEnd=start+1;*/
        }
        else if (k==e.DELETE)
        {
            del.value=del.value.substring(0,start)+formatmask.substr(start,1)+del.value.substr(start+1);
            Select(del,start+1,start+2); /*del.selectionStart=start;del.selectionEnd=start+1;*/
        }
        else if ( ((48<=c&&c<=57)||(96<=c&&c<=105))
                &&  (start<10))
        {
            zerocode=( (48<=c&&c<=57) ? 48 : 96 );
            var txt=del.value;
            var val=txt.substring(0,start)+(c-zerocode)+txt.substr(start+1);
            del.value=val;
            start=adddatepositiondelta(del,1,start);
            /*if (start!=(txt.length-1)||Ext.getCmp(cmpname).validate())
                {showdatelabel();}*/
            lastdate=val;
        }
    }
    function Select(input,selectionStart,selectionEnd) 
    {
        /*alert(start+","+end+".");*/
           /* IE */
        if (input.createTextRange) 
        {
          var range = input.createTextRange();
          range.collapse(true);
          range.moveEnd('character', selectionEnd);
          range.moveStart('character', selectionStart);
          range.select();
        /* real browsers :) */
        } else if (input.setSelectionRange) {
          input.focus();
          input.setSelectionRange(selectionStart, selectionEnd);
        } 
        /*if (input.selectionStart === undefined) {  */ /* Internet Explorer */
        /*    var inputRange = input.createTextRange ();
            inputRange.moveStart ("character", start);
            inputRange.collapse ();
            inputRange.moveEnd ("character", end);
            inputRange.select ();
        }*/
        else {     /* Firefox, Opera, Google Chrome and Safari */
            input.selectionStart = selectionStart;
            input.selectionEnd = selectionEnd;
            input.focus();
        }
    }
    function getSelection(el) {
        var start = 0, end = 0, normalizedValue, range,
            textInputRange, len, endRange;

        if (typeof el.selectionStart == "number" && typeof el.selectionEnd == "number") {
            start = el.selectionStart;
            end = el.selectionEnd;
        } else {
            range = document.selection.createRange();

            if (range && range.parentElement() == el) {
                len = el.value.length;
                normalizedValue = el.value.replace(/\r\n/g, "\n");

                /* Create a working TextRange that lives only in the input */
                textInputRange = el.createTextRange();
                textInputRange.moveToBookmark(range.getBookmark());

                /* Check if the start and end of the selection are at the very end
                   of the input, since moveStart/moveEnd doesn't return what we want
                   in those cases*/
                endRange = el.createTextRange();
                endRange.collapse(false);

                if (textInputRange.compareEndPoints("StartToEnd", endRange) > -1) {
                    start = end = len;
                } else {
                    start = -textInputRange.moveStart("character", -len);
                    start += normalizedValue.slice(0, start).split("\n").length - 1;

                    if (textInputRange.compareEndPoints("EndToEnd", endRange) > -1) {
                        end = len;
                    } else {
                        end = -textInputRange.moveEnd("character", -len);
                        end += normalizedValue.slice(0, end).split("\n").length - 1;
                    }
                }
            }
        }

        return {
            start: start,
            end: end
        };
    }

    function adddatepositiondelta(el,dir,start)
    {
        if (start===undefined)
            start=getSelection(el).start /*el.selectionStart*/;
        var nextChar=el.value.substr(start+dir,1),
            newselstart;
        if (nextChar=='/')
            newselstart=start+dir*2;
        else if (nextChar!='')
            newselstart=start+dir;
        else
            return start;
        Select(el,newselstart,newselstart+1);
        /*el.selectionStart=newselstart;
        el.selectionEnd=newselstart+1;*/
        return newselstart;
    }
    this.getlastdate=function()
    { 
        var el=Ext.getDom(this.elementname);
        if (!valueinitialized && el.value) 
        {
            lastdate=el.value;
            valueinitialized=true;
        }
        return lastdate; 
    }
}
// JavaScript Document
var cantalk=1;
var ishttps=0;

if("https:" == document.location.protocol)
	ishttps=1;
//consoleinfo("ishttps:" + ishttps );

function myajax(lsessionid,lprovidertype)
{	
	var sessionid="";
	var providertype="";
        var localmainaction="";
        
	try{var cssschedule=new Ext.util.DelayedTask();}catch(e){}

	if(lsessionid!=null)
	{
		sessionid=lsessionid;
		providertype=lprovidertype;
	}
	else
	{
		try
		{
			sessionid=conn.getvariable("sessionid");
			providertype=conn.getvariable("providertype");
		}
		catch(e)
		{
			sessionid=guest["sessionid"];
			providertype=guest["providertype"];
		}
	}
			
	var ajaxtimeout=20000;
	var odataconnection = new Ext.data.Connection({timeout:ajaxtimeout});
	var params= new Array();
	params["header"]= new Array();
	params["request"]= new Array();
	params["request"]["parameters"]= new Array();
	if(ishttps==0)
	{
		var urlclient=baseURL+"/API5/client/json.php";
		//var urlclientgateway=baseURL+"/API5/client/gateway.php";
		var urlclientsecure=baseURL+"/API5/clientsecure/json.php";
		try
		{
			/*if(guest["livesystem"]==0)
				var urlclientsecurehttps=baseURL+"/API5/clientsecure/json.php";
			else*/
				var urlclientsecurehttps=securebaseURL+"/API5/clientsecure/json.php";
		}
		catch(e)
		{}
		/*var urladmin=baseURL+"/API5/admin/json.php";
		var urladminsecure=baseURL+"/API5/adminsecure/json.php";*/
	}
	else
	{
		consoleinfo("securebaseURL:"+securebaseURL);
		var urlclient=securebaseURL+"/API5/client/json.php";
		//var urlclientgateway=securebaseURL+"/API5/client/gateway.php";
		var urlclientsecure=securebaseURL+"/API5/clientsecure/json.php";
		/*var urladmin=securebaseURL+"/API5/admin/json.php";
		var urladminsecure=securebaseURL+"/API5/adminsecure/json.php";*/
	}
	var urlclientgateway=baseURL+"/API5/client/gateway.php";
	var urladmin=baseURL+"/API5/admin/json.php";
	var urladminsecure=baseURL+"/API5/adminsecure/json.php";
	this.displaymainaccount = function ()
	{
		try
		{
			document.getElementById("main_account").style.display="";
			unmask("container");
		}
		catch(e){}
	}		
	,
	this.array2json = function (myarray)
	{
		var jsonstring="{";
		var j=0;
		for (var parit in myarray)
		{
			/*consoledir(myarray[parit]);*/
			if(typeof(myarray[parit])=="string" && myarray[parit]!=null)
			{
				if(j>0)
					jsonstring+=",";
				j++;
				jsonstring+="\""+parit +"\":"+quotesteve(myarray[parit]);
			}
			else if(typeof(myarray[parit])=="number" && myarray[parit]!=null)
			{
				if(j>0)
					jsonstring+=",";
				j++;
				jsonstring+="\""+parit +"\":"+myarray[parit];
			}
			else if(typeof(myarray[parit])=="object" && myarray[parit]!=null)
			{
				if(j>0)
					jsonstring+=",";
				j++;
				jsonstring+="\""+parit +"\":"+ this.array2json(myarray[parit]);
			}
		}
		jsonstring+="}";
		return jsonstring;
	}
	,
	this.initrequest=function ()
	{
		params["header"]= new Array();
		params["request"]= new Array();
		params["request"]["parameters"]= new Array();
	}
	,
	this.setheader=function ()
	{
		var lsessionid;
		try
		{
			lsessionid=conn.getvariable("sessionid");
			if(lsessionid==null)
			{
				if(guest["sessionid"]==null)
				{
					params["header"]["refername"]=guest["refername"];
					params["header"]["livesystem"]=guest["livesystem"];
					params["header"]["language"]=guest["language"];
				}
				else
				{
					lsessionid=guest["sessionid"];
					lprovidertype=guest["providertype"];
				}
			}
			else
			{
				lprovidertype=conn.getvariable("providertype");
				
			}
			sessionid=lsessionid;
			providertype=lprovidertype;
		}
		catch(e)
		{
			try
			{
				if(guest["sessionid"]==null)
				{
					params["header"]["refername"]=guest["refername"];
					params["header"]["livesystem"]=guest["livesystem"];
					params["header"]["language"]=guest["language"];
				}
				else
				{
					lsessionid=guest["sessionid"];
					lprovidertype=guest["providertype"];
				}
			}
			catch(e)
			{
			}
		}
		params["header"]["sessionid"]=sessionid;
	}
	,
	this.setautomatic=function()
	{
		this.automatic=1;
	}
	,
	this.setrequestheader=function (lmainaction,lminoraction,lencoding,lnr_template,lresponse)
	{
		if(this.automatic==0 || this.automatic==null || this.automatic=="" )
		{
			if(lminoraction!="REFRESHSESSION")
			{
				var mydate1=new Date();
				lastactiontime=new Date(mydate1.getUTCFullYear(),mydate1.getUTCMonth(),mydate1.getUTCDate(),mydate1.getUTCHours(),mydate1.getUTCMinutes(),mydate1.getUTCSeconds());
				lastactiontime = lastactiontime.getTime();
			}
		}
		this.setheader();
		params["request"]["mainaction"]=lmainaction;
		params["request"]["minoraction"]=lminoraction;
		if(lresponse!=null)
		{
			params["request"]["response"]=lresponse;
		}
			
		if(lencoding=="templates")
		{
			params["request"]["encoding"]=lencoding;
			if(lnr_template!=null)
				params["request"]["nr_template"]=lnr_template;
		}
		else if(lencoding=="getcss")
		{
			params["request"]["encoding"]=lencoding;
			if(lnr_template!=null)
				params["request"]["nr_css"]=lnr_template;
		}
		else if(lencoding=="csv")
		{
			params["request"]["encoding"]=lencoding;
		}
		else
			params["request"]["encoding"]="json";
	}
	,
	this.setparams=function (attribute,value)
	{
		params["request"]["parameters"][attribute]=value;
	}
	,
	this.getmsg = function ()
	{
		return this.array2json(params);
	}
	,
	this.getparams = function ()
	{
		return params;
	}
	,		
	this.POSTrequest=function (lurl,lmyobject,lsuccess,lfailure,lextraParams)
	{
		if(cantalk==1)
		{
			var mymsg="msg="+this.array2json(params);
			if (lurl==null)
			{
				alert("no url");
				return 0;	
			}
			odataconnection.request({
			url: lurl, 
			params: mymsg, 
			extraParams:lextraParams,
			method: 'POST',
			success :lsuccess,
			failure:lfailure,
			scope: lmyobject
			});
		}
	}
	,
	this.GETrequest=function (lurl,lmyobject,lsuccess,lfailure,lextraParams)
	{	
		if(cantalk==1)
		{
			if(lurl == null)
			{
				alert("no url");
				return 0;	
			}
			odataconnection.request({
			url: lurl, 
			method: 'GET',
			success :lsuccess,
			extraParams:lextraParams,
			failure:lfailure,
			scope: lmyobject
			});
		}
	}
	,
	this.POSTupdateblock=function (lurl,lidblock,lminoraction)
	{
		var mymsg="msg="+this.array2json(params);
		this.updateblock(lurl,lidblock,mymsg,lminoraction);
	}
	,
	this.GETupdateblock=function (lurl,lidblock)
	{
		this.updateblock(lurl,lidblock);
	}	
	,
	this.prepareurl=function (lsecure,lprovidertype)
	{
		var lurl="";
		var client=urlclient;
		var admin=urladmin;
		if(lsecure)
		{
			client=urlclientsecure;
			admin=urladminsecure;
		}
		
		if(verifvalue(lprovidertype))
		{
			var providertype=lprovidertype;
		}
		else
		{
			try
			{		
				providertype=conn.getvariable("providertype");
			}
			catch(e)
			{
				try
				{
					sessionid=guest["sessionid"];
					providertype=guest["providertype"];
				}
				catch(e)
				{
					providertype="GU";
				}
			}
		}
				
		switch(providertype)
		{
			case "GU":
			case "CL":
			case "BD":
			
				lurl=client;
				break;
			case "MM":
			case "AD":
			case "SA":
			case "DV":
			case "SV":
			case "OP":
			case "MA":
			case "CS":
			case "AF":
			case "LG":
			case "AS":
			case "IM":
			case "CM":
			case "MS":
			case "AM":
			case "CA":
			case "SS":
			case "SM":
			case "AA":
				lurl=admin;
				break;
			default:
				lurl=client
		}
		return lurl;
	}
	,
	this.isadmin=function()
	{
		try
		{
			providertype=conn.getvariable("providertype");
		}
		catch(e)
		{
			try
			{
				providertype=guest["providertype"];
			}
			catch(e)
			{
				providertype="GU";
			}
		}

		var result=0;
		switch(providertype)
		{
			case "GU":
			case "CL":
			case "BD":
			
				result=0;
				break;
			case "MM":
			case "AD":
			case "SA":
			case "DV":
			case "SV":
			case "OP":
			case "MA":
			case "CS":
			case "AF":
			case "LG":
			case "AS":
			case "IM":
			case "CM":
			case "MS":
			case "AM":
			case "CA":
			case "SS":
			case "SM":
			case "AA":
				result=1;
				break;
			default:
				result=0
		}
		return result;
	}
	,
	this.APIjson=function(lsecure,lmyobject,lonsuccess,lonfailure,lextraParams)
	{
		if(lsecure && (ishttps==0 || this.isadmin()))
		{
			consoleinfo("APIjson old");
			this.APIjsonsecure(lmyobject,lonsuccess,lonfailure,lextraParams);
		}
		else
		{
			consoleinfo("APIjson new");
			this.POSTrequest(this.prepareurl(lsecure),lmyobject,lonsuccess,lonfailure,lextraParams);
		}
	}
	,
	this.APIcsv=function(lsecure,lmyobject,lonsuccess,lonfailure,lextraParams)
	{
		var mymsg="?msg="+this.array2json(params);
		if(lsecure)
			window.open(urladminsecure+mymsg,
                  "DescriptiveWindowName",
                  "resizable=yes,scrollbars=yes,status=yes");
	
		else
			window.open(urladmin+mymsg,
                  "DescriptiveWindowName",
                  "resizable=yes,scrollbars=yes,status=yes");
	},
	this.APIjsonsecure=function(lmyobject,lonsuccess,lonfailure,lextraParams)
	{
		params["request"]["response"]=actionid++;
		if(this.isadmin())
			this.APIjsonadminsecurefrm(lmyobject,lonsuccess,lonfailure,lextraParams);
		else
			this.APIjsonclientsecurefrm(lmyobject,lonsuccess,lonfailure,lextraParams);
	}
	,
	this.prepareAPIjsonclientsecurefrm=function(lmyobject,lonsuccess,lonfailure,lextraParams)
	{
		var el=Ext.get("ajaxfrm");
		el.addListener('load', this.loadframe,this,{single:true});
		this.myobj=lmyobject;
		this.mymethod=lonsuccess;
		this.myfailure=lonfailure;
		this.myextraparams=lextraParams;
		this.actionid=params["request"]["response"];
	}
	,
	this.APIjsonclientsecurefrm=function(lmyobject,lonsuccess,lonfailure,lextraParams)
	{
		this.prepareAPIjsonclientsecurefrm(lmyobject,lonsuccess,lonfailure,lextraParams);
		document.clientsecurefrm.msg.value=this.getmsg();
		document.clientsecurefrm.submit();
	}
	,
	this.APIjsonadminsecurefrm=function(lmyobject,lonsuccess,lonfailure,lextraParams)
	{
		this.prepareAPIjsonclientsecurefrm(lmyobject,lonsuccess,lonfailure,lextraParams);
		document.adminsecurefrm.msg.value=this.getmsg();
		document.adminsecurefrm.submit();
	}
	,
	this.loadframe=function()
	{
		this.GETrequest(urlclientgateway+"?sessionid="+params["header"]["sessionid"]+"&token="+this.actionid,this.myobj,this.mymethod,this.myfailure,this.myextraparams);
		document.getElementById("ajaxfrm").src="";
	}
	,
	this.prepareAPIupdateblockclientsecurefrm=function(lidblock,lmainaction,lminoraction,lnr_template,parameters)
	{
		var el = Ext.get(lidblock);
		this.myoldcontent=document.getElementById(lidblock).innerHTML;
		try{document.getElementById("main_account").style.display="none";}catch(e){}
				
		this.setrequestheader(lmainaction,lminoraction,"templates",lnr_template,actionid++);
		for (var param in parameters)
		{
			this.setparams(param,parameters[param]);
		}
				
		var el=Ext.get("ajaxfrm");
		el.addListener('load', this.loadblock,this,{single:true});
				
		this.actionid=params["request"]["response"];
		this.myobj=this;
		this.mymethod=this.loadblockend;
		this.myfailure=this.loadblockfailure;
		this.idblock=lidblock;
		this.minoraction=lminoraction;
	}
	,
	this.APIupdateblockclientsecurefrm=function(lidblock,lmainaction,lminoraction,lnr_template,parameters)
	{
		if(ishttps==0)
		{
			this.prepareAPIupdateblockclientsecurefrm(lidblock,lmainaction,lminoraction,lnr_template,parameters);
			document.clientsecurefrm.msg.value=this.getmsg();
			document.clientsecurefrm.submit();
		}
		else
		{
			if(lmainaction=="CASHIER")
                        {
                            localmainaction="CASHIER";
                        }
			this.setrequestheader(lmainaction,lminoraction,"templates",lnr_template);
			for (var param in parameters)
			{
				this.setparams(param,parameters[param]);
			}
			this.POSTupdateblock( this.prepareurl(1),lidblock,lminoraction);

		}
		
	}
	,
	this.APIupdateblockadminsecurefrm=function(lidblock,lmainaction,lminoraction,lnr_template,parameters)
	{
		if(ishttps==0 || this.isadmin()) 
		{	
			this.prepareAPIupdateblockclientsecurefrm(lidblock,lmainaction,lminoraction,lnr_template,parameters);
			document.adminsecurefrm.msg.value=this.getmsg();
			document.adminsecurefrm.submit();
		}
		else
		{
			consoleinfo("APIupdateblockclientsecurefrm new");
			this.setrequestheader(lmainaction,lminoraction,"templates",lnr_template);
			for (var param in parameters)
			{
				this.setparams(param,parameters[param]);
			}
			this.POSTupdateblock( this.prepareurl(1),lidblock,lminoraction);
		}
	}
	,
	this.loadblock=function()
	{
		this.GETrequest(urlclientgateway+"?sessionid="+params["header"]["sessionid"]+"&token="+this.actionid,this.myobj,this.mymethod,this.myfailure);
		document.getElementById("ajaxfrm").src="";
	}
	,
	this.loadblockend=function(response,opts)
	{
		if(responsetojson(response,opts)==0)
		{
			document.getElementById(this.idblock).innerHTML=this.myoldcontent;
			cssschedule.delay(100,this.displaymainaccount);
		}
		else
		{
			document.getElementById(this.idblock).innerHTML=response.responseText;
			cssschedule.delay(100,this.displaymainaccount);
			evalscriptcenter(this.minoraction);
		}
	}
	,
	this.loadblockfailure=function()
	{
		document.getElementById(this.idblock).innerHTML=this.myoldcontent;
		cssschedule.delay(100,this.displaymainaccount);
	}
	,
	this.APIupdateblock=function(lsecure,lidblock,lmainaction,lminoraction,lnr_template,parameters)
	{
		if(lsecure && (ishttps==0 || this.isadmin()))
		{
			consoleinfo("APIupdateblock old");
			this.APIupdateblocksecure(lidblock,lmainaction,lminoraction,lnr_template,parameters);
		}
		else
		{
			consoleinfo("APIupdateblock new");
			this.setrequestheader(lmainaction,lminoraction,"templates",lnr_template);
			for (var param in parameters)
			{
				this.setparams(param,parameters[param]);
			}
			this.POSTupdateblock( this.prepareurl(lsecure),lidblock,lminoraction);
		}
	}
	,
	this.APIupdateblocksecure=function(lidblock,lmainaction,lminoraction,lnr_template,parameters)
	{
		params["request"]["response"]=actionid++;
		if(this.isadmin())
			this.APIupdateblockadminsecurefrm(lidblock,lmainaction,lminoraction,lnr_template,parameters);
		else
			this.APIupdateblockclientsecurefrm(lidblock,lmainaction,lminoraction,lnr_template,parameters);
	}
	,	
	this.updateblock=function (lurl,lidblock,mymsg,lminoraction)
	{
		var el = Ext.get(lidblock);
		var oldcontent=document.getElementById(lidblock).innerHTML;
		
		try{document.getElementById("main_account").style.display="none";}catch(e){}	
			
		if(lurl == null)
		{
			alert("no url");
			return 0;	
		}
		
		if(mymsg!=null && cantalk==1)
		{
			odataconnection.request({
			url: lurl,
			method: 'POST',
			params: mymsg,
			extraParams: oldcontent,
			success :function(response,opts)
			{
				try
				{
					try
					{                                         
						var json=Ext.util.JSON.decode(response.responseText);
                                                 console.info("error code: "+json.header.errorcode);
						if(json.header.errorcode==108 || json.header.errorcode=="108")
						{
                                                    if(localmainaction=="CASHIER")
                                                        {
							try{document.getElementById("main_account").style.display="none";}catch(e){}
                                                        try{document.getElementById("formdeposit").style.display="none";}catch(e){}
                                                        try{document.getElementById("sessionerror").style.display="";}catch(e){}
                                                        }
						}
						else if(json.header.errorcode % 100)
						{
							alert(response.responseText);
						}
					}
					catch(e)
					{
						document.getElementById(lidblock).innerHTML=response.responseText;
						cssschedule.delay(100,this.displaymainaccount);
						evalscriptcenter(lminoraction);
					}
				}
				catch(e)
				{
					/*console.info("error on updateblock");*/
				}
			},
			failure: function(response,opts)
			{
				document.getElementById(lidblock).innerHTML=oldcontent;
				cssschedule.delay(100,this.displaymainaccount);
			}
			,scope: this
			});
		}
		else
		{
			if(cantalk==1)
			{
				odataconnection.request({
				url: lurl,
				method: 'GET',
				extraParams: oldcontent,
				success :function(response,opts)
				{
					document.getElementById(lidblock).innerHTML=response.responseText;
					sortables_init();
					evalscriptcenter(lminoraction);
				}
				,
				failure: function(response,opts)
				{
					document.getElementById(lidblock).innerHTML=oldcontent;
				}
				,scope: this
				});
			}
		}
	}
	,
	this.client=function(lmyobject,lonsuccess,lonfailure,lextraParams)
	{
		this.POSTrequest(urlclient,lmyobject,lonsuccess,lonfailure,lextraParams);	
	}
	,
	this.clientsecure=function (lmyobject,lonsuccess,lonfailure,lextraParams)
	{
		if(ishttps==0)
		{
			params["request"]["response"]=actionid++;
			this.APIjsonclientsecurefrm(lmyobject,lonsuccess,lonfailure,lextraParams);
		}
		else
			this.POSTrequest(urlclientsecure,lmyobject,lonsuccess,lonfailure,lextraParams);
	}
	,
	this.clientsecurescripttags=function ()
	{
		var req  = urlclientsecurehttps+"?msg="+this.getmsg(); 
		this.bObj = new JSONscriptRequest(req); 
		this.bObj.buildScriptTag(); 
		this.bObj.addScriptTag();
	}
	,
	this.admin=function (lmyobject,lonsuccess,lonfailure,lextraParams)
	{
		this.POSTrequest(urladmin,lmyobject,lonsuccess,lonfailure,lextraParams);	
	}
	,
	this.adminsecure=function (lmyobject,lonsuccess,lonfailure,lextraParams)
	{
		if(ishttps==0 || this.isadmin())
		{	
			params["request"]["response"]=actionid++;
			this.APIjsonadminsecurefrm(lmyobject,lonsuccess,lonfailure,lextraParams);
		}
		else
			this.POSTrequest(urladminsecure,lmyobject,lonsuccess,lonfailure,lextraParams);
	}
}

function responsetojson(response,opts,notshowalert,msgsuccess)
{
	try
	{
		var json=Ext.util.JSON.decode(response.responseText);
	}
	catch(e)
	{
		var json=response.responseText;
	}	
	try
	{		
		if(json.header.errorcode==108 || json.header.errorcode=="108")
		{
			sessionexpired();
			return 0;
		}
		else if(json.header.errorcode % 100 && notshowalert==null)
		{
			alert(json.header.errordescription+"\n"+otransJS.translate("youneedhelppleaseemailusat"));
			return 0;
		}
		else if (msgsuccess)
		{
			alert(json.header.errordescription+"\n"+otransJS.translate("youneedhelppleaseemailusat"));
		}
		return 1;
	}
	catch(e)
	{
		return 2;
		//debug("error on php");
		//consoledir(response);
	}
}

function verifattributename(lattribute)
{
	return lattribute!=null && lattribute!="";
}

function verifvalue(lvalue)
{
	return lvalue!=null && lvalue!="" && lvalue!=0;
}

function mask(lidblock)
{
	var el = Ext.get(lidblock);
	/*'<img src="'+loadgif+'" style="width:16px;height:16px;" align="absmiddle">&nbsp;'++'...', "x-mask-loading'"*/
	try
	{
		el.mask(otransJS.translate("Loading"));
	}
	catch(e)
	{
		el.mask("Loading");
	}
}

function unmask(lidblock)
{
	var el = Ext.get(lidblock);
	el.unmask();
}

if (!window.console || !console.firebug)
{
    var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
    "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];

    window.console = {};
    for (var i = 0; i < names.length; ++i)
        window.console[names[i]] = function() {};
}

showlog=0;

function consolelog(str)
{
	if(showlog)
		console.log(str);
}

function consoleinfo(str)
{
	if(showlog)
		console.info(str);
}

function consoledebug(str)
{
	if(showlog)
		console.debug(str);
}

function consoleerror(str)
{
	if(showlog)
		console.error(str);
}

function consoledir(str)
{
	if(showlog)
		console.dir(str);
}


function evalscriptcenter(lminoraction)
{
	try
	{
        addscript("myscriptcenter"+lminoraction);
		//eval(document.getElementById("myscriptcenter"+lminoraction).innerHTML);
		//consoleinfo("1 myscriptcenter"+lminoraction);
	}
	catch(e)
	{
		try
		{
            addscript("myscriptcenter");
			//eval(document.getElementById("myscriptcenter").innerHTML);
			//consoleinfo("2 myscriptcenter"+lminoraction);
		}
		catch(e)
		{
			try
			{
				debug(document.getElementById("myscriptcenter").innerHTML);
				//consoleinfo("3 myscriptcenter"+lminoraction);
			}
			catch(e)
			{
				//consoleinfo("4 myscriptcenter"+lminoraction);
			}
		}
	}
}

function addscript(sourceElID)
{
    var sourceEl;
    sourceEl=document.getElementById(sourceElID);
    var script = document.getElementById(sourceElID+"ScriptTag");
    var head = document.getElementsByTagName("head");
    if (script)
        head[0].removeChild(script);
    script = document.createElement("script");
    script.id=sourceElID+"ScriptTag";
    script.type = "text/javascript";
    if(!!(window.attachEvent && !window.opera)) {
        script.text = sourceEl.innerHTML;
    } else {
        script.appendChild(document.createTextNode(sourceEl.innerHTML));
    }
    head[0].appendChild(script);

    //eval(sourceEl.innerHTML);
}

 var escapeable2 = /["\\\x00-\x1f\x7f-\x9f]/g,
            gap,
            indent,
            meta = {    // table of character substitutions
                '\b': '\\b',
                '\t': '\\t',
                '\n': '\\n',
                '\f': '\\f',
                '\r': '\\r',
                '"' : '\\"',
                '\\': '\\\\'
            },
            rep;

function quotesteve(string)
{
	return escapeable2.test(string) ?
    '"' + string.replace(escapeable2, function (a) {
        var c = meta[a];
        if (typeof c === 'string') {
            return c;
        }
        c = a.charCodeAt();
        return '\\u00' + Math.floor(c / 16).toString(16) +
                                   (c % 16).toString(16);
    }) + '"' :
    '"' + string + '"';
}

if (!this.JSON) {

// Create a JSON object only if one does not already exist. We create the
// object in a closure to avoid global variables.

    JSON = function () {

        function f(n) {    // Format integers to have at least two digits.
            return n < 10 ? '0' + n : n;
        }

        Date.prototype.toJSON = function () {

// Eventually, this method will be based on the date.toISOString method.

            return this.getUTCFullYear()   + '-' +
                 f(this.getUTCMonth() + 1) + '-' +
                 f(this.getUTCDate())      + 'T' +
                 f(this.getUTCHours())     + ':' +
                 f(this.getUTCMinutes())   + ':' +
                 f(this.getUTCSeconds())   + 'Z';
        };


        var escapeable = /["\\\x00-\x1f\x7f-\x9f]/g,
            gap,
            indent,
            meta = {    // table of character substitutions
                '\b': '\\b',
                '\t': '\\t',
                '\n': '\\n',
                '\f': '\\f',
                '\r': '\\r',
                '"' : '\\"',
                '\\': '\\\\'
            },
            rep;


        function quote(string) {

// If the string contains no control characters, no quote characters, and no
// backslash characters, then we can safely slap some quotes around it.
// Otherwise we must also replace the offending characters with safe escape
// sequences.

            return escapeable.test(string) ?
                '"' + string.replace(escapeable, function (a) {
                    var c = meta[a];
                    if (typeof c === 'string') {
                        return c;
                    }
                    c = a.charCodeAt();
                    return '\\u00' + Math.floor(c / 16).toString(16) +
                                               (c % 16).toString(16);
                }) + '"' :
                '"' + string + '"';
        }


        function str(key, holder) {

// Produce a string from holder[key].

            var i,          // The loop counter.
                k,          // The member key.
                v,          // The member value.
                length,
                mind = gap,
                partial,
                value = holder[key];

// If the value has a toJSON method, call it to obtain a replacement value.

            if (value && typeof value === 'object' &&
                    typeof value.toJSON === 'function') {
                value = value.toJSON(key);
            }

// If we were called with a replacer function, then call the replacer to
// obtain a replacement value.

            if (typeof rep === 'function') {
                value = rep.call(holder, key, value);
            }

// What happens next depends on the value's type.

            switch (typeof value) {
            case 'string':
                return quote(value);

            case 'number':

// JSON numbers must be finite. Encode non-finite numbers as null.

                return isFinite(value) ? String(value) : 'null';

            case 'boolean':
            case 'null':

// If the value is a boolean or null, convert it to a string. Note:
// typeof null does not produce 'null'. The case is included here in
// the remote chance that this gets fixed someday.

                return String(value);

// If the type is 'object', we might be dealing with an object or an array or
// null.

            case 'object':

// Due to a specification blunder in ECMAScript, typeof null is 'object',
// so watch out for that case.

                if (!value) {
                    return 'null';
                }

// Make an array to hold the partial results of stringifying this object value.

                gap += indent;
                partial = [];

// If the object has a dontEnum length property, we'll treat it as an array.

                if (typeof value.length === 'number' &&
                        !(value.propertyIsEnumerable('length'))) {

// The object is an array. Stringify every element. Use null as a placeholder
// for non-JSON values.

                    length = value.length;
                    for (i = 0; i < length; i += 1) {
                        partial[i] = str(i, value) || 'null';
                    }

// Join all of the elements together, separated with commas, and wrap them in
// brackets.

                    v = partial.length === 0 ? '[]' :
                        gap ? '[\n' + gap + partial.join(',\n' + gap) +
                                  '\n' + mind + ']' :
                              '[' + partial.join(',') + ']';
                    gap = mind;
                    return v;
                }

// If the replacer is an array, use it to select the members to be stringified.

                if (typeof rep === 'object') {
                    length = rep.length;
                    for (i = 0; i < length; i += 1) {
                        k = rep[i];
                        if (typeof k === 'string') {
                            v = str(k, value, rep);
                            if (v) {
                                partial.push(quote(k) + (gap ? ': ' : ':') + v);
                            }
                        }
                    }
                } else {

// Otherwise, iterate through all of the keys in the object.

                    for (k in value) {
                        v = str(k, value, rep);
                        if (v) {
                            partial.push(quote(k) + (gap ? ': ' : ':') + v);
                        }
                    }
                }

// Join all of the member texts together, separated with commas,
// and wrap them in braces.

                v = partial.length === 0 ? '{}' :
                    gap ? '{\n' + gap + partial.join(',\n' + gap) +
                              '\n' + mind + '}' :
                          '{' + partial.join(',') + '}';
                gap = mind;
                return v;
            }
        }


// Return the JSON object containing the stringify, parse, and quote methods.

        return {
            stringify: function (value, replacer, space) {

// The stringify method takes a value and an optional replacer, and an optional
// space parameter, and returns a JSON text. The replacer can be a function
// that can replace values, or an array of strings that will select the keys.
// A default replacer method can be provided. Use of the space parameter can
// produce text that is more easily readable.

                var i;
                gap = '';
                indent = '';
                if (space) {

// If the space parameter is a number, make an indent string containing that
// many spaces.

                    if (typeof space === 'number') {
                        for (i = 0; i < space; i += 1) {
                            indent += ' ';
                        }

// If the space parameter is a string, it will be used as the indent string.

                    } else if (typeof space === 'string') {
                        indent = space;
                    }
                }

// If there is no replacer parameter, use the default replacer.

                if (!replacer) {
                    rep = function (key, value) {
                        if (!Object.hasOwnProperty.call(this, key)) {
                            return undefined;
                        }
                        return value;
                    };

// The replacer can be a function or an array. Otherwise, throw an error.

                } else if (typeof replacer === 'function' ||
                        (typeof replacer === 'object' &&
                         typeof replacer.length === 'number')) {
                    rep = replacer;
                } else {
                    throw new Error('JSON.stringify');
                }

// Make a fake root object containing our value under the key of ''.
// Return the result of stringifying the value.

                return str('', {'': value});
            },


            parse: function (text, reviver) {

// The parse method takes a text and an optional reviver function, and returns
// a JavaScript value if the text is a valid JSON text.

                var j;

                function walk(holder, key) {

// The walk method is used to recursively walk the resulting structure so
// that modifications can be made.

                    var k, v, value = holder[key];
                    if (value && typeof value === 'object') {
                        for (k in value) {
                            if (Object.hasOwnProperty.call(value, k)) {
                                v = walk(value, k);
                                if (v !== undefined) {
                                    value[k] = v;
                                } else {
                                    delete value[k];
                                }
                            }
                        }
                    }
                    return reviver.call(holder, key, value);
                }


// Parsing happens in three stages. In the first stage, we run the text against
// regular expressions that look for non-JSON patterns. We are especially
// concerned with '()' and 'new' because they can cause invocation, and '='
// because it can cause mutation. But just to be safe, we want to reject all
// unexpected forms.

// We split the first stage into 4 regexp operations in order to work around
// crippling inefficiencies in IE's and Safari's regexp engines. First we
// replace all backslash pairs with '@' (a non-JSON character). Second, we
// replace all simple value tokens with ']' characters. Third, we delete all
// open brackets that follow a colon or comma or that begin the text. Finally,
// we look to see that the remaining characters are only whitespace or ']' or
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.

                if (/^[\],:{}\s]*$/.test(text.replace(/\\["\\\/bfnrtu]/g, '@').
replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {

// In the second stage we use the eval function to compile the text into a
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
// in JavaScript: it can begin a block or an object literal. We wrap the text
// in parens to eliminate the ambiguity.

                    j = eval('(' + text + ')');

// In the optional third stage, we recursively walk the new structure, passing
// each name/value pair to a reviver function for possible transformation.

                    return typeof reviver === 'function' ?
                        walk({'': j}, '') : j;
                }

// If the text is not JSON parseable, then a SyntaxError is thrown.

                throw new SyntaxError('JSON.parse');
            },

            quote: quote
        };
    }();
}
function popuppresenter(loptions)
{
        var defaultoptions =
            {
                popupelement      : 'mainpopupel',
                popupelementtype  : 'div',
                contentelement    : 'contentel',
                content           : '',
                visible           : 0,
                position          : 'center',
                okbutton          : {
                                        position     : {startx: 0,starty: 0,endx: 50,endy: 50},
                                        tooltip		 : 'Ok',
										api			 : 	{createparamscallback 	: null,
														 mainaction				: null,
														 minoraction			: null,
														 onsuccess         		: null
														}
                                    },
                cancelbutton      : {
                                        position     : {startx: 80,starty: 0,endx: 50,endy: 50},
                                        tooltip      : 'Cancel',
										api			 : 	{createparamscallback 	: null,
														 mainaction				: null,
														 minoraction			: null,
														 onsuccess         		: null
														}
                                    },
                inputbox          : {
                                        position    : {startx: 0,starty: 80,endx: 100,endy: 20},
                                        defvalue    : 0
                                    },
                staticfields      : [
                                       {position    : {startx: 0,starty: 80,endx: 100,endy: 20},
                                        value       : "",
                                        style		: ""}
                                    ],
                /* mapareabuttons    : [{
                                            id          : 'popupokbutton',
                                            callback    : null,
                                            position     : {startx: 0, starty: 0, endx: 1, endy: 1},
                                            tooltip     : 'OK'
                                    }], */
                mapareaimage      : 'mainpopupimage',
                /*defwidth		  : '10%',
                defheight		  : '10%',*/
				defbackcolor	  : 'transparent',
                overlay	  		  : {create:true,
									 opacity: 0.8,
									 color: "fff"},
                sessionid         : 0
            },
			popupelement=null,
			contentelement=null,
            /*mapareaimage=null,*/
            areamapid='',
            inputboxid='popupinputbox',
            inputbox=null,
            initialized=0,
            options=null,
            self=this;
        this.parameters = null;
		
        function applyoptions()
        {
            if (options.visible)
            {
                if (!initialized)
                {
                    /*if (document.body===null)
					{
						self.addListener(window,'load',function() {applyoptions(); popupelement.style["visibility"]="visible";});
						return;
					}
                    else*/
						initoptions();
                }
                popupelement.style["visibility"]="visible";
            }
            else if (popupelement)
            {
                popupelement.style["visibility"]="hidden";
            }
        }
        function initoptions()
        {
            if (options.contentelement)
                contentelement=document.getElementById(options.contentelement);
            if (!contentelement)
            {
                /*popupelement.innerHTML+="<div id='"+options.contentelement+"'>\n</div>\n";*/
                contentelement=createcontentelement(); /*document.getElementById(options.contentelement);*/
            }
            contentelement.innerHTML+=options.content;

            if (options.mapareaimage)
            {
                var createmap=false,
                    mapHTML='',
                    buttonsHTML='',
                    inputHTML='';
                if (options.okbutton)
                {
                    var buttonoptions=options.okbutton;
                    if (!buttonoptions.htmlinput)
                    {
                        createmap=true;
                        mapHTML+=createareabutton(buttonoptions,'ok');
                    }
                    else
                        buttonsHTML+=createareabutton(buttonoptions,'ok');
                }
                if (options.cancelbutton)
                {
                    buttonoptions=options.cancelbutton;
                    if (!buttonoptions.htmlinput)
                    {
                        createmap=true;
                        mapHTML+=createareabutton(buttonoptions,'cancel');
                    }
                    else
                        buttonsHTML+=createareabutton(buttonoptions,'cancel');
                }
                if (createmap)
                {
                    /*mapareaimage=document.getElementById(options.mapareaimage);*/
                    areamapid=options.popupelement+'map';
                    mapHTML='<map name="'+areamapid+'">\n'+mapHTML;
                    /* for (var i=0;i<options.mapareabuttons.length;i++)
                    {
                        var buttonoptions=options.mapareabuttons[i];
                        mapHTML+='<area shape="rect" coords="';
                        mapHTML+=buttonoptions.position.startx+','+buttonoptions.position.starty+','+buttonoptions.position.endx+','+buttonoptions.position.endy;
                        mapHTML+='" title="'+buttonoptions.tooltip+'" href="javascript:'+buttonoptions.callback+'" />\n';
                    } */
                    mapHTML+='</map>\n' + "<img id='mapareaimage' src='"+options.mapareaimage+"' usemap='#"+areamapid+"' style='border:0 none;' />\n";
                }
                else
                    mapHTML+="<img id='mapareaimage' src='"+options.mapareaimage+"' style='border:0 none;' />\n";
                if (options.inputbox)
                {
                    inputHTML='<input id="'+inputboxid+'" type="input" value="'+options.inputbox.defvalue+'"';
                    inputHTML+=' style="position:absolute;'+(options.inputbox.style?options.inputbox.style:'')+'left:';
                    inputHTML+=options.inputbox.position.startx+'px;top:';
                    inputHTML+=options.inputbox.position.starty+'px;width:';
                    inputHTML+=(options.inputbox.position.endx-options.inputbox.position.startx+1)+'px;height:';
                    inputHTML+=(options.inputbox.position.endy-options.inputbox.position.starty+1)+'px;" />\n';
                }
                
                var staticfieldsHTML="";
                for (var i=0;i<options.staticfields.length;i++)
                {
                    var sf=options.staticfields[i];
                    staticfieldsHTML+='<div style="position:absolute;'+(sf.style?sf.style:'')+'left:'+sf.position.startx+'px;top:'+sf.position.starty
                        +'px;width:'+(sf.position.endx-sf.position.startx+1)+'px;height:'+(sf.position.endy-sf.position.starty+1)+'px;">'+sf.value+'</div>\n';
                }

                /*var styleHTML='';*/
                if (options.style)
                {
                    /*styleHTML='<style type="text/css">'+options.style+'</style>\n';*/
                    /*var headID = document.getElementsByTagName("head")[0];
                    var cssNode = document.createElement('style');
                    cssNode.type = 'text/css';*/
                    /*cssNode.rel = 'stylesheet';
                    cssNode.href = 'FireFox.css';
                    cssNode.media = 'screen';*/
                    /*cssNode.innerHTML=options.style;
                    headID.appendChild(cssNode);*/


                    var styleNode = document.createElement('style');
                    styleNode.type = "text/css";
                    /* browser detection (based on prototype.js)*/
                    if(!!(window.attachEvent && !window.opera)) {
                        styleNode.styleSheet.cssText = options.style;
                    } else {
                        var styleText = document.createTextNode(options.style);
                        styleNode.appendChild(styleText);
                    }
                    document.getElementsByTagName('head')[0].appendChild(styleNode);
                }
                contentelement.innerHTML+=/*styleHTML+*/mapHTML+buttonsHTML+inputHTML+staticfieldsHTML;
/*                self.addListener(document.getElementById('okButtonArea'),'Click',function() {this.buttonscallback('ok');},true);
                  self.addListener(document.getElementById('cancelButtonArea'),'Click',function() {this.buttonscallback('cancel');},true);*/
                inputbox=document.getElementById(inputboxid);
                /*mapareaimage.useMap="#"+areamapid;
                mapareaimage.setAttribute('useMap',"#"+areamapid);
                mapareaimage.attributes */
                /*sizePopUp(options.defwidth,options.defheight);*/
                self.addListener(document.getElementById("mapareaimage"), "load", sizePopUp, true);
            }
            else if (options.popupelementtype=='iframe')
            	sizePopUp();
            initialized=1;
        }
        function createareabutton(buttonoptions,type)
        {
            var buttonHTML;
            if (!buttonoptions.htmlinput)
            {
                buttonHTML='<area id="okButtonArea" shape="rect" coords="'+
                         buttonoptions.position.startx+','+buttonoptions.position.starty+','+buttonoptions.position.endx+','+buttonoptions.position.endy+
                         '" title="'+buttonoptions.tooltip+'" href="javascript:window.opopuppresenter.buttonscallback(\''+type+'\')" />\n';
            }
            else
            {
                buttonHTML='<input type="button" value="" style="position:absolute;'+
                            'left:'+buttonoptions.position.startx+'px;top:'+buttonoptions.position.starty+'px;'+
                            'width:'+(buttonoptions.position.endx-buttonoptions.position.startx+1)+'px;'+
                            'height:'+(buttonoptions.position.endy-buttonoptions.position.starty+1)+'px;'+(buttonoptions.style?buttonoptions.style:'')+'"'+
                            'title="'+buttonoptions.tooltip+'" onclick="window.opopuppresenter.buttonscallback(\''+type+'\');" '+
                            (buttonoptions.cls?'class="'+buttonoptions.cls:'')+'"/>\n';
            }
            return buttonHTML;
        }
        function getElementPos(el,width,height)
        {
            var windims=getDimensions();
            if (!width||!height)
            {
                width=el.clientWidth;
                height=el.clientHeight;
            }
            var pos={left:((windims.width - width) / 2) + 'px',
                     top:((windims.height - height) / 2) + 'px'};
            return pos;
        }
        function sizePopUp(width,height)
        {
            if ((contentelement)&&(options.position=='center'))
            {
            	elementtosize=contentelement;
            	if (!options.overlay.create)
            		elementtosize=popupelement;
                elementtosize.style["position"]="absolute";
                var pos=getElementPos(elementtosize,width,height);
                elementtosize.style["left"]=pos.left;
                elementtosize.style["top"]= pos.top;
                if (options.popupelementtype!='iframe')
                {
                    if (!width||!height)
                    {
                        width=elementtosize.clientWidth;
                        height=elementtosize.clientHeight;
                    }
	                elementtosize.style["width"]= width + 'px';
	                elementtosize.style["height"]= height + 'px';
                }
                /*popupelement.style['z-index']='1000';*/
            }
        }
        /* Cross-browser implementation of element.addEventListener() */
        self.addListener=function(element, type, expression, bubbling)
        {
			bubbling = bubbling || false;
			if(window.addEventListener)     { /* Standard */
				element.addEventListener(type, expression, bubbling);
				return true;
			} else if(window.attachEvent) { /* IE */
				element.attachEvent('on' + type, expression);
				return true;
			} else return false;
        };
        function Browser()
        {
            return {
            IE:     !!(window.attachEvent && !window.opera),
            Opera:  !!window.opera,
            WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
            Gecko:  navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1,
            MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/)};
        }
        function getDimensions() {
            B=Browser;
            var dimensions=[];
            if (options.parentelement)
            {
                dimensions.width=options.parentelement.clientWidth;
                dimensions.height=options.parentelement.clientHeight;
            }
            else
            {
                dimensions.width = Ext.get(document.getElementsByTagName('body')[0]).getWidth(); /*(B.WebKit && !document.evaluate) ? self['innerWidth'] :
                                                                                         (B.Opera) ? document.body['clientWidth'] : document.documentElement['clientWidth'];*/
                dimensions.height = Ext.get(document.getElementsByTagName('body')[0]).getHeight();/* (B.WebKit && !document.evaluate) ? self['innerHeight'] :
                                                                                           (B.Opera) ? document.body['clientHeight'] : document.documentElement['clientHeight'];*/
            }
            return dimensions;
        }
        function createpopupelement()
        {
            var div = document.createElement(options.popupelementtype);
            div.id = options.popupelement;
            div.name = options.popupelement;
            if (options.overlay.create)
            	sizes='width:100%;height:100%;';
        	else if (options.defwidth&&options.defheight)
        		sizes='width:'+options.defwidth+';height:'+options.defheight+';';
            div.style.cssText = "z-index:1000;position:absolute;visibility:hidden;left:0px;top:0px;background-color:"+options.defbackcolor+";"+sizes;

            if (options.parentelement)
            	options.parentelement.appendChild(div);
            else
            	document.body.appendChild(div);
            return div;
        }
        function createoverlaydiv()
        {
            var div = document.createElement('div');
            div.id = options.popupelement+'overlay';
            div.style.cssText = "z-index:1001;position:absolute;left:0px;top:0px;width:100%;height:100%;background-color: #"+options.overlay.color+";"+
								"filter: alpha(opacity = "+(options.overlay.opacity*100)+");-moz-opacity: "+(options.overlay.opacity)+";";
            div.style.opacity=options.overlay.opacity;
            popupelement.appendChild(div);
            return div;
        }
        function createcontentelement()
        {
            var div = document.createElement('div');
            div.id = options.contentelement;
            
            var cssText="z-index:1002;color: #000; border:none;position:absolute;";
            if (options.defwidth&&options.defheight)
            {
                var pos=getElementPos(undefined,parseInt(options.defwidth),parseInt(options.defheight));
                cssText+="width:"+options.defwidth+';height:'+options.defheight+";left:"+pos.left+";top:"+pos.top+";";
            }
            div.style.cssText=cssText;
            popupelement.appendChild(div);
            return div;
        }
		function initelements()
		{
            popupelement=document.getElementById(options.popupelement);
            if (!popupelement)
            {
                /* document.lastChild.innerHTML+="<div id='"+options.popupelement+"' style='z-index:1000'>\n</div>\n";*/
                popupelement=createpopupelement();/*document.getElementById(options.popupelement);*/
            }
            if (options.overlay.create)
            	createoverlaydiv();			
		}
		this.destruct=function()
		{
			popupelement.parentNode.removeChild(popupelement);
		};
		function reset()
		{
			self.destruct();
			popupelement=null;
			contentelement=null;
            /*mapareaimage=null;*/
            areamapid='';
            inputboxid='popupinputbox';
            inputbox=null;
            initialized=0;
            options=null;
		}
        this.initialize = function(loptions)
        {
            options = Object.clone(defaultoptions);
            Object.extend(options, loptions || {});
            if (initialized)
            {
				reset();
			}
			/*if (document.body===null)
			{
				self.addListener(window,'load',function() {initelements();applyoptions();});
				return;
			}
			else*/
				initelements();
            applyoptions();
        },
        this.show = function()
        {
            options.visible=1;
            applyoptions();
        },
        this.hide = function()
        {
            options.visible=0;
            applyoptions();
        },
        this.switchvisiblity = function()
        {
            options.visible=options.visible ? 0 : 1;
            applyoptions();
        },
        this.isvisible = function()
        {
            return popupelement.style["visibility"]=="visible";
        },
        this.buttonscallback = function(btn)
        {
            this.hide();
            var api;
            if (btn=='ok')
                api=options.okbutton.api;
            else if (options.cancelbutton)
                api=options.cancelbutton.api;
            if (api)
            {
                if (api.createparamscallback)
                    this.parameters=api.createparamscallback(btn,inputbox.value);
                /*consoleinfo(btn+"-"+options.promotionuserid+"-"+inputbox.value);*/
                if (api.mainaction&&api.minoraction)
                {
                    var omyajax=new myajax(options.sessionid);
                    omyajax.initrequest();
                    omyajax.setrequestheader(api.mainaction,api.minoraction);
                    for (var key in this.parameters)
                        omyajax.setparams(key,this.parameters[key]);
                    var client=omyajax.client.createDelegate(omyajax);
                    if (api.secure)
                        client=omyajax.clientsecure.createDelegate(omyajax);
                    client(this,api.onsuccess);
                }
            }
        };

        this.initialize(loptions);
}

Object.extend = function(destination, source) {
    if (source instanceof Array)
        {
            var l=source.length;
            for (var property=0;property<l;property++) 
            {
                if ((destination[property])&&(source[property] instanceof Object))
                    Object.extend(destination[property],source[property]);
                else
                    destination[property] = source[property];
            }			
        }
        else
        {
            for (var property in source)
            {
                if ((destination[property])&&(source[property] instanceof Object))
                    Object.extend(destination[property],source[property]);
                else
                    destination[property] = source[property];
            }
        }
        return destination;
    };
    Object.clone=function(obj) {
        if (obj instanceof Array)
        return Object.extend([], obj);
        else
        return Object.extend({}, obj);
        };

showPopUp=function(cfg)
    {
        if (window.opopuppresenter)
            try{window.opopuppresenter.destruct();}catch(e){}
        window.opopuppresenter=new popuppresenter(cfg);
        /*window.opopuppresenter.initialize(inputparameters);*/
        window.opopuppresenter.show();
    };
showGeneralMsgBox=function(title,text,size,style,buttons)
    {
        if (size===undefined) size='XL';
        if (size=='XL')
        {
            var defwidth=797;
            var defheight=350;
        }
        else if(size=='L')
        {
            var defwidth=640;
            var defheight=410;
        }
        /*var imageserver='{/literal}{$rootreferimages}{literal}';*/
        var img=imageserver+"/promotions/generalpopup"+size+".png";
        if (style===undefined) style='input.custombutton{ background: url('+imageserver+'/disconnectpopup/ok.png) no-repeat; width: 86px; height: 30px; border: none;}'+
                              'input:hover.custombutton{ background: url('+imageserver+'/disconnectpopup/ok_up.png) no-repeat; cursor: pointer;}';
        var okbutton,cancelbutton;
        if (buttons===undefined)
        {
            okbutton={position:	{startx:640,starty:300,endx:739,endy:335},
                                tooltip: 	"ok",
                                api:        null,
                                htmlinput:  true,
                                cls:        'custombutton'};
            cancelbutton=null;
        }
        else if(buttons)
        {
            okbutton=buttons.okbuttons;
            cancelbutton=buttons.cancelbutton;
        }
        else
        {
            okbutton=null;
            cancelbutton=null;
        }
        var staticfields;
        
        staticfields=[{         value: 		text,
                                style:		"font-size: 14px; font-family: arial;color: #464646;"}];
        if (okbutton&&okbutton.position)
            endy=okbutton.position.starty;
        else
            endy=defheight;
        endx=defwidth;
        if (title)
        {
            staticfields[0].position={startx:116,starty:100,endx:endx,endy:endy};
            staticfields.push({ position: 	{startx:116,starty:45,endx:500,endy:99},
                                                value: 		title,
                                                style:		"font-size: 14px; font-family: arial;color: #464646;"});
        }
        else
        {
            staticfields[0].position={startx:0,starty:0,endx:endx,endy:endy};
        }
        var inputparameters={
            mapareaimage    : img,
            style           : style,
            okbutton        : okbutton,
            cancelbutton    : cancelbutton,
            inputbox        : null,
            defwidth        : defwidth+'px',
            defheight       : defheight+'px',
            staticfields    : staticfields,
            overlay			: {opacity	:	0.7,
                                color	:	"000"}
        };
        
        showPopUp(inputparameters);
        /*if (window.opopuppresenter)
            window.opopuppresenter.destruct();
        window.opopuppresenter=new popuppresenter(inputparameters);
        window.opopuppresenter.show();*/
        /*window.opopuppresenter.initialize(inputparameters);*/
    };

function connection(_livesystem,_lang,_refername)
{
	var lomyajax=new myajax();
	var connectiondata=new Array();
	var refreshsessionid=0;
	var systemchatcallid=0;
	var getsystemchatstatuscallid=0;
	var systemchatonline=0;
    var firstCallToLP=0;
    var hidecounter=0;
    var callToSystemchat=0; 
    var systemchatcounter=0;
	this.iscreataccount=0;
	
	connectiondata["language"]=_lang;
	connectiondata["refername"]=_refername;
	connectiondata["livesystem"]=_livesystem;
	
	function initconnection(lsessionid)
	{
		if(verifvalue(lsessionid))
		{
			connectiondata["sessionid"]=lsessionid;
			guest["sessionid"]=lsessionid;
		}
		else
			connectiondata["sessionid"]=guest["sessionid"];
		
		connectiondata["mail"]="";
		connectiondata["balance"]=0;
		connectiondata["username"]=guest["username"];
		connectiondata["currency"]="EUR";
		connectiondata["symbol"]="€";
		connectiondata["providerid"]="";
		connectiondata["providertype"]=guest["providertype"];
		connectiondata["isoperator"]=0;
		
		connectiondata["userid"]="";
		connectiondata["realplayer"]=0;
		connectiondata["accountstatus"]="";
		connectiondata["averagedeposit"]="";
		connectiondata["lastdeposit"]="";
		connectiondata["lastdeposittime"]="";
		
		connectiondata["lastsettledtime"]="";
		connectiondata["numberlogins"]=0;
		connectiondata["creationtime"]="";
		connectiondata["birthdate"]="";
		
		
		connectiondata["isretention"]=0;
		connectiondata["viplevel"]=0;
	}
	
	initconnection();

	function verifnewlogin(response, opts){
			
		if (responsetojson(response, opts)) {
			var json = Ext.util.JSON.decode(response.responseText);
			
			connectiondata["sessionid"] = json.result.sessionid;
			connectiondata["firstlastname"] = json.result.firstlastname;
			connectiondata["mail"] = json.result.mail;
			connectiondata["currency"] = json.result.currency;
			connectiondata["username"] = connectiondata["login"];
			connectiondata["currencysymbol"] = json.result.currencysymbol;
			connectiondata["balance"] = json.result.availabletobet;
			connectiondata["providertype"] = json.result.providertype;
			
			
			connectiondata["userid"]=json.result.userid;
			connectiondata["realplayer"]=json.result.realplayer;
			connectiondata["accountstatus"]=json.result.accountstatus;
			connectiondata["averagedeposit"]=json.result.averagedeposit;
			connectiondata["lastdeposit"]=json.result.lastdeposit;
			connectiondata["lastdeposittime"]=json.result.lastdeposittime;
			
			connectiondata["phonenumber"]=json.result.phonenumber;
                        connectiondata["affiliate"]=json.result.affiliatesfirstname +" "+json.result.affiliateslastname;
                        connectiondata["hasactivebonus"]=json.result.hasactivebonus;
                        connectiondata["isretention"]=json.result.isretention;
                        connectiondata["viplevel"]=json.result.viplevel;
                        connectiondata["totaldeposits"]=json.result.totaldeposits;
                        connectiondata["totalwithdrawals"]=json.result.totalwithdrawals;

                        connectiondata["lastsettledtime"]=json.result.lastsettledtime;
                        connectiondata["numberlogins"]=json.result.numberlogins;
                        connectiondata["creationtime"]=json.result.creationtime;
                        connectiondata["birthdate"]=json.result.birthdate;
		   							
			//consoledir(json.result);
			consoleinfo(connectiondata["viplevel"]);
			if(connectiondata["viplevel"]==2 || connectiondata["viplevel"]==2.5)
			{
				
				try{document.getElementById('voicebetbox').style.display="";}catch(e){}
				try{document.getElementById('voicebetboxf').style.display="";}catch(e){}
				try{document.getElementById('voicebetbox1').style.display="";}catch(e){}
				try{pageTracker._trackEvent('Navigation', 'Voicebet');}catch(e){}
				
			}
					
			consoledir(connectiondata);
			createadminconsole();
			
		}
		else
		{
			document.LoginForm.login.value="";
			document.LoginForm.password.value="";
		}
	}

        function responsetojson2(response,opts,returnjson)
        {
        	try
            {
                var json=Ext.util.JSON.decode(response.responseText);
            }
            catch(e)
            {
                //consoledir(response.responseText);
                var json=response.responseText;
            }
            try
            {
                //consoleinfo("responsetojson:"+json.header.errorcode);
                if(json.header.errorcode==108 || json.header.errorcode=="108")
                {
                    sessionexpired();
                    return 0;
                }
                else if(json.header.errorcode % 100)
                {
                    /*alert(json.header.errordescription+"\n"+otransJS.translate("youneedhelppleaseemailusat"));*/
                    return 0;
                }
                var sessionid=json.result.sessionid;
                if (!guest["sessionid"]&&sessionid)
                {
                    guest["sessionid"]=sessionid;
                    connectiondata["sessionid"]=sessionid;
                }
                if (returnjson)
                    return json;
                else
                    return 1;
            }
            catch(e)
            {
                return 2;
                //debug("error on php");
                //consoledir(response);
            }
        }

    function failuresession()
    {
        debug("bigproblem");
    }
    function failuresystemchatcall()
    {}
    function createcomsession(response,opts)
    {
        try{Example.unmask("loginloading");}catch(e){}
        if(responsetojson2(response,opts))
        {
            veriflogin(response,opts);
            if(Get_Cookie("WELCOMEPOPUP")==null)
        		 {
           			 setpopupcookie('WELCOMEPOPUP');
   				 }	 
        }
        else
        {
        	guest["sessionid"]=null;
            connectiondata["sessionid"]=null;
            guest["refername"]="TURFEZ";
            var lomyajax=new myajax();
            lomyajax.initrequest();
            lomyajax.setrequestheader("SESSION","GETSESSION");
            saveurlparameters();
            lomyajax.setparams("a_aid",a_aid);
            lomyajax.setparams("a_bid",a_bid);
            consoleinfo("final:"+a_aid+"-"+a_bid);
            lomyajax.client(this,verifloginmigration,failuresession);
        }
    }

    function verifloginmigration(response,opts)
	{
		try{Example.unmask("loginloading");}catch(e){}
        if(responsetojson2(response,opts,1))
        {
            var omd5=new md5();
            try{Example.mask("loginloading");}catch(e){}
            lomyajax.initrequest();
            lomyajax.setrequestheader("CONNECTION","LOGIN");
            lomyajax.setparams("username",connectiondata["login"]);
            lomyajax.setparams("password",connectiondata["md5pass"]);
            lomyajax.clientsecure(this,verifloginmigration2);
        }
        else
        {
            debug("verifloginmigration failed");
        }
    }

        function verifloginmigration2(response,opts)
        {
            try{Example.unmask("loginloading");}catch(e){}
            response2=responsetojson2(response,opts,1);
            if(response2)
            {
                lomyajax.initrequest();
                lomyajax.setrequestheader("ACCOUNTSECURE","GETMYDETAILS");
                lomyajax.clientsecure(this,verifloginmigration3,null,(response2.result && response2.result.availabletowithdraw ? response2.result.availabletowithdraw : undefined));
            }
            else
            {
                 //consoleinfo("wrong password");
                document.LoginForm.login.value="";
                document.LoginForm.password.value="";
                initconnection();
                try{document.getElementById('logpart').style.display='';}catch(e){}
                try{document.getElementById('logpart1').style.display='';}catch(e){}
                try{document.getElementById('joinpart').style.display='';}catch(e){}
                try{document.getElementById('idlang').style.display='';}catch(e){}
                try{document.getElementById('idlang2').style.display='';}catch(e){}
                try{document.getElementById('details').style.display="";}catch(e){}
                try
                {
                        window.onbeforeunload = null;

                }catch(e){}
                try{homeeast3delogged();}catch(e){}
	     }
         }

        function verifloginmigration3(response,opts)
        {
            try{Example.unmask("loginloading");}catch(e){}
            if(responsetojson2(response,opts))
            {
                //fill hidden form and send to : signup.php
                var json=Ext.util.JSON.decode(response.responseText);
                if (opts.extraParams)
                    json.result.user.availabletowithdraw=opts.extraParams;
                filljoinform(json.result.user,Ext.get("welcomepopuppassword").getValue(),Ext.getCmp('cmpwelcomebirthdate').getValue());
            }
        }

        function filljoinform(user,password,birthdate)
        {
			var params="";
			if(a_aid!="" && a_aid!=null)
				params="&a_aid="+a_aid;
			if(a_bid!="" && a_bid!=null)
				params+="&a_bid="+a_bid;
			if(trackingcode!="" && trackingcode!=null)
				params+="&trackingcode="+trackingcode;
			if(a_uid!="" && a_uid!=null)
				params+="&a_uid="+a_uid;
            var f=Ext.get(Ext.select('body').elements[0]).createChild({   tag:'form',
                                                    action:        securebaseURL+URIbase+"signup.php?from=fromhomepage"+params,
                                                    method:     'post'});
            function addfield(fname,val)
            {
                if (val)
                    f.createChild({ tag:'input',type:"hidden",
                                    name:fname,value:val});
            }
            addfield('firstname',user.firstname);
            addfield('lastname',user.lastname);
            addfield('adress',user.adress1);
            addfield('city',user.city);
            addfield('zip',user.zip);
            addfield('tel',user.telphone);
            addfield('email',user.email);
            addfield('username',user.username);
            addfield('password',password);
            addfield('birthcountry',user.birthcountry);
            addfield('birthcity',user.birthcity);
            addfield('availabletowithdraw',user.availabletowithdraw);
            if (user.birthstate||birthdate)
                addfield('birthstate',(  	user.birthstate ?
											Date.parseDate(user.birthstate,'Y-m-d\\TH:i:s.000\\z') :
											birthdate).format('Y-m-d'));
            addfield('birthdate',user.birthdate);
            f.dom.submit();
        }

	function veriflogin(response,opts)
	{	
		try{Example.unmask("loginloading");}catch(e){}
				
		if(responsetojson(response,opts))
		{
			var json=Ext.util.JSON.decode(response.responseText);
			var lomyajax=new myajax();
			
			try{document.getElementById('details').style.display='';}catch(e){}
			connectiondata["sessionid"]=json.result.sessionid;
			connectiondata["firstlastname"]=json.result.firstlastname;
			connectiondata["mail"]=json.result.mail;
			connectiondata["currency"]=json.result.currency;
			connectiondata["currencysymbol"]=json.result.currencysymbol;
			connectiondata["balance"]=json.result.availabletobet;
			connectiondata["providertype"]=json.result.providertype;
			
			connectiondata["userid"]=json.result.userid;
			connectiondata["realplayer"]=json.result.realplayer;
			connectiondata["accountstatus"]=json.result.accountstatus;
			connectiondata["averagedeposit"]=json.result.averagedeposit;
			connectiondata["lastdeposit"]=json.result.lastdeposit;
			connectiondata["lastdeposittime"]=json.result.lastdeposittime;
			
			
			connectiondata["phonenumber"]=json.result.phonenumber;
		    connectiondata["affiliate"]=json.result.affiliatesfirstname +" "+json.result.affiliateslastname;
		    connectiondata["hasactivebonus"]=json.result.hasactivebonus;
		    connectiondata["isretention"]=json.result.isretention;
		    connectiondata["viplevel"]=json.result.viplevel;
		    
		    connectiondata["totaldeposits"]=json.result.totaldeposits;
		    connectiondata["totalwithdrawals"]=json.result.totalwithdrawals;
		    
		    connectiondata["lastsettledtime"]=json.result.lastsettledtime;
		    connectiondata["numberlogins"]=json.result.numberlogins;
		    connectiondata["creationtime"]=json.result.creationtime;
		    connectiondata["birthdate"]=json.result.birthdate;
		    connectiondata["chatname"]=json.result.chatname;
		    connectiondata["chatallowed"]=json.result.chatallowed;

            connectiondata["country"]=json.result.country;
            connectiondata["creationcountry"]=json.result.creationcountry;
            connectiondata["legigamestartingtime"]=json.result.legigamestartingtime;
		    connectiondata["regulationclosuretime"]=json.result.regulationclosuretime;
		    
		    
		    
		    
			
		    try{send2mythings("9907");}catch(e){}
			//consoledir(connectiondata);
			
			refreshsessionid=setInterval("conn.refreshsession()",120000);
			setCookie("userid",json.result.userid,30);
			setCookie("rp",json.result.realplayer,30);
			setCookie("acs",json.result.accountstatus,30);
			setCookie("vl",json.result.viplevel,30);
                        setCookie("ret",json.result.isretention,30);
                        setCookie("fln",json.result.firstlastname,30);

                        

		
		
			
			try{afterconnect();}catch(e){}
			
			if (this.iscreataccount==1)
			{
				ocreateaccount.gotodeposit();
			}
			else if(this.iscreataccount==2)
			{
				ocreateaccount.gotomoneybooker();
			}
			else if(this.iscreataccount==3)
			{
				ostep2.gotodeposit();
			}
			else if(this.iscreataccount==4)
			{
				ostep2.gotomoneybooker();
			}
			else if(this.iscreataccount==5)
			{
				eval(document.getElementById("myscriptcenterCREATEACCOUNTCL").innerHTML);
				//document.getElementById("depositlater1").style.display="";
				//document.getElementById("depositlater2").style.display="";
				try{document.getElementById('cashier').style.display='';}catch(e){}
                try{this.accountcreatedcallback();
                    this.accountcreatedcallback=undefined;}catch(e){}
			}
			else
			{
				try
				{
					Example.closeonglet("ACTIVATIONCONFIRMATION");
				}
				catch(e){}
			}
			
			try{Example.closeonglet("GETBETTINGGUIDES");}catch(e){}
			try{Example.closeonglet("GETDEPOSIT");}catch(e){}
			try{Example.closeonglet("GETEVENTSTIPS");}catch(e){}
			try{Example.closeonglet("GETEVENTSRESULTS");}catch(e){}
			
			try
			{
				if(json.result.trackercodes!=null || json.result.trackercodes!="")
				{
					var trackercodes=json.result.trackercodes;
					var images="";
					for(var i=0;i<trackercodes.length;i++)
					{
						images+=trackercodes[i]+"<br>";
						try{showtrackingcode(json.result.trackercode);}catch(e){}
					}
				
					try{document.getElementById('debug1').innerHTML=images;}catch(e){}
				}
			}
			catch(e)
			{
				
			}
			
			try
			{
				
				if(json.result.newspaperslinks!=null || json.result.newspaperslinks!="")
				{
					var newspaperslinks=json.result.newspaperslinks;
					
					for(var i=0;i<newspaperslinks.length;i++)
					{
						document.getElementById("newspaperbox1").style.display="";
						document.getElementById("newspaperlink").setAttribute('href',newspaperslinks[0]);
					}
				}
			}
			catch(e)
			{
				console.info("probleme newspaper");
			}
			
		}
		else
		{
			//consoleinfo("wrong password");
			document.LoginForm.login.value="";
			document.LoginForm.password.value="";
			initconnection();
			try{document.getElementById('logpart').style.display='';}catch(e){}
			try{document.getElementById('logpart1').style.display='';}catch(e){}
			try{document.getElementById('joinpart').style.display='';}catch(e){}
			try{document.getElementById('idlang').style.display='';}catch(e){}
			try{document.getElementById('idlang2').style.display='';}catch(e){}
			try{document.getElementById('details').style.display="";}catch(e){}
			try
			{
				window.onbeforeunload = null;

			}catch(e){}
			try{homeeast3delogged();}catch(e){}
		}
	}
		
	function afterconnect()
	{
		try{omarket.loadmybetstemplate();}catch(e){}
		try{document.getElementById('usernamedesc').innerHTML=connectiondata["firstlastname"];}catch(e){}
		try{conn.countdownregulationcode();}catch(e){}
		try{document.getElementById('linktoturfezspace').href="javascript:viewCashier()";}catch(e){}
		try{document.getElementById('usernamelog').style.display="";}catch(e){}
		try{document.getElementById('logpart').style.display="none";}catch(e){}
		try{document.getElementById('logpart1').style.display="none";}catch(e){}
		try{document.getElementById('details').style.display="";}catch(e){}
		try{document.getElementById('joinpart').style.display="none";}catch(e){}
		try{document.getElementById('idlang').style.display="none";}catch(e){}
		try{document.getElementById('idlang2').style.display="none";}catch(e){}
		try{document.getElementById('row2').style.display="";}catch(e){}
		try{document.getElementById('menu').style.display="";}catch(e){}
		try{Example.setonglet("GETVOICEBET","");getvoicebet();}catch(e){}
		try{homeeast3logged();}catch(e){}
		
		//try{document.getElementById('dragableBoxesColumn4').innerHTML+=document.getElementById('dragableBoxesColumn5').innerHTML}catch(e){}
		
		
		if(lomyajax.isadmin())
		{
			try{clearInterval(processIDgipt);}catch(e){}
			processIDgipt=0;
			try{clearInterval(processIDgipt1);}catch(e){}
			processIDgipt1=0;
			try{clearInterval(processIDgipt2);}catch(e){}
			processIDgipt2=0;
			try{getcenterallsports();}catch(e){}
			try{admingetmarkettemplate();}catch(e){debug("admingetmarkettemplate");}
					
			if(connectiondata["providertype"]=="DV")
				try{document.getElementById('debugger').style.display='';}catch(e){}

			try
			{
				if(document.getElementById('viewfunds2').innerHTML=="["+otransJS.translate("hide")+"]")
				{
					showaccountfunds(0);
					document.LoginForm.viewfunds.checked=false;
					document.getElementById('viewfunds2').innerHTML="["+otransJS.translate("show")+"]";
				}
			}
			catch(e)
			{
				try{document.getElementById('row1').innerHTML="";}catch(e){}
			}
			try{document.LoginForm.viewfunds.style.display="none";}catch(e){}
			try{document.getElementById('refreshfundsbutton').style.display="none";}catch(e){}
			try{document.getElementById('sepa').style.display="none";}catch(e){}
			try{document.getElementById('sepa1').style.display="none";}catch(e){}
			try{document.getElementById('sepa2').style.display="none";}catch(e){}				
			try{document.getElementById('myconsole').style.display='';}catch(e){}
			try{document.getElementById('eticket').style.display="none";}catch(e){}
			try{document.getElementById('contentlivetv').innerHTML="";}catch(e){}
			try{document.getElementById('centrefoot').style.display="none";}catch(e){}
			try{document.getElementById('mainfooter').style.display="none";}catch(e){}
			try{document.getElementById('searchmarket').style.display="none";}catch(e){}
			try{document.getElementById('myabout').style.display="none";}catch(e){}
			try{document.getElementById('helppart').style.display="none";}catch(e){}
			/*try{Example.asadmin();}catch(e){}*/
			//consoleinfo("toto")	;
			try{document.getElementById('mainwestmenu').style.display='none';}catch(e){debug("mainwestmenu");}
/*			try{document.getElementById('_lpChatBtn').style.display='none';}catch(e){debug("_lpChatBtn");}*/
			try{document.getElementById('westpub').style.display='none';}catch(e){debug("westpub");}
			try{document.getElementById('westreasons').style.display='none';}catch(e){debug("westpub");}
			try{document.getElementById('centrefoot').style.display='none';}catch(e){debug("centrefoot");}
			try{document.getElementById('dragableBoxesColumn6').style.display='';}catch(e){debug("dragableBoxesColumn6");}
                        try{document.getElementById('dragableBoxesColumn7').style.display='';}catch(e){debug("dragableBoxesColumn7");}
			try
			{
				document.getElementById('gtdswest').style.display='';
				document.getElementById('gtdswest').innerHTML='<center><br><input type="button" class="button" onclick="oadminmarket.gtd()" value="getodds" /><br></center>';
			}
			catch(e){debug("gtdswest");}
			
		}
		else
		{
                        try
			{
                            if (state==LPREPSTATEONLINE)
                            {
                                 if(getCookie("cty")=="1" || getCookie("cty")==1)
                                    document.getElementById('onlinehelp123').style.display="";
                                 else if(getCookie("vl")>=-0.5)
                                    document.getElementById('dailybonus').style.display="";
                            }
                        }
			catch(e){}

                        try
			{
				document.getElementById('row1').innerHTML="<b>"+otransJS.translate("availablefunds")+"</b> <a id='viewfunds2' href='javascript:conn.showaccountfunds2()' class='top_menu'>["+otransJS.translate("hide")+"]</a><b> <span id='fundsbalance'>"+fm(connectiondata["balance"])+"</span></b>";
				document.getElementById('Bdeposit').style.display="none";
			}
			catch(e){}
			
                        try
			{
                            if(document.LoginForm.viewfunds.checked==false)
                            {
                                    showaccountfunds(1);
                                    document.LoginForm.viewfunds.checked=true;
                            }
                            document.LoginForm.viewfunds.style.display="";
			}
			catch(e){}

                        try{document.getElementById('Bdeposit').style.display="";}catch(e){}
			try{document.getElementById('sepa1').style.display="";}catch(e){}
			try{document.getElementById('refreshfundsbutton').style.display="";}catch(e){}
			try{document.getElementById('sepa').style.display="";}catch(e){}
			try{document.getElementById('sepa2').style.display="";}catch(e){}	
			try{document.getElementById('myaccount').style.display='';}catch(e){}
			try{document.getElementById('cashier').style.display='';}catch(e){}
			/*try{document.getElementById('refer_invite').style.display='';}catch(e){}
			try{document.getElementById('invitefriend').style.display='';}catch(e){}*/
			
			try{document.getElementById('registeranddeposit').style.display='none';}catch(e){}
			
                        if(connectiondata["country"]=="FRA" || connectiondata["creationcountry"]=="FRA" || connectiondata["creationcountry"]=="FR" ||
                           connectiondata["country"]=="GUF" || connectiondata["creationcountry"]=="GUF" || connectiondata["creationcountry"]=="GF" ||
                           connectiondata["country"]=="ATF" || connectiondata["creationcountry"]=="ATF" || connectiondata["creationcountry"]=="ATF" ||
                           connectiondata["country"]=="SPM" || connectiondata["creationcountry"]=="SPM" || connectiondata["creationcountry"]=="PM" ||
                           connectiondata["country"]=="REU" || connectiondata["creationcountry"]=="REU" || connectiondata["creationcountry"]=="RE" ||
                           connectiondata["country"]=="GLP" || connectiondata["creationcountry"]=="GLP" || connectiondata["creationcountry"]=="GP" ||
                           connectiondata["country"]=="MTQ" || connectiondata["creationcountry"]=="MTQ" || connectiondata["creationcountry"]=="MQ" ||
                           connectiondata["country"]=="MYT" || connectiondata["creationcountry"]=="MYT" || connectiondata["creationcountry"]=="YT" ||
                           connectiondata["country"]=="NCL" || connectiondata["creationcountry"]=="NCL" || connectiondata["creationcountry"]=="NC" ||
                           connectiondata["country"]=="BLM" || connectiondata["creationcountry"]=="BLM" || connectiondata["creationcountry"]=="BL" ||
                           connectiondata["country"]=="PYF" || connectiondata["creationcountry"]=="PYF" || connectiondata["creationcountry"]=="PF" ||
                           connectiondata["country"]=="MAF" || connectiondata["creationcountry"]=="MAF" || connectiondata["creationcountry"]=="MF" ||
                           connectiondata["country"]=="WLF" || connectiondata["creationcountry"]=="WLF" || connectiondata["creationcountry"]=="WF" )
                        {
                            setCookie("cty",1,30);
                            try{omarket.$("mainbanner").style.display='';}catch(e){}
                            try{document.getElementById('mainbannerimage').style.display="none";}catch(e){}
                            try{document.getElementById('mainbannerimageflash').style.display="";}catch(e){}
                            try{document.getElementById('mainbannerimageflash1').style.display="none";}catch(e){}
                            try{document.getElementById('mainbannerimageflash2').style.display="none";}catch(e){}
                            try{document.getElementById('mainbannerimageflash3').style.display="none";}catch(e){}
                            try{document.getElementById('mainbannerimageflash4').style.display="none";}catch(e){}
                        }
                        else
                        {
                            if(connectiondata["realplayer"]==0)
                            {
                                if(    guest["countryiso3"]=="CIV" || guest["countryiso3"]=="ISR" || guest["countryiso3"]=="AGO" || guest["countryiso3"]=="BFA" || guest["countryiso3"]=="BDI"
                                || guest["countryiso3"]=="BEN" || guest["countryiso3"]=="BWA" || guest["countryiso3"]=="COD" || guest["countryiso3"]=="CAF" || guest["countryiso3"]=="COG"
                                || guest["countryiso3"]=="CMR" || guest["countryiso3"]=="CPV" || guest["countryiso3"]=="DJI" || guest["countryiso3"]=="DZA" || guest["countryiso3"]=="EGY"
                                || guest["countryiso3"]=="ESH" || guest["countryiso3"]=="GNQ" || guest["countryiso3"]=="GNB" || guest["countryiso3"]=="KEN" || guest["countryiso3"]=="COM"
                                || guest["countryiso3"]=="ERI" || guest["countryiso3"]=="ETH" || guest["countryiso3"]=="GAB" || guest["countryiso3"]=="GHA" || guest["countryiso3"]=="GMB"
                                || guest["countryiso3"]=="LBR" || guest["countryiso3"]=="LSO" || guest["countryiso3"]=="LBY" || guest["countryiso3"]=="MAR" || guest["countryiso3"]=="MDG"
                                || guest["countryiso3"]=="MLI" || guest["countryiso3"]=="MRT" || guest["countryiso3"]=="MUS" || guest["countryiso3"]=="MWI" || guest["countryiso3"]=="MOZ"
                                || guest["countryiso3"]=="NAM" || guest["countryiso3"]=="NER" || guest["countryiso3"]=="NGA" || guest["countryiso3"]=="REU" || guest["countryiso3"]=="RWA"
                                || guest["countryiso3"]=="SYC" || guest["countryiso3"]=="SDN" || guest["countryiso3"]=="SHN" || guest["countryiso3"]=="SLE" || guest["countryiso3"]=="SEN"
                                || guest["countryiso3"]=="SOM" || guest["countryiso3"]=="STP" || guest["countryiso3"]=="SWZ" || guest["countryiso3"]=="TCD" || guest["countryiso3"]=="TGO"
                                || guest["countryiso3"]=="TUN" || guest["countryiso3"]=="TZA" || guest["countryiso3"]=="UGA" || guest["countryiso3"]=="MYT" || guest["countryiso3"]=="ZAF"
                                || guest["countryiso3"]=="ZMB" || guest["countryiso3"]=="ZWE" )
                                {
                                    try{document.getElementById('mainbannerimage').style.display="none";}catch(e){}
                                    try{document.getElementById('mainbannerimageflash').style.display="none";}catch(e){}
                                    try{document.getElementById('mainbannerimageflash1').style.display="none";}catch(e){}
                                    try{document.getElementById('mainbannerimageflash2').style.display="none";}catch(e){}
                                    try{document.getElementById('mainbannerimageflash3').style.display="";}catch(e){}
                                    try{document.getElementById('mainbannerimageflash4').style.display="none";}catch(e){}
                                }
                                else
                                {
                                    try{document.getElementById('mainbannerimage').style.display="";}catch(e){}
                                    try{document.getElementById('mainbannerimageflash').style.display="none";}catch(e){}
                                    try{document.getElementById('mainbannerimageflash1').style.display="none";}catch(e){}
                                    try{document.getElementById('mainbannerimageflash2').style.display="none";}catch(e){}
                                    try{document.getElementById('mainbannerimageflash3').style.display="none";}catch(e){}
                                    try{document.getElementById('mainbannerimageflash4').style.display="none";}catch(e){}
                                }
                            }
                            //alert(connectiondata["realplayer"]+"-"+ connectiondata["country"]+"-"+ connectiondata["creationcountry"]);
                            setCookie("cty",0,30);
                            /*if(connectiondata["realplayer"]==1 || connectiondata["realplayer"]=="1")
                            {*/
                           
                            /*}*/
                            
                            if( connectiondata["viplevel"]>=0 &&  connectiondata["viplevel"]<=1)
                            {
                                    try{document.getElementById('mainbannerimage').style.display="none";}catch(e){}
                                    try{document.getElementById('mainbannerimageflash').style.display="none";}catch(e){}
                                    try{document.getElementById('mainbannerimageflash1').style.display="none";}catch(e){}
                                    try{document.getElementById('mainbannerimageflash2').style.display="";}catch(e){}
                                    try{document.getElementById('mainbannerimageflash3').style.display="none";}catch(e){}
                                    try{document.getElementById('mainbannerimageflash4').style.display="none";}catch(e){}
                            }
                           
                            if( connectiondata["viplevel"]>=2)
                            {
                                try{document.getElementById('mainbannerimage').style.display="none";}catch(e){}
                                try{document.getElementById('mainbannerimageflash').style.display="none";}catch(e){}
                                try{document.getElementById('mainbannerimageflash1').style.display="none";}catch(e){}
                                try{document.getElementById('mainbannerimageflash2').style.display="none";}catch(e){}
                                try{document.getElementById('mainbannerimageflash3').style.display="none";}catch(e){}
                                try{document.getElementById('mainbannerimageflash4').style.display="";}catch(e){}
                            }

                              
			}
			
/*			try{document.getElementById('_lpChatBtn').style.display='none';}catch(e){debug("_lpChatBtn");}*/
			try{document.getElementById('westpub').style.display='none';}catch(e){debug("westpub");}
			try{document.getElementById('westreasons').style.display='none';}catch(e){debug("westpub");}
			try{document.getElementById('centrefoot').style.display='none';}catch(e){debug("centrefoot");}
			if(msrv)
                            try{document.getElementById('dragableBoxesColumn6').style.display='';}catch(e){debug("dragableBoxesColumn6");}
                        else
                            try{document.getElementById('dragableBoxesColumn6').style.display='none';}catch(e){debug("dragableBoxesColumn6");}
                        
			if(msrv)
                            try{document.getElementById('dragableBoxesColumn7').style.display='';}catch(e){debug("dragableBoxesColumn7");}
                        else
                            try{document.getElementById('dragableBoxesColumn7').style.display='none';}catch(e){debug("dragableBoxesColumn7");}
			//try{document.getElementById('bettingguidesbox1').style.display='none';}catch(e){debug("bettingguidesbox1");}
			//debug("toto1");
			try{omarket.hidemenu41();}catch(e){debug("toto2");}
		}
		if(getparam("userid")!="" && getparam("userid")!=null && getparam("userid")!=0)
		{
			consoleinfo("getaccountfunds");
			setTimeout("conn.getaccountfunds()",3000);
		}
		try{reloadData("contentfeatured");}catch(e){}
		try{reloadData("contentmymarket");}catch(e){}
		try{reloadData("contentclosingsoon");}catch(e){}
		try{reloadData("contentplayingnow");}catch(e){}
		try{reloadData("contentmarketwinnings");}catch(e){}
                try{reloadData("contentallmymarkets");}catch(e){}
		try{ogeteventstree.geteventstree();}catch(e){}
		
		try
		{
			var activepanel=Example.getactivepanel();
	
			if(activepanel=="mainmarketcontainer")
			{
				try{omarket.getMyBets();}catch(e){}
				try{omarket.forceprice();}catch(e){}
				try{omarket.cleanBetsHelp();}catch(e){}
				try{omarket.resetplacebets();}catch(e){}
				try{this.unhideandshow(2);}catch(e){}
				this.unhideexposure();
			
			}
		}
		catch(e){}
	}
	
	function beforelogout()
	{
		document.LoginForm.login.value="";
		document.LoginForm.password.value="";
		document.LoginForm.viewfunds.checked=true;		
		try{document.getElementById('details').style.display="";}catch(e){}
		try{document.getElementById('logpart').style.display='';}catch(e){}
		try{document.getElementById('logpart1').style.display='';}catch(e){}
		try{document.getElementById('joinpart').style.display='';}catch(e){}
		try{document.getElementById('idlang').style.display='';}catch(e){}
		try{document.getElementById('idlang2').style.display='';}catch(e){}
		try{document.getElementById('row1').style.display='';}catch(e){}
		try{document.getElementById('refreshfundsbutton').style.display='';}catch(e){}
		try{document.getElementById('usernamefunds').innerHTML="";}catch(e){}
		try
		{
			window.onbeforeunload = null;

		}catch(e){}
				
		try{document.getElementById('usernamedesc').innerHTML="";}catch(e){}
		try{document.getElementById('usernamelog').style.display="none";}catch(e){}
		try{document.getElementById('myaccount').style.display="none";}catch(e){}
		try{document.getElementById('cashier').style.display='none';}catch(e){}
		/*try{document.getElementById('refer_invite').style.display='none';}catch(e){}
		try{document.getElementById('invitefriend').style.display="none";}catch(e){}*/
		try{document.getElementById('myconsole').style.display="none";}catch(e){}
		try{document.getElementById('eticket').style.display="";}catch(e){}
		try{document.getElementById('myreport').style.display="none";}catch(e){}
		try{document.getElementById('contentmymarket').innerHTML="";}catch(e){}
		try{document.getElementById('contentmarketwinnings').innerHTML="";}catch(e){}
		try{document.getElementById('debugger').style.display="none";}catch(e){}
		try{document.getElementById('centrefoot').style.display="";}catch(e){}
		try{document.getElementById('mainfooter').style.display="";}catch(e){}
		try{document.getElementById('myabout').style.display='';}catch(e){}
		try{document.getElementById('helppart').style.display='';}catch(e){}
		try{document.getElementById('searchmarket').style.display="";}catch(e){}
		
		
		try{this.showonlyplacebets();}catch(e){}
		try{this.hideexposure();}catch(e){}
		
	}
	
	function afterlogout(lsessionid)
	{
		/*try
		{*/
			try{Example.layout.getRegion('center').hidePanel("homecontainer");}catch(e){}
			initconnection(lsessionid);
			omarket.set("ishomepage",1);
			omarket.init();
			//getcenterallsports();
			ogeteventstree.geteventstree();
			/*consoleinfo("gohome()");
			gohome();*/
			/*try{omarket.cleanBets(1);}catch(e){}
			try{omarket.getMyBets();}catch(e){}*/
						
			reloadData("contentmymarket");
			reloadData("contentmarketwinnings");
			reloadData("contentclosingsoon");
			
			if(isexchange)
			{
				reloadData("contentfeatured");
				reloadData("contentplayingnow");
			}
						
			try{popupWins["my_account"].close();}catch(e){}
			try{popupWins["info"].close();}catch(e){}
			try{popupWins["my_console"].close();}catch(e){}
			/*try{popupWins["eticketwindow"].close();}catch(e){}*/
					
			try{Example.layout.getRegion('center').hidePanel("homecontainer");}catch(e){}
			try{Example.closeonglet("join");}catch(e){}
			try{Example.closeonglet("ACTIVATIONCONFIRMATION");}catch(e){}
			try{Example.closeonglet("GETBETTINGGUIDES");}catch(e){}
			try{Example.closeonglet("GETDEPOSIT");}catch(e){}
			try{Example.closeonglet("GETEVENTSTIPS");}catch(e){}
			try{Example.closeonglet("GETEVENTSRESULTS");}catch(e){}
			
			
			try{Example.asuser();}catch(e){}
			try{Example.closeongletadmin("addnewevent_pane");}catch(e){}
			try{Example.closeongletadmin("modifyevent_pane");}catch(e){}
			try{Example.closeongletadmin("addnewmarket_pane");}catch(e){}
			try{Example.closeongletadmin("addnewselection_pane");}catch(e){}
			try{Example.closeongletadmin("modifyselection_pane");}catch(e){}
			try{Example.closeongletadmin("modifynewmarket_pane");}catch(e){}
			
			showhomeeast3();
			
		/*}
		catch(e){}*/
	}

	function veriflogout(response,opts)
	{
		if(responsetojson(response,opts))
		{
			var json=Ext.util.JSON.decode(response.responseText);
			if(automaticlogout==1)
			{
                try{clearInterval(processIDgipt);}catch(e){}
                try{clearInterval(processIDgipt1);}catch(e){}
                try{clearInterval(processIDgipt2);}catch(e){}
                try{clearInterval(processIDgipt3);}catch(e){}
                try{conn.killrefreshsession();}catch(e){}
                try{conn.killsystemchatcall();}catch(e){}
                if(connectiondata["login"]!= undefined)
                {
                     document.getElementById("disconnectpopuppassword").value="";
                     document.getElementById("disconnectpopuplogin").value="";
                     document.getElementById("disconnectpopuptitle").innerHTML=connectiondata["login"];
                     showdisconnectpopup();
                }
				automaticlogout=0;
			}
			else
			{
				alert(json.header.errordescription+"\n"+otransJS.translate("youneedhelppleaseemailusat"));
			}
			afterlogout(json.result.sessionid);
			conn.systemchatsignup(getCookie("userid"));			
		}
	}
		
	function veriffastlogout(response,opts)
	{
		initconnection();
		if(responsetojson(response,opts))
		{
			var json=Ext.util.JSON.decode(response.responseText);
			/*alert(json.header.errordescription+"\n"+otransJS.translate("youneedhelppleaseemailusat"));*/
		}
	}
		
	function verifrefreshsession(response,opts)
	{
		/*alert(response.responseText);*/
		if(responsetojson(response,opts))
		{
			consoleinfo("refeshing...");
		}
	} 
	function verifsystemchatsignup(response,opts)
	{
		if(responsetojson(response,opts))
		{
			var json=Ext.util.JSON.decode(response.responseText);
			/*this.systemchatstatusid=json.result.systemchatstatusid;*/
			if(json.result.systemchatstatusid!='0')
			{
				callToSystemchat=1;
				conn.systemchatstatusid=json.result.systemchatstatusid;
				systemchatcallid=setInterval("conn.systemchatcall(conn.systemchatstatusid)",15000);
				conn.getsystemchatstatus();
				getsystemchatstatuscallid=setInterval("conn.getsystemchatstatus()",30000);
			}
		}
	}
	function verifgetsystemchatstatus(response,opts)
	{
		var json=Ext.util.JSON.decode(response.responseText);
		var systemchatagentscount=json.result.systemchatagentscount;
		if(systemchatagentscount && systemchatagentscount>0)
		{
			conn.systemchatonline=1;
			document.getElementById('dailybonus').style.display="";
			document.getElementById('onlinehelp123').style.display="";
			/*document.getElementById("livechatVerification1").style.display=""; 
			document.getElementById("livechatVerification2").style.display="none";*/
					
		}
		else
		{
			document.getElementById('dailybonus').style.display="none";
			document.getElementById('onlinehelp123').style.display="none";
			conn.systemchatonline=0;
			document.getElementById("livechatVerification1").style.display="none"; 
			document.getElementById("livechatVerification2").style.display="";
			
		}
	}
	function verifsystemchatcall(response,opts)
	{
		
		if(responsetojson(response,opts))
		{
			var json=Ext.util.JSON.decode(response.responseText);
			var systemchatstatusid=opts.extraParams;
			if(!json.result)
			{
				killsystemchatcall();
			}
			if(json.result.systemchatstatus=='A')
			{
				callToSystemchat=0;
				var el=Ext.getDom("marketingsystemchatpopupid");
				if(el)
					document.body.removeChild(el);
				var f=Ext.get(Ext.select('body').elements[0]).createChild({   tag:'form',
														id: 'marketingsystemchatpopupid',
														target:'marketingsystemchatpopup',
														name: 'marketingsystemchatpopupform',
	                                                    action:"../API5/client/json.php",
	                                                    method:'post',
														onSubmit:"return false;", 
														onClick:"return false;",
														onKeyPress:"return false;"});
	      
				var omyajax=new myajax(); 
				omyajax.setrequestheader("SYSTEMCHAT","GETSYSTEMCHAT","templates",1);
				omyajax.setparams("defaultpathconnection","CLIENT");
				omyajax.setparams("defaulttemplatenumber",1);
				omyajax.setparams("systemchatstatusid",systemchatstatusid);
			    var msgtemp = omyajax.getmsg();
			    var windims=getDimensions();
									
					f.createChild({ id:"marketingsystemchatforminput",tag:'input',type:"hidden",name:'msg',value:''});
					document.getElementById("marketingsystemchatforminput").value=msgtemp;
					
				if(!document.getElementById("marketingsystemchatcontainerdiv"))
				{								
					var systemchatcontainerdom = document.createElement("div");
					systemchatcontainerdom.setAttribute("id", "marketingsystemchatcontainerdiv");
					document.body.appendChild(systemchatcontainerdom);
					
					var systemchatpaneldom = document.createElement("div");
					systemchatpaneldom.setAttribute("id","marketingsystemchatpanel");
					document.body.appendChild(systemchatpaneldom);
					marketingsystemchatcontainer = new Ext.LayoutDialog("marketingsystemchatcontainerdiv", {
						id   : 'marketingsystemchat',
						name : 'marketingsystemchatdlg',
						modal: false,
				       /* width:505,
				        height:530,*/
				        width:305,
				        height:330,
				        shadow:false,
				        minWidth:200,
				        minHeight:350,
				        collapsible:true,
				        autoTabs:true,
				        proxyDrag:true,
				        x:windims.width,
				        y:windims.height,
				        center:{
				            tabPosition: "top",
				            alwaysShowTabs: false
				        }
					});
					conn.systemchatstatusid=systemchatstatusid;
					marketingsystemchatcontainer.setTitle("Turfez Chat");
					createElementEx('marketingsystemchatpopup','iframe',marketingsystemchatcontainer.body,{defwidth:'100%',defheight:'100%'},true,undefined,{scrolling:"no",frameborder:"0"});
					marketingsystemchatcontainer.addKeyListener(27,marketingsystemchatcontainer.hide,this);
					/*marketingsystemchatcontainer.on("show",function (){marketingsystemchatcontainer.close.removeListener("click",marketingsystemchatcontainer.closeClick,this);},this);
					marketingsystemchatcontainer.close.on("click",function(){
																			 if(hidecounter==0)
																			 {
																			 	marketingsystemchatcontainer.collapse();
																			 	marketingsystemchatcontainer.moveTo(250,10);
																			 	marketingsystemchatcontainer.close.addListener("click",function(){marketingsystemchatcontainer.hide();},this);
																			 	hidecounter++;
																			 }},this);*/
					marketingsystemchatcontainer.on("beforehide",function systemchatlogout(){
							lomyajax.initrequest();
							lomyajax.setrequestheader("SYSTEMCHAT","SETSYSTEMCHATSTATUS");
							lomyajax.setparams("systemchatstatus",'C');
							lomyajax.setparams("systemchatstatusid",conn.systemchatstatusid);
							lomyajax.client(this,null);
							callToSystemchat++;
							/*hidecounter=0;*/
							systemchatcallid=setInterval("conn.systemchatcall(conn.systemchatstatusid)",15000);
							var div=document.getElementById("marketingsystemchatcontainerdiv");
							div.parentNode.removeChild(div);
							document.body.removeChild(document.getElementById('marketingsystemchatpopupid'));
					},this);
				}
				else
				{
					var div=document.getElementById("marketingsystemchatcontainerdiv");
					div.parentNode.removeChild(div);
				}
				moveflag=1;		
				document.getElementById('marketingsystemchatpopupid').submit();	
/*				marketingsystemchatcontainer.show();	*/
				document.getElementById("marketingsystemchatcontainerdiv").style.display='none';
				document.getElementById("systemchatinvitediv").style.display='';
				document.getElementById("systemchatinvitedivimg").innerHTML=json.result.invitebonusmessage;
				document.getElementById("systemchatinvitediv").style.top=windims.height;
				document.getElementById("systemchatinvitediv").style.left=parseInt(windims.width)-320;
				the_timeout=setTimeout('conn.moveDivUp("systemchatinvitediv");',100);				
			}
		}
	}
		
	function killrefreshsession()
	{
		try
		{
			clearInterval(refreshsessionid);
			refreshsessionid=0;
		}
		catch(e){}
	}
	function killsystemchatcall()
	{
		try
		{
			clearInterval(systemchatcallid);
			clearInterval(getsystemchatstatuscallid);
			systemchatcallid=0;
			getsystemchatstatuscallid=0;
		}
		catch(e){}
	}	
		
	function verifgetaccountfunds(response,opts)
	{
		if(responsetojson(response,opts))
		{
			var myobj=opts.scope;
			var json=Ext.util.JSON.decode(response.responseText);
			var result=json.result;
			setCookie("blc",result.availabletobet,1);
			
			var newbalance=eval(result.availabletobet);
			myobj.setvariable("balance",newbalance);
			document.getElementById('fundsbalance').innerHTML=fm(newbalance);
			
		}
	}
	function showaccountfunds(valshow)
	{
		if(valshow)
		{
			document.getElementById('usernamelog').style.display="";
			document.getElementById('fundsbalance').style.display='';
			document.getElementById('refreshfundsbutton').style.display='';
			try{document.getElementById('sepa').style.display='';}catch(e){}
			document.getElementById('viewfunds2').innerHTML="["+otransJS.translate("hide")+"]";
		}
		else
		{
			document.getElementById('usernamelog').style.display="none";
			document.getElementById('fundsbalance').style.display="none";
			document.getElementById('refreshfundsbutton').style.display="none";
			try{document.getElementById('sepa').style.display="none";}catch(e){}
			document.getElementById('viewfunds2').innerHTML="["+otransJS.translate("show")+"]";
		}
	}
	this.systemchatsignup=function (userid)
	{
		try
		{
			if (connectiondata["providertype"]=="CL" || connectiondata["providertype"]=="GU")
			{
				lomyajax.initrequest();
				lomyajax.setrequestheader("SYSTEMCHAT","SYSTEMCHATSIGNUP");
				if(userid!='' && userid!=null && userid!="undefined")
					lomyajax.setparams("userid",userid);
				lomyajax.clientsecure(this,verifsystemchatsignup);
			}
		}
		catch(e){}
	}
	,
	this.moveDivLeft=function (myDiv)
	{
		try
		{
			var the_style = conn.getStyleObject(myDiv);
			if (the_style && moveflag)
			{
				var current_left = parseInt(the_style.left);
				var new_left = current_left - 2;
				if (document.layers)
				{
					the_style.left = new_left;
				}
				else
				{
					the_style.left = new_left + "px";
				}
				if (new_left > 0)
				{
					moverightflag=0;
					the_timeout = setTimeout("conn.moveDivLeft('"+myDiv+"');",1);
				}
				else
					the_timeout=setTimeout('conn.moveDivRight("systemchatinvitediv");',100);
			} 
		}
		catch(e){}
	}
	,
	this.moveDivUp=function (myDiv)
	{
		var the_style = conn.getStyleObject(myDiv);
		var windims=getDimensions();
		if (the_style && moveflag)
		{
			try
			{
				var current_top = parseInt(the_style.top);
				var new_top = current_top - 2;
				if (document.layers)
				{
					the_style.top = new_top;
				}
				else
				{
					the_style.top = new_top + "px";
				}
				if (new_top>=((parseInt(windims.height))/2+100))
				{
					/*moveleftflag=0;*/
					the_timeout = setTimeout("conn.moveDivUp('"+myDiv+"');",1);
				}
			/*	else
					the_timeout=setTimeout('conn.moveDivLeft("systemchatinvitediv");',100);*/
			}
			catch(e){}
		} 
	}
	,
	this.getStyleObject=function (objectId)
	{
		try
		{
			if(document.getElementById && document.getElementById(objectId))
			 {
				return document.getElementById(objectId).style;
			 } 
		    else if (document.all && document.all(objectId))
		     {
				return document.all(objectId).style;
			  } 
		    else if (document.layers && document.layers[objectId])
		     {
				return document.layers[objectId];
			 } 
			 else 
			 {
				return false;
			 }
		}
		catch(e){}
	}
	,
	this.getsystemchatwindow=function ()
	{
		try
		{
			var ifrm=document.getElementById('marketingsystemchatpopup');
			if(ifrm)
			{
				moveflag=0;
		    	document.getElementById("systemchatinvitediv").style.display='none';
				document.getElementById("marketingsystemchatcontainerdiv").style.display='';
				marketingsystemchatcontainer.show();
				document.getElementById("marketingsystemchatcontainerdiv").style.zIndex="50000000000";
				ifrm.contentWindow.document.osystemchatusermessage.dolayout();
			}
		}
		catch(e){}
	}
	,
	this.closesystemchatwindow=function ()
	{
		document.getElementById("systemchatinvitediv").style.display='none';
		moveflag=0;
		marketingsystemchatcontainer.hide();
	}
	,
	this.connisadmin=function ()
	{
		if(connectiondata["providertype"]=="AD" || 
		connectiondata["providertype"]=="DV" || 
		connectiondata["providertype"]=="SA" || 
		connectiondata["providertype"]=="SV" || 
		connectiondata["providertype"]=="OP" || 
		connectiondata["providertype"]=="MS" || 
		connectiondata["providertype"]=="MM" || 
		connectiondata["providertype"]=="MA" ||
		connectiondata["providertype"]=="CA")
			return 1;
		else
			return 0;	
	}	
	,
	this.isoperator=function ()
	{
		return connectiondata["isoperator"];
	}
	,		
	this.issessionid=function ()
	{
		return verifattributename(connectiondata["sessionid"]);
	}
	,
	this.getvariable=function (variablename)
	{
		return connectiondata[variablename];
	}
	,
	this.setvariable=function (variablename,value)
	{
		return connectiondata[variablename]=value;
	}
	,
	this.getuserinfo=function ()
	{
		return connectiondata;
	}
	,
	this.connectenter=function (e,word,affichmess,logasuer)
	{
		var key=e.keyCode? e.keyCode : e.charCode;
		
		if (key == 13) 
		{
			this.connect(logasuer);
		}
		else
			return only_letter_or_number(e,word,affichmess,'',otransJS.translate("notloginwithemail"));
	}
	,
	this.pressenter= function (func,e)
	{
		var key=e.keyCode? e.keyCode : e.charCode;
		if (key == 13) 
			eval(func);
	}
	,
	this.connect=function(logasuer,iscreataccount)
	{
		with(window.document.LoginForm)
		{
			if(andand(login.value!="",password.value!=""))
			{
				if (verif_mail(login.value))
				{
					alert(otransJS.translate("youmustntenteryouremailbutyourusername"));
					return -2
				}
				else if (!verif_number_or_letter(login.value))
				{
					alert(otransJS.translate("theloginmustbeletterornumber"));
					return -3;
				}
				
				try{document.getElementById('row1').innerHTML=otransJS.translate("connecting");}catch(e){}
				try{document.getElementById('row2').style.display="none";}catch(e){}
				try{document.getElementById('logpart').style.display="none";}catch(e){}
				try{document.getElementById('logpart1').style.display="none";}catch(e){}
				try{document.getElementById('joinpart').style.display="none";}catch(e){}
				try{document.getElementById('idlang').style.display="none";}catch(e){}
				try{document.getElementById('idlang2').style.display="none";}catch(e){}
				if (navigator.appName!="Microsoft Internet Explorer")
				{
					try
					{
						if(iscreataccount=="" || iscreataccount==null || iscreataccount==0)
						{
							/*var beforeunloadtext=login.value+", "+otransJS.translate("areyousureyouwanttoleavebrandcom");
							window.onbeforeunload = function(e)
							{
					        	return beforeunloadtext;
					   		}*/
						}
	
					}catch(e){}
				}
				try{homeeast3logged();}catch(e){}
				if(getparam("userid")!="" && getparam("userid")!=null && getparam("userid")!=0)
				{
					guest["userid"]=getparam("userid");
					this.loginasuser(login.value,password.value);
				}
				else
				{
					this.iscreataccount=iscreataccount;
					this.login(login.value,password.value);
				}
			}
			else
				alert(otransJS.translate("youmustprovidealoginandpassword"));
		}
	}
	,
	this.loginsecure=function (user,pass)
	{
		var omd5=new md5();
		try{Example.mask("loginloading");}catch(e){}
		lomyajax.initrequest();
		lomyajax.setrequestheader("CONNECTION","LOGIN");
		lomyajax.setparams("username",user);
		connectiondata["login"]=user;
		connectiondata["md5pass"]=omd5.hex_md5(pass);
		lomyajax.setparams("password",connectiondata["md5pass"]);
		lomyajax.clientsecure(this,veriflogin);
	}	
	,
	this.login=function (user,pass)
	{
		var omd5=new md5();
		try{Example.mask("loginloading");}catch(e){}
		lomyajax.initrequest();
		lomyajax.setrequestheader("CONNECTION","LOGIN");
		lomyajax.setparams("username",user);
		connectiondata["login"]=user;
		connectiondata["md5pass"]=omd5.hex_md5(pass);
		lomyajax.setparams("password",connectiondata["md5pass"]);
		lomyajax.clientsecure(this,veriflogin);
	}
	,
	this.newlogin=function (user,pass)
	{
		var omd5=new md5();
		lomyajax.initrequest();
		lomyajax.setrequestheader("CONNECTION","LOGIN");
		lomyajax.setparams("username",user);
		connectiondata["login"]=user;
		connectiondata["md5pass"]=omd5.hex_md5(pass);
		lomyajax.setparams("password",connectiondata["md5pass"]);
		lomyajax.clientsecure(this,verifnewlogin);
	}	
	,
	this.loginasuser=function (user,pass)
	{
		var omd5=new md5();
		Example.mask("loginloading");
		lomyajax.initrequest();
		lomyajax.setrequestheader("CONNECTION","LOGINASUSER");
		lomyajax.setparams("username",user);
		connectiondata["login"]=user;
		connectiondata["md5pass"]=omd5.hex_md5(pass);
		lomyajax.setparams("password",connectiondata["md5pass"]);
		lomyajax.setparams("userid",guest["userid"]);
		document.title=guest["userid"];
		lomyajax.clientsecure(this,veriflogin);
	}
    ,
	this.loginmigration=function (user,pass)
	{
		var omd5=new md5();
		try{Example.mask("loginloading");}catch(e){}
		lomyajax.initrequest();
		lomyajax.setrequestheader("CONNECTION","LOGIN");
		lomyajax.setparams("username",user);
		connectiondata["login"]=user;
		connectiondata["md5pass"]=omd5.hex_md5(pass);
		lomyajax.setparams("password",connectiondata["md5pass"]);
		lomyajax.clientsecure(this,createcomsession);
	}
	,
	this.logout=function ()
	{
		popupchangeminevent=0;
		if(document.getElementById('button_legigame'))
		{
			document.getElementById('button_legigame').style.display="none";
		}
		
		try
		{
			popupchangeminevent=oeventsmanagement.getischangingorder();
			txtconfirm=oeventsmanagement.gettextconfirm();
		}
		catch(e){}
		
		if(popupchangeminevent==0)
		{
			try
			{
				popupchangeminevent=ofeaturedevents.getischangingorder();
				txtconfirm=ofeaturedevents.gettextconfirm();
			}
			catch(e){}
		}
		
		if(popupchangeminevent==0)
		{
			try
			{
				popupchangeminevent=oadminmarket.getischangingorder();
				txtconfirm=oadminmarket.gettextconfirm();
			}
			catch(e){}
		}
		
		quitpage=true;
		if (popupchangeminevent==1)
		{
			quitpage=confirm(txtconfirm);
		}
		if (quitpage)
		{
			omarket.canceltimout();
			
			if(this.issessionid())
			{
				try
				{
					marketingsystemchatcontainer.hide();
					supportsystemchatcontainer.hide();
				}
				catch(e){}
				lomyajax.initrequest();
				lomyajax.setrequestheader("SESSION","LOGOUT");
				lomyajax.client(this,veriflogout);
			}
			else
			{
				afterlogout();
			}			
			beforelogout();
		}
	}
	,
	this.fastlogout=function ()
	{
		try{popupWins["my_account"].close();}catch(e){}
		try{popupWins["info"].close();}catch(e){}
		try{popupWins["my_console"].close();}catch(e){}
		/*try{popupWins["eticketwindow"].close();}catch(e){}*/
		if(this.issessionid())
		{
			if(getparam("mysessionid")!="" && getparam("mysessionid")!=null && getparam("mysessionid")!=0)
			{
				
			}
			else
			{
				lomyajax.initrequest();
				lomyajax.setrequestheader("SESSION","LOGOUT");
				lomyajax.client(this,veriffastlogout);
			}
		}
		if(document.getElementById('button_legigame'))
		{
			document.getElementById('button_legigame').style.display="none";
		}
	}
	,
    this.resetlastactiontime=function()
    {
        var mydate1=new Date();
        lastactiontime=new Date(mydate1.getUTCFullYear(),mydate1.getUTCMonth(),mydate1.getUTCDate(),mydate1.getUTCHours(),mydate1.getUTCMinutes(),mydate1.getUTCSeconds());
        lastactiontime = lastactiontime.getTime();
    }
    ,
	this.refreshsession=function ()
	{
		if(this.issessionid())
		{
			consoleinfo("refreshsession");
			if(connectiondata["providertype"]=="CL")
			{
				var mydate3=new Date();
				var x3=new Date(mydate3.getUTCFullYear(),mydate3.getUTCMonth(),mydate3.getUTCDate(),mydate3.getUTCHours(),mydate3.getUTCMinutes(),mydate3.getUTCSeconds());
				var now3 = x3.getTime();
				var delta3 = now3-lastactiontime;
				
				var delta_in_seconds3 =  (delta3/1000);
				var delta_mins3 = (delta_in_seconds3/60);
				var delta_secs3 = (delta_in_seconds3%60);
				
				consoleinfo("lastactiontime:"+lastactiontime+" - now3:"+now3+" - delta_mins3:" + delta_mins3+" - delta3:"+delta3);
				if(delta_mins3>15)
				{
					document.LoginForm.login.value="";
					document.LoginForm.password.value="";
					consoleinfo("session expired no action since 5 minutes");
					automaticlogout=1;
					this.logout();
				}
				else
				{
					lomyajax.setautomatic();
					lomyajax.initrequest();
					lomyajax.setrequestheader("SESSION","REFRESHSESSION");
					lomyajax.client(this,verifrefreshsession);
				}
			}
			else
			{
				if(connectiondata["providertype"]=="OP")
				{
					lomyajax.setautomatic();
				}
				lomyajax.initrequest();
				lomyajax.setrequestheader("SESSION","REFRESHSESSION");
				lomyajax.client(this,verifrefreshsession);
			}
		}
	}
	,
	this.dorefreshsession=function()
	{
		refreshsessionid=setInterval("conn.refreshsession()",120000);	
	}
	,
	this.systemchatcall=function (val)
	{
		if(callToSystemchat && (connectiondata["providertype"]=="CL" || connectiondata["providertype"]=="GU"))
		{
			lomyajax.setautomatic();
			lomyajax.initrequest();
			lomyajax.setrequestheader("SYSTEMCHAT","GETSYSTEMCHATSTATUS");
			lomyajax.setparams("systemchatstatusid",val);
			lomyajax.client(this,verifsystemchatcall,failuresystemchatcall,val);
		}
		else
		{
			clearInterval(systemchatcallid);
			clearInterval(getsystemchatstatuscallid);
			systemchatcallid=0;
			getsystemchatstatuscallid=0;
		}
	}
	,
	this.getsystemchatstatus=function()
	{
		var omyajax=new myajax();
		omyajax.initrequest();
		omyajax.setrequestheader("SYSTEMCHAT","GETSYSTEMCHATAGENTSCOUNT");
		omyajax.setparams("departmentid",'2');
		omyajax.client(this,verifgetsystemchatstatus);
	}
	,
	this.dosystemchatcall=function()
	{
		systemchatcallid=setInterval("conn.systemchatcall(conn.systemchatstatusid)",15000);	
	}
	,
	this.getaccountfunds=function ()
	{
		if(!lomyajax.isadmin() && connectiondata["providertype"]!="GU")
		{
			lomyajax.initrequest();
			lomyajax.setrequestheader("USERINFO","GETBALANCE");
			lomyajax.client(this,verifgetaccountfunds);
		}
	}
	,
	this.showaccountfunds2=function ()
	{
		if(document.getElementById('viewfunds2').innerHTML=="["+otransJS.translate("hide")+"]")
			showaccountfunds(0);
		else
			showaccountfunds(1);
	}
	,
	this.verifloginsecure=function(response)
	{	
		Example.unmask("loginloading");
		if(responsetojson(response))
		{
			var json=response.responseText;
			
			try{document.getElementById('details').style.display='';}catch(e){}
			connectiondata["sessionid"]=json.result.sessionid;
			connectiondata["firstlastname"]=json.result.firstlastname;
			connectiondata["mail"]=json.result.mail;
			connectiondata["currency"]=json.result.currency;
			connectiondata["currencysymbol"]=json.result.currencysymbol;
			connectiondata["balance"]=json.result.availabletobet;
			connectiondata["providertype"]=json.result.providertype;
			refreshsessionid=setInterval("conn.refreshsession()",120000);
			afterconnect();
		}
		else
		{
			document.LoginForm.login.value="";
			document.LoginForm.password.value="";
			initconnection();
			document.getElementById('logpart').style.display='';
			document.getElementById('logpart1').style.display='';
			document.getElementById('joinpart').style.display='';
			document.getElementById('idlang').style.display='';
			document.getElementById('idlang2').style.display='';
			document.getElementById('details').style.display="";
			try
			{
				window.onbeforeunload = null;

			}catch(e){}
			homeeast3delogged();
		}
	}
	,
	this.monitorfaileddeposit=function()
	{
		
	}	
	,
	this.monitorincashier=function()
	{
		
	}	
	,
	this.lpvisitor=function()
	{
		
                try
                {
                    connectiondata["userid"]= getCookie("userid");
                    connectiondata["realplayer"]=getCookie("rp");
                    connectiondata["accountstatus"]=getCookie("acs");
                    connectiondata["isretention"]=getCookie("ret");
                    connectiondata["viplevel"]=getCookie("vl");
                    connectiondata["firstlastname"]=getCookie("fln");
                    connectiondata["balance"]=getCookie("blc");
                }
                catch(e){consoleinfo("getcookieproblem");}
              
	},
	this.countdownregulationcode=function ()
	{
			var code =connectiondata["regulationclosuretime"];
			var substcode = code.substring(0,10);
			var splitcode = substcode.split('-');
			var codedate= new Date();
			codedate.setFullYear(splitcode[0]);
			codedate.setMonth(splitcode[1]-1);
			codedate.setDate(splitcode[2]);
			var currentTime = new Date();
			var diff = codedate.getTime()-currentTime.getTime();
			diff= diff/(1000*60*60*24);
			if(diff>=0){
			document.getElementById('countdownregulationcode').innerHTML= "Il vous reste "+Math.ceil(diff)+" jours pour valider votre inscription.<span style='color:#2f302e;'>Cliquez ici</span>";
			}
			else if(30+diff>=0)
			{
				var newcount= 30+diff;
				document.getElementById('countdownregulationcode').innerHTML= "Il vous reste "+Math.ceil(newcount)+" jours pour valider votre inscription.<span style='color:#2f302e;'>Cliquez ici</span>";
			}
			else if(30+diff<0){
				document.getElementById('countdownregulationcode').innerHTML= "Votre compte a été désactiver.<span style='color:#2f302e;'>Contactez notre service client.</span>";
				document.getElementById('linktocashier').href="";
				}
			else{
					var code =connectiondata["legigamestartingtime"];
					var substcode = code.substring(0,10);
					var splitcode = substcode.split('-');
		
					var codedate= new Date();
					codedate.setFullYear(splitcode[0]);
					codedate.setMonth(splitcode[1]-1);
					codedate.setDate(splitcode[2]);
					var currentTime = new Date();
					var diff =currentTime.getTime()-codedate.getTime();
					diff= diff/(1000*60*60*24);
					diff= 42-diff;
					if(diff<=42 && diff>=0)
					{
						document.getElementById('countdownregulationcode').innerHTML= "Il vous reste que "+Math.ceil(diff)+" jours pour saisir votre code d'activation.<span style='color:#2f302e;'>Cliquer ici</span>";
						document.getElementById('linktocashier').href="javascript:addtemplatechoose('GETSETREGULATIONCODE','2')";
					}
					else{
						document.getElementById('countdownregulationcode').innerHTML= "Votre compte a ete desactiver.<span style='color:#2f302e;'>Contacter notre service client.</span>";
						document.getElementById('linktocashier').href="";
						}
				}
				document.getElementById('button_legigame').style.display="";
	}
}



conn=new connection();
var fromseo="1";
var mycashier=0;


/*
 * jQuery JavaScript Library v1.3.2
 * http://jquery.com/
 *
 * Copyright (c) 2009 John Resig
 * Dual licensed under the MIT and GPL licenses.
 * http://docs.jquery.com/License
 *
 * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
 * Revision: 6246
 */
(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F<J;F++){var G=M[F];if(G.selected){K=o(G).val();if(H){return K}L.push(K)}}return L}return(E.value||"").replace(/\r/g,"")}return g}if(typeof K==="number"){K+=""}return this.each(function(){if(this.nodeType!=1){return}if(o.isArray(K)&&/radio|checkbox/.test(this.type)){this.checked=(o.inArray(this.value,K)>=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G<E;G++){L.call(K(this[G],H),this.length>1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H<I;H++){if((G=arguments[H])!=null){for(var F in G){var K=J[F],L=G[F];if(J===L){continue}if(E&&L&&typeof L==="object"&&!L.nodeType){J[F]=o.extend(E,K||(L.length!=null?[]:{}),L)}else{if(L!==g){J[F]=L}}}}}return J};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,q=document.defaultView||{},s=Object.prototype.toString;o.extend({noConflict:function(E){l.$=p;if(E){l.jQuery=y}return o},isFunction:function(E){return s.call(E)==="[object Function]"},isArray:function(E){return s.call(E)==="[object Array]"},isXMLDoc:function(E){return E.nodeType===9&&E.documentElement.nodeName!=="HTML"||!!E.ownerDocument&&o.isXMLDoc(E.ownerDocument)},globalEval:function(G){if(G&&/\S/.test(G)){var F=document.getElementsByTagName("head")[0]||document.documentElement,E=document.createElement("script");E.type="text/javascript";if(o.support.scriptEval){E.appendChild(document.createTextNode(G))}else{E.text=G}F.insertBefore(E,F.firstChild);F.removeChild(E)}},nodeName:function(F,E){return F.nodeName&&F.nodeName.toUpperCase()==E.toUpperCase()},each:function(G,K,F){var E,H=0,I=G.length;if(F){if(I===g){for(E in G){if(K.apply(G[E],F)===false){break}}}else{for(;H<I;){if(K.apply(G[H++],F)===false){break}}}}else{if(I===g){for(E in G){if(K.call(G[E],E,G[E])===false){break}}}else{for(var J=G[0];H<I&&K.call(J,H,J)!==false;J=G[++H]){}}}return G},prop:function(H,I,G,F,E){if(o.isFunction(I)){I=I.call(H,F)}return typeof I==="number"&&G=="curCSS"&&!b.test(E)?I+"px":I},className:{add:function(E,F){o.each((F||"").split(/\s+/),function(G,H){if(E.nodeType==1&&!o.className.has(E.className,H)){E.className+=(E.className?" ":"")+H}})},remove:function(E,F){if(E.nodeType==1){E.className=F!==g?o.grep(E.className.split(/\s+/),function(G){return !o.className.has(F,G)}).join(" "):""}},has:function(F,E){return F&&o.inArray(E,(F.className||F).toString().split(/\s+/))>-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+"></"+T+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!O.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!O.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!O.indexOf("<td")||!O.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!O.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!o.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/<tbody/i.test(S),N=!O.indexOf("<table")&&!R?L.firstChild&&L.firstChild.childNodes:Q[1]=="<table>"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E<F;E++){if(H[E]===G){return E}}return -1},merge:function(H,E){var F=0,G,I=H.length;if(!o.support.getAll){while((G=E[F++])!=null){if(G.nodeType!=8){H[I++]=G}}}else{while((G=E[F++])!=null){H[I++]=G}}return H},unique:function(K){var F=[],E={};try{for(var G=0,H=K.length;G<H;G++){var J=o.data(K[G]);if(!E[J]){E[J]=true;F.push(K[G])}}}catch(I){F=K}return F},grep:function(F,J,E){var G=[];for(var H=0,I=F.length;H<I;H++){if(!E!=!J(F[H],H)){G.push(F[H])}}return G},map:function(E,J){var F=[];for(var G=0,H=E.length;G<H;G++){var I=J(E[G],G);if(I!=null){F[F.length]=I}}return F.concat.apply([],F)}});var C=navigator.userAgent.toLowerCase();o.browser={version:(C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(C),opera:/opera/.test(C),msie:/msie/.test(C)&&!/opera/.test(C),mozilla:/mozilla/.test(C)&&!/(compatible|webkit)/.test(C)};o.each({parent:function(E){return E.parentNode},parents:function(E){return o.dir(E,"parentNode")},next:function(E){return o.nth(E,2,"nextSibling")},prev:function(E){return o.nth(E,2,"previousSibling")},nextAll:function(E){return o.dir(E,"nextSibling")},prevAll:function(E){return o.dir(E,"previousSibling")},siblings:function(E){return o.sibling(E.parentNode.firstChild,E)},children:function(E){return o.sibling(E.firstChild)},contents:function(E){return o.nodeName(E,"iframe")?E.contentDocument||E.contentWindow.document:o.makeArray(E.childNodes)}},function(E,F){o.fn[E]=function(G){var H=o.map(this,F);if(G&&typeof G=="string"){H=o.multiFilter(G,H)}return this.pushStack(o.unique(H),E,G)}});o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(E,F){o.fn[E]=function(G){var J=[],L=o(G);for(var K=0,H=L.length;K<H;K++){var I=(K>0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}});
/*
 * Sizzle CSS Selector Engine - v0.9.3
 *  Copyright 2009, The Dojo Foundation
 *  Released under the MIT, BSD, and GPL Licenses.
 *  More information: http://sizzlejs.com/
 */
(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa<ab.length;aa++){if(ab[aa]===ab[aa-1]){ab.splice(aa--,1)}}}}}return ab};F.matches=function(T,U){return F(T,null,null,U)};F.find=function(aa,T,ab){var Z,X;if(!aa){return[]}for(var W=0,V=I.order.length;W<V;W++){var Y=I.order[W],X;if((X=I.match[Y].exec(aa))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){X[1]=(X[1]||"").replace(/\\/g,"");Z=I.find[Y](X,T,ab);if(Z!=null){aa=aa.replace(I.match[Y],"");break}}}}if(!Z){Z=T.getElementsByTagName("*")}return{set:Z,expr:aa}};F.filter=function(ad,ac,ag,W){var V=ad,ai=[],aa=ac,Y,T,Z=ac&&ac[0]&&Q(ac[0]);while(ad&&ac.length){for(var ab in I.filter){if((Y=I.match[ab].exec(ad))!=null){var U=I.filter[ab],ah,af;T=false;if(aa==ai){ai=[]}if(I.preFilter[ab]){Y=I.preFilter[ab](Y,aa,ag,ai,W,Z);if(!Y){T=ah=true}else{if(Y===true){continue}}}if(Y){for(var X=0;(af=aa[X])!=null;X++){if(af){ah=U(af,Y,X,aa);var ae=W^!!ah;if(ag&&ah!=null){if(ae){T=true}else{aa[X]=false}}else{if(ae){ai.push(af);T=true}}}}}if(ah!==g){if(!ag){aa=ai}ad=ad.replace(I.match[ab],"");if(!T){return[]}break}}}if(ad==V){if(T==null){throw"Syntax error, unrecognized expression: "+ad}else{break}}V=ad}return aa};var I=F.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(T){return T.getAttribute("href")}},relative:{"+":function(aa,T,Z){var X=typeof T==="string",ab=X&&!/\W/.test(T),Y=X&&!ab;if(ab&&!Z){T=T.toUpperCase()}for(var W=0,V=aa.length,U;W<V;W++){if((U=aa[W])){while((U=U.previousSibling)&&U.nodeType!==1){}aa[W]=Y||U&&U.nodeName===T?U||false:U===T}}if(Y){F.filter(T,aa,true)}},">":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){var W=Y.parentNode;Z[V]=W.nodeName===U?W:false}}}else{for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){Z[V]=X?Y.parentNode:Y.parentNode===U}}if(X){F.filter(U,Z,true)}}},"":function(W,U,Y){var V=L++,T=S;if(!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("parentNode",U,V,W,X,Y)},"~":function(W,U,Y){var V=L++,T=S;if(typeof U==="string"&&!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("previousSibling",U,V,W,X,Y)}},find:{ID:function(U,V,W){if(typeof V.getElementById!=="undefined"&&!W){var T=V.getElementById(U[1]);return T?[T]:[]}},NAME:function(V,Y,Z){if(typeof Y.getElementsByName!=="undefined"){var U=[],X=Y.getElementsByName(V[1]);for(var W=0,T=X.length;W<T;W++){if(X[W].getAttribute("name")===V[1]){U.push(X[W])}}return U.length===0?null:U}},TAG:function(T,U){return U.getElementsByTagName(T[1])}},preFilter:{CLASS:function(W,U,V,T,Z,aa){W=" "+W[1].replace(/\\/g,"")+" ";if(aa){return W}for(var X=0,Y;(Y=U[X])!=null;X++){if(Y){if(Z^(Y.className&&(" "+Y.className+" ").indexOf(W)>=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return U<T[3]-0},gt:function(V,U,T){return U>T[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W<T;W++){if(Y[W]===Z){return false}}return true}}}},CHILD:function(T,W){var Z=W[1],U=T;switch(Z){case"only":case"first":while(U=U.previousSibling){if(U.nodeType===1){return false}}if(Z=="first"){return true}U=T;case"last":while(U=U.nextSibling){if(U.nodeType===1){return false}}return true;case"nth":var V=W[2],ac=W[3];if(V==1&&ac==0){return true}var Y=W[0],ab=T.parentNode;if(ab&&(ab.sizcache!==Y||!T.nodeIndex)){var X=0;for(U=ab.firstChild;U;U=U.nextSibling){if(U.nodeType===1){U.nodeIndex=++X}}ab.sizcache=Y}var aa=T.nodeIndex-ac;if(V==0){return aa==0}else{return(aa%V==0&&aa/V>=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V<T;V++){U.push(X[V])}}else{for(var V=0;X[V];V++){U.push(X[V])}}}return U}}var G;if(document.documentElement.compareDocumentPosition){G=function(U,T){var V=U.compareDocumentPosition(T)&4?-1:U===T?0:1;if(V===0){hasDuplicate=true}return V}}else{if("sourceIndex" in document.documentElement){G=function(U,T){var V=U.sourceIndex-T.sourceIndex;if(V===0){hasDuplicate=true}return V}}else{if(document.createRange){G=function(W,U){var V=W.ownerDocument.createRange(),T=U.ownerDocument.createRange();V.selectNode(W);V.collapse(true);T.selectNode(U);T.collapse(true);var X=V.compareBoundaryPoints(Range.START_TO_END,T);if(X===0){hasDuplicate=true}return X}}}}(function(){var U=document.createElement("form"),V="script"+(new Date).getTime();U.innerHTML="<input name='"+V+"'/>";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="<a href='#'></a>";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="<p class='TEST'></p>";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="<div class='test e'></div><div class='test'></div>";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1&&!ac){T.sizcache=Y;T.sizset=W}if(T.nodeName===Z){X=T;break}T=T[U]}ad[W]=X}}}function S(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1){if(!ac){T.sizcache=Y;T.sizset=W}if(typeof Z!=="string"){if(T===Z){X=true;break}}else{if(F.filter(Z,[T]).length>0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z<U;Z++){F(T,V[Z],W)}return F.filter(X,W)};o.find=F;o.filter=F.filter;o.expr=F.selectors;o.expr[":"]=o.expr.filters;F.selectors.filters.hidden=function(T){return T.offsetWidth===0||T.offsetHeight===0};F.selectors.filters.visible=function(T){return T.offsetWidth>0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F<E.length){o.event.proxy(G,E[F++])}return this.click(o.event.proxy(G,function(H){this.lastToggle=(this.lastToggle||0)%F;H.preventDefault();return E[this.lastToggle++].apply(this,arguments)||false}))},hover:function(E,F){return this.mouseenter(E).mouseleave(F)},ready:function(E){B();if(o.isReady){E.call(document,o)}else{o.readyList.push(E)}return this},live:function(G,F){var E=o.event.proxy(F);E.guid+=this.selector+G;o(document).bind(i(G,this.selector),this.selector,E);return this},die:function(F,E){o(document).unbind(i(F,this.selector),E?{guid:E.guid+this.selector+F}:null);return this}});function c(H){var E=RegExp("(^|\\.)"+H.type+"(\\.|$)"),G=true,F=[];o.each(o.data(this,"events").live||[],function(I,J){if(E.test(J.type)){var K=o(H.target).closest(J.data)[0];if(K){F.push({elem:K,fn:J})}}});F.sort(function(J,I){return o.data(J.elem,"closest")-o.data(I.elem,"closest")});o.each(F,function(){if(this.fn.call(this.elem,H,this.fn.data)===false){return(G=false)}});return G}function i(F,E){return["live",F,E.replace(/\./g,"`").replace(/ /g,"|")].join(".")}o.extend({isReady:false,readyList:[],ready:function(){if(!o.isReady){o.isReady=true;if(o.readyList){o.each(o.readyList,function(){this.call(document,o)});o.readyList=null}o(document).triggerHandler("ready")}}});var x=false;function B(){if(x){return}x=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);o.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);o.ready()}});if(document.documentElement.doScroll&&l==l.top){(function(){if(o.isReady){return}try{document.documentElement.doScroll("left")}catch(E){setTimeout(arguments.callee,0);return}o.ready()})()}}}o.event.add(l,"load",o.ready)}o.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(F,E){o.fn[E]=function(G){return G?this.bind(E,G):this.trigger(E)}});o(l).bind("unload",function(){for(var E in o.cache){if(E!=1&&o.cache[E].handle){o.event.remove(o.cache[E].handle.elem)}}});(function(){o.support={};var F=document.documentElement,G=document.createElement("script"),K=document.createElement("div"),J="script"+(new Date).getTime();K.style.display="none";K.innerHTML='   <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var H=K.getElementsByTagName("*"),E=K.getElementsByTagName("a")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName("tbody").length,objectAll:!!K.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!K.getElementsByTagName("link").length,style:/red/.test(E.getAttribute("style")),hrefNormalized:E.getAttribute("href")==="/a",opacity:E.style.opacity==="0.5",cssFloat:!!E.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};G.type="text/javascript";try{G.appendChild(document.createTextNode("window."+J+"=1;"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent("onclick",function(){o.support.noCloneEvent=false;K.detachEvent("onclick",arguments.callee)});K.cloneNode(true).fireEvent("onclick")}o(function(){var L=document.createElement("div");L.style.width=L.style.paddingLeft="1px";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L).style.display="none"})})();var w=o.support.cssFloat?"cssFloat":"styleFloat";o.props={"for":"htmlFor","class":"className","float":w,cssFloat:w,styleFloat:w,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!=="string"){return this._load(G)}var I=G.indexOf(" ");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("<div/>").append(M.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H<F;H++){var E=o.data(this[H],"olddisplay");this[H].style.display=E||"";if(o.css(this[H],"display")==="none"){var G=this[H].tagName,K;if(m[G]){K=m[G]}else{var I=o("<"+G+" />").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H<F;H++){this[H].style.display=o.data(this[H],"olddisplay")||""}return this}},hide:function(H,I){if(H){return this.animate(t("hide",3),H,I)}else{for(var G=0,F=this.length;G<F;G++){var E=o.data(this[G],"olddisplay");if(!E&&E!=="none"){o.data(this[G],"olddisplay",o.css(this[G],"display"))}}for(var G=0,F=this.length;G<F;G++){this[G].style.display="none"}return this}},_toggle:o.fn.toggle,toggle:function(G,F){var E=typeof G==="boolean";return o.isFunction(G)&&o.isFunction(F)?this._toggle.apply(this,arguments):G==null||E?this.each(function(){var H=E?G:o(this).is(":hidden");o(this)[H?"show":"hide"]()}):this.animate(t("toggle",3),G,F)},fadeTo:function(E,G,F){return this.animate({opacity:G},E,F)},animate:function(I,F,H,G){var E=o.speed(F,H,G);return this[E.queue===false?"each":"queue"](function(){var K=o.extend({},E),M,L=this.nodeType==1&&o(this).is(":hidden"),J=this;for(M in I){if(I[M]=="hide"&&L||I[M]=="show"&&!L){return K.complete.call(this)}if((M=="height"||M=="width")&&this.style){K.display=o.css(this,"display");K.overflow=this.style.overflow}}if(K.overflow!=null){this.style.overflow="hidden"}K.curAnim=o.extend({},I);o.each(I,function(O,S){var R=new o.fx(J,K,O);if(/toggle|show|hide/.test(S)){R[S=="toggle"?L?"show":"hide":S](I)}else{var Q=S.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),T=R.cur(true)||0;if(Q){var N=parseFloat(Q[2]),P=Q[3]||"px";if(P!="px"){J.style[O]=(N||1)+P;T=((N||1)/R.cur(true))*T;J.style[O]=T+P}if(Q[1]){N=((Q[1]=="-="?-1:1)*N)+T}R.custom(T,N,P)}else{R.custom(T,S,"")}}});return true})},stop:function(F,E){var G=o.timers;if(F){this.queue([])}this.each(function(){for(var H=G.length-1;H>=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J<K.length;J++){if(!K[J]()){K.splice(J--,1)}}if(!K.length){clearInterval(n);n=g}},13)}},show:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());o(this.elem).show()},hide:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(H){var G=e();if(H||G>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})();



function createsession()
{
	var lomyajax=new myajax();
	lomyajax.initrequest();
	lomyajax.setrequestheader("SESSION","GETSESSION");
	
	try{saveurlparameters();}catch(e){debug("saveurl parameters error");}
	/*if((getCookie("a_aid")=="" || getCookie("a_aid")==null) && (getCookie("a_bid")=="" || getCookie("a_bid")==null) && (getCookie("trackingcode")=="" || getCookie("trackingcode")==null) && (getCookie("IFSID")=="" || getCookie("IFSID")==null))
	{
		var a_aid=getparam("a_aid");
		var a_bid=getparam("a_bid");
		var trackingcode=getparam("trackingcode");
		var sid=getparam("SID");
		setCookie("a_aid",a_aid,7);
		setCookie("a_bid",a_bid,7);
		setCookie("trackingcode",trackingcode,7);
		setCookie("IFSID",sid,7);
		consoleinfo("url:"+a_aid+"-"+a_bid+"-"+trackingcode+"-"+sid);
	}
	else
	{
		var a_aid=getCookie("a_aid");
		var a_bid=getCookie("a_bid");
		var trackingcode=getCookie("trackingcode");
		var sid=getCookie("IFSID");
		consoleinfo("cookie:"+a_aid+"-"+a_bid+"-"+trackingcode+"-"+sid);
	}
	
	if(sid!="" && sid!=null)
	{
		a_aid="IFOREX";
		a_bid=sid;
	}
	
	if(trackingcode!="" && trackingcode!=null)
	{
		a_bid=trackingcode;
		if(trackingcode=="yahoo")
			a_aid="YAHOO";
		else if(trackingcode=="937b3c33")
		{
			a_bid=a_aid;
			a_aid="937b3c33";
		}
		else
			a_aid="ADWORDS";
		
	}
	
	if(a_aid=="fl01")
	{
		a_aid="73d013ae";
	}*/
	 
	lomyajax.setparams("a_aid",a_aid);
	lomyajax.setparams("a_bid",a_bid);
        lomyajax.setparams("referurl",referurl);
	consoleinfo("final:"+a_aid+"-"+a_bid);
	lomyajax.client(this,initExt,failuresession);
}

function failuresession()
{
	debug("bigproblem");
}

function initExt(response,opts)
{
	if(responsetojson(response,opts,1) )
	{
		var myobj=opts.scope;
		var json=Ext.util.JSON.decode(response.responseText);
		var result=json.result;
		if(getparam("mysessionid")!="" && getparam("mysessionid")!=null && getparam("mysessionid")!=0)
		{
			guest["sessionid"]=unescape(getparam("mysessionid"));
		}
		else
		{
			guest["sessionid"]=result.sessionid;
		}
                guest["countryiso3"]=result.countryiso3;	
	}
	
	omytime=new mytime();
	omytime.displayTime();
	
	consoleinfo(guest["sessionid"]);
	//RESOURCES/images/GENERAL/captcha.php?sessionid={$sessionid}
	document.getElementById('captcha').src=baseURL+"/RESOURCES/images/GENERAL/captcha2.php?sessionid="+guest["sessionid"];
	conn.setvariable("sessionid",guest["sessionid"]);
	conn.dorefreshsession();
	send2mythings("1105");
	//try{showtrackingcode("IFRAME~script~http://admin.turfez.com/dsnr.php");}catch(e){}
         if(    guest["countryiso3"]=="CIV" || guest["countryiso3"]=="ISR" || guest["countryiso3"]=="AGO" || guest["countryiso3"]=="BFA" || guest["countryiso3"]=="BDI"
            || guest["countryiso3"]=="BEN" || guest["countryiso3"]=="BWA" || guest["countryiso3"]=="COD" || guest["countryiso3"]=="CAF" || guest["countryiso3"]=="COG"
            || guest["countryiso3"]=="CMR" || guest["countryiso3"]=="CPV" || guest["countryiso3"]=="DJI" || guest["countryiso3"]=="DZA" || guest["countryiso3"]=="EGY"
            || guest["countryiso3"]=="ESH" || guest["countryiso3"]=="GNQ" || guest["countryiso3"]=="GNB" || guest["countryiso3"]=="KEN" || guest["countryiso3"]=="COM"
            || guest["countryiso3"]=="ERI" || guest["countryiso3"]=="ETH" || guest["countryiso3"]=="GAB" || guest["countryiso3"]=="GHA" || guest["countryiso3"]=="GMB"
            || guest["countryiso3"]=="LBR" || guest["countryiso3"]=="LSO" || guest["countryiso3"]=="LBY" || guest["countryiso3"]=="MAR" || guest["countryiso3"]=="MDG"
            || guest["countryiso3"]=="MLI" || guest["countryiso3"]=="MRT" || guest["countryiso3"]=="MUS" || guest["countryiso3"]=="MWI" || guest["countryiso3"]=="MOZ"
            || guest["countryiso3"]=="NAM" || guest["countryiso3"]=="NER" || guest["countryiso3"]=="NGA" || guest["countryiso3"]=="REU" || guest["countryiso3"]=="RWA"
            || guest["countryiso3"]=="SYC" || guest["countryiso3"]=="SDN" || guest["countryiso3"]=="SHN" || guest["countryiso3"]=="SLE" || guest["countryiso3"]=="SEN"
            || guest["countryiso3"]=="SOM" || guest["countryiso3"]=="STP" || guest["countryiso3"]=="SWZ" || guest["countryiso3"]=="TCD" || guest["countryiso3"]=="TGO"
            || guest["countryiso3"]=="TUN" || guest["countryiso3"]=="TZA" || guest["countryiso3"]=="UGA" || guest["countryiso3"]=="MYT" || guest["countryiso3"]=="ZAF"
            || guest["countryiso3"]=="ZMB" || guest["countryiso3"]=="ZWE" )
        {
            try{document.getElementById('Banner1').style.display="none";}catch(e){}
            try{document.getElementById('Banner2').style.display="";}catch(e){}
            try{document.getElementById('Banner3').style.display="none";}catch(e){}
        }
        else if( guest["countryiso3"]=="FRA"
               || guest["countryiso3"]=="GUF"
               || guest["countryiso3"]=="ATF"
               || guest["countryiso3"]=="SPM"
               || guest["countryiso3"]=="REU"
               || guest["countryiso3"]=="GLP"
               || guest["countryiso3"]=="MTQ"
               || guest["countryiso3"]=="MYT"
               || guest["countryiso3"]=="NCL"
               || guest["countryiso3"]=="BLM"
               || guest["countryiso3"]=="PYF"
               || guest["countryiso3"]=="MAF"
               || guest["countryiso3"]=="WLF"  )
        {
            try{document.getElementById('Banner1').style.display="none";}catch(e){}
            try{document.getElementById('Banner2').style.display="none";}catch(e){}
            try{document.getElementById('Banner3').style.display="";}catch(e){}
            setCookie("cty",1,30);
        }
        else
        {
            try{document.getElementById('Banner1').style.display="";}catch(e){}
            try{document.getElementById('Banner2').style.display="none";}catch(e){}
            try{document.getElementById('Banner3').style.display="none";}catch(e){}
        }
}

function loadapp()
{
   //consoleinfo("loadapp");
	/*var el = document.createElement("iframe");
	el.setAttribute('id', 'myapplication');
	el.setAttribute('frameborder', '0');
	el.setAttribute('width', '100%');
	document.getElementById('myapp').appendChild(el);
	el.setAttribute('src', 'http://127.0.0.1/index.php');
	resize_iframe();*/
	//document.getElementById("myapplication").src="http://127.0.0.1/index.php";
}

function subconnect()
{
	/*consoleinfo("2");
	var iframe = document.getElementById("myapplication");  
	var doc = null;  
	
	if(iframe.contentDocument)  
	{
		// Firefox, Opera  
		doc = iframe.contentDocument;  
	}
	else if(iframe.contentWindow)  
	{
		// Internet Explorer  
		doc = iframe.contentWindow.document;  
	}
	else if(iframe.document)  
	{
		// Others?  
		doc = iframe.document;  
	}

	if(doc == null)  
		throw "Document not initialized";
	consoleinfo("subconnect");
	doc.LoginForm.login.value=document.LoginForm.login.value;	 
	doc.LoginForm.password.value=document.LoginForm.password.value;
	window.frames["myapplication"].conn.connect();	 */
}


function switchapplogout()
{
	setCookie("a1","",1);
	setCookie("b2","",1);
	fastlogout();
	document.myapp2.submit();
}

function fastlogout()
{
	try
	{
		conn.fastlogout()
	}
	catch(e)
	{
		debug("fastlogout");
	}
}

function switchapp()
{
	if(document.LoginForm.login.value!="" && document.LoginForm.password.value!="")
	{
		if (verif_mail(document.LoginForm.login.value))
		{
			alert(otransJS.translate("youmustntenteryouremailbutyourusername"));
			return -2
		}
		else if (!verif_number_or_letter(document.LoginForm.login.value))
		{
			alert(otransJS.translate("theloginmustbeletterornumber"));
			return -3;
		}
		setCookie("a1",document.LoginForm.login.value,1);
		setCookie("b2",document.LoginForm.password.value,1);
		
		//alert(getCookie("a1")+" - "+ getCookie("b2"));
		
		
		try{document.getElementById('row1').innerHTML=otransJS.translate("connecting");}catch(e){}
		try{document.getElementById('row2').style.display="none";}catch(e){}
		try{document.getElementById('logpart').style.display="none";}catch(e){}
		try{document.getElementById('logpart1').style.display="none";}catch(e){}
		try{document.getElementById('joinpart').style.display="none";}catch(e){}
		try{document.getElementById('idlang').style.display="none";}catch(e){}
		try{document.getElementById('idlang2').style.display="none";}catch(e){}
		setTimeout("document.myapp2.submit()",3000);
		fastlogout();
		
		
	}
	else
		alert(otransJS.translate("youmustprovidealoginandpassword"));
	
	//document.getElementById('myapplication').style.width="100%";
	//document.getElementById('main').style.display="none";
	//document.getElementById('myapp').style.display="";
}
createsession();
//setTimeout("createsession()",1000);

function loadmenulinksecure2(_mainaction,_minoraction,_encoding,_nr_template)
	{
		if (_mainaction=="CASHIER")
		{
			switch (_minoraction) 
			{
				case "GETDEPOSITBANK":
					var number=1;
					break;
				case "GETDEPOSITMONEYBOOKERS":
					var number=2;
					break;
				case "GETDEPOSITTICKETSURF":
					var number=5;
					break;
				case "GETDEPOSITPREPAIDTICKETSURF":
					var number=4;
					break;
				case "GETDEPOSITNETELLER":
					var number=3;
					break;
				default: 
					var number=0;
					break;

			}
			document.LoginForm.selecttype[number].checked=true;	
			for (i=0;issmaller(i,6);i++)
			{
				document.getElementById("idtype"+i).className="unselecttypec";
				if (i==number)
				{
					document.getElementById("idtype"+i).className="selecttypec";
				}
			}
		}
				
		var omyajax=new myajax();
		omyajax.setrequestheader(_mainaction,_minoraction,"templates",_nr_template);
		omyajax.clientsecure(this,verifgetlinks2,null,_minoraction);
	}
	
function verifgetlinks2(response,opts)
	{
		try
		{	
			var json=Ext.util.JSON.decode(response.responseText);
			if(json.header.errorcode==108 || json.header.errorcode=="108")
			{
				sessionexpired();
			}
			else if(json.header.errorcode % 100)
				alert(response.responseText);
			else
			{
				var mytemplate=opts.extraParams;
				document.getElementById("formdeposit").innerHTML=response.responseText;
				eval(document.getElementById('myscriptcenter'+mytemplate).innerHTML);
				
			}
		}
		catch(e)
		{
			var mytemplate=opts.extraParams;
			document.getElementById("formdeposit").innerHTML=response.responseText;
			eval(document.getElementById('myscriptcenter'+mytemplate).innerHTML);
		}
	}
	
	function sessionexpired()
{
	try{clearInterval(processIDgipt1);}catch(e){}
	try{clearInterval(processIDgipt);}catch(e){}
	try{conn.killrefreshsession();}catch(e){}
	try{alert(otransJS.translate("yoursessionhasexpiredpleaselogin"));}catch(e){}
	
	
	
	guest["sessionid"]=null;
	conn.setvariable("sessionid",guest["sessionid"]);
	
	
	if(conn.getvariable("providertype")!="GU")
	{
		conn.logout();
	}
	
	var lomyajax=new myajax();
	lomyajax.initrequest();
	lomyajax.setrequestheader("SESSION","GETSESSION");
	lomyajax.client(this,reloadsession,failuresession);
	//try{createsession();}catch(e){}
}

function reloadsession(response,opts)
{
	var myobj=opts.scope;
	var json=Ext.util.JSON.decode(response.responseText);
	var result=json.result;
	guest["sessionid"]=result.sessionid;
	conn.setvariable("sessionid",guest["sessionid"]);
}

function send2mythings(_action,_transaction)
{
	try
	{
		if (typeof(MyThings) != "undefined") 
		{
			if(_action=="9904")
				MyThings.Track({EventType: MyThings.Event.Conversion,Action: _action,TransactionReference:_transaction});
			else
				MyThings.Track({EventType: MyThings.Event.Visit,Action: _action});
			consoleinfo("MyThings Action:"+_action+"TransactionReference:"+_transaction);
		}
	}
	catch(e)
	{
		debug("send2mythings error")
	}
	
}


// JavaScript Object for country specific iban data.
function Country(name, code, bank_form, acc_form)
{
  // Constructor for Country objects.
  //
  // Arguments:
  //   name      - Name of the country
  //   code      - Country Code from ISO 3166
  //   bank_form - Format of bank/branch code part (e.g. "0 4a 0 ")
  //   acc_form  - Format of account number part (e.g. "0  11  2n")

  this.name      = name;
  this.code      = code;
  this.bank      = Country_decode_format(bank_form);
  this.acc       = Country_decode_format(acc_form);
  this.bank_lng  = Country_calc_length(this.bank);
  this.acc_lng   = Country_calc_length(this.acc);
  this.total_lng = 4 + this.bank_lng + this.acc_lng;
}

function Country_decode_format(form)
{
  var form_list = new Array();
  var parts = form.split(" ");
  for (var i = 0; i < parts.length; ++i)
  {
    var part = parts[i];
    if (part != "")
    {
      var typ = part.charAt(part.length - 1);
      if (typ == "a" || typ == "n")
        part = part.substring(0, part.length - 1);
      else
        typ = "c";
      var lng = parseInt(part);
      form_list[form_list.length] = new Array(lng, typ);
    }
  }
  return form_list;
}

function Country_calc_length(form_list)
{
  var sum = 0;
  for (var i = 0; i < form_list.length; ++i)
    sum += form_list[i][0];
  return sum;
}

// BBAN data from ISO 13616, Country codes from ISO 3166 (www.iso.org).
var iban_data = new Array(
  new Country("Andorra",        "AD", "0  4n 4n", "0  12   0 "),
  new Country("Albania",        "AL", "0  8n 0 ", "0  16   0 "),
  new Country("Austria",        "AT", "0  5n 0 ", "0  11n  0 "),
  new Country("Bosnia and Herzegovina",
                                "BA", "0  3n 3n", "0   8n  2n"),
  new Country("Belgium",        "BE", "0  3n 0 ", "0   7n  2n"),
  new Country("Bulgaria",       "BG", "0  4a 4n", "2n  8   0 "),
  new Country("Switzerland",    "CH", "0  5n 0 ", "0  12   0 "),
  new Country("Cyprus",         "CY", "0  3n 5n", "0  16   0 "),
  new Country("Czech Republic", "CZ", "0  4n 0 ", "0  16n  0 "),
  new Country("Germany",        "DE", "0  8n 0 ", "0  10n  0 "),
  new Country("Denmark",        "DK", "0  4n 0 ", "0   9n  1n"),
  new Country("Estonia",        "EE", "0  2n 0 ", "2n 11n  1n"),
  new Country("Spain",          "ES", "0  4n 4n", "2n 10n  0 "),
  new Country("Finland",        "FI", "0  6n 0 ", "0   7n  1n"),
  new Country("Faroe Islands",  "FO", "0  4n 0 ", "0   9n  1n"),
  new Country("France",         "FR", "0  5n 5n", "0  11   2n"),
  new Country("United Kingdom", "GB", "0  4a 6n", "0   8n  0 "),
  new Country("Georgia",        "GE", "0  2a 0 ", "0  16n  0 "),
  new Country("Gibraltar",      "GI", "0  4a 0 ", "0  15   0 "),
  new Country("Greenland",      "GL", "0  4n 0 ", "0   9n  1n"),
  new Country("Greece",         "GR", "0  3n 4n", "0  16   0 "),
  new Country("Croatia",        "HR", "0  7n 0 ", "0  10n  0 "),
  new Country("Hungary",        "HU", "0  3n 4n", "1n 15n  1n"),
  new Country("Ireland",        "IE", "0  4a 6n", "0   8n  0 "),
  new Country("Israel",         "IL", "0  3n 3n", "0  13n  0 "),
  new Country("Iceland",        "IS", "0  4n 0 ", "2n 16n  0 "),
  new Country("Italy",          "IT", "1a 5n 5n", "0  12   0 "),
  new Country("Lebanon",        "LB", "0  4n 0 ", "0  20   0 "),
  new Country("Liechtenstein",  "LI", "0  5n 0 ", "0  12   0 "),
  new Country("Lithuania",      "LT", "0  5n 0 ", "0  11n  0 "),
  new Country("Luxembourg",     "LU", "0  3n 0 ", "0  13   0 "),
  new Country("Latvia",         "LV", "0  4a 0 ", "0  13   0 "),
  new Country("Monaco",         "MC", "0  5n 5n", "0  11   2n"),
  new Country("Montenegro",     "ME", "0  3n 0 ", "0  13n  2n"),
  new Country("Macedonia, Former Yugoslav Republic of",
                                "MK", "0  3n 0 ", "0  10   2n"),
  new Country("Mauritania",     "MR", "0  5n 5n", "0  11n  2n"),
  new Country("Malta",          "MT", "0  4a 5n", "0  18   0 "),
  new Country("Mauritius",      "MU", "0  4a 4n", "0  15n  3a"),
  new Country("Netherlands",    "NL", "0  4a 0 ", "0  10n  0 "),
  new Country("Norway",         "NO", "0  4n 0 ", "0   6n  1n"),
  new Country("Poland",         "PL", "0  8n 0 ", "0  16n  0 "),
  new Country("Portugal",       "PT", "0  4n 4n", "0  11n  2n"),
  new Country("Romania",        "RO", "0  4a 0 ", "0  16   0 "),
  new Country("Serbia",         "RS", "0  3n 0 ", "0  13n  2n"),
  new Country("Saudi Arabia",   "SA", "0  2n 0 ", "0  18   0 "),
  new Country("Sweden",         "SE", "0  3n 0 ", "0  16n  1n"),
  new Country("Slovenia",       "SI", "0  5n 0 ", "0   8n  2n"),
  new Country("Slovak Republic",
                                "SK", "0  4n 0 ", "0  16n  0 "),
  new Country("San Marino",     "SM", "1a 5n 5n", "0  12   0 "),
  new Country("Tunisia",        "TN", "0  2n 3n", "0  13n  2n"),
  new Country("Turkey",         "TR", "0  5n 0 ", "1  16   0 "));

// Search the country code in the iban_data list.
function CountryData(code)
{
  for (var i = 0; i < iban_data.length; ++i)
    if (iban_data[i].code == code)
      return iban_data[i];
  return null;
}

// Modulo 97 for huge numbers given as digit strings.
function mod97(digit_string)
{
  var m = 0;
  for (var i = 0; i < digit_string.length; ++i)
    m = (m * 10 + parseInt(digit_string.charAt(i))) % 97;
  return m;
}

// Convert a capital letter into digits: A -> 10 ... Z -> 35 (ISO 13616).
function capital2digits(ch)
{
  var capitals = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  for (var i = 0; i < capitals.length; ++i)
    if (ch == capitals.charAt(i))
      break;
  return i + 10;
}

// Fill the string with leading zeros until length is reached.
function fill0(s, l)
{
  while (s.length < l)
    s = "0" + s;
  return s;
}

// Compare two strings respecting german umlauts.
function strcmp(s1, s2)
{
  var chars = "Aa��BbCcDdEeFfGgHhIiJjKkLlMmNnOo��PpQqRrSs�TtUu��VvWwXxYyZz";
  var lng = (s1.length < s2.length) ? s1.length : s2.length;
  for (var i = 0; i < lng; ++i)
  {
    var d = chars.indexOf(s1.charAt(i)) - chars.indexOf(s2.charAt(i));
    if (d != 0)
      return d;
  }
  return s1.length - s2.length;
}

// Create an index table of the iban_data list sorted by country names.
function CountryIndexTable()
{
  var tab = new Array();
  var i, j, t;
  for (i = 0; i < iban_data.length; ++i)
    tab[i] = i;
  for (i = tab.length - 1; i > 0; --i)
    for (j = 0; j < i; ++j)
      if (strcmp(iban_data[tab[j]].name, iban_data[tab[j+1]].name) > 0)
        t = tab[j], tab[j] = tab[j+1], tab[j+1] = t;
  return tab;
}

// Calculate 2-digit checksum of an IBAN.
function ChecksumIBAN(iban)
{
  var code     = iban.substring(0, 2);
  var checksum = iban.substring(2, 4);
  var bban     = iban.substring(4);

  // Assemble digit string
  var digits = "";
  for (var i = 0; i < bban.length; ++i)
  {
    var ch = bban.charAt(i).toUpperCase();
    if ("0" <= ch && ch <= "9")
      digits += ch;
    else
      digits += capital2digits(ch);
  }
  for (var i = 0; i < code.length; ++i)
  {
    var ch = code.charAt(i);
    digits += capital2digits(ch);
  }
  digits += checksum;

  // Calculate checksum
  checksum = 98 - mod97(digits);
  return fill0("" + checksum, 2);
}

// Fill the account number part of IBAN with leading zeros.
function FillAccount(country, account)
{
  return fill0(account, country.acc_lng);
}

// Check if syntax of the part of IBAN is invalid.
function InvalidPart(form_list, iban_part)
{
  for (var f = 0; f < form_list.length; ++f)
  {
    var lng = form_list[f][0], typ = form_list[f][1];
    if (lng > iban_part.length)
      lng = iban_part.length;
    for (var i = 0; i < lng; ++i)
    {
      var ch = iban_part.charAt(i);
      var a = ("A" <= ch && ch <= "Z");
      var n = ("0" <= ch && ch <= "9");
      var c = n || a || ("a" <= ch && ch <= "z");
      if ((!c && typ == "c") || (!a && typ == "a") || (!n && typ == "n"))
        return true;
    }
    iban_part = iban_part.substring(lng);
  }
  return false;
}

// Check if length of the bank/branch code part of IBAN is invalid.
function InvalidBankLength(country, bank)
{
  return (bank.length != country.bank_lng);
}

// Check if syntax of the bank/branch code part of IBAN is invalid.
function InvalidBank(country, bank)
{
  return (InvalidBankLength(country, bank) ||
          InvalidPart(country.bank, bank));
}

// Check if length of the account number part of IBAN is invalid.
function InvalidAccountLength(country, account)
{
  return (account.length < 1 || account.length > country.acc_lng);
}

// Check if syntax of the account number part of IBAN is invalid.
function InvalidAccount(country, account)
{
  return (InvalidAccountLength(country, account) ||
          InvalidPart(country.acc, FillAccount(country, account)));
}

// Check if length of IBAN is invalid.
function InvalidIBANlength(country, iban)
{
  return (iban.length != country.total_lng);
}

// Convert iban from intern value to string format (IBAN XXXX XXXX ...).
function extern(intern)
{
  var s = "IBAN";
  for (var i = 0; i < intern.length; ++i)
  {
    if (i % 4 == 0)
      s += " ";
    s += intern.charAt(i);
  }
  return s;
}

// Convert iban from string format to intern value.
function intern(extern)
{
  if (extern.substring(0, 4) == "IBAN")
    extern = extern.substring(4);
  var s = "";
  for (var i = 0; i < extern.length; ++i)
    if (extern.charAt(i) != " ")
      s += extern.charAt(i);
  return s;
}

// Calculate the checksum and assemble the IBAN.
function CalcIBAN(country, bank, account)
{
  var fill_acc = FillAccount(country, account);
  var checksum = ChecksumIBAN(country.code + "00" + bank + fill_acc);
  return country.code + checksum + bank + fill_acc;
}

function CalcAltIBAN(country, bank, account)
{
  var fill_acc = FillAccount(country, account);
  var checksum = ChecksumIBAN(country.code + "00" + bank + fill_acc);
  checksum = fill0("" + mod97(checksum), 2);
  return country.code + checksum + bank + fill_acc;
}

// Check the checksum of an IBAN.
function IBANokay(iban)
{
  return ChecksumIBAN(iban) == "97";
}

// Check the input, calculate the checksum and assemble the IBAN.
function CreateIBAN()
{
  var form = document.ibanform;
  var code = form.country.options[form.country.selectedIndex].value;
  var bank = intern(form.bank.value);
  var account = intern(form.account.value);
  var country = CountryData(code);

  var err = null, err_focus = null;
  if (country == null)
  {
    err = _("Unknown Country Code: ") + code;
    err_focus = form.country;
  }
  else if (InvalidBankLength(country, bank))
  {
    err = _("Bank/Branch Code length ") + bank.length +
          _(" is not correct for ") + country.name +
          " (" + country.bank_lng + ")";
    err_focus = form.bank;
  }
  else if (InvalidBank(country, bank))
  {
    err = _("Bank/Branch Code ") + bank + _(" is not correct for ") +
          country.name;
    err_focus = form.bank;
  }
  else if (InvalidAccountLength(country, account))
  {
    err = _("Account Number length ") + account.length +
          _(" is not correct for ") + country.name +
          " (" + country.acc_lng + ")";
    err_focus = form.account;
  }
  else if (InvalidAccount(country, account))
  {
    err = _("Account Number ") + account + _(" is not correct for ") +
          country.name;
    err_focus = form.account;
  }

  if (err)
  {
    // Set error image on BBAN side
    document.bban_img.src = error_img.src;
    document.iban_img.src = blank_img.src;

    // Clear destination fields, set focus to wrong field
    form.iban.value = "";
    form.alt_iban.value = "";
    err_focus.focus();

    // Show message box with error message
    alert(err);
  }
  else
  {
    // Set okay image on IBAN side
    document.iban_img.src = okay_img.src;
    document.bban_img.src = blank_img.src;

    // Calculate IBAN, write results in form fields
    form.bank.value = bank;
    form.account.value = FillAccount(country, account);
    form.iban.value = extern(CalcIBAN(country, bank, account));

    // Calculate alternative IBAN, write warning if not the same
    form.alt_iban.value = extern(CalcAltIBAN(country, bank, account));
    if (form.alt_iban.value != form.iban.value)
      form.alt_iban.value += " (*)";
    else
      form.alt_iban.value = "";

    // Check for dispensable global variables in debug modus
    if (debug_output)
      debug_check_vars();
  }
}

// Check the syntax and the checksum of the IBAN.
function ibanCheck(ibanElem, msgElem)
{
  var form =  {'iban': ibanElem};
  var thevalueiban= document.getElementById('iban').value ;
  var iban = intern(thevalueiban);

  var code     = iban.substring(0, 2);
  var checksum = iban.substring(2, 4);
  var bban     = iban.substring(4);
  var country  = CountryData(code);

  var err = null;
  if (country == null)
    err = _("Unknown Country Code: ") + code;
  else if (InvalidIBANlength(country, iban))
    err = _("IBAN length ") + iban.length + _(" is not correct for ") +
          country.name + " (" + country.total_lng + ")";
  else
  {
    var bank_lng = country.bank_lng;
    var bank     = bban.substring(0, bank_lng);
    var account  = bban.substring(bank_lng);

    if (InvalidBank(country, bank))
      err = _("Bank/Branch Code ") + bank + _(" is not correct for ") +
            country.name;
    else if (InvalidAccount(country, account))
      err = _("Account Number ") + account + _(" is not correct for ") +
            country.name;
    else if (!IBANokay(iban))
      err = _("Checksum of IBAN incorrect");
  }

  if (err)
  {
      document.getElementById('iban_ok').style.display="none";
      inlineMsg('iban',2,20,'Votre Iban semble incorrect.');
      document.getElementById('msgcontent').className="msgcontent1";
      document.getElementById('msgtoto').className="msg1";
      
	/*$(msgElem).text(err);*/


  }
  else
  {
    document.getElementById('iban_ok').style.display="";
    document.getElementById('msgtoto').style.display="none";
	/*$(msgElem).text('IBAN valide.');*/
  }
}


// Check the syntax and the checksum of the IBAN.
function CheckIBAN()
{
  var form = document.ibanform;
  var iban = intern(form.iban.value);

  var code     = iban.substring(0, 2);
  var checksum = iban.substring(2, 4);
  var bban     = iban.substring(4);
  var country  = CountryData(code);

  var err = null;
  if (country == null)
    err = _("Unknown Country Code: ") + code;
  else if (InvalidIBANlength(country, iban))
    err = _("IBAN length ") + iban.length + _(" is not correct for ") +
          country.name + " (" + country.total_lng + ")";
  else
  {
    var bank_lng = country.bank_lng;
    var bank     = bban.substring(0, bank_lng);
    var account  = bban.substring(bank_lng);

    if (InvalidBank(country, bank))
      err = _("Bank/Branch Code ") + bank + _(" is not correct for ") +
            country.name;
    else if (InvalidAccount(country, account))
      err = _("Account Number ") + account + _(" is not correct for ") +
            country.name;
    else if (!IBANokay(iban))
      err = _("Checksum of IBAN incorrect");
  }

  if (err)
  {
    // Set error image on IBAN side
    document.iban_img.src = error_img.src;
    document.bban_img.src = blank_img.src;

    // Clear destination fields, set focus to wrong field
    form.country.selectedIndex = 0;
    form.bank.value = "";
    form.account.value = "";
    form.alt_iban.value = "";
    form.iban.focus();

    // Show message box with error message
    alert(err);
  }
  else
  {
    // Set okay image on BBAN side
    document.bban_img.src = okay_img.src;
    document.iban_img.src = blank_img.src;

    // Write results in form fields
    form.iban.value = extern(iban);
    for (var i = form.country.options.length - 1; i > 0; --i)
      if (form.country.options[i].value == code)
        break;
    form.country.selectedIndex = i;
    form.bank.value = bank;
    form.account.value = account;

    // Calculate alternative IBAN, write warning if not the same
    form.alt_iban.value = extern(CalcAltIBAN(country, bank, account));
    if (form.alt_iban.value != form.iban.value)
      form.alt_iban.value += " (*)";
    else
      form.alt_iban.value = "";

    // Check for dispensable global variables in debug modus
    if (debug_output)
      debug_check_vars();
  }
}


// Examples of IBANs for each country.
var examples = new Array(
  new Array("AD", "00012030",    "200359100100",         "12"),
  new Array("AL", "21211009",    "0000000235698741",     "47"),
  new Array("AT", "19043",       "00234573201",          "61"),
  new Array("BA", "129007",      "9401028494",           "39"),
  new Array("BE", "539",         "007547034",            "68"),
  new Array("BG", "BNBG9661",    "1020345678",           "80"),
  new Array("CH", "00762",       "011623852957",         "93"),
  new Array("CY", "00200128",    "0000001200527600",     "17"),
  new Array("CZ", "0800",        "0000192000145399",     "65"),
  new Array("DE", "37040044",    "0532013000",           "89"),
  new Array("DK", "0040",        "0440116243",           "50"),
  new Array("EE", "22",          "00221020145685",       "38"),
  new Array("ES", "21000418",    "450200051332",         "91"),
  new Array("FI", "123456",      "00000785",             "21"),
  new Array("FO", "6460",        "0001631634",           "62"),
  new Array("FR", "2004101005",  "0500013M02606",        "14"),
  new Array("GB", "NWBK601613",  "31926819",             "29"),
  new Array("GE", "NB",          "0000000101904917",     "29"),
  new Array("GI", "NWBK",        "000000007099453",      "75"),
  new Array("GL", "6471",        "0001000206",           "89"),
  new Array("GR", "0110125",     "0000000012300695",     "16"),
  new Array("HR", "1001005",     "1863000160",           "12"),
  new Array("HU", "1177301",     "61111101800000000",    "42"),
  new Array("IE", "AIBK931152",  "12345678",             "29"),
  new Array("IL", "010800",      "0000099999999",        "62"),
  new Array("IS", "0159",        "260076545510730339",   "14"),
  new Array("IT", "X0542811101", "000000123456",         "60"),
  new Array("LB", "0999",        "00000001001901229114", "62"),
  new Array("LI", "08810",       "0002324013AA",         "21"),
  new Array("LT", "10000",       "11101001000",          "12"),
  new Array("LU", "001",         "9400644750000",        "28"),
  new Array("LV", "BANK",        "0000435195001",        "80"),
  new Array("MC", "1273900070",  "0011111000h79",        "11"),
  new Array("ME", "505",         "000012345678951",      "25"),
  new Array("MK", "250",         "120000058984",         "07"),
  new Array("MR", "0002000101",  "0000123456753",        "13"),
  new Array("MT", "MALT01100",   "0012345MTLCAST001S",   "84"),
  new Array("MU", "BOMM0101",    "101030300200000MUR",   "17"),
  new Array("NL", "ABNA",        "0417164300",           "91"),
  new Array("NO", "8601",        "1117947",              "93"),
  new Array("PL", "10901014",    "0000071219812874",     "61"),
  new Array("PT", "00020123",    "1234567890154",        "50"),
  new Array("RO", "AAAA",        "1B31007593840000",     "49"),
  new Array("RS", "260",         "005601001611379",      "35"),
  new Array("SA", "80",          "000000608010167519",   "03"),
  new Array("SE", "500",         "00000058398257466",    "45"),
  new Array("SI", "19100",       "0000123438",           "56"),
  new Array("SK", "1200",        "0000198742637541",     "31"),
  new Array("SM", "U0322509800", "000000270100",         "86"),
  new Array("TN", "10006",       "035183598478831",      "59"),
  new Array("TR", "00061",       "00519786457841326",    "33"));

// Test data for each country.
var test_data = new Array(
  new Array("XY", "1",           "2",                    "33"),
  new Array("AD", "11112222",    "C3C3C3C3C3C3",         "11"),
  new Array("AD", "1111222",     "C3C3C3C3C3C3",         "11"),
  new Array("AD", "X1112222",    "C3C3C3C3C3C3",         "11"),
  new Array("AD", "111@2222",    "C3C3C3C3C3C3",         "11"),
  new Array("AD", "1111X222",    "C3C3C3C3C3C3",         "11"),
  new Array("AD", "1111222@",    "C3C3C3C3C3C3",         "11"),
  new Array("AD", "11112222",    "@3C3C3C3C3C3",         "11"),
  new Array("AD", "11112222",    "C3C3C3C3C3C@",         "11"),
  new Array("AL", "11111111",    "B2B2B2B2B2B2B2B2",     "54"),
  new Array("AL", "1111111",     "B2B2B2B2B2B2B2B2",     "54"),
  new Array("AL", "X1111111",    "B2B2B2B2B2B2B2B2",     "54"),
  new Array("AL", "1111111@",    "B2B2B2B2B2B2B2B2",     "54"),
  new Array("AL", "11111111",    "@2B2B2B2B2B2B2B2",     "54"),
  new Array("AL", "11111111",    "B2B2B2B2B2B2B2B@",     "54"),
  new Array("AT", "11111",       "22222222222",          "17"),
  new Array("AT", "1111",        "22222222222",          "17"),
  new Array("AT", "X1111",       "22222222222",          "17"),
  new Array("AT", "1111@",       "22222222222",          "17"),
  new Array("AT", "11111",       "X2222222222",          "17"),
  new Array("AT", "11111",       "2222222222@",          "17"),
  new Array("BA", "111222",      "3333333344",           "79"),
  new Array("BA", "11122",       "3333333344",           "79"),
  new Array("BA", "X11222",      "3333333344",           "79"),
  new Array("BA", "11@222",      "3333333344",           "79"),
  new Array("BA", "111X22",      "3333333344",           "79"),
  new Array("BA", "11122@",      "3333333344",           "79"),
  new Array("BA", "111222",      "X333333344",           "79"),
  new Array("BA", "111222",      "3333333@44",           "79"),
  new Array("BA", "111222",      "33333333X4",           "79"),
  new Array("BA", "111222",      "333333334@",           "79"),
  new Array("BE", "111",         "222222233",            "93"),
  new Array("BE", "11",          "222222233",            "93"),
  new Array("BE", "X11",         "222222233",            "93"),
  new Array("BE", "11@",         "222222233",            "93"),
  new Array("BE", "111",         "X22222233",            "93"),
  new Array("BE", "111",         "222222@33",            "93"),
  new Array("BE", "111",         "2222222X3",            "93"),
  new Array("BE", "111",         "22222223@",            "93"),
  new Array("BG", "AAAA2222",    "33D4D4D4D4",           "20"),
  new Array("BG", "AAAA222",     "33D4D4D4D4",           "20"),
  new Array("BG", "8AAA2222",    "33D4D4D4D4",           "20"),
  new Array("BG", "AAA@2222",    "33D4D4D4D4",           "20"),
  new Array("BG", "AAAAX222",    "33D4D4D4D4",           "20"),
  new Array("BG", "AAAA222@",    "33D4D4D4D4",           "20"),
  new Array("BG", "AAAA2222",    "X3D4D4D4D4",           "20"),
  new Array("BG", "AAAA2222",    "3@D4D4D4D4",           "20"),
  new Array("BG", "AAAA2222",    "33@4D4D4D4",           "20"),
  new Array("BG", "AAAA2222",    "33D4D4D4D@",           "20"),
  new Array("CH", "11111",       "B2B2B2B2B2B2",         "60"),
  new Array("CH", "1111",        "B2B2B2B2B2B2",         "60"),
  new Array("CH", "X1111",       "B2B2B2B2B2B2",         "60"),
  new Array("CH", "1111@",       "B2B2B2B2B2B2",         "60"),
  new Array("CH", "11111",       "@2B2B2B2B2B2",         "60"),
  new Array("CH", "11111",       "B2B2B2B2B2B@",         "60"),
  new Array("CY", "11122222",    "C3C3C3C3C3C3C3C3",     "29"),
  new Array("CY", "1112222",     "C3C3C3C3C3C3C3C3",     "29"),
  new Array("CY", "X1122222",    "C3C3C3C3C3C3C3C3",     "29"),
  new Array("CY", "11@22222",    "C3C3C3C3C3C3C3C3",     "29"),
  new Array("CY", "111X2222",    "C3C3C3C3C3C3C3C3",     "29"),
  new Array("CY", "1112222@",    "C3C3C3C3C3C3C3C3",     "29"),
  new Array("CY", "11122222",    "@3C3C3C3C3C3C3C3",     "29"),
  new Array("CY", "11122222",    "C3C3C3C3C3C3C3C@",     "29"),
  new Array("CZ", "1111",        "2222222222222222",     "68"),
  new Array("CZ", "111",         "2222222222222222",     "68"),
  new Array("CZ", "X111",        "2222222222222222",     "68"),
  new Array("CZ", "111@",        "2222222222222222",     "68"),
  new Array("CZ", "1111",        "X222222222222222",     "68"),
  new Array("CZ", "1111",        "222222222222222@",     "68"),
  new Array("DE", "11111111",    "2222222222",           "16"),
  new Array("DE", "1111111",     "2222222222",           "16"),
  new Array("DE", "X1111111",    "2222222222",           "16"),
  new Array("DE", "1111111@",    "2222222222",           "16"),
  new Array("DE", "11111111",    "X222222222",           "16"),
  new Array("DE", "11111111",    "222222222@",           "16"),
  new Array("DK", "1111",        "2222222223",           "79"),
  new Array("DK", "111",         "2222222223",           "79"),
  new Array("DK", "X111",        "2222222223",           "79"),
  new Array("DK", "111@",        "2222222223",           "79"),
  new Array("DK", "1111",        "X222222223",           "79"),
  new Array("DK", "1111",        "22222222@3",           "79"),
  new Array("DK", "1111",        "222222222X",           "79"),
  new Array("EE", "11",          "22333333333334",       "96"),
  new Array("EE", "1",           "22333333333334",       "96"),
  new Array("EE", "X1",          "22333333333334",       "96"),
  new Array("EE", "1@",          "22333333333334",       "96"),
  new Array("EE", "11",          "X2333333333334",       "96"),
  new Array("EE", "11",          "2@333333333334",       "96"),
  new Array("EE", "11",          "22X33333333334",       "96"),
  new Array("EE", "11",          "223333333333@4",       "96"),
  new Array("EE", "11",          "2233333333333X",       "96"),
  new Array("ES", "11112222",    "334444444444",         "71"),
  new Array("ES", "1111222",     "334444444444",         "71"),
  new Array("ES", "X1112222",    "334444444444",         "71"),
  new Array("ES", "111@2222",    "334444444444",         "71"),
  new Array("ES", "1111X222",    "334444444444",         "71"),
  new Array("ES", "1111222@",    "334444444444",         "71"),
  new Array("ES", "11112222",    "X34444444444",         "71"),
  new Array("ES", "11112222",    "3@4444444444",         "71"),
  new Array("ES", "11112222",    "33X444444444",         "71"),
  new Array("ES", "11112222",    "33444444444@",         "71"),
  new Array("FI", "111111",      "22222223",             "68"),
  new Array("FI", "11111",       "22222223",             "68"),
  new Array("FI", "X11111",      "22222223",             "68"),
  new Array("FI", "11111@",      "22222223",             "68"),
  new Array("FI", "111111",      "X2222223",             "68"),
  new Array("FI", "111111",      "222222@3",             "68"),
  new Array("FI", "111111",      "2222222X",             "68"),
  new Array("FO", "1111",        "2222222223",           "49"),
  new Array("FO", "111",         "2222222223",           "49"),
  new Array("FO", "X111",        "2222222223",           "49"),
  new Array("FO", "111@",        "2222222223",           "49"),
  new Array("FO", "1111",        "X222222223",           "49"),
  new Array("FO", "1111",        "22222222@3",           "49"),
  new Array("FO", "1111",        "222222222X",           "49"),
  new Array("FR", "1111122222",  "C3C3C3C3C3C44",        "44"),
  new Array("FR", "111112222",   "C3C3C3C3C3C44",        "44"),
  new Array("FR", "X111122222",  "C3C3C3C3C3C44",        "44"),
  new Array("FR", "1111@22222",  "C3C3C3C3C3C44",        "44"),
  new Array("FR", "11111X2222",  "C3C3C3C3C3C44",        "44"),
  new Array("FR", "111112222@",  "C3C3C3C3C3C44",        "44"),
  new Array("FR", "1111122222",  "@3C3C3C3C3C44",        "44"),
  new Array("FR", "1111122222",  "C3C3C3C3C3@44",        "44"),
  new Array("FR", "1111122222",  "C3C3C3C3C3CX4",        "44"),
  new Array("FR", "1111122222",  "C3C3C3C3C3C4@",        "44"),
  new Array("GB", "AAAA222222",  "33333333",             "45"),
  new Array("GB", "AAAA22222",   "33333333",             "45"),
  new Array("GB", "8AAA222222",  "33333333",             "45"),
  new Array("GB", "AAA@222222",  "33333333",             "45"),
  new Array("GB", "AAAAX22222",  "33333333",             "45"),
  new Array("GB", "AAAA22222@",  "33333333",             "45"),
  new Array("GB", "AAAA222222",  "X3333333",             "45"),
  new Array("GB", "AAAA222222",  "3333333@",             "45"),
  new Array("GE", "AA",          "2222222222222222",     "98"),
  new Array("GE", "A",           "2222222222222222",     "98"),
  new Array("GE", "8A",          "2222222222222222",     "98"),
  new Array("GE", "A@",          "2222222222222222",     "98"),
  new Array("GE", "AA",          "X222222222222222",     "98"),
  new Array("GE", "AA",          "222222222222222@",     "98"),
  new Array("GI", "AAAA",        "B2B2B2B2B2B2B2B",      "72"),
  new Array("GI", "AAA",         "B2B2B2B2B2B2B2B",      "72"),
  new Array("GI", "8AAA",        "B2B2B2B2B2B2B2B",      "72"),
  new Array("GI", "AAA@",        "B2B2B2B2B2B2B2B",      "72"),
  new Array("GI", "AAAA",        "@2B2B2B2B2B2B2B",      "72"),
  new Array("GI", "AAAA",        "B2B2B2B2B2B2B2@",      "72"),
  new Array("GL", "1111",        "2222222223",           "49"),
  new Array("GL", "111",         "2222222223",           "49"),
  new Array("GL", "X111",        "2222222223",           "49"),
  new Array("GL", "111@",        "2222222223",           "49"),
  new Array("GL", "1111",        "X222222223",           "49"),
  new Array("GL", "1111",        "22222222@3",           "49"),
  new Array("GL", "1111",        "222222222X",           "49"),
  new Array("GR", "1112222",     "C3C3C3C3C3C3C3C3",     "61"),
  new Array("GR", "111222",      "C3C3C3C3C3C3C3C3",     "61"),
  new Array("GR", "X112222",     "C3C3C3C3C3C3C3C3",     "61"),
  new Array("GR", "11@2222",     "C3C3C3C3C3C3C3C3",     "61"),
  new Array("GR", "111X222",     "C3C3C3C3C3C3C3C3",     "61"),
  new Array("GR", "111222@",     "C3C3C3C3C3C3C3C3",     "61"),
  new Array("GR", "1112222",     "@3C3C3C3C3C3C3C3",     "61"),
  new Array("GR", "1112222",     "C3C3C3C3C3C3C3C@",     "61"),
  new Array("HR", "1111111",     "2222222222",           "94"),
  new Array("HR", "111111",      "2222222222",           "94"),
  new Array("HR", "X111111",     "2222222222",           "94"),
  new Array("HR", "111111@",     "2222222222",           "94"),
  new Array("HR", "1111111",     "X222222222",           "94"),
  new Array("HR", "1111111",     "222222222@",           "94"),
  new Array("HU", "1112222",     "34444444444444445",    "35"),
  new Array("HU", "111222",      "34444444444444445",    "35"),
  new Array("HU", "X112222",     "34444444444444445",    "35"),
  new Array("HU", "11@2222",     "34444444444444445",    "35"),
  new Array("HU", "111X222",     "34444444444444445",    "35"),
  new Array("HU", "111222@",     "34444444444444445",    "35"),
  new Array("HU", "1112222",     "X4444444444444445",    "35"),
  new Array("HU", "1112222",     "3X444444444444445",    "35"),
  new Array("HU", "1112222",     "344444444444444@5",    "35"),
  new Array("HU", "1112222",     "3444444444444444X",    "35"),
  new Array("IE", "AAAA222222",  "33333333",             "18"),
  new Array("IE", "AAAA22222",   "33333333",             "18"),
  new Array("IE", "8AAA222222",  "33333333",             "18"),
  new Array("IE", "AAA@222222",  "33333333",             "18"),
  new Array("IE", "AAAAX22222",  "33333333",             "18"),
  new Array("IE", "AAAA22222@",  "33333333",             "18"),
  new Array("IE", "AAAA222222",  "X3333333",             "18"),
  new Array("IE", "AAAA222222",  "3333333@",             "18"),
  new Array("IL", "111222",      "3333333344",           "64"),
  new Array("IL", "11122",       "3333333344",           "64"),
  new Array("IL", "X11222",      "3333333344",           "64"),
  new Array("IL", "11@222",      "3333333344",           "64"),
  new Array("IL", "111X22",      "3333333344",           "64"),
  new Array("IL", "11122@",      "3333333344",           "64"),
  new Array("IL", "111222",      "X333333333333",        "64"),
  new Array("IL", "111222",      "333333333333@",        "64"),
  new Array("IS", "1111",        "223333333333333333",   "12"),
  new Array("IS", "111",         "223333333333333333",   "12"),
  new Array("IS", "X111",        "223333333333333333",   "12"),
  new Array("IS", "111@",        "223333333333333333",   "12"),
  new Array("IS", "1111",        "X23333333333333333",   "12"),
  new Array("IS", "1111",        "2@3333333333333333",   "12"),
  new Array("IS", "1111",        "22X333333333333333",   "12"),
  new Array("IS", "1111",        "22333333333333333@",   "12"),
  new Array("IT", "A2222233333", "D4D4D4D4D4D4",         "43"),
  new Array("IT", "A222223333",  "D4D4D4D4D4D4",         "43"),
  new Array("IT", "82222233333", "D4D4D4D4D4D4",         "43"),
  new Array("IT", "AX222233333", "D4D4D4D4D4D4",         "43"),
  new Array("IT", "A2222@33333", "D4D4D4D4D4D4",         "43"),
  new Array("IT", "A22222X3333", "D4D4D4D4D4D4",         "43"),
  new Array("IT", "A222223333@", "D4D4D4D4D4D4",         "43"),
  new Array("IT", "A2222233333", "@4D4D4D4D4D4",         "43"),
  new Array("IT", "A2222233333", "D4D4D4D4D4D@",         "43"),
  new Array("LB", "1111",        "B2B2B2B2B2B2B2B2B2B2", "88"),
  new Array("LB", "111",         "B2B2B2B2B2B2B2B2B2B2", "88"),
  new Array("LB", "X111",        "B2B2B2B2B2B2B2B2B2B2", "88"),
  new Array("LB", "111@",        "B2B2B2B2B2B2B2B2B2B2", "88"),
  new Array("LB", "1111",        "@2B2B2B2B2B2B2B2B2B2", "88"),
  new Array("LB", "1111",        "B2B2B2B2B2B2B2B2B2B@", "88"),
  new Array("LI", "11111",       "B2B2B2B2B2B2",         "73"),
  new Array("LI", "1111",        "B2B2B2B2B2B2",         "73"),
  new Array("LI", "X1111",       "B2B2B2B2B2B2",         "73"),
  new Array("LI", "1111@",       "B2B2B2B2B2B2",         "73"),
  new Array("LI", "11111",       "@2B2B2B2B2B2",         "73"),
  new Array("LI", "11111",       "B2B2B2B2B2B@",         "73"),
  new Array("LT", "11111",       "22222222222",          "15"),
  new Array("LT", "1111",        "22222222222",          "15"),
  new Array("LT", "X1111",       "22222222222",          "15"),
  new Array("LT", "1111@",       "22222222222",          "15"),
  new Array("LT", "11111",       "X2222222222",          "15"),
  new Array("LT", "11111",       "2222222222@",          "15"),
  new Array("LU", "111",         "B2B2B2B2B2B2B",        "27"),
  new Array("LU", "11",          "B2B2B2B2B2B2B",        "27"),
  new Array("LU", "X11",         "B2B2B2B2B2B2B",        "27"),
  new Array("LU", "11@",         "B2B2B2B2B2B2B",        "27"),
  new Array("LU", "111",         "@2B2B2B2B2B2B",        "27"),
  new Array("LU", "111",         "B2B2B2B2B2B2@",        "27"),
  new Array("LV", "AAAA",        "B2B2B2B2B2B2B",        "86"),
  new Array("LV", "AAA",         "B2B2B2B2B2B2B",        "86"),
  new Array("LV", "8AAA",        "B2B2B2B2B2B2B",        "86"),
  new Array("LV", "AAA@",        "B2B2B2B2B2B2B",        "86"),
  new Array("LV", "AAAA",        "@2B2B2B2B2B2B",        "86"),
  new Array("LV", "AAAA",        "B2B2B2B2B2B2@",        "86"),
  new Array("MC", "1111122222",  "C3C3C3C3C3C44",        "26"),
  new Array("MC", "111112222",   "C3C3C3C3C3C44",        "26"),
  new Array("MC", "X111122222",  "C3C3C3C3C3C44",        "26"),
  new Array("MC", "1111@22222",  "C3C3C3C3C3C44",        "26"),
  new Array("MC", "11111X2222",  "C3C3C3C3C3C44",        "26"),
  new Array("MC", "111112222@",  "C3C3C3C3C3C44",        "26"),
  new Array("MC", "1111122222",  "@3C3C3C3C3C44",        "26"),
  new Array("MC", "1111122222",  "C3C3C3C3C3@44",        "26"),
  new Array("MC", "1111122222",  "C3C3C3C3C3CX4",        "26"),
  new Array("MC", "1111122222",  "C3C3C3C3C3C4@",        "26"),
  new Array("ME", "111",         "222222222222233",      "38"),
  new Array("ME", "11",          "222222222222233",      "38"),
  new Array("ME", "X11",         "222222222222233",      "38"),
  new Array("ME", "11@",         "222222222222233",      "38"),
  new Array("ME", "111",         "X22222222222233",      "38"),
  new Array("ME", "111",         "222222222222@33",      "38"),
  new Array("ME", "111",         "2222222222222X3",      "38"),
  new Array("ME", "111",         "22222222222223@",      "38"),
  new Array("MK", "111",         "B2B2B2B2B233",         "41"),
  new Array("MK", "11",          "B2B2B2B2B233",         "41"),
  new Array("MK", "X11",         "B2B2B2B2B233",         "41"),
  new Array("MK", "11@",         "B2B2B2B2B233",         "41"),
  new Array("MK", "111",         "@2B2B2B2B233",         "41"),
  new Array("MK", "111",         "B2B2B2B2B@33",         "41"),
  new Array("MK", "111",         "B2B2B2B2B2X3",         "41"),
  new Array("MK", "111",         "B2B2B2B2B23@",         "41"),
  new Array("MR", "1111122222",  "3333333333344",        "21"),
  new Array("MR", "111112222",   "3333333333344",        "21"),
  new Array("MR", "X111122222",  "3333333333344",        "21"),
  new Array("MR", "1111@22222",  "3333333333344",        "21"),
  new Array("MR", "11111X2222",  "3333333333344",        "21"),
  new Array("MR", "111112222@",  "3333333333344",        "21"),
  new Array("MR", "1111122222",  "X333333333344",        "21"),
  new Array("MR", "1111122222",  "3333333333@44",        "21"),
  new Array("MR", "1111122222",  "33333333333X4",        "21"),
  new Array("MR", "1111122222",  "333333333334@",        "21"),
  new Array("MT", "AAAA22222",   "C3C3C3C3C3C3C3C3C3",   "39"),
  new Array("MT", "AAAA2222",    "C3C3C3C3C3C3C3C3C3",   "39"),
  new Array("MT", "8AAA22222",   "C3C3C3C3C3C3C3C3C3",   "39"),
  new Array("MT", "AAA@22222",   "C3C3C3C3C3C3C3C3C3",   "39"),
  new Array("MT", "AAAAX2222",   "C3C3C3C3C3C3C3C3C3",   "39"),
  new Array("MT", "AAAA2222@",   "C3C3C3C3C3C3C3C3C3",   "39"),
  new Array("MT", "AAAA22222",   "@3C3C3C3C3C3C3C3C3",   "39"),
  new Array("MT", "AAAA22222",   "C3C3C3C3C3C3C3C3C@",   "39"),
  new Array("MU", "AAAA2222",    "333333333333333DDD",   "37"),
  new Array("MU", "AAAA222",     "333333333333333DDD",   "37"),
  new Array("MU", "8AAA2222",    "333333333333333DDD",   "37"),
  new Array("MU", "AAA@2222",    "333333333333333DDD",   "37"),
  new Array("MU", "AAAAX222",    "333333333333333DDD",   "37"),
  new Array("MU", "AAAA222@",    "333333333333333DDD",   "37"),
  new Array("MU", "AAAA2222",    "X33333333333333DDD",   "37"),
  new Array("MU", "AAAA2222",    "33333333333333@DDD",   "37"),
  new Array("MU", "AAAA2222",    "3333333333333338DD",   "37"),
  new Array("MU", "AAAA2222",    "333333333333333DD@",   "37"),
  new Array("NL", "AAAA",        "2222222222",           "57"),
  new Array("NL", "AAA",         "2222222222",           "57"),
  new Array("NL", "8AAA",        "2222222222",           "57"),
  new Array("NL", "AAA@",        "2222222222",           "57"),
  new Array("NL", "AAAA",        "X222222222",           "57"),
  new Array("NL", "AAAA",        "222222222@",           "57"),
  new Array("NO", "1111",        "2222223",              "40"),
  new Array("NO", "111",         "2222223",              "40"),
  new Array("NO", "X111",        "2222223",              "40"),
  new Array("NO", "111@",        "2222223",              "40"),
  new Array("NO", "1111",        "X222223",              "40"),
  new Array("NO", "1111",        "22222@3",              "40"),
  new Array("NO", "1111",        "222222X",              "40"),
  new Array("PL", "11111111",    "2222222222222222",     "84"),
  new Array("PL", "1111111",     "2222222222222222",     "84"),
  new Array("PL", "X1111111",    "2222222222222222",     "84"),
  new Array("PL", "1111111@",    "2222222222222222",     "84"),
  new Array("PL", "11111111",    "X222222222222222",     "84"),
  new Array("PL", "11111111",    "222222222222222@",     "84"),
  new Array("PT", "11112222",    "3333333333344",        "59"),
  new Array("PT", "1111222",     "3333333333344",        "59"),
  new Array("PT", "X1112222",    "3333333333344",        "59"),
  new Array("PT", "111@2222",    "3333333333344",        "59"),
  new Array("PT", "1111X222",    "3333333333344",        "59"),
  new Array("PT", "1111222@",    "3333333333344",        "59"),
  new Array("PT", "11112222",    "X333333333344",        "59"),
  new Array("PT", "11112222",    "3333333333@44",        "59"),
  new Array("PT", "11112222",    "33333333333X4",        "59"),
  new Array("PT", "11112222",    "333333333334@",        "59"),
  new Array("RO", "AAAA",        "B2B2B2B2B2B2B2B2",     "91"),
  new Array("RO", "AAA",         "B2B2B2B2B2B2B2B2",     "91"),
  new Array("RO", "8AAA",        "B2B2B2B2B2B2B2B2",     "91"),
  new Array("RO", "AAA@",        "B2B2B2B2B2B2B2B2",     "91"),
  new Array("RO", "AAAA",        "@2B2B2B2B2B2B2B2",     "91"),
  new Array("RO", "AAAA",        "B2B2B2B2B2B2B2B@",     "91"),
  new Array("RS", "111",         "222222222222233",      "48"),
  new Array("RS", "11",          "222222222222233",      "48"),
  new Array("RS", "X11",         "222222222222233",      "48"),
  new Array("RS", "11@",         "222222222222233",      "48"),
  new Array("RS", "111",         "X22222222222233",      "48"),
  new Array("RS", "111",         "222222222222@33",      "48"),
  new Array("RS", "111",         "2222222222222X3",      "48"),
  new Array("RS", "111",         "22222222222223@",      "48"),
  new Array("SA", "11",          "B2B2B2B2B2B2B2B2B2",   "46"),
  new Array("SA", "1",           "B2B2B2B2B2B2B2B2B2",   "46"),
  new Array("SA", "X1",          "B2B2B2B2B2B2B2B2B2",   "46"),
  new Array("SA", "1@",          "B2B2B2B2B2B2B2B2B2",   "46"),
  new Array("SA", "11",          "@2B2B2B2B2B2B2B2B2",   "46"),
  new Array("SA", "11",          "B2B2B2B2B2B2B2B2B@",   "46"),
  new Array("SE", "111",         "22222222222222223",    "32"),
  new Array("SE", "11",          "22222222222222223",    "32"),
  new Array("SE", "X11",         "22222222222222223",    "32"),
  new Array("SE", "11@",         "22222222222222223",    "32"),
  new Array("SE", "111",         "X2222222222222223",    "32"),
  new Array("SE", "111",         "222222222222222@3",    "32"),
  new Array("SE", "111",         "2222222222222222X",    "32"),
  new Array("SI", "11111",       "2222222233",           "92"),
  new Array("SI", "1111",        "2222222233",           "92"),
  new Array("SI", "X1111",       "2222222233",           "92"),
  new Array("SI", "1111@",       "2222222233",           "92"),
  new Array("SI", "11111",       "X222222233",           "92"),
  new Array("SI", "11111",       "2222222@33",           "92"),
  new Array("SI", "11111",       "22222222X3",           "92"),
  new Array("SI", "11111",       "222222223@",           "92"),
  new Array("SK", "1111",        "2222222222222222",     "66"),
  new Array("SK", "111",         "2222222222222222",     "66"),
  new Array("SK", "X111",        "2222222222222222",     "66"),
  new Array("SK", "111@",        "2222222222222222",     "66"),
  new Array("SK", "1111",        "X222222222222222",     "66"),
  new Array("SK", "1111",        "222222222222222@",     "66"),
  new Array("SM", "A2222233333", "D4D4D4D4D4D4",         "71"),
  new Array("SM", "A222223333",  "D4D4D4D4D4D4",         "71"),
  new Array("SM", "82222233333", "D4D4D4D4D4D4",         "71"),
  new Array("SM", "AX222233333", "D4D4D4D4D4D4",         "71"),
  new Array("SM", "A2222@33333", "D4D4D4D4D4D4",         "71"),
  new Array("SM", "A22222X3333", "D4D4D4D4D4D4",         "71"),
  new Array("SM", "A222223333@", "D4D4D4D4D4D4",         "71"),
  new Array("SM", "A2222233333", "@4D4D4D4D4D4",         "71"),
  new Array("SM", "A2222233333", "D4D4D4D4D4D@",         "71"),
  new Array("TN", "11222",       "333333333333344",      "23"),
  new Array("TN", "1122",        "333333333333344",      "23"),
  new Array("TN", "X1222",       "333333333333344",      "23"),
  new Array("TN", "1@222",       "333333333333344",      "23"),
  new Array("TN", "11X22",       "333333333333344",      "23"),
  new Array("TN", "1122@",       "333333333333344",      "23"),
  new Array("TN", "11222",       "X33333333333344",      "23"),
  new Array("TN", "11222",       "333333333333@44",      "23"),
  new Array("TN", "11222",       "3333333333333X4",      "23"),
  new Array("TN", "11222",       "33333333333334@",      "23"),
  new Array("TR", "11111",       "BC3C3C3C3C3C3C3C3",    "95"),
  new Array("TR", "1111",        "BC3C3C3C3C3C3C3C3",    "95"),
  new Array("TR", "X1111",       "BC3C3C3C3C3C3C3C3",    "95"),
  new Array("TR", "1111@",       "BC3C3C3C3C3C3C3C3",    "95"),
  new Array("TR", "11111",       "@C3C3C3C3C3C3C3C3",    "95"),
  new Array("TR", "11111",       "B@3C3C3C3C3C3C3C3",    "95"),
  new Array("TR", "11111",       "BC3C3C3C3C3C3C3C@",    "95"),
  new Array("DE", "12345678",    "5",                    "06"),
  new Array("DE", "12345678",    "16",                   "97"),
  new Array("DE", "12345678",    "16",                   "00"),
  new Array("DE", "12345678",    "95",                   "98"),
  new Array("DE", "12345678",    "95",                   "01"));


// Translation table and translation function for localized versions
var trans_tab = new Array();

function _(s)
{
  var t = trans_tab[s];
  if (t)
    s = t;
  return s;
}

// Fill the translation table
function fill_trans_tab(trans_data)
{
  for (var i = 0; i < trans_data.length / 2; ++i)
    trans_tab[trans_data[2 * i]] = trans_data[2 * i + 1];

  // Translate the country names in the iban_data list
  for (var i = 0; i < iban_data.length; ++i)
    iban_data[i].name = _(iban_data[i].name);
}


// Set debug_output = true if location ends with a hash or a quotation mark
var debug_output = (location.href.charAt(location.href.length - 1) == "#") ||
                   (location.href.charAt(location.href.length - 1) == "?");

if (debug_output)
  debug_iban_data();

function debug_iban_data()
{
  var s = "";
  for (var i = 0; i < iban_data.length; ++i)
  {
    var country = iban_data[i];
    s += country.name + " / " + country.code + " / ";
    for (var f = 0; f < country.bank.length; ++f)
      s += country.bank[f][0] + country.bank[f][1];
    s += " = " + country.bank_lng + " / ";
    for (var f = 0; f < country.acc.length; ++f)
      s += country.acc[f][0] + country.acc[f][1];
    s += " = " + country.acc_lng + " / " + country.total_lng + "\n";
  }
  alert(s);
}

function debug_check_vars()
{
  var o = false;
  var s = "";
  for (var v in window)
  {
    if (o)
      s += "" + v + "=" + window[v] + "\n";
    if (v == "debug_check_vars")
      o = true;
  }
  if (s != "")
    alert("vars:\n" + s);
  else
    alert("no vars");
}function md5()
{
	var hexcase = 0;
	var b64pad  = "";
	var chrsz   = 8;
		
	function b64_md5(s){ return binl2b64(core_md5(str2binl(s), s.length * chrsz));}
	function str_md5(s){ return binl2str(core_md5(str2binl(s), s.length * chrsz));}
	function hex_hmac_md5(key, data) { return binl2hex(core_hmac_md5(key, data)); }
	function b64_hmac_md5(key, data) { return binl2b64(core_hmac_md5(key, data)); }
	function str_hmac_md5(key, data) { return binl2str(core_hmac_md5(key, data)); }
	
	function md5_vm_test()
	{
	  return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72";
	}
	
	function core_md5(x, len)
	{
	  x[len >> 5] |= 0x80 << ((len) % 32);
	  x[(((len + 64) >>> 9) << 4) + 14] = len;
	
	  var a =  1732584193;
	  var b = -271733879;
	  var c = -1732584194;
	  var d =  271733878;
	
	  for(var i = 0; i < x.length; i += 16)
	  {
	    var olda = a;
	    var oldb = b;
	    var oldc = c;
	    var oldd = d;
	
	    a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);
	    d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);
	    c = md5_ff(c, d, a, b, x[i+ 2], 17,  606105819);
	    b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);
	    a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);
	    d = md5_ff(d, a, b, c, x[i+ 5], 12,  1200080426);
	    c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);
	    b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);
	    a = md5_ff(a, b, c, d, x[i+ 8], 7 ,  1770035416);
	    d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);
	    c = md5_ff(c, d, a, b, x[i+10], 17, -42063);
	    b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162);
	    a = md5_ff(a, b, c, d, x[i+12], 7 ,  1804603682);
	    d = md5_ff(d, a, b, c, x[i+13], 12, -40341101);
	    c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290);
	    b = md5_ff(b, c, d, a, x[i+15], 22,  1236535329);
	
	    a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);
	    d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);
	    c = md5_gg(c, d, a, b, x[i+11], 14,  643717713);
	    b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);
	    a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);
	    d = md5_gg(d, a, b, c, x[i+10], 9 ,  38016083);
	    c = md5_gg(c, d, a, b, x[i+15], 14, -660478335);
	    b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);
	    a = md5_gg(a, b, c, d, x[i+ 9], 5 ,  568446438);
	    d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);
	    c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);
	    b = md5_gg(b, c, d, a, x[i+ 8], 20,  1163531501);
	    a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);
	    d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);
	    c = md5_gg(c, d, a, b, x[i+ 7], 14,  1735328473);
	    b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734);
	
	    a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);
	    d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);
	    c = md5_hh(c, d, a, b, x[i+11], 16,  1839030562);
	    b = md5_hh(b, c, d, a, x[i+14], 23, -35309556);
	    a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);
	    d = md5_hh(d, a, b, c, x[i+ 4], 11,  1272893353);
	    c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);
	    b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640);
	    a = md5_hh(a, b, c, d, x[i+13], 4 ,  681279174);
	    d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);
	    c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);
	    b = md5_hh(b, c, d, a, x[i+ 6], 23,  76029189);
	    a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);
	    d = md5_hh(d, a, b, c, x[i+12], 11, -421815835);
	    c = md5_hh(c, d, a, b, x[i+15], 16,  530742520);
	    b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);
	
	    a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);
	    d = md5_ii(d, a, b, c, x[i+ 7], 10,  1126891415);
	    c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905);
	    b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);
	    a = md5_ii(a, b, c, d, x[i+12], 6 ,  1700485571);
	    d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);
	    c = md5_ii(c, d, a, b, x[i+10], 15, -1051523);
	    b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);
	    a = md5_ii(a, b, c, d, x[i+ 8], 6 ,  1873313359);
	    d = md5_ii(d, a, b, c, x[i+15], 10, -30611744);
	    c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);
	    b = md5_ii(b, c, d, a, x[i+13], 21,  1309151649);
	    a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);
	    d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379);
	    c = md5_ii(c, d, a, b, x[i+ 2], 15,  718787259);
	    b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);
	
	    a = safe_add(a, olda);
	    b = safe_add(b, oldb);
	    c = safe_add(c, oldc);
	    d = safe_add(d, oldd);
	  }
	  return Array(a, b, c, d);
	
	}
	
	function md5_cmn(q, a, b, x, s, t)
	{
	  return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b);
	}
	function md5_ff(a, b, c, d, x, s, t)
	{
	  return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
	}
	function md5_gg(a, b, c, d, x, s, t)
	{
	  return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
	}
	function md5_hh(a, b, c, d, x, s, t)
	{
	  return md5_cmn(b ^ c ^ d, a, b, x, s, t);
	}
	function md5_ii(a, b, c, d, x, s, t)
	{
	  return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
	}
	
	function core_hmac_md5(key, data)
	{
	  var bkey = str2binl(key);
	  if(bkey.length > 16) bkey = core_md5(bkey, key.length * chrsz);
	
	  var ipad = Array(16), opad = Array(16);
	  for(var i = 0; i < 16; i++)
	  {
	    ipad[i] = bkey[i] ^ 0x36363636;
	    opad[i] = bkey[i] ^ 0x5C5C5C5C;
	  }
	
	  var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz);
	  return core_md5(opad.concat(hash), 512 + 128);
	}
	
	function safe_add(x, y)
	{
	  var lsw = (x & 0xFFFF) + (y & 0xFFFF);
	  var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
	  return (msw << 16) | (lsw & 0xFFFF);
	}
	
	function bit_rol(num, cnt)
	{
	  return (num << cnt) | (num >>> (32 - cnt));
	}
	
	function str2binl(str)
	{
	  var bin = Array();
	  var mask = (1 << chrsz) - 1;
	  for(var i = 0; i < str.length * chrsz; i += chrsz)
	    bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32);
	  return bin;
	}
	
	function binl2str(bin)
	{
	  var str = "";
	  var mask = (1 << chrsz) - 1;
	  for(var i = 0; i < bin.length * 32; i += chrsz)
	    str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask);
	  return str;
	}
	
	function binl2hex(binarray)
	{
	  var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
	  var str = "";
	  for(var i = 0; i < binarray.length * 4; i++)
	  {
	    str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) + hex_tab.charAt((binarray[i>>2] >> ((i%4)*8  )) & 0xF);
	  }
	  return str;
	}
	
	function binl2b64(binarray)
	{
	  var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
	  var str = "";
	  for(var i = 0; i < binarray.length * 4; i += 3)
	  {
	    var triplet = (((binarray[i   >> 2] >> 8 * ( i   %4)) & 0xFF) << 16) | (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 ) |  ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF);
	    for(var j = 0; j < 4; j++)
	    {
	      if(i * 8 + j * 6 > binarray.length * 32) str += b64pad;
	      else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F);
	    }
	  }
	  return str;
	}
	
	this.hex_md5=function(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));}
}function mytime()
{
	var gmtoffset=3600000*timeoffset;
	var _localtime="FR";
	if(guest["localtime"])
		 _localtime=guest["localtime"];	 
	var dayNames=days;
	var monthNames=months;
	/*"dayNames[timeSource().getDay()]+', '+*/
	var outputTime="timeSource().getDate()+' '+monthNames[timeSource().getMonth()]+' '+fixYear2(timeSource().getYear())+', '+leadingZero(timeSource().getHours())+':'+leadingZero(timeSource().getMinutes())+' '";//+':'+leadingZero(timeSource().getSeconds())+' '";
	var schedule=new Ext.util.DelayedTask();
	
	function timeSource()
	{
	   var x=new Date(timeNow().getUTCFullYear(),timeNow().getUTCMonth(),timeNow().getUTCDate(),timeNow().getUTCHours(),timeNow().getUTCMinutes(),timeNow().getUTCSeconds());
	   x.setTime(x.getTime()+gmtoffset); //-3600000
	   return x;
	}
	
	function timeNow(){
		var mydate=new Date();
	   return mydate;
	}
	
	function leadingZero(x){
	   return (x>9)?x:'0'+x;
	}
	
	function fixYear2(x){
	   x=(x<500)?x+1900:x;
	   return String(x).substring(2,4);
	}
		
	function changeGMT(val)
	{
		gmtoffset=3600000*val;	
	}
	
	this.displayTime=function() 
	{
		document.getElementById('showtime').innerHTML=''+eval(outputTime)+' '+_localtime;
		schedule.delay(60000,this.displayTime,this);
	}
}

function today_start_end(){

	var now = new Date();

	var year = now.getUTCFullYear();
	var mon = now.getUTCMonth() + 1;
	var date = now.getUTCDate();

        if(mon<10)
                mon="0"+mon;

        if(date<10)
                date="0"+date;

	var date_str = "" + year + "-" + mon + "-" + date;

	var starttime  = date_str + "T00:00:00.000z"; //"2010-12-21T00:00:00.000z";
	var endtime = date_str + "T23:59:00.000z";

	return {
		starttime: starttime,
		endtime: endtime
	}
}
