
var xmlhttp;

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 show_chapter(val,id){
	//alert(val);
	var url="chapter.php?book="+val;
	//alert(url);
		xmlHttp=getxmlhttpobject();
		xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
			{	
				//alert(xmlHttp.responseText);
				document.getElementById(id).innerHTML=xmlHttp.responseText;
				//document.getElementById(id1).innerHTML=xmlHttp.responseText;
			}		
		}
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);	
	}


function chk_username(val){
	//alert(val);
	var url="user.php?user="+val;
	//alert(url);
		xmlHttp=getxmlhttpobject();
		xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
			{	
				//alert(xmlHttp.responseText);
				$check=parseInt(xmlHttp.responseText);
				if($check!=1)
				{
					document.getElementById("Submit").disabled=true;
					document.getElementById("user_hidden").value=1;
					//document.getElementById(id).innerHTML=xmlHttp.responseText;
					if(val!='')
					alert("This Username is Already Exist, Please Enter Another Username!");
					else
					alert("Please Enter Username, Its Mandatory!");
					document.getElementById("email").focus();
				}else{
					//document.getElementById(id).innerHTML='';
					document.getElementById("user_hidden").value=0;
				}
				//document.getElementById(id1).innerHTML=xmlHttp.responseText;
			}		
		}
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);	
	}
	
	

function chk_profile(value){
	//alert(value);
	var url="profile.php?profile="+value;
	//alert(url);
		xmlHttp=getxmlhttpobject();
		xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
			{	
				// 	alert(xmlHttp.responseText);
				$check=parseInt(xmlHttp.responseText);
				if($check!=1)
				{
					document.getElementById("Submit").disabled=true;
					document.getElementById("profile_hidden").value=1;
					//document.getElementById(id1).innerHTML=xmlHttp.responseText;
					if(value!='')
					alert("This Profile Name is Already Exist, Please Enter Another Profile Name!");
					else
					alert("Please Enter Profile Name, Its Mandatory!");
					document.getElementById("profile_name").focus();
					}else{
					//document.getElementById(id1).innerHTML='';
					document.getElementById("profile_hidden").value=0;
					}
				//document.getElementById(id1).innerHTML=xmlHttp.responseText;
			}		
		}
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);	
	}


