var xmlHttp;
function createXMLHttpRequest() {
	if (window.ActiveXObject) {
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	} else if (window.XMLHttpRequest) {
		xmlHttp = new XMLHttpRequest;
	} 
} 
function GetData(get_data, hId) {
	createXMLHttpRequest();
	var url="index.php?a=getdata&do="+get_data+"&lid="+hId;
	xmlHttp.open("GET", url, true);
	xmlHttp.onreadystatechange=CallBack;
	xmlHttp.send(null);
} 
function CallBack() {
	if (xmlHttp.readyState==1) {
		document.getElementById("data_type").innerHTML="<center>Loading...<img src=\"images/loading.gif\"></center>";
	} 
	if (xmlHttp.readyState==4 && xmlHttp.status==200) {
		document.getElementById("data_type").innerHTML="";
		document.getElementById("data_type").innerHTML=xmlHttp.responseText;
	} 
} 

function fieldOn(status) {
	if ( status == "on" && document.getElementById("morefield").style.display == "none" ) {
		document.getElementById("morefield").style.display = "";
	} else if (status == "off" && document.getElementById("morefield").style.display == "" ) {
		document.getElementById("morefield").style.display = "none";
	}
}


function procVote()
{
  d = document.vote;
  if (!document.vote.email.value)
  {
    alert('Please, enter your E-Mail address!');
    document.vote.email.focus();
    return false;
  }



  if (!document.vote.yzms.value)
  {
    alert('Please input a turing number!');
    document.vote.yzms.focus();
    return false;
  }


  var   value = 0;
  for   (var i = 0; i < d.vote.length; i ++)   
  {   
  if (d.vote[i].checked)   
  value = d.vote[i].value;   
  }   
  if (value < 2)   
  {
   if (!d.login.value)
    {
    alert('Please, enter your login!');
    d.login.focus();
    return false;
    }
   if (!d.password.value)
    {
    alert('Please, enter your password!');
    d.password.focus();
    return false;
    }
  }


  else
  {
    a = d.email.value.indexOf('@');
    b = d.email.value.indexOf('@', a+1);
    c = d.email.value.lastIndexOf('.');
    if (c < a+1) { c = -1; }
    if (a == -1 || b != -1 || c <= a + 2 || a < 1 || c + 2 >= d.email.value.length || c + 4 < d.email.value.length)
    {
      alert('Please, enter a valid E-Mail Address');
      d.email.focus();
      return false;
    }
  }




  var   value = 0;
  for   (var i = 0; i < d.vote.length; i ++)   
  {   
  if (d.vote[i].checked)   
  value = d.vote[i].value;   
  }   
  if (value < 2)   
  {
   if (!d.login.value)
    {
    alert('Please, enter your login!');
    d.login.focus();
    return false;
    }
   if (!d.password.value)
    {
    alert('Please, enter your password!');
    d.password.focus();
    return false;
    }
  }




  return true;
}





function checkform3() {
  if (document.repscam.eml.value == '') {
    alert("Please enter your e-mail address!");
    document.repscam.eml.focus();
    return false;
  }

  if (document.repscam.login.value == '') {
    alert("Please enter your login!");
    document.repscam.login.focus();
    return false;
  }

  if (document.repscam.password.value == '') {
    alert("Please enter your password!");
    document.repscam.password.focus();
    return false;
  }

  if (document.repscam.notify.value == '') {
    alert("Please let us know more information!");
    document.repscam.notify.focus();
    return false;
  }
  return true;
}



function textCounter(field, countfield, maxlimit) {
 if (field.value.length > maxlimit){
    field.value = field.value.substring(0, maxlimit);
 }
 else {
       countfield.value = maxlimit - field.value.length;
     }
 }
