if (typeof ammo != "object") {
	var ammo = {
		id: "ammo",
		version: "2.3"
	};
};
ammo.namespace = function() {
    var a=arguments, o=null, i, j, d;
    for (i=0; i<a.length; ++i) {
        d=a[i].split(".");
        o=ammo;
        for (j=(d[0] == "ammo") ? 1 : 0; j<d.length; ++j) {
            o[d[j]]=o[d[j]] || {};
            o=o[d[j]];
        }
    }
    return o;
};

/**
 * Create AMMO.CLASS class
 *
 * @method create	initiallize class
 *
 * @method extend	make sub class
 *
 */
ammo.cls = {
	create: function() {
		return function() { this.initialize.apply(this, arguments); };
	},
	extend: function(subc, superc, overrides) {
		var tmpf = function() {};
		tmpf.prototype=superc.prototype;
		subc.prototype=new tmpf();
		subc.prototype.constructor=subc;
		subc.superclass=superc.prototype;
		if (superc.prototype.constructor == Object.prototype.constructor) {
			superc.prototype.constructor=superc;
		}

		if (overrides) {
			for (var i in overrides) {
				subc.prototype[i]=overrides[i];
			}
		}
	}
};

ammo.namespace(
	"data",
	"ajax",
	// COOKIE overall, including global cookie names and getcookie/setcookie action
	"cookie", 
	// COOKIE about HERDER region/language section
	"cookie.regilang", 
	// HTML overall : including all HTML action
	"html", 
	// HTML data section : including Menu data and so on
	"html.data", 
	// HTML utilities : including common tools
	"html.utilities", 
	// HTML : navigation bar functions
	"html.navibar", 
	// HTML : HERDER region/language functions
	"html.regilang" 
);

