// Ajax Function 

/*function DataByPost(url,objId,postData,div_id)
{
 
	//alert(postData);
    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() {
			if (AJAX.readyState==4 || AJAX.readyState=="complete")
			{  
				var msg=AJAX.responseText.split('|');
				if(document.getElementById(div_id))   
				document.getElementById(div_id).style.display='none'; 
				for(i=0;i<selId.length;i++)
				{ 
				//alert(msg);
				document.getElementById(selId[i]).innerHTML = msg[i];
				}
			}
	   }                                  
	   AJAX.send(passData);
	}
}*/

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

	   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); 
				 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++)
                      { 
					    //alert(msg[i]);
                        if(document.getElementById(selId[i]))
						document.getElementById(selId[i]).innerHTML = msg[i];
					  }
			}
	   }                                  
	   AJAX.send(passData);
	   //alert('complete');
	}
}


//BY VALUE.
function showContent(url,arg,opr,sel_id,div_id)
{
	
   var postData='';
   var formVal=arg.split('|');

			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);
	document.getElementById('div_vote_btn').style.display='none';
}


//---------------------New Function for ajex-----------------------//

// JavaScript Document
// Ajax Function 
function DataByPost_1(url,objId,postData,div_id)
{
    var selId = objId.split('|');//alert(objId);
	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")
			{   
				var msg=AJAX.responseText.split('|');
				if(document.getElementById(div_id))   
				document.getElementById(div_id).style.display='none'; 
                      for(i=0;i<selId.length;i++)
                      {
                        //alert(msg[0]);  
						if(document.getElementById(selId[i]))
						document.getElementById(selId[i]).innerHTML = msg[i];
                      }
			}
	   }                                  
	   AJAX.send(passData);
	}
}
//BY VALUE.
function showContent_1(url,arg,opr,sel_id,div_id)
{ 
  var postData='';
 //alert(url);
  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_1(url,sel_id,postData,div_id);
}
//-----------------------------------------------------------//	


function showContent_2(url,arg,opr,sel_id,div_id)
{ 
  var postData='';
  //alert(url);
  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_1(url,sel_id,postData,div_id);
}
//-----------------------------------------------------------//	
function inviteMailPost(url,objId,postData,div_id)
{
	var selId = objId.split('|');//alert(url);
	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++)
				{
					//alert(msg[i]);
					if(document.getElementById(selId[i]))
						document.getElementById(selId[i]).innerHTML = msg[i];
				}
			}
		}
		AJAX.send(passData);
		//alert('complete');
	}
}

function inviteMail(url,arg,opr,sel_id,div_id)
{
	//alert("medma");
	var postData='';
	
	var formVal=arg.split('|');//alert(arg);
	//alert("formVal= "+formVal);
	if(document.getElementById(div_id))
	document.getElementById(div_id).style.display='';
	var postData = '';
	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);
	
	inviteMailPost(url,sel_id,postData,div_id);
}

