/**************************
 Code to stop people Right-Clicking the page
 **************************/

function clickIE4(){
	if (event.button==2)
		return false;
}

function clickNS4(e){
	if (document.layers||document.getElementById&&!document.all)
		if (e.which==2||e.which==3)
			return false;
}

if (document.layers){
	document.captureEvents(Event.MOUSEDOWN);
	document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById)
	document.onmousedown=clickIE4;

document.oncontextmenu=new Function("return false")


/***********************************
       Miscellaneous Functions
************************************/
function showHide(divName) {
  if (divName.style.display == "")
	contract(divName);
  else
	expand(divName);
}
function expand(divName) {
  divName.style.display = "";
}
function contract(divName) {
  divName.style.display = "none";
} 
  
function isValidDate(dateStr) {
	// Checks for the following valid date formats:
	// MM/DD/YY   MM/DD/YYYY   MM-DD-YY   MM-DD-YYYY
	// Also separates date into month, day, and year variables
	
	var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/;
	

	
	var matchArray = dateStr.match(datePat); // is the format ok?
	if (matchArray == null) {
	    alert("no");
	    return false;
	}
	day = matchArray[1];
	month = matchArray[3]; // parse date into variables
	year = matchArray[4];
	if (month < 1 || month > 12) { // check month range
	    return false;
	}
	if (day < 1 || day > 31) {
	    return false;
	}
	if ((month==4 || month==6 || month==9 || month==11) && day==31) {
	    return false
	}
			
	if (month == 2) { // check for february 29th
	var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
	if (day>29 || (day==29 && !isleap)) {
	    return false;
	   }
	}
	return true;  // date is valid
}


