
function GetXmlHttpObject(handler)
{ 
	var objXMLHttp=null
		if (window.XMLHttpRequest)
		{
			objXMLHttp=new XMLHttpRequest()
		}
		else if (window.ActiveXObject)
		{
			objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
		}
	return objXMLHttp
}

var xmlHttp;
var _xt;
var _div_id;

function show_data(param,xt,_div)
{
//alert("from this field " + param);
var obj = document.getElementById(param);
var str = obj.value;
//alert(obj.options[obj.selectedIndex].text);
_div_id = _div;
//alert("This value passed " + str);
_xt = xt;
//alert("Task number : " + _xt);
//alert("going to effect this : " + _div_id);
	loading_splash(_div_id);
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
		var url=location.protocol + "//" + location.hostname +"/xjax/xjax.php";
		url=url+"?xt="+xt
		url=url+"&var="+str
		url=url+"&sid="+sid
		url=url+"&xid="+Math.random()
		//alert(url);
		xmlHttp.onreadystatechange=stateChanged
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
		
} 



function send_data(param,xt,_div)
{
//alert(param);
//var obj = document.getElementById(param);
var str = param;
//alert(str);
_xt = xt;
_div_id = _div;
//alert(_xt);
if(_xt!="88")
{
	loading_splash(_div_id);
}
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 

		var url=location.protocol + "//" + location.hostname +"/xjax/xjax.php";
		url=url+"?xt="+xt
		url=url+"&var="+str
		url=url+"&sid="+sid
		url=url+"&xid="+Math.random()
		//alert(url);
		xmlHttp.onreadystatechange=stateChanged
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
		
} 



function stateChanged() 
{ 
  if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
	//alert(_xt);
	//alert(xmlHttp.responseText);
	//alert(_div_id);
	

			if(_xt==17){
				document.getElementById(_div_id).innerHTML =xmlHttp.responseText;
				get_courses();
			}else if(_xt==6){
				//alert(xmlHttp.responseText);
				document.getElementById(_div_id).innerHTML =xmlHttp.responseText;
			}else if(_xt==12){							
				document.getElementById(_div_id).innerHTML=xmlHttp.responseText;
				var strcheck = xmlHttp.responseText;
				//alert(strcheck.indexOf("error"));
				if (strcheck.indexOf("error")!="-1"){
					clear_form_7_4();
				}
			}else if(_xt==88){
				//alert(xmlHttp.responseText);
				if(xmlHttp.responseText==1){
						alert('Email Id Already Exists.');
				}else{
					add_beni1();
				}
				//document.getElementById(_div_id).innerHTML =xmlHttp.responseText;
			
			}else if(_xt==14){
				//document.getElementById("sec_question_id1").style.display="none";
				//document.getElementById("sec_question_id2").style.display="none";
				//document.getElementById(_div_id).innerHTML =xmlHttp.responseText;
				res = xmlHttp.responseText;
				res_arr = res.split("|");
				if (res_arr[0]!="0"){ 
					document.getElementById("sec_question_id1").style.display="none";
					document.getElementById("sec_question_id2").style.display="none";
				}
				document.getElementById(_div_id).innerHTML = res_arr[1];
				clear_from_8_2();
				
			}else if(_xt==15){
				//document.getElementById("sec_question_id1").style.display="none";
				//document.getElementById("sec_question_id2").style.display="none";
				//document.getElementById(_div_id).innerHTML =xmlHttp.responseText;
				res = xmlHttp.responseText;
				res_arr = res.split("|");
				if (res_arr[0]=="0"){ 
					document.getElementById("sec_question_id1").style.display="";
					document.getElementById("sec_question_id2").style.display="";
				}
				document.getElementById(_div_id).innerHTML = res_arr[1];
			}else if(_xt==16){			
				
				document.getElementById(_div_id).innerHTML=xmlHttp.responseText;
				var strcheck = xmlHttp.responseText;
				//alert(strcheck.indexOf("error"));
				if (strcheck.indexOf("error")!="-1"){
					clear_from_8_3();
				}
			}else if(_xt==18){
				res = xmlHttp.responseText;
				res_arr = res.split("|");
				if (res_arr[0]!="0"){ 
					document.getElementById("sec_ques1").style.display="none";
					document.getElementById("sec_ques2").style.display="none";
				}
				document.getElementById(_div_id).innerHTML = res_arr[1];
				clear_from_9_2();
			}else if(_xt==19){
				res = xmlHttp.responseText;
				res_arr = res.split("|");
				if (res_arr[0]=="0"){ 
					document.getElementById("sec_ques1").style.display="";
					document.getElementById("sec_ques2").style.display="";
				}
				document.getElementById(_div_id).innerHTML = res_arr[1];
			}else if(_xt==25){
				var res = xmlHttp.responseText;
				document.getElementById(_div_id).innerHTML ="";
				if (res=="true"){ 
					
					add_beni();
				}else{
					alert("Email Address already exist"); 
				}
				
			}else{
				document.getElementById(_div_id).innerHTML =xmlHttp.responseText;
			}



	} 

} 



function loading_splash(_div){

var str = "<table border=0 cellpadding=0 cellspacing=0 style=WIDTH:100%;HEIGHT:100% align=center><tr><td align=center valign=middle><table border=0 cellpadding=4 cellspacing=0 width=150 height=40 style=BORDER-RIGHT:#888888 2px solid; BORDER-TOP:#888888 2px solid; BORDER-LEFT:#888888 2px solid; CURSOR:default; BORDER-BOTTOM:#888888 2px solid; BACKGROUND-COLOR:#ffffff><tr><td align=center class=text11><IMG src=/images/loading/spinner.gif>&nbsp;&nbsp;<b>Loading ...</b></td></tr></table></td></tr></table>";

document.getElementById(_div_id).innerHTML = str;

}
