/* ------------------------------------------------------------------------
	prettyCheckboxes
	
	Developped By: Stephane Caron (http://www.no-margin-for-errors.com)
	Inspired By: All the non user friendly custom checkboxes solutions ;)
	Version: 1.1
	
	Copyright: Feel free to redistribute the script/modify it, as
			   long as you leave my infos at the top.
------------------------------------------------------------------------- */
	
jQuery.fn.prettyCheckboxes=function(a){a=jQuery.extend({checkboxWidth:67,checkboxHeight:27,className:"prettyCheckbox",display:"list"},a);$(this).each(function(){$label=$('label[for="'+$(this).attr("id")+'"]');$label.prepend("<span class='holderWrap'><span class='holder'></span></span>");if($(this).is(":checked")){$label.addClass("checked")}$label.addClass(a.className).addClass($(this).attr("type")).addClass(a.display);$label.find("span.holderWrap").width(a.checkboxWidth).height(a.checkboxHeight);$label.find("span.holder").width(a.checkboxWidth);$(this).addClass("hiddenCheckbox");$label.bind("click",function(){$("input#"+$(this).attr("for")).triggerHandler("click");if($("input#"+$(this).attr("for")).is(":checkbox")){$(this).toggleClass("checked");$("input#"+$(this).attr("for")).checked=true;$(this).find("span.holder").css("top",0)}else{$toCheck=$("input#"+$(this).attr("for"));$('input[name="'+$toCheck.attr("name")+'"]').each(function(){$('label[for="'+$(this).attr("id")+'"]').removeClass("checked")});$(this).addClass("checked");$toCheck.checked=true}});$("input#"+$label.attr("for")).bind("keypress",function(b){if(b.keyCode==32){if($.browser.msie){$('label[for="'+$(this).attr("id")+'"]').toggleClass("checked")}else{$(this).trigger("click")}return false}})})};checkAllPrettyCheckboxes=function(b,a){if($(b).is(":checked")){$(a).find("input[type=checkbox]:not(:checked)").each(function(){$('label[for="'+$(this).attr("id")+'"]').trigger("click");if($.browser.msie){$(this).attr("checked","checked")}else{$(this).trigger("click")}})}else{$(a).find("input[type=checkbox]:checked").each(function(){$('label[for="'+$(this).attr("id")+'"]').trigger("click");if($.browser.msie){$(this).attr("checked","")}else{$(this).trigger("click")}})}};




function test_form(){
	var prenom = document.getElementById('rsvp').firstName.value;
	var nom = document.getElementById('rsvp').lastName.value;
	var e_mail = document.getElementById('rsvp').email.value;



	var errorfirstName = true;
	var errorlastName = true;
	var errorMail = true;

	var place = e_mail.indexOf("@",1);
	var point = e_mail.indexOf(".",place+1);
	if ((place > -1)&&(e_mail.length >2)&&(point > 1)){
		errorMail = false;
	}

	if(prenom.length > 2){
		if(prenom != 'First Name'){
			errorfirstName = false;
		}
	}

	if(nom.length > 2){
		if(nom != 'Last Name'){
			errorlastName = false;
		}
	}

	if(errorfirstName||errorlastName||errorMail){
		if(errorfirstName){
			document.getElementById('firstName').style.backgroundColor = '#f6da69'; 
			document.getElementById('firstName').style.border = '1px solid #918144'; 
		}else{
			document.getElementById('firstName').style.backgroundColor = '#ffffff'; 
			document.getElementById('firstName').style.border = 'none'; 
		}
		if(errorlastName){
			document.getElementById('lastName').style.backgroundColor = '#f6da69'; 
			document.getElementById('lastName').style.border = '1px solid #918144'; 
		}else{
			document.getElementById('lastName').style.backgroundColor = '#ffffff'; 
			document.getElementById('lastName').style.border = 'none'; 
		}
		if(errorMail){
			document.getElementById('email').style.backgroundColor = '#f6da69'; 
			document.getElementById('email').style.border = '1px solid #918144'; 
		}else{
			document.getElementById('email').style.backgroundColor = '#ffffff'; 
			document.getElementById('email').style.border = 'none'; 
		}
		return(false);
	}else{
		document.getElementById('rsvp').submit();
		return(true);
	}
}


