// version 15	15/10/2003
var mES=null
var mSessionTimeOut=10
var mRollOver=true
//var mSiteName=''
//var mBaseURL=''
function init(sessionTimeOut,siteName,baseURL) {
	mSessionTimeOut=(sessionTimeOut==null)? 10 : sessionTimeOut
	mSiteName=(siteName==null)? '' : siteName
	mBaseURL=(baseURL==null)? '' : baseURL
	mES=document.images.entretienSession
	if (mES!=null) setTimeout('sessionContinue()',mSessionTimeOut*1000*60/2)
}

//entretien session
function sessionContinue() {
	mES.src="BO/images/blank.gif"
	mES.src="BO/entretienSession.asp"
	setTimeout('sessionContinue()',mSessionTimeOut*1000*60/2)
}

//chargement d'une image
function preloadIMG(url) {
	var img=new Image()
	img.src=url
	return img
}

//fenetrage
function popup(URL,NAME,WIDTH,HEIGHT,SCROLLBARS) {
	if (window.event) window.event.cancelBubble=true
	if (SCROLLBARS==null) SCROLLBARS='yes'
	if (SCROLLBARS=='no' & navigator.appName=='Opera') SCROLLBARS='yes'
	var majURL=URL.toUpperCase()
	if (majURL.indexOf('DOC.ASP')!=-1 | majURL.indexOf('.JPG')!=-1 | majURL.indexOf('.GIF')!=-1 | majURL.indexOf('.PNG')!=-1) {
		if (WIDTH==null) WIDTH=640
		if (HEIGHT==null) HEIGHT=480
		NAME=(NAME==null | NAME=='')? 'IMG' : NAME
		var w = window.open('',NAME,'width='+WIDTH+',height='+HEIGHT+',resizable=yes,scrollbars=yes')
		var svURL=URL
		with (w.document) {
			write("<html><head><title>"+mSiteName+" - img</title>\n")
			write('<base href="'+mBaseURL+'">\n')
			write("<script language='JavaScript'>\n")
			write("IE5=NN4=NN6=false;\n")
			write("if(document.all)IE5=true;\n")
			write("else if(document.getElementById)NN6=true;\n")
			write("else if(document.layers)NN4=true;\n")
			write("function autoSize() {\n")
			write("var H=document.images[0].height\n")
			write("H=(H>(screen.height*4/5))? (screen.height*4/5):H\n")

			write("var L=document.images[0].width\n")
			write("if(IE5) self.resizeTo(L+29,H+31);\n")
			write("if(NN6) self.resizeTo(L+23,H+29);\n")
			write("else window.resizeTo(L+29,H+31);\n")
			write("self.focus();\n")
			write("}\n</scri")
			write("pt>\n")
			write('</head><body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 onLoad="javascript:autoSize();">')
			write('<a href="javascript:window.close()"><img src="'+svURL+'" border=0 alt=Fermer></a>')
			write("</body></html>")
			close()
		}
	}
	else {
		if (WIDTH==null) WIDTH=800
		if (HEIGHT==null) HEIGHT=480
		window.open(URL,NAME,'width='+WIDTH+',height='+HEIGHT+',location=no,toolbar=no,scrollbars='+SCROLLBARS+',resizable=yes')
	}
	return false
}

//barre de lecture
function over(obj) {
	obj.id=obj.id.replace(/Out/gi,'Over')
}
function out(obj) {
	obj.id=obj.id.replace(/Over/gi,'Out')
}

//mailForm
function mailFormVerif(myForm) {
	var ok=true
	var elm
	var mess=''
	var ctr=0
	var pubNom
	for (var x=0;x<myForm.elements.length;x++) {
		elm=myForm.elements[x]
		pubNom=elm.name.replace('_obligatoire','')
		if (elm.value=='') {
			if (elm.name.indexOf('_obligatoire')!=-1) {
				if (ctr==0) elm.focus()
				ok=false ; ctr=1
				mess+=pubNom+' doit être saisi.\n'
			}
		}
		else {
			if (elm.name.indexOf('eMail')!=-1) {
				//var reg=/\w{2,}\.?\w{1,}@\w{2,}\.\w{2,}/
				var reg=/^([a-zA-Z0-9]+([-_]?[a-zA-Z0-9]+)*.)*[a-zA-Z0-9]+([-_]?[a-zA-Z0-9]+)*@([a-zA-Z0-9]+([-_]?[a-zA-Z0-9]+)*.)+[a-zA-Z]{2,4}$/i
				if (!reg.test(elm.value)) {
					if (ctr==0) elm.focus()
					ok=false ; ctr=1
					mess+=pubNom+' n\'est pas correct.\n'
				}
			}
		}
	}
	if (!ok) alert(mess)
	// Test traitement particulier pour certains clients (cf ROUSSEY)
	if (ok) {
	    if (document.getElementById('DIVPART')) {
	      document.getElementById('ContenuDivHidden').value = document.getElementById('DIVPART').innerHTML;
	      document.getElementById('DIVPART').innerHTML = "";
	    }
	}
	
	return ok
}

