// JavaScript Document
var xmlHttp




function jlcaste(str)
{
	document.edusear.qcaste.value = str;
	if(str > 0)
	{
       xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			 alert ("Browser does not support HTTP Request")
			 return
		 }
	 url = "including_files/scastedisp.php?r="+str
	 url=url+"&sid="+Math.random()
	 xmlHttp.onreadystatechange=qdispscaste
	 xmlHttp.open("GET",url,true)
	 xmlHttp.send(null)
	}
	else
	{
		document.getElementById("scastload").innerHTML='<select name="lcaste1" size="7" multiple id="lcaste" style="width:150px;"><option value="-1">Any</option></select>';
		//document.getElementById("qqcaste").outerHTML= document.getElementById("qqcaste").outerHTML;
		document.edusear.ncaste.value = "-1";
	}
}

function qdispscaste()
{
	if (xmlHttp.readyState==4 )
		{
		//alert(xmlHttp.responseText);
		document.getElementById("scastload").innerHTML=xmlHttp.responseText;
		document.getElementById("scastload1").innerHTML='<select name="lcaste1" size="7" multiple id="lcaste1" style="width:150px;"></select>';
		//document.getElementById("qqcaste").outerHTML= document.getElementById("qqcaste").outerHTML;
		document.edusear.ncaste.value = "";
	
		}
}


function lqcaste(str)
{
	document.qsearch.qcaste.value = str;
}

function qcasteload(str)
{
	xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			 alert ("Browser does not support HTTP Request")
			 return
		 }
	 url = "including_files/castedisp.php?r="+str
	 url=url+"&sid="+Math.random()
	 xmlHttp.onreadystatechange=qdispcaste
	 xmlHttp.open("GET",url,true)
	 xmlHttp.send(null)
}

function qdispcaste()
{
	if (xmlHttp.readyState==4)
		{
			//alert("response /n"+xmlHttp.responseText);
		//document.myForm.cas.value=xmlHttp.responseText;
		document.getElementById("qqcaste").innerHTML=""+xmlHttp.responseText
		//document.getElementById("qqcaste").outerHTML= document.getElementById("qqcaste").outerHTML;
		//document.qsearch.qcaste.value = "-1";
	
		}
}


function bcasteload(str)
{
	
	
	document.getElementById("qcaste").value=str;
	//alert("yes bos "+str);
}



function qcasteloadoth(str)
{
	xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			 alert ("Browser does not support HTTP Request")
			 return
		 }
	 url = "../../including_files/castedisp.php?r="+str
	 url=url+"&sid="+Math.random()
	 xmlHttp.onreadystatechange=qdispcaste
	 xmlHttp.open("GET",url,true)
	 xmlHttp.send(null)
}

function qdispcasteoth()
{
	if (xmlHttp.readyState==4 )
		{
		//document.myForm.cas.value=xmlHttp.responseText;
		document.getElementById("qqcaste").innerHTML=""+xmlHttp.responseText
		document.getElementById("qqcaste").outerHTML= document.getElementById("qqcaste").outerHTML;
		document.qsearch.qcaste.value = "-1";
	
		}
}




function jcasteload(str)
{
	xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			 alert ("Browser does not support HTTP Request")
			 return
		 }
	 url = "including_files/castedisp.php?r="+str
	 url=url+"&sid="+Math.random()
	 xmlHttp.onreadystatechange=jdispcaste
	 xmlHttp.open("GET",url,true)
	 xmlHttp.send(null)
}

function jdispcaste()
{
	if (xmlHttp.readyState==4 )
		{
		//document.myForm.cas.value=xmlHttp.responseText;
		document.getElementById("jcaste").innerHTML=""+xmlHttp.responseText
		document.getElementById("jcaste").outerHTML= document.getElementById("jcaste").outerHTML;
	
		}
}


