/* ------------------------------------------------------------------------
	Class: npc
	Author: Stéphane PERES
	Version: 1.7
------------------------------------------------------------------------- */

// Charger avec JQuery.load() et l'injecter dans le div => désactiver
/*function f_init() {
	$("#zoneTexte").html("Chargement ..."); $("#zoneTexte").load("zoneTexte.html");
}*/

// Espace Imprimante
$(function(){
    $('#print').each(function(){
            var parent = $(this).parent();
            var dTop = $(this).offset().top;
            var elem = $(this);
            $(window).scroll(function(){
                parent.css('position','relative');
                elem.css('position','absolute');
                    if(scrollY()>dTop){
                        elem.stop().animate({top:scrollY()-parent.offset().top+10},300);
                    }else{
                        elem.stop().animate({top:dTop-parent.offset().top},300)
                    }
            });
            if(scrollY()>dTop){
                elem.stop().animate({top:scrollY()-parent.offset().top+10},300);
            }
    });
});

function scrollY() {
	scrOfY = 0;
	if( typeof( window.pageYOffset ) == 'number' ) {
		//Netscape compliant
		scrOfY = window.pageYOffset;
	} else if( document.body && ( document.body.scrollTop ) ) {
		//DOM compliant
		scrOfY = document.body.scrollTop;
	} else if( document.documentElement && ( document.documentElement.scrollTop ) ) {
		//IE6 standards compliant mode
		scrOfY = document.documentElement.scrollTop;
	}
	return scrOfY;
}

// Gestion des langues
function afficheLangue() {
	alert('langue: ' + document.getElementsByTagName("html")[0].getAttribute('lang'));
}

function setLangue(param)
{
	document.getElementsByTagName("html")[0].setAttribute("lang", param);
	return false;
}

function translate(param)
{
	document.getElementById('langForm').lang.value = param;
	document.getElementById('langForm').submit();
	return false;
}


// Texte défilant - page accueil
var tWidth='100%';                  							// width (in pixels)
var tHeight='16px';                  							// height (in pixels)
//var tcolour='#fff';              												// background colour:
var moStop=true;                     							// pause on mouseover (true or false)
var fontfamily = 'helvetica, courrier, arial, sans-serif';		// font for content
var tSpeed=1;                        							// scroll speed (1 = slow, 5 = fast)
var texte_defilant="";											// contenu du texte défilant - défini dans la page appelante; 
var cps=tSpeed;
var aw, mq;
var fsz = parseInt(tHeight) - 4; 

function startticker(){
		if (document.getElementById('ticker')) {
			var tick = '<div style="position:relative;width:'+tWidth+';height:'+tHeight+';overflow:hidden;"';
			if (moStop) tick += ' onmouseover="cps=0" onmouseout="cps=tSpeed"';
			tick +='><div id="mq" style="position:absolute;left:0px;top:0px;font-family:'+fontfamily+';font-size:'+fsz+'px;white-space:nowrap;"><\/div><\/div>';
			document.getElementById('ticker').innerHTML = tick; mq = document.getElementById("mq"); mq.style.left=(parseInt(tWidth)+10)+"px";
			mq.innerHTML='<span id="tx">'+texte_defilant+'<\/span>'; aw = document.getElementById("tx").offsetWidth; lefttime=setInterval("scrollticker()",20);
		}
	}

function scrollticker(){
	mq.style.left = (parseInt(mq.style.left)>(-10 - aw)) ?parseInt(mq.style.left)-cps+"px" : parseInt(tWidth)+10+"px";
} 
window.onload=startticker;

// Menu avocats
function afficherMenu(a) { 
	$(a).fadeIn(300); // Exemple a: '#menu_avocats'
	$(a).show();
}

function masquerMenu(a) {
	$(a).hide(); // Exemple a: '#menu_avocats'
}


// Menu accordeon
$(document).ready( function (){
	// On cache les sous-menus sauf celui qui porte la classe "open_at_load" :
	$("ul.sousMenu:not('.open_at_load')").hide();
	$("li.menu span").each( function () {
		var TexteSpan = $(this).text();
		$(this).replaceWith('<a href="" title="Afficher le sous-menu">' + TexteSpan + '</a>') ;
	}) ;

	$("li.menu > a").click( function () {
		// Si le sous-menu etait deja ouvert, on le referme :
		if ($(this).next("ul.sousMenu:visible").length != 0) {
			$(this).next("ul.sousMenu").slideUp("normal", function () { $(this).parent().removeClass("open") } );
		}
		// Si le sous-menu est cache, on ferme les autres et on l'affiche :
		else {
			$("ul.sousMenu").slideUp("normal", function () { $(this).parent().removeClass("open") } );
			$(this).next("ul.sousMenu").slideDown("normal", function () { $(this).parent().addClass("open") } );
		}
		return false;
	});
}) ;


// Diaporama
$(document).ready(function(){
	$('#news').innerfade({
		animationtype: 'slide',
		speed: 750,
		timeout: 8000,
		type: 'sequence',
		containerheight: '1em'
	});

	$('.dia').innerfade({
		animationtype: 'fade',
		speed: 'slow',
		timeout: 3500,
		type: 'sequence',
		containerheight: '188px',
		containerwidth: '158px',
		bgFrame: 'none',
		controlBox: 'none',
		displayTitle: 'none'
	});
});

// Diaporama 2
$(document).ready(function(){
	$('.dia2').innerfade({
		animationtype: 'fade',
		speed: 'slow',
		timeout: 4500,
		type: 'sequence',
		containerheight: '188px',
		containerwidth: '158px',
		bgFrame: 'none',
		controlBox: 'none',
		displayTitle: 'none'
	});
});

// Diaporama 3
$(document).ready(function(){
	$('.dia3').innerfade({
		animationtype: 'fade',
		speed: 'slow',
		timeout: 7000,
		type: 'sequence',
		containerheight: '188px',
		containerwidth: '158px',
		bgFrame: 'none',
		controlBox: 'none',
		displayTitle: 'none'
	});
});


ascenseur = {
	init : function(btn,acacher){			
		$(acacher).hide();
		$(btn).click(function(){
			$(acacher).slideToggle(500);
			return false;
		});
	} // correction erreur: présence ','
}


function lien(monLien){
	window.open(monLien, '_blank');
	return false;
}


/* ------------------------------------------------------------------------
	Class: AffichageDate
	Author: Stéphane PERES
	Version: 1.2
------------------------------------------------------------------------- */

eval(function(p,a,c,k,e,r){e=function(c){return c.toString(a)};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('3 7(){0 a=1 4;0 b=a.p();0 c=a.2();0 d=1 5("6","fé8","9","g","h","i","j","kût","l","m","n","déo");0 e=a.q();0 f=a.r();$("#s").u(e+" "+d[c]+" "+b);v w}',33,33,'var|new|getMonth|function|Date|Array|janvier|afficheDate|vrier|mars|||||||avril|mai|juin|juillet|ao|septembre|octobre|novembre|cembre|getFullYear|getDate|getDay|dateactuelle||html|return|false'.split('|'),0,{}))

