//------------------------------------------------------------------------------------
// Script Notice Légale
//------------------------------------------------------------------------------------
function showCPR(s) {
       var y = new Date().getYear();
       if (y<1900) y+=1900;
       if (s!=y)
          document.write(s + " - " + y);
	       else
          document.write(y);
}
//------------------------------------------------------------------------------------
// Test champs formulaire
//------------------------------------------------------------------------------------
function verifCode(obj) {
       return (obj.value == "") || (obj.value.length == 5 && !isNaN(obj.value));
	   //si le champ est vide, je retourne vrai (parce que ca n est pas un champ obligatoire)
	   // ou si le champ a une longueur de 5 caractères et que c'est un nombre, je returne vrai
}

function isEmail(obj) {
       if (obj.value.indexOf(" ") + "" == "-1"
       && obj.value.indexOf("@") + "" != "-1"
       && (obj.value.lastIndexOf(".") > obj.value.indexOf("@"))
       && obj.value != "") return true;
       else return false;
}
function isTel(obj) {
	if (isNaN(obj.value)==false && obj.value.length==10)  return true;
	else return false;
}
//------------------------------------------------------------------------------------
// FixFlash
//------------------------------------------------------------------------------------
function fixFlash1(s) { document.write(s);}
//------------------------------------------------------------------------------------
// Cache mail
//------------------------------------------------------------------------------------
function CacheMail(mail, domain) {
    this.location = 'mailto:' + mail + '@' + domain;
}

profLastDataID = "";
partLastDataID = "";
function changeImageTitre(id,str, str1, idData,cs) {
  var div = document.getElementById(id);
  div.innerHTML = str+"<br />"+str1;
  var div1 = document.getElementById(idData);
  div1.style.display = "block";
  if (cs==1) {
	  if (profLastDataID!="" && profLastDataID!=idData) {
        var div2 = document.getElementById(profLastDataID);
	    div2.style.display = "none";
	  }
	  profLastDataID = idData;
  } else {
	  if (partLastDataID!="" && profLastDataID!=idData) {
        var div2 = document.getElementById(partLastDataID);
	    div2.style.display = "none";
	  }
	  partLastDataID = idData;
  }
  
}

function toFieldLen(val, fld, len) {
  if (val.length==len) {
	eval("document." + fld + ".focus();");
  }
}

function checkKeyFull(field, evt, fld, len) {
	if (checkKey(field, evt)) {
		if ((field.value).length==len) {
			eval("document." + fld + ".focus();");
		}
		return true;
	} else return false;
}

function checkKey(field, evt) {
  var keyCode = 
    document.layers ? evt.which :
    document.all ? event.keyCode :
    document.getElementById ? evt.keyCode : 0;
  //alert(keyCode);
  if ((document.all || document.getElementById) && evt.shiftKey) {
    if (keyCode == 9) return true;
	return false;
  }
  if (document.layers && evt.modifiers & event.SHIFT_MASK) {
    if (keyCode == 9) return true;
	return false;
  }
  // 0 .. 9, 0 .. 9 on right keyboard, Backspace, Tab, End, Home, Left Arrow, Right Arrow, Del button
  if ((keyCode > 47 && keyCode < 58) || (keyCode > 95 && keyCode < 106) || keyCode == 8 || keyCode == 9 || keyCode == 35 || keyCode == 36 || keyCode == 37 || keyCode == 39  || keyCode == 46) return true;
  return false;
}

function setChkBtn(fldName,setIndex,maxIndex) {
 var i, t;
 t = eval("document." + fldName + setIndex + ".checked");
 if (t) {
  for (i=1; i<=maxIndex; i++) 
   if (i!=setIndex) eval("document." + fldName + i + ".checked = false;");
 }
}

