var xmlHttp=null;
var xmlHttp2=null;
var elementId1=null;
var elementId2=null;
var detail=null;
var authorData=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 xmlHttp2=new XMLHttpRequest();
 }
catch (e)
 {
 // Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  xmlHttp2=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  xmlHttp2=new ActiveXObject("Microsoft.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 stateChanged() 
{ 
		 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		 { 
			if(xmlHttp.status==200) 
			{
			// alert(xmlHttp.responseText);
			document.getElementById('test').innerHTML=xmlHttp.responseText;
			}
			
		 }
		  else
			{				
				/*document.getElementById('imgAwait').style.visibility = 'visible';*/ // show the waiting image
			}

}	

function showAuthor() 
{ 
		 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		 { 
			if(xmlHttp.status==200) 
			{
			// alert(xmlHttp.responseText);
			document.getElementById('authordetail').innerHTML=xmlHttp.responseText;
			document.getElementById('ajaxwait').innerHTML="";
			}
			
		 }
		  else
			{	
			document.getElementById('ajaxwait').innerHTML="Please Wait...";
				/*document.getElementById('imgAwait').style.visibility = 'visible';*/ // show the waiting image
			}

}	

function showAuthorData() 
{ 
		 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		 { 
			if(xmlHttp.status==200) 
			{
			// alert(xmlHttp.responseText);
			document.getElementById('authorData').innerHTML=xmlHttp.responseText;
			document.getElementById('ajaxwait').innerHTML="";
			}
			
		 }
		  else
			{	
			document.getElementById('ajaxwait').innerHTML="Please Wait...";
				/*document.getElementById('imgAwait').style.visibility = 'visible';*/ // show the waiting image
			}

}	


function newAuthor() 
{ 
		 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		 { 
			if(xmlHttp.status==200) 
			{
			// alert(xmlHttp.responseText);
			document.getElementById('authordetail').innerHTML=xmlHttp.responseText;
			
			document.getElementById('ajaxwait').innerHTML="";
			}
			
		 }
		  else
		{	
		document.getElementById('ajaxwait').innerHTML="Please Wait...";
		}
			
		if (xmlHttp2.readyState==4 || xmlHttp2.readyState=="complete")
		 { 
			if(xmlHttp2.status==200) 
			{// hide the waiting image 
			document.getElementById("selectauthor").innerHTML=xmlHttp2.responseText;
			}
		 }
}


function comData()
{
		/*	alert (1);	*/
		var author = document.getElementById("author").value;
		//alert (author);
		var url = 'communication_show.php?';
		xmlHttp=GetXmlHttpObject();	
		xmlHttp.onreadystatechange=showAuthor;
		xmlHttp.open("GET",url+"author="+author,true);
		xmlHttp.send(null);
}


function authorDataNew()
{
			//alert (1);	
		var author = document.getElementById("author").value;
		//alert (author);
		var url = 'author_show.php?';
		xmlHttp=GetXmlHttpObject();	
		xmlHttp.onreadystatechange=showAuthor;
		xmlHttp.open("GET",url+"author="+author,true);
		xmlHttp.send(null);
}

function authorData()
{
			//alert (1);	
		var author = document.getElementById("author").value;
		//alert (author);
		var url = 'author_show.php?';
		xmlHttp=GetXmlHttpObject();	
		xmlHttp.onreadystatechange=showAuthor;
		xmlHttp.open("GET",url+"author="+author,true);
		xmlHttp.send(null);
}

function updateAuthor(formfield)
{
		var authorid = formfield.value;	
		if(authorid=='add')
		{
		var url = 'author_new.php?';
		xmlHttp=GetXmlHttpObject();	
		xmlHttp.onreadystatechange=newAuthor;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);

		var url2 = 'author_select.php?';
		xmlHttp2=GetXmlHttpObject();	
		xmlHttp2.onreadystatechange=newAuthor;
		xmlHttp2.open("GET",url2,true);
		xmlHttp2.send(null);
		}
		else
		{
		var url = 'author_process.php?';
		xmlHttp=GetXmlHttpObject();	
		xmlHttp.onreadystatechange=showAuthor;
		xmlHttp.open("GET",url+"authorid="+authorid,true);
		xmlHttp.send(null);
		}
}

