$(document).ready(function() {	
	
	/*kentico BizForm apply this class to the image submit button*/
	$(".FormButton").hover(
	  function () {
		$(this).attr("src",$(this).attr("src").replace("_off", "_on"));
	  }, 
	  function () {
		$(this).attr("src",$(this).attr("src").replace("_on", "_off"));
	  }
	);
	/*you can apply this class to image buttons so they will have rollover effections*/
	$(".ImageButton").hover(
	  function () {
		$(this).attr("src",$(this).attr("src").replace("_off", "_on"));
	  }, 
	  function () {
		$(this).attr("src",$(this).attr("src").replace("_on", "_off"));
	  }
	);

	/* product center js */
	$("div#btnBackNext1 a").click(function () { 
      $("a#link2").click();
    });

	$("div#btnBackNext2 a").click(function () { 
      $("a#link3").click();
    });
	$("div#btnBackNext3 a").click(function () { 
      $("a#link2").click();
    });
	/* product center js ends */
			
});

/*salesforce form validation */
function validateRegistrationTEMP() {
	var theForm = document.getElementById('form1');
	var emptyFields = "";

	if (theForm.first_name.value == ""){
		emptyFields += "First Name cannot be blank." + "\n" ;
	} 

	if (theForm.last_name.value == ""){
		emptyFields += "Last Name cannot be blank." + "\n" ;
	}
	
	if (theForm.email.value == ""){
		emptyFields += "Email cannot be blank." + "\n" ;
	} else if (!validateEmail(theForm.email.value)) {
		emptyFields += "The email address must be correctly formatted." + "\n" ;
	}
	
	if (theForm.company.value == ""){
		emptyFields += "Company cannot be blank." + "\n" ;
	} 
	
	if (emptyFields.length >= 1) {
		alert("Please ensure that the following fields are completed correctly:" + "\n" + emptyFields);
		return false;
	} else {
		theForm.submit();
		return true;
	}
}

function validateEmail(email) {
/*	new version by Laurence 2004 Nov 26
	revised 2005 Nov 04 by Laurence: allow hyphens before @ symbol; rename 'verifyEmail' to 'validateEmail'

	RegExp is a Javascript1.2 feature; tested successfully in WinIE 5.0+, MacIE 5.1, Safari 1.0, WinNN 4.7, WinNN 6.2, WinMoz 1.7
	The pattern matches: 
	- at least one word character ( a-zA-Z0-9_ )
	- followed by any number more including periods and hyphens
	- then a single @
	- then at least one alphanumeric character plus any number more including hyphens and periods
	- plus an ending of an alphanumeric char, a single period, and at least 2 more letters. 
	There can be nothing before or after the pattern; all whitespace, punctuation, etc. not explicitly allowed is forbidden.
*/
	var myRegExp = /^[\w][\w\.\-]*@[a-zA-Z0-9]+[\w\.\-]*[a-zA-Z0-9]\.[a-zA-Z]{2,}$/;
	var sPos = email.search(myRegExp);
	if (sPos >= 0) {
		return true;
	} else {
		return false;
	}
}