function TestParam(Form) 
{
	if (Form.eNom.value == "") 
		{ alert("Attention, le nom est nécessaire"); Form.eNom.focus(); return }
	if (Form.ePrenom.value == "") 
		{ alert("Attention, le prénom est nécessaire"); Form.ePrenom.focus(); return }
	if (!isEmail(Form.eEmail))
		{ alert("Merci d'indiquer un email correct"); Form.eEmail.focus(); return }
	//if (Form.eSociate.value=="")
	//	{ alert("Attention, le profession est nécessaire"); Form.eEmail.focus(); return }	
	if (Form.eTel.value != "" && (Form.eTel.value).length!=10)
		{ alert("Attention, le téléphone est nécessaire"); Form.eTel.focus(); return }	
	if (!verifCode(Form.eCodePostal))
		{ alert("Merci d'indiquer un code postal correct"); Form.eCodePostal.focus(); return }
	if (Form.eMessage.value == "")
		{ alert("Attention, le champ 'Message' doit être renseigné."); Form.eMessage.focus();
			return }
	if (Form.eCaptcha.value == "")
		{ alert("Merci de saisir les caractères indiqués par l'image"); Form.eCaptcha.focus(); return; }

	Form.submit();															
}

function openPopup(url, width, height, scrollbars, resizeable){
    window.open(url,'popup','width='+width+', height='+height+', scrollbars='+scrollbars+', resizeable='+resizeable+'')
}

function OpenClose(id)
{
	f = 0;
	if (document.getElementById(id).style.display == "none") 
	{
		f=1;
		document.getElementById(id).style.display='block';
	}
	if ((document.getElementById(id).style.display == "block")&&(f==0)) document.getElementById(id).style.display='none';
}
	
	
//SCROLLING TEXT

i = 0
var speed = 1
var flag = false;
function scroll_up() {
if (flag) clearTimeout(t1);
flag = true;
var div = document.getElementById("pictures")
if (i<=div.scrollHeight - 230) i = i + speed
div.scrollTop = i
//if (i > div.scrollHeight - 80) {i = 0}
t1=setTimeout("scroll_up()",1)
}

function scroll_down() {
if (flag) clearTimeout(t1);
flag = true;
if (i>0) i = i - speed;
var div = document.getElementById("pictures")
div.scrollTop = i
//if (i > div.scrollHeight - 80) {i = 0}
t1=setTimeout("scroll_down()",1)
}

//-------------------------------------------------------------------------------
// Fonction Captcha()
//-------------------------------------------------------------------------------
function RefreshCaptcha() {
	var i = new Image();
	var d = new Date();
	i.src = '/Includes/modCaptcha.asp?Type=4&Dt=' + d.getHours().toString() + d.getMinutes().toString() + d.getSeconds().toString() ;
	$("Captcha").src =  i.src;
}

function GetID(id) { return document.getElementById(id); } 
function montrerFenetre(src) {
    var overlay = GetID('overlay');
    overlay.style.visibility = "visible";

	var my_image = GetID('img');
	my_image.src = src;
	
	var my_window = GetID('window');
	my_window.style.visibility = "visible";
}

function cacherFenetre() {
    var overlay = GetID('overlay');
    overlay.style.visibility = "hidden";

	var my_window = GetID('window');
	my_window.style.visibility = "hidden";
}


function montrerFenetre(src,id_div,id_img) {
    var overlay = GetID('overlay');
    overlay.style.visibility = "visible";

	var my_image = GetID(id_img);
	my_image.src = src;
	
	var my_window = GetID(id_div);
	my_window.style.visibility = "visible";
}

<!-- PreLoad Wait - Script -->	
			function waitPreloadPage() { //DOM
			if (document.getElementById){
			document.getElementById('prepage').style.visibility='hidden';
			document.getElementById('options1').style.display = "block";
			}else{
			if (document.layers){ //NS4
			document.prepage.visibility = 'hidden';
			}
			else { //IE4
			document.all.prepage.style.visibility = 'hidden';
			}
			}
			}
		// End -->
		
		
		function getY( oElement )
		{
		var iReturnValue = 0;
		while( oElement != null ) {
		iReturnValue += oElement.offsetLeft;
		oElement = oElement.offsetParent;
		}
		return iReturnValue;
		}	