function editAuthor(authorId)
{
		var url = 'author_edit.php?';
		xmlHttp=GetXmlHttpObject();	
		xmlHttp.onreadystatechange=newAuthor;
		xmlHttp.open("GET",url+"authorId="+authorId,true);
		xmlHttp.send(null);
}
function updateAuthorInfo(formfield)
{
	var fieldName = formfield.name;	
	var fieldValue = htmlentities(formfield.value);
	//alert(fieldValue);
	var url = 'author_update_info.php?';
	xmlHttp=GetXmlHttpObject();	
//	xmlHttp.onreadystatechange=showAuthor;
	xmlHttp.open("GET",url+"fieldName="+fieldName+"&fieldValue="+fieldValue,true);
	xmlHttp.send(null);	
}

function updateAuthorContact()
{


	var phone1 = document.getElementById("phone1").value;
	var phoneType1 = document.getElementById("phonetype1").value;
	var phone2 = document.getElementById("phone2").value;
	var phoneType2 = document.getElementById("phonetype2").value;
	var phone3 = document.getElementById("phone3").value;
	var phoneType3 = document.getElementById("phonetype3").value;	
	//alert(phone1);
	//alert(phoneType3);
	var url = 'author_update_contact.php?';
	xmlHttp=GetXmlHttpObject();	
//	xmlHttp.onreadystatechange=showAuthor;
	xmlHttp.open("GET",url+"phone1="+phone1+"&phoneType1="+phoneType1+"&phone2="+phone2+"&phoneType2="+phoneType2+"&phone3="+phone3+"&phoneType3="+phoneType3,true);
	xmlHttp.send(null);	
}

function uploadauthorpic(formfield)
{
	//alert(1);
	var fieldName = formfield.name;	
	//alert(fieldName);
	var fieldValue = formfield.value;
	//alert(fieldValue);	
	var url = 'author_upload_pic.php?';
	xmlHttp=GetXmlHttpObject();
	xmlHttp.onreadystatechange=showAuthor;
	xmlHttp.open("GET",url+"fieldName="+fieldName+"&fieldValue="+fieldValue,true);
	xmlHttp.send(null);	
}

/*function makequery($cityId, $keyWord)
{
	$sqlQuery = "select * from shop ";
	if($cityId=='' && $keyWord =='')
	{
		return $sqlQuery;
	}
	else
	{
		$whereCity = "";
		if($cityId!='' )
		{
		$whereCity = " where city_id='$cityId'";
		$sqlQuery = $sqlQuery.$whereCity;
			if($keyWord!='')
			{
				$sqlQuery = $sqlQuery." AND ";
			}
		}
		else
		{
		$sqlQuery = $sqlQuery." WHERE ";
		}

		$whereKeyWord= "'";
		
		if($keyWord!='')
		{
		$whereKeyWrod = " (shopname like '%$keyWord%' OR shopname like '$keyWord%' OR shopname like '%$keyWord' OR shopname like '$keyWord' OR address like '%$keyWord%' OR phone1 like '%$keyWord%' OR phone2  like '%$keyWord%' OR contactperson like '%$keyWord%') ";
		$sqlQuery = $sqlQuery.$whereKeyWrod ;
		}

	}// else main else
	return $sqlQuery;
	
}*/

function insertDate(formfield, table, tableIdName, tableId)
{
	//alert (tableIdName);
	var fieldName = formfield.name;	
	var fieldValue = formfield.value;
	//var dateArray= fieldValue.split("/");
	//var newarray = new Array(dateArray[2], dateArray[1], dateArray[0])
	//var convertedDate = newarray.join("-");
	var url = 'update_date.php?'; 
	xmlHttp=GetXmlHttpObject();	
	//xmlHttp.onreadystatechange=graphicsstate;	
	xmlHttp.open("GET",url+"fieldName="+fieldName+"&convertedDate="+fieldValue+"&table="+table+"&tableIdName="+tableIdName+"&tableId="+tableId,true);
	xmlHttp.send(null);	
}

