function switchurl(url){
	//baseurl=document.location.href;
	//if(baseurl.indexOf('www.airtransat.com')!=-1){document.location=url;}else{window.open(url);}
	document.location=url;
}

// Dhtml Programs
pageloading = false;
cancelMenuTimeout=null;

function init()
	{
	
	atpromos_init();
	
	}


function oldinit()
	{
	initlayers();
	preloadImages();
	
	
	pageloading = true;
	
	
	}

function preloadImages() {
	
}

function atpromos_init() {
	//stub
}
function anim()
	{
	for(m=1;m<8;m++)
		{
		divanim = eval("menu" + m);
		bozo = divanim.clipto - divanim.getclipbottom();
		if(bozo)
			{
			divanim.setclipbottom(Math.floor(divanim.getclipbottom()+(bozo/1.3)));
			}
		else
			{
			divanim.hide();
			}
		}
	}

function hidemenu2()
	{
	if(ismac) this.hide();
	else this.clipto = 19;
	}

function showmenu2()
	{
	if(ismac) this.show();
	else this.clipto = this.getheight();
	}
	
function hidemenu3(zeDiv)
	{
	if(ismac) zeDiv.hide();
	else zeDiv.clipto = 19;
	}

function showmenu3(zeDiv)
	{
	if(ismac) zeDiv.show();
	else zeDiv.clipto = zeDiv.getheight();
	}
	
function showmenu(id)
	{
	clearTimeout(cancelMenuTimeout);
	var showmenudiv;
	for(m=1;m<8;m++){ 
		if (id == 'menu'+m){
			showmenudiv = eval(id);
			showmenudiv.show();
			showmenudiv.clipto = showmenudiv.getheight();
		}
	}
	cancelMenuTimeout=setTimeout("hideMenuExept('"+id+"')",100);
	}
	
function hideMenuExept(id){
	for(m=1;m<8;m++){ 
		if (id != 'menu'+m){
			showmenudiv = eval('menu'+m);
			hidemenu('menu'+m);
		}
	}

}

	
function hidemenu(id)
	{
	var hidemenu = eval(id)
	if(ismac) hidemenu.hide();
	else hidemenu.clipto = 19;
	}

var debut, fin, langid, lastid

// fonction qui permet de passer a la page equivalente dans une autre langue 
var langRedirect = 0;
function changelangue(langid,lastid)
	{
	var template = document.location.href;
	debut  =  template.slice(0,template.lastIndexOf(lastid));
	debut  += langid;
	fin    =  template.slice((template.lastIndexOf(lastid) + 4),template.length);
	if(langRedirect) fin = fin.substring(0,fin.indexOf("?"));
	if(template.indexOf("Eschedule") != -1 ) {
		template = template.substring(0,template.indexOf("Eschedule")+10);
		
		document.location = template + "esched2-" + langid.substring(1,3) + ".asp";
		}
	else document.location.href = (debut + fin);
	} 

// fonction pour changer les images des sous sous section 
function rollover(nameid) { document['igs' + nameid].src = "/images/li_l3_on.gif" }
function rollout(nameid) { document['igs' + nameid].src = "/images/li_l3_off.gif" }



// function called by some files in shared_content

function showWin(url,w,h,s) {
	var ow; ow=window.open(url,"win",'status=1,scrollbars=' + s + ',width=' + w + ',height=' + h);
	try { ow.focus(); } catch(e) {}
}




// fonction open window pour la sous-section "notre flotte"
function openWin(url,w,h,s){var ow; ow=window.open(url,"win",'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=' + s + ',resizable=0,width=' + w + ',height=' + h + ',top=20,left=20');ow.focus();}
function openWin2(url,w,h,s){window.open(url,"win2",'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=' + s + ',resizable=0,width=' + w + ',height=' + h + ',top=20,left=20')}
function openWin3(url,w,h,s){window.open(url,"win3",'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=' + s + ',resizable=0,width=' + w + ',height=' + h + ',top=20,left=20')}

