if(document.all&&!document.getElementById){document.getElementById=function(A){return document.all[A]}}function BlockSubmit(B,C){var A=B.keyCode||B.which;if(A==13){C();return false}else{return true}}function CheckAll(B){var A=Explode(B,",");for(j=0;j<A.length;j++){CheckSwitch(A[j],true)}}function CheckNone(B){var A=Explode(B,",");for(j=0;j<A.length;j++){CheckSwitch(A[j],false)}}function CheckSwitch(C,A){var B=document.getElementsByTagName("input");for(i=0;i<B.length;i++){if(B[i].type=="checkbox"&&B[i].id.indexOf(C)==0){B[i].checked=A}}}function ClearContents(A){if(A){A.innerHTML=""}}function CompletePreferenceSet(B){var A=document.getElementById(B);if(A){A.className="PreferenceComplete"}}function Explode(B,A){return B.split(A)}function Focus(A){var B=document.getElementById(A);if(B){B.focus()}}function GetElements(A,B){var D=document.getElementsByTagName(A);var C=new Array();for(i=0;i<D.length;i++){if(D[i].id.indexOf(B)==0){C[C.length]=D[i]}}return C}function HideElement(A,C){var B=document.getElementById(A);if(B){B.style.display="none";if(C==1){ClearContents(B)}}}function PathFinder(){this.params=new function(){this.url=document.URL;this.domain=document.domain;this.httpMethod=this.url.replace(/^(http|https)(:\/\/).*$/,"$1$2");return this};this.getRootPath=function(C,B,F){var A=document.getElementsByTagName(C);var G="";var D="";for(var E=0;E<A.length;E++){G="";if(A[E].getAttribute&&A[E].getAttribute(B)){G=A[E].getAttribute(B)}else{if(A[E][B]){G=A[E][B]}}if(G.match(F)){D=G.replace(F,"");D=D.replace(/^http(s)?:\/\/[^\/]+/,"");break}}return D||false};return this}function PopTermsOfService(A){window.open(A,"TermsOfService","toolbar=no,status=yes,location=no,menubar=no,resizable=yes,height=600,width=400,scrollbars=yes")}function PreferenceSet(A){setTimeout("CompletePreferenceSet('"+this.Param+"');",400)}function RefreshPage(A){if(!A){A=400}setTimeout("document.location.reload();",A)}function RefreshPageWhenAjaxComplete(A){RefreshPage()}function SubmitForm(C,A,B){Wait(A,B);document[C].submit()}function SwitchElementClass(C,F,A,G,E,D){var B=document.getElementById(C);Sender=document.getElementById(F);if(B&&Sender){if(B.className==G){B.className=A;Sender.innerHTML=E}else{B.className=G;Sender.innerHTML=D}}}function SwitchExtension(E,F,D){var C=document.getElementById(F);if(C){C.className="Processing"}var B="ExtensionKey="+F+"&PostBackKey="+D;var A=new DataManager();A.Param=F;A.RequestFailedEvent=SwitchExtensionResult;A.RequestCompleteEvent=SwitchExtensionResult;A.LoadData(E+"?"+B)}function SwitchExtensionResult(B){var A=document.getElementById(Trim(B.responseText));if(A){setTimeout("SwitchExtensionItemClass('"+Trim(B.responseText)+"')",400)}else{alert(Trim(B.responseText))}}function SwitchExtensionItemClass(C){var B=document.getElementById(C);var A=document.getElementById("chk"+C+"ID");if(B&&A){B.className=A.checked?"Enabled":"Disabled"}}function SwitchPreference(G,F,C,E){var A=document.getElementById(F);var D=document.getElementById(F+"ID");if(D&&A){A.className="PreferenceProgress";var B=new DataManager();B.Param=F;B.RequestFailedEvent=HandleFailure;if(C==1){B.RequestCompleteEvent=RefreshPageWhenAjaxComplete}else{B.RequestCompleteEvent=PreferenceSet}B.LoadData(G+"?Type="+F+"&PostBackKey="+E+"&Switch="+D.checked)}}function Trim(A){return A.replace(/^\s*|\s*$/g,"")}function UpdateCheck(D,B,C){var A=new DataManager();A.RequestCompleteEvent=UpdateCheckStatus;A.RequestFailedEvent=UpdateCheckStatus;A.Param=D;A.LoadData(D+"?RequestName="+B+"&PostBackKey="+C)}function UpdateCheckStatus(E){if(E.responseText=="COMPLETE"){return }var F=E.responseText.substring(0,E.responseText.indexOf("|"));if(F=="First"){var B=document.getElementById("Core");var G=document.getElementById("CoreDetails")}else{var B=document.getElementById(F);var G=document.getElementById(F+"Details")}var D=E.responseText.slice(E.responseText.indexOf("|")+1);var A=document.getElementById("FormPostBackKey");var C=(A)?A.value:"";if(B&&G){if(D.indexOf("ERROR]")==1){B.className="UpdateError";G.innerHTML=D.replace(/\[ERROR\]/g,"")}else{if(D.indexOf("OLD]")==1){B.className="UpdateOld"}else{if(D.indexOf("UNKNOWN]")==1){B.className="UpdateUnknown"}else{B.className="UpdateGood"}}G.innerHTML=D.replace(/\[OLD\]/g,"").replace(/\[UNKNOWN\]/g,"").replace(/\[GOOD\]/g,"");setTimeout("UpdateCheck('"+this.Param+"', '"+F+"', '"+C+"');",300)}}else{alert("Error: "+E.responseText)}}function Wait(A,C){A.disabled=true;A.value=C;var B=A.parentNode;while(B!=null){if(B.tagName=="FORM"){B.submit();break}B=B.parentNode}}function WriteEmail(D,B,G,A){if(document.createElement&&document.getElementById){var E,C,F;E=document.createElement("a");E.href="mailto:"+B+"@"+D;G=G||B+"@"+D;F=document.createTextNode(G);E.appendChild(F);C=document.getElementById(A);if(C){C.parentNode.appendChild(E)}}}function showById(A){document.getElementById(A).style.display="block"};
/* Funciones para el tool tip */
var offsetxpoint = -60 ;//Customize x offset of tooltip
var offsetypoint = 20 ;//Customize y offset of tooltip
var ie = document.all;
var ns6 = document.getElementById && !document.all;
var tipobj = null;
var enabletip=false;
document.write('<div id="dhtmltooltip"></div> <!-- Tooltip -->');

