/*
Rollover /images for side nav
*/

image1 = new Image();
image1.src = "/images/rollover/nav_aboutus.gif";
image1on = new Image();
image1on.src = "/images/rollover/nav_aboutus_over.gif";

image2 = new Image();
image2.src = "/images/rollover/nav_products.gif";
image2on = new Image();
image2on.src = "/images/rollover/nav_products_over.gif";

image3 = new Image();
image3.src = "/images/rollover/nav_products_com.gif";
image3on = new Image();
image3on.src = "/images/rollover/nav_products_com_over.gif";

image4 = new Image();
image4.src = "/images/rollover/nav_products_hangar.gif";
image4on = new Image();
image4on.src = "/images/rollover/nav_products_hangar_over.gif";

image5 = new Image();
image5.src = "/images/rollover/nav_products_sliding.gif";
image5on = new Image();
image5on.src = "/images/rollover/nav_products_sliding_over.gif";

image6 = new Image();
image6.src = "/images/rollover/nav_employment.gif";
image6on = new Image();
image6on.src = "/images/rollover/nav_employment_over.gif";

image7 = new Image();
image7.src = "/images/rollover/nav_catalog.gif";
image7on = new Image();
image7on.src = "/images/rollover/nav_catalog_over.gif";

image8 = new Image();
image8.src = "/images/rollover/nav_distributors.gif";
image8on = new Image();
image8on.src = "/images/rollover/nav_distributors_over.gif";

image9 = new Image();
image9.src = "/images/rollover/nav_contactus.gif";
image9on = new Image();
image9on.src = "/images/rollover/nav_contactus_over.gif";

/*
Rollover /images for right side nav
*/
imgside1 = new Image();
imgside1.src = "/images/rollover/navrt_home.gif";
imgside1on = new Image();
imgside1on.src = "/images/rollover/navrt_home_over.gif";

imgside2 = new Image();
imgside2.src = "/images/rollover/navrt_productfinder.gif";
imgside2on = new Image();
imgside2on.src = "/images/rollover/navrt_productfinder_over.gif";

imgside3 = new Image();
imgside3.src = "/images/rollover/navrt_requestcat.gif";
imgside3on = new Image();
imgside3on.src = "/images/rollover/navrt_requestcat_over.gif";


/*
Rollover functionas
*/
function on(pNameOfImg) {
	document[pNameOfImg].src = eval(pNameOfImg + "on.src");
	}	
	
function out(pNameOfImg) {
	document[pNameOfImg].src = eval(pNameOfImg + ".src");
	}
	
/*---------------------------------------------------------------
WindowPopup() - Popup helper function
---------------------------------------------------------------*/
function WindowPopup(pPopupURL)
{
	window.open(pPopupURL, '', 'width=550,height=435,resizable=yes');
}

/*---------------------------------------------------------------
WindowGoAndPopup() - Popup helper, with redirect
---------------------------------------------------------------*/
function WindowGoAndPopup(pPopupURL, pRedirectURL)
{
	window.location = pRedirectURL
	window.open(pPopupURL, '', 'width=550,height=425,resizable=yes');
}

