function lienSpe(l,type,extra){
	extra=(extra ? extra : '');
	if(this.parent.admin && this.parent.site){
		if(type=='admin'){
			parent.document.getElementById("framesetter").cols = "0,100";
		}
		if(type=='site'){			
			parent.document.getElementById("framesetter").cols = "100,0";
			
			parent.site.modele8PopSansLien('<div class="imageChargement"></div>');
			
			parent.site.location.reload(true);
		}
	}
	else{
		if(type=='admin' && extra==''){
			extra='&extraSite='+document.location.href;
		}
		if(type=='site' && extra==''){
			extra='&extraAdmin='+document.location.href;
		}
		lien(l+'?type='+type+extra);
	}
}

function MAZero(idDiv,idIn){
	(idDiv ? idDiv=idDiv : idDiv='');
	(idIn ? idIn=idIn : idIn='');
	
	if(idDiv!='' && $(idDiv)){
		var elDiv = $(idDiv).getElementsByTagName("*");
		
		for (var i=0; i<elDiv.length; i++) {
			if(elDiv[i].tagName=='INPUT' || elDiv[i].tagName=='TEXTAREA'){
				if(elDiv[i].type=='radio' || elDiv[i].type=='checkbox'){
					elDiv[i].checked=false;
				}
				else{
					elDiv[i].value='';
				}
			}
			if(elDiv[i].className == 'mazHidden'){
				elDiv[i].style.display='none';
			}
		}
	}
	else if(idIn!='' && $(idIn)){
		if($(idIn).type=='radio' || $(idIn).type=='checkbox'){
			$(idIn).checked=false;
		}
		else{
			$(idIn).value='';
		}
	}
}

function array_search( needle, haystack, strict ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // *     example 1: array_search('zonneveld', {firstname: 'kevin', middle: 'van', surname: 'zonneveld'});
    // *     returns 1: 'surname'
 
    var strict = !!strict;
 
    for(var key in haystack){
        if( (strict && haystack[key] === needle) || (!strict && haystack[key] == needle) ){
            return key;
        }
    }
 
    return false;
}


	
	
	
	

function format(valeur,decimal,separateur) {
// formate un chiffre avec 'decimal' chiffres après la virgule et un separateur
	var deci=Math.round( Math.pow(10,decimal)*(Math.abs(valeur)-Math.floor(Math.abs(valeur)))) ; 
	var val=Math.floor(Math.abs(valeur));
	if ((decimal==0)||(deci==Math.pow(10,decimal))) {val=Math.floor(Math.abs(valeur)); deci=0;}
	var val_format=val+"";
	var nb=val_format.length;
	for (var i=1;i<4;i++) {
		if (val>=Math.pow(10,(3*i))) {
			val_format=val_format.substring(0,nb-(3*i))+separateur+val_format.substring(nb-(3*i));
		}
	}
	if (decimal>0) {
		var decim=""; 
		for (var j=0;j<(decimal-deci.toString().length);j++) {decim+="0";}
		deci=decim+deci.toString();
		val_format=val_format+"."+deci;
	}
	if (parseFloat(valeur)<0) {val_format="-"+val_format;}
	return val_format;
}


	
	
	
	

function totalReservation(e){
	montant=parseFloat(document.getElementById('montant').value);
	guide=parseFloat(document.getElementById('guide').value);
	
	if(document.getElementById('montant').value!=''){
		assurance='';
		if(document.getElementById('assO').checked){
			assurance=montant*3/100;
		}
		
		if(document.getElementById('guide').value=='')
			guide=0;
			
		total=montant+guide+assurance;
		acompte=total*40/100;
		reste=total-acompte;
		
		document.getElementById('total').value=format(total,2,' ');
		document.getElementById('acompte').value=format(acompte,2,' ');
		document.getElementById('solde').value=format(reste,2,' ');
		document.getElementById('ass').value=format(assurance,2,' ');
	}
}


	
	
	
	

function verifCheckBateau(idVerif){
	document.getElementById(idVerif).value='';

	i=1;
	while(i<=7){
		id='choix['+i+']';
		//alert(id);
		if(document.getElementById(id).checked)
			document.getElementById(idVerif).value='ok';
		i++;
	}
		
}


	
	
	
	

function loadSelect(idForm){
	document.getElementById(idForm).submit();
}


	
	
	
	

