
var xmlHttp

function _info_cat1(str,id)
{
	if(str=="")
	return;
	xmlHttp=GetXmlHttpObject();
	
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	var url="ajax_dmenu.php";
	url=url+"?type="+str+"&id="+id;
	xmlHttp.onreadystatechange=stateChanged1;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChanged1() 
{ 
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById("divcat2").innerHTML=xmlHttp.responseText;
	}
}



function _info_cat2(str,id)
{ 
	if(str=="")
	return;
	xmlHttp=GetXmlHttpObject();
	
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	var url="ajax_dmenu.php";
	url=url+"?type="+str+"&id="+id;
	xmlHttp.onreadystatechange=stateChanged2;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChanged2() 
{ 
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById("divcat3").innerHTML=xmlHttp.responseText;
	}
}


function _info_cat3(str,id)
{ 
	if(str=="")
	return;
	xmlHttp=GetXmlHttpObject();
	
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	var url="ajax_dmenu.php";
	url=url+"?type="+str+"&id="+id;
	xmlHttp.onreadystatechange=stateChanged3;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChanged3() 
{ 
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById("divcat4").innerHTML=xmlHttp.responseText;
	}
}

function uname(str)
{ 
	if(str=="")
	return;
	xmlHttp=GetXmlHttpObject();
	
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	var url="ajax_dmenu.php";
	url=url+"?uname="+str+"&type=uname";
	xmlHttp.onreadystatechange=stateChanged4;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChanged4() 
{ 
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById("umsg").innerHTML=xmlHttp.responseText;
	}
}


