if (document.all) {						// If IE...
	BrowVer='IE';							// !!!!! Set Browser Type Flag
	Pth=document.all;						// Define Path
	PicsWid=0;							// add extra 0
} else if (document.getElementById) {				// ...else Non IE but supports document.getElementById...
	BrowVer='NonIE';						// !!!!! Set Browser Type Flag
	Pth=document;							// Define Path
	PicsWid=15;							// add extra 15 to compensate for scrollbar
} 
/*else {							// Non-compatible browser
	BrowVer='Bad';							// !!!!! Set Browser Type Flag
	document.location='Sorry-Browser.htm';				// Go to bad news page
*/
else { 
	BrowVer='NonIE';						// !!!!! Set Browser Type Flag
	Pth=document;							// Define Path
	PicsWid=15;							// add extra 15 to compensate for scrollbar
}
// ##### GET HOST FILE PATH #####
var HstNam=document.location.host;					// !!!!! FilePath = location of this page.
if (HstNam=='192.168.0.2') {
	FullWPth='http://192.168.0.2/';
	FullWPth+=(document.location.pathname.substr(0,14)=='/bettermm/dev/') ? 'bettermm/dev/': 'bettermm/';
} else if (HstNam=='www.bettermortgage.com.au') {
	FullWPth='http://www.bettermortgage.com.au/';
	if (document.location.pathname.substr(0,5)=='/dev/') { FullWPth+='dev/'; }
} else {
	FullWPth='http://www.bettermm.com.au/';
	if (document.location.pathname.substr(0,5)=='/dev/') { FullWPth+='dev/'; }
}


function GetScrDim() {
	if (BrowVer=='IE') {						// If IE...
		ScrWid=document.body.clientWidth;				// Get IE WindowInside Width
		ScrHei=document.body.clientHeight;				// Get IE WindowInside Height
		ScrnX=screen.availwidth;					// Get screen width
		ScrnY=screen.availheight;					// Get screen height
		ScrlWid=document.body.scrollWidth;				// = Total Page Width
		ScrlHei=document.body.scrollHeight;				// = Total Page Length
	} else if (BrowVer=='NonIE') {					// ...else Non IE but supports document.getElementById...
		ScrWid=window.innerWidth;					// Get NS WindowInside Width
		ScrHei=window.innerHeight;					// Get NS WindowInside Height
		ScrnX=screen.availWidth;					// Get screen width
		ScrnY=screen.availHeight;					// Get screen Height
		ScrlWid=document.width;						// = Total Page Height
		ScrlHei=document.height;					// = Total Page Height
	}
	WinBdrW=10;							// Estimated allowance for Browser Frame Width
	WinBdrH=36;							// Estimated allowance for Browser Frame Height (no menus etc)
	MRight();								// Re-Align Menu's
}


function FreshWin(URLFile,WType,WName) {
	if (WName) {
		var WinName=WName;
	} else {
		var WinName='';
	}
	if (WType==1) {
		// ##### MINI HTML WINDOW #####
		var WinBits='width=779,innerwidth=779,height=500,innerheight=500,status=no,resizable=yes,menubar=no,scrollbars=yes,left=20,top=20';
	}
	if (WType==2) {
		// ##### LOAN SERVICE NET #####
		var WinBits='width=725,innerwidth=725,height=590,innerheight=590,status=yes,resize=no,menubar=no,scroll=no,left=5,top=5';
	}
	if (WType==3) {
		// ##### LOGIN #####
		var LeftPos=Math.round((ScrnX-380)/2);			// Center Login X
		var TopPos=Math.round((ScrnY-356)/2);			// Center Login Y
		var WinBits='width=370,innerwidth=370,height=320,innerheight=320,status=no,resize=no,menubar=no,scroll=no,left='+LeftPos+',top='+TopPos;
	}
	if (WType==4) {
		// ##### MINI HTML WINDOW + MENUBAR #####
		var WinBits='width=779,innerwidth=779,height=500,innerheight=500,status=no,resizable=yes,menubar=yes,scrollbars=yes,left=20,top=20';
	}
	if (WType==5) {
		// ##### NORMAL HTML WINDOW + MENUBAR #####
		var WinBits='status=no,resizable=yes,menubar=yes,scrollbars=yes,toolbar=yes';
	}
	if (WType==6) {
		// ##### BETTERTRAK LOAN WINDOW #####
		var WinBits='width=788,innerwidth=788,height='+(ScrnY-40)+',innerheight='+(ScrnY-40)+',status=no,resizable=yes,menubar=no,scrollbars=yes,left=0,top=0';
	}
	if (WType==7) {
		// ##### GE CALCULATOR WINDOW #####
		var WinBits='width=788,innerwidth=690,height=600,innerheight=600,status=no,resizable=yes,menubar=no,scrollbars=yes,left=0,top=0';
	}
	var NewWin=window.open(URLFile,WinName,WinBits);
	NewWin.focus();
}




