// JavaScript Document

function doWidthChangeMem(elem,startWidth,endWidth,steps,intervals,powr,whichStyle) { 
//Width changer with Memory by www.hesido.com
    if (elem.widthChangeMemInt)
	window.clearInterval(elem.widthChangeMemInt);
    var actStep = 0;
    elem.widthChangeMemInt = window.setInterval(
	function() { 
	  elem.currentWidth = easeInOut(startWidth,endWidth,steps,actStep,powr);
	  //elem.style.paddingBottom = divHeight + "px";
	  //alert(whichStyle);
	  if (whichStyle == "marginTop") elem.style.marginTop = elem.currentWidth + "px";
	  else if (whichStyle == "height") elem.style.height = elem.currentWidth + "px";
	  //elem.setAttribute("style",whichStyle + elem.currentWidth + "px");
	  actStep++;
	  if (actStep > steps){ 
	  	if (whichStyle == "height"){
			var leDivHeight = document.getElementById(elem.id);
			if (leDivHeight.id == "newsletterCenter") var leForm = document.getElementById("newsletterForm");
			if (leDivHeight.id == "containerMap") var leForm = document.getElementById("mapWDest");
			//alert(leForm.id);
			//alert(leDivHeight.style.height);
			if (leDivHeight.style.height == "160px")	leForm.style.display = "block";
			if (leDivHeight.style.height == "168px")	leForm.style.display = "block";
			//else if (leDivHeight.style.height == "1px")	leForm.style.display = "none";
			}
	  	window.clearInterval(elem.widthChangeMemInt);
	  }
	} 
	,intervals)
}

function swapHeight(theDiv,widthDepart,widthFin,whichStyle,boxHeight){
	var leDiv = document.getElementById("newsletterCenter");
	//alert(boxHeight);
	if (leDiv.style.height == "1px") {
		widthChange(theDiv,widthDepart,widthFin,whichStyle);
	}
	else if (leDiv.style.height == "160px"){
		document.getElementById("newsletterForm").style.display = "none";
		widthRestore(theDiv,whichStyle,1);
	}
	}
	
function swapHeightMap(theDiv,widthDepart,widthFin,whichStyle,boxHeight){
	var leDiv = document.getElementById("containerMap");
	//alert (leDiv.style.height);
	if (leDiv.style.height == "41px") {
		document.getElementById("viewMap").style.display = "none";
		document.getElementById("closeMap").style.display = "block";
		widthChange(theDiv,widthDepart,widthFin,whichStyle);
	}
	else if (leDiv.style.height == "168px"){
		document.getElementById("viewMap").style.display = "block";
		document.getElementById("closeMap").style.display = "none";
		document.getElementById("mapWDest").style.display = "none";
		widthRestore(theDiv,whichStyle,41);
	}
	}
	
function widthChange(theDiv,widthDepart,widthFin,whichStyle) {
	var leDiv = document.getElementById(theDiv);
	//alert(leDiv);
    if (!leDiv.currentWidth) leDiv.currentWidth = widthDepart;
	//if no memory is set, set it first;
    doWidthChangeMem(leDiv,leDiv.currentWidth,widthFin,5,5,3,whichStyle);
    } 
function widthRestore(theDiv,whichStyle,widthFin) {
	var leDiv = document.getElementById(theDiv);
    //if (!leDiv.currentWidth) return;
	doWidthChangeMem(leDiv,leDiv.currentWidth,widthFin,10,5,3,whichStyle);
    }
	
function easeInOut(minValue,maxValue,totalSteps,actualStep,powr) {
//Generic Animation Step Value Generator By www.hesido.com
	var delta = maxValue - minValue;
	var stepp = minValue+(Math.pow(((1 / totalSteps)*actualStep),powr)*delta);
	return Math.ceil(stepp)
}

window.onload=montre;
function montre(id) {
var d = document.getElementById(id);
	for (var i = 1; i<=10; i++) {
		if (document.getElementById('descriptionDestMenu'+i)) {document.getElementById('descriptionDestMenu'+i).style.display='none';}
	}
if (d) {d.style.display='block';}
}
function makevisible(cur,which)
{
	if(document.getElementById)
	{
	if (which==0)
		{
		if(document.all)
			cur.filters.alpha.opacity=80
		else
			cur.style.setProperty("-moz-opacity", .8, "");
		}
	else
		{
		if(document.all)
			cur.filters.alpha.opacity=100
		else
			cur.style.setProperty("-moz-opacity", 1, "");
		}
	}
}