function convertAndInsertDate(formfield, table, tableIdName, tableId)
{
	var fieldName = formfield.name;	
	var fieldValue = formfield.value;
	//var dateArray= fieldValue.split("/");
	//var newarray = new Array(dateArray[2], dateArray[1], dateArray[0])
	//var convertedDate = newarray.join("-");
	var url = 'date_convert_insert.php?'; 
	xmlHttp=GetXmlHttpObject();
	//xmlHttp.onreadystatechange=graphicsstate;	
	xmlHttp.open("GET",url+"fieldName="+fieldName+"&convertedDate="+fieldValue+"&table="+table+"&tableIdName="+tableIdName+"&tableId="+tableId,true);
	xmlHttp.send(null);	
}

function showPage() 
{ 
		 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		 { 
			if(xmlHttp.status==200) 
			{
			// alert(xmlHttp.responseText);
			document.getElementById('pagedata').innerHTML=xmlHttp.responseText;
			document.getElementById('ajaxwait').innerHTML="";
			}
			
		 }
		  else
			{	
			document.getElementById('ajaxwait').innerHTML="Please Wait...";
				/*document.getElementById('imgAwait').style.visibility = 'visible';*/ // show the waiting image
			}

}	

function diplaypage(urlname, table, caption, table_id)
{
	//alert(1);
	var url = 'create_session.php?';
	xmlHttp=GetXmlHttpObject();	
	xmlHttp.onreadystatechange=showPage;
	xmlHttp.open("GET",url+"urlname="+urlname+"&table="+table+"&caption="+caption+"&table_id="+table_id,true);
	xmlHttp.send(null);	
}

function addnewshop()
{
	//alert(1);
	var url = 'addnew.php?';
	xmlHttp=GetXmlHttpObject();	
	xmlHttp.onreadystatechange=showPage;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);	
}

function addnewcat(cat_name)
{
	//alert(cat_name);
	var url = 'manage_specialist.php?';
	xmlHttp=GetXmlHttpObject();	
	xmlHttp.onreadystatechange=showPage;
	xmlHttp.open("GET",url+"cat_name="+cat_name,true);
	xmlHttp.send(null);	
}

function editbookshop(action,rId)
{
	if(action=='delete')
	{
		var url='bookshopaction.php?';
		var actionId=1;
	}
	
	else if(action=='edit')
	{
		//alert(1);
		var url='editbookshop.php?';
		var actionId=2;
	}
	xmlHttp=GetXmlHttpObject();	
	xmlHttp.onreadystatechange=showPage;
	xmlHttp.open("GET",url+"actionId="+actionId+"&rId="+rId,true);
	xmlHttp.send(null);	
}

function showtabledetail() 
{ 
		 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		 { 
			if(xmlHttp.status==200) 
			{
			// alert(xmlHttp.responseText);
			document.getElementById(detail).innerHTML=xmlHttp.responseText;
			document.getElementById('ajaxwait').innerHTML="";
			}
			
		 }
		  else
			{	
			document.getElementById('ajaxwait').innerHTML="Please Wait...";
				/*document.getElementById('imgAwait').style.visibility = 'visible';*/ // show the waiting image
			}

}	

function showDetail(tablename, tableId)
{
	//alert(tablename);
	detail = tablename+"detail";
	//var chechkbox = 'tableArray['+tablename+']';
	//alert(detail);
	document.getElementsByName(tablename).checked=false;
	//alert(document.getElementsByName(tablename).value);
	var url = 'show_table_detail.php?';
	xmlHttp=GetXmlHttpObject();	
	xmlHttp.onreadystatechange=showtabledetail;
	xmlHttp.open("GET",url+"tablename="+tablename+"&tableId="+tableId,true);
	xmlHttp.send(null);	
}

function showCheckedRecords(tablename,tableId)
{
	//alert(tablename);
	//alert(tableId);
	detail = tablename+"detail";
	//alert(detail);
	//document.getElementById(tablename).checked=false;
	var url = 'show_table_detail_checked.php?';
	xmlHttp=GetXmlHttpObject();	
	xmlHttp.onreadystatechange=showtabledetail;
	xmlHttp.open("GET",url+"tablename="+tablename+"&tableId="+tableId,true);
	xmlHttp.send(null);	
}

function selectAll()
{
	document.getElementById("bookshops").checked=true;
	document.getElementById("wholesellers").checked=true;
	document.getElementById("distributers").checked=true;
	document.getElementById("airport_bookshops").checked=true;
	document.getElementById("idividual_buyers").checked=true;
	document.getElementById("film_producers").checked=true;
	document.getElementById("newspapers").checked=true;
	document.getElementById("magazines").checked=true;
	document.getElementById("radio").checked=true;
	document.getElementById("internet_marketing_companies").checked=true;
	document.getElementById("tv_stations").checked=true;
	//document.getElementById("specialistcat").checked=true;
	
	
}