function cartdisp(str)
{
	//alert(str)
	xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			 alert ("Browser does not support HTTP Request")
			 return
		 }
     document.cartnew.cart.value = "";
	 document.cartnew.carse.value ="";		 
	 url = "including_files/cartup.php?"+str
	 url=url+"&sid="+Math.random()
	 xmlHttp.onreadystatechange=cartdispfin
	 xmlHttp.open("GET",url,true)
	 xmlHttp.send(null)
}

function cartdispfin()
{
	if (xmlHttp.readyState==4 )
		{
		//document.myForm.cas.value=xmlHttp.responseText;
		var rco = xmlHttp.responseText;
		
		var rcoarray = rco.split(",");
		   //alert(rcoarray[5]);
		//alert ("ar0="+rcoarray[0]+" ar1="+rcoarray[1]+" ar2="+rcoarray[2]+" ar3="+rcoarray[3]+" ar4="+rcoarray[4]+" ar5="+rcoarray[5]+" ar6="+rcoarray[6]);
		    if (rcoarray[2] == 0)
			{
				if (rcoarray[0] == 15)
					{
                        alert(rcoarray[7] +" is Added to Profile Selection Cart");
                        //alert ("Maximum Profiles Selected Please Confirm / Remove Profiles from your Cart To Proceed Further");
                        document.getElementById("shcart").innerHTML="<strong><font color='#FFFFFF' size='2' face='arial'>"+rcoarray[1]+"</font></strong>";
						document.getElementById("shbal").innerHTML="<strong><font color='#FFFFFF' size='2' face='arial'>"+rcoarray[3]+"</font></strong>";
						document.cartnew.bppro.value = rcoarray[6];
						document.getElementById("listcart").innerHTML=rcoarray[5];
						document.cartnew.ptcart.value = rcoarray[1];
						document.cartnew.carselen.value = rcoarray[8];
					}
				else
					{
                        alert(rcoarray[7] +" is Added to Profile Selection Cart");
                        document.getElementById("shcart").innerHTML="<strong><font color='#FFFFFF' size='2' face='arial'>"+rcoarray[1]+"</font></strong>";
						document.getElementById("shbal").innerHTML="<strong><font color='#FFFFFF' size='2' face='arial'>"+rcoarray[3]+"</font></strong>";
						document.cartnew.bppro.value = rcoarray[6];
						document.getElementById("listcart").innerHTML=rcoarray[5];
						document.cartnew.ptcart.value = rcoarray[1];
						document.cartnew.carselen.value = rcoarray[8];
						//alert(xmlHttp.responseText);
					}
			 }
			 
			 else if(rcoarray[4] == 0)
			 {
				 alert(rcoarray[2] +" Profile is Already in Selected Cart");
				 document.getElementById("shcart").innerHTML="<strong><font color='#FFFFFF' size='2' face='arial'>"+rcoarray[1]+"</font></strong>";
				 document.getElementById("shbal").innerHTML="<strong><font color='#FFFFFF' size='2' face='arial'>"+rcoarray[3]+"</font></strong>";
				 document.cartnew.bppro.value = rcoarray[6];
				 document.getElementById("listcart").innerHTML=rcoarray[5];
				 document.cartnew.ptcart.value = rcoarray[1];
				 document.cartnew.carselen.value = rcoarray[8];
			 
			 }
			 else
			 {
				 
 				 alert(rcoarray[4]);
				 document.getElementById("shcart").innerHTML="<strong><font color='#FFFFFF' size='2' face='arial'>"+rcoarray[1]+"</font></strong>";
				 document.getElementById("shbal").innerHTML="<strong><font color='#FFFFFF' size='2' face='arial'>"+rcoarray[3]+"</font></strong>";
				 document.cartnew.bppro.value = rcoarray[6];
				 document.getElementById("listcart").innerHTML=rcoarray[5];
				 document.cartnew.ptcart.value = rcoarray[1];
				 document.cartnew.carselen.value = rcoarray[8];

			 }
			 
			 
	
		}

}

