// JavaScript Document

var leftpromos=400;
tabMenu=new Array();

if(document.URL.indexOf("/fr/")!=-1){tabMenu["base"]=1;tabMenu["bateaux"]=2;tabMenu["tarifs"]=3;tabMenu["planning"]=4;tabMenu["croisieres"]=5;tabMenu["loisirs"]=6;tabMenu["liens"]=7;}
if(document.URL.indexOf("/es/")!=-1){tabMenu["puerto"]=1;tabMenu["barcos"]=2;tabMenu["tarifas"]=3;tabMenu["disponibilidad"]=4;tabMenu["cruceros"]=5;tabMenu["actividades"]=6;tabMenu["vinculos"]=7;}
if(document.URL.indexOf("/de/")!=-1){tabMenu["hafen"]=1;tabMenu["boote"]=2;tabMenu["mietpreise"]=3;tabMenu["verfugbarkeit"]=4;tabMenu["kreuzfahrten"]=5;tabMenu["freizeit"]=6;tabMenu["links"]=7;}
if(document.URL.indexOf("/en/")!=-1){tabMenu["port"]=1;tabMenu["boats"]=2;tabMenu["prices"]=3;tabMenu["availability"]=4;tabMenu["cruise"]=5;tabMenu["activities"]=6;tabMenu["links"]=7;}
function croisiere(x)
{

	if(document.getElementById("cerclecroisiere"))
	{
	   document.getElementById("cerclecroisiere").src="../img/5-"+x+"/cercle.gif";
	   x++;
	   if(x>5)x=2;
	   setTimeout("croisiere("+x+")",3500);
	}
}
function createPromos()
{
	if(document.URL.indexOf("/fr/")!=-1)lg="fr"
	else
	if(document.URL.indexOf("/de/")!=-1)lg="de"
	else
	if(document.URL.indexOf("/en/")!=-1)lg="en"
	else
	if(document.URL.indexOf("/es/")!=-1)lg="es"
	
	switch(lg)
	{
		case "fr": txt="Offres spéciales, cliquez ici! Tél : 05 53 84 72 50";break;
		case "de": txt="Sonderangebote! Tel: 00 33 5 53 84 72 50  Wir sprechen Deutsch!";break;
		case "en": txt="Special offers ! Click here! Tel: 00 33 5 53 84 72 50  We speak English!";break;
		case "es": txt="¡ Ofertas especiales aquí ! Tel : 00 33 5 53 84 72 50  ¡ Hablamos español !";break;
		default: txt="Découvrez nos offres spéciales, cliquez ici";break;
	}
	
	if(document.getElementById("bandepromos"))
	{
		lienPromo=document.createElement("a");
		lienPromo.id="promos";
		switch(lg)
		{
			case "fr": lienPromo.href="http://www.lot-navigation.com/"+lg+"/tarifs-tous.html";break;
			case "de": lienPromo.href="http://www.lot-navigation.com/"+lg+"/mietpreise-alle.html";break;
			case "en": lienPromo.href="http://www.lot-navigation.com/"+lg+"/prices-all.html";break;
			case "es": lienPromo.href="http://www.lot-navigation.com/"+lg+"/tarifas-todos.html";break;
			default: lienPromo.href="http://www.lot-navigation.com/fr/tarifs-tous.html";break;
		}
		
		texteLP=document.createTextNode(txt);
		
		lienPromo.appendChild(texteLP);
		document.getElementById("bandepromos").appendChild(lienPromo);
	
		setInterval(defilePromos,150);
	}
}
function  defilePromos()
{
	if(document.getElementById("promos"))
	{
		leftpromos-=5;
		if(leftpromos<-530)leftpromos=400
		document.getElementById("promos").style.left=leftpromos+"px";
	}
}

//document.body.onload="setInterval(defilePromos,100);"

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}
// JavaScript Document
var tme=new Array(0,0,0,0,0,0,0,0);
var timeMenu=new Array();

//Défilement de la promo
function ftimeMenu(urlPage)
{
	document.getElementById("smenu"+urlPage).style.display="none";
	//document.getElementById("debogue").innerHTML+=tme+"<br/>";
}

var urlCut=document.URL.split("/");
var tabUrl=urlCut[urlCut.length-1].split("-");
var urlSimple=urlCut[urlCut.length-1].substring(0,urlCut[urlCut.length-1].indexOf("."));
//alert(urlSimple);
//var urlPage=tabUrl[0].substring(tabUrl[0].length-1);
var urlPage=tabMenu[tabUrl[0]];
var page;
if(tabUrl[1]) page=tabUrl[1].substring(0,1)
else page=0;
var sPage=tabUrl[0].substring(tabUrl[0].length-2);
var termURL=urlCut[urlCut.length-1].substring(urlCut[urlCut.length-1].indexOf("."));
var langue=urlCut[urlCut.length-2];
	