function uncheckAll()
{
	document.getElementById("bookshops").checked=false;
	document.getElementById("wholesellers").checked=false;
	document.getElementById("distributers").checked=false;
	document.getElementById("airport_bookshops").checked=false;
	document.getElementById("idividual_buyers").checked=false;
	document.getElementById("film_producers").checked=false;
	document.getElementById("newspapers").checked=false;
	document.getElementById("magazines").checked=false;
	document.getElementById("radio").checked=false;
	document.getElementById("internet_marketing_companies").checked=false;
	document.getElementById("specialist").checked=false;
	document.getElementById("tv_stations").checked=false;
	
}

function clearDiv(divName)
{
	//alert(cat_name);
	detail = divName;
	//alert(detail);
	var url = 'cleardiv.php?';
	xmlHttp=GetXmlHttpObject();	
	xmlHttp.onreadystatechange=showtabledetail;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);	
}


function showPrint() 
{ 
		 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		 { 
			if(xmlHttp.status==200) 
			{
			// alert(xmlHttp.responseText);
			document.getElementById('printarea').innerHTML=xmlHttp.responseText;
			document.getElementById('ajaxwait').innerHTML="";
			}
			
		 }
		  else
			{	
			document.getElementById('ajaxwait').innerHTML="Please Wait...";
				/*document.getElementById('imgAwait').style.visibility = 'visible';*/ // show the waiting image
			}

}	


function startPrinting(leterDetails)
{
	//alert(cat_name);
	//detail = divName;
	//alert(detail);
	var url = 'print_letters.php?';
	xmlHttp=GetXmlHttpObject();	
	xmlHttp.onreadystatechange=showPrint;
	xmlHttp.open("GET",url+"leterDetails="+leterDetails,true);
	xmlHttp.send(null);	
}

function dataOfSelectedAuthor(url, tdId)
{
		authorData==tdId;
		//var authorid = formfield.value;	
		//var url = 'author_process.php?';
		xmlHttp=GetXmlHttpObject();	
		xmlHttp.onreadystatechange=showAuthorData;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
}

function createAuthorDataSession(formfield, page)
{
		
		var bookId = formfield.value;
		var url = 'create_authordata_session.php?';
		xmlHttp=GetXmlHttpObject();	
		//xmlHttp.onreadystatechange=showAuthorData;
		xmlHttp.open("GET",url+"bookId="+bookId+"&page="+page,true);
		xmlHttp.send(null);	
}

function showAuthorBooks() 
{ 
		 if (xmlHttp2.readyState==4 || xmlHttp2.readyState=="complete")
		 { 
			if(xmlHttp2.status==200) 
			{
			//alert(xmlHttp2.responseText);
			document.getElementById('authorBooks').innerHTML=xmlHttp2.responseText;
			document.getElementById('ajaxwait').innerHTML="";
			}
			
		 }
		  else
			{	
			document.getElementById('ajaxwait').innerHTML="Please Wait...";
				/*document.getElementById('imgAwait').style.visibility = 'visible';*/ // show the waiting image
			}

}	

function authorBooks(formfield)
{
		//alert(1);
		var authorId = formfield.value;
		var url = 'show_author_books.php?';
		xmlHttp2=GetXmlHttpObject();	
		xmlHttp2.onreadystatechange=showAuthorBooks;
		xmlHttp2.open("GET",url+"authorId="+authorId,true);
		xmlHttp2.send(null);	
}
function changeBookId(formfield)
{
		var bookid = formfield.value;
		var url = 'createbooksession.php?';
		xmlHttp=GetXmlHttpObject();	
		//xmlHttp.onreadystatechange=showAuthor;
		xmlHttp.open("GET",url+"bookid="+bookid,true);
		xmlHttp.send(null);
}

function createAuthorFirstBookSession(formfield)
{
		var authorId = formfield.value;
		//alert(authorId);
		var url = 'createAuhtorFirstBookSession.php?';
		xmlHttp=GetXmlHttpObject();	
		//xmlHttp.onreadystatechange=showAuthor;
		xmlHttp.open("GET",url+"authorId="+authorId,true);
		xmlHttp.send(null);
}

