	var franchiseFormValidator;
	var franchiseInlineValidator;
	
	if(location.href.indexOf("request-information") > -1){
	window.addEvent('domready', function(){
		//Form Validation
		FormValidator.add('postal', {
		  errorMsg: "Please enter postal code in format 'X#X #X#'",
		  test: function(element) {
			if (element.get('value').length == 6 && element.get('value').search(/^[a-zA-Z]\d[a-zA-Z]\d[a-zA-Z]\d$/) != -1) return true;
			else if (element.get('value').length == 7 && element.get('value').search(/^[a-zA-Z]\d[a-zA-Z](-|\s)\d[a-zA-Z]\d$/) != -1) return true;
			else return false;
		  }
		});
		FormValidator.add('phone', {
		  errorMsg: "Please enter a 10 digit phone number",
		  test: function(element) {
			var stripped = element.get('value').replace(/[\(\)\.\-\ ]/g, '');    

			if (element.get('value') == "") {
		        return false;
		    } else if (isNaN(parseInt(stripped))) {
		        return false;
		    } else if (!(stripped.length == 10)) {
		        return false;
		    } else {
				return true;
			}
		  }
		});
		
		franchiseFormValidator = new FormValidator(document.getElementById('FranchiseRequestForm'));
		franchiseInlineValidator = new FormValidator.Inline('FranchiseRequestForm');
		//franchiseFormValidator.validate();
		
		// Listen for click events on the submit button.
		document.getElementById('FranchiseRequestForm').addEvent( 'submit', function(ev){
			// Stops the submission of the form.
			new Event(ev).stop();
			
			document.getElementById('loading').style.display = "block";
			document.getElementById('FranchiseRequestForm').set('send', {
				onComplete: function(response) {
					if(response.match("successfully")){
						document.getElementById('fail').style.display = "none";
						document.getElementById('success').style.display = "block";
						document.getElementById('franchiseFormContainer').style.display = "none";
					}else{
						document.getElementById('fail').style.display = "block";
						document.getElementById('success').style.display = "none";
					}
				}
			});
			
			//Validate and Send the form.
			if (franchiseFormValidator.validate()) {
					document.getElementById('FranchiseRequestForm').send();
			}
			document.getElementById('loading').style.display = "none";
		});//form addEvent
	});//window addEvent
	}
	