﻿// JScript File
function setBackgroundImage (id, imageURL) {
  if (document.layers)
    document[id].background.src = imageURL == 'none' ? null : imageURL;
  else if (document.all)
    document.all[id].style.backgroundImage = imageURL == 'none' ? 'none' 
: 'url(' + imageURL + ')';
  else if (document.getElementById)
    document.getElementById(id).style.backgroundImage = imageURL == 
'none' ? 'none' : 'url(' + imageURL + ')';
}

function tabOnclick()
{
    var obj= {};
    obj= parseUri(location.protocol + "//" + location.hostname + "" + location.pathname)
	 for (var property in obj)
	 {
		 if (property == "fileName")
		 {
			var filename = obj[property];			
			 if (filename =="HotelPromotions.aspx")
			 {
                 document.getElementById('tdAboutUs').setAttribute("onmouseover",null);
		         document.getElementById('tdAboutUs').setAttribute("onmouseout",null);
		         document.getElementById('tdAboutUs').setAttribute("onclick",null);
		         document.getElementById('tdAboutUs').removeAttribute("style");
		         setBackgroundImage ('tdAboutUs', 'images/btn-promotions2.gif');	
			 }
			 else if ((filename=="MemDetailsR.aspx") || (filename =="MshipDetailsR.aspx"))
			 {
			     document.getElementById('tdPersonal').setAttribute("onmouseover",null);
		         document.getElementById('tdPersonal').setAttribute("onmouseout",null);
		         document.getElementById('tdPersonal').setAttribute("onclick",null);
		         document.getElementById('tdPersonal').removeAttribute("style");
			     setBackgroundImage ('tdPersonal', 'images/btn-personal_details2.gif');	
			 }
			 else if ((filename =="MemSurListR.aspx")|| (filename =="MemSurDetailsR.aspx")||(filename =="MemSurSummaryR.aspx")|| (filename =="FeedbackR.aspx"))
			 {
			    document.getElementById('tdPreference').setAttribute("onmouseover",null);
		         document.getElementById('tdPreference').setAttribute("onmouseout",null);
		         document.getElementById('tdPreference').setAttribute("onclick",null);
		         document.getElementById('tdPreference').removeAttribute("style");
			    setBackgroundImage ('tdPreference', 'images/btn-inbox2.gif');	
			 }
			 else if (filename =="TransactionsR.aspx")
			 {
			     document.getElementById('tdTransaction').setAttribute("onmouseover",null);
		         document.getElementById('tdTransaction').setAttribute("onmouseout",null);
		         document.getElementById('tdTransaction').setAttribute("onclick",null);
		         document.getElementById('tdTransaction').removeAttribute("style");
			     setBackgroundImage ('tdTransaction', 'images/btn-point_status2.gif');	
			 }
			 else if (filename =="TransRedemptionDetailsR.aspx")
			 {
			    document.getElementById('tdRedemption').setAttribute("onmouseover",null);
		         document.getElementById('tdRedemption').setAttribute("onmouseout",null);
		         document.getElementById('tdRedemption').setAttribute("onclick",null);
		         document.getElementById('tdRedemption').removeAttribute("style");
			    setBackgroundImage ('tdRedemption', 'images/btn-redemption2.gif');	
			 }
			 else if (filename =="ContactUsR.aspx")
			 {
	             document.getElementById('tdFeedback').setAttribute("onmouseover",null);
                 document.getElementById('tdFeedback').setAttribute("onmouseout",null);
                 document.getElementById('tdFeedback').setAttribute("onclick",null);
                 document.getElementById('tdFeedback').removeAttribute("style");
	             setBackgroundImage ('tdFeedback', 'images/btn-contact_us2.gif');	
			 }
			 else if (filename =="FAQR.aspx")
			 {
			    document.getElementById('tdFAQ').setAttribute("onmouseover",null);
		         document.getElementById('tdFAQ').setAttribute("onmouseout",null);
		         document.getElementById('tdFAQ').setAttribute("onclick",null);
		         document.getElementById('tdFAQ').removeAttribute("style");
			    setBackgroundImage ('tdFAQ', 'images/btn-faq2.gif');	
			 }	 				
		
		 }			 	
 	}	
}

function parseUri(sourceUri){
    var uriPartNames = ["source","protocol","authority","domain","port","path","directoryPath","fileName","query","anchor"];
    var uriParts = new RegExp("^(?:([^:/?#.]+):)?(?://)?(([^:/?#]*)(?::(\\d*))?)?((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[\\?#]|$)))*/?)?([^?#/]*))?(?:\\?([^#]*))?(?:#(.*))?").exec(sourceUri);
    var uri = {};
    
    for(var i = 0; i < 10; i++){
        uri[uriPartNames[i]] = (uriParts[i] ? uriParts[i] : "");
    }
    
    // Always end directoryPath with a trailing backslash if a path was present in the source URI
    // Note that a trailing backslash is NOT automatically inserted within or appended to the "path" key
    if(uri.directoryPath.length > 0){
        uri.directoryPath = uri.directoryPath.replace(/\/?$/, "/");
    }
    
    return uri;
}