// Formulaire forum tourisme en FRANCAIS
function verifFormForumTourisme() {
if (document.formForumTourisme.nompers.value=='') {
	window.alert('Le nom est obligatoire');
	document.formForumTourisme.nompers.focus();
	return false;
}
if (document.formForumTourisme.adresse1.value=='') {
	window.alert('L\'adresse est obligatoire');
	document.formForumTourisme.adresse1.focus();
	return false;
}
if (document.formForumTourisme.cp.value=='') {
	window.alert('Le code postal est obligatoire');
	document.formForumTourisme.cp.focus();
	return false;
}
if (document.formForumTourisme.ville.value=='') {
	window.alert('La ville est obligatoire');
	document.formForumTourisme.ville.focus();
	return false;
}
if (document.formForumTourisme.email.value=='') {
	window.alert('L\'adresse mail est obligatoire');
	document.formForumTourisme.email.focus();
	return false;
}
else {
	var reg=/^([a-zA-Z0-9]+([-_]?[a-zA-Z0-9]+)*.)*[a-zA-Z0-9]+([-_]?[a-zA-Z0-9]+)*@([a-zA-Z0-9]+([-_]?[a-zA-Z0-9]+)*.)+[a-zA-Z]{2,4}$/i
	if (!reg.test(document.formForumTourisme.email.value)) {
		window.alert('L\'adresse mail est incorrecte');
		document.formForumTourisme.email.select();
		document.formForumTourisme.email.focus();
		return false;
	}
}
return true;
}
// Fin formulaire forum tourisme en FRANCAIS

// Formulaire forum tourisme en ANGLAIS
function verifFormForumTourismeUK() {
if (document.formForumTourisme.nompers.value=='') {
	window.alert('Name is required');
	document.formForumTourisme.nompers.focus();
	return false;
}
if (document.formForumTourisme.adresse1.value=='') {
	window.alert('Address is required');
	document.formForumTourisme.adresse1.focus();
	return false;
}
if (document.formForumTourisme.cp.value=='') {
	window.alert('Zip code is required');
	document.formForumTourisme.cp.focus();
	return false;
}
if (document.formForumTourisme.ville.value=='') {
	window.alert('City is required');
	document.formForumTourisme.ville.focus();
	return false;
}
if (document.formForumTourisme.email.value=='') {
	window.alert('E-mail is required');
	document.formForumTourisme.email.focus();
	return false;
}
else {
	var reg=/^([a-zA-Z0-9]+([-_]?[a-zA-Z0-9]+)*.)*[a-zA-Z0-9]+([-_]?[a-zA-Z0-9]+)*@([a-zA-Z0-9]+([-_]?[a-zA-Z0-9]+)*.)+[a-zA-Z]{2,4}$/i
	if (!reg.test(document.formForumTourisme.email.value)) {
		window.alert('E-mail is wrong');
		document.formForumTourisme.email.select();
		document.formForumTourisme.email.focus();
		return false;
	}
}
return true;
}
// Fin formulaire forum tourisme en ANGLAIS

//fenêtre modale + refresh
function modalDialog(URL) {
	if (showModalDialog) {
		var resolutionX=screen.availWidth*3/5
		var resolutionY=screen.availHeight*4/5
		if (resolutionX<800) resolutionX=800
		if (resolutionY<600) resolutionY=600
		args='dialogWidth:'+resolutionX+'px; dialogHeight:'+resolutionY+'px;edge: Sunken; center: Yes; help: Yes; resizable: Yes; status: No;'
		showModalDialog(URL,'',args)
		document.location.reload()
	}
	else {
		alert("IE est nécessaire")
	}
	return false
}

//gestion bottomMess s'il existe
var bottomMessTimeout=null
function moveBottomMess() {
	var obj=null
	obj=document.getElementById('bottomMess')
	if (obj) {
		with (obj.style) {
			position='absolute'
			width='100%'
			left=document.body.clientWidth+document.body.scrollLeft-obj.offsetWidth-1
			top=document.body.clientHeight+document.body.scrollTop-obj.offsetHeight-1
		}
		clearTimeout(bottomMessTimeout)
		bottomMessTimeout=setTimeout('moveBottomMess()',1000)
	}
}