//Gestion des sous-menus
function sousmenus()
{
	var sm1=new Object;
	sm1.src="../img/fd-sm1.gif";
	var sm=new Object;
	sm.src="../img/fd-sm.gif";
	//alert("m"+urlPage);
	if(document.getElementById("m"+urlPage))
	{
		document.getElementById("m"+urlPage).style.backgroundImage="url(../img/mh/imh-"+urlPage+"2.gif)";
		document.getElementById("m"+urlPage).style.color="white";
	}
	/*if(document.getElementById("m"+urlSimple))
	{
		document.getElementById("m"+urlSimple).style.backgroundImage="url(../img/mh/fd-sm1.gif)";
		document.getElementById("m"+urlSimple).style.color="white";
	}*/
	var z;
	for(z=1 ; z<8 ; z++)
	{
		document.getElementById("m"+z).onmouseover=function()
		{
			for(var k=1;k<8;k++)if(document.getElementById("smenu"+k))document.getElementById("smenu"+k).style.display="none";
			var j=this.id.substring(1);
			if(tme[j]==1)clearTimeout(timeMenu[j]);
			document.getElementById("smenu"+j).style.display="block";
		}
		document.getElementById("m"+z).onmouseout=function()
		{
			var j=this.id.substring(1);
			if(tme)if(tme[j]==1)clearTimeout(timeMenu[j]);
			timeMenu[j]=setTimeout('ftimeMenu("'+j+'")', 500);
			tme[j]=1;
		}
		document.getElementById("smenu"+z).onmouseout=function()
		{
			var j=this.id.substring(5);
			if(tme[j]==1)clearTimeout(timeMenu[j]);
			timeMenu[j]=setTimeout('ftimeMenu("'+j+'")', 500);
			tme[j]=1;
	
		}
		document.getElementById("smenu"+z).onmouseover=function()
		{
			var j=this.id.substring(5);
			if(tme[j]==1)clearTimeout(timeMenu[j]);
			document.getElementById("smenu"+j).style.display="block";
		}
	}
}

//Gestion des menus de droite
function menudroite()
{
	var z;
	for(z=1;z<=6;z++)
	{	
		if(document.getElementById("md"+String(z)))
		{
			if(document.getElementById("md"+String(z)).href==document.URL)
			document.getElementById("md"+String(z)).style.backgroundImage="url(../img/md/md-b.gif)";
		}
	}
}

//Images défilantes
function img()
{
	//alert(sPage);
	if(sPage==1)
	{
		var aleatoire=Math.random()*10;
		var aleajactaest=aleatoire/(10/5);
		var nb=Math.round(aleajactaest);
		//alert(aleatoire+" - "+aleajactaest+" - "+nb);
		if(nb==0)img()
		else
		{
			document.getElementById('colonne-c').style.backgroundImage="url(../img/1-1/base-"+nb+".jpg)";
		}
	}
}

//Clique sur 360°
function qt()
{
	if(document.getElementById("qt"))
	{
		document.getElementById("qt").onclick=function()
		{	
			document.getElementById("fenqt").style.display="block";
			document.getElementById("visite").style.display="none";
			document.getElementById("centre").style.display="none";
			retour();
			return false;
		}
	}
}

//Clique sur 360°
function diapo()
{
	if(document.getElementById("diapo"))
	{
		document.getElementById("diapo").onclick=function()
		{	
			document.getElementById("fendiapo").style.display="block";
			document.getElementById("visite").style.display="none";
			document.getElementById("centre").style.display="none";
			retour();
			return false;
		}
	}
}

var cpt=0;

function fenfunc(adresse)
{
			fen=window.open(adresse, "tarifs", "menubar=no, resizable=no, scrollbars =no, status =no, toolbar=no, width=730, height=165");
			fen.focus();
			//alert(adresse);

			intTarifs=setTimeout("fenfunc('"+adresse+"');cpt++",500);
			
			//alert(cpt);
			if(cpt>=3)clearInterval(intTarifs);
			fen.onUnload=function()
			{clearInterval(intTarifs);alert("unload");}
}

function tarif()
{
	
	if(document.getElementById("tarif"))
	{
		document.getElementById("tarif").onclick=function()
		{
			var adresse=this.href;
			if(adresse.indexOf("#")==-1)
			{
				if(tabUrl[1].indexOf(".")!=-1)tabUrl[1]=tabUrl[1].substring(0,tabUrl[1].indexOf("."));
				adresse+="#"+tabUrl[0]+tabUrl[1];
				if(tabUrl[2])adresse+=tabUrl[2].substring(0,tabUrl[2].indexOf("."));
			}
	//			alert(adresse);
				
			fenfunc(adresse);
			return false;
		}
	}
	else
	if(document.getElementById("tarif2"))
	{
		document.getElementById("tarif2").onclick=function()
		{//alert("tarif2");
			var adresse=this.href;
			if(tabUrl[1].indexOf(".")!=-1)tabUrl[1]=tabUrl[1].substring(0,tabUrl[1].indexOf("."));
			if(adresse.indexOf("#")==-1)adresse+="#"+tabUrl[0]+tabUrl[1]+tabUrl[2].substring(0,tabUrl[2].indexOf("."));
			fenfunc(adresse);
			return false;
		}
	}
}