// ########## DETERMINE NEW WINDOW SIZE / SCROLBARS Y/N - START ##########
function NwWinEnv(PicW,PicH) {
	ScrllBars='0';				// Set Scrollbars to default value of 'no'
	if (PicW>(ScrnX-WinBdrW)) {	// if picture is wider than screen can take...
		WindW=ScrnX-WinBdrW;		// Set window width to Max
		ScrllBars='1';				// Set scrollbars to 'yes'
	} else {					// otherwise
		WindW=PicW;				// Set window width to width of pic
	}
	if (PicH>(ScrnY-WinBdrH)) {	// if picture is taller than screen can take...
		WindH=ScrnY-WinBdrH;		// Set window height to Max
		ScrllBars='1';				// Set scrollbars to 'yes'
	} else {					// otherwise
		WindH=PicH;				// Set window height to height of pic
	}
}
// ########## DETERMINE NEW WINDOW SIZE / SCROLBARS Y/N - END ##########


// ########## Pic Window - START ##########
function PicWinOpen(PicURL,WinNam,WinTitle,PicW,PicH) {
	NwWinEnv(PicW,PicH);
	WinTitle+=' ... ( Click Pic to Close Window ) ....................................................................';
	var WinFeatures='height='+WindH+',innerheight='+WindH+',width='+WindW+',innerwidth='+WindW+',channelmode=0,dependent=1,directories=0,fullscreen=0,location=0,menubar=0,scrollbars='+ScrllBars+',resizable=0,status=0,toolbar=0,screenX=0,left=0,screenY=0,top=0';
	NewPopupwin=window.open('',WinNam,WinFeatures);
	NewPopupwin.document.open('text/html', 'replace');
	NewPopupwin.document.write('<html><head><title>', WinTitle, '</title></head>');
	NewPopupwin.document.write('<body bgcolor=#FFFFFF leftmargin=0 rightmargin=0 topmargin=0 bottommargin=0 marginheight=0 marginwidth=0>');
	NewPopupwin.document.write('<a href="JavaScript:self.close();"><img src="', PicURL, '" width=', PicW, ' height=', PicH, ' border=0 alt=" Click Picture to Close this Window "></a>');
	NewPopupwin.document.write('</body></html>');
	NewPopupwin.document.close();
}
// ########## Pic Window - END ##########





BoxNumPrev=0;

function SetupBoxOvr(BoxNum,FrmName2,FldName2) {
	document.getElementById('Box'+BoxNum).className='GroupBoxOvr';
	BoxNumPrev=BoxNum;
	if (document[FrmName2] && document[FrmName2][FldName2]) {
		document[FrmName2][FldName2].focus();
	}
}
function BoxOvr(BoxNum) {
	if (BoxNum==BoxNumPrev || BoxNumPrev==0) { return; }
	if (document.getElementById('Box'+BoxNumPrev)) {
		document.getElementById('Box'+BoxNumPrev).className='GroupBox';
	}
	if (document.getElementById('Box'+BoxNum)) {
		document.getElementById('Box'+BoxNum).className='GroupBoxOvr';
	}
	BoxNumPrev=BoxNum;
}

function BMMConfirm(Mssg, ConfActionFlg, ConfAction) {
	if (confirm(Mssg)) {
		if (ConfActionFlg==1) {			// URL REDIRECTION
			window.location.href=ConfAction;
		}
	}
}



