

	$(document).ready(function() {
				
		
//      $("a#lang").click(function(){
//			  alert('Soon!');
//			  return false
//		 })
				
	   	$('#testimonialslist').cycle({ fx:     'scrollUp', delay: 2000});
		//$('.pics').cycle('fade');
		$("#clientarea").hover(function(){$(this).stop().animate({ top: '0px'}, 'slow', 'easeOutQuad');}, function() { $(this).stop().animate({ top: '-66px'}, 'slow', 'easeOutBounce');});
		$("ul#pricefaq li.rounded").hover(function() {$(this).animate({ backgroundColor: "#ddd" }, 600);},function() {$(this).animate({ backgroundColor: "#fff" }, 400);});
		$("div#tweet p").hover(function() {$(this).animate({ backgroundColor: "#999" }, 600);},function() {$(this).animate({ backgroundColor: "#474747" }, 400);});
		//Cufon.now();
		
		
						$("form#formcontact").submit(function() {
																 
							 var theForm = $(this) 
							 var theFormID = $(this).attr('id') 
							 var theName = $("#" + theFormID + " input#NOM").val();
							// var theVille = $("#" + theFormID + " input#VILLE").val();
							// var theMessage = $("#" + theFormID + " input#MESSAGE").val();
							 var theEmail = $("#" + theFormID + " input#EMAIL").val();
							 var themessage = 'S.v.p verifier le(s) champ(s) suivant: \n'
							 
							 var hasError = false;
		                     var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
							// $("#" + theFormID + " .error").remove(); 
							 $("#" + theFormID + " .error").removeClass('error'); 
							 
							 
							if(theName == '') {
								//$("#" + theFormID + " input#NOM").before('<span class="error">*</span>');
								$("#" + theFormID + " input#NOM").addClass('error');
								
								themessage = themessage + "\n- Votre Nom";
								hasError = true;
							}
							
//							if(theVille == '') {
//								//$("#" + theFormID + " input#NOM").before('<span class="error">*</span>');
//								$("#" + theFormID + " input#VILLE").addClass('error');
//								
//								themessage = themessage + "\n- Votre Ville";
//								hasError = true;
//							}
							

							if(theEmail == '') {
								//$("#" + theFormID + " input#EMAIL").before('<span class="error">*</span>');
								$("#" + theFormID + " input#EMAIL").addClass('error');
								themessage = themessage + "\n- Votre Courriel";
								hasError = true;
							} else if(!emailReg.test(theEmail)) {
								//$("#" + theFormID + " input#EMAIL").before('<span class="error">*</span>');
								$("#" + theFormID + " input#EMAIL").addClass('error');
								themessage = themessage + "\n- Votre Courriel";
								hasError = true;
							}
					
							
						  if(hasError == false) {
							  // theForm.submit();
									
							 	$("form#" + theFormID + " input[type='submit']").before('<img class="spinner" src="http://bin.webloft.ca/images/wait.gif">');
									
								$.ajax({
								  type: "POST",
								  url: 'ajax/clients_request.asp',
								  cache: false,
								  data: $("form#" + theFormID ).serialize(),
								  success: function(msg){
									  
										if(msg.indexOf("error") > 0 ){
											alert(msg);
											return false;
										 } else {  
										   $("form#" + theFormID + " input[type='submit']").before('<span class="good">' + msg + '</span>');
										   $("form#" + theFormID + " input[type='submit']").remove() ;
 										   $("img.spinner").html(msg).remove() ;
									   }
									  
								  }
								});				   
					
								
							   
						  }	else {
							  
							  alert(themessage);
							  return false;
						 }						
						   return false;
						 });
			
			
//						$("form#trouverdetaillanten").submit(function() {
//																 
//							 var theForm = $(this) 
//							 var theFormID = $(this).attr('id') 
//							 var theName = $("#" + theFormID + " input#NOM").val();
//							 var theVille = $("#" + theFormID + " input#VILLE").val();
//							// var theMessage = $("#" + theFormID + " input#MESSAGE").val();
//							 var theEmail = $("#" + theFormID + " input#EMAIL").val();
//							 var themessage = 'Please check field(s): \n'
//							 
//							 var hasError = false;
//		                     var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
//							// $("#" + theFormID + " .error").remove(); 
//							 $("#" + theFormID + " .error").removeClass('error'); 
//							 
//							 
//							if(theName == '') {
//								//$("#" + theFormID + " input#NOM").before('<span class="error">*</span>');
//								$("#" + theFormID + " input#NOM").addClass('error');
//								
//								themessage = themessage + "\n- Your Name";
//								hasError = true;
//							}
//							
//							if(theVille == '') {
//								//$("#" + theFormID + " input#NOM").before('<span class="error">*</span>');
//								$("#" + theFormID + " input#VILLE").addClass('error');
//								
//								themessage = themessage + "\n- Your City";
//								hasError = true;
//							}
//							
//
//							if(theEmail == '') {
//								//$("#" + theFormID + " input#EMAIL").before('<span class="error">*</span>');
//								$("#" + theFormID + " input#EMAIL").addClass('error');
//								themessage = themessage + "\n- Your Email";
//								hasError = true;
//							} else if(!emailReg.test(theEmail)) {
//								//$("#" + theFormID + " input#EMAIL").before('<span class="error">*</span>');
//								$("#" + theFormID + " input#EMAIL").addClass('error');
//								themessage = themessage + "\n- Your Email";
//								hasError = true;
//							}
//					
//							
//						  if(hasError == false) {
//							  // theForm.submit();
//									
//								$.ajax({
//								  type: "POST",
//								  url: 'ajax/clients_request.asp',
//								  cache: false,
//								  data: $("form#" + theFormID ).serialize(),
//								  success: function(msg){
//									  
//										if(msg.indexOf("error") > 0 ){
//											alert(msg);
//											return false;
//										 } else {  
//										   $("form#" + theFormID + " input[type='submit']").before('<span class="good">' + msg + '</span>');
//										   $("form#" + theFormID + " input[type='submit']").remove() ;
//									   }
//									  
//								  }
//								});				   
//					
//								
//							   
//						  }	else {
//							  
//							  alert(themessage);
//							  return false;
//						 }						
//						   return false;
//						 });
//			

				   $("select#choosetype").change(function() {
					  $("<div>")
						  .css({
							  'position': 'absolute',
							  'top': '0px',
							  'left': '0px',
							  'backgroundColor': 'black',
							  'opacity': '0.50',
							  'width': '100%',
							  'text-align': 'center',
							  //'padding-top': ($(window).height()/2)-100  ,
							  'padding-top': '140px'  ,
							  'color': 'white',
							  'height': $(window).height(),
							  zIndex: 5000
						  }).html('<h3>CHARGEMENT...</h3>').appendTo("body");
					 document.location = this.value ;
					});
 
		
		
	});
	
	
	
	Cufon.replace('h1')('h2')('h3')('h4')('h5')('#top_menu ul li a')('table#prices th')('#tour_content ul#count li');
	Cufon.replace('#promodesc p', {textShadow: '#333 1px 1px'});
	Cufon.replace('#promodesc h1', {textShadow: '#333 1px 1px'});
	Cufon.replace('#promodesc h2', {textShadow: '#333 1px 1px'});
	Cufon.replace('table#prices td.totalprice', {textShadow: '#333 1px 1px'});