function duplicateBookState() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		if(xmlHttp.status==200) 
		{
			if (xmlHttp.responseText!='ok')
				 {
					alert(xmlHttp.responseText);
				 }
				 else
				 {
				//document.getElementById('duplicateBook').innerHTML=xmlHttp.responseText;
				 }
		}
	}
	else
	{	
	//document.getElementById('bookdetail').innerHTML="Please Wait...";
	}
}


function updateDuplicateBookInfo(formfield, msgbox)
{
	//alert(1);
	duplicateBook=msgbox;
	var fieldName = formfield.name;	
	var fieldValue = formfield.value;
	var url = 'book_update_duplicate_info.php?';
	xmlHttp=GetXmlHttpObject();	
	xmlHttp.onreadystatechange=duplicateBookState;	
	xmlHttp.open("GET",url+"fieldName="+fieldName+"&fieldValue="+fieldValue,true);
	xmlHttp.send(null);	
}

function duplicateisbncheck() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		if(xmlHttp.status==200) 
		{
			if (xmlHttp.responseText=='ISBN is unique!!')
				 {
					//document.getElementById('duplicateBook').innerHTML=xmlHttp.responseText;
				 }
				 else
				 {
				alert(xmlHttp.responseText);
				 }
		}
	}
	else
	{	
	//document.getElementById('contractdetail').innerHTML="Please Wait...";
	}
}

function emailcheckstate() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		if(xmlHttp.status==200) 
		{
			if (xmlHttp.responseText==1)
				 {
					 //alert(xmlHttp.responseText);
					document.getElementById('emailerr').innerHTML="Email Address Does not exist";
				 }
				 else
				 {
					 //alert(xmlHttp.responseText);
				document.getElementById('emailerr').innerHTML=""
				 }
		}
	}
	else
	{	
	document.getElementById('emailerr').innerHTML="Please Wait...";
	}
}

/*function checkpassword()
{
	alert(1);
	var password=document.getElementById('password').value;
	var repassword=document.getElementById('repassword').value;
	if(password!=repassword)
	{
		document.getElementById('errortd').value="Password Mismatch..!!";
	}
	//xmlHttp=GetXmlHttpObject();	
	//xmlHttp.onreadystatechange=passwordmismatchcheck;	
}
*/
 function checkemail()
{
	//alert(1);
	
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	var email =  document.getElementById('email').value
	if(document.getElementById('email').value.match(emailExp))
	{
		//alert(email);
		var url = 'varify_email.php?';
		xmlHttp=GetXmlHttpObject();	
		xmlHttp.onreadystatechange=emailcheckstate;	
		xmlHttp.open("GET",url+"email="+email,true);
		xmlHttp.send(null);	
		
	}
	else
	
	{
		document.getElementById('errortd').innerHTML="Incorrect Email..!!";
		$msg=0
	}

}


function availabilitystate() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		if(xmlHttp.status==200) 
		{
			if (xmlHttp.responseText)
				 {
					 //alert(xmlHttp.responseText);
					document.getElementById('availdiv').innerHTML=xmlHttp.responseText;
					
				 }
				 else
				 {
					 //alert(xmlHttp.responseText);
				document.getElementById('availdiv').innerHTML=""
				 }
		}
	}
	else
	{	
	document.getElementById('availdiv').innerHTML="Please Wait...";
	}
}


function checkAvailability()
{
	//alert(1);
	
	var email =  document.getElementById('client_email').value
	
		//alert(email);
		var url = 'check_availabiity.php?';
		xmlHttp=GetXmlHttpObject();	
		xmlHttp.onreadystatechange=availabilitystate;	
		xmlHttp.open("GET",url+"email="+email,true);
		xmlHttp.send(null);	
		

}


function emailstate() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		if(xmlHttp.status==200) 
		{
			if (xmlHttp.responseText)
				 {
					 //alert(xmlHttp.responseText);
					document.getElementById(elementId1).innerHTML=xmlHttp.responseText;
					
				 }
				 else
				 {
					 //alert(xmlHttp.responseText);
				document.getElementById(elementId1).innerHTML=""
				 }
				 
		}
	}
	else
	{	
	document.getElementById(elementId1).innerHTML="Please Wait...";
	}
}

