window.onload=function(){
	hideMessage();
	chkScreen();
	if(window.AutoCompleteForm!=null)autoCompleteFormCheck();
	if(window.Suggest!=null)toolsCheck();
	if(window.ownOnLoadFuntion!=null)ownOnLoadFuntion();
	
	};
var GLOBALint;
function hideMessage(){
	var msg=document.getElementById("systemMessages");
	if(msg!=null){
			var timeout=window.setTimeout("if(document.getElementById(\"systemMessages\"))Effect.Fade('systemMessages',{duration:1.0});",7000);
			
		}
	}
	
	
function reduceIt(elm){
	elm=document.getElementById(elm);
	if(elm.clientHeight>0)
	{
	elm.style.overflow="hidden";
	if(elm.clientHeight-2>=0)
		elm.style.height=(elm.clientHeight-2)+"px";
	else
		elm.style.height=(elm.clientHeight-1)+"px";
	}
	else
	{
		elm.style.display="none";
	 clearInterval(GLOBALint);	
	}
	
}
function pauseScript(millis) 
{
date = new Date();
var curDate = null;
do { var curDate = new Date(); } 
while(curDate-date < millis);
} 

function autoCompleteFormCheck(){
	var arrForm = document.forms;
	for(var i=0;i<arrForm.length;i++)
		if(arrForm[i].getAttribute("bothmedia")=="AutoCompleteForm")
			var form=new AutoCompleteForm(arrForm[i]);
}

function toolsCheck(){
	var arrForm = document.forms;
	for(var i=0;i<arrForm.length;i++){
		for(var c=0;c<arrForm[i].elements.length;c++){
			if(arrForm[i].elements[c].getAttribute("bothmedia")=="sugerencias")
				var form=new Suggest(arrForm[i].elements[c]);
		}
	}
}


function helpCheck(){
	var arrForm = document.images;
		for(var c=0;c<arrForm.length;c++){
			if(arrForm[c].getAttribute("help"))
			{
				var elm=arrForm[c];
				var div=document.getElementById("bothmediaHelpMsg");
				if(!div){
					div = document.createElement("DIV");
					ifr=document.createElement("IFRAME");
					div.id="bothmediaHelpMsg";
					div.style.display="none";
					div.style.position="absolute";
					div.onmouseover=function(){this.style.display="block";
					document.getElementById("bothmediaHelpMsgFrame").style.display="block";};
					div.onmouseout=function(){this.style.display="none";
					document.getElementById("bothmediaHelpMsgFrame").style.display="none";
					};
					
					ifr.id="bothmediaHelpMsgFrame";
					ifr.style.display="none";
					ifr.style.position="absolute";
					ifr.scrolling="no";
					document.body.appendChild(ifr);
					document.body.appendChild(div);
					
				}
				var ifr=document.getElementById("bothmediaHelpMsgFrame");
				
				elm.onmouseover=function(e){

					var div = document.getElementById("bothmediaHelpMsg");
					div.innerHTML=this.getAttribute("help");
					var isIE=(window.event!=null);
					if(isIE){
					document.onmousemove=function(e){
							if(window.event)e=window.event;
								var isIE=(window.event!=null);
								div.style.top=(document.documentElement.scrollTop+document.body.scrollTop+e.clientY+2)+"px";
								div.style.left=(document.documentElement.scrollLeft+document.body.scrollLeft+e.clientX+2)+"px";
								div.style.display="block";
								
								ifr.style.top=(document.documentElement.scrollTop+document.body.scrollTop+e.clientY+2)+"px";
								ifr.style.left=(document.documentElement.scrollLeft+document.body.scrollLeft+e.clientX+2)+"px";
								ifr.style.width=(div.clientWidth+2)+"px";
								ifr.style.height=(div.clientHeight+2)+"px";
								ifr.style.display="block";
						};
					}
					else {						
						window.onmousemove=function(e){
							if(window.event)e=window.event;
								var isIE=(window.event!=null);
								div.style.top=(window.scrollY+e.clientY+2)+"px";
								div.style.left=(window.scrollX+e.clientX+2)+"px";
								div.style.display="block";
								
								ifr.style.border="none";
								ifr.style.top=(window.scrollY+e.clientY+2)+"px";
								ifr.style.left=(window.scrollX+e.clientX+2)+"px";
								ifr.style.width=(div.clientWidth+2)+"px";
								ifr.style.height=(div.clientHeight+2)+"px";
								ifr.style.display="block";
						};
					}
				};
				
				elm.onmouseout=function(){
					var div = document.getElementById("bothmediaHelpMsg");
					div.style.display="none";
					ifr.style.display="none";
					if(!window.event)window.onmousemove=null;
					else document.onmousemove=null;
				};
				
			}
	}
}

function helpCheck2(){
	var arrForm = document.forms;
	for(var i=0;i<arrForm.length;i++){
		for(var c=0;c<arrForm[i].elements.length;c++){
			if(arrForm[i].elements[c].getAttribute("help"))
			{
				
				var elm=arrForm[i].elements[c];
				var div=document.getElementById("bothmediaHelpMsg");
				if(!div){
					div = document.createElement("DIV");	
					div.id="bothmediaHelpMsg";
					div.style.display="none";
					div.style.position="absolute";
					div.onmouseover=function(){this.style.display="block"};
					div.onmouseout=function(){this.style.display="none"};
					document.body.appendChild(div);
				}
				elm.style.cursor="default";
				elm.onmouseover=function(e){
					var div = document.getElementById("bothmediaHelpMsg");
					div.innerHTML=this.getAttribute("help");
					var isIE=(window.event!=null);
					if(isIE){
					document.onmousemove=function(e){
							if(window.event)e=window.event;
								var isIE=(window.event!=null);
								div.style.top=(document.documentElement.scrollTop+document.body.scrollTop+e.clientY+2)+"px";
								div.style.left=(document.documentElement.scrollLeft+document.body.scrollLeft+e.clientX+2)+"px";
								div.style.display="block";
						};
					}
					else {						
						window.onmousemove=function(e){
							if(window.event)e=window.event;
								var isIE=(window.event!=null);
								div.style.top=(window.scrollY+e.clientY+2)+"px";
								div.style.left=(window.scrollX+e.clientX+2)+"px";
								div.style.display="block";
						};
					}
				};
				
				elm.onmouseout=function(){
					var div = document.getElementById("bothmediaHelpMsg");
					div.style.display="none";
					if(!window.event)window.onmousemove=null;
					else document.onmousemove=null;
				};
				
			}
	}
	}
}

function showLanguage(str){
 var form=document.forms[0];
 var fss=form.getElementsByTagName("FIELDSET");
 var name ="fieldset"+str;
 for(var i=0;i<fss.length;i++){
  if(fss[i].id&&fss[i].id==name)fss[i].style.display="block";
  else if(fss[i].id) fss[i].style.display="none";
 }

 switch (str){
  case "ES":
   document.getElementById("eslang").className="active";
   document.getElementById("enlang").className="";
   break;
  case "EN":
   document.getElementById("eslang").className="";
   document.getElementById("enlang").className="active";
   break;
 }
 return false;
}

function chkScreen()
{
	if(screen.width<1280&&document.getElementById("container"))
	{
		document.body.style.backgroundPosition = "-75px 0px";
		document.getElementById("container").style.marginLeft = "5px";
		document.getElementById("footerContent").getElementsByTagName("SPAN")[1].style.marginLeft = "40px";
		document.getElementById("footerContent").style.width = "995px";
		
	}
}