function open_window(url,w,h)
{
window.open(url,"win",'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=0,resizable=0,width=' + w + ',height=' + h + ',top=20,left=20')
}

function open_map(url,w,h)
{
window.open(url,"win",'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width=' + w + ',height=' + h + ',top=20,left=20')
}

function xmltarget(url)
	{
//	window.open(url,"fromxml",toolbar=1,location=1,directories=1,status=1,menubar=1,resizable=1,'width=' + windowwidth-20 + ',height=' + windowheight + ',top=20,left=20')
	window.open(url,"fromxml",'width=780, height=500,toolbar=1,location=1,directories=1,status=1,menubar=1,resizable=1,scrollbars=1')
	}

function xmlnavtarget(url)
	{
//	window.open(url,"fromxml",toolbar=1,location=1,directories=1,status=1,menubar=1,resizable=1,scrollbars=1,'width=' + windowwidth-20 + ',height=' + windowheight + ',top=20,left=20')
	window.open(url,"fromxml",'width=790,height=500,toolbar=1,location=1,directories=1,status=1,menubar=1,resizable=1,scrollbars=1')
	}

// Pop windows pour les produits

// Screen Postion
function position(object,h,y,e)
	{
	if(isns4)
		{
		if ((e.y + h) > (window.pageYOffset + window.innerHeight))
			{
			y = ((window.innerHeight - h) + window.pageYOffset - 4)
			}
		else
			{
			y = y - 4
			}
		}
		
	else if(isie)
		{
		e = window.event;
		if ((e.y+document.body.scrollTop+h) > (document.body.scrollTop + document.body.clientHeight))
			{
		    y = ((document.body.clientHeight - h) + document.body.scrollTop - 4)
			}
	    else
			{
			y = y - 4 
			}
		}
		
	object.setxy(170,y);		
	}

	
// Coordonate and html write
function zoom(id,width,heigh,state,e)
	{
	if(pageloading)
		{
		if(isie)
			{
			x = window.event.x+document.body.scrollLeft;
			y = window.event.y+document.body.scrollTop-20;
			}
		else
			{
			x = e.pageX;
			y = e.pageY-25;
			}
		
		product.html("<table bgcolor=00BFF3 cellpadding=1 cellspacing=0 border=0><tr><td><img src='../images/prod/" + id + ".jpg' onLoad='zoomshow()' height=" + heigh + " width=" + width + "></td></tr></table>\n");
		zoomanim.html("<table bgcolor='00BFF3' cellpadding='1' cellspacing='0' border='0'><tr><td><table width=" + width + " height=" + heigh + " cellpadding=0 cellspacing=1 border=0 bgcolor=ffffff><tr><td valign=middle align=center><img src=\"../images/loading.gif\" width=46 height=6 border=0></td></tr></table></td></tr></table>\n");
		position(zoomanim,heigh,y,e);
		position(product,heigh,y,e);
		zoomanim.show();
		product.show();
		}
	}

function zoomout(id,state,e)
	{
	if(pageloading)
		{
		zoomanim.hide();
		product.hide();	
		}
	}
	
function zoomshow()
	{
	zoomanim.hide();
	product.show();	
	}

function popWin(url,w,h,scroll,name)
	{
  	var str = "height=" + h + ",innerHeight=" + h;
	str += ",width=" + w + ",innerWidth=" + w;
	if (window.screen) 
		{
		var ah = screen.availHeight - 30;
		var aw = screen.availWidth - 10;

		var xc = (aw - w) / 2;
		var yc = (ah - h) / 2;

		str += ",left=" + xc + ",screenX=" + xc;
		str += ",top=" + yc + ",screenY=" + yc;
		}
		if(!name) name = "pop";
		pop = window.open(url,name,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=' + scroll + ',resizable=0,' + str);
	}
	
// code from Dreamweaver
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

