var defaultHTTPPrefix="http://www.thaiairways.com.sg";
var defaultHTTPSPrefix="https://www.thaiairways.com.sg";
	 
//document.write("<script language=\"JavaScript\" src=\"../inc/functions.js\"></script>");
document.write("<LINK href=\""+defaultHTTPPrefix+"/js/thai-css-sg.css\" type=text/css rel=stylesheet>");
//document.write("<div align=\"center\"></div>");
//document.write("<div id=\"Layer1\" style=\"position:absolute; width:773px; height:97px; z-index:1; left: 92px; top: 0px\"><object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0\" width=\"100%\" height=\"100%\">");
//document.write("    <param name=movie value=\""+defaultHTTPPrefix+"/top-ani.swf\">");
//document.write("    <param name=quality value=High>");
//document.write("    <embed src=\""+defaultHTTPPrefix+"/top-ani.swf\" quality=high pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"100%\" height=\"100%\">");
//document.write("    </embed> ");
//document.write("  </object></div>");
document.write("<div id=\"Layer2\" style=\"position:absolute; width:800px; height:36px; z-index:2; left: 82px; top: 34px\"> ");

//Start Menu Function
function MenuItem(){
	this.label=null;
	this.url=null;
	this.secure=false;
	this.nestedMenuItems=new Array();
}
MenuItem.prototype.add=function(label,url,secure){
	var mi=new MenuItem();
	mi.label=label;
	mi.url=url;
	mi.secure=(secure==null||secure==false?false:true);
	this.nestedMenuItems[this.nestedMenuItems.length]=mi;
	return mi;
}
MenuItem.prototype.getUrl=function(httpPrefix,httpsPrefix){
	return this.url==null 
		? 'javascript://void'
		: this.url.indexOf('://')>=0
			? this.url
			: this.secure==true
				? httpsPrefix+this.url
				: httpPrefix+this.url;
}

function ExpandableMenu(varName,menuHeading,menuItems){
	this.varName=varName;
	this.menuHeading=menuHeading;
	this.menuItems=menuItems;
	this.totalTopLevelMenuItems=0;
	this.httpPrefix=null;
	this.httpsPrefix=null;
	for(var i=0;i<this.menuItems.length;++i){
		this.totalTopLevelMenuItems+=this.menuItems[i].nestedMenuItems.length;
	}
}
ExpandableMenu.prototype.setUrlPrefixes=function(httpPrefix,httpsPrefix){this.httpPrefix=httpPrefix;this.httpsPrefix=httpsPrefix;}
ExpandableMenu.prototype.writeMenu=function(fixedMenuIdAndClass,expandableMenuIdAndClass,fixedMenuActiveOption,expandableMenuActiveOption){
	var mi=null;
	var fixedMenu='<div id="'+fixedMenuIdAndClass+'"><div class="heading">'+this.menuHeading+'</div>';
	for(var i=0;i<this.menuItems.length;++i){
		var menuItem=this.menuItems[i];
		for(var j=0;j<menuItem.nestedMenuItems.length;++j){
			mi=menuItem.nestedMenuItems[j];
			fixedMenu+='\n<a';
			var clazz='';
			var nestedMenuExpanded=false;
			if(mi.label==fixedMenuActiveOption){
				if(mi.nestedMenuItems.length>0){
					nestedMenuExpanded=true;
					if(expandableMenuActiveOption==null||expandableMenuActiveOption.length==0){
						clazz+='active';
					}
					clazz+=' expanded';
				}else{
					clazz+='active';
				}
			}else if(mi.nestedMenuItems.length>0){
				clazz+='expandable ';
			}
			if(clazz.length>0){
				fixedMenu+=' class="'+clazz+'"';
			}
			if(mi.url==null||mi.url.length==0||clazz.indexOf('active')>=0){
				fixedMenu+=' href="javascript://void"';
				if(mi.nestedMenuItems.length>0){
					fixedMenu+=' onclick="javascript:'+this.varName+'.toggleNestedMenu(this,\''+expandableMenuIdAndClass+'_'+j+'\');"';
				}
			}else{
				fixedMenu+=' href="'+mi.getUrl(this.httpPrefix,this.httpsPrefix)+'"';
			}
			fixedMenu+='>'+mi.label+'</a>';
			if(mi.nestedMenuItems.length>0){
				fixedMenu+='\n<div id="'+expandableMenuIdAndClass+'_'+j+'" class="'+expandableMenuIdAndClass;
				if(nestedMenuExpanded){
					fixedMenu+=' expanded';
				}
				fixedMenu+='">';
				for(var k=0;k<mi.nestedMenuItems.length;++k){
					fixedMenu+='\n<a';
					if(mi.nestedMenuItems[k].label==expandableMenuActiveOption){
						fixedMenu+=' class="active"';
					}
					fixedMenu+=' href="'+mi.nestedMenuItems[k].getUrl(this.httpPrefix,this.httpsPrefix)+'" >'+mi.nestedMenuItems[k].label+'</a>';
				}
				fixedMenu+='\n</div>';
			}
		}
	}
	fixedMenu+='</div>';
	document.write(fixedMenu);
}
ExpandableMenu.prototype.toggleNestedMenu=function(node,id){
	var menu=document.getElementById(id);
	var display=(menu.currentStyle?menu.currentStyle.display:document.defaultView.getComputedStyle(menu,null).display);
	if(display=='none'){
		menu.style.display='block';
		node.className=node.className.replace(/expandable/ig,'expanded');
	}else{
		anchors=menu.getElementsByTagName('a');
		for(var i=0;i<anchors.length;++i){
			if(anchors[i].className.indexOf('active')>=0){
				return;
			}
		}
		menu.style.display='none';
		node.className=node.className.replace(/expanded/ig,'expandable');
	}
}

