// JavaScript Document

var xmlHttp;

function email_exist(str)
{
	
	if(str=='')
		{
			return false;
		}
/*	document.getElementById("id_icon_close").style.display='none';	
	document.getElementById("id_icon_open").style.display='none';*/
	document.getElementById("show_err_email").style.display='none';	
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  } 
var url="ajax_email.php";
url=url+"?email="+str;
url=url+"&sid="+Math.random();

xmlHttp.onreadystatechange=stateChanged_email;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 

function stateChanged_email() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 var stp=xmlHttp.responseText.split("|");
 
// alert(stp[0]);
 if(stp[1]=="<img src='images/icon_open.png' width='16' height='16'  />")
 	{
	 document.getElementById("valid_show").innerHTML=stp[1];
	}
	else
	{
/*	 document.getElementById("id_icon_open").style.display='none';	
	document.getElementById("id_icon_close").style.display=''; */
	document.getElementById("show_err_email").style.display=''; 
	document.getElementById("valid_show").innerHTML=stp[1];
	document.getElementById("err_email").innerHTML=stp[0];
	}
 } 
}

function publicurl(str)
{
	
	if(str=='')
		{
			return false;
		}
	document.getElementById("show_err_url").style.display='none';	
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  } 
var url="ajax_public_url.php";
url=url+"?name="+str;
url=url+"&sid="+Math.random();

xmlHttp.onreadystatechange=stateChanged_url;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function stateChanged_url() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 var stp=xmlHttp.responseText.split("|");
 
// alert(stp[0]);
 if(stp[1]=="<img src='images/icon_open.png' width='16' height='16'  />")
 	{
	 document.getElementById("valid_public").innerHTML=stp[1];
	}
	else
	{
/*	 document.getElementById("id_icon_open").style.display='none';	
	document.getElementById("id_icon_close").style.display=''; */
	document.getElementById("show_err_url").style.display=''; 
	document.getElementById("valid_public").innerHTML=stp[1];
	document.getElementById("err_url").innerHTML=stp[0];
	}
 } 
}


/*  ============= for user setting page ============ */
function publicurl_settings(str)
{
	
	if(str=='')
		{
			return false;
		}
document.getElementById("show_err_url_settings").style.display='none';	
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  } 
var url="ajax_public_url.php";
url=url+"?name_settings="+str;
url=url+"&sid="+Math.random();

xmlHttp.onreadystatechange=stateChanged_url_settings;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function stateChanged_url_settings() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 var stp=xmlHttp.responseText.split("|");
 
// alert(stp[0]);
 if(stp[1]=="<img src='images/icon_open.png' width='16' height='16'  />")
 	{
	 document.getElementById("valid_public_settings").innerHTML=stp[1];
	}
	else
	{
/*	 document.getElementById("id_icon_open").style.display='none';	
	document.getElementById("id_icon_close").style.display=''; */
	document.getElementById("show_err_url_settings").style.display=''; 
	document.getElementById("valid_public_settings").innerHTML=stp[1];
	document.getElementById("err_url_settings").innerHTML=stp[0];
	}
 } 
}


/*  ============= for user setting page end ============ */


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;
}
