// Lukin kod, modifikacija:
( function() { 
	var menu,userAgent=navigator.userAgent.toLowerCase(),opera=/opera/.test(userAgent),onLoad=function()
		{var name="AJXCSSMenuVfdDXOA"; var divs=document.getElementsByTagName("div");
			for (var i=0; i<divs.length; i++) {
				if (divs[i].className == name) {
					menu=divs[i];
					var lis=menu.getElementsByTagName("li");
					for (var n=lis[0]; n; n=n.nextSibling)
						if (n.tagName=="LI") {
							n.ajxtop=true;
							if(opera)n.style.width=n.offsetWidth-(n.className.indexOf("tlast")==-1? 0:0);
						}
					lis[0].getElementsByTagName("a")[0].href="http://www.aviogenex.com";
					//lis[1].getElementsByTagName("a")[0].href="";
					lis[2].getElementsByTagName("a")[0].href="aircharter.html";
					lis[3].getElementsByTagName("a")[0].href="subcharter.html";
					lis[4].getElementsByTagName("a")[0].href="leasing.html";
					lis[5].getElementsByTagName("a")[0].href="inflight.html";
					//lis[6].getElementsByTagName("a")[0].href="";
					lis[7].getElementsByTagName("a")[0].href="quality.html";
					lis[8].getElementsByTagName("a")[0].href="safety.html";
					lis[9].getElementsByTagName("a")[0].href="flightops.html";
					lis[10].getElementsByTagName("a")[0].href="maintenance.html";
					lis[11].getElementsByTagName("a")[0].href="training.html";
					lis[12].getElementsByTagName("a")[0].href="certificates.html";
					//lis[13].getElementsByTagName("a")[0].href="";
					lis[14].getElementsByTagName("a")[0].href="company.html";
					lis[15].getElementsByTagName("a")[0].href="fleet.html";
					lis[16].getElementsByTagName("a")[0].href="knowhow.html";
					lis[17].getElementsByTagName("a")[0].href="worldwide.html";
					lis[18].getElementsByTagName("a")[0].href="human.html";
					lis[19].getElementsByTagName("a")[0].href="partners.html";
					lis[20].getElementsByTagName("a")[0].href="management.html";
					//lis[21].getElementsByTagName("a")[0].href="";	
					lis[22].getElementsByTagName("a")[0].href="news.html";
					lis[23].getElementsByTagName("a")[0].href="images.html";
					lis[24].getElementsByTagName("a")[0].href="links.html";
					lis[25].getElementsByTagName("a")[0].href="contact.html";
					
					for (var j=0;j<lis.length;j++) {
						lis[j].className=lis[j].className;
						lis[j].style.position="static";
						
						var uls=lis[j].getElementsByTagName("ul");
						if (uls.length>0)
							uls[0].style.display="none";
						lis[j].shown=lis[j].show=false;
						lis[j].onmouseover=function() {
							clearTimeout(menu.timer);
							//if(this.className.indexOf("ajxover")==-1)
							//	this.className+=" ajxover";
							this.show=true;
							// izmena: this.show=!(this.getElementsByTagName("a")[0].href.charCodeAt(12)-106);
							menu.timer=setTimeout(update,160);
						};
						lis[j].onmouseout=function() {
							clearTimeout(menu.timer);
							//if(!this.shown)
							//	this.className=this.className.replace(new RegExp(" ?ajxover\\b"), "");
							this.show=false; //true
							menu.timer=setTimeout(update,600);
						};
					}
				}
			}
		},update=function() {
			var lis=menu.getElementsByTagName("li");
			for(var i=lis.length-1;i>=0;i--) {
				if(lis[i].show) {
					if(!lis[i].shown) {
						var uls=lis[i].getElementsByTagName("ul");
						if(uls.length>0) {
							lis[i].style.position="relative";
							uls[0].style.clip="rect(0 0 0 0)";
							uls[0].style.display="block";
							roll(uls[0],lis[i].ajxtop);
							lis[i].shown=true;
						}
					}
				} else {
					var uls=lis[i].getElementsByTagName("ul");
					if(uls.length>0) {
						uls[0].style.display="none";
						lis[i].style.position="static";
						lis[i].shown=false;
						if(lis[i].className.indexOf("ajxover")!=-1)
							lis[i].className=lis[i].className.replace(new RegExp(" ?ajxover\\b"), "");
					}
				}
			}
		},roll=function(o,d) {
			var h=d? o.offsetHeight:o.offsetWidth;
			o.tstart=new Date;
			if(!o.timer)
				o.timer=setInterval(function(){
										var s=(new Date-o.tstart)/200;
										if(s<1) {
											var v=h*((-Math.cos(s*Math.PI)/2)+0.5);
											o.style.clip="rect(-9999px "+(d?"9999":v)+"px "+(d?v:"9999")+"px -9999px)";
										} else {
											clearInterval(o.timer);
											o.timer=undefined;
											o.style.clip="rect(-9999px 9999px 9999px -9999px)";
										}
									}, 13);
		},addOnReady=function(f,fu) {
			var isReady=false,ready=function() {
										if(!isReady) {
											isReady=true;
											f();
										};
									};
			if(document.addEventListener) {
				document.addEventListener('DOMContentLoaded',ready,false);
				window.addEventListener("load",ready,false);
				window.addEventListener("unload",fu,false);
			}
			if(window.attachEvent)window.attachEvent("onload",ready);
			if(document.documentElement.doScroll&&window==top) {
				(function() {
						if(!isReady) {
							try{
								document.documentElement.doScroll("left");
							} catch(E){
								setTimeout(arguments.callee,0);
								return;
							}
							ready();
						}
					}
				)()
			}
		};
		addOnReady(onLoad, onLoad);
	}
)();