function TabbedMenu(varName,menuItems){
	this.varName=varName;
	this.menuItems=menuItems;
	this.totalTopLevelMenuItems=0;
	this.httpPrefix=null;
	this.httpsPrefix=null;
	for(var i=0;i<this.menuItems.length;++i){
		this.totalTopLevelMenuItems+=this.menuItems[i].nestedMenuItems.length;
	}
	this.mouseOverCounter=new Array();
	this.popup=null;
}
TabbedMenu.prototype.millisecondTimein=300;
TabbedMenu.prototype.millisecondTimeout=700;
TabbedMenu.prototype.popupVarName=function(){return this.varName;}
TabbedMenu.prototype.setUrlPrefixes=function(httpPrefix,httpsPrefix){this.httpPrefix=httpPrefix;this.httpsPrefix=httpsPrefix;}
TabbedMenu.prototype.writeMenu=function(fixedMenuClass,popupMenuClass,fixedMenuActiveOption,popupMenuActiveOption){
	var mi=null;
	var fixedMenu='\n<table id="'+fixedMenuClass+'" cellspacing="0">\n<tr>';
	for(var i=0;i<this.menuItems.length;++i){
		var menuItem=this.menuItems[i];
		for(var j=0;j<menuItem.nestedMenuItems.length;++j){
			mi=menuItem.nestedMenuItems[j];
			fixedMenu+='\n<td><a id="m'+i+j+'" href="'+mi.getUrl(this.httpPrefix,this.httpsPrefix)+'"';
			var adjustedLabel=mi.label.replace(/\s+/g,'&nbsp;');
			var clazz='m'+i;
			if(mi.label==fixedMenuActiveOption){
				clazz+=' active';
				adjustedLabel+='&nbsp;&nbsp;&nbsp;';
			}else{
				if(mi.label.length<=6){
					adjustedLabel='&nbsp;'+adjustedLabel+'&nbsp;';
				}
				var eventParams="'m"+i+j+"','"+popupMenuClass+"-"+i+j+"'";
				fixedMenu+=' onmouseout="javascript:'+this.varName+'.mouseOut('+eventParams+');" onmouseover="javascript:'+this.varName+'.mouseOver('+eventParams+');"';
			}
			fixedMenu+='class="'+clazz+'"';
			fixedMenu+='>'+adjustedLabel+'</a></td>';
		}
	}
	fixedMenu+='\n</tr></table>';
	for(var i=0;i<this.menuItems.length;++i){
		var menuItem=this.menuItems[i];
		for(var j=0;j<menuItem.nestedMenuItems.length;++j){
			mi=menuItem.nestedMenuItems[j];
			fixedMenu+='\n<div id="'+popupMenuClass+'-'+i+j+'"';
			fixedMenu+=' class="'+popupMenuClass;
			if(mi.label==fixedMenuActiveOption&&mi.nestedMenuItems.length>0){
				fixedMenu+=' active"';
			}else{
				var eventParams="'m"+i+j+"','"+popupMenuClass+"-"+i+j+"'";
				fixedMenu+='" onmouseout="javascript:'+this.varName+'.mouseOut('+eventParams+');" onmouseover="javascript:'+this.varName+'.mouseOver('+eventParams+');"';
			}
			fixedMenu+='>';
			for(var k=0;k<mi.nestedMenuItems.length;++k){
				fixedMenu+='\n<a';
				if(mi.nestedMenuItems[k].label==popupMenuActiveOption){
					fixedMenu+=' class="active"';
				}
				fixedMenu+=' href="'+mi.nestedMenuItems[k].getUrl(this.httpPrefix,this.httpsPrefix)+'" >'+mi.nestedMenuItems[k].label+'</a>';
			}
			fixedMenu+='\n</div>';
		}
	}
	document.write(fixedMenu);
	document.getElementById(fixedMenuClass).tableLayout='fixed';
}
TabbedMenu.prototype.mouseOver=function(invokingNodeId,popupMenuId){
	if(this.mouseOverCounter[popupMenuId]==null){
		this.mouseOverCounter[popupMenuId]=0;
	}
	this.mouseOverCounter[popupMenuId]++;
	if(this.popup==null){
		this.showPopup(invokingNodeId,popupMenuId);
	}else{
		var show=this.varName+'.showPopup("'+invokingNodeId+'","'+popupMenuId+'");';
		window.setTimeout(show,this.millisecondTimein);
	}
}
TabbedMenu.prototype.mouseOut=function(invokingNodeId,popupMenuId){
	if(this.mouseOverCounter[popupMenuId]==null){
		this.mouseOverCounter[popupMenuId]=0;
	}else{
		this.mouseOverCounter[popupMenuId]--;
		var hide=this.varName+'.hidePopup("'+popupMenuId+'");';
		window.setTimeout(hide,this.millisecondTimeout);
	}
}
TabbedMenu.prototype.showPopup=function(invokingNodeId,popupMenuId){
	if(this.mouseOverCounter[popupMenuId]>0){
		if(this.popup==null||this.popup.id!=popupMenuId){
			if(this.popup!=null){
				this.killPopup();
			}
			this.popup=document.getElementById(popupMenuId);
			this.popup.contentSize=this.popup.innerHTML.replace(/[\s\r\n\t ]*/ig,'').length;
			if(this.popup.contentSize>0){
				this.popup.style.display='block';
			}
			this.popup.invokingNode=document.getElementById(invokingNodeId);
			this.popup.invokingNode.className+=' hover';
		}
	}
}
TabbedMenu.prototype.hidePopup=function(popupMenuId){
	if(this.mouseOverCounter[popupMenuId]==0){
		if(this.popup!=null&&this.popup.id==popupMenuId){
			this.killPopup();
		}
	}
}
TabbedMenu.prototype.killPopup=function(){
	this.mouseOverCounter[this.popup.id]=0;
	this.popup.style.display='none';
	this.popup.invokingNode.className=this.popup.invokingNode.className.replace(/\ hover/ig,'');
	this.popup=null;
}
//End Menu Function





