 



function getObj( name, forceIEBehavior )

{

    var newObj;

    if ( typeof name == "string" ) {

        if (document.getElementById) {

            newObj = document.getElementById(name);

            if ( newObj == null && forceIEBehavior != null & forceIEBehavior ) {

                var newObjArray = document.getElementsByName( name );

                if ( newObjArray != null && newObjArray.length > 0 ) 

                    newObj = newObjArray[ 0 ];

            }else{

                var newObjArray = document.getElementsByName( name );

                if ( newObjArray != null && newObjArray.length > 0 ) 

                    newObj = newObjArray[ 0 ];

            }

        }

        else if (document.all) {

            newObj = document.all[name];

        }

        else if (document.layers) {

            newObj = document.layers[name];

        }

    }

    else

        newObj = name;

    return newObj;

}







function getObjArray( name )

{

    var newObjArray;

    if ( typeof name == "string" ) {

        if (document.getElementById) {

			 newObjArray = document.getElementsByName(name);

        }

        else if(document.getElementsByName)

            newObjArray = document.getElementsByName(name);

        else if (document.all)

            newObjArray = document.all[name];

        else if (document.layers)

            newObjArray = document.layers[name];

    }

    else

        newObjArray = name;

    return newObjArray;

}



function doUpdateHtml(obj,text) {

	if(obj.innerHTML != null)

		obj.innerHTML = text;

	else if(obj.insertAdjacentHTML != null) {

		obj.insertAdjacentHTML("beforeEnd",text);

	}

	else if(document.createElement != null) {

	

	}

}

function doUpdateText(obj,text) {

	if(obj.innerText != null)

		obj.innerText = text;

	else if(obj.innerHTML != null)

		obj.innerHTML = text;

	else if(obj.insertAdjacentHTML != null) {

		obj.insertAdjacentHTML("beforeEnd",text);

	}

	else if(document.createElement != null) {

	}

}

function doGetText(obj) {

	if(obj.innerText != null)

		return obj.innerText;

	else if(obj.innerHTML != null)

		return obj.innerHTML;

}







function getStyle( name, forceIEBehavior )

{

    var myObj = getObj( name, forceIEBehavior );

    return myObj == null ? null : myObj.style;

}





function hideElement( name )

{

	if ( document.getElementById )

		getStyle( name ).visibility="hidden";

	else if ( document.layers )

		getObj( name ).visibility = "hide";

}





function showElement( name )

{

	if ( document.getElementById )

		getStyle( name ).visibility="visible"

	else if ( document.layers )

		getObj( name ).visibility = "show";

}





function menuElementStatus( name )

{

	if ( document.getElementById ){

		if(getStyle( name ).visibility == "visible")

			return true

		else

			return false

	}else if ( document.layers ){

		if(getObj( name ).visibility == "show")

			return true

		else

			return false

	}

}








var currentlyHovering_Main = false;



function doMenu(pId,pEvt) {

    currentlyHovering = true;



    var pEvent= (window.event) ? window.event : pEvt;

    

    if (window.event)event.cancelBubble=true;

	else if (pEvent.stopPropagation)pEvent.stopPropagation()



    setTimeout('doPopulateCheck('+pId+','+(pEvent.type=="click")+','+(pEvent.type=="mouseover")+')',500);

}



function doPopulateCheck(pId,pblnClickStatus,pblnmouseoverStatus) {



    if (!currentlyHovering_Main){

        doPopulateMenu(pId,pblnClickStatus,pblnmouseoverStatus);

    }

}



function doHideMenus(){

	var objSubMenu;

	for (i=0;i<13;i++) {

		objSubMenu ='menuItem' + i.toString();

		if(getObj(objSubMenu)){

			if (menuElementStatus( objSubMenu ) ){

				hideElement( objSubMenu );

				var navElement = getObj('navItem' + i.toString());

				if (navElement != null) {

						if (navElement.className.indexOf("On") != -1) 

						navElement.className = navElement.className.substring(0, (navElement.className.length-2));

				}

				return;

			}

		}

	}

}



