// JavaScript Document

function switchlang(lang) {

//try{
//	location.href=document.getElementById('otherLang').innerHTML;
//	}
//	catch(e){}

//temporary fix for demo
var	address=document.location.href.toString();
// exceptions list for secondary pages not in comms sections (temp only)
var address_array = address.split("\/");
var section=address_array[4];
var page=address_array[5];
//alert(section+" "+page);
if (section=="aviation.training" || section=="military" || section=="public.safety" || section=="sim.products") {
	if (page!="home.asp") {
		return;
	}
}

if (lang=="fr") {
	var new_address=address.replace(/\/en\//,"\/fr\/");
	}
else {
	var new_address=address.replace(/\/fr\//,"\/en\/");
	}
document.location= new_address;
}


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')?'block':(v=='hide')?'none':v; }
    obj.display=v; }
}

function openVideoWin(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function showPDF(zeURL,name,features) {
	var ppdf=window.open(zeURL,'zePDF','width=700,height=500,scrollbars=1,resizable=1'); 
	
	try { ppdf.focus(); } catch(e) {}
	
}

function popNews(zeURL) {
	var pnews=window.open(zeURL,'thenews','width=720,height=600,scrollbars=1,resizable=1,toolbar=0,location=0'); 
	
	try { pnews.focus(); } catch(e) {}
	
	return false;
	
}

function popForm(zeURL) {
	var pform=window.open(zeURL,'theform','width=425,height=450,scrollbars=0,resizable=1,toolbar=0,location=0'); 
	
	try { pform.focus(); } catch(e) {}
	
	return false;
	
}


function showSearch(lang,val) {

    location.href = "/" + lang + "/search/index.aspx?search=" + escape(val);
}




// show/hide slide
function showSlide (divID) {
	document.getElementById(divID).style.display="block";
}

function hideSlide (divID) {
	document.getElementById(divID).style.display="none";
}
// end function



function ajouterEventLoad (func) {
    var oldload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            oldload();
            func();
        }
        return;
    }
}







// collapsing sections
function trigger_effect(src_element,div_id, effect){
		Effect.toggle(div_id, effect, {duration: .15, afterFinish:function(){
		image = src_element.getElementsByTagName('img')[0];
		image.src = image.src.match('/_img/icon.more.gif') ? '/_img/icon.less.gif' : '/_img/icon.more.gif';
		}});
		return true;
	}



function deployElementOnLoad(zedivname) {
	trigger_effect(document.getElementById(zedivname+'Parent'),document.getElementById(zedivname),'blind');
}