function show( id ) 
{ 
	document.getElementById(id).style.display = 'block'; 
} 
function hide( id ) 
{ 
	document.getElementById(id).style.display = 'none'; 
} 
function confirm_delete()
{
	var val;
	val = confirm("Do you want to delete?");
	return val;
}
function Check(chk,check_ctr)
{
	if(check_ctr.checked==true)
	{
		for (i = 0; i < chk.length; i++)
		chk[i].checked = true ;
	}
	else
	{
		for (i = 0; i < chk.length; i++)
		chk[i].checked = false ;
	}
}
function display_option4(show_item,a,b,c)
{
	document.getElementById(show_item).style.borderBottom="none";
	document.getElementById(a).style.borderBottom="1px solid #CEDFE7";
	document.getElementById(b).style.borderBottom="1px solid #CEDFE7";
	document.getElementById(c).style.borderBottom="1px solid #CEDFE7";
	
	document.getElementById(show_item+"_details").style.display="block";
	document.getElementById(a+"_details").style.display="none";
	document.getElementById(b+"_details").style.display="none";
	document.getElementById(c+"_details").style.display="none";
}
///////////////////
/*
function sender_details(id)
{
		if (window.XMLHttpRequest)
		{// code for IE7+, Firefox, Chrome, Opera, Safari
			xmlhttp=new XMLHttpRequest();
		}
		else
		{// code for IE6, IE5
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
		
		xmlhttp.onreadystatechange=function()
		{
			if (xmlhttp.readyState==4 && xmlhttp.status==200)
			{
				document.getElementById("spn_sender_account").innerHTML=xmlhttp.responseText;
			}
		}
		
		xmlhttp.open("GET","ajax_answer_sender.php?id="+id,true);
		xmlhttp.send();
}
function receipent_details(id)
{
		if (window.XMLHttpRequest)
		{// code for IE7+, Firefox, Chrome, Opera, Safari
			xmlhttp=new XMLHttpRequest();
		}
		else
		{// code for IE6, IE5
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
		
		xmlhttp.onreadystatechange=function()
		{
			if (xmlhttp.readyState==4 && xmlhttp.status==200)
			{
				document.getElementById("spn_recipient_list").innerHTML=xmlhttp.responseText;
			}
		}
		
		xmlhttp.open("GET","ajax_answer_recipient.php?id="+id,true);
		xmlhttp.send();
} */

/////////////////////////// common for ajax
//New for courier 
var xmlHttp;
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;
} 




function showUser(str)
{ 
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
 	{
 		alert ("Browser does not support HTTP Request");
 		return;
 	}
	var url="getuser.php";
	url=url+"?sender_details_id="+str;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 	{ 
 		document.getElementById("spn_sender_account").innerHTML=xmlHttp.responseText;
		document.getElementById("spn_recipient_account").innerHTML=desc2;
 	} 
}
////////////////////////////////////
function showUser2(str,str2)
{ 
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
 	{
 		alert ("Browser does not support HTTP Request");
 		return;
 	}
	var url="getuser.php";
	url=url+"?recipient_details_id="+str+"sender_details_id="+str2;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged2;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChanged2() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 	{ 
 		document.getElementById("spn_recipient_account").innerHTML=xmlHttp.responseText;
 	} 
}
////////////////////////////////////
function showUser3(str)
{ 
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
 	{
 		alert ("Browser does not support HTTP Request");
 		return;
 	}
	var url="getuser.php";
	url=url+"?sender_account_chk="+str;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged3;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChanged3() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 	{ 
 		document.getElementById("spn_sender_chk").innerHTML=xmlHttp.responseText;
 	} 
}
////////////////////////////////////
function showPartner(str)
{ 
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
 	{
 		alert ("Browser does not support HTTP Request");
 		return;
 	}
	var url="get_partner.php";
	url=url+"?add_partner="+str;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged4;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChanged4() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 	{ 
 		document.getElementById("spn_partner").innerHTML=xmlHttp.responseText;
 	} 
}
/////////////////
function hidePartner()
{ 
	document.getElementById("spn_partner").innerHTML="";
	document.getElementById("spn_add_partner").innerHTML="<label style='margin-top:5px;color:#036388;cursor:pointer;' onclick='showPartner(1);document.getElementById(\"spn_add_partner\").innerHTML=\"<label style=margin-top:5px;color:#036388;cursor:pointer; onclick=hidePartner()>Hide Partner</label>\"').innerHTML='T'>Add Partner </label>";
}


function showCategory(str)
{
	if (str=="")
	{
		document.getElementById("txtHint").innerHTML="";
		return;
	} 
	
	if (window.XMLHttpRequest)
	{// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}
	else
	{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	
	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
			document.getElementById('spn_sub_category').innerHTML=xmlhttp.responseText;
		}
	}
	
	xmlhttp.open("GET","get_sub_category.php?category_id="+str,true);
	xmlhttp.send();
}
function showMsg(str)
{
	if (str=="")
	{
		document.getElementById("msg_body").innerHTML="";
		return;
	} 
	
	if (window.XMLHttpRequest)
	{// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}
	else
	{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	
	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
			document.getElementById('msg_body').innerHTML=xmlhttp.responseText;
		}
	}
	
	xmlhttp.open("GET","showMsg.php?id="+str,true);
	xmlhttp.send();
}