ammo.data = function() {
	// { text: "Korea Station",    id: "sub1_9",  url:"//www.airmacau.co.kr/" },
	this.today = new Date();
	this.navibar = {
	"LEFTNAVIBAR": [ 
		{ text: "Home", id: "navi_0", col: "1", url: "http://en.airmacau.com.mo/" },
		{ text: "Flight Info", id: "navi_2", col: "1", url: "", submenu: { id: "sub2", itemdata: [
			{ text: "Timetable",         id: "sub2_1", url:"//www.airmacau.com.mo/timetable/schedules.asp" },
			{ text: "Flight Status",     id: "sub2_2", url:"//en.airmacau.com.mo/timetable/flight_status.asp" },
			{ text: "Download Timetable",id: "sub2_3", url:"//en.airmacau.com.mo/timetable/timetable.asp" }
		] }
		},
		{ text: "Hot Offers", id: "navi_1", col: "3", url: "", submenu: { id: "sub1", itemdata: [
			{ text: "Macau Station",    id: "sub1_1" , url:"//en.airmacau.com.mo/routes/macau.asp" },
			{ text: "Taipei Station",   id: "sub1_2",  url:"//en.airmacau.com.mo/routes/taipei.asp" },
			{ text: "Shanghai Station", id: "sub1_3" , url:"//en.airmacau.com.mo/routes/shanghai.asp" },
			{ text: "Beijing Station",  id: "sub1_4" , url:"//en.airmacau.com.mo/routes/beijing.asp" },
			{ text: "Xiamen Station",   id: "sub1_6" , url:"//en.airmacau.com.mo/routes/xiamen.asp" },
			{ text: "Japan Station",    id: "sub1_8",  url:"//www.airmacau.jp/" },
			{ text: "Bangkok Station",  id: "sub1_10", url:"//www.airmacau.co.th/" }
		] }
		},
		{ text: "Privileges", id: "navi_5", col: "1", url: "", submenu: { id: "sub5", itemdata: [
			{ text: "Hot Offers",         id: "sub5_1", url:"//en.airmacau.com.mo/ffp/offers.asp" },
			{ text: "Introduction",       id: "sub5_2", url:"//en.airmacau.com.mo/ffp/intro.asp?page=1" },
			{ text: "Online Register",    id: "sub5_3", url:"//ffp.airmacau.com.mo/MACAUFFPWEB_EN/Member/RegistNote.aspx" },
			{ text: "Login",              id: "sub5_4", url:"//ffp.airmacau.com.mo/MACAUFFPWEB_EN/index.aspx" },
			{ text: "Mileages Calculator",id: "sub5_5", url:"//ffp.airmacau.com.mo/MACAUFFPWEB_EN/FlightActivity/FlightActivitySimulateCount.aspx" },
			{ text: "Service Hotline",    id: "sub5_6", url:"//en.airmacau.com.mo/ffp/intro.asp?page=contact" },
			{ text: "VIP Lounge",         id: "sub5_7", url:"//en.airmacau.com.mo/vip/viproom.asp" },
			{ text: "Smart Shopping",     id: "sub5_8", url:"//en.airmacau.com.mo/vip/privileges.asp?type=mfm_A1" },
			{ text: "Airline Partner",    id: "sub5_9", url:"//en.airmacau.com.mo/ffp/partner_ana.asp" }
		] }
		},
		{ text: "Customer Service", id: "navi_6", col: "1", url: "", submenu: { id: "sub6", itemdata: [
			{ text: "Passenger Info",       id: "sub6_1", url:"//en.airmacau.com.mo/service/rules.asp" },
			{ text: "Visa Endorsement",     id: "sub6_2", url:"//en.airmacau.com.mo/service/twn_visa.asp" },
			{ text: "Flight Reconfirmation",id: "sub6_3", url:"//en.airmacau.com.mo/service/confirm.asp" },
			{ text: "Understand Tickets",   id: "sub6_4", url:"//en.airmacau.com.mo/service/tickets_faq.asp" },
			{ text: "Contact Us",           id: "sub6_5", url:"//en.airmacau.com.mo/contact/area_macau.asp" }
		] }
		},
		{ text: "Service Campaign", id: "navi_11", col: "1", url: "", submenu: { id: "sub11", itemdata: [
			{ text: "Macau Airport Telephone Check In Service",                  id: "sub11_1", url:"//en.airmacau.com.mo/event/tel_confirm.asp" },
			{ text: "Platinum Card and Gold Card Members Short Message Service", id: "sub11_2", url:"//en.airmacau.com.mo/contact/en_sms_main.asp" },
			{ text: "Premium Service Center",                                    id: "sub11_3", url:"//en.airmacau.com.mo/event/vpondutye.asp" }
		] }
		},
		{ text: "Air Shopping", id: "navi_7", col: "1", url: "", submenu: { id: "sub7", itemdata: [
			{ text: "Perfume",          id: "sub7_1", url:"//en.airmacau.com.mo/airshopping/eshopping.asp?type=perfume&page=1" },
			{ text: "Cosmetics",        id: "sub7_2", url:"//en.airmacau.com.mo/airshopping/eshopping.asp?type=cosmetic&page=1" },
			{ text: "Accessories",      id: "sub7_3", url:"//en.airmacau.com.mo/airshopping/eshopping.asp?type=accessory&page=1" },
			{ text: "Gifts",            id: "sub7_4", url:"//en.airmacau.com.mo/airshopping/eshopping.asp?type=gift&page=1" }
		] }
		},
		{ text: "Contact Us", id: "navi_8", col: "1", url: "", submenu: { id: "sub8", itemdata: [
			{ text: "Air Macau Office",      id: "sub8_1", url:"//en.airmacau.com.mo/contact/area_macau.asp" },
			{ text: "Passengers Sales Agent",id: "sub8_2", url:"//en.airmacau.com.mo/contact/psg_bangladesh.asp" },
			{ text: "Cargo Sales Agent",     id: "sub8_3", url:"//en.airmacau.com.mo/contact/cargo_bangladesh.asp" },
			{ text: "Travel Agent",          id: "sub8_4", url:"//en.airmacau.com.mo/contact/agents.asp" },
			{ text: "Comments",              id: "sub8_5", url:"//en.airmacau.com.mo/contact/comments.asp" }
		] }
		},
		{ text: "About Us", id: "navi_9", col: "1", url: "", submenu: { id: "sub9", itemdata: [
			{ text: "Corporate Info",   id: "sub9_1", url:"//en.airmacau.com.mo/about/company.asp" },
			{ text: "Air Macau News",   id: "sub9_2", url:"//en.airmacau.com.mo/about/news.asp" },
			{ text: "Fleet Info",       id: "sub9_3", url:"//en.airmacau.com.mo/about/airplanes.asp" },
			{ text: "Annual Report",    id: "sub9_4", url:"//en.airmacau.com.mo/about/fininfo.asp" },
			{ text: "Recruitment",      id: "sub9_5", url:"//en.airmacau.com.mo/about/recruit.asp" }
		] }
		},
		{ text: "Cargo Service", id: "navi_10", col: "1", url: "", submenu: { id: "sub10", itemdata: [
			{ text: "Service Intro",    id: "sub10_1", url:"//en.airmacau.com.mo/cargo/introduce.asp" },
			{ text: "Timetable",        id: "sub10_2", url:"//en.airmacau.com.mo/cargo/introduce.asp#cargo_schedules" },
			{ text: "Cargo Tracking",   id: "sub10_3", url:"//en.airmacau.com.mo/cargo/track.asp" },
			{ text: "E-Cargo",          id: "sub10_5", url:"//en.airmacau.com.mo/cargo/ecargo.asp" }
		] }
		},
	] };
	this.dispchs = new Array( H_CSO01, H_CSO02, H_CSO03, H_CSO04, H_CSO35,
		H_CSO26, H_CSO27, H_CSO06, H_CSO07,
		H_CSO08, H_CSO09, H_CSO10, H_CSO31, H_CSO11,
		H_CSO12, H_CSO13, H_CSO14, H_CSO28, H_CSO30, H_CSO16, H_CSO33, H_CSO34,
		H_CSO17, H_CSO18, H_CSO19, H_CSO36, H_CSO29,
		H_CSO20, H_CSO32);
	this.dispchsc = new Array( H_O01, H_O02, H_O03, H_O04, H_O35,
		H_O26, H_O27, H_O06, H_O07,
		H_O08, H_O09, H_O10, H_O31, H_O11,
		H_O12, H_O13, H_O14, H_O28, H_O30, H_O16, H_O33, H_O34,
		H_O17, H_O18, H_O19, H_O36, H_O29,
		H_O20, H_O32);
	this.dispcht = new Array(H_CSP01, H_CSP13, H_CSP04, H_CSP35, H_CSP31, H_CSP10,
		H_CSP18, H_CSP06, H_CSP26, H_CSP11, 
		H_CSP07, H_CSP12, H_CSP30, H_CSP14, H_CSP28, H_CSP27,
		H_CSP02, H_CSP16, H_CSP33, H_CSP34, H_CSP32, H_CSP19, H_CSP36, H_CSP29,
		H_CSP20); 
	this.dispchtc = new Array(H_O01, H_O13, H_O04, H_O35, H_O31, H_O10,
		H_O18, H_O06, H_O26, H_O11, 
		H_O07, H_O12, H_O30, H_O14, H_O28, H_O27,
		H_O02, H_O16, H_O33, H_O34, H_O32, H_O19, H_O36, H_O29,
		H_O20); 
	this.ctyname = new Array( H_C01 ,H_C02 ,H_C03 ,H_C04
		,H_C05 ,H_C06 ,H_C07 ,H_C08
		,H_C09 ,H_C10 ,H_C11 ,H_C12
		,H_C13 ,H_C14 ,H_C15 ,H_C16
		,H_C17 ,H_C18 ,H_C19 ,H_C20
		,H_C21 ,H_C22 ,H_C23 ,H_C24
		,H_C25 ,H_C26 ,H_C27 ,H_C28
		,H_C29 ,H_C30 ,H_C31 ,H_C32
		,H_C33 ,H_C34 ,H_C35 ,H_C36);
	this.aptname = new Array( H_APT01 ,H_APT02 ,H_APT03 ,H_APT04
		,H_APT05 ,H_APT06 ,H_APT07 ,H_APT08
		,H_APT09 ,H_APT10 ,H_APT11 ,H_APT12
		,H_APT13 ,H_APT14 ,H_APT15 ,H_APT16
		,H_APT17 ,H_APT18 ,H_APT19 ,H_APT20
		,H_APT21 ,H_APT22 ,H_APT23 ,H_APT24
		,H_APT25 ,H_APT26 ,H_APT27 ,H_APT28
		,H_APT29 ,H_APT30 ,H_APT31 ,H_APT32
		,H_APT33 ,H_APT34,H_APT35 ,H_APT36);
	this.aptcode = new Array( H_O01 ,H_O02 ,H_O03 ,H_O04
		,H_O05 ,H_O06 ,H_O07 ,H_O08
		,H_O09 ,H_O10 ,H_O11 ,H_O12
		,H_O13 ,H_O14 ,H_O15 ,H_O16
		,H_O17 ,H_O18 ,H_O19 ,H_O20
		,H_O21 ,H_O22 ,H_O23 ,H_O24
		,H_O25 ,H_O26 ,H_O27 ,H_O28
		,H_O29 ,H_O30 ,H_O31 ,H_O32
		,H_O33 ,H_O34,H_O35 ,H_O36);
	this.crcode = new Array(H_PRC_CNY, H_PRC_TWD, H_PRC_HKD, H_PRC_MOP,H_PRC_USD, H_PRC_KRW, H_PRC_JPY, H_PRC_THB);
	this.crname = new Array(H_PR_CNY, H_PR_TWD, H_PR_HKD, H_PR_MOP, H_PR_USD, H_PR_KRW, H_PR_JPY, H_PR_THB);
	this.acname = new Array(H_AIRBUS+"A310", H_AIRBUS+"A310-200", H_AIRBUS+"A300", H_AIRBUS+"A300-600", 
		H_AIRBUS+"A310-300", H_AIRBUS+"A319", H_AIRBUS+"A320", H_AIRBUS+"A321", 
		H_AIRBUS+"A300", H_AIRBUS+"A330-200", H_AIRBUS+"A330-200", H_AIRBUS+"A340", 
		H_AIRBUS+"A340-300", H_BOEING+"737-700", H_BOEING+"737-200", H_BOEING+"737-200", 
		H_BOEING+"737-200", H_BOEING+"737-300", H_BOEING+"737-400", H_BOEING+"737-500", 
		H_BOEING+"737-600", H_BOEING+"737", H_BOEING+"737-800", H_BOEING+"747-400", 
		H_BOEING+"747SP", H_BOEING+"747-200", H_BOEING+"747-400", H_BOEING+"747", 
		H_BOEING+"757", H_BOEING+"767-300", H_BOEING+"767-200", H_BOEING+"777-200", 
		H_BOEING+"777", H_BOEING+"747", H_BOEING+"767-200/ER");
	this.accode = new Array("310", "312", "AB3", "AB6",
		"313", "319", "320", "321",
		"300", "330", "332", "340",
		"343", "73G", "73M", "73S",
		"732", "733", "734", "735",
		"736", "737", "738", "74E",
		"74L", "74M", "744", "747",
		"757", "763", "767", "772",
		"777", "74P", "762");
	this.tmtext = new Array(H_YEA, H_MON, H_WEE, H_DAY, H_HOU, H_MIN, H_SEC, 
		H_ONE, H_TWO, H_THR, H_FOU, H_FIV,
		H_SIX, H_SEV, H_EIG, H_NIN, H_TEN);
	this.cbcls = new Array("", H_CARBINCE, H_CARBINCB);
	this.rgctv = new Array("", H_HD_ALSTST1V, H_HD_ALSTST2V, H_HD_ALSTST3V,
		H_HD_ALSTST4V, H_HD_ALSTST5V, H_HD_ALSTST6V, H_HD_ALSTST7V,
		H_HD_ALSTST8V, H_HD_ALSTST9V, H_HD_ALSTST10V, H_HD_ALSTST11V,
		H_HD_ALSTST12V, H_HD_ALSTST13V, H_HD_ALSTST14V, H_HD_ALSTST15V,
		H_HD_ALSTST16V, H_HD_ALSTST17V, H_HD_ALSTST18V, H_HD_ALSTST19V,
		H_HD_ALSTST20V, H_HD_ALSTST21V, H_HD_ALSTST34V, H_HD_ALSTST35V,
		H_HD_ALSTST22V, H_HD_ALSTST23V, H_HD_ALSTST33V,
		H_HD_ALSTST24V, H_HD_ALSTST25V, H_HD_ALSTST26V, H_HD_ALSTST27V,
		H_HD_ALSTST28V, H_HD_ALSTST29V, H_HD_ALSTST30V, H_HD_ALSTST31V,
		H_HD_ALSTST32V);
	this.rgctc = new Array("", H_HD_ALSTST1C, H_HD_ALSTST2C, H_HD_ALSTST3C,
		"", "", "", H_HD_ALSTST7C,
		"", "", "", "",
		"", "", "", "",
		"", "", "", "",
		"", "", "", "", H_HD_ALSTST22C, "", "",
		H_HD_ALSTST24C, "", "", H_HD_ALSTST27C, 
		"", "", H_HD_ALSTST30C, "",
		"");
	this.wdname = new Array(H_WD0, H_WD1, H_WD2, H_WD3, H_WD4, H_WD5, H_WD6,
		H_WD7, H_WD8, H_WD9, H_WD10, H_WD11, H_WD12, H_WD13);
	this.ajaxer1 = AJAX_ERROR_COMMON1;
	this.ajaxer2 = AJAX_ERROR_COMMON2;
};

