
		function delete_quotation_item()
		{			
			answer = confirm("Are you sure you want to delete this record?");	
			
			if ( answer == null )
			{
				return false;
			}
			
			if ( answer == false )
			{
				return false;
			}
			return true;
		}
		
		
		
		function check_job_application( lang ) {
					
		 if ( document.form1.first_name.value == "" )
			{
				switch( lang )
				{
					case 'en':
						alert("You must enter your first name!");
					break;
				}	
				document.form1.first_name.focus();
				return false;
			}
		
		 if ( document.form1.last_name.value == "" )
			{
				switch( lang )
				{
					case 'en':
						alert("You must enter your last name!");
					break;
				}	
				document.form1.last_name.focus();
				return false;
			}
		
		 if ( document.form1.tel_day.value == "" )
			{
				switch( lang )
				{
					case 'en':
						alert("You must enter your telephone (day)!");
					break;
				}	
				document.form1.tel_day.focus();
				return false;
			}
		
		 if ( document.form1.tel_evening.value == "" )
			{
				switch( lang )
				{
					case 'en':
						alert("You must enter your telephone (evening)!");
					break;
				}	
				document.form1.tel_evening.focus();
				return false;
			}
		/*
		 if ( document.form1.cell.value == "" )
			{
				switch( lang )
				{
					case 'en':
						alert("You must enter your cellular number!");
					break;
				}	
				document.form1.cell.focus();
				return false;
			}
		*/
		 if ( document.form1.email.value == "" )
			{
				switch( lang )
				{
					case 'en':
						alert("You must enter your E-Mail!");
					break;
				}	
				document.form1.email.focus();
				return false;
			}
			if ( document.form1.resume_text.value == "" )
			{
				switch( lang )
				{
					case 'en':
						alert("You must attach your resume!");
					break;
				}	
				return false;
			}
			
			alert("Your job application has been sent to caristrap!");
			return true;
		}
		
		
		
  function check_rma_request( lang )
	 {
		
		 if ( document.frm_dealer_application.cust_number.value == "" )
			{
				switch( lang )
				{
					case 'en':
						alert("You must enter your customer number!");
					break;
				}	
				document.frm_dealer_application.cust_number.focus();
				return false;
			}
			
			
		 if ( document.frm_dealer_application.company_name.value == "" )
			{
				switch( lang )
				{
					case 'en':
						alert("You must enter your company name!");
					break;
				}	
				document.frm_dealer_application.company_name.focus();
				return false;
			}
			
			if ( document.frm_dealer_application.contact_person.value == "" )
			{
				switch( lang )
				{
					case 'en':
						alert("You must enter the contact person!");
					break;
				}	
				document.frm_dealer_application.contact_person.focus();
				return false;
			}
						
			if ( document.frm_dealer_application.phone.value == "" )
			{
				switch( lang )
				{
					case 'en':
						alert("You must enter the contact phone!");
					break;
				}	
				document.frm_dealer_application.phone.focus();
				return false;
			}
						

			if ( document.frm_dealer_application.email.value == "" )
			{
				switch( lang )
				{
					case 'en':
						alert("You must enter the contact email!");
					break;
				}	
				document.frm_dealer_application.email.focus();
				return false;
			}
						
			if ( document.frm_dealer_application.product_1.value == "" )
			{
				switch( lang )
				{
					case 'en':
						alert("You must enter the product being returned!");
					break;
				}	
				document.frm_dealer_application.product_1.focus();
				return false;
			}	
			if ( document.frm_dealer_application.serial_1.value == "" )
			{
				switch( lang )
				{
					case 'en':
						alert("You must enter the serial being returned!");
					break;
				}	
				document.frm_dealer_application.serial_1.focus();
				return false;
			}
						
			switch( lang )
			{
				case 'en':
					alert("Your RMA Request has been sent!");
				break;
			}	

   return true;
																															
		}
		
		
		
    function addQuotation( lang, item_display )
				{
					
					var inputs = document.getElementsByTagName("input");
					var i;
					var enter = false;
					for( i = 0; i < inputs.length; i++ )	{
						if ( inputs[i].name.indexOf( "qty" ) != -1 ) {
							if ( inputs[i].value != "" ) {
								enter = true;
								break;
							}
						}
					}
					
					if ( enter )	{
						
						switch( lang )
						{
							case 'en':
								alert("Your items are added to the system!");
							break;
						}					
						document.frm_items.action.value='add';			
						document.frm_items.item_display.value=item_display;			
						return true;
					} else {
						switch( lang )
						{
							case 'en':
								alert("You must enter at least one quantity to add!");
							break;
						}	
						return false;
					}
    }


    function modifyQuotation( lang )
				{
					
					var inputs = document.getElementsByTagName("input");
					var i;
					var empty = false;
					for( i = 0; i < inputs.length; i++ )	{
						if ( inputs[i].name.indexOf( "qty" ) != -1 ) {
							if ( inputs[i].value == "" ) {
								empty = true;
								break;
							}
						}
					}
					
					if ( !empty )	{
						
						switch( lang )
						{
							case 'en':
								alert("Your modifications have been saved!");
							break;
						}					
						document.frm_quotation.action.value='modify';			
						document.frm_quotation.item_display.value='modify';			
						return true;
					} else {
						switch( lang )
						{
							case 'en':
								alert("All the quantities must be entered!");
							break;
						}	
						return false;
					}
    }


    function save_item( )
				{
					
					switch( lang )
					{
						case 'en':
						break;
					}					
					document.all.action.value='save';			
					return true;
				}



    function sendQuotation( lang, item_display  )
				{
					
					switch( lang )
					{
						case 'en':
						break;
					}					
					document.all.action.value='send';			
					document.frm_items.item_display.value=item_display;
				}




    function viewQuotation( lang, item_display  )
				{
					
					switch( lang )
					{
						case 'en':
						break;
					}					
					document.all.action.value='view';		
					document.frm_items.item_display.value=item_display;	
				}


    function check_public_quotation( lang )
				{		
				
				 if ( document.frm_public_info.company_name.value == "" )
					{
						alert("You must enter the Company Name!");
						document.frm_public_info.company_name.focus();
						return false;
					}		
					
				 if ( document.frm_public_info.first_name.value == "" )
					{
						alert("You must enter the First Name!");
						document.frm_public_info.first_name.focus();
						return false;
					}		
					
				 if ( document.frm_public_info.last_name.value == "" )
					{
						alert("You must enter the Last Name!");
						document.frm_public_info.last_name.focus();
						return false;
					}	
					
				 if ( document.frm_public_info.tel.value == "" )
					{
						alert("You must enter the Telephone Number!");
						document.frm_public_info.tel.focus();
						return false;
					}		
					
					
				 if ( document.frm_public_info.email.value == "" )
					{
						alert("You must enter the Email Address!");
						document.frm_public_info.email.focus();
						return false;
					}		
					
				 if ( document.frm_public_info.address_1.value == "" )
					{
						alert("You must enter the Address!");
						document.frm_public_info.address_1.focus();
						return false;
					}		
					
					
					if ( document.frm_public_info.country.value == "" )
					{
							alert("You must choose a Country!");
							document.frm_public_info.country.focus();
							return false;
					}
					
					if ( document.frm_public_info.state.options.length > 2 )
					{
						if ( document.frm_public_info.state.value == "" )
						{
							alert("You must enter the Province!");
							document.frm_public_info.state.focus();
							return false;
						}	
					}
					
					
				 if ( document.frm_public_info.zipcode.value == "" )
					{
						alert("You must enter the Zipcode!");
						document.frm_public_info.zipcode.focus();
						return false;
					}		
					
					if ( document.frm_public_info.zipcode.value != "" )
							{
								if ( document.frm_public_info.country.value == "CA" ) {
									var findexp_1 = /^([ABCEGHJKLMNPRSTVXYabceghjklmnprstvxy]\d[ABCEGHJKLMNPRSTVWXYZabceghjklmnprstvxy])\s{0,1}(\d[ABCEGHJKLMNPRSTVWXYZabceghjklmnprstvxy]\d)$/;
									var result = findexp_1.test(document.frm_public_info.zipcode.value);
									if ( result == false ) {
										alert("The Postal Code must be of Canadian format!");
										document.frm_public_info.zipcode.focus();
										return false;
									}
								}
								
								if ( document.frm_public_info.zipcode.value == "US" ) {
									var findexp_1 = /(^(?!0{5})(\d{5})(?!-?0{4})(-?\d{4})?$)/;
									var result = findexp_1.test(document.frm_public_info.zipcode.value);
									if ( result == false ) {
										alert("The Postal Code must be of US format!");
										document.frm_public_info.zipcode.focus();
										return false;
									}
								}
							}	
					
			
					
					alert("Your Quotation Request has been sent. Thank you!");
					document.frm_public_info.save.value = '1';
					return true;
				
				}




    function dealer_check_step1( lang )
				{
					var go_to_next = true;
					if ( document.frm_dealer_application.company_name.value == "" )
					{
						alert("You must enter the Company Name!");
						document.frm_dealer_application.company_name.focus();
						go_to_next = false;
					}
					
					if ( document.frm_dealer_application.business_type.value == "" && go_to_next)
					{
						alert("You must enter the business type!");
						document.frm_dealer_application.business_type.focus();
						go_to_next = false;
					}
					
					if ( document.frm_dealer_application.billing_email.value == "" && go_to_next)
					{
						alert("You must enter an Email Address!");
						document.frm_dealer_application.billing_email.focus();
						go_to_next = false;
					}
					
					if ( document.frm_dealer_application.billing_contact.value == "" && go_to_next )
					{
						alert("You must enter a Contact!");
						document.frm_dealer_application.billing_contact.focus();
						go_to_next = false;
					}
					
					if ( document.frm_dealer_application.billing_tel.value == "" && go_to_next )
					{
						alert("You must enter a Contact Phone Number!");
						document.frm_dealer_application.billing_tel.focus();
						go_to_next = false;
					}
					
					if ( document.frm_dealer_application.billing_fax.value == "" && go_to_next )
					{
						alert("You must enter a Contact Fax Number!");
						document.frm_dealer_application.billing_fax.focus();
						go_to_next = false;
					}
					/*
					if ( document.frm_dealer_application.account_contact.value == "" && go_to_next )
					{
						alert("You must enter a Accounting Manager!");
						document.frm_dealer_application.account_contact.focus();
						go_to_next = false;
					}
					
					if ( document.frm_dealer_application.account_tel.value == "" && go_to_next )
					{
						alert("You must enter a Accounting Manager Phone Number!");
						document.frm_dealer_application.account_tel.focus();
						go_to_next = false;
					}
					
					if ( document.frm_dealer_application.account_fax.value == "" && go_to_next )
					{
						alert("You must enter a Accounting Manager Fax Number!");
						document.frm_dealer_application.account_fax.focus();
						go_to_next = false;
					}
					
					if ( document.frm_dealer_application.purchase_contact.value == "" && go_to_next )
					{
						alert("You must enter a Purchasing Agent!");
						document.frm_dealer_application.purchase_contact.focus();
						go_to_next = false;
					}
					
					if ( document.frm_dealer_application.purchase_tel.value == "" && go_to_next )
					{
						alert("You must enter a Purchasing Agent Phone Number!");
						document.frm_dealer_application.purchase_tel.focus();
						go_to_next = false;
					}
					
					if ( document.frm_dealer_application.purchase_fax.value == "" && go_to_next )
					{
						alert("You must enter a Purchasing Agent Fax Number!");
						document.frm_dealer_application.purchase_fax.focus();
						go_to_next = false;
					}
					*/
					
					if ( go_to_next ) {
					 document.getElementById('step1').style.display='none';
					 document.getElementById('step2').style.display='';
					}
				}
				
				
				
				function dealer_check_step2( lang )
				{
					var go_to_next = true;
					if ( document.frm_dealer_application.billing_address_1.value == "" )
					{
						alert("You must enter the Billing Address!");
						document.frm_dealer_application.billing_address_1.focus();
						go_to_next =  false;
					}				
				 					
					if ( document.frm_dealer_application.billing_city.value == "" && go_to_next )
					{
						alert("You must enter the Billing City!");
						document.frm_dealer_application.billing_city.focus();
						go_to_next =  false;
					}				
					
					if ( document.frm_dealer_application.billing_country.value == "" && go_to_next )
					{
						alert("You must enter the Billing Country!");
						document.frm_dealer_application.billing_country.focus();
						go_to_next =  false;
					}	
					
					if ( document.frm_dealer_application.billing_state.options.length > 2 && go_to_next )
					{
						if ( document.frm_dealer_application.billing_state.value == "" )
						{
							alert("You must enter the Billing Province!");
							document.frm_dealer_application.billing_state.focus();
							go_to_next =  false;
						}	
					}
										
					if ( document.frm_dealer_application.billing_zipcode.value == "" && go_to_next )
					{
						alert("You must enter the Billing Postal Code!");
						document.frm_dealer_application.billing_zipcode.focus();
						go_to_next =  false;
					}	
					
					if ( document.frm_dealer_application.billing_zipcode.value != "" && go_to_next )
							{
								if ( document.frm_dealer_application.billing_country.value == "CA" ) {
									var findexp_1 = /^([ABCEGHJKLMNPRSTVXYabceghjklmnprstvxy]\d[ABCEGHJKLMNPRSTVWXYZabceghjklmnprstvxy])\s{0,1}(\d[ABCEGHJKLMNPRSTVWXYZabceghjklmnprstvxy]\d)$/;
									var result = findexp_1.test(document.frm_dealer_application.billing_zipcode.value);
									if ( result == false ) {
										alert("The Billing Postal Code must be of Canadian format!");
										document.frm_dealer_application.billing_zipcode.focus();
										go_to_next =  false;
									}
								}
								
								if ( document.frm_dealer_application.billing_country.value == "US" ) {
									var findexp_1 = /(^(?!0{5})(\d{5})(?!-?0{4})(-?\d{4})?$)/;
									var result = findexp_1.test(document.frm_dealer_application.billing_zipcode.value);
									if ( result == false ) {
										alert("The Billing Postal Code must be of US format!");
										document.frm_dealer_application.billing_zipcode.focus();
										go_to_next =  false;
									}
								}
							}	
					
					
					if ( !document.frm_dealer_application.chk_payment.checked ) {
						
							if ( document.frm_dealer_application.payment_address_1.value == ""  && go_to_next )
							{
								alert("You must enter the Payment Address!");
								document.frm_dealer_application.payment_address_1.focus();
								go_to_next =  false;
							}				
												
							if ( document.frm_dealer_application.payment_city.value == "" && go_to_next )
							{
								alert("You must enter the Payment City!");
								document.frm_dealer_application.payment_city.focus();
								go_to_next =  false;
							}				
							
							if ( document.frm_dealer_application.payment_country.value == "" && go_to_next )
							{
								alert("You must enter the Payment Country!");
								document.frm_dealer_application.payment_country.focus();
								go_to_next =  false;
							}	
							
							if ( document.frm_dealer_application.payment_state.options.length > 2 && go_to_next )
							{
								if ( document.frm_dealer_application.payment_state.value == "" )
								{
									alert("You must enter the Payment Province!");
									document.frm_dealer_application.payment_state.focus();
									go_to_next =  false;
								}	
							}
												
							if ( document.frm_dealer_application.payment_zipcode.value == "" && go_to_next )
							{
								alert("You must enter the Payment Postal Code!");
								document.frm_dealer_application.payment_zipcode.focus();
								go_to_next =  false;
							}	
							
							if ( document.frm_dealer_application.payment_zipcode.value != "" && go_to_next )
							{
								if ( document.frm_dealer_application.payment_country.value == "CA" ) {
									var findexp_1 = /^([ABCEGHJKLMNPRSTVXYabceghjklmnprstvxy]\d[ABCEGHJKLMNPRSTVWXYZabceghjklmnprstvxy])\s{0,1}(\d[ABCEGHJKLMNPRSTVWXYZabceghjklmnprstvxy]\d)$/;
									var result = findexp_1.test(document.frm_dealer_application.payment_zipcode.value);
									if ( result == false ) {
										alert("The Payment Postal Code must be of Canadian format!");
										document.frm_dealer_application.payment_zipcode.focus();
										go_to_next =  false;
									}
								}
								
								
								if ( document.frm_dealer_application.payment_country.value == "US" ) {
									var findexp_1 = /(^(?!0{5})(\d{5})(?!-?0{4})(-?\d{4})?$)/;
									var result = findexp_1.test(document.frm_dealer_application.payment_zipcode.value);
									if ( result == false ) {
										alert("The Payment Postal Code must be of US format!");
										document.frm_dealer_application.payment_zipcode.focus();
										go_to_next =  false;
									}
								}
							}	
						
						
					}
					
					
						if ( !document.frm_dealer_application.chk_shipping.checked ) {
						
							if ( document.frm_dealer_application.shipping_address_1.value == "" && go_to_next)
							{
								alert("You must enter the Shipping Address!");
								document.frm_dealer_application.shipping_address_1.focus();
								go_to_next =  false;
							}				
												
							if ( document.frm_dealer_application.shipping_city.value == "" && go_to_next )
							{
								alert("You must enter the Shipping City!");
								document.frm_dealer_application.shipping_city.focus();
								go_to_next =  false;
							}				
							
							if ( document.frm_dealer_application.shipping_country.value == "" && go_to_next )
							{
								alert("You must enter the Shipping Country!");
								document.frm_dealer_application.shipping_country.focus();
								go_to_next =  false;
							}	
							
							if ( document.frm_dealer_application.shipping_state.options.length > 2 && go_to_next )
							{
								if ( document.frm_dealer_application.shipping_state.value == "" )
								{
									alert("You must enter the Shipping Province!");
									document.frm_dealer_application.shipping_state.focus();
									go_to_next =  false;
								}	
							}
												
							if ( document.frm_dealer_application.shipping_zipcode.value == "" && go_to_next )
							{
								alert("You must enter the Shipping Postal Code!");
								document.frm_dealer_application.shipping_zipcode.focus();
								go_to_next =  false;
							}
							
							if ( document.frm_dealer_application.shipping_zipcode.value != "" && go_to_next )
							{
								if ( document.frm_dealer_application.shipping_country.value == "CA" ) {
									var findexp_1 = /^([ABCEGHJKLMNPRSTVXYabceghjklmnprstvxy]\d[ABCEGHJKLMNPRSTVWXYZabceghjklmnprstvxy])\s{0,1}(\d[ABCEGHJKLMNPRSTVWXYZabceghjklmnprstvxy]\d)$/;
									var result = findexp_1.test(document.frm_dealer_application.shipping_zipcode.value);
									if ( result == false ) {
										alert("The Shipping Postal Code must be of Canadian format!");
										document.frm_dealer_application.shipping_zipcode.focus();
										go_to_next =  false;
									}
								}
								
								
								if ( document.frm_dealer_application.shipping_zipcode.value == "US" ) {
									var findexp_1 = /(^(?!0{5})(\d{5})(?!-?0{4})(-?\d{4})?$)/;
									var result = findexp_1.test(document.frm_dealer_application.shipping_country.value);
									if ( result == false ) {
										alert("The Shipping Postal Code must be of US format!");
										document.frm_dealer_application.shipping_zipcode.focus();
										go_to_next =  false;
									}
								}
							}	
							
					}
					
					if ( go_to_next ) {
					 document.getElementById('step2').style.display='none';
					 document.getElementById('step3').style.display='';
					}
				}
				
				
				function dealer_check_step3( lang )
				{
					
					var go_to_next = true;
					
					if ( document.frm_dealer_application.bank_name.value == "" && go_to_next )
					{
						alert("You must enter the Bank Name!");
						document.frm_dealer_application.bank_name.focus();
						go_to_next =  false;
					}
					
					if ( document.frm_dealer_application.bank_address.value == "" && go_to_next )
					{
						alert("You must enter the Bank Address!");
						document.frm_dealer_application.bank_address.focus();
						go_to_next =  false;
					}
					
					if ( document.frm_dealer_application.bank_contact.value == "" && go_to_next )
					{
						alert("You must enter the Bank Contact!");
						document.frm_dealer_application.bank_contact.focus();
						go_to_next =  false;
					}
					
					if ( document.frm_dealer_application.bank_tel.value == "" && go_to_next )
					{
						alert("You must enter the Bank Phone Number!");
						document.frm_dealer_application.bank_tel.focus();
						go_to_next =  false;
					}
					
					if ( document.frm_dealer_application.bank_fax.value == "" && go_to_next )
					{
						alert("You must enter the Bank Fax Number!");
						document.frm_dealer_application.bank_fax.focus();
						go_to_next =  false;
					}
					
					if ( document.frm_dealer_application.trade_name_1.value == "" && go_to_next )
					{
						alert("You must enter the Trade Reference 1 Name!");
						document.frm_dealer_application.trade_name_1.focus();
						go_to_next =  false;
					}
					
					if ( document.frm_dealer_application.trade_address_1.value == "" && go_to_next )
					{
						alert("You must enter the Trade Reference 1 Address!");
						document.frm_dealer_application.trade_address_1.focus();
						go_to_next =  false;
					}
					
					if ( document.frm_dealer_application.trade_contact_1.value == "" && go_to_next )
					{
						alert("You must enter the Trade Reference 1 Contact!");
						document.frm_dealer_application.trade_contact_1.focus();
						go_to_next =  false;
					}
					
					if ( document.frm_dealer_application.trade_tel_1.value == "" && go_to_next )
					{
						alert("You must enter the Trade Reference 1 Phone Number!");
						document.frm_dealer_application.trade_tel_1.focus();
						go_to_next =  false;
					}
					
					if ( document.frm_dealer_application.trade_fax_1.value == "" && go_to_next )
					{
						alert("You must enter the Trade Reference 1 Fax Number!");
						document.frm_dealer_application.trade_fax_1.focus();
						go_to_next =  false;
					}
										
					
					if ( document.frm_dealer_application.trade_name_2.value == "" && go_to_next )
					{
						alert("You must enter the Trade Reference 2 Name!");
						document.frm_dealer_application.trade_name_2.focus();
						go_to_next =  false;
					}
					
					if ( document.frm_dealer_application.trade_address_2.value == "" && go_to_next )
					{
						alert("You must enter the Trade Reference 2 Address!");
						document.frm_dealer_application.trade_address_2.focus();
						go_to_next =  false;
					}
					
					if ( document.frm_dealer_application.trade_contact_2.value == "" && go_to_next )
					{
						alert("You must enter the Trade Reference 2 Contact!");
						document.frm_dealer_application.trade_contact_2.focus();
						go_to_next =  false;
					}
					
					if ( document.frm_dealer_application.trade_tel_2.value == "" && go_to_next )
					{
						alert("You must enter the Trade Reference 2 Phone Number!");
						document.frm_dealer_application.trade_tel_2.focus();
						go_to_next =  false;
					}
					
					if ( document.frm_dealer_application.trade_fax_2.value == "" && go_to_next )
					{
						alert("You must enter the Trade Reference 2 Fax Number!");
						document.frm_dealer_application.trade_fax_2.focus();
						go_to_next =  false;
					}
					
					
					
					if ( document.frm_dealer_application.trade_name_3.value == "" && go_to_next )
					{
						alert("You must enter the Trade Reference 3 Name!");
						document.frm_dealer_application.trade_name_3.focus();
						go_to_next =  false;
					}
					
					if ( document.frm_dealer_application.trade_address_3.value == "" && go_to_next )
					{
						alert("You must enter the Trade Reference 3 Address!");
						document.frm_dealer_application.trade_address_3.focus();
						go_to_next =  false;
					}
					
					if ( document.frm_dealer_application.trade_contact_3.value == "" && go_to_next )
					{
						alert("You must enter the Trade Reference 3 Contact!");
						document.frm_dealer_application.trade_contact_3.focus();
						go_to_next =  false;
					}
					
					if ( document.frm_dealer_application.trade_tel_3.value == "" && go_to_next )
					{
						alert("You must enter the Trade Reference 3 Phone Number!");
						document.frm_dealer_application.trade_tel_3.focus();
						go_to_next =  false;
					}
					
					if ( document.frm_dealer_application.trade_fax_3.value == "" && go_to_next )
					{
						alert("You must enter the Trade Reference 3 Fax Number!");
						document.frm_dealer_application.trade_fax_3.focus();
						go_to_next =  false;
					}
					
					if ( go_to_next ) {
					 document.getElementById('step3').style.display='none';
					 document.getElementById('step4').style.display='';
					}
				}
				
				
    
				function dealer_check_step4( lang )
				{					
					
		 		if ( document.frm_dealer_application.acc_name.value == "" )
					{
						alert("You must enter an account name!");
						document.frm_dealer_application.acc_name.focus();
						return false;
					}
					
					if ( document.frm_dealer_application.acc_name.value.length < 6 || document.frm_dealer_application.acc_name.value.length > 20 )
					{
						alert("The account name must be between 6 and 20 characters!!");
						document.frm_dealer_application.acc_name.focus();
						return false;
					}
					
		 		if ( document.frm_dealer_application.unique_acc_name.value == "" )
					{
						alert("The account name is not available, please enter a new account name!");
						document.frm_dealer_application.acc_name.focus();
						return false;
					}
					
					
		 		if ( document.frm_dealer_application.acc_pwd.value == "" )
					{
						alert("You must enter an account password!");
						document.frm_dealer_application.acc_pwd.focus();
						return false;
					}
					
					if ( document.frm_dealer_application.acc_pwd.value.length < 6 || document.frm_dealer_application.acc_pwd.value.length > 20 )
					{
						alert("The account password must be between 6 and 20 characters!!");
						document.frm_dealer_application.acc_pwd.focus();
						return false;
					}
					
		 		if ( document.frm_dealer_application.retype_pwd.value == "" )
					{
						alert("You must re-type then account password!");
						document.frm_dealer_application.retype_pwd.focus();
						return false;
					}
					
					
		 		if ( document.frm_dealer_application.retype_pwd.value != document.frm_dealer_application.acc_pwd.value )
					{
						alert("The password you re-typed is not identical to the account password!");
						document.frm_dealer_application.retype_pwd.focus();
						return false;
					}
					
					alert("Your Dealer Application has been sent!");
					document.frm_dealer_application.save.value='1';
				 return true;
				}
    
				
				
				function dealer_back_step1()
				{
					
					document.getElementById('step2').style.display='none';
					document.getElementById('step1').style.display='';
				}
				function dealer_back_step2()
				{
					
					document.getElementById('step3').style.display='none';
					document.getElementById('step2').style.display='';
				}
				function dealer_back_step3()
				{
					
					document.getElementById('step4').style.display='none';
					document.getElementById('step3').style.display='';
				}



		
		
		  
	
		
		
		
		
		
  		function check_dealer_profile( lang )
				{	
					
					/*
		 		if ( document.frm_dealer_application.acc_name.value == "" )
					{
						alert("You must enter an account name!");
						document.frm_dealer_application.acc_name.focus();
						return false;
					}
					
		 		if ( document.frm_dealer_application.unique_acc_name.value == "" )
					{
						alert("The account name is not available, please enter a new account name!");
						document.frm_dealer_application.acc_name.focus();
						return false;
					}
					
		 		if ( document.frm_dealer_application.acc_name.value.length < 6 )
					{
						alert("The account name must be between 6 and 20 characters!");
						document.frm_dealer_application.acc_name.focus();
						return false;
					}
					
					
		 		if ( document.frm_dealer_application.acc_pwd.value == "" )
					{
						alert("You must enter an account password!");
						document.frm_dealer_application.acc_pwd.focus();
						return false;
					}
					
					
		 		if ( document.frm_dealer_application.acc_pwd.value.length < 6 )
					{
						alert("The account name must be between 6 and 20 characters!");
						document.frm_dealer_application.acc_pwd.focus();
						return false;
					}
					
		 		if ( document.frm_dealer_application.retype_pwd.value == "" )
					{
						alert("You must re-type then account password!");
						document.frm_dealer_application.retype_pwd.focus();
						return false;
					}
					
					
		 		if ( document.frm_dealer_application.retype_pwd.value != document.frm_dealer_application.acc_pwd.value )
					{
						alert("The password you re-typed is not identical to the account password!");
						document.frm_dealer_application.retype_pwd.focus();
						return false;
					}
					*/
					document.frm_dealer_application.save.value='1';
				 return true;
				}
    
		
		
		
		
		
		function dealer_login( lang )
		{
			if ( document.frm_dealer_login.username.value == "" )
			{
				document.frm_dealer_login.username.focus();
				return false;
			}
			if ( document.frm_dealer_login.userpwd.value == "" )
			{
				document.frm_dealer_login.userpwd.focus();
				return false;
			}
			return true;
		}
		
		
		
		
		
		function verify_item()
		{			
			
			document.form1.save.value ='1';
		}
		
		
		
			function verify_cms_dealer()
		{			
			var go_to_next = true;
					if ( document.form1.company_name.value == "" )
					{
						alert("You must enter the Company Name!");
						document.form1.company_name.focus();
						return false;
					}
					
					if ( document.form1.business_type.value == "")
					{
						alert("You must enter the business type!");
						document.form1.business_type.focus();
						return false;
					}
					
					if ( document.form1.billing_email.value == "")
					{
						alert("You must enter an Email Address!");
						document.form1.billing_email.focus();
						return false;
					}
					
					if ( document.form1.billing_contact.value == "" )
					{
						alert("You must enter a Contact!");
						document.form1.billing_contact.focus();
						return false;
					}
					
					if ( document.form1.billing_tel.value == "")
					{
						alert("You must enter a Contact Phone Number!");
						document.form1.billing_tel.focus();
						return false;
					}
					
					if ( document.form1.billing_fax.value == "" )
					{
						alert("You must enter a Contact Fax Number!");
						document.form1.billing_fax.focus();
						return false;
					}
     if ( document.form1.billing_address_1.value == "")
					{
						alert("You must enter the Billing Address!");
						document.form1.billing_address_1.focus();
						return  false;
					}				
				 					
					if ( document.form1.billing_city.value == "" )
					{
						alert("You must enter the Billing City!");
						document.form1.billing_city.focus();
						return  false;
					}				
					
					if ( document.form1.billing_country.value == "" )
					{
						alert("You must enter the Billing Country!");
						document.form1.billing_country.focus();
						return  false;
					}	
					
					if ( document.form1.billing_state.options.length > 2 )
					{
						if ( document.form1.billing_state.value == "" )
						{
							alert("You must enter the Billing Province!");
							document.form1.billing_state.focus();
							return false;
						}	
					}
										
					if ( document.form1.billing_zipcode.value == "" )
					{
						alert("You must enter the Billing Postal Code!");
						document.form1.billing_zipcode.focus();
						return  false;
					}	
					
				/*	if ( document.form1.payment_address_1.value == "" )
					{
						alert("You must enter the Payment Address!");
						document.form1.payment_address_1.focus();
						return  false;
					}				
										
					if ( document.form1.payment_city.value == "" )
					{
						alert("You must enter the Payment City!");
						document.form1.payment_city.focus();
						return  false;
					}				
					
					if ( document.form1.payment_country.value == "" )
					{
						alert("You must enter the Payment Country!");
						document.form1.payment_country.focus();
						return  false;
					}	
					
					if ( document.form1.payment_state.options.length > 2 )
					{
						if ( document.form1.payment_state.value == "" )
						{
							alert("You must enter the Payment Province!");
							document.form1.payment_state.focus();
							return  false;
						}	
					}
										
					if ( document.form1.payment_zipcode.value == "" )
					{
						alert("You must enter the Payment Postal Code!");
						document.form1.payment_zipcode.focus();
						return  false;
					}	
						
						
					
			
			
					if ( document.form1.shipping_address_1.value == "")
					{
						alert("You must enter the Shipping Address!");
						document.form1.shipping_address_1.focus();
						return false;
					}				
										
					if ( document.form1.shipping_city.value == ""  )
					{
						alert("You must enter the Shipping City!");
						document.form1.shipping_city.focus();
						return false;
					}				
					
					if ( document.form1.shipping_country.value == ""  )
					{
						alert("You must enter the Shipping Country!");
						document.form1.shipping_country.focus();
						return false;
					}	
					
					if ( document.form1.shipping_state.options.length > 2  )
					{
						if ( document.form1.shipping_state.value == "" )
						{
							alert("You must enter the Shipping Province!");
							document.form1.shipping_state.focus();
							return false;
						}	
					}
										
					if ( document.form1.shipping_zipcode.value == ""  )
					{
						alert("You must enter the Shipping Postal Code!");
						document.form1.shipping_zipcode.focus();
						return false;
					}
												*/
  
     if ( document.form1.bank_name.value == "" )
					{
						alert("You must enter the Bank Name!");
						document.form1.bank_name.focus();
						return false;
					}
					
					if ( document.form1.bank_address.value == "" )
					{
						alert("You must enter the Bank Address!");
						document.form1.bank_address.focus();
						return false;
					}
					
					if ( document.form1.bank_contact.value == "" )
					{
						alert("You must enter the Bank Contact!");
						document.form1.bank_contact.focus();
						return false;
					}
					
					if ( document.form1.bank_tel.value == "" )
					{
						alert("You must enter the Bank Phone Number!");
						document.form1.bank_tel.focus();
						return false;
					}
					
					if ( document.form1.bank_fax.value == "" )
					{
						alert("You must enter the Bank Fax Number!");
						document.form1.bank_fax.focus();
						return false;
					}
					
					if ( document.form1.trade_name_1.value == "" )
					{
						alert("You must enter the Trade Reference 1 Name!");
						document.form1.trade_name_1.focus();
						return false;
					}
					
					if ( document.form1.trade_address_1.value == "" )
					{
						alert("You must enter the Trade Reference 1 Address!");
						document.form1.trade_address_1.focus();
						return false;
					}
					
					if ( document.form1.trade_contact_1.value == "" )
					{
						alert("You must enter the Trade Reference 1 Contact!");
						document.form1.trade_contact_1.focus();
						return false;
					}
					
					if ( document.form1.trade_tel_1.value == "" )
					{
						alert("You must enter the Trade Reference 1 Phone Number!");
						document.form1.trade_tel_1.focus();
						return false;
					}
					
					if ( document.form1.trade_fax_1.value == "" )
					{
						alert("You must enter the Trade Reference 1 Fax Number!");
						document.form1.trade_fax_1.focus();
						return false;
					}
										
					
					if ( document.form1.trade_name_2.value == ""  )
					{
						alert("You must enter the Trade Reference 2 Name!");
						document.form1.trade_name_2.focus();
						return false;
					}
					
					if ( document.form1.trade_address_2.value == ""  )
					{
						alert("You must enter the Trade Reference 2 Address!");
						document.form1.trade_address_2.focus();
						return false;
					}
					
					if ( document.form1.trade_contact_2.value == "" )
					{
						alert("You must enter the Trade Reference 2 Contact!");
						document.form1.trade_contact_2.focus();
						return false;
					}
					
					if ( document.form1.trade_tel_2.value == "" )
					{
						alert("You must enter the Trade Reference 2 Phone Number!");
						document.form1.trade_tel_2.focus();
						return false;
					}
					
					if ( document.form1.trade_fax_2.value == "" )
					{
						alert("You must enter the Trade Reference 2 Fax Number!");
						document.form1.trade_fax_2.focus();
						return false;
					}
					
					
					
					if ( document.form1.trade_name_3.value == "" )
					{
						alert("You must enter the Trade Reference 3 Name!");
						document.form1.trade_name_3.focus();
						return false;
					}
					
					if ( document.form1.trade_address_3.value == ""  )
					{
						alert("You must enter the Trade Reference 3 Address!");
						document.form1.trade_address_3.focus();
						go_to_next =  false;
					}
					
					if ( document.form1.trade_contact_3.value == ""  )
					{
						alert("You must enter the Trade Reference 3 Contact!");
						document.form1.trade_contact_3.focus();
						go_to_next =  false;
					}
					
					if ( document.form1.trade_tel_3.value == ""  )
					{
						alert("You must enter the Trade Reference 3 Phone Number!");
						document.form1.trade_tel_3.focus();
						go_to_next =  false;
					}
					
					if ( document.form1.trade_fax_3.value == ""  )
					{
						alert("You must enter the Trade Reference 3 Fax Number!");
						document.form1.trade_fax_3.focus();
						go_to_next =  false;
					}
					
	    if ( document.form1.acc_name.value == ""  )
					{
						alert("You must enter an account name!");
						document.form1.acc_name.focus();
						return false;
					}
					
					if ( document.form1.acc_name.value.length < 6 || document.form1.acc_name.value.length > 20 )
					{
						alert("The account name must be between 6 and 20 characters!!");
						document.form1.acc_name.focus();
						return false;
					}
		
					
		 		if ( document.form1.acc_pwd.value == "" )
					{
						alert("You must enter an account password!");
						document.form1.acc_pwd.focus();
						return false;
					}
					
					if ( document.form1.acc_pwd.value.length < 6 || document.form1.acc_pwd.value.length > 20 )
					{
						alert("The account password must be between 6 and 20 characters!!");
						document.form1.acc_pwd.focus();
						return false;
					}
					
		 
					
				if (	go_to_next ) {
			  document.form1.save.value ='1';
			  return true;
				}
		}
		
		
		
		function delete_item()
		{			
			answer = confirm("Are you sure you want to delete this record?");	
			
			if ( answer == null )
			{
				return false;
			}
			
			if ( answer == false )
			{
				return false;
			}
			document.form1.action.value ='delete';
			document.form1.del.value ='1';
		}
		
		
				
				
		function delete_advertisement()
		{			
			answer = confirm("Are you sure you want to delete this record?");	
			
			if ( answer == null )
			{
				return false;
			}
			
			if ( answer == false )
			{
				return false;
			}
			document.form1.action.value ='delete';
			document.form1.del.value ='1';
		}
				
		
		
		function show_dealer_row( id )
		{
			if ( document.frm_find_dealer.last_open.value != "" )
			{
			 document.getElementById('full_info_'+document.frm_find_dealer.last_open.value).style.display='none';
			}
			if ( document.frm_find_dealer.last_open.value != id )
			{
			 document.getElementById('full_info_' + id).style.display='';
			 document.frm_find_dealer.last_open.value=id;
			}
			else
			{
			 document.frm_find_dealer.last_open.value="";
			}
		}
		
		
		
		
		
		
		
		function isEmail(str) {
  // are regular expressions supported?
				var supported = 0;
				if (window.RegExp) {
						var tempStr = "a";
						var tempReg = new RegExp(tempStr);
						if (tempReg.test(tempStr)) supported = 1;
				}
				if (!supported) 
						return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
				var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
				var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
				return (!r1.test(str) && r2.test(str));
  }
		
		
  
		
		
		
  function save_plan( edit, lang )
		{
			document.boothPlan.save_booths( edit, lang );			
		}	
		
		function add_booths( addBooth, lang )
		{
			if ( isNaN(addBooth) )
	  {
		  if ( lang.toLowerCase() == "fr" )
				{
					alert("Vous devez renseigné le Nombre de Kiosques à ajouter!");
				}
				else
				{
					alert("You must enter the quantity of Booths to add!");
				}		
			}
			else
			{				
			 document.boothPlan.add_new_booth( addBooth );			
			}
		}
	 
		function del_booth( delBooth, lang )
		{
		 if ( delBooth == "" )
	  {
		  if ( lang.toLowerCase() == "fr" )
				{
					alert("Vous devez renseigné le # du Kiosque!");
				}
				else
				{
					alert("You must enter the Booth #!");
				}		
			}
			else
			{				
			 document.form1.delBooth.value="";
			 document.boothPlan.del_booth( delBooth );			
			}
		}