var serverDate=new Date(2005,5,21,0);

// Start Menu URL
var menumain =defaultHTTPPrefix+ "/";
var mnuaboutthai =defaultHTTPPrefix+ "/AboutThai/";
var mnuflyingwithus=defaultHTTPPrefix+ "/FlyingWithUs/";
var mnuroyalorchidholidays=defaultHTTPPrefix + "/ROH/";
var mnuschedulefare=defaultHTTPPrefix + "/ScheduleFare/";
var mnufrequentflyers=defaultHTTPPrefix + "/FrequentFlyers/";
var mnupromotions=defaultHTTPPrefix+ "/Promotions/";
var mnuvisitsingapore=defaultHTTPPrefix + "/VisitSingapore/";
var mnuquizzes=defaultHTTPPrefix+ "/Quizzes/";
var mnusubscribe=defaultHTTPPrefix + "/subscribe/";
var mnuguestbook=defaultHTTPPrefix+ "/guestbook/";
var mnusearch =defaultHTTPPrefix + "/search/";
var mnutermsofuse=defaultHTTPPrefix + "/terms/";
//Start Home
//var home = thaiurl + "index.asp";
//End Home

var f0=new MenuItem("f0");
//f0.add("Home","/index.asp");

var f1=f0.add("About THAI",menumain +"index.asp");
f1.add("THAI Look & Story",mnuaboutthai +"THAILookStory.htm");
f1.add("THAI Milestones",mnuaboutthai + "THAIMilestones.htm");
f1.add("News Room",mnuaboutthai + "releases_statements.asp");
f1.add("<a target=\"_blank\" href=\"http://www.staralliance.com\">Star Alliance & Global Network</a>");
f1.add("Photo Gallery",mnuaboutthai + "PhotoGallery.htm");
f1.add("<a target=\"_blank\" href=\"http://www.thaiairways.com\">THAI Offices Worldwide</a>");
f1.add("THAI Singapore",mnuaboutthai + "Singapore.asp");

