
$(document).ready(function($){

    //reader rss du blog
    

    $.get("/FeedReader.php", function(feed){
        $("#newsfeed").append(feed);
    });

    
    //$('a.lightbox').lightBox();
    
    $('div.inner').wrap('<div class="outer"></div>');
    $(".inner").corner("round 8px").parent().css('padding', '2px').corner("round 9px");
    
    $(".popup").click(function(){
        window.open($(this).attr("href"));
        return false;
    });
    
    $("#headerMenu li div").hide();
    $("#headerMenu li").hover(function(){
        $(this).children("div").fadeIn("slow");
        $(this).addClass("selected");
    }, function(){
        $(this).children("div").fadeOut("fast");
        $(this).removeClass("selected");
    });
    
    $("body").addClass($.browser + $.browser.version.substr(0, 1));
    
    $.each($.browser, function(i, val){
        if (i == "msie" && $.browser.version.substr(0, 3) == "6.0") {
            $.getScript("http://wwwdata.appli-box.com/scripts/minmax.js");
        }
    });
    if (jQuery.isFunction(jQuery.fn.tabs) && $("#tabList").length > 0) {
        $("#tabList").tabs({
            fx: {
                opacity: 'toggle'
            }
        });
    } 
    //$(document).pngFix(); 
    
    $("#headerMenu a").hover(function(){
        $(this).next("div").animate({
            opacity: "show",
            top: "33"
        }, "slow");
    }, function(){
        $(this).next("div").animate({
            opacity: "hide",
            top: "43"
        }, "fast");
    });
    if (jQuery.isFunction(jQuery.fn.accordion)) {
        $('#shop-agenceArticles').accordion({
            autoHeight: false,
            header: 'h2'
        });
    }
	  
    if ($('#projectForm').length > 0) {

        // remove * in required input name (Name, Email, Tel), because we can't use '*Name' in JS (* is forbidden)
        // we need * in case of user have not js activated
        var inputNameName = $('#DevisNom').attr('name');
        var inputNameLength = inputNameName.length;
        var newInputName = inputNameName.substr(1, inputNameLength);
        $('#DevisNom').attr({
            name: newInputName
        });
        
        var inputEmailName = $('#Devisemail').attr('name');
        var inputNameLength = inputEmailName.length;
        var newInputName = inputEmailName.substr(1, inputNameLength);
        $('#Devisemail').attr({
            name: newInputName
        });
        
        var inputTelName = $('#Devistel').attr('name');
        var inputNameLength = inputTelName.length;
        var newInputName = inputTelName.substr(1, inputNameLength);
        $('#Devistel').attr({
            name: newInputName
        });
        
        
        
        // validation Form "Contactez-nous"
        $('#projectForm').validate({
            rules: {
                Nom: 'required',
                Email: {
                    required: true,
                    email: true
                },
                Tel: 'required'
            },
            messages: {
                Nom: 'Veuillez saisir votre nom',
                Email: {
                    required: 'Veuillez saisir votre email',
                    email: 'Votre email est invalide'
                },
                Tel: 'Veuillez saisir votre n&deg; de t&eacute;l&eacute;phone'
            }
        });
    } 
    
});


jQuery.fn.log = function (msg,type) {
	if(!window.console){
		return;
	}
	
  console.log("%s: %o", msg, this);
  return this;
};
jQuery.fn.debug = function (msg) {
	if(!window.console){
		return;
	}
  console.debug("%s: %o", msg, this);
  return this;
};
jQuery.fn.error = function (msg) {
	if(!window.console){
		return;
	}
  console.error("%s: %o", msg, this);
  return this;
};