/* ****** DO NOT EDIT BELOW THIS LINE! ****** */

/* ****************************************************** */
/*  determine screen resolution, assign new window sizes  */
/* ****************************************************** */

var resWidth = screen.width;

if (resWidth.toString() == "800") {
	
	var width = 780;
	var height = 580;
	
} else if (resWidth.toString() == "1024") {
	
	var width = 930;
	var height = 700;

} else if (resWidth.toString() == "1152") {
	
	var width = 930;
	var height = 820;

} else if (resWidth.toString() >= "1280") {
	
	var width = 930;
	var height = 960;
	
}


/* ****** browser detection ****** */

var detect = navigator.userAgent.toLowerCase();
var OS, browser, total, theString, place;
var version = 0;

if(checkIt('konqueror')) {
	browser = "Konqueror";
	OS = "Linux";
}
else if(checkIt('safari')) { browser = "Safari"; }
else if(checkIt('omniweb')) { browser = "OmniWeb"; }
else if(checkIt('opera')) { browser = "Opera"; }
else if(checkIt('webtv')) { browser = "WebTV"; }
else if(checkIt('icab')) { browser = "iCab"; }
else if(checkIt('msie')) { browser = "Internet Explorer"; }
else if(navigator.userAgent.indexOf("Firefox") != -1) { browser = "Firefox"; }
else if(!checkIt('compatible')) {
	browser = "Netscape Navigator";
	version = detect.charAt(8);
}
else { browser = "An unknown browser"; }

if(!version) { version = detect.charAt(place + theString.length); }

if(!OS) {
	if(checkIt('linux')) { OS = "Linux"; }
	else if(checkIt('x11')) { OS = "Unix"; }
	else if(checkIt('mac')) { OS = "Mac"; }
	else if(checkIt('win')) { OS = "Windows"; }
	else { OS = "an unknown operating system"; }
}

function checkIt(string) {
	place = detect.indexOf(string) + 1;
	theString = string;
	return place;
}

var getPageNameBegin02 = location.pathname.lastIndexOf("/");
var getPageNameEnd02 = location.pathname.indexOf(".htm");
var getPageNameFinal02 = location.pathname.substring (getPageNameBegin02, getPageNameEnd02);

getPageNameFinal02 = getPageNameFinal02.substr(1);

/* ****** initial forward to index.html ****** */
var doneForward = readCookie ("forward");

if (doneForward != "dn") {
	
	window.location = "index.html";
	createCookie ("forward", "dn");

} else {
	
	createCookie ("forward", "z");

}

/* ****** link controls ****** */

	function whichLink(link) {
		if(link == "emailPres") {
			this.location.href = "mailto::ted_feitshans@ncsu.edu?subject=E-mail inquiry from AALA contact page";
		}
		else if(link == "emailPresElect") {
			this.location.href = "mailto:WcolemanPjensen@aol.com?subject=E-mail inquiry from AALA contact page";
		}
		else if(link == "email") {
			this.location.href = "mailto:RobertA@aglaw-assn.org?subject=E-mail inquiry from AALA web site";
		}
		else if(link == "editor") {
			this.location.href = "mailto:lindamccormick@gotsky.com?subject=E-mail inquiry from AALA web site";
		}
		else if(link == "flag") {
			this.location.href = "mailto:FLAG@transitionguides.com";
		}
		else {
			if(link == "index") {
				this.location.href = link + ".html";
			}
			else {
				this.location.href = link + ".htm";
			}
		}
	}

	function whichLink2(link2) {
		this.location.href = link2;
	}

/* ******************************************** */
/* 	     prevent non-numerical and limit			  */
/* ******************************************** */

function checkValue (fieldID, fieldValue, limit) {

	var newValue = (isNaN (parseInt (fieldValue)) == true) ? "" : fieldValue;
	newValue = (newValue < 1 || newValue > limit || isNaN (newValue)) ? "" : newValue;
	
	document.getElementById(fieldID).value = newValue;
	
}