/*---------------------------------------------------------------
ValidateRequestCatalog() - Form validator
---------------------------------------------------------------*/
function ValidateRequestCatalog() {
	strAlert = "The following issues need to be corrected before submitting the form: \r\n";
	blnValid = true;
	
	// Check entries on the form that need to be validated
	// if(Trim(document.RequestCat.txtCompanyName.value) == '') {
	//	strAlert += "- Company name is blank and is required. \r\n";
	//	blnValid = false;
	//	}
	if(Trim(document.RequestCat.txtName.value) == '') {
		strAlert += "- Name is blank and is required. \r\n";
		blnValid = false;
		}
	if(Trim(document.RequestCat.txtAddr1.value) == '') {
		strAlert += "- Address is blank and is required. \r\n";
		blnValid = false;
		}
	if(Trim(document.RequestCat.txtCity.value) == '') {
		strAlert += "- City is blank and is required. \r\n";
		blnValid = false;
		}
	if(Trim(document.RequestCat.txtState.value) == '') {
		strAlert += "- State is blank and is required. \r\n";
		blnValid = false;
		}				
	if(Trim(document.RequestCat.txtZipcode.value) == '') {
		strAlert += "- Zipcode is blank and is required. \r\n";
		blnValid = false;
		}
	if(Trim(document.RequestCat.txtEmail.value) == '') {
		strAlert += "- Email is blank and is required. \r\n";
		blnValid = false;
		}		
	else if ((Trim(document.RequestCat.txtEmail.value)) != (Trim(document.RequestCat.txtEmailConfirm.value))) {
		strAlert += "- Emails do not match. \r\n";
		blnValid = false;
		}		
	else if (!IsEmail(document.RequestCat.txtEmail.value)) {
		strAlert += "- Email format invalid.  (ex: email@domain.com) \r\n";
		blnValid = false;
		}	
		
	if( (Trim(document.RequestCat.txtPhone1.value) == '') || (Trim(document.RequestCat.txtPhone2.value) == '') || (Trim(document.RequestCat.txtPhone3.value) == '') ) {
		strAlert += "- Phone number is blank and is required. \r\n";
		blnValid = false;
		}
	else if( (!IsNumeric(document.RequestCat.txtPhone1.value)) || (!IsNumeric(document.RequestCat.txtPhone2.value)) || (!IsNumeric(document.RequestCat.txtPhone3.value)) ) {
		strAlert += "- Phone number is not a numeric value. \r\n";
		blnValid = false;
		}
	else if( (document.RequestCat.txtPhone1.value.length < 3) || (document.RequestCat.txtPhone2.value.length < 3) || (document.RequestCat.txtPhone3.value.length < 4) ) {
		strAlert += "- Phone number is not a complete telephone number. \r\n";
		blnValid = false;
		}

	//if( (Trim(document.RequestCat.txtFax1.value) == '') || (Trim(document.RequestCat.txtFax2.value) == '') || (Trim(document.RequestCat.txtFax3.value) == '') ) {
	//	strAlert += "- Fax number is blank and is required. \r\n";
	//	blnValid = false;
	//	}
	//else if( (!IsNumeric(document.RequestCat.txtFax1.value)) || (!IsNumeric(document.RequestCat.txtFax2.value)) || (!IsNumeric(document.RequestCat.txtFax3.value)) ) {
	//	strAlert += "- Fax number is not a numeric value. \r\n";
	//	blnValid = false;
	//	}
	//else if( (document.RequestCat.txtFax1.value.length < 3) || (document.RequestCat.txtFax2.value.length < 3) || (document.RequestCat.txtFax3.value.length < 4) ) {
	//	strAlert += "- Fax number is not a complete telephone number. \r\n";
	//	blnValid = false;
	//	}	
	
	// Display message, if necessary
	if(!blnValid) {
		alert(strAlert);
		}
		
	// Allow form to submit or cancel
	return blnValid;
	}	
	

