// Image swapping - Mouseover
function imageOn(imgName) {
	var d = document;
	if (d.images) {
		d.images[imgName].src = onImageArray[imgName].src;
	}
}

// Image Swapping - Mouseout
function imageOff(imgName) {
	var d = document;
	if (d.images) {
		d.images[imgName].src = offImageArray[imgName].src;
	}
}

function bgon( td, menulayer )
{
    if(document.getElementById(td)) document.getElementById(td).style.backgroundImage="url('images/qa_menu_blank_active.gif')";
    if(document.getElementById(menulayer)) document.getElementById(menulayer).style.visibility='visible';
}
    
function bgoff( td, menulayer )
{    
    if(document.getElementById(td)) document.getElementById(td).style.backgroundImage="url('images/qa_menu_blank_passive.gif')";
    if(document.getElementById(menulayer)) document.getElementById(menulayer).style.visibility='hidden';    
    
}

// Allows changing a parent page url from popup window
function two4one(strPlace) {
	var sURL = '../index.asp?fa=' + strPlace;
	window.opener.parent.window.location.href = sURL;
	top.close();
}

///////////////////////////////////////////////////////////////////////////////
// Request Form Validation 
function contactUsFormChk(daForm) {
	var sProblem = '';
	sProblem += checkFName(daForm.fname.value);
	sProblem += checkLName(daForm.lname.value);
	sProblem += checkZip(daForm.zip.value);
	sProblem += checkPhone(daForm.phone.value);
	sProblem += checkEmail(daForm.email.value);
	sProblem += checkMessage(daForm.msg.value);
	if (sProblem != '') {
		sProblem = 'The following form field(s) were invalid or incorrect:\n\n' + sProblem + '\nPlease complete or correct the form and submit again.'
		alert(sProblem);
		return false;
	}
	return true;
}

function checkFName(strVal) {
	var error = '';
	if (strVal.length == 0) {
		error = 'First Name is a required field.\n'
	}
	return error;	  
}

function checkLName(strVal) {
	var error = '';
	if (strVal.length == 0) {
		error = 'Last Name is a required field.\n'
	}
	return error;
}

function checkEmail(strVal) {
	var error = '';
	if (strVal.length == 0) {
		error = 'Email is a required field.\n';
	} else {
		var emailFilter = /^.+@.+\..{2,3}$/;
		if (!(emailFilter.test(strVal))) { 
			error = 'Please enter a valid email address.\n';
		} else {
			//test email for illegal characters
			var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/;
			if (strVal.match(illegalChars)) {
				error = 'Please enter a valid email address.\n';
			}
		}
	}
	return error;    
}

function checkPhone(strVal) {
	var error = '';
	if (strVal != '') {
		var stripped = strVal.replace(/[\(\)\.\-\ ]/g, ''); //strip out acceptable non-numeric characters
		if (isNaN(parseInt(stripped))) {
			error = 'The phone number contains illegal characters.';
		}
		if (!(stripped.length == 10)) {
			error = 'The phone number is the wrong length. Make sure you included an area code.\n';
		} 
	}
	return error;
}

function checkMessage(strVal) {
	var error = '';
	if (strVal != '') {
		if (strVal.Length > 1000) {
			error = "Your message can be no longer than a 1000 characters.\n";
		}
	}
	return error;
}

function checkZip(strVal) {
	var error = '';
	if (strVal != '') {
		var stripped = strVal.replace(/\-/g, ''); //strip out '-', if present
		if (isNaN(parseInt(stripped))) {
			error = 'Please enter a valid zip code.\n';
		} else {
			if (!((stripped.length == 5) || (stripped.length == 9))){
				error = 'Please enter a valid zip code.\n';
			}
		}
	}
	return error;
}			
///////////////////////////////////////////////////////////////////////////////

