//********************************************************************
//*Author:	Paul Zita 
//*Copyright:	Zita Associates Inc.
//*Created:	June 2005
//*Reason:	Created to validate and format Maximizer forms client-
//*		side as the Maximizer CGI and validation scripts are 
//*		easily overcome
//********************************************************************

function junk(){
		
	//	 var valForm = false;
		 re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/
		  
		if (document.mtiform.field_data_Last_Name.value.length<1 || isNaN(document.mtiform.field_data_Last_Name.value) == false){
			alert("Please, enter your last name");
			document.mtiform.field_data_Last_Name.focus();
			document.mtiform.field_data_Last_Name.select();
			return false;
		}

		else if (document.mtiform.field_data_First_Name.value.length<1 || isNaN(document.mtiform.field_data_First_Name.value) == false){
				alert("Please, enter your first name");
				document.mtiform.field_data_First_Name.focus();
				document.mtiform.field_data_First_Name.select();
				return false;
			}

		else if (re.test(document.mtiform.field_data_U_E_mail_Address.value) == false){
				alert("Please, enter your email address")
				document.mtiform.field_data_U_E_mail_Address.focus();
				document.mtiform.field_data_U_E_mail_Address.select();
				return false;
			}
		
		
		else if (document.mtiform.field_data_Company.value.length<1){
			alert("Please, enter your Company name")
			document.mtiform.field_data_Company.focus();
			document.mtiform.field_data_Company.select();
			return false;
		}
		
		else if (document.mtiform.field_data_Address_Line_1.value.length<1){
			alert("Please, enter your address")
			document.mtiform.field_data_Address_Line_1.focus();
			document.mtiform.field_data_Address_Line_1.select();
			return false;
		}
		else if (document.mtiform.field_data_City.value.length<1 || isNaN(document.mtiform.field_data_City.value) == false){
			alert("Please, enter the name of your city")
			document.mtiform.field_data_City.focus();
			document.mtiform.field_data_City.select();
			return false;
		}
		
		else if (document.mtiform.field_data_Country.value=="Country" || document.mtiform.field_data_Country.value=="Other"){
			alert("Please, select a country");
			document.mtiform.field_data_Country.focus();
			document.mtiform.field_data_Country.select();
			return false;
		}
		else if (document.mtiform.field_data_State_Province.disabled==true || document.mtiform.field_data_State_Province.value=="State/Prov" || document.mtiform.field_data_State_Province.value=="" ){
			alert("Please, select a State or Province")
			document.mtiform.field_data_State_Province.focus();
			document.mtiform.field_data_State_Province.select();
			return false;
		}
		else if (document.mtiform.field_data_Zip_Code.value.length<4){
			alert("Please, enter your zip or postal code")
			document.mtiform.field_data_Zip_Code.focus();
			document.mtiform.field_data_Zip_Code.select();
			return false;
		}
		
		
		else if (document.mtiform.field_data_Phone_1.value.length<10){
			alert("Please, enter your phone number with area code")
			document.mtiform.field_data_Phone_1.focus();
			document.mtiform.field_data_Phone_1.select();
			return false;
		}
		
		else if (document.mtiform.field_data_U_Type_of_Business.value.length<1 || isNaN(document.mtiform.field_data_U_Type_of_Business.value) == false){
			alert("Please, enter what type of business you are in")
			document.mtiform.field_data_U_Type_of_Business.focus();
			document.mtiform.field_data_U_Type_of_Business.select();
			return false;
		}
		
		else if (document.mtiform.field_data_U_Marketing.value=="Select One"){
			alert("Please, tell us how you hear about Crown Custom Metal Spinning Inc.");
			document.mtiform.field_data_U_Marketing.focus();
			document.mtiform.field_data_U_Marketing.select();
			return false;
		}
		
//		else if (document.mtiform.prodDescription.value.length<10){
//			alert("Please, enter some information about the product you are interested in")
//			document.mtiform.prodDescription.focus();
//			document.mtiform.prodDescription.select();
//			return false;
//		}
		
		else {
	//	document.forms[0].action = "http://www.crowncookware.ca/cgi-bin/crownCookWare.cgi";
		document.forms[0].action = "http://www.crowncookware.ca/cgi-bin/crownCookWareLinux.pl";
	//	document.forms[0].action = "http://www.zita.ca/crowncookware/crownCookWareWin.pl";
		document.forms[0].submit();
	
	//	valForm = true;

		}

	//	return valForm;

	}
	
 function allCaps() {
 
 	document.mtiform.field_data_Company.value = document.mtiform.field_data_Company.value.toUpperCase();
 	}
 	
 
 function lastName() {
  	
  	var txtEspressione = /^\D/g;
  	var toReplace;
  	var espresso = document.mtiform.field_data_Last_Name.value.toLowerCase();

  	toReplace = espresso.replace(txtEspressione, function(sMatch){ return sMatch.toUpperCase() });
 // 	espresso = toReplace;
  	document.mtiform.field_data_Last_Name.value = toReplace;
  	return;
 	}
 
 function firstName() {
   	
   	var txtEspressione = /^\D/g;
   	var toReplace;
   	var espresso = document.mtiform.field_data_First_Name.value.toLowerCase();

   	toReplace = espresso.replace(txtEspressione, function(sMatch){ return sMatch.toUpperCase() });
   	espresso = toReplace;
   	document.mtiform.field_data_First_Name.value = toReplace;
   	return;
 	}
 
 	
 function addressName() {
    	
    	var txtEspressione = /\s\D/g;
    	var toReplace;
    	var espresso = document.mtiform.field_data_Address_Line_1.value.toLowerCase();
 
    	toReplace = espresso.replace(txtEspressione, function(sMatch){ return sMatch.toUpperCase() });
    	espresso = toReplace;
    	document.mtiform.field_data_Address_Line_1.value = toReplace;
    	return;
  	}
 	
 function cityName() {
    	
    	var txtEspressione = /^\D/g;
    	var toReplace;
    	var espresso = document.mtiform.field_data_City.value.toLowerCase();
 
    	toReplace = espresso.replace(txtEspressione, function(sMatch){ return sMatch.toUpperCase() });
    	espresso = toReplace;
    	document.mtiform.field_data_City.value = toReplace;
    	return;
  	}
 
  function postalCode() {
 
 	document.mtiform.field_data_Zip_Code.value = document.mtiform.field_data_Zip_Code.value.toUpperCase();
 	}
 	
 function typeBusiness() {
     	
     	var txtEspressione = /\s\D/g;
	var txtEspressione2 = /^\D/g;
	var toReplace;
	var espresso = document.mtiform.field_data_U_Type_of_Business.value.toLowerCase();
	 
	toReplace = espresso.replace(txtEspressione, function(sMatch){ return sMatch.toUpperCase() });
	espresso = toReplace;
	toReplace2 = espresso.replace(txtEspressione2, function(sMatch){ return sMatch.toUpperCase() });
	 
	document.mtiform.field_data_U_Type_of_Business.value = toReplace2;
	return;
  	}
 
 