function showEmail(msgId,table)
{
	
		elementId1="msgDiv";
		//document.getElementById(elementId1).style.visibility='visible';
		//alert(table);
		var url = 'show_email.php?';
		xmlHttp=GetXmlHttpObject();	
		xmlHttp.onreadystatechange=emailstate;	
		xmlHttp.open("GET",url+"msgId="+msgId+"&table="+table,true);
		xmlHttp.send(null);
		
	
}
function hidediv(div)
{
	//alert(div);
	document.getElementById(div).style.display='none';
}

function showSentMsg(msgId,table)
{
	
		elementId1="msgDiv";
		//document.getElementById(elementId1).style.visibility='visible';
		//alert(table);
		var url = 'show_sent_message.php?';
		xmlHttp=GetXmlHttpObject();	
		xmlHttp.onreadystatechange=emailstate;	
		xmlHttp.open("GET",url+"msgId="+msgId+"&table="+table,true);
		xmlHttp.send(null);
		
	
}

function markAsRed(msgId)
{
	
		elementId1="msgDiv";
		//document.getElementById(elementId1).style.visibility='visible';
		//alert(table);
		var url = 'mark_as_red.php?';
		xmlHttp=GetXmlHttpObject();	
		xmlHttp.onreadystatechange=emailstate;	
		xmlHttp.open("GET",url+"msgId="+msgId,true);
		xmlHttp.send(null);
		
	
}



function showquicksearch()
{
	
		elementId1="searchdiv";
		var url = 'quick_search.php?';
		xmlHttp=GetXmlHttpObject();	
		xmlHttp.onreadystatechange=emailstate;	
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
	
}
function update_intro_flag(formfield,id)
{
	
		
		var fieldName = formfield.name;	
		var fieldValue = formfield.value;
		var url = 'update_intro_flag.php?';
		xmlHttp=GetXmlHttpObject();	
		//xmlHttp.onreadystatechange=emailstate;	
		xmlHttp.open("GET",url+"fieldName="+fieldName+"&fieldValue="+fieldValue+"&id="+id,true);
		xmlHttp.send(null);
	
}
/*function checkpassword()
{
	alert(1);
	var password=document.getElementById('password').value;
	var repassword=document.getElementById('repassword').value;
	if(password!=repassword)
	{
		document.getElementById('errortd').value="Password Mismatch..!!";
	}
	//xmlHttp=GetXmlHttpObject();
	//xmlHttp.onreadystatechange=passwordmismatchcheck;	
}
*/

function passwordstate() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		if(xmlHttp.status==200) 
		{
			if (xmlHttp.responseText)
				 {
					 //alert(xmlHttp.responseText);
					document.getElementById('availdiv').innerHTML=xmlHttp.responseText;
					
				 }
				 else
				 {
					 //alert(xmlHttp.responseText);
				document.getElementById('availdiv').innerHTML=""
				 }
		}
	}
	else
	{	
	document.getElementById('availdiv').innerHTML="Please Wait...";
	}
}


function checkoldpassword(emp_id,emp)
{
	//alert(1);
	
	//alert(emp_id);
	//alert(emp);
	var password =  document.getElementById('old_pass').value
	
		
		var url = 'check_password.php?';
		xmlHttp=GetXmlHttpObject();	
		xmlHttp.onreadystatechange=passwordstate;	
		xmlHttp.open("GET",url+"password="+password+"&emp_id="+emp_id+"&emp="+emp,true);
		xmlHttp.send(null);	
		

}


function jobchannelstate() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		if(xmlHttp.status==200) 
		{
			if (xmlHttp.responseText)
				 {
					 //alert(xmlHttp.responseText);
					document.getElementById('jobchannels').innerHTML=xmlHttp.responseText;
					
				 }
				 else
				 {
					 //alert(xmlHttp.responseText);
				document.getElementById('jobchannels').innerHTML=""
				 }
		}
	}
	else
	{	
	document.getElementById('jobchannels').innerHTML="Please Wait...";
	}
}


function show_all_job_channels()
{
	
		
		var url = 'job_channels.php?';
		xmlHttp=GetXmlHttpObject();	
		xmlHttp.onreadystatechange=jobchannelstate;	
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);	
		

}