function majAuto(idCheck,id){
	elt=document.getElementById(idCheck);
	
	if(elt.checked==1)
		dis="disabled";
	else
		dis="";
		
	document.getElementById('TAUX'+id).disabled=dis;
	document.getElementById('dateTauxD_d'+id).disabled=dis;
	document.getElementById('dateTauxD_m'+id).disabled=dis;
	document.getElementById('dateTauxD_y'+id).disabled=dis;
	document.getElementById('dateTauxF_d'+id).disabled=dis;
	document.getElementById('dateTauxF_m'+id).disabled=dis;
	document.getElementById('dateTauxF_y'+id).disabled=dis;
}


	
	
	
	

function submitContratForm(id){
	alert(id);
	document.forms[id].submit();
}


	
	
	
	

function OnlyNumber(e){
	var IE5 = false;

	if (!e) var e = window.event;
	if (e.keyCode) { IE5= true; code = e.keyCode;}
	else if (e.which) code = e.which ;
	
	//test du code
	if ((code < 48 || code > 57)&&(code!=46))
	{
		if(IE5) e.returnValue = false;
		else e.preventDefault();
	}
} 


	
	
	
	

function testMdpVisiteur(tb,label,non,oui){
	base=window.document;
	if(base.getElementById(non).checked==true){
		invisible(label);
		invisible(tb);
		base.getElementById(tb).value='      ';
	}
	if(base.getElementById(oui).checked==true){
		visible(label);
		visible(tb);
		base.getElementById(tb).value='';
	}
}

	
	
	
	

function visible(id){
	document.getElementById(id).style.display='inline';
}


	
	
	
	

function invisible(id){
	document.getElementById(id).style.display='none';
}


	
	
	
	

function verif_form( min, max, id, mod ) {
	a = $(id).value;

	if ( $R( min, max ).include( $F(id) ) == false )
	{
		if ( !mod )
		{
			alert( min + " <==> " + max);
		}
		
		$(id).value = min;
		
		return false;
	}
	else
	{
		return true;
	}
}


	
	
	
	

function isArray(obj) {
   if (obj.constructor.toString().indexOf("Array") == -1)
      return false;
   else
      return true;
}


	
	
	
	

function validSubmit( element_ )
{
	var error = "";
		element_.each
		(
			function( element )
			{
				if(typeof(element)=='object'){
					var test=false;var test2=true;
					element2=element;
					element.each
					(
						function( elementBis ){
							if($(elementBis)){
								if($(elementBis).checked)
									test=true;
							}
							else
								test2=false;
						}
					);
					
					if(test==false && test2){
						error='ERREUR';
						element2.each
						(
							function( elementBis2 ){
								if($(elementBis2)){
									$(elementBis2).up(1).addClassName( "error" );
								}
							}
						);
					}
					else{
						element2.each
						(
							function( elementBis2 ){
								if($(elementBis2)){
									$(elementBis2).up(1).removeClassName( "error" );
								}
							}
						);
					}
				}
				else if($(element)){
					if ( element=='pwd' && $F('pwd'))
					{
						if ( $('pwd').value.length < 6 )
						{
							error += tabJsMessage[1];
							$('pwd').up(1).addClassName( "error" );
							$('pwd').focus();
						}
						else if($F('email_inscr')==$F('pwd'))
						{
							error += tabJsMessage[2];
							$('pwd').up(1).addClassName( "error" );
							$('email_inscr').up(1).addClassName( "error" );
							$('pwd').focus();
						}
						else
						{
							$('pwd').up(1).removeClassName( "error" );
						}
					}
					else if ( element=='email_inscr' )
					{
						var reg = /^[a-z0-9._-]+@[a-z0-9.-]{2,}[.][a-z]{2,3}$/;
						if ( !$F(element) )
						{
							error += tabJsMessage[3];
							$(element).up(1).addClassName( "error" );
							$(element).focus();
						}
						else if(reg.exec($F(element))==null)
						{
							error += tabJsMessage[4];
							$(element).up(1).addClassName( "error" );
							$(element).focus();
						}
						else
						{
							$(element).up(1).removeClassName( "error" );
						}
					}
					else if ( !$F(element) )
					{
						error += element + tabJsMessage[5];
						$(element).up(1).addClassName( "error" );
						$(element).focus();
					}
					/* else if ( !$F(element) && ($($(element).className) ? $($(element).className).style.display : '')!='none')
					{
						error += element + tabJsMessage[5];
						$(element).up(1).addClassName( "error" );
						$(element).focus();
					} */
					else
					{
						$(element).up(1).removeClassName( "error" );
					}
				}
			}
		);
		
		/*if ( $('nss') )
		{
			if ( $('nss').value.length != 15 )
			{
				error += "Votre numéro de Sécurité Sociale doit contenir 15 caractères.\n";
				$('nss').up(1).addClassName( "error" );
				$('nss').focus();
			}
			else
			{
				$('nss').up(1).removeClassName( "error" );
			}
		}*/
	
	if ( error )
	{
		//alert( error );
		
		return false;
	}
	else
	{
		modele8PopSansLien('<div class="imageChargement"></div>');
		return true;
	}
}


	
	
	
	

