/**
 * @author Sam
 */

$(document).ready(function ()
{
    $info = $('#langue').attr("class").split('-');
	$langue = $info[0];	
	if ($info[1] == "blog"){
		$chemin = "../";	
	} else {
		$chemin = "";	
	};
			
    // setup ul.tabs to work as tabs for each div directly under div.panes 
	$("ul.tabs").tabs("div.panes > div", {history: true}); 
	$("ul.tabs_who").tabs("div.who_content", {event:'mouseover'}); 
    $(".quote a img").hover(function(){
        $(this).attr("src", $chemin+"images/"+$langue+"/quote_hover.png");
    }, function(){
        $(this).attr("src", $chemin+"images/"+$langue+"/quote.png");
    });
    
    $("#area_contact").hover(function(){
        $('#image_contact').attr("src", $chemin+"images/"+$langue+"/logo_haut_contact_hover.png");
    }, function(){
        $('#image_contact').attr("src", $chemin+"images/"+$langue+"/logo_haut_contact.png");
    });
    $("#area_quote").hover(function(){
        $('#image_quote').attr("src", $chemin+"images/"+$langue+"/logo_haut_quote_hover.png");
    }, function(){
        $('#image_quote').attr("src", $chemin+"images/"+$langue+"/logo_haut_quote.png");
    });
    $("#area_portfolio").hover(function(){
        $('#image_portfolio').attr("src", $chemin+"images/"+$langue+"/logo_bas_portfolio_hover.png");
    }, function(){
        $('#image_portfolio').attr("src", $chemin+"images/"+$langue+"/logo_bas_portfolio.png");
    });
    $("#area_index").hover(function(){
        $('#image_index').attr("src", $chemin+"images/"+$langue+"/logo_bas_index_hover.png");
    }, function(){
        $('#image_index').attr("src", $chemin+"images/"+$langue+"/logo_bas_index.png");
    });
	$time = '200';
    $(".image_blog").hover(function(){
        $("#image_blog").stop( )
		.animate({
            marginTop: "0px"
        }, 0);
        $('#image_ressort').stop()
		.animate({
            height: "60px",
            width: "57px"
        }, 0);		
        $("#image_blog").animate({
            marginTop: "-10px"
        }, $time);
        $('#image_ressort').animate({
            height: "50px",
            width: "57px"
        }, $time);
        $("#image_blog").animate({
            marginTop: "+8px"
        }, $time);
        $('#image_ressort').animate({
            height: "68px",
            width: "57px"
        }, $time);
        $("#image_blog").animate({
            marginTop: "-6px"
        }, $time);
        $('#image_ressort').animate({
            height: "54px",
            width: "57px"
        }, $time);
        $("#image_blog").animate({
            marginTop: "+5px"
        }, $time);
        $('#image_ressort').animate({
            height: "65px",
            width: "57px"
        }, $time);
        $("#image_blog").animate({
            marginTop: "-3px"
        }, $time);
        $('#image_ressort').animate({
            height: "57px",
            width: "57px"
        }, $time);
        $("#image_blog").animate({
            marginTop: "+1px"
        }, $time);
        $('#image_ressort').animate({
            height: "61px",
            width: "57px"
        }, $time);
        $("#image_blog").animate({
            marginTop: "0px"
        }, $time);
        $('#image_ressort').animate({
            height: "60px",
            width: "57px"
        }, $time);
    }, function(){
		$("#image_blog").stop({clearQueue : true});
        $('#image_ressort').stop({clearQueue : true});
    });

	 
    // initialize scrollable  
    $("div.scrollable").scrollable({ 
        size: 3, 
        items: '.thumbs',   
        hoverClass: 'hover' ,
		clickable: false,
		loop: true 
    }); 

	$('#contact_form').FormValidate({
		phpFile:"shared/send.php",
		ajax:true,
		validCheck: false
	});

	$('#quote_form').FormValidate({
		phpFile:"shared/send_quote.php",
		ajax:true,
		validCheck: false
	});

	$('#form_reason').change(function()
		{
		var message_index;
		var custom_form_html;			
		message_index = $('#form_reason').val();
		switch (message_index) {
			case "new":
				$('li.new').removeClass('hide');
				$('li.no_new').addClass('hide');				
				break; 
			case "develop":
				$('li.develop').removeClass('hide');
				$('li.no_develop').addClass('hide');				
				break; 
			case "update":
				$('li.update').removeClass('hide');
				$('li.no_update').addClass('hide');				
				break; 
			case 'support':
				$('li.support').removeClass('hide');
				$('li.no_support').addClass('hide');				
				break; 					
			case 'other':
				$('li.other').removeClass('hide');
				$('li.no_other').addClass('hide');				
				break; 
		}	
        }
	);			
	$('.help').qtip({
	   	position: {
	      corner: {
	         target: 'rightMiddle',
	         tooltip: 'leftMiddle'
	      },
		  adjust: { x: 15, y: 0 }
	   	},
	   	style: {
			border: {
				width: 3,
				radius: 8,
				color: '#1165A9'
			}
		}	
	});
    $(".help2").livequery(function(){
		$(this).qtip({
		   	position: {
		      corner: {
		         target: 'rightMiddle',
		         tooltip: 'leftMiddle'
		      },
			  adjust: { x: 15, y: 0 }
		   	},
		   	style: {
				border: {
					width: 3,
					radius: 8,
					color: '#1165A9'
				}
			}
		});
	}); 
	
	// Links effect
	//
	$("aa").hover(
			function(){
				jQuery(this).parent().addClass("selected");
				jQuery(this).animate({opacity: 0.5},200);
				jQuery(this).animate({opacity: 1},100);
			},
			function(){
				jQuery(this).parent().removeClass("selected");
				jQuery(this).animate({opacity: 1},100);
			}
		);		
});

