$(document).ready(function(){
	if (jQuery.browser.opera) {
		$('input:checkbox').css('padding', '0');
	}
    $.cookie('allowToCommentBlog', 'true', {
        expires: 1,
        path: '/',
        secure: false
    });
    
    if ($("a.lightbox").lightBox) 
        $("a.lightbox").lightBox({
            fixedNavigation: true
        });
    if ($.browser.msie && $.browser.version < 7) {
        buttonfix();
    }
    $("#Search").bind("focus", function(e){
        if (this.value == ini_search) 
            this.value = '';
    });
    $("#Search").bind("blur", function(e){
        if (this.value == '') 
            this.value = ini_search;
    });
    $("#Newsletter").bind("focus", function(e){
        if (this.value == ini_newsletter) 
            this.value = '';
    });
    $("#Newsletter").bind("blur", function(e){
        if (this.value == '') 
            this.value = ini_newsletter;
    });
	
    $("#search").bind("focus", function(e){
        if (this.value == ini_search) 
            this.value = '';
    });
    $("#search").bind("blur", function(e){
        if (this.value == '') 
            this.value = ini_search;
    });
    $("#newsletter").bind("focus", function(e){
        if (this.value == ini_newsletter) 
            this.value = '';
    });
    $("#newsletter").bind("blur", function(e){
        if (this.value == '') 
            this.value = ini_newsletter;
    });
    var test = $('#basicModal');
    if (test.length > 0) {
        $('#basicModal').modal({
            minHeight: 60,
            maxHeight: 600,
            onShow: function(){
                $('#basicModal').show();
            },
            onClose: function(dialog){
                $.modal.close(); // must call this!
                $('#basicModal').hide();
            },
            autoResize: true
        });
    }
    
    //Actualisation automatique du panier
    if ($('#panier-validation').length > 0) {
        $('.panier-quantite input').change(function(){
            $('#recalculer').click();
        });
    }
	
	$("#w_isoLivrPays").change(function() { window.location='panier.html?isoLivr='+this.value; });
	
	$("#w_btn-bon-commande").click(function(e){
        e.preventDefault();
        window.print();
    });
	
	$("label[for$='boncommande']").click(function(e){
        e.preventDefault();
        window.print();
    });
    
});