ammo.ajax = function() {
	ammo.data.call(this);
	function getXmlHttpRequestObject() {
		var xmlHttpRequest = false;
		if ( window.XMLHttpRequest ) {
			try {
				xmlHttpRequest = new XMLHttpRequest();
			} catch (e) {
				xmlHttpRequest = false;
			}
		} else if ( window.ActiveXObject ) {
			try {
				xmlHttpRequest = new ActiveXObject( "Msxml2.XMLHTTP" );
			} catch (e) {
				try {
					xmlHttpRequest = new ActiveXObject( "Microsoft.XMLHTTP" );
				} catch (e) {
					xmlHttpRequest = false;
				}
			}
		}
		if ( xmlHttpRequest.overrideMimeType ) {
			xmlHttpRequest.overrideMimeType( "text/xml" );
		}
		return xmlHttpRequest;
	};

	/**
	 * Use XmlHttpRequest Handler to prepare a AJAX submit
	 *
	 * @method prepareXmlHttpRequest ( create XmlHttpRequest )
	 * @param {method}	method	[ GET | POST ]
	 * @param {action}	action	request action / cgi url
	 * @param {params}	params	get / post parameters like "a=b&c=d&..."
	 * @param {calbak}	calbak	callback function name like "alert"
	 * @param {failfn}	failfn	error-handle function name like "alert"
	 * @return {retvle}	retvle	calbak's return value if calbak is not null, or AJAX's responseText value
	 *
	 */
	function prepareXmlHttpRequest( method, action, params, calbak, failfn) {
		var finalData, spliter, argrt=new Array();
		if ( method == "GET" ) {
			if (action.indexOf("?")!=-1) { spliter = "&"; } else { spliter = "?"; }
			action	= action + spliter + params;
			finalData = null;
		} else {
			finalData = escape (params);
		}
		request.open( method, action, true );
		if ( method == "POST" )
		{
			request.setRequestHeader( "Method", "POST " + action + " HTTP/1.1" );
			request.setRequestHeader( "Content-Type",  "application/x-www-form-urlencoded" );
			request.setRequestHeader( "Content-Length", finalData.length );
		}
		request.onreadystatechange = function() {
			if ( request.readyState == 4 ) {
				//alert(request.status+"[3]="+request.responseText);
				if ( request.status == 200 && (typeof calbak)=="function" && calbak != "" ) {
					argrt[0]=request.status;
					argrt[1]=request.responseText;
					calbak.apply(this, argrt);
				} else if ( request.status != 200 ) {
					if ((typeof failfn)=="function" && failfn != "" ) {
						argrt[0]=request.status;
						argrt[1]=request.responseText;
						failfn.apply(this, argrt);
					} else {
						alert(this.ajaxer1 + request.status + this.ajaxer2);
					}
				}
			}
		};
		return finalData;
	};

	function run( method, action, params, calbak, failfn) {
		request = getXmlHttpRequestObject();
		if (typeof request == "object") {
			esDATA = prepareXmlHttpRequest( method, action, params, calbak, failfn);
			request.send( esDATA );
		}
	};

	var argv=arguments, argc=arguments.length;
	var request , esDATA;
	//if (argc==3) { run(argv[0], argv[1], argv[2], "", ""); }
	if (argc==4) { run(argv[0], argv[1], argv[2], argv[3], ""); }
	if (argc==5) { run(argv[0], argv[1], argv[2], argv[3], argv[4]); }
};

/**
 * Create AMMO.COOKIE class
 *
 * @member	ckspliter	"&";
 * @member	ckregilang	"NX_REGLANG";
 * @member	ckibe		"NX_IBE";
 * @member	cktktd		"NX_TKTD";
 * @member	cktktr		"NX_TKTR";
 *
 * @method setcookie 
 * @param {name}	name	cookie name
 * @param {value}	value	cookie value
 * @param {expires}	expires	cookie expire time
 * @param {path}	path	cookie path
 * @param {domain}	domain	cookie domain
 * @param {secure}	secure	???
 *
 * @method getcookie 
 * @param {name}	name	cookie name
 *
 * @method setck	make a new cookie
 * @param {name}	vn	cookie name
 * @param {value}	vu	cookie value
 * @param {expire}	vt	cookie expire time
 *
 * @method updck	update a cookie's value
 * @param {name}	vn	cookie name
 * @param {value}	vu	cookie value
 * @param {expire}	vt	cookie expire time
 *
 * @method delck	delete a cookie (set it's value to empty)
 * @param {name}	vn	cookie name
 *
 * @method getck	obtain a cookie's value
 * @param {name}	vn	cookie name
 *
 */
ammo.cookie = function() {
	this.ckspliter = "&";
	this.ckregilang = "NX_REGLANG";
	this.ckibe = "NX_IBE";
	this.ckprc = "NX_PRC";
	this.ckprc2 = "NX_PRC2";
	this.ckvclsd = "NX_VCLSD";
	this.ckvclsr = "NX_VCLSR";
	this.cktktd = "NX_TKTD";
	this.cktktr = "NX_TKTR";
	this.cktktp = "NX_TKTP";
	this.cktktah = "NX_TKTAH";
	this.cktktaj = "NX_TKTAJ";
	this.setcookie = function(name, value) {
		var argv=arguments;
		var argc=arguments.length;
		//var exi=(2<argc)?argv[2]:null;
		var exi = null;
		if (2<argc) {
			if (argv[2] != "" && argv[2] != null && argv[2] != "undefind") {
				exi = new Date (argv[2]);
			} else {
				exi = null;
			}		
		} else {
			exi = null;
		}
		if (exi!=null) {
			if (exi.toGMTString() == "NaN") {
				exi = null;
			}
		}
		var pat=(3<argc)?argv[3]:null;
		var dom=(4<argc)?argv[4]:null;
		var sec=(5<argc)?argv[5]:false;

		/*
		alert(name+ "="+ escape(value)+ 
			((exi==null)?"":("; expires="+ exi.toGMTString()))+
			((pat==null)?"":("; path="+ pat))+
			((dom==null)?"":("; domain="+ dom))+
			((sec==true)?"; secure":"")
		);
		*/
		document.cookie = 
			name+ "=" + escape(value)+ 
			((exi==null)?"":("; expires="+ exi.toGMTString()))+
			((pat==null)?"":("; path="+ pat))+
			((dom==null)?"":("; domain="+ dom))+
			((sec==true)?"; secure":"");
	};
	this.getcookie = function(name) {
		var search = name + "=";
		var returnvalue = "";
		if (document.cookie.length > 0) {
			offset = document.cookie.indexOf(search);
			if (offset != -1) {
				offset += search.length;
				end = document.cookie.indexOf(";", offset);
				if (end == -1) end = document.cookie.length;
				returnvalue=unescape(document.cookie.substring(offset,end));
			}
		}
		return returnvalue;
	};
	this.setck = function(vn, vu, vt, vp, vd) { this.setcookie(vn, vu, vt, vp, vd); };
	this.updck = function(vn, vu, vt, vp, vd) { this.setck(vn, vu, vt, vp, vd); };
	this.delck = function(vn) { if (typeof vn == "string") { this.setcookie(vn, ""); } };
	this.getck = function(vn) { if (typeof vn == "string") { return this.getcookie(vn); } };
};

