// Ajax Function 
function DataByPost(url,objId,postData,div_id)
{
    	var selId = objId.split('|');//alert(selId);
	var passData = postData; //alert(passData);
	var AJAX = null;
	if (window.XMLHttpRequest) {
	   AJAX=new XMLHttpRequest();//for Mozila
	} else {
	   AJAX=new ActiveXObject("Microsoft.XMLHTTP");
	}
	if (AJAX==null) {
	   alert("Your browser doesn't support AJAX.");						
	   return false
	} else {
	   AJAX.open("POST",url,true);
	   //alert(url);
	   AJAX.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	   AJAX.onreadystatechange = function() {                
	   //alert("Readystate: "+AJAX.readyState);
	if (AJAX.readyState==4 || AJAX.readyState=="complete")
	{  
		//callback(AJAX.responseText, AJAX.status); 
		//alert(AJAX.responseText);
		var msg=AJAX.responseText.split('|');//alert(msg);
		if(document.getElementById(div_id))   
			document.getElementById(div_id).style.display='none'; 
		for(i=0;i<selId.length;i++)
		{ 
			if(document.getElementById(selId[i]))
			{
				if(msg[i]==1)
				{
					//alert(msg);
					window.location.reload();	
				}else if(msg[i]==2){
					//alert(msg);
					window.location.href='mentororderclub.php';
				} else{
					document.getElementById(selId[i]).innerHTML = msg[i];
					document.getElementById('loginName').value = "";
					document.getElementById('password').value = "";
					document.getElementById('err_div2').innerHTML = "";
					document.getElementById('loginName').focus();
				}
			}
		}
	}
	   }
	   AJAX.send(passData);
	   //alert('complete');
	}
}

//BY VALUE.-------------------------------//
function showContent(url,arg,opr,sel_id,div_id)
{
  var postData='';
  var formVal=arg.split('|');
  //alert("formVal= "+formVal);
	if(document.getElementById(div_id))   
		document.getElementById(div_id).style.display='';
	for(i=1;i<=formVal.length;i++) 
	var postData =postData + 'value'+i+'='+escape(formVal[i-1])+'&';
	postData=postData + 'opr='+opr;
	//alert("url= "+url+"Post Data :"+postData+"sel_id= "+sel_id+"div_id= "+div_id);
	DataByPost(url,sel_id,postData,div_id);
}
//-----------------------------------------------------------//	