/* ****** residual crapola ****** */

	function disableFields (field) {
		
		var fieldObj = document.getElementById (field);
		
		fieldObj.disabled = true;
		
	}

	function memSurvey01 (elementChecked, elementID, assocID) {
		
		var assocElement = document.getElementById (assocID);
		
		if (!elementChecked) {
			
			assocElement.value = "";
			assocElement.disabled = true;
			
		} else {
			
			assocElement.disabled = false;
			assocElement.value = "";
			assocElement.focus();
		
		}
		
	}

	function dispTurtle() {
		var turtle = '<a href="http://www.divingturtledesign.com" class="turtle" onMouseOver="javascript:linkStatus(' + '\'' + 'd i v i n g t u r t l e d e s i g n . c o m' + '\'' + ');return true;" onMouseOut="javascript:linkStatus(0);return true;">';

		document.write('&nbsp;Site Design by ' + turtle + 'Diving Turtle' + '</a>&nbsp;');
	}

	function dispCopyright() {
		theDate = new Date();
		whatYear = theDate.getFullYear();

		if(whatYear == 2003) {
			document.write('&nbsp;© ' + whatYear + ' American Agricultural Law Association, ALL RIGHTS RESERVED&nbsp;');
		}
		else {
			document.write('&nbsp;© 2003 - ' + whatYear + ' American Agricultural Law Association, ALL RIGHTS RESERVED&nbsp;');
		}
	}

	function linkStatus(whichStatus) {
		if(whichStatus == 0) {
			window.status = "";
		}
		else {
			window.status = whichStatus;
		}
	}

	function changeCursor(whichCursor) {
		document.body.style.cursor = whichCursor;
	}


/* ****** open new window ****** */

	function OpenWin(whatPage, whatName, widthblah, heightblbah, scroll, toolbar, menubar, location, resize) {
		var newWin = null;

		leftPos = (screen.width) ? (screen.width - width) / 2 : 0;
//		topPos = (screen.height) ? (screen.height - height) / 2 : 0;

		settings = 'height=' + height + ',width=' + width + ',top=0,left=' + leftPos + ',scrollbars=' + scroll + ',toolbar=' + toolbar + ',menubar=' + menubar + ',location=' + location + ',resizable=' + resize;

		newWin = window.open(whatPage, whatName, settings);
	}

	function OpenWin1(whatPage, whatName, widthblah, heightblah, scroll, toolbar, menubar, location, resize) {
		var newWin = null;

		leftPos = (screen.width) ? (screen.width - width) / 2 : 0;
		topPos = (screen.height) ? (screen.height - height) / 2 : 0;

		settings = 'height=' + height + ',width=' + width + ',top' + topPos + ',left=' + leftPos + ',scrollbars=' + scroll + ',toolbar=' + toolbar + ',menubar=' + menubar + ',location=' + location + ',resizable=' + resize;

		newWin = window.open(whatPage, whatName, settings);
	}

	function OpenWinLinks(whatPage) {
		var newWin = null;
		var whatName = "links";


		leftPos = (screen.width) ? (screen.width - width) / 2 : 0;
//		topPos = (screen.height) ? (screen.height - height) / 2 : 0;

		settings = 'height=600,width=800,top=0,left=' + leftPos + ',scrollbars=yes,toolbar=yes,menubar=yes,location=yes,resizable=yes';

		newWin = window.open(whatPage, whatName, settings);
	}

	function OpenWinIndex(whatPage) {
		var newWin = null;
		var whatName = "index";

		settings = 'height=768,width=1024,top=0,left=0,scrollbars=yes,toolbar=yes,menubar=yes,location=yes,resizable=yes,status=yes';

		newWin = window.open(whatPage, whatName, settings);
	}

	function OpenWinRegForm(whatPage) {
		//var width = 1024;
		var newWin = null;
		var whatName = "regForm";

		leftPos = (screen.width) ? (screen.width - width) / 2 : 0;

		settings = 'height=' + height + ',width=' + width + ',top=0,left=' + leftPos + ',scrollbars=yes,toolbar=yes,menubar=yes,location=yes,resizable=yes,status=yes';

		newWin = window.open(whatPage, whatName, settings);
	}

/* **************************** */
/*  opens a new archive window  */
/* **************************** */

var settings = "";
var newWin = "";

function openWinArchive (whatPage, whatName) {
	
	var leftPos = (screen.width) ? (screen.width - width) / 2 : 0;

	settings = 'width=' + width + ',height=' + height + ',top=0,left=' + leftPos + ',scrollbars=yes,toolbar=yes,menubar=yes,location=yes,resizable=yes,status=yes';

	newWin = window.open(whatPage, whatName, settings);
	
}