/*----------------------------------------------------------------------------//
// Javascript pour le site client  -------------------------------------------//
//----------------------------------------------------------------------------//
// Client : -
// Note   : -
// Date   : -
//----------------------------------------------------------------------------*/

/*----------------------------------------------------------------------------*/
// Inclusion dynamique des fichiers externes javascripts
/*----------------------------------------------------------------------------*/
function importJavascript(src)
{
	document.write("<script type=\"text/javascript\" src=\"" + src + "\"></scr" + "ipt>");
}

/*----------------------------------------------------------------------------*/
// Importations de fichiers
/*----------------------------------------------------------------------------*/
 //importJavascript("/includes/js/plugins/jquery.myslide.sources.js");
 importJavascript("/includes/js/plugins/jquery.ifixpng.js");
 importJavascript("/includes/js/plugins/jquery.equalizeCols.js");
 importJavascript("/includes/js/plugins/jquery.dimensions.js");
 importJavascript("/includes/js/plugins/jquery.innerfade.js");
 importJavascript("/includes/js/sifr.js");
 //importJavascript("/includes/js/plugins/jquery.selectbox-0.3.js");

/*----------------------------------------------------------------------------*/
// Declarations jQuery
/*----------------------------------------------------------------------------*/
$(document).ready(function(){		   
	$.init_slide('ContainerSlideshow','Slideshow',0,0,1000,1,5000,1, "_self");
	$("img#FleursHeader").ifixpng();
	$("div#ConseilBeauteMois ul li:last-child").css("background","none");
	$("div.BlocDegradeContenu div.ProduitVedette:last").css("background","none");
	$("div.BlocDegradeContenu.AjustementContenuGeneral:last").css("margin-bottom","0");
	$('div.BlocPartenaires-Image:nth-child(3n)').css("margin-right","0");
	//$(".SelectBox").selectbox();
	
	// Accordeon 
	$('.accordeon ul').hide();
    var activeMenu = $('#accordeon ul:first');
   activeMenu.show();
    $("a.SubMenu").click(function(){
        //activeMenu.animate({height:'toggle'}, 500);
        activeMenu = $(this).parent().children("ul");
        activeMenu.animate({height:'toggle'}, 500);
    });

// Acordéon trousse
	$('.Accordeon > div').hide();
    var activeMenu = $('.Accordeon div');
    $("a.EnteteAccordeon").click(function(){
        //activeMenu.animate({height:'toggle'}, 500);
		activeMenu = $(this).next();
        activeMenu.animate({height:'toggle'}, 500);
    });

	
        // Egalisation des colonnes
        $('#ColonneSousMenu, #ColonnePrincipaleInt').equalizeCols();
        $('#ColonneVideosGauche, #ColonneVideosDroite').equalizeCols();
        $('#ColonneLargeMode, #ColonnePetiteMode').equalizeCols();
        $('#BlocBasContenuGauche, #BlocBasContenuDroite').equalizeCols();
        $('#BlocGaleriePhotosDroite, #BlocGaleriePhotosGauche').equalizeCols();
	  
        // Fade image
        $('#PhotoExpert').innerfade({ speed: 'slow', timeout: 2000, type: 'sequence', containerheight: '78px' });
        $('#PhotosEmissionTele').innerfade({ speed: 'slow', timeout: 3000, type: 'sequence', containerheight: '167px' });
});
$(window).load(function(){
    $('#q').keypress(function(e){
        if(e.which == 13){
            redirectToSearchPage();
            return false;
        }
    });
    $('.txtInfolettre').keypress(function(e){
        if(e.which == 13){
            $('.btnSubscribe').click();
            return false;
        }
    });
    $('#btnRecherche').click(function(){
        redirectToSearchPage();
        return false;
    });
});

///Pour openAdd
function ShowAdsZone(pZoneId,pSource){
   var m3_u = (location.protocol=='https:'?'https://adsdt.absolunet.com/www/delivery/ajs.php':'http://adsdt.absolunet.com/www/delivery/ajs.php');
   var m3_r = Math.floor(Math.random()*99999999999);
   if (!document.MAX_used) document.MAX_used = ',';
   document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
   document.write ("?zoneid="+pZoneId+"&amp;source="+pSource+"&amp;block=1;");
   document.write ('&amp;cb=' + m3_r);
   if (document.MAX_used != ',') document.write ("&amp;exclude=" + document.MAX_used);
   document.write ("&amp;loc=" + escape(window.location));
   if (document.referrer) document.write ("&amp;referer=" + escape(document.referrer));
   if (document.context) document.write ("&context=" + escape(document.context));
   if (document.mmm_fo) document.write ("&amp;mmm_fo=1");
   document.write ("'><\/scr"+"ipt>");
}

				
/* function to limit the amount of textarea input to 1000 characters */
function check_length(ctrl, maxlength) {
    if(ctrl.pref == null)
        ctrl.pref = "";
    /* get the length of characters currently in the textarea */
    //var x = document.input.the_text.value.length;
    var x = ctrl.value.length;
    /* if user enters less than 1000 characters, ok */
    if(x < maxlength) {
        return true;
    }
    return false;
}

function affichage_popup(chemin)
{
    window.open (chemin,"mywindow","menubar=0,resizable=0,scrollbars=0,width=365,height=440");
}