ammo.cookie.regilang = function() {
	this.regi = "";
	this.city = ""; 
	this.lang = ""; 
	this.sesi = false; 
	this.expd = new Date(2110,3,9);
	this.basedomain = "airmacau.com.mo";
	this.getregi = function() { return this.regi;};
	this.getcity = function() { return this.city;};
	this.getlang = function() { return this.lang;};
	this.getsesi = function() { return this.sesi;};
	this.get = function(vn) { return eval(vn); };
	this.set = function(vn, vu) {
		var f = this;
		if(vn.toLowerCase()=="regi"){f.setregi(vu);}
		else if(vn.toLowerCase()=="city"){f.setcity(vu);}
		else if(vn.toLowerCase()=="lang"){f.setlang(vu);}
		else if(vn.toLowerCase()=="sesi"){f.setsesi(vu);}
	};
	this.setregi = function(instr) { this.regi=instr; this.updcookie(); };
	this.setcity = function(instr) { this.city=instr; this.updcookie(); };
	this.setlang = function(instr) { this.lang=instr; this.updcookie(); };
	this.setsesi = function(instr) { this.sesi=instr; this.updcookie(); };
	this.init0 = function() {
		var f = this;
		var sT=f.getck(f.ckregilang), tAR;
		if (typeof sT == "string" && sT != "") {
			tAR = sT.split(f.ckspliter);
			if (tAR.length==4) {
				f.regi=tAR[0]; f.city=tAR[1]; f.lang=tAR[2]; f.sesi=tAR[3];
				return;
			}
		} else {
			f.regi=""; f.city=""; f.lang=""; f.sesi="";
		}
	};
	this.init4 = function(regi, city, lang, sesi) {
		var f = this;
		f.regi=regi; f.city=city; f.lang=lang; f.sesi=sesi;
		f.updcookie();
	};
	this.updcookie = function() {
		var f = this;
		if (f.sesi) { 
			f.updck(f.ckregilang,
				f.regi+f.ckspliter+f.city+f.ckspliter+f.lang+f.ckspliter+f.sesi,
				"", "/", this.basedomain);
		} else {
			f.updck(f.ckregilang,
				f.regi+f.ckspliter+f.city+f.ckspliter+f.lang+f.ckspliter+f.sesi,
				f.expd, "/", this.basedomain);
		}
	};
	var argv=arguments, argc=arguments.length;
	if (argc==0) { return this.init0(); }
	if (argc==3) { return this.init4(argv[0], argv[1], argv[2], false); }
	if (argc==4) { return this.init4(argv[0], argv[1], argv[2], argv[3]); }
};
ammo.cookie.regilang.prototype = new ammo.cookie();

ammo.html = function() {
	/**
	 * Create a DOM element with the attributes, styles, actions textnode and subchild
	 *
	 * @method cE ( create Element )
	 * @param {tag}		ta	the tag name
	 * @param {attribute}	at	the attributes format as "NAME1:VALUE1; NAME2:VALUE2"
	 *				# 'class' to 'className'
	 *				# 'bgcolor' to 'bgColor' and must be led by a '#'
	 *				# 'backgroundColor' must lead with a '#'
	 *				# 'colspan' to 'colSpan'
	 *				# 'rowspan' to 'rowSpan'
	 *				# 'cellspacing' to 'cellSpacing'
	 *				# 'cellpadding' to 'cellPadding'
	 * @param {style}	st	the styles format as "NAME1:VALUE1; NAME2:VALUE2"
	 *				# 'z-index' to 'style.zIndex'
	 *				#     and many other attributes will be dealt like that
	 * @param {innerHTML}	ih	the initial innerHTML
	 * @param {textnode}	te	the initial textnode
	 * @param {subchild}	su	one initial subchild object
	 * @param {subchild}	pa	one initial parent object
	 *
	 */
	this.cE = function(ta, at, st, ih, te, su, pa) {
		var tmpar;
		var obj;
		if (typeof ta == "string") { obj=document.createElement(ta); }
		if (typeof obj != "object") { return null; }
		if (typeof at == "string" && at != "" ) {
			tmpar = at.split(";");
			for (var i=0, j=""; i<tmpar.length; i++, j="") {
				j = trim(tmpar[i]).split(":");
				if (j.length==2 && j[0]!="" && j[1]!="") {
					if (j[0].toLowerCase()=="class") {
						obj.className=j[1];
					} else if (j[0].toLowerCase()=="bgcolor") {
						obj.bgColor=j[1];
					} else if (j[0].toLowerCase()=="colspan") {
						obj.colSpan=j[1];
					} else if (j[0].toLowerCase()=="rowspan") {
						obj.rowSpan=j[1];
					} else if (j[0].toLowerCase()=="cellspacing") {
						obj.cellSpacing=j[1];
					} else if (j[0].toLowerCase()=="cellpadding") {
						obj.cellPadding=j[1];
					} else {
						obj.setAttribute(j[0],j[1]);
					}
				}
			}
		}
		if (typeof st == "string" && st != "" ) {
			tmpar = st.split(";");
			for (var i=0, j=""; i<tmpar.length; i++, j="") {
				j = trim(tmpar[i]).split(":");
				if (j.length==2 && j[1]!="") {
					if (j[0].toLowerCase()=="z-index") {
						obj.style.zIndex=j[1];
					} else {
						obj.style[j[0]]=j[1];
					}
				}
			}
		}
		if (typeof ih == "string" && ih != "" ) { obj.innerHTML= ih; }
		if (typeof te == "string" && te != "" ) { obj.appendChild( document.createTextNode(te)); }
		if (typeof su == "object") { obj.appendChild(su); }
		if (typeof pa == "object") { return this.aCH(pa, obj); }
		return obj;
	};
	this.cHE  = function (ta, at, st, ih, te, su, pa) { return this.cE(ta, at, st, ih, te, su, pa); };
	this.cDIV = function (at, st, ih, te, su, pa) { return this.cE("DIV", at, st, ih, te, su, pa); };
	this.cTA  = function (at, st, ih, te, su, pa) { return this.cE("TABLE", at, st, ih, te, su, pa); };
	this.cTB  = function (at, st, ih, te, su, pa) { return this.cE("TBODY", at, st, ih, te, su, pa); };
	this.cTR  = function (at, st, ih, te, su, pa) { return this.cE("TR", at, st, ih, te, su, pa); };
	this.cTD  = function (at, st, ih, te, su, pa) { return this.cE("TD", at, st, ih, te, su, pa); };
	this.cIMG = function (at, st, ih, te, su, pa) { return this.cE("IMG", at, st, ih, te, su, pa); };
	this.cOP = function (at, st, ih, te, su, pa) { return this.cE("OPTION", at, st, ih, te, su, pa); };
	this.aCH  = function (pa, su) { if (typeof pa != "object") { pa = new Object(); } pa.appendChild(su); return pa; };
	this.nCH  = function (pa, su) { if (typeof pa != "object") { pa = new Object(); } pa.innerHTML=""; pa.appendChild(su); return pa; };
};

