//FORMULAIRE

//Premiere fonction appelle le fichier Jquery.color et la bibliothèque jquery pour une animation de couleurs sur les champs
		jQuery(function() {
			jQuery("input,textarea").bind("click focus", function() {
				jQuery(this).animate({ backgroundColor: "#ffcc00",color: "#000" }, 300);
				});	
		});
		
//Fonction du formulaire sur les différentes id des champs au click du bouton envoyer
	
		jQuery(function() {
				jQuery("#envoyer").click(function(){
					valid = true

					if(jQuery("#contactname").val() == ""){
						jQuery("#contactname").css("backgroundColor","#CC3333");
							
							valid = false;
					}

					else if(jQuery("#email").val() == ""){
						
						jQuery("#email").css("backgroundColor","#CC3333");
							
							valid = false;
					}
					
					else if (!jQuery("#email").val().match(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/i)){
							
							valid = false;
					}
					
					else if(jQuery("#subject").val() == ""){
						jQuery("#subject").css("backgroundColor","#CC3333");
						
							valid = false;
					}
					
					else if(jQuery("#message").val() == ""){
						jQuery("#message").css("backgroundColor","#CC3333");
						
							valid = false;
					}
				

					
					return valid;
	
					
				});

				
				
				//Fonction du formulaire à chaque étape de remplissage du formulaire
				
			jQuery(function() {
			
				jQuery("#contactname").blur(function(){
				
					valid = true
				
					

				
					if(jQuery("#contactname").val() == ""){
						jQuery("#contactname").css({ backgroundColor: "#CC3333",color:"#FFF" });
						jQuery("#contactname").next(".error").text("Veuillez entrer votre nom!").slideDown(400);
							
							valid = false;
					}

						else{
							jQuery("#contactname").animate({ backgroundColor: "#000",color: "#FFF" }, 400);
							jQuery("#contactname").next(".error").slideUp(400);
							
			
						}
					});
				

				
						
				jQuery("#email").blur(function(){
						
						valid = true
					
						if(jQuery("#email").val() == ""){
							jQuery("#email").css({ backgroundColor: "#CC3333",color:"#FFF" });
							jQuery("#email").next(".error").text("Veuillez entrer votre e-mail!").slideDown(400);
							
									valid = false;
					}
					
							
						//Petit verification pour être sur que la structure de l'e-mail est juste afin d'afficher le message d'erreur si ce n'est pas le cas: ne pas oublier que le php verifie derriere
						else if (!jQuery("#email").val().match(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/i)){	
							jQuery("#email").css({ backgroundColor: "#CC3333",color:"#FFF" });
							jQuery("#email").next(".error").text("Veuillez entrer un e-mail valide!").slideDown("slow");
								
								valid = false;
					}
					
						else{
							jQuery("#email").animate({ backgroundColor: "#000",color: "#FFF" }, 400);
							jQuery("#email").next(".error").slideUp("slow");
						}
					
					return valid;
					

      
				});
				
				
				
				
				
				
				jQuery("#subject").blur(function(){
						
						valid = true
					
						if(jQuery("#subject").val() == ""){
							jQuery("#subject").css({ backgroundColor: "#CC3333",color:"#FFF" });
							jQuery("#subject").next(".error").text("Veuillez remplir le champ sujet!").slideDown(400);
							
									valid = false;
					}
					
					
						else{
							jQuery("#subject").animate({ backgroundColor: "#000",color: "#FFF" }, 400);
							jQuery("#subject").next(".error").slideUp("slow");
						}
					
					return valid;
				});
				
				
				
				jQuery("#message").blur(function(){
						
						valid = true
					
						if(jQuery("#message").val() == ""){
							jQuery("#message").css({ backgroundColor: "#CC3333",color:"#FFF" });
							jQuery("#message").next(".error").text("Veuillez remplir le champ message!").slideDown(400);
							
									valid = false;
					}
					
					
						else{
							jQuery("#message").animate({ backgroundColor: "#000",color: "#FFF" }, 400);
							jQuery("#message").next(".error").slideUp("slow");
						
					
					valid = false;
					
					}
				});
				
				
			});
			
		
			
			});
			
	function verif()
	{
			alert("Veuillez confirmer l'envoi du message!");
			return true;
			
	}



			