function cartrem()
{
	if(document.cartnew.ptcart.value == 0)
	{
       alert("Your Profile Selection Cart is Empty");
       return;
     }
    if(document.cartnew.cart.value == "")
	  {
		  alert("Select Any one Profile from your Cart to Proceed Further");
		  return;
	  }
	//alert(str)
	xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			 alert ("Browser does not support HTTP Request")
			 return
		 }
	  
	 str = document.cartnew.cart.value + document.cartnew.sco.value; 
	 //alert(str);
	 url = "including_files/cartremove.php?p1="+str
	 url=url+"&sid="+Math.random()
	 xmlHttp.onreadystatechange=cartlistshow
	 xmlHttp.open("GET",url,true)
	 xmlHttp.send(null)
	
}

function cartlistshow()
{
	if (xmlHttp.readyState==4 )
		{
		var cartremo = xmlHttp.responseText;
		var cartremoarray = cartremo.split(",");
		var shf = document.getElementById('shcart1');
		document.getElementById("shcart").innerHTML="<strong><font color='#FFFFFF' size='2' face='arial'>"+cartremoarray[0]+"</font></strong>";
		if (shf != null)
		{
		document.getElementById("shcart1").innerHTML= "<font size='2' face='Arial, Helvetica, sans-serif'>Selected Profiels <font color='#CC3300'>( <font size='2' face='Arial, Helvetica, sans-serif'>"+cartremoarray[0]+"</font> )</font> </font>";
		}
		document.getElementById("shbal").innerHTML="<strong><font color='#FFFFFF' size='2' face='arial'>"+cartremoarray[1]+"</font></strong>";
		//alert(cartremoarray[0]);
		document.getElementById("listcart").innerHTML=cartremoarray[2];
        document.cartnew.cart.value = "";
        document.cartnew.carse.value = "";
        document.cartnew.ptcart.value = cartremoarray[0];
		document.cartnew.carselen.value = cartremoarray[3];

	
		}
}

var t1;
var t2;
function trpro(str)
{
//	alert(str)
var datas = str.split("," );

 
 t1 = datas[0];
 t2 = datas[1];
 

	//alert(str)
	xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			 alert ("Browser does not support HTTP Request")
			 return
		 }
	 url = "../including_files/transhow.php?traid="+datas[2];
	 url=url+"&sid="+Math.random()
	 xmlHttp.onreadystatechange=trashow
	 xmlHttp.open("GET",url,true)
	 xmlHttp.send(null)

}

function trashow()
{
	if (xmlHttp.readyState==4 )
		{
		 for (i=1;i<=t2;i++)
		 {
			 document.getElementById("d"+i).innerHTML = "";
		 }
		document.getElementById("d"+t1).innerHTML=xmlHttp.responseText;
		}
}


function cpa()
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
 str = document.pform1.opa.value
 str1 = document.pform1.uid.value
 str2 = document.pform1.bid.value
 url = "including_files/pcheck.php?r="+str+"&r1="+str1+"&r2="+str2
 url=url+"&sid="+Math.random()

xmlHttp.onreadystatechange=pa1
xmlHttp.open("GET",url,true)
xmlHttp.send(null)

}

function pa1()
{
if (xmlHttp.readyState==4 )
 {
//document.myForm.cas.value=xmlHttp.responseText;
var det1 = xmlHttp.responseText;
var detarr = det1.split(",");
document.getElementById("invpa").innerHTML=detarr[1];
document.pform1.opr.value=detarr[0];

}
}

function forpas()
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
 
 if (document.pform1.una.value == "")
    {
		alert ("Enter Valid User ID");
		return
	}
	
var str = document.pform1.bran.value
var str1 = document.pform1.una.value
var str2 = document.pform1.nemail.value
 url = "including_files/forpascheck.php?r="+str+"&r1="+str1+"&r2="+str2
 url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=forpashow
xmlHttp.open("GET",url,true)
xmlHttp.send(null)

}

function forpashow()
{
if (xmlHttp.readyState==4 )
 {
//document.myForm.cas.value=xmlHttp.responseText;
document.getElementById("invpa").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;
}


