
var navMinDiagnoses;
var navMaxDiagnoses;
var navMinPreferences;
var navMaxPreferences;

navMinDiagnoses = 5;
navMaxDiagnoses = 20;
navMinPreferences = 10;
navMaxPreferences = 20;

function printForm (formURL) {
	if (document.forms.length > 0) {
		// add to list of diagonese / preferences
		
		document.forms[0].feature.value = "print";
		document.forms[0].action = formURL;
		document.forms[0].target = "_blank";
		document.forms[0].submit();
	}
}

function postForm (formURL, formDir) {
	if (document.forms.length > 0) {
	
		// add to list of diagonese / preferences
		if (formURL == "/carefinder/careoptions/carenav3.asp")
		{
			if (formDir == "add")
			{
				var currValue = parseInt(document.forms[0].numDiagnoses.value);
				currValue += parseInt(5);
				if (currValue == "" || parseInt(currValue) < parseInt(navMinDiagnoses))
				{
					currValue = parseInt(navMinDiagnoses);
				}
				if (parseInt(currValue) > parseInt(navMaxDiagnoses))
				{
					currValue = parseInt(navMaxDiagnoses);
				}
				document.forms[0].numDiagnoses.value = currValue;
			}
		}
		else if (formURL == "/carefinder/careoptions/carenav24.asp")
		{
			if (formDir == "add")
			{
				var currValue = parseInt(document.forms[0].numPreferences.value);
				currValue += parseInt(5);
				if (currValue == "" || parseInt(currValue) < parseInt(navMinPreferences))
				{
					currValue = parseInt(navMinPreferences);
				}
				if (parseInt(currValue) >= parseInt(navMaxPreferences))
				{
					currValue = parseInt(navMaxPreferences);
				}
				document.forms[0].numPreferences.value = currValue;
			}
		}
		
		document.forms[0].dir.value = formDir;
		document.forms[0].action = formURL;
		document.forms[0].target = "_top";
		document.forms[0].submit();
	}
}

function toggleLayer (whichLayer) {

	if (document.getElementById) {
		// this is the way the standards work
		var layerObj = document.getElementById(whichLayer);
		var style2 = layerObj.style;
		style2.display = style2.display? "":"block";
		
	} else if (document.all) {
		// this is the way old msie versions work
		var layerObj = document.all[whichLayer];
		var style2 = layerObj.style;
		style2.display = style2.display? "":"block";
		
	} else if (document.layers) {
		// this is the way nn4 works
		var layerObj = document.layers[whichLayer];
		var style2 = layerObj.style;
		style2.display = style2.display? "":"block";
		
	}

	if (layerObj && style2 && style2.display == "block") {
		layerObj.focus();
	}
}

function openwindow (currPage, winName, showLocation, pageWidth, pageHeight) {
	var winWidth, winHeight;
	var wPhotoWindow;

	winWidth = 800;
	if (pageWidth > 0) {
		winWidth = pageWidth;
	}

	winHeight = screen.height;
	if (pageHeight > 0) {
		winHeight = pageHeight;
	} else if (pageHeight = 0) {
		winHeight = screen.height;
	}

	if (currPage != "") {
		wPhotoWindow = window.open(currPage, winName, "resizable=yes,location=" + showLocation + ",menubar=yes,scrollbars=yes,status=yes,width=" + winWidth + ",height=" + winHeight + "");
		wPhotoWindow.focus();
	}
}

function jumpToAnchor (anchorName) {

	if (anchorName != "") {
		window.location.hash = anchorName;
	}

}