/*---------------------------------------------------------------
ValidateRequestInfo() - Form validator
---------------------------------------------------------------*/
function ValidateRequestInfo() {
	strAlert = "The following issues need to be corrected before submitting the form: \r\n";
	blnValid = true;
	
	// Check entries on the form that need to be validated
	//if(Trim(document.RequestInfo.txtCompanyName.value) == '') {
	//	strAlert += "- Company name is blank and is required. \r\n";
	//	blnValid = false;
	//	}
	
	if(Trim(document.RequestInfo.txtName.value) == '') {
		strAlert += "- Name is blank and is required. \r\n";
		blnValid = false;
		}
	if(Trim(document.RequestInfo.txtAddr1.value) == '') {
		strAlert += "- Address is blank and is required. \r\n";
		blnValid = false;
		}
	if(Trim(document.RequestInfo.txtCity.value) == '') {
		strAlert += "- City is blank and is required. \r\n";
		blnValid = false;
		}
	if(Trim(document.RequestInfo.txtState.value) == '') {
		strAlert += "- State is blank and is required. \r\n";
		blnValid = false;
		}				
	if(Trim(document.RequestInfo.txtZipcode.value) == '') {
		strAlert += "- Zipcode is blank and is required. \r\n";
		blnValid = false;
		}
	if(Trim(document.RequestInfo.txtEmail.value) == '') {
		strAlert += "- Email is blank and is required. \r\n";
		blnValid = false;
		}	
	else if ((Trim(document.RequestInfo.txtEmail.value)) != (Trim(document.RequestInfo.txtEmailConfirm.value))) {
		strAlert += "- Emails do not match. \r\n";
		blnValid = false;
		}			
	else if (!IsEmail(document.RequestInfo.txtEmail.value)) {
		strAlert += "- Email format invalid.  (ex: email@domain.com) \r\n";
		blnValid = false;
		}	
	
		
	if( (Trim(document.RequestInfo.txtPhone1.value) == '') || (Trim(document.RequestInfo.txtPhone2.value) == '') || (Trim(document.RequestInfo.txtPhone3.value) == '') ) {
		strAlert += "- Phone number is blank and is required. \r\n";
		blnValid = false;
		}
	else if( (!IsNumeric(document.RequestInfo.txtPhone1.value)) || (!IsNumeric(document.RequestInfo.txtPhone2.value)) || (!IsNumeric(document.RequestInfo.txtPhone3.value)) ) {
		strAlert += "- Phone number is not a numeric value. \r\n";
		blnValid = false;
		}
	else if( (document.RequestInfo.txtPhone1.value.length < 3) || (document.RequestInfo.txtPhone2.value.length < 3) || (document.RequestInfo.txtPhone3.value.length < 4) ) {
		strAlert += "- Phone number is not a complete telephone number. \r\n";
		blnValid = false;
		}
		
	//if( (Trim(document.RequestInfo.txtFax1.value) == '') || (Trim(document.RequestInfo.txtFax2.value) == '') || (Trim(document.RequestInfo.txtFax3.value) == '') ) {
	//	strAlert += "- Fax number is blank and is required. \r\n";
	//	blnValid = false;
	//	}
	//else if( (!IsNumeric(document.RequestInfo.txtFax1.value)) || (!IsNumeric(document.RequestInfo.txtFax2.value)) || (!IsNumeric(document.RequestInfo.txtFax3.value)) ) {
	//	strAlert += "- Fax number is not a numeric value. \r\n";
	//	blnValid = false;
	//	}
	//else if( (document.RequestInfo.txtFax1.value.length < 3) || (document.RequestInfo.txtFax2.value.length < 3) || (document.RequestInfo.txtFax3.value.length < 4) ) {
	//	strAlert += "- Fax number is not a complete telephone number. \r\n";
	//	blnValid = false;
	//	}		
	
	// Display message, if necessary
	if(!blnValid) {
		alert(strAlert);
		}
		
	// Allow form to submit or cancel
	return blnValid;
	}	
	
/*---------------------------------------------------------------
ValidateDistributorLitReq() - Form validator
---------------------------------------------------------------*/
function ValidateDistributorLitReq() {
	strAlert = "The following issues need to be corrected before submitting the form: \r\n";
	blnValid = true;
	form = document.DistributorLitReq;
	
	// Check entries on the form that need to be validated
	if(Trim(form.txtName.value) == '') {
		strAlert += "- Name is blank and is required. \r\n";
		blnValid = false;
		}	
	if(Trim(form.txtAddr1.value) == '') {
		strAlert += "- Address is blank and is required. \r\n";
		blnValid = false;
		}
	if(Trim(form.txtCity.value) == '') {
		strAlert += "- City is blank and is required. \r\n";
		blnValid = false;
		}
	if(Trim(form.txtState.value) == '') {
		strAlert += "- State is blank and is required. \r\n";
		blnValid = false;
		}				
	if(Trim(form.txtZipcode.value) == '') {
		strAlert += "- Zipcode is blank and is required. \r\n";
		blnValid = false;
		}		
		
	if(Trim(form.txtEmail.value) == '') {
		strAlert += "- Email is blank and is required. \r\n";
		blnValid = false;
		}	
	else if ((Trim(form.txtEmail.value)) != (Trim(form.txtEmailConfirm.value))) {
		strAlert += "- Emails do not match. \r\n";
		blnValid = false;
		}			
	else if (!IsEmail(form.txtEmail.value)) {
		strAlert += "- Email format invalid.  (ex: email@domain.com) \r\n";
		blnValid = false;
		}	

	if( (Trim(form.txtPhone1.value) == '') || (Trim(form.txtPhone2.value) == '') || (Trim(form.txtPhone3.value) == '') ) {
		strAlert += "- Phone number is blank and is required. \r\n";
		blnValid = false;
		}
	else if( (!IsNumeric(form.txtPhone1.value)) || (!IsNumeric(form.txtPhone2.value)) || (!IsNumeric(form.txtPhone3.value)) ) {
		strAlert += "- Phone number is not a numeric value. \r\n";
		blnValid = false;
		}
	else if( (form.txtPhone1.value.length < 3) || (form.txtPhone2.value.length < 3) || (form.txtPhone3.value.length < 4) ) {
		strAlert += "- Phone number is not a complete telephone number. \r\n";
		blnValid = false;
		}
		
	// Display message, if necessary
	if(!blnValid) {
		alert(strAlert);
		}
		
	// Allow form to submit or cancel
	return blnValid;
	}