function doPopulateMenu(pId,pblnClickStatus,pblnmouseoverStatus){

        doHideMenus();

        var objMenu = getObj('navItem' + pId);

        var strSubMenu = 'menuItem' + pId;

    

        if (pblnClickStatus==true && (!menuElementStatus( strSubMenu )) || pblnmouseoverStatus==true){

            objMenu.className = objMenu.className + "On";

            showElement( strSubMenu );

        }	

        else if (pblnClickStatus==true){

            if (objMenu.className.indexOf("On") != -1) {

                    objMenu.className = objMenu.className.substring(0, (objMenu.className.length-2));

            }

            hideElement( strSubMenu );

        }

}



function doHideSubMenu(pId){

	var objMId = getObj('navItem' + pId)

	var objSMId = getObj('menuItem' + pId)

	

	if (!currentlyHovering) {

		if (typeof objSMId !="undefined" && objSMId.style.visibility =="visible"){

			if (objMId.className.indexOf("On") != -1) {

				objMId.className = objMId.className.substring(0, (objMId.className.length-2));

				hideElement( 'menuItem' + pId );

				strVal = getObj('selectedMenu').value;

				if(getObj('navItem' +strVal)){

					objNavSelected = getObj('navItem' +strVal);

					if(objNavSelected.className != objNavSelected.clasName+"On")

						objNavSelected.className = objNavSelected.className + "On";

					showElement( 'menuItem'+strVal);

					currentlyHovering = true;

				}

			}

		}

	}

}



function doHideMenu(pId) {

	

    currentlyHovering=false;

    setTimeout("doHideCheck("+pId+")",500);

}



function doHideCheck(pId) {

    if (!currentlyHovering){

    	setTimeout("doHideSubMenu("+pId+")",1000);

    }

}



function doPersistHover(pId) {

	currentlyHovering = true;

    currentlyHovering_Main = true;

}



function doNotPersistHover(pId) {

    currentlyHovering_Main = false;

	 

    if (currentlyHovering){

        currentlyHovering = false;

        setTimeout("doHideSubMenu("+pId+")",1500);

    }

}



function setMenu(pId){

	getObj('selectedMenu').value=pId;

}



  function setFooterHeight(){



    var box = new Array("left","middle","right"); 



    for(x=0;x<box.length;x++){ 

        h = getObj(box[x]).offsetHeight;

        for(y=0;y<box.length;y++){

            test_h = getObj(box[y]).offsetHeight;

            if(h<test_h){ 

                h = test_h;

            }

        }  

    }

    if(h < 400){

        h=800;

    }

    

    for(x=0;x<box.length;x++){

        getObj(box[x]).style.height = h +"px"; 

    }

  }

  





function doRollover(elID) {

	var midEl = getObj(elID + "Middle");

	var leftEl = getObj(elID + "Left");

	var rightEl = getObj(elID + "Right");

	

	if (midEl.className.indexOf("Roll") == -1) {

		midEl.className = midEl.className + "Roll";

		leftEl.className = leftEl.className + "Roll";

		rightEl.className = rightEl.className + "Roll";

	}

}



function doRestore(elID) {

	var midEl = getObj(elID + "Middle");

	var leftEl = getObj(elID + "Left");

	var rightEl = getObj(elID + "Right");

	

	if (midEl.className.indexOf("Roll") != -1) {

		midEl.className = midEl.className.substring(0, (midEl.className.length-4));

		leftEl.className = leftEl.className.substring(0, (leftEl.className.length-4));

		rightEl.className = rightEl.className.substring(0, (rightEl.className.length-4));

	}

}







function leftNavClick(id, numNav) {

	var selNav = document.getElementById("leftNav" + id);

	if (selNav.className == "parent") {

		

		for (var i=0; i<numNav; i++) {

			document.getElementById("leftNav" + i).className = "parent";

			if (document.getElementById("leftNav" + i + "Children") != null) {

				document.getElementById("leftNav" + i + "Children").style.display = "none";

			}

		}

		selNav.className = "parentselected";

		document.getElementById("leftNav" + id + "Children").style.display = "";

	}

	return false;

}