function ietruebody(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}

function ddrivetip(oimg, thetext, thecolor, thewidth){	
	if (ie||ns6){
		tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : "";}
	if (ns6||ie){
		tipobj.innerHTML='';
		if (typeof thewidth!="undefined"){
			tipobj.style.width=thewidth+"px";}
		if (typeof thecolor!="undefined" && thecolor!=="") { 
			tipobj.style.backgroundColor=thecolor; }
		else {
			tipobj.style.backgroundColor="#EEEEEE";
			tipobj.style.color='#000000'; }
		if (typeof oimg!="undefined" && oimg!==""){ 
			tipobj.innerHTML+='<img src="'+oimg+'"><br>';
		}
		//alert(thetext);
		tipobj.innerHTML+='<font style="font-size:12px;font-family:\'Arial\'">'+thetext+'</font>';
		enabletip=true;
		return false;
	}
	
}

function positiontip(e){
	if (enabletip){
		var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
		var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
		
		var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20;
		var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20;

		var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000;

		if (rightedge<tipobj.offsetWidth){
			//move the horizontal position of the menu to the left by it's width
			tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px";
		}else if (curX<leftedge){
			tipobj.style.left="5px";
		}else{
			//position the horizontal position of the menu where the mouse is positioned
			tipobj.style.left=curX+offsetxpoint+"px";}
		//same concept with the vertical position
		if (bottomedge<tipobj.offsetHeight){
			tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px";
		}else{
			tipobj.style.top=curY+offsetypoint+"px";}
		tipobj.style.visibility="visible";
	}
}
document.onmousemove=positiontip;

function hideddrivetip(){
	if (ns6||ie){
		enabletip=false;
		tipobj.style.visibility="hidden";
		tipobj.style.left="-1000px";
		tipobj.style.backgroundColor='#EEEEEE';
		tipobj.style.width='';
		tipobj.style.color='#000000';
	}
}


function categoryContent() {
try {
	var subca = document.getElementById('CategoryID');
	if (subca.options.length>=2) { while (subca.options.length-1) { subca.remove(1); } }	
	var ind=document.getElementById('CategoryID_O').value;
	if (ind>0) {
		for (var i=0; i<99; i++) {
			if ( typeof(arrXJ[ addzeros(i.toString(),2) + addzeros(ind,3) ] ) != "undefined" ) {
				cat=arrXJ[addzeros(i.toString(),2) + addzeros(ind,3)];
				thisCat=cat.indexOf('||');				
				thisCat=cat.substr(0,thisCat);
				cat=cat.substring(cat.indexOf('||')+2);
				subca.options[i+1] = new Option(cat, thisCat); }
	}	}
} catch(ex) { }
}


function addzeros(str,limit) {
	if (str.length<limit) {
	 for (var i=str.length; i<limit; i++) {
		str='0'+str;
	 } }
	return str;
}