sfHover = function()
{
	try{
	var sfEls = document.getElementById( "menuHaut" ).getElementsByTagName( "LI" );
	
	for ( var i = 0; i < sfEls.length; i ++ )
	{
		sfEls[i].onmouseover = function()
		{
			this.className += " sfhover";
		}
		
		sfEls[i].onmouseout = function()
		{
			this.className = this.className.replace( new RegExp( " sfhover\\b" ), "" );
		}
	}
	}
	catch(e){}
}

/*if ( window.attachEvent )
{
	window.attachEvent( "onload", sfHover );
}*/


	
	
	
	

function confirmSimple(lien,txt){
	var test=confirm(txt);
	if(test)
		document.location.href=lien;
}


	
	
	
	

function confirmSuppr(lien){
	var test=confirm('Supprimer cette reservation?');
	if(test)
		document.location.href=lien;
}


	
	
	
	

function confirmSupprUser(lien){
	var test=confirm(tabJsMessage[6]);
	if(test)
		document.location.href=lien;
}


	
	
	
	

function confirmRepre(lien){
	var test=confirm('Voulez-vous créer un représentant?');
	if(test)
		document.location.href=lien;
}


	
	
	
	

function confirmContactModif(t){
	var test=confirm(tabJsMessage[7]);
	if(test)
		document.location.href=t;
}


	
	
	
	

function demandeNomInvitation(txtDiv,txtId,id,action,target){
	var testPwInvit='';
	if(document.getElementById(txtId))
		testPwInvit=document.getElementById(txtId).value;
		
	if(testPwInvit || txtId==''){
		if(txtDiv!='')modele8PopSansLien('<div class="imageChargement"></div>');
		document.getElementById(id).target=target;
		document.getElementById(id).action=action;
		document.getElementById(id).submit();
	}
	else
		document.getElementById(txtDiv).style.backgroundColor='red';
}


	
	
	
	

function lien(l){
	document.location.href=l;
}


	
	
	
	

function lienForm(l){
	tabTemp=l.split(':');
	if(tabTemp[0]=='http')
		nvelleFenetre(l);
	else
		document.location.href=l;
}


	
	
	
	

function actionForm(id,action){
	document.getElementById(id).action=action;
	document.getElementById(id).submit();
}


	
	
	
	

function confirmForm(type,id){
	var test=confirm(tabJsMessage[8]+type+"?");
	if(test)
		document.getElementById(id).submit();
}


	
	
	
	

function confimLien(lien, mess){
	var test=confirm(mess);
	if(test)
		document.location.href=lien;
}


	
	
	
	

function nvelleFenetre(chem){
	if(chem!='./vide' && chem!='../vide' && chem!="./")
		open(chem);
}


	
	
	
	

function messageInfo(m){
	alert(m);
}


	
	
	
	

function optionInfo(m,id){
	if(document.getElementById(id).value!=0)
		alert(m);
}


	
	
	
	

idInput=1;
function getInput(type,v,eltDiv,eltInput,width){
	//alert(eltInput+idInput);
	//alert(eltDiv);
	var insertion = new Insertion.Bottom(eltDiv,'<input type="'+type+'" name="'+eltInput+idInput+'" id="'+eltInput+idInput+'" value="'+v+'" size="'+width+'px"/><br/>');
	idInput++;
}


	
	
	
	

idInputB=new Array;
function getInputB(type,v,eltDiv,eltInput,width,id){
	if(!idInputB[id])
		idInputB[id]=1;
	//alert(eltInput+idInput);
	//alert(eltDiv);
	var insertion = new Insertion.Bottom(eltDiv,'<hr/><input type="'+type+'" name="'+eltInput+idInputB[id]+'" id="'+eltInput+idInputB[id]+'" value="'+v+'" style="'+width+'"/><br/>');
	idInputB[id]++;
}


	
	
	
	