ammo.html.data = function() {
	ammo.html.call(this);
	ammo.data.call(this);
};

ammo.html.utilities = function() {
	ammo.html.data.call(this);
	this.ptfeetitle = function(ft) {
		var tmp;
		if (ft == "PA") { return H_IBE_PA; }
		else if (ft == "PC") { return H_IBE_PC; }
		else if (ft == "PI") { return H_IBE_PI; }
		else { tmp = eval("H_IBE_"+ft); return tmp + " (" + ft + ")"; }
	};
	this.ptaircraft = function(ac) {
		if ("string" == typeof ac && ac != "") {
			for (i=0; i<this.accode.length; i++) {
				if (this.accode[i]==ac) { return this.acname[i]; } }
		}
		return ac;
	};
	this.ptairport = function(apt) {
		if ("string" == typeof apt && apt != "") {
			for (i=0; i<this.aptcode.length; i++) {
				if (this.aptcode[i]==apt) { return this.aptname[i]; } }
		}
		return apt;
	};
	this.ptcity = function(apt) {
		if ("string" == typeof apt && apt != "") {
			for (i=0; i<this.aptcode.length; i++) {
				if (this.aptcode[i]==apt) { return this.ctyname[i]; } }
		}
		return apt;
	};
	this.ptcurrency = function(cr) {
		if ("string" == typeof cr && cr != "") {
			for (i=0; i<this.crcode.length; i++) {
				if (this.crcode[i]==cr) { return this.crname[i]; } }
		}
		return cr;
	};
	this.pttime = function(tm) {
		if (typeof tm == "string" && tm.length==4 ) {
			return (tm.substring(0,2) + ":" + tm.substring(2,4)); }
		return tm;
	};
	this.ptdifftm = function(depart, arrive) {
		if(typeof depart=="string"&&depart.length==4
			&&typeof arrive=="string"&&arrive.length==4){
			if (depart < arrive) {
				var tTM = eval(arrive.substring(0,2) * 60)
					+ parseInt(arrive.substring(2,4), 10)
					- eval(depart.substring(0,2) * 60)
					- parseInt(depart.substring(2,4), 10);
				return (parseInt(tTM/60, 10) + this.tmtext[4] + (tTM%60) + this.tmtext[5]);
			} else if (depart > arrive) {
				var tTM = eval(arrive.substring(0,2) * 60)
					+ parseInt(arrive.substring(2,4), 10)
					+ 1440
					- eval(depart.substring(0,2) * 60)
					- parseInt(depart.substring(2,4), 10);
				return (parseInt(tTM/60, 10) + this.tmtext[4] + (tTM%60) + this.tmtext[5]);
			}
		}
		return "0" +this.tmtext[4] + "0" + this.tmtext[5];
	};
	this.ptdifftm2 = function(depart, arrive, from, to) {
		if(typeof depart=="string"&&depart.length==4
			&&typeof arrive=="string"&&arrive.length==4){
			if (depart < arrive) {
				var tTM = eval(arrive.substring(0,2) * 60)
					+ parseInt(arrive.substring(2,4), 10)
					- eval(depart.substring(0,2) * 60)
					- parseInt(depart.substring(2,4), 10);
				return (parseInt(tTM/60, 10) 
					+ (from=="MFM" && to=="BKK"?1:0) 
					+ (from=="MFM" && (to=="KIX" || to=="ICN")?-1:0) 
					+ (from=="BKK" && to=="MFM"?-1:0) 
					+ ((from=="KIX" || from=="ICN") && to=="MFM"?1:0) 
					+ this.tmtext[4] + (tTM%60) + this.tmtext[5]);
			} else if (depart > arrive) {
				var tTM = eval(arrive.substring(0,2) * 60)
					+ parseInt(arrive.substring(2,4), 10)
					+ 1440
					- eval(depart.substring(0,2) * 60)
					- parseInt(depart.substring(2,4), 10);
				return (parseInt(tTM/60, 10) 
					+ (from=="MFM" && to=="BKK"?1:0) 
					+ (from=="MFM" && (to=="KIX" || to=="ICN")?-1:0) 
					+ (from=="BKK" && to=="MFM"?-1:0) 
					+ ((from=="KIX" || from=="ICN") && to=="MFM"?1:0) 
					+ this.tmtext[4] + (tTM%60) + this.tmtext[5]);
			}
		}
		return "0" +this.tmtext[4] + "0" + this.tmtext[5];
	};
	this.ptclass = function(cc) {
		if (cc.toLowerCase() == "b") { return this.cbcls[1]; }
		else if (cc.toLowerCase() == "i") { return this.cbcls[2]; }
		else { return this.cbcls[0]; }
	};
	this.ptOPST = function (lan, cty, oOBJ, sSTR) {
		var co, st, i;
		var tmp, tmp2;
		if (lan == H_LV03 || lan == H_LV01 || lan == H_LV06) {
			tmp = this.dispcht;
			tmp2 = this.dispchtc;
		} else {
			tmp = this.dispchs;
			tmp2 = this.dispchsc;
		}
		if ("object" == typeof oOBJ) {
			oOBJ.innerHTML = "";
			for (i=0; i<tmp.length; i++) {
				if (tmp2[i] != "CSX" && tmp2[i] != "KWE" && tmp2[i] != "HAK" && tmp2[i] != "KMG"
						&& tmp2[i] != "SZX"
						&& tmp2[i] != "MNL"
						&& tmp2[i] != "SHA/PVG"
						&& tmp2[i] != "KWL") {
					oOBJ = this.cOP( "value:"+tmp2[i]+"; "+
						(tmp2[i]==sSTR ? "selected:selected" : ""),
						"", "", tmp[i], "", oOBJ);
				}
			}
		}
	};
	this.ptOPSTIBE = function (lan, cty, oOBJ, sSTR) {
		var co, st, i;
		var tmp, tmp2;
		if (lan == H_LV03 || lan == H_LV01 || lan == H_LV06) {
			tmp = this.dispcht;
			tmp2 = this.dispchtc;
		} else {
			tmp = this.dispchs;
			tmp2 = this.dispchsc;
		}
		if ("object" == typeof oOBJ) {
			oOBJ.innerHTML = "";
			for (i=0; i<tmp.length; i++) {
				if (tmp2[i] != "CSX" && tmp2[i] != "KWE" && tmp2[i] != "HAK" && tmp2[i] != "KMG"
				  && tmp2[i] != "SZX"
				  && tmp2[i] != "MNL"
				  && tmp2[i] != "SHA"
				  && tmp2[i] != "PVG"
				  && tmp2[i] != "SHA/PVG"
				  && tmp2[i] != "KWL") {
					oOBJ = this.cOP( "value:"+tmp2[i]+"; "+
						(tmp2[i]==sSTR ? "selected:selected" : ""),
						"", "", tmp[i], "", oOBJ);
				} else if ( tmp2[i] == "SHA/PVG") {
					oOBJ = this.cOP( "value:SHA; "+
						("SHA"==sSTR ? "selected:selected" : ""),
						"", "", tmp[i], "", oOBJ);
				}
			}
		}
	};
	this.ptOPMFM = function (lan, cty, oOBJ) {
		var co, st, i;
		var tmp;
		if (lan == H_LV03 || lan == H_LV01 || lan == H_LV06) {
			tmp = H_CSP01;
		} else {
			tmp = H_CSO01;
		}
		if ("object" == typeof oOBJ) {
			oOBJ.innerHTML = "";
			oOBJ = this.cOP( "value:MFM; selected:selected; width:200",
				"", "", tmp, "", oOBJ);
		}
	};
	this.ptOPSTMOTW = function (lan, cty, oOBJ, sSTR) {
		var co, st, i;
		var tmp, tmp2;
		if (lan == H_LV03 || lan == H_LV01 || lan == H_LV06) {
			tmp = this.dispcht;
			tmp2 = this.dispchtc;
		} else {
			tmp = this.dispchs;
			tmp2 = this.dispchsc;
		}
		if ("object" == typeof oOBJ) {
			oOBJ.innerHTML = "";
			for (i=0; i<tmp.length; i++) {
				if (tmp2[i] == "TPE" || tmp2[i] == "KHH" || tmp2[i] == "MFM" || tmp2[i] == "PVG" || tmp2[i] == "PEK" || tmp2[i] == "NKG" || tmp2[i] == "XMN" || tmp2[i] == "HGH" || tmp2[i] == "NNG" || tmp2[i] == "CTU" || tmp2[i] == "SHA" || tmp2[i] == "SIN" || tmp2[i] == "HFE" || tmp2[i] == "BKK" || tmp2[i] == "NGB" || tmp2[i] == "ICN" || tmp2[i] == "CKG" || tmp2[i] == "TYN") {
					oOBJ = this.cOP( "value:"+tmp2[i]+"; "+
						(tmp2[i]==sSTR ? "selected:selected" : ""),
						"", "", tmp[i], "", oOBJ);
				}
			}
		}
	};
	this.ptOPSTMOTWIBE = function (lan, cty, oOBJ, sSTR) {
		var co, st, i;
		var tmp, tmp2;
		if (lan == H_LV03 || lan == H_LV01 || lan == H_LV06) {
			tmp = this.dispcht;
			tmp2 = this.dispchtc;
		} else {
			tmp = this.dispchs;
			tmp2 = this.dispchsc;
		}
		if ("object" == typeof oOBJ) {
			oOBJ.innerHTML = "";
			for (i=0; i<tmp.length; i++) {
				if (tmp2[i] == "TPE" || tmp2[i] == "KHH" || tmp2[i] == "MFM" || tmp2[i] == "PEK" || tmp2[i] == "NKG" || tmp2[i] == "XMN" || tmp2[i] == "HGH" || tmp2[i] == "NNG" || tmp2[i] == "CTU" || tmp2[i] == "SIN" || tmp2[i] == "HFE" || tmp2[i] == "BKK" || tmp2[i] == "NGB" || tmp2[i] == "ICN" || tmp2[i] == "CKG" || tmp2[i] == "TYN") {
					oOBJ = this.cOP( "value:"+tmp2[i]+"; "+
						(tmp2[i]==sSTR ? "selected:selected" : ""),
						"", "", tmp[i], "", oOBJ);
				} else if (tmp2[i] == "SHA/PVG") {
					oOBJ = this.cOP( "value:SHA; "+
						("SHA"==sSTR ? "selected:selected" : ""),
						"", "", tmp[i], "", oOBJ);
				}
			}
		}
	};
	this.ptOPMOTWCN = function (lan, cty, oOBJ, sSTR) {
		var co, st, i;
		var tmp, tmp2;
		if (lan == H_LV03 || lan == H_LV01 || lan == H_LV06) {
			tmp = this.dispcht;
			tmp2 = this.dispchtc;
		} else {
			tmp = this.dispchs;
			tmp2 = this.dispchsc;
		}
		if ("object" == typeof oOBJ) {
			oOBJ.innerHTML = "";
			for (i=0; i<tmp.length; i++) {
				if (tmp2[i] != "CSX" && tmp2[i] != "KWE" && tmp2[i] != "HAK" && tmp2[i] != "KMG" && tmp2[i] != "SZX"
					&& tmp2[i] != "ICN" && tmp2[i] != "KIX" && tmp2[i] != "BKK" && tmp2[i] != "MNL") {
					oOBJ = this.cOP( "value:"+tmp2[i]+"; "+
						(tmp2[i]==sSTR ? "selected:selected" : ""),
						"", "", tmp[i], "", oOBJ);
				}
			}
		}
	};
	this.pttac = function (tacid) {
		if (typeof eval("H_IBE_TCTEXT"+tacid) == "string") { return eval("H_IBE_TCTEXT"+tacid); }
		else { return H_IBE_TCTEXT0; }
	};
	this.ptffpmile = function (cls) {
		var uc = cls, pers = "";
		var fd = new ammo.cookie.ibe.fltinfo();
		if (uc != "") {
			if (this.diffDT_s(fd.getdd(), 'mm/dd/yyyy', '3/28/2010', 'mm/dd/yyyy') >= 0 ) {
				if ( uc == 'C' || uc == 'D' || uc == 'Z' || uc == 'J') { pers = '130%';
				} else if ( uc == 'Y' || uc == 'B' || uc == 'M' || uc == 'H' || uc == 'K') { pers = '100%';
				} else if ( uc == 'L' || uc == 'Q' || uc == 'G' || uc == 'S' || uc == 'V' || uc == 'U' || uc == 'W') { pers = '50%';
				} else if ( uc == 'X' || uc == 'N' || uc == 'T' || uc == 'E' || uc == 'I' || uc == 'R') { pers = '0 '+H_MILES;
				} else { pers = H_CHECK; 
				}
			} else if (this.diffDT_s(fd.getdd(), 'mm/dd/yyyy', '7/1/2008', 'mm/dd/yyyy') >= 0 ) {
				if (uc == 'C') { pers = '200%';
				} else if ( uc == 'D' || uc == 'Y') { pers = '150%';
				} else if ( uc == 'J' || uc == 'B' || uc == 'M' || uc == 'L') { pers = '100%';
				} else if ( uc == 'Z' || uc == 'W' || uc == 'U') { pers = '80%';
				} else if ( uc == 'H' || uc == 'T' || uc == 'Q' || uc == 'S') { pers = '50%';
				} else if ( uc == 'I' || uc == 'R' || uc == 'X' || uc == 'N') { pers = '0%';
				} else if ( uc == 'V') { pers = '150'+H_MILES;
				} else if ( uc == 'E' || uc == 'G' || uc == 'K') { pers = '0'+H_MILES;
				} else { pers = H_CHECK; 
				}
			} else {
				if (uc == 'C') { pers = '200%';
				} else if ( uc == 'D' || uc == 'Y') { pers = '150%';
				} else if ( uc == 'J' || uc == 'Z' || uc == 'B' || uc == 'M' || uc == 'L' || uc == 'W' || uc == 'U') { pers = '100%';
				} else if ( uc == 'H' || uc == 'T' || uc == 'Q' || uc == 'S') { pers = '50%';
				} else if ( uc == 'I' || uc == 'R' || uc == 'X' || uc == 'N') { pers = '0%';
				} else if ( uc == 'V') { pers = '150'+H_MILES;
				} else if ( uc == 'E' || uc == 'G' || uc == 'K') { pers = '0'+H_MILES;
				} else { pers = H_CHECK; 
				}
			}
			return H_IBE_FFP_FT + uc + H_IBE_FFP_MT + pers + H_IBE_FFP_LT;
		}
		return "";
	};
	this.grpCHK = function (oOBJ, iIDX) {
		for (var i=0; i<oOBJ.length; i++) { oOBJ[i].checked = false; }
		oOBJ[iIDX].checked = true;
	};
	this.vldDT = function (sDT, iFMT) {
		var j = trim(sDT);
		if (iFMT == "mm/dd/yyyy") {
			if (j=="mm/dd/yyyy") { return 1; }
			if (j.length==0) { return 5; }
			if (j.length>10 || j.length<8) { return 2; }
			var  reg  =  /^(\d{1,2})(\/)(\d{1,2})\2(\d{1,4})$/;    
			var  r  =  j.match(reg);    
			if (r==null) { return  3; }
			var kk = new Date(r[4], r[1]-1, r[3]);    
			if (r[4]!=kk.getFullYear() || r[1]!=(kk.getMonth()+1)
				|| r[3]!=kk.getDate()) { return 4; }
		}
		return 0;
	};
	this.diffDT_s = function (sDT, sFMT, eDT, eFMT) {
		var j, k, l, m;
		if (typeof sDT == "object") {
			j = sDT.getFullYear() + "/" + (sDT.getMonth()+1) + "/" + sDT.getDate();
		}
		if (typeof sDT == "string") {
			if (this.vldDT(sDT, sFMT)==0) {
				j = this.fmtDT(sDT, sFMT, "yyyy/m/d");
			} else {
				return 1;
			}
		}
		if (typeof eDT == "object") {
			k = eDT.getFullYear() + "/" + (eDT.getMonth()+1) + "/" + eDT.getDate();
		}
		if (typeof eDT == "string") {
			if (this.vldDT(eDT, eFMT)==0) {
				k = this.fmtDT(eDT, eFMT, "yyyy/m/d");
			} else {
				return 2;
			}
		}
		l = new Date(j).valueOf();
		m = new Date(k).valueOf();
		return (l - m);
	};
	this.diffDT_y = function (SEC) {
		return Math.floor(Math.abs(SEC)/86400000/365);
	};		
	this.diffDT_m = function (SEC) {
		return Math.floor(Math.abs(SEC)/86400000/30);
	};		
	this.diffDT_d = function (SEC) {
		return Math.floor(Math.abs(SEC)/86400000);
	};		
	this.isnumber = function(nb) {
		var j = trim(nb);
		var  reg  =  /^\d*$/;    
		var  r  =  j.match(reg);    
		if (r==null) { return  false; } else { return true; }
	};
	this.isffpcard = function(cid) {
		if (cid.length != 9 || !this.isnumber(cid)) { return false; }
		if (parseInt(cid.substring(0,8), 10)%7 != parseInt(cid.substring(8,9), 10)) { return false; }
		return true;
	};
	this.ischara = function(nb) {
		var j = trim(nb);
		var  reg  =  /^[A-Za-z]*$/;    
		var  r  =  j.match(reg);    
		if (r==null) { return  false; } else { return true; }
	};
	this.isemail = function(nb) {
		var j = trim(nb);
		var  reg  =  /^\w([-.\w])*@\w([-.\w])*\.\w([-.\w])*$/;
		var  r  =  j.match(reg);    
		if (r==null) { return  false; } else { return true; }
	};
	this.isnumchar = function(nb) {
		var j = trim(nb);
		var  reg  =  /^[A-Za-z0-9]*$/;    
		var  r  =  j.match(reg);    
		if (r==null) { return  false; } else { return true; }
	};
	this.fmtCR = function (sCR, iFMT, oFMT) {
		var j;
		if (typeof sCR == "string" || typeof sCR == "number") {
			j = trim(String(sCR));
			//if (j.length==0) { return j; }
			//if (j==iFMT) { return j; }
			if (iFMT == "0") {
				if (oFMT == "0.00") {
					return j+".00";
				}
			}
			if (iFMT == "100") {
				if (oFMT == "0.00") {
					var t  = j / 100;
					var t3 = String(t);
					var t2 = t3.indexOf(".");
					if (t2 == -1) { return (t3 + ".00"); }
					else if (t2 == t3.length - 2 ) { return (t3 + "0"); }
					else { return t3; }
				}
			}
			return j;
		}
		return "";
	};
	this.fmtDT = function (sDT, iFMT, oFMT) {
		var j,dND,y,m,d,w;
		if (typeof sDT == "string") {
			j = trim(sDT);
			if (j.length==0) { return j; }
			if (j==iFMT) { return j; }
			if (iFMT == "mm/dd/yyyy") {
				if (j.length>10 || j.length<8) { return j; }
				var  reg  =  /^(\d{1,2})(\/)(\d{1,2})\2(\d{1,4})$/;    
				var  r  =  j.match(reg);    
				if (r==null) { return j; }
				dND = new Date(r[4], r[1]-1, r[3]);    
				y=dND.getFullYear();	m=dND.getMonth()+1;
				d=dND.getDate();	w=dND.getDay();
				if (oFMT == "mm/dd/yyyy") {
					return (m>9 ? "":"0")+m+"/"+(d>9 ? "":"0")+d+"/"+y;
				} else if (oFMT == "yyyy/mm/dd") {
					return y+"/"+(m>9 ? "":"0")+m+"/"+(d>9 ? "":"0")+d;
				} else if (oFMT == "yyyy/m/d") {
					return y+"/"+m+"/"+d;
				} else if (oFMT == "yHYmHMdHDsHW") {
					return y+H_YEA+m+H_MON+d+H_DAY+" "+this.wdname[w];
				} else if (oFMT == "yHYmHMdHDsHW2") {
					return y+H_YEA+m+H_MON+d+H_DAY+" "+this.wdname[w+7];
				} else if (oFMT == "yHYmHMdHD") {
					return y+H_YEA+m+H_MON+d+H_DAY;
				}
			}
			return j;
		}
		if (typeof sDT == "object") {
			dND=sDT;
			if (iFMT == "objDate") {
				y=dND.getFullYear();	m=dND.getMonth()+1;
				d=dND.getDate();	w=dND.getDay();
				if (oFMT == "mm/dd/yyyy") {
					return (m>9 ? "":"0")+m+"/"+(d>9 ? "":"0")+d+"/"+y;
				} else if (oFMT == "m/yyyy") {
					return m+"/"+y;
				} else if (oFMT == "m/d/yyyy") {
					return m+"/"+d+"/"+y;
				}
			}
			return "";
		}
		return "";
	};
};