function Trim(str) {
   	return str.replace(/^\s*|\s*$/g,"");
	}	
	
function IsEmail(src) {
	var emailReg = "^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$";
	var regex = new RegExp(emailReg);
	return regex.test(src);
	}	
	
function IsNumeric(sText) {
	var ValidChars = "0123456789";
	var IsNumber = true;
	var Char;
	
	for (i = 0; i < sText.length && IsNumber == true; i++) { 
		Char = sText.charAt(i); 
		if (ValidChars.indexOf(Char) == -1) {
			IsNumber = false;
		 	}
		}
	return IsNumber;
	}	


function diagramSelection(selection,txtBox,txtBoxHidden)
{

	txtBox.value = 'You have selected: '+selection ;
	txtBoxHidden.value = selection;

}

//when request forms page is refreshed (or 1st loaded)
//this function sets all select boxes value back to the default value
//this is a Firefox issue (on refresh select boxes not going back to default value)
function initOther()
{
	document.RequestCat.ddlHear.selectedIndex = 0;
	document.RequestCat.ddLDM.selectedIndex = 0;
	document.RequestCat.ddLFM.selectedIndex = 0;
}
function checkSelection(optionHearVal,divTxtShow,divLblShow)
{
	//checks to see if the other option has been selected from a dropdown list
	//if so, displays the please describe if other label and text box 
	//otherwise makes them invisible
	var v;
	if (optionHearVal=='Other')
	{
		v='visible'
	}
	else
	{ 
		v='hidden';
	}
	
	setDivVisibility(divTxtShow,v);
	setDivVisibility(divLblShow,v);
}

function checkState(myCheck,divShow,divSubmit)
{
	if ( myCheck.checked ){
		setDivVisibility(divShow,'hidden');
		setDivVisibility(divSubmit,'visible');
	}
	else
	{
		setDivVisibility(divShow,'visible');
		setDivVisibility(divSubmit,'hidden');	
	}


}

function setDivVisibility(div,v){

	var ns4 = (document.layers)? true:false
	var ie4 = (document.all)? true:false
	var DOM;
	
	if (ns4 || ie4) {
		DOM = 0;
	}else{ 
		if (navigator.userAgent.indexOf("MSIE 4") == -1) { 
			(document.getElementsByTagName("*")) ? (DOM = 1) : (DOM = 0) 
		} 
	}
	
	
	
	  if (ns4) {
		  document.layers[div].visibility = v;
	  }
	  else if (ie4) {
		  document.all[div].style.visibility = v;
	  }
	  else if (DOM) {
		 document.getElementById(div).style.visibility = v;
	  }
}	