//scroll up/down de la page
var okscroll=false
var godown
function scrollPage() {
	if (okscroll) {
		if (godown) {
			window.scrollBy(0,4)
		} 
		else {
			window.scrollBy(0,-4)
		}
		moveBottomMess()
		setTimeout('scrollPage()', 40)
	}
}

//mise en valeur résultat recherche
function rSearch(find) {
	try {
		if (find.length>1) {
			var range=document.selection.createRange()
			range.select()
			var bookMark=range.getBookmark()
			range.findText(find)
			while (range.boundingWidth>0) {
				range.select()
				range.pasteHTML('<span class=rSearch>'+range.text+'</span>')
				range.collapse(false)
				range.findText(find)
			}
			range.moveToBookmark(bookMark)
		}
	}
	catch (e) {}
}

//ajout de fonctions...
Date.prototype.getWeek = function() {
     var dayDiff=this-new Date(this.getFullYear(),0,0);
     var tempDays=Math.floor(dayDiff/86400000)-(this.getDay()-7)%7;
     return tempDays>365? 1: Math.ceil(tempDays/7);
}

//signature MD5
var hex_chr_MD5 = "0123456789ABCDEF";
function rhex_MD5(num)
{
  str = "";
  for(j = 0; j <= 3; j++)
    str += hex_chr_MD5.charAt((num >> (j * 8 + 4)) & 0x0F) +
           hex_chr_MD5.charAt((num >> (j * 8)) & 0x0F);
  return str;
}
function str2blks_MD5(str)
{
  nblk = ((str.length + 8) >> 6) + 1;
  blks = new Array(nblk * 16);
  for(i = 0; i < nblk * 16; i++) blks[i] = 0;
  for(i = 0; i < str.length; i++)
    blks[i >> 2] |= str.charCodeAt(i) << ((i % 4) * 8);
  blks[i >> 2] |= 0x80 << ((i % 4) * 8);
  blks[nblk * 16 - 2] = str.length * 8;
  return blks;
}
function add_MD5(x, y)
{
  var lsw = (x & 0xFFFF) + (y & 0xFFFF);
  var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
  return (msw << 16) | (lsw & 0xFFFF);
}
function rol_MD5(num, cnt)
{
  return (num << cnt) | (num >>> (32 - cnt));
}
function cmn_MD5(q, a, b, x, s, t)
{
  return add_MD5(rol_MD5(add_MD5(add_MD5(a, q), add_MD5(x, t)), s), b);
}
function ff_MD5(a, b, c, d, x, s, t)
{
  return cmn_MD5((b & c) | ((~b) & d), a, b, x, s, t);
}
function gg_MD5(a, b, c, d, x, s, t)
{
  return cmn_MD5((b & d) | (c & (~d)), a, b, x, s, t);
}
function hh_MD5(a, b, c, d, x, s, t)
{
  return cmn_MD5(b ^ c ^ d, a, b, x, s, t);
}
function ii_MD5(a, b, c, d, x, s, t)
{
  return cmn_MD5(c ^ (b | (~d)), a, b, x, s, t);
}
function MD5(str)
{
  x = str2blks_MD5(str);
  a =  1732584193;
  b = -271733879;
  c = -1732584194;
  d =  271733878;

  for(i = 0; i < x.length; i += 16)
  {
    olda = a;
    oldb = b;
    oldc = c;
    oldd = d;

    a = ff_MD5(a, b, c, d, x[i+ 0], 7 , -680876936);
    d = ff_MD5(d, a, b, c, x[i+ 1], 12, -389564586);
    c = ff_MD5(c, d, a, b, x[i+ 2], 17,  606105819);
    b = ff_MD5(b, c, d, a, x[i+ 3], 22, -1044525330);
    a = ff_MD5(a, b, c, d, x[i+ 4], 7 , -176418897);
    d = ff_MD5(d, a, b, c, x[i+ 5], 12,  1200080426);
    c = ff_MD5(c, d, a, b, x[i+ 6], 17, -1473231341);
    b = ff_MD5(b, c, d, a, x[i+ 7], 22, -45705983);
    a = ff_MD5(a, b, c, d, x[i+ 8], 7 ,  1770035416);
    d = ff_MD5(d, a, b, c, x[i+ 9], 12, -1958414417);
    c = ff_MD5(c, d, a, b, x[i+10], 17, -42063);
    b = ff_MD5(b, c, d, a, x[i+11], 22, -1990404162);
    a = ff_MD5(a, b, c, d, x[i+12], 7 ,  1804603682);
    d = ff_MD5(d, a, b, c, x[i+13], 12, -40341101);
    c = ff_MD5(c, d, a, b, x[i+14], 17, -1502002290);
    b = ff_MD5(b, c, d, a, x[i+15], 22,  1236535329);    

    a = gg_MD5(a, b, c, d, x[i+ 1], 5 , -165796510);
    d = gg_MD5(d, a, b, c, x[i+ 6], 9 , -1069501632);
    c = gg_MD5(c, d, a, b, x[i+11], 14,  643717713);
    b = gg_MD5(b, c, d, a, x[i+ 0], 20, -373897302);
    a = gg_MD5(a, b, c, d, x[i+ 5], 5 , -701558691);
    d = gg_MD5(d, a, b, c, x[i+10], 9 ,  38016083);
    c = gg_MD5(c, d, a, b, x[i+15], 14, -660478335);
    b = gg_MD5(b, c, d, a, x[i+ 4], 20, -405537848);
    a = gg_MD5(a, b, c, d, x[i+ 9], 5 ,  568446438);
    d = gg_MD5(d, a, b, c, x[i+14], 9 , -1019803690);
    c = gg_MD5(c, d, a, b, x[i+ 3], 14, -187363961);
    b = gg_MD5(b, c, d, a, x[i+ 8], 20,  1163531501);
    a = gg_MD5(a, b, c, d, x[i+13], 5 , -1444681467);
    d = gg_MD5(d, a, b, c, x[i+ 2], 9 , -51403784);
    c = gg_MD5(c, d, a, b, x[i+ 7], 14,  1735328473);
    b = gg_MD5(b, c, d, a, x[i+12], 20, -1926607734);
    
    a = hh_MD5(a, b, c, d, x[i+ 5], 4 , -378558);
    d = hh_MD5(d, a, b, c, x[i+ 8], 11, -2022574463);
    c = hh_MD5(c, d, a, b, x[i+11], 16,  1839030562);
    b = hh_MD5(b, c, d, a, x[i+14], 23, -35309556);
    a = hh_MD5(a, b, c, d, x[i+ 1], 4 , -1530992060);
    d = hh_MD5(d, a, b, c, x[i+ 4], 11,  1272893353);
    c = hh_MD5(c, d, a, b, x[i+ 7], 16, -155497632);
    b = hh_MD5(b, c, d, a, x[i+10], 23, -1094730640);
    a = hh_MD5(a, b, c, d, x[i+13], 4 ,  681279174);
    d = hh_MD5(d, a, b, c, x[i+ 0], 11, -358537222);
    c = hh_MD5(c, d, a, b, x[i+ 3], 16, -722521979);
    b = hh_MD5(b, c, d, a, x[i+ 6], 23,  76029189);
    a = hh_MD5(a, b, c, d, x[i+ 9], 4 , -640364487);
    d = hh_MD5(d, a, b, c, x[i+12], 11, -421815835);
    c = hh_MD5(c, d, a, b, x[i+15], 16,  530742520);
    b = hh_MD5(b, c, d, a, x[i+ 2], 23, -995338651);

    a = ii_MD5(a, b, c, d, x[i+ 0], 6 , -198630844);
    d = ii_MD5(d, a, b, c, x[i+ 7], 10,  1126891415);
    c = ii_MD5(c, d, a, b, x[i+14], 15, -1416354905);
    b = ii_MD5(b, c, d, a, x[i+ 5], 21, -57434055);
    a = ii_MD5(a, b, c, d, x[i+12], 6 ,  1700485571);
    d = ii_MD5(d, a, b, c, x[i+ 3], 10, -1894986606);
    c = ii_MD5(c, d, a, b, x[i+10], 15, -1051523);
    b = ii_MD5(b, c, d, a, x[i+ 1], 21, -2054922799);
    a = ii_MD5(a, b, c, d, x[i+ 8], 6 ,  1873313359);
    d = ii_MD5(d, a, b, c, x[i+15], 10, -30611744);
    c = ii_MD5(c, d, a, b, x[i+ 6], 15, -1560198380);
    b = ii_MD5(b, c, d, a, x[i+13], 21,  1309151649);
    a = ii_MD5(a, b, c, d, x[i+ 4], 6 , -145523070);
    d = ii_MD5(d, a, b, c, x[i+11], 10, -1120210379);
    c = ii_MD5(c, d, a, b, x[i+ 2], 15,  718787259);
    b = ii_MD5(b, c, d, a, x[i+ 9], 21, -343485551);

    a = add_MD5(a, olda);
    b = add_MD5(b, oldb);
    c = add_MD5(c, oldc);
    d = add_MD5(d, oldd);
  }
  return rhex_MD5(a) + rhex_MD5(b) + rhex_MD5(c) + rhex_MD5(d);
}


