function toggle_comment_form(id){
    var cform = $('#comment_form_' + id);
    if(cform.hasClass('hidden')) {
        cform.prev().text("Annuler");
        cform.show();
    }
    else {
        cform.prev().text("Répondre");
        cform.hide();
    }
    cform.toggleClass('hidden');
}

function toggle_quote_comment_form(id){
    var cform = $('#quote_comment_form_' + id);
    if(cform.hasClass('hidden')) {
        cform.prev().text("Annuler");
        cform.show();
    }
    else {
        cform.prev().text("Citer");
        cform.hide();
    }
    cform.toggleClass('hidden');
}

function confirmDelete()
{
    var agree=confirm("Veuillez confirmer la suppression");
    if (agree)
        return true ;
    else
        return false ;
}

$(function(){
    $('#id_date').datepicker({ dateFormat: 'yy-mm-dd', showAnim: 'fadeIn' });
    $('#id_starting').datepicker({ dateFormat: 'yy-mm-dd', showAnim: 'fadeIn' });
    
    sfHover = function() {
            var sfEls = document.getElementById("main-menu").getElementsByTagName("li");
            for (var i=0; i<sfEls.length; i++) {
                    sfEls[i].onmouseover=function() {
                            this.className+=" sfhover";
                    }
                    sfEls[i].onmouseout=function() {
                            this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
                    }
            }
    }
    if (window.attachEvent) window.attachEvent("onload", sfHover);
    
});