function statusNavClick(id, numTabs, isKF) {

	var elStatusNavPrefix = "statusNav";

	var elStatusBodyPrefix = "statusBody";

	if (isKF != null && isKF == true) {

		elStatusNavPrefix += "KF";

	}

	

	var sNavElement = getObj("statusNav" + id);

	if (sNavElement.className != elStatusNavPrefix + "On") {

		for (var i=0; i<numTabs; i++) {

			getObj("statusNav" + i).className = elStatusNavPrefix + "Off";

			getObj("statusBody" + i).style.display = "none";  

		}

		if (id < numTabs-1) {

			sNavElement.className = elStatusNavPrefix + "On";  

			getObj("statusNav" + (id+1)).className = elStatusNavPrefix + "OffAfterOn";  

		} else {

			

			sNavElement.className = elStatusNavPrefix + "OnLast";

		}

		getObj(elStatusBodyPrefix + id).style.display = "block";  

	}

}



function checkboxClick(id) {

	cb = getObj(id);

	if(cb.click != null && cb.click != "undefined")

		cb.click();

		

	cb.checked = !cb.checked;

}



function radioClick(id, val) {

	r = getObj(id);

	if(r.click != null && r.click != "undefined")

		r.click();

		

	r.checked = true;

}



function MM_preloadImages() {

 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}

}




function doInterstitialSubmit(formName, msg) {

    scroll(0,0);

    if(null != formName)

    {

    	var form = getObj(formName);

    	if(form != null) form.submit();

    	else {

    		alert("Unable to submit form.");

    		return false;

    	}

    }



    

    var bd = getObj('content2col');

    if (null==bd || "undefined"==bd) bd = getObj('content3col');

    if (null==bd || "undefined"==bd) bd = getObj('contentCategory');

    

    var hd = getObj('header');

    var ft = getObj('footer');

    if (navigator.userAgent.toLowerCase().indexOf("gecko")!=-1 && navigator.userAgent.toLowerCase().indexOf("rv:1.7")!=-1) {

        hd.style.display="none";

        if (null!=bd && "undefined"!=bd) bd.style.display="none";

    }

    else if (navigator.userAgent.toLowerCase().indexOf("gecko")!=-1) {

        hd.style.display="none";

        if (null!=bd && "undefined"!=bd) bd.style.display="none";

    }

    

    else {

        hd.style.display="none";

        if (null!=bd && "undefined"!=bd){

        	 bd.style.display="none";

       	}

    }

    var subMsg = "";

    

    if(arguments.length > 2) {

    	subMsg = arguments[2];

    }



    doUpdateText(getObj('interstitialText'),msg);

    doUpdateText(getObj('interstitialSubText'),subMsg);

    getObj('interstitialWindow').style.display = "block";





    return false;

}





function doInterstitialSubmitPopup(formName, msg) {

    scroll(0,0);

    if(null != formName)

    {

    	var form = getObj(formName);

    	if(form != null) form.submit();

    	else {

    		alert("Unable to submit form.");

    		return false;

    	}

    }





    var bd = getObj('contentPopup');



    if (navigator.userAgent.toLowerCase().indexOf("gecko")!=-1 && navigator.userAgent.toLowerCase().indexOf("rv:1.7")!=-1) {

        if (null!=bd && "undefined"!=bd) bd.style.display="none";

    }

    else if (navigator.userAgent.toLowerCase().indexOf("gecko")!=-1) {

        if (null!=bd && "undefined"!=bd) bd.style.display="none";

    }

    

    else {

        if (null!=bd && "undefined"!=bd){

        	 bd.style.display="none";

       	}

    }

    var subMsg = "";

    

    if(arguments.length > 2) {

    	subMsg = arguments[2];

    }



    doUpdateText(getObj('interstitialText'),msg);

    doUpdateText(getObj('interstitialSubText'),subMsg);

    getObj('interstitialWindow').style.display = "block";





    return false;

}






function opencorptravellink(){



window.open('http://ctl.singaporeair.com.sg/OneToOne/ScriptPublisher/ScrptPub.dll?ESPJ=10126&ESPTP=11039&ESPW=SIADB&DisableDSGNCache=1',"",'toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,resizable=yes,copyhistory=yes,scrollbars=yes,width=600,height=500,top=150,left=100');

}







