function comment_form_error_msg(event, test,error_class_element_id,error_msg_element_id,error_msg, input){     var div = jQuery(event).parents('.repondre').next('.'+error_msg_element_id);    var parentId = jQuery(event).attr('id');    if(test == false){        jQuery('#'+error_class_element_id+parentId).addClass("erreur-champ");        jQuery('.error_'+error_class_element_id).remove();        jQuery(div).append(error_msg);    }else{        if(input != '') {            jQuery(input).removeClass("erreur-champ");        }        jQuery('#'+error_class_element_id+parentId).removeClass("erreur-champ");        jQuery('.error_'+error_class_element_id).remove();    }}function comment_form_validate(event, url_ajax){    var ok = true;    var test;    var parentId = jQuery(event).attr('id');    var form = jQuery(event).parents('form');    //form.find('#comment'+parentId)    ok = verif_comment(form.find('#comment'+parentId), event);        //'Not connected user' form:    if( form.find('#author'+parentId).length != 0 ){        var recaptcha_ok = false;        ok = verif_author(form.find('#author'+parentId), event);                ok = verif_email(form.find('#email'+parentId), event);    }        if( document.getElementById('author') && ok == false){        Recaptcha.reload();    }    return ok;} function verif_comment(elmt, event, input) {    test = (elmt.val() != "");    comment_form_error_msg(event, test,'comment','col-erreur','<div style="top:153px;" class="error_comment"><p class="ccd3333">Ce champ est obligatoire</p></div>', input);    return test;}function verif_author(elmt, event, input) {    test = (elmt.val() != "");    comment_form_error_msg(event, test,'author','col-erreur','<div style="top:73px;" class="error_author"><p class="ccd3333">Ce champ est obligatoire</p></div>', input);    return test;}function verif_email(elmt, event, input) {    if(elmt.val() != "" ){        email_reg_exp = new RegExp("^([a-zA-Z0-9_-])+([.]?[a-zA-Z0-9_-]{1,})*@([a-zA-Z0-9-_]{2,}[.])+[a-zA-Z]{2,3}\\s*$","i");        test = email_reg_exp.test(elmt.val());        comment_form_error_msg(event, test,'email','col-erreur','<div style="top:113px;" class="error_email"><p class="ccd3333">Adresse invalide</p></div>');        return test;    }else{        comment_form_error_msg(event, false,'email','col-erreur','<div style="top:113px;" class="error_email"><p class="ccd3333">Ce champ est obligatoire</p></div>');				        return false;    }}jQuery().ready( function () {       jQuery('.clearfix').find('>li').each ( function () {		jQuery(this).hover ( function () {            if (!jQuery(this).hasClass('nohover'))				jQuery(this).addClass('hover');            jQuery(this).find('.col-action').show();		},         function () {            if (!jQuery(this).hasClass('nohover'))				jQuery(this).removeClass('hover');			jQuery(this).find('.col-action').hide();		});	});  	// retour en haut	jQuery('.fleche-haut').click( function() {			jQuery.scrollTo(0,1000);			return false;     });    	jQuery('.action-ajouter, .bouton-action-add, .discussion-anchor').click( function() {            if(jQuery('#commentform').length)                jQuery.scrollTo(jQuery('#commentform').parents('.repondre').find('.com-titre').position().top - navHeight, 800);            else                jQuery.scrollTo(jQuery('.discussion .clearfix').eq(0).position().top - navHeight, 800);                			return false;     });         jQuery('.action-go-comments').click( function() {        if(jQuery('#comments').find('.discussion-bloc').length)			jQuery.scrollTo(jQuery('#comments').position().top - navHeight, 800);        else            jQuery.scrollTo(jQuery('#commentform').parents('.repondre').find('.com-titre').position().top - navHeight, 800);			        return false;     });        /* GM add 21/07/2011 for Premium Clubs */    var current_url = window.location;	var post_anchor = current_url.hash.substring(1);		if( post_anchor != '' && post_anchor.match(/comments/) ){		//global "navHeight" may not be known here:		var localNavHeight = $('.nav').outerHeight(true);		if(jQuery('#comments').find('.discussion-bloc').length)			jQuery.scrollTo(jQuery('#comments').position().top - localNavHeight, 800);        else            jQuery.scrollTo(jQuery('#commentform').parents('.repondre').find('.com-titre').position().top - localNavHeight, 800);	}else if( post_anchor != '' && post_anchor.match(/commentform/) ){		//global "navHeight" may not be known here:		var localNavHeight = $('.nav').outerHeight(true);		if(jQuery('#commentform').length)            jQuery.scrollTo(jQuery('#commentform').parents('.repondre').find('.com-titre').position().top - localNavHeight, 800);        else            jQuery.scrollTo(jQuery('.discussion .clearfix').eq(0).position().top - localNavHeight, 800);	}	/* End GM add 21/07/2011 */    jQuery('.erreur-champ').live('blur',  function() {        var elmt = jQuery(this);        var id = elmt.attr('id');        match = id.match(/comment+/g);        if(id.match(/comment+/g))            tmp = verif_comment(elmt, jQuery(this), jQuery(this));        if(id.match(/author+/g))            tmp = verif_author(elmt, jQuery(this), jQuery(this));        if(id.match(/email+/g))            tmp = verif_email(elmt, jQuery(this), jQuery(this));    });        /* click event on send mail friend */        jQuery('.action_emailthis').click( function() {        Recaptcha.destroy();    });         /* Positions du pav� publicitaire */    var div_pub = jQuery('.article').parents('.gen-col-droite').find('.col-note-pub300x250');    if(jQuery('.article').height() < div_pub.innerHeight()) {        jQuery('.pub-centree').parent('div').show();        jQuery('.pub-centree').append(div_pub.find('object'));        div_pub.hide();    }    else {        div_pub.show();    }     /* Position des notes */    var height_col_note = jQuery('.gen-col-note').height();    jQuery('.article .sup-notes').each( function() {        var sup_note = jQuery(this);        var position_sup_note = sup_note.position().top;        var position_colonne_art = jQuery('.gen-col-article').position().top;        var href_sup_note = sup_note.find('a').attr('href');                var note = jQuery(href_sup_note).parents('.note-contenu');        var position_block = (position_sup_note - position_colonne_art) - (note.innerHeight() - note.height());        // var position_block = (position_sup_note - position_colonne_art);                note.css ({            'top': position_block        });                jQuery('.gen-col-note > div').each( function() {            var div = jQuery(this);            var link_id = div.find('a').attr('id');            var sup_id = href_sup_note.replace('#', '');            if(link_id != sup_id) {                var position_div = div.position().top;                var height_div = div.innerHeight();                                if((height_div + position_div) > position_block) {                    console.log(href_sup_note+"("+position_block+") => "+div.attr('class')+" : "+(position_div + height_div));                    position_block = (position_div + height_div);                    note.css ({                        'top': position_block                    });                }            }            else {                return false;            }        });        height_col_note+=note.innerHeight();         note.show();            });    jQuery('.gen-col-note').height(height_col_note);        /* Hover sur les notes */    jQuery('.article .sup-notes').hover(function() {        var sup_note = jQuery(this);        var href_sup_note = sup_note.find('a').attr('href');                jQuery(href_sup_note).addClass('hover');    },    function () {        var sup_note = jQuery(this);        var href_sup_note = sup_note.find('a').attr('href');        jQuery(href_sup_note).removeClass('hover');        //$(this).find('.ligne-actions').removeClass('ligne-actions-on');    });        jQuery('.gen-col-note .note-contenu-detail .note').hover(function() {        var detail_note = jQuery(this);        var href_detail_note = detail_note.attr('href');                jQuery(href_detail_note).addClass('hover');    },    function () {        var detail_note = jQuery(this);        var href_detail_note = detail_note.attr('href');        jQuery(href_detail_note).removeClass('hover');        //$(this).find('.ligne-actions').removeClass('ligne-actions-on');    });          jQuery('.retour-note').click( function() {        position_note = jQuery(jQuery(this).attr('href')).position().top;        position_scroll = position_note - navHeight;        jQuery.scrollTo(position_scroll, 800);        return false;    });        jQuery('.retour-note').click( function() {        position_note = jQuery(jQuery(this).attr('href')).position().top;        position_scroll = position_note - navHeight;        jQuery.scrollTo(position_scroll, 800);        return false;    });        /* Pour une fiche fournisseur */	$('.fournisseur-fiche').each ( function () {		$(this).hover ( function () {			$(this).addClass('fiche-hover');			//$(this).find('.ligne-actions').addClass('ligne-actions-on');					},		function () {			$(this).removeClass('fiche-hover');			//$(this).find('.ligne-actions').removeClass('ligne-actions-on');		});	});		$('.fiche-hover').live ( 'click', function () {		// Tag GA		_gaq.push(['_trackPageview', '/pagesvirtuelles/fournisseurs/'+$(this).find('h1 a').attr('id')]);		// Open new window		window.open($(this).find('h1 a').attr('href'));		return false;	});    });
