//////////////////////////////////////////
/*
class Bulle = creer une bulle d'info sur l'element indiqué si le nom d'un id commence par 'h_' l'evenement sera mouseover sinon focus
::_donnee = stucture : nom prop=id de l'element, val prop=texte a afficher
::_esp = _espace par rapport a l'element en px
::_css = class css(facultatif)
*/
function Bulle(_donnee, _esp, _css){  	
	this.bulle_html;
    this.tmp; 
	this.donnee;
	this.esp;
	this.css;
	var _this;
	
    this.init = function(){			
		this.donnee=_donnee;		
		this.esp=_esp;
		this.css=_css;
		this.tmp=0; 
		this.bulle_html='<iframe  id="ifr_bul" frameborder="0" scrolling="no" style="position:absolute;width:0px;height:0px;display:none;z-index:10000"></iframe><div  style="background-color:#777777;display:none;width:auto;position:absolute;z-index:10005;top:0px;left:0px;opacity:0.5" id="div_ombre"></div><div '+((this.css && this.css!='')?' class="'+this.css+'" ':'')+' style="display:none;width:auto;position:absolute;z-index:10010;top:0px;left:0px" id="div_bul"></div>';
		_this=this;
		
		$('body').prepend(this.bulle_html);
        for(var p in this.donnee){	
            if(p.indexOf('h_')!=-1){
            	$('#'+p).mouseover(_this.showBull);
				$('#'+p).click(_this.hideBull);
			}else{
				$('#'+p).focus(_this.showBull);
			}
			$('#'+p).mouseout(_this.fadeOutBull);
            $('#'+p).blur(_this.hideBull);			
						
        }
        if(!this.css || this.css==''){
			$('#div_bul').css('border','1px solid #CCCCCC').css('background-color','#FFFFFF');
		}	
		document.onclick = function(){_this.hideBull();}
    }
    
    this.showBull = function(ev){ 	
  		if(!ev.target.activ){
			_this.hideBull();							
			$('#div_bul').html(_this.donnee[ev.target.id]);
			$('#div_bul').show();	
			_this.posBull(ev);
			$('#div_bul').hide();
			$('#div_bul,#ifr_bul,#div_ombre').fadeIn('speed');
			//ev.target.activ=1;
		}
    }
    
    this.fadeOutBull = function(e){
		switch(e.type){
			case 'mouseout':
				temp=2000;
			break;
			case 'click':
				temp=100;
			break;
			case 'blur':
				temp=100;
			break;
			default:
				temp=3000;
			break;
		}
		if(_this.tmp>0){clearTimeout(_this.tmp);_this.tmp=0;}
		if($('#div_bul')[0].style.display!='none')_this.tmp = setTimeout(function(){$('#div_bul,#ifr_bul,#div_ombre').fadeOut('speed')},temp);
	}
	
     this.hideBull = function(){
		 if(_this.tmp>0){clearTimeout(_this.tmp);_this.tmp=0;}
		 $('#div_bul,#ifr_bul,#div_ombre').hide();
	}
	 
    this.posBull = function(ev){
		var mouse_top = (document.all)?mousey:mousey-window.document.body.scrollTop;
		var mouse_left = (document.all)?mousex:mousex-document.body.scrollLeft;
		var fen_width = document.body.clientWidth;
		var div_h = $('#div_bul').height(); 
		var div_w = $('#div_bul').width();
		var _top = (mouse_top < div_h+this.esp)?mouse_top+document.body.scrollTop+(this.esp/2):mouse_top+document.body.scrollTop-(this.esp+div_h);
		var _left = (fen_width < mouse_left+div_w)?mouse_left+document.body.scrollLeft-div_w:mouse_left+document.body.scrollLeft-20;	
		$('#div_bul,#ifr_bul').css('top',_top);
		$('#div_bul,#ifr_bul').css('left',_left); 
		$('#div_ombre').css('top',_top+4);
		$('#div_ombre').css('left',_left+4);
		$('#ifr_bul,#div_ombre').height(div_h+parseInt($('#div_bul').css('padding-bottom'))+parseInt($('#div_bul').css('padding-top')));
		$('#ifr_bul,#div_ombre').width(div_w+parseInt($('#div_bul').css('padding-left'))+parseInt($('#div_bul').css('padding-right')));
	}    	
    this.init();
}

 
 
 /*
class Astuce = affiche les astuces
::donnee = proprietes : indexées à partir de 1 contenant les textes des astuces 
::nb_jour = entier : indiquant le nombre de jours que l'astuce n'apparaît pas

<iframe frameborder="no" src="../../fondifr.html" allowtransparency="true"  style="display:block;position:absolute;width:100%;height:100%;top:0px;left:0px;z-index:999;opacity:0.8;background-color:#FFFFE8;" id="div_astuce_ifr"></iframe>
margin-bottom:2%;
margin-left:5%;
margin-right:5%;
margin-top:3%;
text-align:left;
*/
var Astuce = function (donnee,nb_jour,lang){  
	var idx = total_prop=0;
	var page_name = document.title;
	var ouvert = false;
    this.init = function(){
		for(var p in donnee)total_prop++;		
		astuce_html='<div id="div_astuce_fond" class="transp80" style="background-color:#DDD;position:absolute"></div>'
					+'<div align="center" class="arial_vert_gras" style="display:block;position:absolute;margin:10% 15% 20% 15%;top:0px;left:0px;z-index:1000;background-color:#FFFFAA;color:#FF0000;width:70%;height:auto" id="div_astuce">'
					+'<div  style="border:2px solid #000000;width:100%;height:100% " ><div id="close_astuce" class="close_astuce" style="margin:4px 3px 10px 10px;cursor:pointer;float:right">&nbsp;</div><div id="div_astuce_title" style="margin:10px 0 10px 30px;font-size:14px;float:center">INFORMATION</div><div class="mini_mini"  style="font-weight:bold;font-family:verdana;font-size:11px;margin:3% 5% 2% 5%;text-align:justify;" id="div_astuce_content">'+donnee[++idx]+'</div>';
		if(total_prop>1)astuce_html+='<div id="switch" style="margin:2px 0 8px 0;text-align:center"><a id="g" class="arial_petit_rouge" style="width:30px" href="javascript:void(0)" ><<</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="arial_petit_rouge" style="width:30px"  id="d"  href="javascript:void(0)">>></a></div>';
		astuce_html+='</div></div>';
		$('body').prepend(astuce_html);			
		if(IE){
			setTimeout(function(){$('#div_astuce_fond').height('100%').width('100%');},800);
		}else{
			$('#div_astuce_fond').height('100%').width('100%');
		}		
		$('#div_astuce #switch a').each(function(e){this.onclick = this.switchAstuce;});		
		$('#div_astuce #close_astuce').click(this.closeAstuce); 
		ouvert = true;
    }    
   
   this.switchAstuce = function(){
		if(this.id=='d' && idx<total_prop)$('#div_astuce_content').fadeIn(250).html(donnee[++idx]); else if(this.id=='g' && idx>1) $('#div_astuce_content').fadeIn(250).html(donnee[--idx]);
	}
   
  this.closeAstuce = function(){
	  if(ouvert){
		$('#div_astuce').fadeOut('speed');
		$('#div_astuce_fond').fadeOut('speed');
		if(typeof nb_jour != 'undefined')set_cookie('astuce_'+page_name, 1, nb_jour);
		ouvert=false;
	  }
	}
    if(read_cookie('astuce_'+page_name)==null)this.init();
}


 /*
class Aide = affiche l'aide onpress de la touche " ² " et au survol de l'element ou  sur le focus, mais l'aide reste bloquée sur l'element focussé
::donnee = stucture : nom prop=id de l'element, val prop=texte a afficher
::css = class css (facultatif)
*/
var Aide = function (donnee,css){  	
	aide_html='<div align="center" style="display:none;position:absolute;width:100%;height:100%;top:0px;left:0px;z-index:1000;background-color:#DDDDDD" id="div_aide">'
				+'AIDE<div '+((css && css!='')?' class="'+css+'" ':'')+' style="margin:20% 0" id="div_aide_content"></div><div id="close_aide" style="margin:10px;cursor:pointer">FERMER AIDE</div></div>';
	id_activ = '';
	bloc_aide_focus=false;
	
    init = function(){
		$('body').prepend(aide_html); 
		$('#div_aide #close_aide').click(closeAide); 
		for(var p in donnee){                 
            $('#'+p).focus(activId);
            $('#'+p).blur(deActivId); 
            $('#'+p).mouseover(activId);   
            $('#'+p).mouseout(deActivId);       
        }
		
    }    
	
	activId = function(e){
		if(!bloc_aide_focus)id_activ = e.target.id;
		if(e.type == 'focus')bloc_aide_focus=true;	
	}
	
	deActivId = function(e){
		if(e.type == 'blur')bloc_aide_focus=false;
		if(!bloc_aide_focus)id_activ = '';		
	}
   
   
    matchKey = function(e){
		var code = (window.Event)? e.which : event.keyCode;
		if(code==178)showAide();
	}
	
   showAide= function(){
		if(id_activ!='')$('#div_aide #div_aide_content').text(donnee[id_activ]).parent().show();
	}
   
    closeAide = function(){
		$('#div_aide').fadeOut('speed');
	}
	
	if(window.Event)document.captureEvents(Event.KEYPRESS); 
	document.onkeypress = matchKey;
    init();
}