function linkToPDF(pdfName,newBrowserInstance){

   window.open(pdfName,"",'toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,resizable=yes,copyhistory=yes,scrollbars=yes,width=700,height=400,top=150,left=100')

}



function makePopupWindow(url, name,height, width) {

	if (null==name || "undefined"==name) name = "popupWindow";

	if (null==height || "undefined"==height) height = 600;

	if (null==width || "undefined"==width) width = 600;

    var sFullPath = "";

    if(url.indexOf("http://") > -1)

    	sFullPath = url;

    else { 

        var sProtocol = self.location.protocol;

	    var sHost     = self.location.host;

	    var sPath     = self.location.pathname;

	    var aUrl      = sPath.split("/");







	    if(url.indexOf(WEBAPP_CONTEXT) == -1) 

	    	sFullPath = WEBAPP_CONTEXT;

   	    if(url.indexOf(LOCALE_CONTEXT) == -1) 

	    	sFullPath += "/" + LOCALE_CONTEXT;

		sFullPath = sFullPath + url;

    }

    var sUrl = SHOWPOPUPACTIONURL;

    if(sUrl.indexOf("?") > -1)

    	sUrl += "&";

    else

    	sUrl += "?";

    

    sUrl += "method=window&windowUrl=" + sFullPath;

    

 	var winOptions = "toolbar=no,location=yes,directories=no,status=no,menubar=yes,resizable=yes,copyhistory=no,scrollbars=yes,width=" + width +",height=" + height + ",top=10,left=100";

	window.open(sUrl,name,winOptions);

}



function makeActionPopupWindow(url, name,height, width){

	if (null==name || "undefined"==name) name = "popupWindow";

	if (null==height || "undefined"==height) height = 600;

	if (null==width || "undefined"==width) width = 600;

    var sUrl = SHOWPOPUPACTIONURL;

    

    if(sUrl.indexOf("?") > -1)

    	sUrl += "&";

    else

    	sUrl += "?";

    

    sUrl += "method=window&windowUrl=" + url;

    

 	var winOptions = "toolbar=no,location=yes,directories=no,status=no,menubar=yes,resizable=yes,copyhistory=no,scrollbars=yes,width=" + width +",height=" + height + ",top=10,left=100";

	window.open(sUrl,name,winOptions);

}





function openDisplayETWindow(url){

    var sProtocol = self.location.protocol;

    var sHost     = self.location.host;

    var sPath     = self.location.pathname;

    var aUrl      = sPath.split("/");

   

    var sFullPath =sProtocol+"//"+sHost+aUrl[0]+"/"+aUrl[1]+"/"+aUrl[2]+url;

 	var winOptions = "toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,copyhistory=no,scrollbars=yes,width=700,height=300,top=150,left=100";

	window.open(sFullPath,"popupWindow",winOptions);

}



function openURL(url, name,height, width){

window.open(url,"",'toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,resizable=yes,copyhistory=yes,scrollbars=yes,width=600,height=500,top=150,left=100');

}







SetCookieValue('cookieValueCheck','True','','/','','');



function GetCookieValue() {	

	

		var strName = "cookieValueCheck";

		if (document.cookie.indexOf(strName) == -1)

		{

			return false;

		}

		else

		{

		cookieStart = document.cookie.indexOf(strName);

		cookieValStart = (document.cookie.indexOf("=", cookieStart) + 1);

		cookieValEnd = document.cookie.indexOf(";", cookieStart);

		if (cookieValEnd == -1)

			{

			cookieValEnd = document.cookie.length;

			}

		cookieValue = document.cookie.substring(cookieValStart, cookieValEnd);

		}

		if (cookieValue = "True")

		{

			SetCookieValue('cookieValueCheck','false','','/','','');

			return true;

		}

	}

