function ajax(){
var xmlHttp;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
  return xmlHttp;
}// JavaScript Document


function isValidEmail(str) {
   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
}


function check_empty(ID, errorMsg){
	if( document.getElementById(ID).value==''){
		document.getElementById(ID).style.border="1px solid red";
		document.getElementById(ID+"_hint").innerHTML= '<img src="images/x.png" style="vertical-algn:middle" height="13" />&nbsp;'+errorMsg;
		return false;
	}else{
		document.getElementById(ID).style.border="1px solid green";
		document.getElementById(ID+"_hint").innerHTML= '';
		return true;
	}
}

function check_same(ID1, ID2, errorMsg){
	if( document.getElementById(ID1).value != document.getElementById(ID2).value){
		document.getElementById(ID1).style.border="1px solid red";
		document.getElementById(ID2).style.border="1px solid red";
		document.getElementById(ID1+"_hint").innerHTML= '<img src="images/x.png" style="vertical-algn:middle" height="13" />&nbsp;'+errorMsg;
		return false;
	}else{
		document.getElementById(ID1).style.border="1px solid green";
		document.getElementById(ID2).style.border="1px solid green";
		document.getElementById(ID1+"_hint").innerHTML= '';
		return true;
	}
}

function check_mail(ID, errorMsg){
	if(isValidEmail( document.getElementById(ID).value)){
		document.getElementById(ID).style.border="1px solid green";
		return true;
	}else{
		document.getElementById(ID).style.border="1px solid red";
		document.getElementById(ID+"_hint").innerHTML= '<img src="images/x.png" style="vertical-algn:middle" height="13" />&nbsp;'+errorMsg;
	}
}

function IsNumeric(sText)

{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
}

/*if(xmlHttp.readyState==4){
		alert(xmlHttp.responseText);
		if(xmlHttp.responseText ==0){
			return false;
		}else{
			return true;
		}
	}*/
function check_validation2(){
	xmlHttp= ajax();
	xmlHttp.onreadystatechange=function(){
		if(xmlHttp.readyState==4){
			m= xmlHttp.responseText ;
			//alert(m);
			return m;
		}
	}
	url= "do.php?do=check_validation&value="+ document.getElementById("c_conatc").value ;
	xmlHttp.open("GET",url,false);
	xmlHttp.send(null);
	return xmlHttp.responseText ;
}

function check_validation(){
	$t= check_validation2();
	return $t;
}