/* JavaScript Document*/
$(document).ready(function(){
	var mouseInside=false;
	$("#contactForm").hoverIntent(
		function(){
			$(this).stop().animate({"margin-left":"-245px"},300).addClass("open");
			$("body.ie #fixedBlock").stop().animate({"padding-left":"250px"},100);
			mouseInside=true;			
		},function(){
			if(!($("#contactForm input, #contactForm textarea").hasClass("used"))){
				$(this).stop().animate({"margin-left":"-30px"},300).removeClass("open");
				$("body.ie #fixedBlock").stop().animate({"padding-left":"60px"},400);
			}
			mouseInside=false;
	});
	
	$("#contactForm input, #contactForm textarea").focus(function(){
		$(this).addClass("used");
	});
	
	$("#contactForm a").bind("click",function(event){
		if($(this).parent("#contactForm").hasClass("open")){
			$(this).parent("#contactForm").animate({"margin-left":"-30px"},300).removeClass("open");
		}
	});
	
	$("#contactForm .button a img").bind("click",function(event){
		//alert("kapouink");
		if($(this).parent("#contactForm").hasClass("open")){
			$(this).stop().animate({"margin-left":"-245px"},300).addClass("open");
		}
	});
	
	$("body").bind("click",function(event){
		if($("#contactForm").hasClass("open") && mouseInside == false){
			$("#contactForm").animate({"margin-left":"-30px"},300).removeClass("open");
		}
	});
		
	if(Modernizr.input.placeholder){
		$("html").addClass("placeholder_active");
	}
});