function SetCookieValue(name,value,expires,path,domain,secure)

	{

		var strDNS = GetDNSValue();

	    	document.cookie = name + "=" +escape(value) +

	        ( (expires) ? ";expires=" + expires.toGMTString() + 1000*60*20 : "") +

        	( (path) ? ";path=" + path : "") +

	     

        	( (domain) ? ";domain=" + strDNS : "") +

	        ( (secure) ? ";secure" : "");

		    return true

	}

function GetDNSValue()

	{

		cookieDomain = document.location.hostname;

	}

function GetCookie() {

	

		var strName = "MYIMAGE";

		if (document.cookie.indexOf(strName) == -1)

		{

   			return false;

		}

		else

		{

		cookieStart = document.cookie.indexOf(strName);

		cookieValStart = (document.cookie.indexOf("=", cookieStart) + 1);

		cookieValEnd = document.cookie.indexOf(";", cookieStart);

		if (cookieValEnd == -1)

			{

			cookieValEnd = document.cookie.length;

			}

		cookieValue = document.cookie.substring(cookieValStart, cookieValEnd);

		}

		

			return true;



	}





function CheckCookiesEnabled()        

{			

	

	var images = new Array(3);

		images[0] = "first_01.jpg";

		images[1] = "first_02.jpg";

		images[2] = "first_03.jpg";



		if (GetCookie() ){			

		cookieStart = document.cookie.indexOf("MYIMAGE");

		cookieValStart = (document.cookie.indexOf("=", cookieStart) + 1);

		cookieValEnd = document.cookie.indexOf(";", cookieStart);

		if (cookieValEnd == -1)

			{

			cookieValEnd = document.cookie.length;

			}

		cookieValue = document.cookie.substring(cookieValStart, cookieValEnd);

		

		if(cookieValue == images[0])

			{



			SetCookie('MYIMAGE','first_02.jpg','','/','','');

			}

			if(cookieValue == images[1])

			{



			SetCookie('MYIMAGE','first_03.jpg','','/','','');

			}

			if(cookieValue == images[2])

			{

	

			SetCookie('MYIMAGE','first_01.jpg','','/','','');

			}

		

		

		}

		 else {	

	

			SetCookie('MYIMAGE','first_01.jpg','','/','','');

   			return false;	

   		}	

		

}  



function SetCookie(name,value,expires,path,domain,secure)

	{

		

		var strDNS = GetDNS();

	    	document.cookie = name + "=" +escape(value) +

	        ( (expires) ? ";expires=" + expires.toGMTString() + 1000*60*20 : "") +

        	( (path) ? ";path=" + path : "") +

	    

        	( (domain) ? ";domain=" + strDNS : "") +

	        ( (secure) ? ";secure" : "");

		    return true

	}

		function GetDNS()

	{

		cookieDomain = document.location.hostname;

	}	




function doInterstitialPageSubmit(formName, locale, msg) {

    var sProtocol = self.location.protocol;

    var sHost     = self.location.host;

    var sPath     = self.location.pathname;

	scroll(0,0);

	var aUrl      = sPath.split("/");	    

	

    var interstitialUrl = sProtocol + '//' + sHost + '/'+  aUrl[1] + '/' + locale +'/content/interstitial.jsp?msg1='+msg;    



    var subMsg = "";

    

    if(arguments.length > 3) {

    	subMsg = arguments[3];

        interstitialUrl += '&msg2='+subMsg;

    }    



    if(null != formName) {

        this.formName = formName;

    }

	var time = new Date();

	interstitialUrl += '&time='+time.getTime();



    setTimeout("doAjaxCall('"+interstitialUrl+"')",0);
  



}




var req;

var interstitialContent = '';

var formName = '';

function doAjaxCall(url) {

   

   
if (window.ActiveXObject) { 	

      

		req = new ActiveXObject("Microsoft.XMLHTTP");
       

		if (req) {
           

			req.onreadystatechange = processStateChange;
           

			req.open("GET", url, true); 
           

			req.send();
       

		}
   

	} else if (window.XMLHttpRequest) { 

        req = new XMLHttpRequest();

        req.onreadystatechange = processStateChange;		

        try {

            req.open("POST", url, true); 

        } catch (e) {

            alert("Problem Communicating with Server\n"+e);

        }



        req.send(null);

    }


}