ammo.html.navibar = function() {
	ammo.html.data.call(this);
	this.loopnum=-1;
	this.mknavibartr_normal = function(idDIV, oObj) {
		var oTD, oTR, oIMG, oTA, oDIV, oO2, f = this;
		oTR = f.cTR();
		oTR.onmouseover=function() {snavi(this);};
		oTR.onmouseout=function() {cnavi(this);};

		oIMG = f.cIMG("width:20; height:1; src:/images/spacer.gif");
		oTR = f.cTD("", "", "", "", oIMG, oTR);

		oTD = f.cTD( ((typeof oObj.submenu != "object")?"colSpan:2; ":"") + "width:100; height:26; id:"+idDIV+oObj.id, 
			((oObj.url!="")?"cursor:pointer; ":""),
			"", oObj.text);
		if (typeof oObj.submenu != "object") {
			oTD.onmouseover= function() { changeClassById(idDIV+oObj.id, "navi_on"); };
			oTD.onmouseout= function() { changeClassById(idDIV+oObj.id, ""); };
			if (oObj.url!="") { oTD.onclick=function() {GotoURL(oObj.url); }; }
			oTR = f.aCH(oTR, oTD);
		} else {
			oTD.onmouseover= function() { changeClassById(idDIV+oObj.id,"navi_on"); MM_showHideLayers(idDIV+oObj.submenu.id,"","show"); };
			oTD.onmouseout= function() { changeClassById(idDIV+oObj.id,""); MM_showHideLayers(idDIV+oObj.submenu.id,"","hide"); };
			if (oObj.url!="") { oTD.onclick=function() {GotoURL(oObj.url); }; }
			oTR = f.aCH(oTR, oTD);

			oTB = f.cTB();
			oO2 = oObj.submenu.itemdata;
			for (var j=0; j<oO2.length;j++) {
				oTD = f.cTD("class:navisub_td; id:"+idDIV+oO2[j].id, "cursor:pointer", "", "", 
					f.cHE("A", "target:_top; class:b2b; href:"+oO2[j].url, "", "", oO2[j].text, ""));
				oTD.onmouseover= function() { changeClassById(this, "navisub_tdon"); };
				oTD.onmouseout= function() { changeClassById(this, "navisub_td"); };

				oTB = f.cTR("", "", "", "", oTD, oTB);
			}

			oDIV = f.cTA( "cellSpacing:1; cellPadding:2; bgColor:#666666; border:0", "", "", "", oTB, f.cDIV("id:"+idDIV+oObj.submenu.id, "width:200px; z-index:1; left:-10px; visibility:hidden; position:absolute; top:0px;") );
			oDIV.onmouseover=function() {MM_showHideLayers(idDIV+oObj.submenu.id,"","show"); };
			oDIV.onmouseout=function() {MM_showHideLayers(idDIV+oObj.submenu.id,"","hide"); };
			oTD = f.cDIV("", "position:absolute", "", "", oDIV, f.cTD("width:20"));
			oTD.onmouseover= function() {
				changeClassById(idDIV+oObj.id,"navi_on"); MM_showHideLayers(idDIV+oObj.submenu.id,"","show");
			};
			oTD.onmouseout= function() {
				changeClassById(idDIV+oObj.id,""); MM_showHideLayers(idDIV+oObj.submenu.id,"","hide");
			};

			oTR = f.aCH(oTR, oTD);
		}
		return oTR;
	};
	this.mknavibartr_selected = function(idDIV, oObj) {
		var f = this, oTR;
		oTR = f.cTD("", "", "", "",
			f.cIMG("src:/images/spacer.gif", "width:19%; height:1"),
			f.cTR("", "backgroundColor:#8f97af"));
		oTR = f.cTD( "class:navi_on; colSpan:2; width:100; height:25; id:"+idDIV+oObj.id, "", "", oObj.text, "", oTR);
		return oTR;
	};
	this.mknavibartr_selectedsub = function(oObj) {
		var f = this, oTD, oTR, oIMG, oTB, oTA, oDIV, oTR2, oTB2, oO2;
		if (typeof oObj.submenu == "object") {
			oTR = f.cTD("bgcolor:#8f97af", "width:1", "", "", 
				f.cIMG("src:/images/spacer.gif", "width:1; height:1"),
				f.cTR());
			oTR = f.cTD("bgcolor:#d0d0d0", "", "", "", 
				f.cIMG("src:/images/spacer.gif", "width:1; height:2"),
				f.cTR());
			oTR = f.cTD("bgcolor:#8f97af", "width:1", "", "", 
				f.cIMG("src:/images/spacer.gif", "width:1; height:1"),
				f.cTR());
			oTB = f.cTB("", "", "", "", oTR);

			oTR = f.cTD("bgcolor:#8f97af", "width:1", "", "", 
				f.cIMG("src:/images/spacer.gif", "width:1; height:1"),
				f.cTR());

			oTB2 = f.cTB();
			oO2 = oObj.submenu.itemdata;
			if (oObj.col == "1" ) {
				for (var j=0; j<oO2.length;j++) {
					oTR2 = f.cTD("width:100; height:20; align:left", "", "", "", 
						f.cHE("A", "href:"+oO2[j].url, "color:#d74747", "", oO2[j].text),
						f.cTR("", "", "", "", f.cTD("TD", "width:19%; height:20; align:right")));
					oTB2 = f.aCH(oTB2, oTR2);
				}
			} else {
				var colsp = parseInt(oObj.col, 10);
				for (var i=0; i<oO2.length;i++) {
					if (i%colsp == 0) {
						oTR2 = f.cTR("", "", "", "", f.cTD("width:19%; height:20; align:right"));
					}
					oTR2 = f.cTD("width:27%; height:20; align:left", "", "", "", 
						f.cHE("A", "href:"+oO2[i].url, "color:#d74747", "", oO2[i].text, ""),
						oTR2);
					if (i%colsp == colsp-1) { oTB2 = f.aCH(oTB2, oTR2); }
				}
				for (; i%colsp!=0;i++) {
					oTR2 = f.aCH(oTR2, f.cTD("width:27%; height:20; align:left"));
					if (i%colsp == colsp-1) { oTB2 = f.aCH(oTB2, oTR2); }
				}
			}
			oTR = f.cTD("", "", "", "",
				f.cTA("cellSpacing:0; cellPadding:0; class:c12; border:0; width:100%", "", "", "", oTB2),
				oTR);
			oTR = f.cTD("bgcolor:#8f97af", "width:1", "", "", 
				f.cIMG("src:/images/spacer.gif", "width:1; height:1"),
				oTR);
			oTB = f.aCH(oTB, oTR);

			oTB = f.aCH(oTB, f.cTD("bgColor:#8f97af; height:1; colSpan:3", "", "", "",
				f.cIMG("src:/images/spacer.gif", "width:1; height:1"),
				f.cTR()));

			oTR = f.cTD("bgColor:#ffffff; colSpan:3", "", "", "", 
				f.cTA("width:100%; border:0; cellSpacing:0; cellPadding:0", "", "", "", oTB),
				f.cTR());
		}
		return oTR;
	};
	this.initnavibar = function(idMENUERDIV, iWIDTH, idSelected) {
		var f = this, oTD, oTR, oTB, oTA, oTGT=$(idMENUERDIV);
		var oO = f.navibar["LEFTNAVIBAR"];
		oTGT.innerHTML="";
		oTB = f.cTB();
		for (var i=0; i < oO.length;i++) {
			oTR="";
			if (typeof oO[i] == "object") {
				if (oO[i].id != idSelected) {
					oTR = this.mknavibartr_normal(idMENUERDIV, oO[i]);
				} else {
					oTR = this.mknavibartr_selected(idMENUERDIV, oO[i]);
				}
				if (typeof oTR == "object") { oTB=f.aCH(oTB, oTR); }
				oTB = f.cTR("", "", "", "",
					f.cTD("colSpan:3; height:1; bgColor:#ffffff", "", "", "", ""),
					oTB);
				if (oO[i].id == idSelected) { oTR = this.mknavibartr_selectedsub(oO[i]); }
				if (typeof oTR == "object") { oTB=f.aCH(oTB, oTR); }
				oTB = f.cTR("", "", "", "", 
					f.cTD("colSpan:3; height:2; bgColor:#ffffff", "", "", "", ""),
					oTB);
			}
		}
		oTA = f.cTA("class:navi; cellSpacing:0; cellPadding:0; width:"+iWIDTH+"; bgColor:#d0d0d0; border:0",
				"", "", "", oTB);
		oTGT = f.nCH(oTGT, oTA);
	};
	this.initnavibar_animation = function(oSTR, iWIDTH) {
		if(this.loopnum>12) { this.loopnum=-1; }
		if (this.loopnum<0) {
			this.initnavibar(oSTR, iWIDTH, "");
		} else {
			this.initnavibar(oSTR, iWIDTH, "navi_"+this.loopnum);
		}
		this.loopnum++;
	};
	this.initnavibar_animation_start = function(oSTR, iWIDTH, iTIMEOUT) {
		this.initnavibar(oSTR, iWIDTH, "");
		this.loopnum++;
		ka = new ammo.html.navibar() ;
		setInterval("ka.initnavibar_animation('"+oSTR+"', "+iWIDTH+")", parseInt(iTIMEOUT, 10));
	};
	var argc=arguments.length, argv=arguments;
	if (argc == 1) { this.initnavibar(argv[0], 140, ""); };
	if (argc == 2) { this.initnavibar(argv[0], argv[1], ""); };
	if (argc == 3) { this.initnavibar(argv[0], argv[1], argv[2]); };
};

ammo.html.regilang = function() {
	ammo.html.data.call(this);
	this.initcity_form = function(ckregi, ckcity) {
		if (ckcity.length==3) { return ckcity; }
		if (ckcity=="") {
			if (ckregi!="") {
				for (var k2=1,tmpv; k2 <= this.rgctv.length ; k2++) {
					tmpv = this.rgctv[k2];
					if (tmpv == ckregi) { 
						return this.rgctc[k2];
					}
				}
			}
			return this.rgctc[1];
		}
		return "";
	};
	this.initcity = function(region){if(region.length==3){return region;}return "";};
	this.initregi = function(region) {
		if (region.length==2) { return region; }
		if (region.length==3) {
			for (var k2=1,tmpv,tmpt; k2 <= this.rgctv.length ; k2++) {
				tmpv = this.rgctv[k2];
				if (tmpv.length==2) { tmpt = tmpv;
				} else if (tmpv == region) { return tmpt; }
			}
		}
		return "";
	};
};


