var SIMLBLUE = '#ACAFD5';
var SIMBLUE = '#595EAA';
var SIMDBLUE = '#2C2F55';
var SIMWBLUE = '#6A6EB3';

function over(obj) {
	//if (!obj.contains(event.fromElement)) {
		obj.style.cursor = 'hand';
		obj.bgColor = SIMLBLUE;
	//}
}

function clk(obj) {
	//if(event.objElement.tagName=='TD') {
		obj.children.tags('A')[0].click();
	//}
}

function out(obj) {
	//if (!obj.contains(event.toElement)) {
		obj.style.cursor = 'default';
		obj.bgColor = SIMBLUE;
	//}
}

function goStat(section) {
	window.status = 'go to the ' + section + ' section';
	return true;
}

function stat(see) {
	window.status = see;
	return true;
}


function showDate() {

	var now = new Date();
	var now_day = now.getDay();
	var now_month = now.getMonth();
	var now_date = now.getDate();
	var now_year = now.getYear();
	
	switch (now_day) {
		case 0:
			now_day = "sunday";
		break;
		case 1:
			now_day = "monday";
		break;
		case 2:
			now_day = "tuesday";
		break;
		case 3:
			now_day = "wednesday";
		break;
		case 4:
			now_day = "thursday";
		break;
		case 5:
			now_day = "friday";
		break;
		case 6:
			now_day = "saturday";
		break;
		default:
			now_day = "Day:Error!";
	}

	switch (now_month) {
		case 0:
			now_month = "january";
		break;
		case 1:
			now_month = "february";
		break;
		case 2:
			now_month = "march";
		break;
		case 3:
			now_month = "april";
		break;
		case 4:
			now_month = "may";
		break;
		case 5:
			now_month = "june";
		break;
		case 6:
			now_month = "july";
		break;
		case 7:
			now_month = "august";
		break;
		case 8:
			now_month = "september";
		break;
		case 9:
			now_month = "october";
		break;
		case 10:
			now_month = "november";
		break;
		case 11:
			now_month = "december";
		break;
		default:
			now_month = "Month:Error!";
	}

	if (now_year < 2000) {
		now_year += 1900;
	}
	
	var str = now_day + ", " + now_month + " " + now_date + ", " + now_year;
	document.write(str);

}


function checkNetscape() {
	
	var IE4 = (document.all && !document.getElementById) ? true : false;
	var N4 = (document.layers) ? true : false;
	var IE5 = (document.all && document.getElementById) ? true : false;
	var N6 = (document.getElementById && !document.all) ? true : false;
	
	if (N4 == true) {
		window.location = "netscape/frames.htm";
	}
	
}

function checkIE() {
	if (navigator.appName == "Microsoft Internet Explorer") {
		window.location = "../home.htm";
	}
}

function checkFrames() {
	if (top.frames.length == 0) {
		top.location = "frames.htm"
	}
}


// Validate Informatin Request Form
function testForm(passForm) {

	// Regular Expressions to validate E-mail and Phone Number
	reEmail =	/^\w+([\.-}?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/
	rePhone = /^\(?(\d{3})\)?[\.\-\/]?(\d{3})[\.\-\/]?(\d{4})$/

	// Check for blank fields
	if (
			(passForm.name.value == "") || (passForm.name.value == null) ||
			(passForm.email.value == "") || (passForm.email.value == null) ||
			(passForm.hphone.value == "") || (passForm.hphone.value == null)
		) {
		window.alert("Please fill in all the required fields.");
		return false;
	}

	// Check Email Address
	if (reEmail.test(passForm.email.value) == false)	{
		window.alert("The email address you have entered is invalid. Please retype it.");
		passForm.email.focus();
		passForm.email.select();
		return false;
	}

	// Check Home Phone Number
	hphoneResult = rePhone.exec(passForm.hphone.value);
	if (hphoneResult == false || hphoneResult == null)	{
		window.alert("Please retype your home phone number in the following format: (123)456-7890");
		passForm.hphone.focus();
		passForm.hphone.select();
		return false;
	}
  passForm.hphone.value = "(" + hphoneResult[1] + ")" + hphoneResult[2] + "-" + hphoneResult[3];

	// Check Work Phone Number ONLY IF IT IS ENTERED
	if ((passForm.wphone.value == "") || (passForm.wphone.value == null)) {}
	else {
		wphoneResult = rePhone.exec(passForm.wphone.value);
		if (wphoneResult == false || wphoneResult == null)	{
			window.alert("Please retype your work phone number in the following format: (123)456-7890");
			passForm.wphone.focus();
			passForm.wphone.select();
			return false;
		}
		passForm.wphone.value = "(" + wphoneResult[1] + ")" + wphoneResult[2] + "-" + wphoneResult[3];
	}

	// Check Fax Number ONLY IF IT IS ENTERED
	if ((passForm.fax.value == "") || (passForm.fax.value == null)) {}
	else {
		faxResult = rePhone.exec(passForm.fax.value);
		if (faxResult == false || faxResult == null)	{
			window.alert("Please retype your fax number in the following format: (123)456-7890");
			passForm.fax.focus();
			passForm.fax.select();
			return false;
		}
		passForm.fax.value = "(" + faxResult[1] + ")" + faxResult[2] + "-" + faxResult[3];
	}

	// Display page to let user know that the information has been sent
	window.location = "sent.htm";
	return true;

}