ns = (navigator.appName == 'Netscape' && document.layers != null) ? true:false;
ns6 = (navigator.appName == 'Netscape' && document.getElementById) ? true:false;

function OpenWindow(address,width,height,resizable,external,scrolling,button,windowName) {
	if (windowName == "") windowName = "NewWindow";

	if (navigator.appName.indexOf("Microsoft")!=-1 && navigator.appVersion.indexOf("Mac")!=-1) {
		height -= 16;
		width -= 16;
	} else if (navigator.appName.indexOf("Netscape")!=-1 && navigator.appVersion.indexOf("Mac")!=-1) {
		height -= 2;
	}	
	
	var externalWindow = window.open("/system/popup_frameset.asp?button="+button+"&External="+external+"&scrolling="+scrolling+"&address="+address,windowName,"top=0,left=0,width="+width+",height="+height+",resizable="+resizable);
	externalWindow.focus();
}

function CheckSideMenu(doExpand, MenuObjName, SubMenuItem) {
	if (parent.sidemenu.CurrentMenuSelected != null) {
//		if (parent.sidemenu.CurrentMenuSelected != MenuObjName) {
			parent.sidemenu.ToggleMenu(doExpand, MenuObjName,SubMenuItem);
//		}
	}
	SwapBottomLink('hide');
}

function ChangeSideMenuBanner(NewBannerNumber) {
	if (parent.sidemenu.MenuLoaded != null) {
		var CurrentRotatingBannerAd = parent.sidemenu.document.rotatingbannerimage.src.toString();	
		var NewRotatingBannerAd = parent.sidemenu.RotatingBannerAds[NewBannerNumber];	
		if (NewRotatingBannerAd != null) {
			if (CurrentRotatingBannerAd.indexOf(NewRotatingBannerAd) < 0) {	// the current banner ad is different from the new one.
				parent.sidemenu.document.rotatingbannerimage.src = NewRotatingBannerAd;
			}
		}
	}
}

function SwapBottomLink(sNewState) {
	if (ns) {
		BottomLayer = parent.parent.bottom.document.bottomlink;
		BottomLayer.visibility = sNewState;
	} else { // IE / NS6
		BottomLayer = parent.parent.bottom.bottomlink;
		swapLayers(BottomLayer,sNewState);
	}
}



function swapImage(LayerName, ImageName, ImageSrc) {
	if ((LayerName != "") && (ns)) {
		getLayer('',LayerName).document[ImageName].src=ImageSrc;
	} else {
		document[ImageName].src=ImageSrc;
	}
}

function ChangeLayerContent(LayerName, NewContent)
{
	thisLayer = getLayer(document,LayerName);
	if (document.layers) {	// NS
		thisLayer.document.open();
		thisLayer.document.write(NewContent);
		thisLayer.document.close();
	} else {	// IE & NS6
		thisLayer.innerHTML = NewContent;
	}
}

function getLayer (level, LayerName) {
	if (document.all) {
		// IE
		return eval(LayerName);
	} else if (document.getElementById) {
		// NS6
		return document.getElementById(LayerName);
	} else if (document.layers) {
		// NS
		if (level == "") level = document;
		if (level.layers) {
			for (var i = 0; i < level.layers.length; i++) {
				if (level.layers[i].name == LayerName) return level.layers[i]
				else if (level.layers[i].layers.length > 0) {
					var obj = getLayer(level.layers[i], LayerName)
					if (obj && obj != null) return obj
				}
			}
		}
		return false;
	}
}


function swapLayers() { 
	// This function is dependant on ns,ns6 vars, and the "getLayer" script
	var i, visStr, args, theObj;
	args = swapLayers.arguments;
	for (i=0; i<(args.length-1); i+=2) { //with arg pairs (objName,visStr)
		visStr = args[i+1];
		theObj = getLayer ('', args[i]);
		if (ns) { //NS
			if (theObj) theObj.visibility = visStr;
		} else { // IE / NS6
			if (visStr == 'show') visStr = 'visible'; //convert vals
			if (visStr == 'hide') visStr = 'hidden';			
			if (theObj) theObj.style.visibility = visStr;
		}
	}
}





function printpage(documentLocation) {
	var macIE = (navigator.appName.indexOf("Microsoft")!=-1 && navigator.appVersion.indexOf("Mac")!=-1) 
	
	if (!macIE) {
		// Launch the "Printing Page" Window. (includes Hidden frame which is the one being printed.
		thiswidth='320';
		thisheight='110';
		thistop = eval(screen.height - thisheight) / 2		
		thisleft = eval(screen.width - thiswidth) / 2

		if (!ns) {
			thistop = self.screenTop + eval(eval(document.body.clientHeight - thisheight) / 2);
			thisleft = self.screenLeft + eval(eval(document.body.clientWidth - thiswidth) / 2);
		}
			
		var ThisWindow = window.open ("/system/printpage_popup_frameset.asp?documentLocation="+documentLocation,"PrintPage","width="+thiswidth+",height="+thisheight+",top="+thistop+",left="+thisleft+",scrollbars=0");
		ThisWindow.focus();
		
	} else { 
		// Launch the Printer friendly "Hidden" frame for them to print.
		if (confirm("Click OK to launch a Printer friendly Version\n\nUse your browsers page setup and print functions to print.")) {
			window.open ("/system/printpage_popup_hidden.asp?documentLocation="+documentLocation,"PrintPage","width=520,height=550,top=0,left=0,scrollbars=yes,menubar=yes");
		}
	}
}

function showfloorplan(){
	var ThisWindow = window.open ("springsummer/floorplan_popup_frameset.asp","FloorPlan","width=650,height=430,top=0,left=0,scrollbars=0");
	ThisWindow.focus();
}

function showperson(Type, ID) {
	var PersonDetailsWin = window.open("/springsummer/person_details.asp?type="+Type+"&ID="+ID,"PersonDetails","width=320,height=520,top=0,left=0,scrollbars=0");
	PersonDetailsWin.focus();
}

function showperson_aw(Type, ID) {
	var PersonDetailsWin = window.open("/autumnwinter/person_details.asp?type="+Type+"&ID="+ID,"PersonDetails","width=320,height=520,top=0,left=0,scrollbars=0");
	PersonDetailsWin.focus();
}

function LaunchFeedback(Subject,ShowReplyButton) {
	var FeedBackWin = window.open("/corporate/feedback.asp?Subject="+Subject+"&ShowReplybutton="+ShowReplyButton,"FeedBackWin","width=305,height=430,top=0,left=0,scrollbars=0");
	FeedBackWin.focus();
}


function viewpdf(URL) {
	var viewpdfWin = window.open(URL,"FeedBackWin","width=600,height=430,top=0,left=0,scrollbars=1,resizable=1");
	viewpdfWin.focus();
}