// fucntion to delete restaurant item picture
function _remove_info_pic(type,id,pic)
{
	if(id=="")
	return;
	xmlHttp=GetXmlHttpObject();
	
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	var url="ajax_del.php";
	url=url+"?id="+id+"&pic="+pic+"&ctype="+type;
	xmlHttp.onreadystatechange=stateChanged5;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function stateChanged5() 
{ 

	if (xmlHttp.readyState==4)
	{ 
		alert("Picture removed successfully ");
		//alert(xmlHttp.responseText);

	}
}

// fucntion to show product detail
function _showProDetail(id,type)
{
	if(id=="")
	return;
	xmlHttp=GetXmlHttpObject();
	
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	var url="ajax_detail.php";
	url=url+"?id="+id+"&ctype="+type;
	xmlHttp.onreadystatechange=stateChanged6;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function stateChanged6() 
{ 

	if (xmlHttp.readyState==4)
	{ 
		document.getElementById("pro_view").innerHTML=xmlHttp.responseText;
	}
}

// fucntion to update personal detail
function _updatePersonal(id,name,mobile,landline,email,position,ctype)
{
	if(id=="")
	return;
	xmlHttp=GetXmlHttpObject();
	
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	var url="ajax_update.php";
	url=url+"?id="+id+"&ctype="+ctype+"&name="+name+"&mobile="+mobile+"&landline="+landline+"&email="+email+"&position="+position;
	xmlHttp.onreadystatechange=stateChanged7;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function stateChanged7() 
{ 

	if (xmlHttp.readyState==4)
	{ 
		//updation done now show updated data
		
		id=xmlHttp.responseText;
		
		_updatePersonalShow(id,'personal_detail')
	}
}


// fucntion to show personal detail
function _updatePersonalShow(id,ctype)
{
	if(id=="")
	return;
	xmlHttp=GetXmlHttpObject();
	
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	var url="ajax_detail.php";
	url=url+"?id="+id+"&ctype="+ctype;
	xmlHttp.onreadystatechange=stateChanged8;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function stateChanged8() 
{ 

	if (xmlHttp.readyState==4)
	{ 
		document.getElementById("div_personal").innerHTML=xmlHttp.responseText;
		document.getElementById('form_progress').style.display='none';
		document.getElementById('show_pers_info').style.display='block';
	    document.getElementById('edit_pers_info').style.display='none';
	}
}

// fucntion to update password
function _updatePass(id,newpass,oldpass,ctype)
{
	if(id=="")
	return;
	xmlHttp=GetXmlHttpObject();
	
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	var url="ajax_update.php";
	url=url+"?id="+id+"&newpass="+newpass+"&oldpass="+oldpass+"&ctype="+ctype;
	xmlHttp.onreadystatechange=stateChanged9;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function stateChanged9() 
{ 

	if (xmlHttp.readyState==4)
	{ 
		document.getElementById('passMsg').innerHTML=xmlHttp.responseText;
		document.getElementById('form_progress1').style.display='none';
		document.getElementById('passMsg').style.display='block';
		document.getElementById('passEdit').style.display='none';
	}
}

// fucntion to send forget password request
function _forgetPass(email,ctype)
{
	if(email=="")
	return;
	xmlHttp=GetXmlHttpObject();
	
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	var url="ajax_update.php";
	url=url+"?email="+email+"&ctype="+ctype;
	xmlHttp.onreadystatechange=stateChanged10;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function stateChanged10() 
{ 

	if (xmlHttp.readyState==4)
	{ 
		document.getElementById('msg1').innerHTML=xmlHttp.responseText;
		document.getElementById('cancel').value="Login Now";
	}
}



// function to submitt user query for info product

function _submitQuery(proid,compid,name,phone,email,subject,query,code,type,ctype)
{

	if(email=="")
	return;
	xmlHttp=GetXmlHttpObject();
	
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	var url="aj_form_upload.php";
	url=url+"?proid="+proid+"&compid="+compid+"&name="+name+"&phone="+phone+"&email="+email+"&subject="+subject+"&query="+query+"&code="+code+"&type="+type+"&ctype="+ctype;
	xmlHttp.onreadystatechange=stateChanged11;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function stateChanged11() 
{ 

	if (xmlHttp.readyState==4)
	{ 
		msg1="<b>Your query successfully sent to company</b>";
		msg2="<b>Sorry ! could not sent query to company now . Please try later</b>";
		
		val=xmlHttp.responseText;
		
		if(val==1)
		{
			document.getElementById('query_div1').innerHTML=msg1;
		}
		else if(val==2)
		{
			document.getElementById('query_div1').innerHTML=msg2;
		}
		else
		{
			document.getElementById('query_div').style.display="block";
			document.getElementById('query_div1').style.display="none";	
			document.getElementById('c_security').style.display="block";
		}
		
	}
}



function _info_cat4(str,id)
{
	if(str=="")
	return;
	xmlHttp=GetXmlHttpObject();
	
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	var url="ajax_dmenu.php";
	url=url+"?type="+str+"&id="+id;
	xmlHttp.onreadystatechange=stateChanged12;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChanged12() 
{ 
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById("div_cat2").innerHTML=xmlHttp.responseText;
	}
}



function _info_cat5(str,id)
{ 
	if(str=="")
	return;
	xmlHttp=GetXmlHttpObject();
	
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	var url="ajax_dmenu.php";
	url=url+"?type="+str+"&id="+id;
	xmlHttp.onreadystatechange=stateChanged13;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChanged13() 
{ 
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById("div_cat3").innerHTML=xmlHttp.responseText;
	}
}


function _info_cat6(str,id)
{ 
	if(str=="")
	return;
	xmlHttp=GetXmlHttpObject();
	
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	var url="ajax_dmenu.php";
	url=url+"?type="+str+"&id="+id;
	xmlHttp.onreadystatechange=stateChanged14;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChanged14() 
{ 
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById("div_cat4").innerHTML=xmlHttp.responseText;
	}
}


function _info_group(str,id)
{ 
	if(str=="")
	return;
	xmlHttp=GetXmlHttpObject();
	
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	var url="ajax_dmenu.php";
	url=url+"?type="+str+"&id="+id;
	xmlHttp.onreadystatechange=stateChanged15;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChanged15() 
{ 
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById("group").innerHTML=xmlHttp.responseText;
	}
}



function show_cus_form(ctype,id)
{
	if(ctype=="")
	{
		return;	
	}
	
	xmlHttp=GetXmlHttpObject();
	
	if(xmlHttp==null)
	{
		alert("Your browser doesn't support ajax");
		return;
	}
	var url="ajax_update.php";
	
	params="ctype="+ctype+"&id="+id;
	
	xmlHttp.open("POST",url,true);
	//Send the proper header information along with the request
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", params.length);
	xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.onreadystatechange=stateChanged16;
	xmlHttp.send(params);
}

function stateChanged16()
{
	if (xmlHttp.readyState==4)
	{
		document.getElementById('container').innerHTML=xmlHttp.responseText;
		
	}
}


function single_sms(ctype,mobile,s_msg,qty)
{
	if(ctype=="")
	{
		return;	
	}
	
	xmlHttp=GetXmlHttpObject();
	
	if(xmlHttp==null)
	{
		alert("Your browser doesn't support ajax");
		return;
	}
	var url="_send.php";
	
	params="ctype="+ctype+"&mobile="+mobile+"&s_msg="+s_msg+"&sms_count="+qty;
	
	xmlHttp.open("POST",url,true);
	//Send the proper header information along with the request
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", params.length);
	xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.onreadystatechange=stateChanged17;
	xmlHttp.send(params);
}

function stateChanged17()
{
	if (xmlHttp.readyState==4)
	{
		
		//document.getElementById('msg1').innerHTML=xmlHttp.responseText;
		document.getElementById('letter_box_message').style.display='block';
		document.getElementById('message_for_letter').innerHTML=xmlHttp.responseText;
		
	}
}

function cus_add(ctype,group_id,name,mobile,email,city,newcity,sname,dob,sdob,anni,id)
{
	if(ctype=="")
	{
		return;	
	}
	
	xmlHttp=GetXmlHttpObject();
	
	if(xmlHttp==null)
	{
		alert("Your browser doesn't support ajax");
		return;
	}
	var url="ajax_update.php";
	
	url=url+"?ctype="+ctype+"&group_id="+group_id+"&name="+name+"&mobile="+mobile+"&email="+email+"&city="+city+"&newcity="+newcity+"&sname="+sname+"&dob="+dob+"&sdob="+sdob+"&anni="+anni+"&id="+id;
	
	xmlHttp.onreadystatechange=stateChanged18;
	
	xmlHttp.open("GET",url,true);
	
	xmlHttp.send(null);
}

function stateChanged18()
{
	if (xmlHttp.readyState==4)
	{
		
		//document.getElementById('msg1').innerHTML=xmlHttp.responseText;
		document.getElementById('letter_box_message').style.display='block';
		document.getElementById('message_for_letter').innerHTML=xmlHttp.responseText;
		
	}
}


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