//error handler
onerror=handleErr;

function PrintThisPage() 
{
     PrintPage(false);
}

function PrintPage(addHeader) 
{ 
   var sOption="toolbar=yes,location=no,directories=yes,menubar=yes,"; 
	   sOption+="scrollbars=yes,width=750,height=450,left=50,top=100"; 

   var sWinHTML = document.getElementById('contentstart').innerHTML; 
   if(addHeader)
       sWinHTML = '<table cellpadding="0" cellspacing="0" border="0"><tr><td align="center"><img src="images/logobigGray.gif" /><br />&nbsp;</td></tr><tr><td>' + sWinHTML + '</td></tr></table>';
   
   var winprint=window.open("","",sOption); 
	   winprint.document.open(); 
	   winprint.document.write('<html>');
	   winprint.document.write('<head>');
	   winprint.document.write('<title>Travelinsure Genie - Online Policy Issuing System</title>');	       
	   winprint.document.write('<LINK type="text/css" href="http://www.travelinsuregenie.com/genieadmin/App_Themes/Default/PrintStyle.css" rel="Stylesheet" >');	   
	   winprint.document.write('<style media="print" type="text/css">');
	   winprint.document.write('.sTABLE {visibility:visible;}');
	   winprint.document.write('.DIV {writing-mode: tb-rl;');
	   winprint.document.write('height: 80%;');
	   winprint.document.write('margin: 10% 0%;}');
	   winprint.document.write('@page {size: landscape;}');
	   winprint.document.write('</style>');
	   winprint.document.write('<style type="text/css">.sRemove {visibility:hidden;width:0px;} </style>');
	   winprint.document.write('</head>');
	   winprint.document.write('<body onload="window.print();">');  
	   winprint.document.write(sWinHTML);          
	   winprint.document.write('</body></html>'); 
	   winprint.document.close(); 
	   winprint.focus(); 
}

function SendMail(url,title) 
{ 
	var sWinHTML=document.getElementById('contentstart').innerHTML;
	sWinHTML = '<style type="text/css">.sRemove {visibility:hidden;width:0px;} </style>' + sWinHTML;
    document.getElementById("hdnReport").value=sWinHTML;
	var mailWindow=window.open(url,"Mail","width=400,height=200,left=300,top=180");
}

function sendWhiteLabelMail(url)
{
    var mailWindow=window.open(url,"Mail","width=400,height=180,left=300,top=180");
}

function getTable()
{
    var htmlTable=self.opener.document.forms[0].elements["hdnReport"].value;
    document.getElementById("Hidden1").value =htmlTable;
}

function openPage(path)
{
    window.open(path,'Create','width=400,height=160,left=300,top=180')
}

function confirm_agent()
{
    if(confirm("Has this agent paid the amount due?"))
    {
        return true;
    }
    else 
    {
        return false;
    }
}

function confirm_globeshield()
{
    if(confirm("Create commission payment for agent ?"))
    {
        return true;
    }
    else 
    {
        return false;
    }
}

function handleErr(msg,url,l)
{
    return true;
}

   
function openInvoice(filename) 
{
    var winl = (screen.width-400)/2;
    var wint = (screen.height-160)/2;
    var n = window.open(filename,'wording',"left="+winl+",top="+wint+",width=400,height=180 ,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes");
}

function openReport(filename) 
{
    var winl = (screen.width-1000)/2;
    var wint = (screen.height-800)/2;
    var n = window.open(filename,'wording',"left="+winl+",top="+wint+",width=900 ,height=580 ,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes");
}

function UCFirst(str)
{
   firstChar = str.substring(0,1);
   remainChar = str.substring(1);
   
   firstChar = firstChar.toUpperCase(); 
   remainChar = remainChar.toLowerCase();

   return firstChar + remainChar
}

function UCTitle(str)
{  
    return str.toLowerCase().replace(/\b[a-z]/g, cnvrt);
	function cnvrt()
	{
	    return arguments[0].toUpperCase();
	}
}
    