function flags()
{
	var tabflag=new Array("fr", "de", "en", "es");
	for(var a=0;a<4;a++)
	{
		if(langue!=tabflag[a])
		{
			/*document.getElementById("l"+tabflag[a]).onclick=function()
			{
				this.href="../"+this.id.substring(1)+"/"+urlSimple+termURL;
			}
			document.getElementById("l"+tabflag[a]).onmouseover=function()
			{
				document.getElementById("i"+this.id.substring(1)).src="../img/flags/int-"+this.id.substring(1)+"1.gif";
			}
			document.getElementById("l"+tabflag[a]).onmouseout=function()
			{
				document.getElementById("i"+this.id.substring(1)).src="../img/flags/int-"+this.id.substring(1)+".gif";
			}*/
		}
		else document.getElementById("i"+tabflag[a]).src="../img/flags/int-"+tabflag[a]+"1.gif";
	}
	if(langue=="fr")
	{
		document.getElementById("lfr").onclick=function(){this.href="../"}
	}
	else document.getElementById("laccueil").onclick=function(){this.href="../index-"+langue+".html";}
}

function popup()
{
	for(var i=0; i<document.getElementsByTagName("a").length;i++)
	{
		if(document.getElementsByTagName("a")[i].className=="popup")
		{
			//alert(document.getElementsByTagName("a")[i].className);
			if(document.getElementsByTagName("a")[i].parentNode.parentNode.id=="quicktime")
			document.getElementsByTagName("a")[i].onclick=function()
			{
				var p=window.open(this.href,"popup");p.focus();
				return false;
				
			}
			else
			document.getElementsByTagName("a")[i].onclick=function()
			{
				if(this.id=="blank")
				{
					var p=window.open(this.href,"popup");p.focus();
				}
				else
				{
					var p=window.open(this.href,"popup","resizable=no, location=no, width=500, height=242, menubar=no, status=no, scrollbars=no, menubar=no");p.focus();
				}
				return false;
				
			}
		}
	}
}

function zoom()
{
	var base;
	for(var i=0; i<document.getElementsByTagName("img").length;i++)
	{
		if(document.getElementsByTagName("img")[i].className=="zoom")
		{
			document.getElementsByTagName("img")[i].style.cursor="pointer";
			document.getElementsByTagName("img")[i].onclick=function()
			{
				z=document.createElement("img");
				z.src=this.src.substring(0,this.src.length-4)+"2"+this.src.substring(this.src.length-4);
				z.id="carte2";
				z.style.position="absolute";
				z.style.top="10px";
				z.style.left="10px";
				z.style.border="2px solid white";
				z.style.cursor="pointer";
				z.onclick=function()
				{
					document.getElementById("page").removeChild(z);
				}
				document.getElementById("page").appendChild(z);
			}
			
		}
	}
}

function retour()
{
		 ret=document.URL.replace("#",'');
		// alert(document.getElementsByTagName('a').length);
		 for(var u=0;u<document.getElementsByTagName('a').length;u++)
		 {
			//alert('a');
			 if(document.getElementsByTagName('a')[u].className=="retour")
			 {
			
				 document.getElementsByTagName('a')[u].onclick=function()
				 {window.location=ret;}
			 }
		 }
}

//addLoadEvent(nameOfSomeFunctionToRunOnsPageLoad);
addLoadEvent(function() { createPromos();;});
addLoadEvent(function(){sousmenus();});
addLoadEvent(function(){menudroite();});
//addLoadEvent(function(){img();});
addLoadEvent(function(){qt();});
addLoadEvent(function(){diapo();});
addLoadEvent(function(){tarif();});
addLoadEvent(function(){flags();});
addLoadEvent(function(){croisiere(2);});
addLoadEvent(function(){popup();});
addLoadEvent(function(){zoom();});

// google analitic
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
try
{
var pageTracker = _gat._getTracker("UA-9317390-1");
pageTracker._trackPageview();
}
catch(err) {}


// yahoo
window.ysm_customData = new Object();
window.ysm_customData.conversion = "transId=,currency=,amount=";
var ysm_accountid  = "139498FVUG43T1RMO2BFL9ARM5K";
document.write("<SCR" + "IPT language='JavaScript' type='text/javascript' " 
+ "SRC=//" + "srv3.wa.marketingsolutions.yahoo.com" + "/script/ScriptServlet" + "?aid=" + ysm_accountid 
+ "></SCR" + "IPT>");