f1=f0.add("Flying With Us",menumain + "index.asp");
f1.add("Where We Fly",mnuflyingwithus + "WhereWeFlyDomestic.htm");
f1.add("<a target=\"_blank\" href=\"http://www.thaiairways.com\">Our Aircrafts</a>");
f1.add("Before You Fly Q&A",mnuflyingwithus + "BeforeYouFlyQ&A.htm");
f1.add("Inflight Services",mnuflyingwithus+ "InflightServices01.htm");
f1.add("Inflight Health & Well Being",mnuflyingwithus + "InflightHealth.htm");
f1.add("Other Services",mnuflyingwithus + "OtherServicesLimousines.htm");


f1=f0.add("Royal Orchid Holidays",menumain + "index.asp");
f1.add("Discover Thailand","http://www.thaiairways.com/holiday-packages/royal-orchid-holidays/en/discover-thailand.htm");
f1.add("Discover the world","http://www.thaiairways.com/holiday-packages/royal-orchid-holidays/en/discover-the-world.htm");
f1.add("Explore by interest","http://www.thaiairways.com/holiday-packages/royal-orchid-holidays/en/explore-by-interest.htm");
f1.add("Weekly travel features","http://www.thaiairways.com/plan-your-trip/destinations/en/weekly-travel-features.htm");
f1.add("ROH colums in magazine", "http://www.thaiairways.com/holiday-packages/eurngluang-tours/th/roh-columns-in-magazines/roh-columns-in-magazines-south-africa.htm");
//f1.add("Fly-Drive Thailand",mnuroyalorchidholidays + "Fly-DriveThailand/default.htm");
//f1.add("Bookings",mnuroyalorchidholidays + "bookings.htm");

f1=f0.add("Schedule & Fare",menumain + "index.asp");
f1.add("Flight Timetable",mnuschedulefare + "flight_timetable.asp");
f1.add("<a target=\"_blank\" href=\"http://www.thaiairways.com\">Flight Schedule");
f1.add("<a target=\"_blank\" href=\"http://www.thaiairways.com\">Airfare</a>");
f1.add("<a target=\"_blank\" href=\"http://www.thaiairways.com\">Terms & Conditions</a>");

f1=f0.add("Frequent Flyers",menumain + "index.asp");
f1.add("About Royal Orchid Plus",mnufrequentflyers + "AboutROP.htm");
f1.add("Benefits & Privileges",mnufrequentflyers + "Benefits.htm");
f1.add("Redeeming Awards",mnufrequentflyers + "RedeemingAwards.htm");
f1.add("Mileage Accrual",mnufrequentflyers + "MileageAccrual.htm");
f1.add("<a target=\"_blank\" href=\"http://www.thaiairways.com\">Enrol Online</a>");
f1.add("<a target=\"_blank\" href=\"http://www.thaiairways.com\">Members Login</a>");
f1.add("Q&A",mnufrequentflyers + "Q&A.htm");

f1=f0.add("Promotions",menumain+ "index.asp");
f1.add("Package Promotions",mnupromotions + "promotions.asp?type=PACKAGE");
f1.add("Airfare Promotions",mnupromotions + "promotions.asp?type=AIRFARE");
f1.add("<a href='mailto:sales@thaiairways.com.sg'>Email Enquiries</a>");

var s0 = new MenuItem("s0");
var s1=s0.add("Visit Singapore",menumain + "index.asp");
s1.add("General Information",mnuvisitsingapore + "GeneralInformation.htm");

var tabbedMenuAB=new TabbedMenu('tabbedMenuAB',[f0,s0]);
tabbedMenuAB.setUrlPrefixes(defaultHTTPPrefix,defaultHTTPSPrefix);
//tabbedMenuAB.writeMenu("menu-a","menu-b","Home","");
document.write("<script language=JavaScript type=text/javascript> tabbedMenuAB.writeMenu(\"menu-a\",\"menu-b\",\"Home\",\"\");</script>");
document.write("</div>");
//document.write("<div align=\"center\"></div>");