idInputC=new Array;
function getInputC(type,v,eltDiv,eltInput,width,id,sc,img,alt){
	(img ? img=img : img='');
	(alt ? alt=alt : alt='');
	if(!idInputC[id])
		idInputC[id]=1;
	//alert(eltInput+idInput);
	//alert(eltDiv);
	sc=str_replace('johnny', idInputC[id], sc);
	
	var insertion = new Insertion.Bottom(eltDiv,'<img src="'+img+'" alt="'+alt+'"/><input type="'+type+'" name="'+eltInput+idInputC[id]+'" id="'+eltInput+idInputC[id]+'" value="'+v+'" style="'+width+'" '+sc+'/>');
	idInputC[id]++;
}


	
	
	
	

idInputD=new Array;
function getInputD(type,v,eltDiv,eltInput,width,id,cl){
	if(!idInputD[id])
		idInputD[id]=1;
	//alert(eltInput+idInput);
	//alert(eltDiv);
	var insertion = new Insertion.Bottom(eltDiv,'<input type="'+type+'" name="'+eltInput+idInputD[id]+'" id="'+eltInput+idInputD[id]+'" value="'+v+'" style="'+width+'" class="'+cl+'"/><br/>');
	idInputD[id]++;
}


	
	
	
	

idInputE=new Array;
function getInputE(type,v,eltDiv,eltInput,width,id,sc,img,alt){
	(img ? img=img : img='');
	(alt ? alt=alt : alt='');
	if(!idInputE[id])
		idInputE[id]=1;
	//alert(eltInput+idInput);
	//alert(eltDiv);
	sc=str_replace('johnny', idInputE[id], sc);
	
	var insertion = new Insertion.Bottom(eltDiv,'<img src="'+img+'" alt="'+alt+'"/><input type="'+type+'" name="'+eltInput+idInputE[id]+'" id="'+eltInput+idInputE[id]+'" value="'+v+'" style="'+width+'" '+sc+'/>');
	idInputE[id]++;
}


	
	
	
	

idInputF=new Array;
function getInputF(type,v,eltDiv,eltInput,width,id,cl){
	if(!idInputF[id])
		idInputF[id]=1;
	//alert(eltInput+idInput);
	//alert(eltDiv);
	var insertion = new Insertion.Bottom(eltDiv,'<input type="'+type+'" name="'+eltInput+idInputF[id]+'" id="'+eltInput+idInputF[id]+'" value="'+v+'" style="'+width+'" class="'+cl+'"/><br/>');
	idInputF[id]++;
}


	
	
	
	

function toggleIE(id){
	if(document.getElementById(id).style.display!='none')
		document.getElementById(id).style.display='none';
	else
		document.getElementById(id).style.display='block';
}


	
	
	
	

function block_show( val )
{
	$(val).show();
}


	
	
	
	

function block_hide( val,fct)
{
	if(typeof(fct)=='function'){
		fct(val);
		fct('',val);
	}
		
	$(val).hide();
}


	
	
	
	

function class_hide( tag,val )
{
	tab=getElementsByClass(tag,val);
	i=0;
	while(i<tab.length){
		tab[i].style.display='none';
		i++;
	}
}


	
	
	
	

function getColorEx(id,color){
	document.getElementById(id).style.backgroundColor=color;
}


	
	
	
	

function str_replace(a, b, str) {
    return str_replace2(str, a, b);
}


	
	
	
	

function str_replace2(SRs, SRt, SRu) {
  /*
  **  Replace a token in a string
  **    s  string to be processed
  **    t  token to be found and removed
  **    u  token to be inserted
  **  returns new String
  */
  SRRi = SRs.indexOf(SRt);
  SRRr = '';
  if (SRRi == -1) return SRs;
  SRRr += SRs.substring(0,SRRi) + SRu;
  if ( SRRi + SRt.length < SRs.length)
    SRRr += str_replace2(SRs.substring(SRRi + SRt.length, SRs.length), SRt, SRu);
  return SRRr;
}


	
	
	
	

function getElementsByClass(tag, cl){
	var elements = document.getElementsByTagName(tag);
	
	var results = new Array();
	for(var i=0; i<elements.length; i++){
		if(elements[i].className == cl){
			results[results.length] = elements[i];
		}
	}
	return results;
}


	
	
	
	

function copy_clip(inElement)
{
if(window.clipboardData)
	window.clipboardData.setData('Text',inElement);
} 

