objForm = "";
sAction = "";

function validatePage(url,form,action)
{

	objForm = form;
	url = unescape(url);

	if (document.getElementById("errorDiv").style.display == "block")
		slideup('errorDiv');

	if (action)
		sAction = action;

	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 


function stateChanged() 
{ 
	var aMsg = "";
	
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{


		aMsg = xmlHttp.responseText.split("|");

		if (aMsg[1] == 0)
		{
			if (sAction)
				objForm.action = sAction;

			objForm.submit();
		}
		else
		{
			aField = aMsg[0].split(";");

			for (i=0; i<aField.length; i++)
			{
				aVal = aField[i].split("/");
				if (aVal[1] == "1")
					document.getElementById("td" + aVal[0]).className = "boxTableError";
				else
					document.getElementById("td" + aVal[0]).className = "boxTable";
			}
			
			setErrorBox(aMsg[1]);
		}
		//document.getElementById(sDiv).innerHTML=xmlHttp.responseText;
	}
} 

function GetXmlHttpObject()
{ 
	var objXMLHttp=null
	if (window.XMLHttpRequest)
		objXMLHttp=new XMLHttpRequest()
	else if (window.ActiveXObject)
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
	
	return objXMLHttp
} 


//----Open/close DIV's--------
function checkDiv(sDiv,style,imgID,img1,img2){

	if (style)
		document.getElementById(sDiv).style.display = style;
	else
	{
		if (document.getElementById(sDiv).style.display == 'block')
		{
			document.getElementById(sDiv).style.display = "none";
		}
		else
		{
			document.getElementById(sDiv).style.display = "block";
		}	
	}

	if (imgID)
		if (document.getElementById(imgID).src.search(img1) > 0)
			document.getElementById(imgID).src = img2;
		else
			document.getElementById(imgID).src = img1;
}

function fOpenWin(url,name,param){
	var win;
	win = window.open(url,name,param);
	win.focus();
}



<!--Text counter--->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Written by Steve - http://jsmadeeasy.com/ -->

<!--
function getObject(obj) {
  var theObj;
  if(document.all) {
	if(typeof obj=="string") {
	  return document.all(obj);
	} else {
	  return obj.style;
	}
  }
  if(document.getElementById) {
	if(typeof obj=="string") {
	  return document.getElementById(obj);
	} else {
	  return obj.style;
	}
  }
  return null;
}

//Contador de caracteres.
function Contar(entrada,salida,texto,caracteres) {
  //var entradaObj=getObject(entrada);
  var entradaObj=entrada;
  var salidaObj=getObject(salida);
  var longitud=caracteres - entradaObj.value.length;
  if(longitud <= 0) {
	longitud=0;
	texto='<span class="disable"> '+texto+' </span>';
	entradaObj.value=entradaObj.value.substr(0,caracteres);
  }
  salidaObj.innerHTML = texto.replace("{CHAR}",longitud);
}


//-- Roll over images ---
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


//--- Check all check boxes ---
function checkAll(field,value){

	for (i=0; i < field.length; i++)
	{
		field[i].checked = value;
		changeClass(value,field[i].name + i)
	}
}


// --- Validate tabs
function checkFields(action){
		
	//--- Validates is profile is opened and completed ---
	if (document.getElementById("Module").value == "Profile")
		checkProfileFields(document.getElementById("fSubscribe"),action);
	else
		//--- Rdirects to the tab url ---
		window.location = action;				
}


// --- Set error box text ----
function setErrorBox(Text)
{
	document.getElementById("errorText").innerHTML=Text;
	if (document.getElementById("errorDiv").style.display == "block")
		setTimeout("slidedown('errorDiv');",300);
	else
		slidedown('errorDiv')
}


// --- Change class name
function changeClass(val,code)
{
	if (val)
		document.getElementById(code).className = "listChecked";
	else
		document.getElementById(code).className = "";
}

function fOnLoad(){
}