/**
 * OnLoad events associated with "complete-solution" retail campaign
 * 
 * @author Jon Trumbul
 * @copyright 2009 Melbourne IT
 * @dependencies Mootools 1.2 Core
 * 
 * @return none
 */

window.addEvent('domready', function() {
	
	var percent = $('percentButton');
	percent.addEvent('click', function() {
		myFx = new Fx.Scroll(window).toElement('eoiForm');    
	});
	
	var enquire = $('enquireButton');
	enquire.addEvent('click', function() {
		myFx = new Fx.Scroll(window).toElement('eoiForm');    
	});
	
	if($('booking_conf') || $('errorDiv')) {
	    myFx = new Fx.Scroll(window).toElement('quotePrompt');
	}
	
});

ONEGEEK.forms.GValidator.options = {
    // Generic GValidator options that will be applied to any form without a specific section below.    
    // Edit to suit your environment
    reqShow: true,            // Automatically add the required char to labels?
    reqChar: '*',             // Character used to indicate a required field
    reqPlacement: 'after',   // Position of required character. Can be 'before' or 'after'  
    autoFocus: 'false' 
}

ONEGEEK.forms.GValidator.plugins = {  
    company: {
      _extends: "NameField",
      contextMsg: "Please enter your company name",
      errorMsg: "Company is required, please complete.",
      regex: /^([a-zA-Z0-9\-\'\s]{2,30})$/g,
      cleanRegex: /[^a-zA-Z1-9\-\'\s]/g
    },   
    
    url: {
      _extends: "AbstractTextField",
      regex: /^(http:\/\/|)(www\.|)[A-Za-z0-9][A-Za-z0-9-]{2,61}[A-Za-z0-9](\.([a-z])*)+$/i,
      errorMsg: 'Please enter a valid website address',
      contextMsg: 'Your website address will be kept confidential'     
    }
	
};

ONEGEEK.forms.GValidator.translation.EN = {  
    defaults: {
      emptyMsg: "Field is required, please complete."
    },
    
    name: {
      cleanRegex: /[^a-zA-Z1-9\-\'\s]/g
    },
    
    phone: {
      errorMsg: "Your phone number needs to be at least 8 digits",  
      contextMsg: "Your phone number needs to be at least 8 digits",
      cleanRegex: /[^a-zA-Z0-9]/g
    }
		
};

