/** Questions reponses **/
$(document).ready(function() {
	$("#questions").hide();
	$(".btn_question").click(function () {
	$("#questions").toggle("slow");
	return false;
});

});

/******************************* COLONNES EGALES */

function hauteurEgale(group) {
   tallest = 0;
   group.each(function() {
      thisHeight = $(this).height();
      if(thisHeight > tallest) {
         tallest = thisHeight;
      }
   });
   group.height(tallest);
}


Usage:
$(document).ready(function() {
   hauteurEgale($(".bloc_adresse"));
});

/*****************************MESSAGE ATTENTE********************************/

function MessageAttente() {

$get('lbl_100').innerHTML = "<div id=DIV_LigneArticleCommentaire></div><div id='DIV2_LigneArticleCommentaire' style='TEXT-ALIGN:CENTER; overflow:hidden'><center><img border='0' src='Image/WEB/loading.gif' class='ImgLoading100' /><br><br>Chargement en cours<br>Merci de patienter.</center></div>";
showTextLightbox(150, 150, true);

}



/* checked Adresse compte
--------------------------------*/
function CheckAdresse(Adresse1, Adresse2, Adresse3) {
var mValid = false;
try {
if($('#' + Adresse1).val() !='' ){mValid = true;}
if($('#' + Adresse2).val() !=''){mValid = true;}
if($('#' + Adresse3).val() !='' ){mValid = true;} 
return mValid;
}
catch(ex){return false;}
}

/* repositionner titre page
--------------------------------*/
$(document).ready(function() {
    $('#bloc_titre_page').append($('#TitreHead'));
});

/* caroussel popup article
--------------------------------*/
//$("#slide_popup").tinycarousel({ display: 5 }); // VOIR SI CHARGE APRES AJAX


/* Fonction de debugage InfoDev
--------------------------------*/
function InfoDev(message, cumul) { if (!$('#InfoDev').length) { $('BODY').append('<div id="InfoDev" style="position: absolute; top:0; left:0; font-size:15px;"></div>'); } cumul ? $('#InfoDev').append("<br>" + message) : $('#InfoDev').html(message); }


/* lihoverFix
--------------------------------*/
$(document).ready(function() {
    $('#bloc_list_article li, .bloc_DA_sell ul li, #menu_Catalogue1 li').hover(function() { $(this).addClass("sfhover"); }, function() { $(this).removeClass("sfhover"); });
});


/* Par contexte
--------------------------------*/

$(document).ready(function() {
    var contexte = $("#H_MEM_CONTEXTE").val();
    switch (contexte) {

        case "Accueil": /*############################ CONTEXTE ACCUEIL ###################################*/

            /****** boite a onglets ******/
            $("#bloc_accueil_onglet_menu").facileTabs({ targetElements: ".bloc" });

            /******Caroussel******/
            $('#AccueilSlide').tinycarousel({ pager: true, display: 1, interval: true });

            break;
        case "View": /*############################### CONTEXTE VIEW ######################################*/

            /******Infobule sur bouton panier inactif ou choix taille ******/
            $('.cadeaux_li a[tooltip]').each(function() {
                $(this).qtip({
                    content: $(this).attr('tooltip'), // Use the tooltip attribute of the element for the content
                    style: { tip: true, border: { radius: 5 }, name: 'cream' }, // Give it a crea mstyle to make it stand out
                    position: { corner: { tooltip: 'center', target: 'rightTop'} }
                });
            });
			
			/******************************* ZOOM **********************************/
	
			/*$(function() {
			var option = {
	
			zoomWidth: 300,
			zoomHeight: 300,
			position : 'right',
			xOffset :20,
			yOffset :-37,
			showEffect:'show',
			hideEffect:'fadeout',
			fadeoutSpeed: 'slow'
			}
	
			$(".jqzoom").jqzoom(option);});	
			*/

            /****** Boite à onglets ******/

            $("#bloc_DA_onglet_content .bloc div[id^='sub_'] > div[id^='lbl_'] > div[id^='lbl_']").each(function(i) { if ($(this).html().length < 3) { $(this).parent().parent().remove(); } }); //enlever contenus vides
            $("#bloc_DA_onglet_content .bloc").each(function(i) { if ($(this).html().length < 5) { $("#bloc_DA_onglet_menu li:eq(" + i + ")").addClass("delete"); $(this).remove(); } });
            $("#bloc_DA_onglet_menu li.delete").each(function() { $(this).remove(); });
            $("#bloc_DA_onglet_menu").facileTabs({ targetElements: ".bloc" });    //lancer boite à onglets

            /******Caroussel******/
            $("#slide_fils").tinycarousel({ display: 5 });
            $("#slide_freres").tinycarousel({ display: 5 });
            $("#slide_cousins").tinycarousel({ display: 5 });
            $("#bloc_DA_vignettes").tinycarousel({ display: 4});
            /*$("#bloc_DA_vignettes").tinycarousel({ display: 4, viewport: '#detailArticl_Galr', overview: '#detailArticl_Galr ul' });*/

            /****** zoom ICI et zoom XL ******/
            lancerGallery();




            break;
        case "PageStatique": /*####################### CONTEXTE PAGES SATTIQUES ###########################*/

            break
        case "Identification": /*##################### CONTEXTE IDENTIFICATION ############################*/

            /****** suivi commande******/
            $('.sc_detail').click(function() {
                var $tab1 = $(this).parent().parent().parent().parent('#suivi_commande_liste');
                $tab1.next('.sc_detail_tab').slideToggle('slow');
                return false;
            });

            /****** login (nouveau et ancien compte) ******/
            if ($('#r_compte_old').attr('checked') == true) {
                $('#div_compte_new').hide(); $('#a_compte_old').addClass('checked');
            }
            else {
                $('#div_compte_old').hide(); $('#a_compte_new').addClass('checked');
            }

            $('#a_compte_old').click(function() {
                $('#r_compte_old').attr('checked', 'checked');
                $('#r_compte_new').removeAttr('checked');
                $('#a_compte_old').addClass('checked');
                $('#a_compte_new').removeClass('checked');
                $('#div_compte_new').fadeOut('slow');
                $('#div_compte_old').fadeIn('slow');
            });

            $('#a_compte_new').click(function() {
                $('#r_compte_old').removeAttr('checked');
                $('#r_compte_new').attr('checked', 'checked');
                $('#a_compte_old').removeClass('checked');
                $('#a_compte_new').addClass('checked');
                $('#div_compte_old').fadeOut('slow');
                $('#div_compte_new').fadeIn('slow');
            });


            break
        case "AfficheResultatRechercheAvancee": /*#### CONTEXTE RECHERCHE #################################*/

            /******Caroussel******/
            $("#slide_panier").tinycarousel({ display: 5 });


            break
        case "ValidationPanier": /*################### CONTEXTE PANIER ####################################*/

            /******Point Relais ******/
            $(document).ready(function() {
                $('#gk_listerelais .horaire').each(function(i) {
                    $(this).qtip({
                        content: "<div class='BulleKiala'>" + $('#gk_listerelais p').eq(i).html() + "</div>",
                        show: 'mouseover',
                        hide: 'mouseout',
                        position: { corner: { tooltip: 'bottomMiddle', target: 'topMiddle'} },
                        style: { border: { width: 2, radius: 5, color: '#BAB3B3' }, tip: true, width: '400' }
                    });
                    $(this).click(function() { return false });
                });
            });

            /******Caroussel******/
            $("#slide_panier").tinycarousel({ display: 5 });


            break
        default: /*################################## AUTRES #############################################*/

    }
});

