function IsIE55orHigher(){
	var re = /MSIE\s\d{1}.\d{1}\;/gi;
	var UserAgent = re.exec(window.navigator.userAgent); 
	if (UserAgent == null) return false //browser is not IE
	else {
		var IEversion = UserAgent.toString();
		if (IEversion.substr(IEversion.indexOf(' ')+1,3) >= 5.5) return true;
		else return false;
	}	
}

function passCommandStringInMenu(File){
	return File+document.location.search;
}

function fn_DailyReport(strURL)	{
	var BoolBottomMenu =false; // true if bottom menu present
	var alltd = document.body.all.tags("TD");
	for(var i = 0; i < alltd.length; i ++) {
		if(/btm\-item\-out/i.test(alltd[i].className)) {
			BoolBottomMenu = true;
		}
	}
	if (BoolBottomMenu)  top.location = 'myreports.asp?'+strURL;
}	

function OperateBookmark(InitDefStr, Url, SessionId){
	var RetDefStr = window.showModalDialog('edit_str.asp?str='+InitDefStr,'','dialogHeight: 150px; dialogWidth: 250px; dialogTop: px; dialogLeft: px; edge: Raised; center: Yes; help: No; resizable: No; status: No;scroll:No');
	if (RetDefStr)
		document.location='user_addbkmark.asp?bookmarkname='+RetDefStr+'&url='+Url+'&session_id='+SessionId;
}

function OpenAddBookmarkWindow(urlStr){
	window.showModalDialog(urlStr,"",'dialogHeight: 150px; dialogWidth: 250px; dialogTop: px; dialogLeft: px; edge: Raised; center: Yes; help: No; resizable: No; status: No;scroll:No');
	return false;
}

function OpenActiveXWindow(urlStr){
	window.showModalDialog(urlStr,"",'dialogHeight: 600px; dialogWidth: 500px; dialogTop: (screen.availHeight-600)/2; dialogLeft:(screen.availWidth-500)/2; edge: Raised; center: Yes; help: No; resizable: Yes; status: No;scroll:No');
	return false;
}

if (IsIE55orHigher()){
	var oPopup = window.createPopup();
	var isPopupOpen = oPopup.isOpen;
	
	function showBookmarks(PopupHeight) {
		if (isPopupOpen){
			oPopup.hide();
			hidePopup();
		}	
		else {
			oPopup.document.body.innerHTML = oContextHTML.innerHTML; 
			oPopup.show(3, 27, 345, PopupHeight, dropdowno);
			bkmarrow.src = 'imgpms/bkmarup.gif';
			isPopupOpen = true;
		}
	}
	
	function hidePopup(){
		bkmarrow.src = 'imgpms/bkmar.gif';
		isPopupOpen = false;
	}
}

function showHelp(){
	var PathName = document.location.pathname;
    var posPoint = PathName.indexOf(".");
	var posSlash = PathName.lastIndexOf("/");
	if (posSlash == -1) posSlash = 0;
	var FileName = PathName.substr(posSlash+1,posPoint-posSlash);
	window.open("showhelp.asp?file="+FileName+"htm",'HelpWin','width=600,height=600,menubar=yes,resizable=yes,scrollbars=yes');
//	window.open("help/"+FileName+"htm",'HelpWin','width=600,height=600,menubar=yes,resizable=yes,scrollbars=yes');
}

function CloseHelpWindow(Key) {
if (Key == 27) window.close();
}

function drawPercent(Prcnt){
var pcolor='#3285A5';
var pbcolor ='#E8E6E6'
document.write('<table width="120" border=0 cellspacing=0 cellpadding=2><tr><td style="border-top: 1 solid '+pcolor+';border-bottom: 1 solid '+pcolor+';border-left: 1 solid '+pcolor+';">');
document.write('<table width="80" border=0 cellspacing=1 cellpadding=0 bgcolor='+pcolor+'><tr>');
if (Prcnt == '100') document.write('<td><img src="imgpms/spacer.gif" alt="" width="80" height="15" border="0" style="background-color: '+pcolor+';"></td>');
else{
	if (Prcnt == '0') document.write('<td><img src="imgpms/spacer.gif" alt="" width="80" height="15" border="0" style="background-color: '+pbcolor+';"></td>');
	else {
		document.write('<td><img src="imgpms/spacer.gif" alt="" width='+(80*Prcnt/100)+' height="15" border="0" style="background-color: '+pcolor+';"></td>');
		document.write('<td><img src="imgpms/spacer.gif" alt="" width='+(80-(80*Prcnt/100))+' height="15" border="0" style="background-color:'+pbcolor+';"></td>');
	}
}	
document.write('</tr></table>');
document.write('</td><td width="50" align=center style="border-top: 1 solid '+pcolor+';border-bottom: 1 solid '+pcolor+';border-right: 1 solid '+pcolor+';"><font style="font-size: 11px; color: black;">'+Prcnt+'%</font></td>');
document.write('</td></tr></table>');
}
