/*
	######################################################################################################
	########################################################################################### navigation
	######################################################################################################
*/

function openDoc (iURL) {
	document.location = iURL;
}

function openPrintSpecsPopUp (iFileName) {
	var fName = iFileName;
	var windowName = "printSpecs";
	var NS6 = (document.getElementById && navigator.appName.indexOf("Netscape")>=0 )? true: false;
	var width = (NS6) ? 600 : 617 ;
	var height = (NS6) ? 270 : 270 ;
	var height = (NS6) ? 300 : 300 ;
	openPopup(fName,windowName,width,height);
}

function openPagePopup (iFileName) {
	var fName = iFileName;
	var windowName = "pagePopup";
	var NS6 = (document.getElementById && navigator.appName.indexOf("Netscape")>=0 )? true: false;
	var width = (NS6) ? 600 : 600 ;
	var height = (NS6) ? 300 : 300 ;
	openPopup(fName,windowName,width,height);
}

function openHomeHelp (iFileName) {
	
	var fName = iFileName;
	var windowName = "homeHelp";
	
	var NS6 = (document.getElementById && navigator.appName.indexOf("Netscape")>=0 )? true: false;		
	var width = (NS6) ? 312 : 312 ;
	var height = (NS6) ? 400 : 400 ;	
	var x = screen.availWidth - width;
	var y = (screen.availHeight - height)/2;
	
	openPopupAtXY(fName,windowName,width,height,x,y);
}

function openPopup (fileName,windowName,width,height,scrollbars) {
	ileft=(screen.width-width)/2;
	itop=(screen.height-height)/2;
	params = "toolbar=0,";
	params += "location=0,";
	params += "directories=0,";
	params += "status=0,";
	params += "menubar=0,";
	var scrollbars = (scrollbars) ? scrollbars : "yes" ;
	params += "scrollbars=" + scrollbars + ",";
	params += "resizable=yes,";
	params +="top=" + itop + ",";
	params +="left=" + ileft + ",";
	params += "width=" + width + ","; // Explorer, Navigator 2,3
	params += "height=" + height + ","; // Explorer, Navigator 2,3	
	params += "innerHeight=" + height + ","; // Navigator 4+
	params += "innerWidth=" + width; // Navigator 4+
	win = window.open(fileName, windowName, params);
	win.focus();
}

function openPopupAtXY (fileName,windowName,width,height,x,y,scrollbars) {
	ileft = x;
	itop = y;
	params = "toolbar=0,";
	params += "location=0,";
	params += "directories=0,";
	params += "status=0,";
	params += "menubar=0,";
	var scrollbars = (scrollbars) ? scrollbars : "yes" ;
	params += "scrollbars=" + scrollbars + ",";
	params += "resizable=no,";
	params +="top=" + itop + ",";
	params +="left=" + ileft + ",";
	params += "width=" + width + ","; // Explorer, Navigator 2,3
	params += "height=" + height + ","; // Explorer, Navigator 2,3	
	params += "innerHeight=" + height + ","; // Navigator 4+
	params += "innerWidth=" + width; // Navigator 4+
	
	win = window.open(fileName, windowName, params);
	win.focus();
}

/*
	######################################################################################################
	######################################################################## object and styles referencing
	######################################################################################################
*/

var NS4 = (navigator.appName.indexOf("Netscape")>=0 && !document.getElementById)? true : false;
var IE4 = (document.all && !document.getElementById)? true : false;
var IE5 = (document.getElementById && document.all)? true : false;
var NS6 = (document.getElementById && navigator.appName.indexOf("Netscape")>=0 )? true: false;
var W3C = (document.getElementById)? true : false;

function getObj (layerName) {
	var layerRef = null;
	layerRef =  (NS4) ? document.layers[layerName] :
				(IE4) ? document.all[layerName] :
				(W3C) ? document.getElementById(layerName) :
				null;
	return layerRef;
}

function getStyle (objName,objRef) {
	var lyrRef = null;
	if (objName != null) {
		lyrRef = getObj(objName);			
	} else {
		lyrRef = objRef;
	}
	return lyrRef ? (NS4 ? lyrRef : lyrRef.style) : null;
}

function tellObj (obj,objName) {
	obj = (obj)  ? obj : getObj(objName);
	alert("object = " + obj);
	oStyle = getStyle('',obj);
	alert("style = " + oStyle);
}

function MM_findObj(n, d) {
	var p,i,x;
	if (!d) d = document;
	if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
		d = parent.frames[n.substring(p + 1)].document;
		n = n.substring(0,p);
	}
	if (!(x = d[n]) && d.all) x = d.all[n];
	for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
	for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n,d.layers[i].document);
  	if (!x && d.getElementById) x = d.getElementById(n);
	return x;
}

function MM_showHideLayers() {
	var i,p,v,obj,args = MM_showHideLayers.arguments;
	for (i = 0; i < (args.length - 2); i += 3) {
		if ((obj = MM_findObj(args[i])) != null) {
			v=args[i+2];
			if (obj.style) {
				obj = obj.style;
				v = (v == 'show') ? 'visible' : (v == 'hide') ? 'hidden' : v;
			}
			obj.visibility=v;
		}
	}
}

function switchImage(imgName, imgSrc) {
	var imgObj = MM_findObj(imgName);
	imgObj.src = imgSrc;
}