/*---------------------------------------------------------------
ValidateRequestQuote() - Form validator
---------------------------------------------------------------*/
function ValidateRequestQuote() {
	strAlert = "The following issues need to be corrected before submitting the form: \r\n";
	blnValid = true;
	
	// Check entries on the form that need to be validated
	// if(Trim(document.RequestCat.txtCompanyName.value) == '') {
	//	strAlert += "- Company name is blank and is required. \r\n";
	//	blnValid = false;
	//	}
	if(Trim(document.RequestCat.txtName.value) == '') {
		strAlert += "- Name is blank and is required. \r\n";
		blnValid = false;
		}
	if(Trim(document.RequestCat.txtAddr1.value) == '') {
		strAlert += "- Address is blank and is required. \r\n";
		blnValid = false;
		}
	if(Trim(document.RequestCat.txtCity.value) == '') {
		strAlert += "- City is blank and is required. \r\n";
		blnValid = false;
		}
	if(Trim(document.RequestCat.txtState.value) == '') {
		strAlert += "- State is blank and is required. \r\n";
		blnValid = false;
		}				
	if(Trim(document.RequestCat.txtZipcode.value) == '') {
		strAlert += "- Zipcode is blank and is required. \r\n";
		blnValid = false;
		}
	if(Trim(document.RequestCat.txtEmail.value) == '') {
		strAlert += "- Email is blank and is required. \r\n";
		blnValid = false;
		}	
	else if ((Trim(document.RequestCat.txtEmail.value)) != (Trim(document.RequestCat.txtEmailConfirm.value))) {
		strAlert += "- Emails do not match. \r\n";
		blnValid = false;
		}			
	else if (!IsEmail(document.RequestCat.txtEmail.value)) {
		strAlert += "- Email format invalid.  (ex: email@domain.com) \r\n";
		blnValid = false;
		}	
		
	if( (Trim(document.RequestCat.txtPhone1.value) == '') || (Trim(document.RequestCat.txtPhone2.value) == '') || (Trim(document.RequestCat.txtPhone3.value) == '') ) {
		strAlert += "- Phone number is blank and is required. \r\n";
		blnValid = false;
		}
	else if( (!IsNumeric(document.RequestCat.txtPhone1.value)) || (!IsNumeric(document.RequestCat.txtPhone2.value)) || (!IsNumeric(document.RequestCat.txtPhone3.value)) ) {
		strAlert += "- Phone number is not a numeric value. \r\n";
		blnValid = false;
		}
	else if( (document.RequestCat.txtPhone1.value.length < 3) || (document.RequestCat.txtPhone2.value.length < 3) || (document.RequestCat.txtPhone3.value.length < 4) ) {
		strAlert += "- Phone number is not a complete telephone number. \r\n";
		blnValid = false;
		}
	
	if( document.RequestCat.ddlHear.options[document.RequestCat.ddlHear.selectedIndex].value == "NONE") {
		strAlert += "- 'How did you hear about us?' Please make a selection. \r\n";
		blnValid = false;
	}
	else if ( document.RequestCat.ddlHear.options[document.RequestCat.ddlHear.selectedIndex].value == "Other" )
	{
		if ( document.RequestCat.txtHearOther.value == ""  )
		{
			strAlert += "- 'How did you hear about us? --Other' - Please be specific in the area provided. \r\n";
			blnValid = false;
		}
	}
	
	if ( document.RequestCat.ddLDM.options[document.RequestCat.ddLDM.selectedIndex].value == "Other" )
	{
		if ( document.RequestCat.txtDM.value == ""  )
		{
			strAlert += "- Please enter the type of  'Other' Door Material in the area provided. \r\n";
			blnValid = false;
		}
	}
	
	if ( document.RequestCat.ddLFM.options[document.RequestCat.ddLFM.selectedIndex].value == "Other" )
	{
		if ( document.RequestCat.txtFM.value == ""  )
		{
			strAlert += "- Please enter the type of  'Other' Floor Material in the area provided. \r\n";
			blnValid = false;
		}
	}
		
	//if( (Trim(document.RequestCat.txtFax1.value) == '') || (Trim(document.RequestCat.txtFax2.value) == '') || (Trim(document.RequestCat.txtFax3.value) == '') ) {
	//	strAlert += "- Fax number is blank and is required. \r\n";
	//	blnValid = false;
	//	}
	//else if( (!IsNumeric(document.RequestCat.txtFax1.value)) || (!IsNumeric(document.RequestCat.txtFax2.value)) || (!IsNumeric(document.RequestCat.txtFax3.value)) ) {
	//	strAlert += "- Fax number is not a numeric value. \r\n";
	//	blnValid = false;
	//	}
	//else if( (document.RequestCat.txtFax1.value.length < 3) || (document.RequestCat.txtFax2.value.length < 3) || (document.RequestCat.txtFax3.value.length < 4) ) {
	//	strAlert += "- Fax number is not a complete telephone number. \r\n";
	//	blnValid = false;
	//	}	
	
	// Display message, if necessary
	if(!blnValid) {
		alert(strAlert);
		}
		
	// Allow form to submit or cancel
	return blnValid;
	}	