// JavaScript Document
function Trim(str)
{
	//trim leding spaces
	while(true)
	{
		if(str.charAt(0) == ' ')
			str = str.substr(1);
		else
			break;
	}
	
	//trim trailing spaces
	while(true)
	{
		if(str.charAt(str.length-1) == ' ')
			str = str.substr(0,str.length-1);
		else
			break;
	}
	return(str);	
}
function shdiv2()
{
	document.getElementById("show").style.visibility="visible";
	document.getElementById("show").style.position="absolute";
	document.getElementById("adv").style.visibility="visible";
	document.getElementById("adv").style.position="absolute";
	document.getElementById("show").innerHTML="<br><br><br><br><br><br><div align='center'><font color='#000000'><b>LOADING &nbsp;&nbsp;<img src='images/shoppingcartloader.gif'><br>Please wait until the list is generated.</b></font></div>";
}
function shdiv()
{
	document.getElementById("show").style.visibility="visible";
	document.getElementById("show").style.position="absolute";
	document.getElementById("adv").style.visibility="visible";
	document.getElementById("adv").style.position="absolute";
	document.getElementById("show").innerHTML="<br><br><br><br><br><br><div align='center'><font color='#000000'><b>LOADING &nbsp;&nbsp;<img src='images/shoppingcartloader.gif'><br>Please wait until the list is generated.</b></font></div>";
}
function hidesrchdiv()
{
	document.getElementById("show").style.visibility="hidden";
	document.getElementById("show").style.position="absolute";
	document.getElementById("adv").style.visibility="hidden";
	document.getElementById("adv").style.position="absolute";
}

function showlocation(frm,val)
{
	
	/*var maintainmod;
	maintainmod="<table width='100%'  border='0' align='center' cellpadding='0' cellspacing='0'>"
	maintainmod=maintainmod+"<tr><td align='right'>"
	maintainmod=maintainmod+"<input name='buttonclose' type='button' class='inputbox' onclick='hidesrchdiv()' value=' Close '>"
	maintainmod=maintainmod+"</td></tr><tr><td>&nbsp;</td></tr>"
	maintainmod=maintainmod+"<tr><td align='left'><h2>Module under maintenance.<br>Please check back later. <br>Thank you<h2></td></tr>"
	maintainmod=maintainmod+"</table>"
	
	document.getElementById("show").style.visibility="visible";
	document.getElementById("show").style.position="absolute";
	document.getElementById("show").innerHTML=maintainmod;*/
	if (val=='')
	{
		hidesrchdiv();
		return false;
	}
	else
	{
		var pathArray = window.location.pathname.split( '/' );
		shdiv();
		var xmlHttp;
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
		{
		  alert ("Your browser does not support AJAX!");
		  return;
		} 
		if (parseInt(pathArray.length)>3)
		{frm="../"+frm;}
		var url=frm+"?val="+val;
		xmlHttp.onreadystatechange=stateChangedloc;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
	}
}
function GetXmlHttpObject()
{
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 stateChangedloc() 
{ 
	
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById("show").innerHTML=Trim(xmlHttp.responseText);
	}
}
function Clickheretoprint(){
		var disp_setting="toolbar=no,location=no,directories=no,menubar=yes,"; 
		    disp_setting+="scrollbars=yes,width=650, height=600, left=100, top=0"; 
		var content_vlue = document.getElementById("show").innerHTML; 	
		var docprint=window.open("","",disp_setting); 
			docprint.document.open(); 
//			docprint.document.write('<body onload="javascript:window.print()" onfocus="javascript:window.close()">'); 
			docprint.document.write('<html>'); 
			docprint.document.write('<head>'); 
			docprint.document.write('</head>'); 
			docprint.document.write('<body onload="window.print();window.close();">'); 
			docprint.document.write('<table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">');
			docprint.document.write('<tr><td><img src="../images/hlogo.gif"></td></tr>');
			docprint.document.write('<tr><td colspan="2">&nbsp;</td></tr>');
			docprint.document.write('<tr><td colspan="2">&nbsp;</td></tr>');
			docprint.document.write('<tr><td colspan="2">'+content_vlue+'<td></tr>');
			docprint.document.write('</table>'); 
			docprint.document.write('</body>'); 
			docprint.document.write('</html>'); 
			docprint.document.close(); 
			docprint.focus(); 
}
