// JavaScript Document
function makeRequest(div,url) {
    document.getElementById(div).innerHTML="<IMG SRC='/images/load2.gif'>Please Wait...";
    xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Your browser does not support AJAX!");
	 return;
	} 
	xmlHttp.onreadystatechange=function(){
		if(xmlHttp.readyState == 4){
		  strText = xmlHttp.responseText;
		  //alert(strText);
		  div = document.getElementById(div);
		  div.innerHTML = strText;
		}
   }
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function GetXmlHttpObject(){
  var xmlHttp=null;
  try  {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
  }catch (e){
   // Internet Explorer
    try{
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }catch (e){
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

function trim(s){
  while(s.substring(0,1)==' '){
	s=s.substring(1,s.length);
  }
  while(s.substring(s.length-1,s.length)==" "){
	s=s.substring(0,s.length-1);
  }
  return s;
}


function validateForm3(){
  var formError='';
  document.getElementById('Uaboutme').innerHTML='';
  document.getElementById('Uaboutmatch').innerHTML='';
  document.getElementById('Uaboutfamily').innerHTML='';

  if(trim(document.getElementById("about_me").value)==""){
	document.getElementById("about_me").value="";
    formError+="Please Enter About me.<br/>";
	document.getElementById('Uaboutme').innerHTML="Please Enter About me.<br/>";
  }

  if(trim(document.getElementById("about_match").value)==""){
	document.getElementById("about_match").value="";
    formError+="Please Enter About match.<br/>";
	document.getElementById('Uaboutmatch').innerHTML="Please Enter About match.<br/>";
  }

  if(trim(document.getElementById("about_family").value)==""){
	document.getElementById("about_family").value="";
    formError+="Please Enter About family.";
	document.getElementById('Uaboutfamily').innerHTML="Please Enter About family.<br/>";
  }
  if(formError!=''){
	alert("You have some error on this page, Please check the respective fields");
    return false;
  }
}

function textCounter(field,cntfield,maxlimit) {
  if (field.value.length > maxlimit) // if too long...trim it!
  {
    field.value = field.value.substring(0, maxlimit);
    alert("Maxium limit is over");
  }
  // otherwise, update 'characters left' counter
  else
  {
    cntfield.value = maxlimit - field.value.length;
  }
}


function changegroup(str)
{
	var url_open;
	if(str=='B'){
	  url_open="free.html";
	}
	if(str=='P'){
	  url_open="platinum.html";
	}
	if(str=='D'){
	  url_open="diamond.html";
	}
	if(str=='G'){
	  url_open="gold.html";
	}
	if(str=='S'){
	  url_open="silver.html";
	}
	window.open(url_open,'mywindow','width=525, height=280, left=150, top=200');
}

function GetAllStates(Master,Master2,VALUE,VALUE2){
  url = "../phplib/fregister2.php?Master="+Master+"&VALUE="+VALUE;
  //alert(url);
  
  if(VALUE != 233){
    document.getElementById('tdCities').innerHTML="";
    document.getElementById('ocity').innerHTML="";
   }
  MasterDiv='tdStates';
  setTimeout("makeRequest(MasterDiv,url)",500);
}

function GetAllCities(Master,Master2,VALUE,VALUE2){
  url = "../phplib/fregister2.php?Master="+Master+"&VALUE="+VALUE;
  MasterDiv='tdCities';
  //alert(url);
  setTimeout("makeRequest(MasterDiv,url)",500);
}

function OtherCity(Master,VALUE){
 url = "../phplib/fregister2.php?Master="+Master+"&VALUE="+VALUE;
  MasterDiv='ocity';
  makeRequest(MasterDiv,url);
}