// AUTRES SCRIPTS


 		jQuery(document).ready(function(){
		
	/* ---FADE D'ENTREE SUR LE SITE--- */
	/*jQuery("#slideshow").hide().slideDown(1500, function(){
			jQuery('#cu3er-container').fadeTo(4000, 1, function(){
				jQuery('#bb').next().fadeTo(2500, 1);
			});
	});*/
	
		
		//Diagnal Sliding pour la page SERV
				jQuery('.services_bloc.mon_slide').hover(function(){
					jQuery(".cover", this).stop().animate({top:'260px', left:'325px'},{queue:false,duration:300});
				}, function() {
					jQuery(".cover", this).stop().animate({top:'0px', left:'0px'},{queue:false,duration:300});
				});
		

jQuery(document).ready(function() { 
         
    // enable tooltip for "download" element. use the "slide" effect 
    jQuery(".content_bloc").tooltip({ 
	
	effect: 'slide',
	
	// tweak the position
	offset: [10, 10]
	
	})
	
	.dynamic( {
	
		// customized configuration on bottom edge
		bottom: {
		
			// slide downwards
			direction: 'down',
			
			// bounce back when closed
			bounce: true
		}});  
});
	
	

         
    // enable tooltip for "download" element. use the "slide" effect 
    jQuery("li.content_bloc").tooltip({ effect: 'slide'});  


		
            jQuery('#footer_liens a, .nav_post a, .lien, p a').hover(function() {
                jQuery(this).animate({ color: "#FFCC00" }, 300);
        		},function() {
    			jQuery(this).animate({ color: "#999" }, 300);
        	});
		
	
					
		/*	jQuery('.mon_menu li a').hover(function() {
                jQuery(this).animate({ color: "#ffcc00" }, 100);
        		},function() {
    			jQuery(this).animate({ color: "#000" }, 10);
        	});
			
			jQuery('.current_page_item a').hover(function() {
                jQuery(this).animate({ color: "#FFF" }, 10);
        		},function() {
    			jQuery(this).animate({ color: "#FFF" }, 10);
        	});
			
			*/
		

			jQuery('.content_bloc').hover(function() {
                jQuery(this).animate({ marginTop: "-10px" }, 100);
        		},function() {
    			jQuery(this).animate({ marginTop: "0px" }, 300);
        	});
			

	jQuery(window).ready(function(){
            jQuery("h2, h2 a, h3, ul#footer_liens li a, ul.sub-navigation li a").PastelShadow(
                {
                    x: 2,
                    y: 1,
                    blur: 1,
                    color: "#000"
                }
            );
			
			jQuery(".footer_titre").PastelShadow(
                {
                    x: 1,
                    y: 1,
                    blur: 0,
                    color: "#424242"
                }
            );
			
			jQuery(".bt").PastelShadow(
                {
                    x: 1,
                    y: 1,
                    blur: 3,
                    color: "#666"
                }
            );

        });
	
			<!--TRANSPARENCE DE LA BALISE CONCERNANT LA PAGE PORT-->
			jQuery(".project-grid li a span").fadeTo("slow",0.8);
			
			<!--EFFET SUR LA LISTE DES LIENS DE LA PAGE D'ACCUEIL-->
			jQuery('.blog-list li').hover(function() {
                jQuery(this).animate({ backgroundColor: "#000", marginLeft: "10px" }, 100);
				},function() {
				jQuery(this).animate({ backgroundColor: "#202020", marginLeft: "0px" }, 200)			
        		
        	});
			
		
			
		/*	jQuery('ul.sub-navigation li').hover(function() {
                jQuery(this).animate({ color: "#ffcc00", paddingLeft: "15px" }, 200);
				},function() {
    			jQuery(this).animate({ color: "#FFF", paddingLeft: "0px" }, 200);
        	});
			
			jQuery('ul.sub-navigation li.selected a').hover(function() {
                jQuery(this).css({ color: "#FFCC00", paddingLeft: "-10px"  });
		
        	});*/

			
			jQuery('').hover(function() {
                jQuery(this).animate({ paddingTop: "5px" }, 100).animate({ paddingTop: "0px" }, 300)			
        		
        	});

			jQuery('textarea').elastic();

 		 });