function processStateChange() {



    if (req.readyState == 4) { 

		if (req.status == 200 || req.status == 0) { 



            var form = getObj(formName);

            if(form != null) form.submit();

            else {

                

                return false;

            }

		           

			var hd = getObj('header');

			hd.style.display="none";

			var ft = getObj('footer');

			ft.style.display="none";	



			var bd = getObj('content2col');

			var bd1 = getObj('content3col');

			var bd2 = getObj('contentCategory');

			var bd3 = getObj('catContent');

			var section;



			

			interstitialContent = req.responseText;



			if (null!=bd && "undefined"!=bd){				

				document.getElementById("content2col").innerHTML =interstitialContent;

			}

			else if (null!=bd1 && "undefined"!=bd1){

				document.getElementById("content3col").innerHTML =interstitialContent;

			}

			else if (null!=bd2 && "undefined"!=bd2){

				document.getElementById("contentCategory").innerHTML =interstitialContent;

			}			

			else if (null!=bd3 && "undefined"!=bd3){

				document.getElementById("catContent").innerHTML =interstitialContent;

			}	

        } else {





            var form = getObj(formName);

            if(form != null) form.submit();

            else {

                

                return false;

            }

            document.getElementById("contentCategory").innerHTML ="";

        }

    }

}

function doInterstitialPageSubmitFare(formName, locale, msg) {
    var sProtocol = self.location.protocol;
    var sHost     = self.location.host;
    var sPath     = self.location.pathname;
	scroll(0,0);
	var aUrl      = sPath.split("/");	    
	
    var interstitialUrl = sProtocol + '//' + sHost + '/'+  aUrl[1] + '/' + locale +'/content/interstitial_popup.jsp?msg1='+msg;    

    var subMsg = "";
    
    if(arguments.length > 3) {
    	subMsg = arguments[3];
        interstitialUrl += '&msg2='+subMsg;
    }    

    if(null != formName) {
        this.formName = formName;
    }
	var time = new Date();
	interstitialUrl += '&time='+time.getTime();

    setTimeout("doAjaxCallFare('"+interstitialUrl+"')",0);
  

}

 function processStateChangeFare() {

    if (req.readyState == 4) { 
		if (req.status == 200 || req.status == 0) { 

            var form = getObj(formName);
            if(form != null) form.submit();
            else {
                
                return false;
            }
		           
			var cont = getObj('interstetial');
			var section;

			
			interstitialContent = req.responseText;

			if (null!=cont && "undefined"!=cont){				
				document.getElementById("interstetial").innerHTML =interstitialContent;
			}
	
        } else {


            var form = getObj(formName);
            if(form != null) form.submit();
            else {
                
                return false;
            }
            document.getElementById("interstetial").innerHTML ="";
        }
    }
}
function doAjaxCallFare(url) {
   
   
if (window.ActiveXObject) { 	

      
		req = new ActiveXObject("Microsoft.XMLHTTP");
       
		if (req) {
           
			req.onreadystatechange = processStateChangeFare;
           
			req.open("GET", url, true); 
           
			req.send();
       
		}
   
	} else if (window.XMLHttpRequest) { 
        req = new XMLHttpRequest();
        req.onreadystatechange = processStateChange;		
        try {
            req.open("POST", url, true); 
        } catch (e) {
            alert("Problem Communicating with Server\n"+e);
        }

        req.send(null);
    }

}

function returnObjById(id)
{	
    if (document.getElementById)
        var returnVar = document.getElementById(id);
    else if (document.all)
        var returnVar = document.all[id];
    else if (document.layers)
        var returnVar = document.layers[id];
    return returnVar;
}

function ftoggle(context,ndiv,nimg)
{
  var v_imgpath=context;
  var vdiv = returnObjById(ndiv);
  var vimg = returnObjById(nimg);

  if (vdiv.style.display == 'inline')
  {
    vdiv.style.display = 'none';
	vimg.src = v_imgpath+'/icon_plus.gif';
  } else {
    vdiv.style.display = 'inline';
	vimg.src = v_imgpath+'/icon_minus.gif';
  }

}

