$(document).ready(function() {

    $('#s').click(function(){
        if($(this).val() == 'Chercher les meilleurs Prix du Net...')
            $(this).val('');
    });
    $('#s').blur(function(){
        if($(this).val() == '')
            $(this).val('Chercher les meilleurs Prix du Net...');
    });
    $('#histo_title').click(function(){
        $('#fav').hide();
        $('#histo').show();
        $(this).removeClass('bloc_off');
        $(this).addClass('bloc_on');
        $('#fav_title').removeClass('bloc_on');
        $('#fav_title').addClass('bloc_off');
    });
    $('#fav_title').click(function(){
        $('#histo').hide();
        $('#fav').show();
        $(this).removeClass('bloc_off');
        $(this).addClass('bloc_on');
        $('#histo_title').removeClass('bloc_on');
        $('#histo_title').addClass('bloc_off');
    });
    $('#new_title').click(function(){
        $('#topi').hide();
        $('#new').show();
        $(this).removeClass('bloc_off');
        $(this).addClass('bloc_on');
        $('#top_title').removeClass('bloc_on');
        $('#top_title').addClass('bloc_off');
    });
    $('#top_title').click(function(){
        $('#new').hide();
        $('#topi').show();
        $(this).removeClass('bloc_off');
        $(this).addClass('bloc_on');
        $('#new_title').removeClass('bloc_on');
        $('#new_title').addClass('bloc_off');
    });
});
$(document).ready(function()
{
    // $('#informer').hide();
    $('.shareConfig').mousemove(function(e){
        $('#informer').show();
        $('#informer').css({
            top: (e.pageY + 30) + "px",
            left: (e.pageX + 15) + "px"
        });
    });
    $('.shareConfig').mouseout(function(e){
        $('#informer').hide();
    });
    $('#link_compte').mouseout(function(e){
        $('#informer').hide();
    });
    $('#product_popularity').mouseout(function(e){
        $('#informer').hide();
    });
});

$(document).ready(function()
{
    if(window.opera)
    {
        if ($("a#favLayout").attr("rel") != "")
        { // don't overwrite the rel attrib if already set
            $("a#favLayout").attr("rel","sidebar");
        }
    }
    $("a#favLayout").click(function(event)
    {
        event.preventDefault();
        var url = this.href;
        var title = this.title;

        if (window.sidebar)
        { // Favoris Mozilla Firefox
            window.sidebar.addPanel(title, url, "");
        }
        else if( window.external )
        { // Favoris IE
            window.external.AddFavorite( url, title);
        }
        else if(window.opera)
        { // Opera 7+
            return false; // do nothing - the rel="sidebar" should do the trick
        } else
{ // for Safari, Konq etc - navigateur qui ne supporte pas les favoris(que je n'ai pas trouv�)
            alert('Malheureusement ce navigateur ne permet pas l&quote;ajout de favoris automatique. Merci d&quote;ajouter ce favoris manuellement.');
        }
    });
});

// add a "rel" attrib if Opera 7+
$(document).click(function(){
    if($('#menu_ht').html() != "")
    {
        if($('#menu_ht').attr('style').toLowerCase() == 'display: block;' || $('#menu_ht').attr('style').toLowerCase() == 'display: block'  || $('#menu_ht').attr('style').toLowerCase() == 'display: block; ')
        {
            $('#menu_ht').hide();
        }
    // $('#menu_ht').html('');
    }
    if($('#menu_vq').html() != "")
    {
        if($('#menu_vq').attr('style').toLowerCase() == 'display: block;' || $('#menu_vq').attr('style').toLowerCase() == 'display: block'  || $('#menu_vq').attr('style').toLowerCase() == 'display: block; ')
        {
            $('#menu_vq').hide();
        }
    //$('#menu_vq').html('');
    }
});
$("#bouton").live('click',function(){
    Temp =$("#s").attr("value").replace(/[//\\?.]/gi," ");
    document.forms["formulaire"].elements["s"].value=Temp;
});

$(document).ready(function(){
    $("#dialog").dialog({
        height: 460,
        width: 550,
        modal: true,
        autoOpen: false,
        resizable: false,
        title: ''
    });
   $('.alerterComFicheProduit').click(function(){
        $('#dialog').dialog('option','title', 'Alerter un modérateur');
        $("#dialog").find('iframe').attr('src','/alerter/produit/'+$(this).attr('id')+'.html');
        $('#dialog').dialog('open');
    });
    $('.ui-widget-overlay').live('click', function(){
       $('#dialog').dialog('close');
    });
});
