function isEmail(string) {
	if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1) {
		document.myForm.submit();
	} else {
		alert ('Please check the Return Email Address.\n\nWithout it I can\'t reply to your message.');  
		document.myForm.email.focus();
	}
}

function linkClick(which) {
	if (document.links[which].className == 'badlink') {
		var newclassName = 'links';
		if (document.myForm.linkcount.value == "" || document.myForm.linkcount.value == "1") {
			var newlinkcount = "";
			var newH3string = "To report bad links:";
		} else {
			var newlinkcount = document.myForm.linkcount.value - 1;
			var newH3string = "To report " + newlinkcount + " bad links:";
		}
		var link_numbers_array = document.myForm.linknumbers.value.split('_');
		var new_link_numbers_array = new Array( );
		for (var i = 0; i < link_numbers_array.length; i++) {
			if (link_numbers_array[i] != which) {new_link_numbers_array[i] = link_numbers_array[i];}
		}
		var newlinknumbers = new_link_numbers_array.join('_'); // pull (which) out of the linknumbers array
	} else {
		var newclassName = 'badlink';
		var newlinkcount = (document.myForm.linkcount.value - 0) + 1;
		var newH3string = "To report " + newlinkcount + " bad links:";
		if (document.myForm.linkcount.value == "") {
			var newlinknumbers = which;
		} else {
			var newlinknumbers = document.myForm.linknumbers.value + "_" + which;
		}
	}
	document.links[which].className = newclassName;
		document.myForm.badlinkH3.value = newH3string;
	document.myForm.linkcount.value = newlinkcount;
	document.myForm.linknumbers.value = newlinknumbers;
}

function sendLinkForm(which) {
	if (which == 'suggest') {
		if (document.myForm.suggestion.value.length > 9) {
			document.myForm.submit();
		}
	} else if (which =='report') {
		document.myForm.suggestion.value = '';
		document.myForm.submit();
	}
}

function siteSearch() {
	if (document.myForm.q.value=='Search all entries') {
		alert ('Type a word in to the Search all entries field to search the entire journal archive.');
		document.myForm.q.focus();
	} else {
		document.myForm.submit();
	}
}

function printPage() {
	if (window.print) {
		setTimeout('window.print();',200);
	}
	else if ((navigator.platform.substring(0,3)) == "mac") {
		alert("Press \"Cmd+p\" on your keyboard to print article.");
	}
	else {
		alert("Press \"Ctrl+p\" on your keyboard to print article.")
	}
}

function showHideIt (showHide, It) { // ('[show|hide]', 'objectIdName')
	if (document.layers) { //ns4
		document.It.visibility = showHide;
	} else {
		if (showHide == "show") {showHide = "visible";} else {showHide = "hidden";}
		if (document.all) { //ie4
			document.all[It].style.visibility = showHide;
		} else if (document.getElementById) { //ns6
			document.getElementById(It).style.visibility = showHide;
		}
	}
}
