

/* ALLOWS PNGS IN IE4+
---------------------------------------- */

if (navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer" && window.attachEvent) {
	document.writeln('<style type="text/css">img { visibility:hidden; } </style>');
	window.attachEvent("onload", fnLoadPngs);
}
function fnLoadPngs() {
	var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
	var itsAllGood = (rslt != null && Number(rslt[1]) >= 5.5);
	for (var i = document.images.length - 1, img = null; (img = document.images[i]); i--) {
		if (itsAllGood && img.src.match(/\.png$/i) != null) {
			var src = img.src;
			img.style.width = img.width + "px";
			img.style.height = img.height + "px";
			img.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='scale')"
			img.src = "/images/mrI.gif";
		}
		img.style.visibility = "visible";
	}	
}








/* FORM FIELD VALIDATION
<script type="text/javascript" language="JavaScript">
function checkRequiredFields() {
	var errorMessage = new String();
	if(noneWithCheck(document.daForm.radioOne)){ errorMessage += "\nPlease click one radio button of the set of three."; }
	if(withoutCheck(document.daForm.radioLoner)){ errorMessage += "\nThe \"Loner\" radio button must be clicked."; }
	If checkbox names are "name[]"
		if(noneWithCheck(document.daForm['name[]'])){ errormessage += "\nPlease check one or more check boxes of the set of three."; }
	if(noneWithCheck(document.daForm.checkOne)){ errorMessage += "\nPlease check one or more check boxes of the set of three."; }
	if(withoutCheck(document.daForm.checkLoner)){ errorMessage += "\nThe \"Loner\" check box must be checked."; }
	if(withoutContent(document.daForm.sometext.value)){ errorMessage += "\n\"Some text\" is a required field."; }
	If formfields names are "name[]"
		if(noneWithContent(document.daForm['name[]'])){ errorMessage += "\nSomething must be typed in one or both of the set of form text fields."; }
	if(noneWithContent(document.daForm.oneOrTheOther)){ errorMessage += "\nSomething must be typed in one or both of the set of form text fields."; }
	if(withoutContent(document.daForm.areaName.value)){ errorMessage += "\nSomething must be typed in the textarea box."; }
	If validating an email make sure to use both "withoutContent" and "isValidEmail"
	if(isValidEmail(document.daForm.areaName.value)){ errorMessage += "\nThe email address you entered is not valid."; }
	if(withoutContent(document.daForm.FileGet.value)){ errorMessage += "\nA file name must be provided for uploading."; }
	if(withoutSelectionValue(document.daForm.dropname)){ errorMessage += "\nPlease select something from the dropdown list."; }
	if(errorMessage.length > 2) {
		displayEM(errorMessage);
		return false;
	}
	return true;
}
</script>
<form name="daForm" onSubmit="return checkRequiredFields();" action="page.php" method="post" enctype="multipart/form-data">
</form>
---------------------------------------- */

function displayEM(errorMessage){
	var beforeErrorMessage = new String();
	beforeErrorMessage = "You man not have noticed but:\n";
	var afterErrorMessage = new String();
	afterErrorMessage = "\n\nPlease make the above changes.";
	alert(beforeErrorMessage + errorMessage + afterErrorMessage);
}

function withoutContent(ss) {
	if(ss.length > 0) { return false; }
	return true;
}

function isValidEmail(ss) {
	if(ss.length > 0) {
		if((ss.indexOf(".") > 0) && (ss.indexOf("@") > 0)) { return false; }
		return true;
	}
}

function isValidURL(ss) {
	if(ss.length > 0) {
		if((ss.substring(0,7) == "http://") && (ss.indexOf(".") > 0)) { return false; }
		return true;
	}
}

function noneWithContent(ss) {
	for(var i = 0; i < ss.length; i++) {
		if(ss[i].value.length > 0) { return false; }
	}
	return true;
}

function noneWithCheck(ss) {
	if(ss.length){
		for(var i = 0; i < ss.length; i++) {
			if(ss[i].checked) { return false; }
		}
	}else{
		if(ss.checked) { return false; }
	}
	return true;
}

function withoutCheck(ss) {
	if(ss.checked) { return false; }
	return true;
}

function withoutSelectionValue(ss) {
	for(var i = 0; i < ss.length; i++) {
		if(ss[i].selected) {
			if(ss[i].value.length) { return false; }
		}
	}
return true;
}


/* ONLOAD
---------------------------------------- */
window.onload=function(){
	buttonRollovers();
	colorRows();
	tableruler();
}
