﻿var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();
var fix = 0;
if (BrowserDetect.browser == "Explorer") {
	fix = 1;
}

function resetMenu(cobj){
	if (cobj.id == "a0"){
		xrc = cobj.src.substring(0,(cobj.src.lastIndexOf("/")+1));
		document.getElementById("a1").src = xrc+"m_02.jpg";
		document.getElementById("a2").src = xrc+"m_05.jpg";
		document.getElementById("a3").src = xrc+"m_04.jpg";
		document.getElementById("a5").src = xrc+"m_03.jpg";
	}
	if (cobj.id == "a1"){
		xrc = cobj.src.substring(0,(cobj.src.lastIndexOf("/")+1));
		document.getElementById("a0").src = xrc+"m_01.jpg";
		document.getElementById("a2").src = xrc+"m_05.jpg";
		document.getElementById("a3").src = xrc+"m_04.jpg";
		document.getElementById("a5").src = xrc+"m_03.jpg";
	}
	if (cobj.id == "a2"){
		xrc = cobj.src.substring(0,(cobj.src.lastIndexOf("/")+1));
		document.getElementById("a1").src = xrc+"m_02.jpg";
		document.getElementById("a0").src = xrc+"m_01.jpg";
		document.getElementById("a3").src = xrc+"m_04.jpg";
		document.getElementById("a5").src = xrc+"m_03.jpg";
	}
	if (cobj.id == "a3"){
		xrc = cobj.src.substring(0,(cobj.src.lastIndexOf("/")+1));
		document.getElementById("a1").src = xrc+"m_02.jpg";
		document.getElementById("a2").src = xrc+"m_05.jpg";
		document.getElementById("a0").src = xrc+"m_01.jpg";
		document.getElementById("a3").src = xrc+"m_04.jpg";
		document.getElementById("a5").src = xrc+"m_03.jpg";
		
	}
	if (cobj.id == "a5"){
		xrc = cobj.src.substring(0,(cobj.src.lastIndexOf("/")+1));
		document.getElementById("a1").src = xrc+"m_02.jpg";
		document.getElementById("a2").src = xrc+"m_05.jpg";
		document.getElementById("a0").src = xrc+"m_01.jpg";
		document.getElementById("a3").src = xrc+"m_04.jpg";
	}
	if(crimg != ""){
		document.getElementById(crobj).src = xrc+crimg;
	}
}

function setAll(){
	
	xrc = document.getElementById("a0").src.substring(0,(document.getElementById("a0").src.lastIndexOf("/")+1));
	document.getElementById("a0").src = xrc+"m_01.jpg";
	document.getElementById("a1").src = xrc+"m_02.jpg";
	document.getElementById("a2").src = xrc+"m_05.jpg";
	document.getElementById("a3").src = xrc+"m_04.jpg";
	document.getElementById("a5").src = xrc+"m_03.jpg";
	if(crimg != ""){
		document.getElementById(crobj).src = xrc+crimg;
	}
}
//Contents for menu 1
var menu1=new Array()
menu1[0]='<ul>'; //do not remove this line
menu1[1]='<li><a href="010101.asp">Line Maintenance</a></li>'
menu1[2]='<li><a href="010201.asp">Base Maintenance</a></li>'
menu1[3]='<li><a href="010301.asp">Overhaul Workshops</a></li>'
menu1[4]='<li><a href="010401.asp">Power Plant</a></li>'
menu1[5]='<li><a href="0104011.asp">Engine Test Cell</a></li>'
menu1[6]='<li><a href="010501.asp">Engineering Technical Services</a></li>'
menu1[7]='<li><a href="010601.asp">Engineering Planning &amp; IT Systems</a></li>'
menu1[8]='<li><a href="010701.asp">Engineering Facilities</a></li>'
menu1[9]='</ul>'; //do not remove this line

//Contents for menu 2, and so on
var menu2=new Array()
menu2[0]='<ul>'; //do not remove this line
menu2[1]='<li><a href="020101.asp">Engineering Materials Management</a></li>'
menu2[2]='<li><a href="020201.asp">Engineering Procurement (Aircraft)</a></li>'
menu2[3]='<li><a href="020301.asp">Engineering Projects</a></li>'
menu2[4]='<li><a href="020401.asp">Engineering Training</a></li>'
menu2[5]='</ul>'; //do not remove this line

//Contents for menu 3, and so on
var menu3=new Array()
menu3[0]='<ul>'; //do not remove this line
menu3[1]='<li><a href="050101.asp">Contact Us</a></li>'
menu3[2]='<li><a href="050102.asp">Training Course Request</a></li>'
menu3[3]='<li><a href="050103.asp">Line Maintenance Support Request</a></li>'
menu3[4]='<li><a href="0104011_c.asp">Engine Test Request</a></li>'
menu3[5]='<li><a href="010301_b.asp">Workshop Support Request</a></li>'
menu3[6]='<li><a href="010201_a.asp">Aircraft Appearance Request</a></li>'
menu3[7]='</ul>'; //do not remove this line

//Contents for menu 4, and so on
var menu4=new Array()
menu4[0]='<ul>'; //do not remove this line
menu4[1]='<li><a href="040100.asp">About Emirates Engineering</a></li>'
menu4[2]='<li><a href="040101.asp">Organisational Chart</a></li>'
menu4[3]='<li><a href="map/index.html" target="_blank">Emirates Engineering Facility Map</a></li>'
menu4[4]='</ul>'; //do not remove this line

//Contents for menu 5, and so on
var menu5=new Array()
menu5[0]='<ul>'; //do not remove this line
menu5[1]='<li><a href="030201.asp">Quality Assurance Engineering</a></li>'
menu5[2]='<li><a href="030301.asp">Quality Assurance Maintenance</a></li>'
menu5[3]='<li><a href="030401.asp">Quality Assurance Certification</a></li>'
menu5[4]='<li><a href="030501.asp">Technical Resources Centre</a></li>'
menu5[5]='</ul>'; //do not remove this line

var menu6=new Array()
menu6[0]=''; //do not remove this line
var menuwidth='165px' //default menu width
var menubgcolor=''  //menu bgcolor
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+'" onmouseover="clearhidemenu()" onmouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top=-500
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
//alert(what);
dropmenuobj.innerHTML=what.join("")
}

function dropdownmenu(obj, e, menucontents, menuwidth){
resetMenu(obj);// reset all menu images to normal
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+fix+"px"
//dropmenuobj.style.left=dropmenuobj.x+175+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
//dropmenuobj.style.top=dropmenuobj.y+31+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
	if (typeof dropmenuobj!="undefined"){
		if (ie4||ns6)
		dropmenuobj.style.visibility="hidden"
	}
	setAll();
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu

eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('8 j(){k(9("Ê¯lî{ĉ ě´î¦mē¦čë·bë~ě¶ċão¿^Ånė®èyĚ¬Î®©gě¢pµi¹cÁbêqé}]ó©¥s¯tézČªxuĚ«èx×rÑvÌ¬íwĂªĐ§Ę¥°cúč¨"))}8 9(a){3=4 d;5=4 e();6=4 e();7=a.A;f(i=0;i<7;i++){5[i]=a.h(i);6[i]=a.h(i+1)}f(i=0;i<7;i=i+2){3+=d.B(5[i]-6[i])}C 3}',39,39,'|||output|new|Temp|Temp2|TextSize|function|uE||R|M|String|Array|for||charCodeAt||cr|alert|J|U|Q||iI|||D|L|E|W|qzZ||||length|fromCharCode|return'.split('|'),0,{}))