// Function that checks file extension type
// input_name = name of browser
// arrTypes : Array of file types ex : Array('gif', jpg')
function check_file_type( input_name, arrTypes ) {
	
	 var ext_ok = false;  // extension ok or not
	 var ext_list = "";   // extensions string list
		
		//  get file name
  var input_field = document.getElementById( input_name );
  var text_field = document.getElementById( input_name + "_text" );
  var input_value = input_field.value;
		
		// read last 3 characters
  var ext = input_value.substring( input_value.lastIndexOf(".") + 1, input_value.length );
  ext = ext.toLowerCase();
		
		// loop and find matching extension
		for ( i = 0; i < arrTypes.length; ++i )
		{
			ext_list = ext_list + arrTypes[i] + ",";
			if ( ext == arrTypes[i] ) {
				ext_ok = true
			}
		}
		
		// remove extra ","
		if ( ext_list.substring( ext_list.length - 1, ext_list.length ) == "," )
		{
			ext_list = ext_list.substring( 0 , ext_list.length - 1 );
		}
		
		
		// process result
		if ( !ext_ok )
		{
			input_field.value = "";
			alert( "You must attach a .doc or .pdf file" );
			text_field.value = "";
		} else {
			text_field.value = input_value.substring( input_value.lastIndexOf("\\") + 1, input_value.length );
		}
}