function popMilestonesWindow() 
{
	popwin2Window = window.open('popups/popMilestones.html', 'popMilestones', 'width=370,height=430,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();
}

function popLocationsWindow() 
{
	popwin2Window = window.open('popups/popLocations.html', 'popLocations', 'width=370,height=430,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();
}

function popPeopleWindow(i)
{
	popwin2Window = window.open('popups/popPeople.asp?who=' + i , 'popPeople', 'width=370,height=430,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();
}

function popKRICWindow() 
{
	popwin2Window = window.open('popups/popKRIC.html', 'popKRIC', 'width=370,height=430,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();
}

function popKRICv2Window() 
{
	popwin2Window = window.open('popups/popKRICv2.html', 'popKRICv2', 'width=370,height=430,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();
}

function popAIMCOWindow() 
{
	popwin2Window = window.open('popups/popAIMCO.html', 'popAIMCO', 'width=370,height=430,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();
}

function popAIMCOv2Window() 
{
	popwin2Window = window.open('popups/popAIMCOv2.html', 'popAIMCOv2', 'width=370,height=430,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();
}

function pop3PartyWindow() 
{
	popwin2Window = window.open('popups/pop3Party.html', 'pop3Party', 'width=370,height=430,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();
}

function pop3Partyv2Window() 
{
	popwin2Window = window.open('popups/pop3Partyv2.html', 'pop3Partyv2', 'width=370,height=430,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();
}

function popTeleCaseMgmt() 
{
	popwin2Window = window.open('popups/popTeleCaseMgmt.html', 'TeleCaseMgmt', 'width=370,height=430,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();
}

function popMedCaseMgmt() 
{
	popwin2Window = window.open('popups/popMedCaseMgmt.html', 'MedCaseMgmt', 'width=370,height=430,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();
}

function popVocRehab() 
{
	popwin2Window = window.open('popups/popVocRehab.html', 'VocRehab', 'width=370,height=430,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();
}

function popUtilReview() 
{
	popwin2Window = window.open('popups/popUtilReview.html', 'TeleCaseMgmt', 'width=370,height=430,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();
}

function popCompCareProviderNetwork() 
{
	popwin2Window = window.open('popups/popCompCareProviderNetwork.html', 'CompCareProviderNetwork', 'width=370,height=430,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();
}

function popLinks() 
{
	popwin2Window = window.open('popups/popLinks.html', 'Links', 'width=370,height=430,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();
}

function popWhatWeWriteWindow() 
{
	popwin2Window = window.open('popWhatWeWrite.html', 'WhatWeWrite', 'width=370,height=430,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();
}

function popUnderwritingWindow() 
{
	popwin2Window = window.open('popUnderwriting.html', 'Underwriting', 'width=370,height=430,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();
}

function popLCWindow() 
{
	popwin2Window = window.open('popLC.html', 'LC', 'width=370,height=430,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();
}

function popClaimsWindow() 
{
	popwin2Window = window.open('popClaims.html', 'Claims', 'width=370,height=430,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();
}

function popKey2CompWindow() 
{
	popwin2Window = window.open('popups/popKey2Comp.html', 'Key2Comp', 'width=370,height=430,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();
}

function popKeyRiskPlazaWindow() 
{
	popwin2Window = window.open('popups/popKeyRiskPlaza.html', 'KeyRiskPlaza', 'width=370,height=430,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();
}

function popOtherWebToolsWindow() 
{
	popwin2Window = window.open('popups/popOtherWebTools.html', 'OtherWebTools', 'width=370,height=430,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();
}

function popKRICContacts() 
{
	popwin2Window = window.open('popups/popKRICContacts.html', 'KRICContacts', 'width=370,height=430,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();
}
function popDrivingHazardsCourse1() 
{
	popwin2Window = window.open('../../popups/PerceptionofDrivingHazards_Course 1.ppt', 'DrivingHazardsCourse1', 'width=800,height=600,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();
}
function popDrivingHazardsCourse2() 
{
	popwin2Window = window.open('../../popups/PerceptionofDrivingHazards_Course 2.ppt', 'DrivingHazardsCourse2', 'width=800,height=600,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();
}
function popMECCDemo() 
{
	popwin2Window = window.open('popups/MECCSiteTourV2.exe', 'MeccDemo', 'width=800,height=600,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();
}
function popCountryClub1() 
{
	popwin2Window = window.open('../../popups/CountryClub1.ppt', 'CountryClub1', 'width=800,height=600,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();
}
function popFurnWorkshop1() 
{
	popwin2Window = window.open('../../popups/FurnWorkshop1.ppt', 'FurnWorkshop1', 'width=800,height=600,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();
}

function popMunWorkshop1() 
{
	popwin2Window = window.open('../../popups/Municipalities.ppt', 'MunWorkshop1', 'width=800,height=600,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();
}

function popAutoDealers1() 
{
	popwin2Window = window.open('../../popups/AutoDealers1.ppt', 'AutoDealers1', 'width=800,height=600,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();
}



function popCompCareContacts() 
{
	popwin2Window = window.open('../../popups/popCompCareContacts.html', 'CompCareContacts', 'width=370,height=430,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();
}
function popWhatToDo() 
{
	popwin2Window = window.open('../../popups/popWhatToDo.html', 'WhatToDo', 'width=370,height=430,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();
}
function popWhereToGo() 
{
	popwin2Window = window.open('../../popups/popWhereToGo.html', 'WhereToGo', 'width=370,height=430,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();
}
function popWhomToNotify() 
{
	popwin2Window = window.open('../../popups/popWhomToNotify.html', 'WhomToNotify', 'width=370,height=430,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();
}
function popProviderInformation() 
{
	popwin2Window = window.open('../../popups/popProviderInformation.html', 'ProviderInformation', 'width=370,height=430,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();
}
function popPreCert() 
{
	popwin2Window = window.open('../../popups/popPreCert.html', 'PreCert', 'width=370,height=430,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();
}
function popReturnToWork() 
{
	popwin2Window = window.open('../../popups/popReturnToWork.html', 'ReturnToWork', 'width=370,height=430,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();
}
function popMedDef() 
{
	popwin2Window = window.open('../../popups/popMedDef.html', 'MedDef', 'width=370,height=430,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();
}
function popLegislature() 
{
	popwin2Window = window.open('popups/popLegislature.html', 'Links', 'width=370,height=430,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();

}
function popContacts() 
{
	popwin2Window = window.open('popups/popContacts.html', 'Contacts', 'width=370,height=430,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();

}

function popAdminSvcs() 
{
	popwin2Window = window.open('popups/popAdminSvcs.html', 'Administrative Services', 'width=370,height=430,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	popwin2Window.focus();

}
// Template function below to add another popup
//function pop<NEW_NAME>() 
//{
//	popwin2Window = window.open('popups/pop<NEW_NAME>.html', '<NEW_NAME>', 'width=370,height=430,toolbar=no,directories=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
//	popwin2Window.focus();
//}