if (navigator.appName == "Netscape"){	// Netscape
	if (parseInt(navigator.appVersion) <= 4){
		var myStyles = "";
		var myAll = ".";
		var myBrowser = "NS";
	}
	else{
		var myStyles = "').style";
		var myAll = ".getElementById('";
		var myBrowser = "NS6";
	}
}
else if (document.all){		//IE
	var myStyles = ".style";
	var myAll = ".all.";
	var myBrowser = "IE";
}

function switchImage(myObj, imageName ){
	myObj.src = ('images/buttons/' + imageName );
}

function checkLeap(Year){
	// It is exactly divisible by 4
	if ((Year % 4) == 0){
		// It is exactly divisible by 100
		// Is it also exactly divisible by 400?
		if ( (Year % 100) == 0){
			Result = ( (Year % 400) == 0);
		}
		else{
			Result = 1;
		}
	}
	// It is not exactly divisible by 4
	// It is not a leap year
	else{
		Result = 0;
	}
	return (Result);
}

function myDaysInMonth(month, year){
	if (month == 2){
		if (checkLeap(year) == 1){
			return 29
		}
		else{
			return 28
		}
	}
	
	if ((month == 1)||(month == 3)||(month == 5)||(month == 7)||(month == 8)||(month == 10)||(month == 12)){
		return 31
	}
	
	if ((month == 4)||(month == 6)||(month == 9)||(month == 11)){
		return 30
	}

}

function openNewWindow(winWidth,winHeight,pageRef,myTitle){

	if (navigator.appName == "Netscape"){ // Netscape
		if (parseInt(navigator.appVersion) <= 4){
			myWidth = (screen.width - winWidth) / 2;
			myHeight = (screen.height - winHeight) / 2;
			myBrowser2 = "NS";
		}
		else{
			myWidth = (screen.width - winWidth) / 2;
			myHeight = (screen.height - winHeight) / 2;
			myBrowser2 = "NS6";
		}
	}
	else if (document.all){ //IE
		myWidth = (screen.width - winWidth) / 2;
		myHeight = (screen.height - winHeight) / 2;
		myBrowser2 = "IE";
	}
	myParams = "width=" + winWidth + ",height=" + winHeight

	myWin = window.open(String(pageRef),String(myTitle),String(myParams));
	myWin.moveTo(myWidth,myHeight)
	myWin.focus()

}
	
function hideLayer(lyr, state){
	eval("document" + myAll + lyr + myStyles + ".visibility = " + "'" + state + "'");
}

function checkForm(myElement, obj, alertRef){

	if (obj.value == ""){
		alert("Please provide " + alertRef + ".")
		obj.focus();
		obj.select();
		return false;
	}

	if (myElement == 'text_numeric'){
		for (a = 0; a <= obj.value.length - 1; a++){
			var c = obj.value.charAt(a)
			if (!((c >= 0)&&(c <= 9))){
				alert(alertRef + " may only contain numeric values.")
				obj.focus();
				obj.select();
				return false;
				//break;
			}		
		}
	}

	if (myElement == 'phone'){
		for (a = 0; a <= obj.value.length - 1; a++){
			var c = obj.value.charAt(a)
			if (!(((c >= 0)&&(c <= 9))||(c == "-"))){
				alert(alertRef + ' may only contain numeric values and "-".')
				obj.focus();
				obj.select();
				return false;
				//break;
			}		
		}
	}

	if (myElement == 'select'){
		if (obj.value == 0){
			alert("Please select " + alertRef + ".")
			obj.focus();
			return false;
		}
	}

	if (myElement == 'radio'){
		isCheck = 0
		for (a = 0; a <=  obj.length - 1; a++){
			if (obj[a].checked == true){
				isCheck = 1
			}
		}
		if (isCheck == 0){
			alert("Please select " + alertRef + ".")
			return false;
		}
	}
	return true;
}