/*
 * JQUERY COLOR ANIMATIONS
 * Copyright 2007 John Resig
 * Released under the MIT and GPL licenses.
 */

(function(jQuery){

	// We override the animation for all of these color styles
	jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){
		jQuery.fx.step[attr] = function(fx){
			if ( fx.state == 0 ) {
				fx.start = getColor( fx.elem, attr );
				fx.end = getRGB( fx.end );
			}

			fx.elem.style[attr] = "rgb(" + [
				Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0),
				Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0),
				Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0)
			].join(",") + ")";
		}
	});

	// Color Conversion functions from highlightFade
	// By Blair Mitchelmore
	// http://jquery.offput.ca/highlightFade/

	// Parse strings looking for color tuples [255,255,255]
	function getRGB(color) {
		var result;

		// Check if we're already dealing with an array of colors
		if ( color && color.constructor == Array && color.length == 3 )
			return color;

		// Look for rgb(num,num,num)
		if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
			return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])];

		// Look for rgb(num%,num%,num%)
		if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
			return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];

		// Look for #a0b1c2
		if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
			return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];

		// Look for #fff
		if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
			return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];

		// Otherwise, we're most likely dealing with a named color
		return colors[jQuery.trim(color).toLowerCase()];
	}
	
	function getColor(elem, attr) {
		var color;

		do {
			color = jQuery.curCSS(elem, attr);

			// Keep going until we find an element that has color, or we hit the body
			if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") )
				break; 

			attr = "backgroundColor";
		} while ( elem = elem.parentNode );

		return getRGB(color);
	};
	
	// Some named colors to work with
	// From Interface by Stefan Petre
	// http://interface.eyecon.ro/

	var colors = {
		aqua:[0,255,255],
		azure:[240,255,255],
		beige:[245,245,220],
		black:[0,0,0],
		blue:[0,0,255],
		brown:[165,42,42],
		cyan:[0,255,255],
		darkblue:[0,0,139],
		darkcyan:[0,139,139],
		darkgrey:[169,169,169],
		darkgreen:[0,100,0],
		darkkhaki:[189,183,107],
		darkmagenta:[139,0,139],
		darkolivegreen:[85,107,47],
		darkorange:[255,140,0],
		darkorchid:[153,50,204],
		darkred:[139,0,0],
		darksalmon:[233,150,122],
		darkviolet:[148,0,211],
		fuchsia:[255,0,255],
		gold:[255,215,0],
		green:[0,128,0],
		indigo:[75,0,130],
		khaki:[240,230,140],
		lightblue:[173,216,230],
		lightcyan:[224,255,255],
		lightgreen:[144,238,144],
		lightgrey:[211,211,211],
		lightpink:[255,182,193],
		lightyellow:[255,255,224],
		lime:[0,255,0],
		magenta:[255,0,255],
		maroon:[128,0,0],
		navy:[0,0,128],
		olive:[128,128,0],
		orange:[255,165,0],
		pink:[255,192,203],
		purple:[128,0,128],
		violet:[128,0,128],
		red:[255,0,0],
		silver:[192,192,192],
		white:[255,255,255],
		yellow:[255,255,0]
	};
	
})(jQuery);

