
// strType F => for flooring and C => for Carpets
function SelectProductRange(objForm, strType) { 
	var strRangeName = objForm.cboProductRangeName.value;
	
	if ( strRangeName == "Select" ) { 
		alert( "Please select a Range!" ); 
	} else { 
		if(strType == 'F')
			strLocation = "flooring.asp?flor=" + strRangeName; 
		else
			if(strType == 'C') {
				iCatID = objForm.hidCatID.value;
				strLocation = "carpets.asp?cpt=" + strRangeName + "&cptcatid=" + iCatID;
		}
		else
			if(strType == 'A') {
				strLocation = "alice_carpets.asp?cpt=" + strRangeName;
		}
		else
			if(strType == 'R') {
				strLocation = "rugindex.asp?range=" + strRangeName;
		}
		window.location = strLocation; 
	} 
}
function funcCarpetsRedirect(CarpetType)
{
	
	var strCarpet, CarpetID, i;
	if(CarpetType == 1)
	{
		i = document.frmCarpets.cboPlain.selectedIndex;
		strCarpet = document.frmCarpets.cboPlain.options[i].text;
		CarpetID  = document.frmCarpets.cboPlain.value;
	}
	else if(CarpetType == 2)
	{
		i = document.frmCarpets.cboLight.selectedIndex;
		strCarpet = document.frmCarpets.cboLight.options[i].text;
		CarpetID  = document.frmCarpets.cboLight.value;
	}
	else if(CarpetType == 3)
	{
		i = document.frmCarpets.cboHeavy.selectedIndex;
		strCarpet = document.frmCarpets.cboHeavy.options[i].text;
		CarpetID  = document.frmCarpets.cboHeavy.value;
	}
	else if(CarpetType == 4)
	{
		i = document.frmCarpets.cboBerber.selectedIndex;
		strCarpet = document.frmCarpets.cboBerber.options[i].text;
		CarpetID  = document.frmCarpets.cboBerber.value;
	}
	else if(CarpetType == 5)
	{
		i = document.frmCarpets.cboContract.selectedIndex;
		strCarpet = document.frmCarpets.cboContract.options[i].text;
		CarpetID  = document.frmCarpets.cboContract.value;
	}
	 window.location="carpets.asp?cpt="+strCarpet+"&cptcatid="+CarpetID;
}
function theform_Validator(theForm)
{

  if (theForm.txtName.value == "")
  {
    alert("Please enter a value for the \"name\" field.");
    theform.txtName.focus();
    return (false);
  }

  if (theform.txtName.value.length < 3)
  {
    alert("Please enter at least 3 characters in the \"name\" field.");
    theform.txtName.focus();
    return (false);
  }
  if (theform.txtEmail.value == "")
  {
    alert("Please enter a value for the \"email\" field.");
    theform.txtEmail.focus();
    return (false);
  }

  if (theform.txtEmail.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"email\" field.");
    theform.txtEmail.focus();
    return (false);
  }
  if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(theform.txtEmail.value))
  {
     alert("Please enter a valid Email in the \"email\" field.");
    theform.txtEmail.focus();
    return (false);
  }
  
  return (true);
}