// ########## MENU RIGHT ALIGN, OVER's and OUTs - START ##########
function MRight() {
	if (!Pth.MainTDID) {
		return;
	}
	var LPos=Pth.MainTDID.offsetWidth-175;
	for (i=1; i<=14; i++) {
		if (document.getElementById('MDB_'+i)) {
			document.getElementById('MDB_'+i).style.left=LPos;
		}
	}
}
MenuWait=0;
var MLvl1='';
var MLvl2='';
var Colr='';
function MOver(zzv1, zzv2, zzv3, zzv4) {
	if (MLvl1!='') {						// If there is a menu showing...
		if (MenuWait!=0) {						// If there is a menu pack-up waiting...
			window.clearTimeout(MenuWait);					// ...stop the delay
		}
		if (MLvl1!=zzv1) {						// If the Level 1 menu showing is NOT the same as the new one we are about to build...
			MOut2();							// ...Go turn it off
		} else if (MLvl2==zzv2) {					// ...else if the Level 2 menu showing is the same as the new one we are about to build...
			return;								// Abort
		}
	}
	MLvl1=zzv1;							// Assign the Layer showing vars to the new layer
	MLvl2=zzv2;
	Colr=zzv3;
	// #### DO MENU DIV LAYER OVER #####
	document.getElementById('MD_'+MLvl1).className='MD1Ov';				// Change MenuLevel1 DIV Class to OVER
	document.getElementById('MD_'+MLvl1+'_TD').className='MD1TDOv';			// Change MenuLevel1 TD  Class to OVER
	if (document.getElementById('MA_'+MLvl1)) {						// if there is an Arrow...
		document.getElementById('MA_'+MLvl1).src=FullWPth+'B2-OV'+Colr+'.gif';	// Change Arrows 1 Source to OVER-Pic
	}	
	if (document.getElementById('MDB_'+MLvl1)) {					// if there is a DropBox for this Level1 DIV...
		if (MLvl2!=0) {							// if this is over a Level2 Menu...
			document.getElementById('MD_'+MLvl1+'_'+MLvl2).className='MD2Ov';			// Change MenuLevel2 DIV  Class to OVER
			if(document.all)
			{
				document.getElementById('MD_'+MLvl1).style.cursor='hand';				// Change Cursor to HAND  (ie. 6)
			}else{
				document.getElementById('MD_'+MLvl1).style.cursor='pointer';				// Change Cursor to POINTER (All others, and ie 7)
			}
			
			//document.getElementById('MD_'+MLvl1+'_'+MLvl2).style.cursor='hand';			// Change Cursor to HAND
		} else {
			document.getElementById('MDB_'+MLvl1).style.visibility='visible';			// Turn on MenuPopupBox
			//Effect.Appear(document.getElementById('MDB_'+MLvl1));
			document.getElementById('MD_'+MLvl1).style.cursor='default';			// Change Cursor to DEFAULT
		}
	} else {							// ...else No Sub Menu
		if(document.all)
		{
			document.getElementById('MD_'+MLvl1).style.cursor='hand';				// Change Cursor to HAND  (ie. 6)
		}else{
			document.getElementById('MD_'+MLvl1).style.cursor='pointer';				// Change Cursor to POINTER (All others, and ie 7)
		}		
	}	
	if (zzv4) {
		window.status=zzv4;
	}
}
function MOut(zzv1, zzv2, zzv3) {
	if (zzv2!=0) {							// if this is over a Level 2 Menu...
		document.getElementById('MD_'+zzv1+'_'+zzv2).className='MD2Up';			// Change Level 2 Menu DIV Class to UP
	}
	if (MLvl2!=zzv2) {
		return;
	}
	MLvl1=zzv1;							// Assign the Layer showing vars to the new layer
	MLvl2=zzv2;
	Colr=zzv3;
	MenuWait=window.setTimeout("MOut2()", 500);
	
}
function MOut2() {
	
	MenuWait=0;
	// #### DO MENU DIV LAYER OUT #####
	document.getElementById('MD_'+MLvl1).className='MD1Up';				// Change MenuLevel1 DIV Class to UP
	document.getElementById('MD_'+MLvl1+'_TD').className='MD1TDUp';			// Change MenuLevel1 TD  Class to UP
	if (document.getElementById('MA_'+MLvl1)) {						// if there is an Arrow...
		document.getElementById('MA_'+MLvl1).src=FullWPth+'B2-UP'+Colr+'.gif';		// Change Arrows 1 Source to OUT-Pic
	}
	if (document.getElementById('MDB_'+MLvl1)) {					// if there is a DropBox for this Level1 DIV...
		//Effect.Fade(document.getElementById('MDB_'+MLvl1));
		document.getElementById('MDB_'+MLvl1).style.visibility='hidden';			// Turn off MenuPopupBox
		if (MLvl2!=0) {							// if this is over a Level2 Menu...
			document.getElementById('MD_'+MLvl1+'_'+MLvl2).className='MD2Up';			// Change MenuLevel2 DIV  Class to UP
		}
	}
	MLvl1='';
	MLvl2='';
	Colr='';
	window.status='';
}
// ########## MENU RIGHT ALIGN, OVER's and OUTs - END ##########



// ########## contents of the BMMroot/javascript/CheckDate.js file ##########

function checkThisDate(page, loanid)
{
	var update = confirm("Click OK to update the sent date for this document, OR cancel to leave it as it is.");
	if(update)
	{
		var newDate = prompt("Enter the new date (format 10-Jan-2001).", '');
		url = page + ".cfm?LoanID=" + loanid + "&NewDate=" + newDate;
		window.location.href = url;
	}
}



// ########## FILL / EMPTY KARD CONTENTS - START ##########
function OpenCloseKardSub(TickBoxID,Container,CustomHTML) {
	if (Pth[TickBoxID].checked==true) {
		Pth[Container].innerHTML=CustomHTML;
	} else {
		Pth[Container].innerHTML='';
	}
}
// ########## FILL / EMPTY KARD CONTENTS - END ##########