var iOpacity=100;
var myImages = new Array();

function FindPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		} while (obj = obj.offsetParent);
	}
	return [curleft,curtop];
}


function swapPic(pic1, pic2)
{
    
    if (pic1 == document.getElementById('mainpic').src)
    {
        document.getElementById('mainpic').src = pic2;
    }
    else
    {
        document.getElementById('mainpic').src = pic1;
    }
    
}


function GetXMLResponse(oXML)
    {var iLength=oXML.childNodes.length;
    return oXML.childNodes[iLength-1].childNodes[0]}


function showImage(imageSrc) 
    {
        if (myImages[imageSrc] != 'undefined') {
            img = new Image(); 
            img.src = imageSrc;
            myImages[imageSrc] = img;
        }
        document.images['myImage'].src = imageSrc;
    }
            
    function priceVisibility(sYrPic, sTheYear)
    {
        swapVisibility(document.getElementById(sYrPic), sTheYear);
        return false;
    }
            
    function thumbSwap(sentPic)
    {
       document.getElementById('mainpic').src = sentPic;
    }
            
    function showMap(mapImg)
    {
        iMap = new Image();
        iMap.src = mapImg;
        iWidth = iMap.width;
        iHeight = iMap.height;
        mapWindow = window.open("","Map","toolbar=no,location=no,scrollbars=no,resizable=no,width="+iWidth+",height="+iHeight+""); 
        mapWindow.document.write("<title>Adventure Map</title><style>body{margin:0}</style><img src="+iMap.src+" />");
    }


function TrapReturnKey(sbtn, event){
 if (document.all){
  if ((event.keyCode == 13) && (document.getElementById(sbtn))) {
   event.returnValue=false;
   event.cancel = true;
   document.getElementById(sbtn).click();
  }
 }
 else if (document.getElementById){
  if ((event.which == 13) && (document.getElementById(sbtn))) {
   event.returnValue=false;
   event.cancel = true;
	document.getElementById(sbtn).click();
  }
 }
 else if((document.layers) && (document.getElementById(sbtn))) {
  if(event.which == 13){
   event.returnValue=false;
   event.cancel = true;
	document.getElementById(sbtn).click();
  }
 }
}


function GetElementsByClassName(oElm, strTagName, strClassName){
    var arrElements = (strTagName == "*" && document.all)? document.all : oElm.getElementsByTagName(strTagName);
    var arrReturnElements = new Array();
    strClassName = strClassName.replace(/\-/g, "\\-");
    var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
    var oElement;
    for(var i=0; i<arrElements.length; i++){
        oElement = arrElements[i];      
        if(oRegExp.test(oElement.className)){
            arrReturnElements.push(oElement);
        }   
    }
    return (arrReturnElements)
}


 function RegEventHandler(element,name,handler) {
	if(element.addEventListener) element.addEventListener(name,handler,false);
	else if(element.attachEvent) element.attachEvent('on'+name,function() { handler(window.event); } );
	else {
		var oldHandler=element['on'+name]?element['on'+name]:null;
		element['on'+name]=function() {
		if(oldHandler) oldHandler();
		handler(window.event);
		}
	}
}


function popup(sUrl, sWindowName, sHeight, sWidth, sScrollbars, sToolbar, sMenuBar, sResizable, sStatusBar)
{
   // don't allow if we don't have the focus
   if (! window.focus)return true;

   // open the new window, 
   window.open(sUrl, sWindowName, 'height='+sHeight+',width='+sWidth+',toolbar='+sToolbar+',menubar='+sMenuBar+',resizable='+sResizable+',status='+sStatusBar+',scrollbars='+sScrollbars+'');
}

function popupmap(sUrl, sWidth, sHeight, sTitle) {
    popup('map.aspx?src=' + sUrl + '&title=' + sTitle, 'MapWindow', sHeight, sWidth, 'no', 'no', 'no', 'no', 'no');
}

function openloawindow(sCodes)
{
   // don't allow if we don't have the focus
   if (! window.focus)return true;

   // open the new window, 
   window.open('http://www.travelmood.com/loa.asp?reasoncode=' +sCodes, 'LOA', 'height=600,width=700,toolbar=1,scrollbars=1');	
}

	function Postback(sCommand, sArgument, bCheckDelete) {
		//confirm delete if required	
		if (bCheckDelete==true) {
			if (confirm('Are you sure that you want to delete this record?')==false) {
				return;
			}
		}
		
		document.forms[0].Command.value=sCommand;
		document.forms[0].Argument.value=sArgument;
		document.forms[0].submit();
	}
	
function HideItem(sItemName)
	{	
	//alert('Hide - ' + sItemName);			//  Usefull for debugging
	if (document.getElementById(sItemName))
	    {document.getElementById(sItemName).style.visibility = "hidden";
	    document.getElementById(sItemName).style.display = "none"}}
    	
function ShowItem(sItemName)
	{	
	//alert('Show - ' + sItemName);			//  Usefull for debugging
	if (document.getElementById(sItemName))
	    {document.getElementById(sItemName).style.visibility = "visible";
	    document.getElementById(sItemName).style.display = ""}}
	
function ShowRow(sItemNumber, sRowName)
{
	var iItemNumber = parseInt(sItemNumber);
	var iItemNumber2 = iItemNumber+1;
	var sItem = sRowName+iItemNumber2;
	document.getElementById(sItem).className="nothidden";
	HideItem(sRowName+"plus"+sItemNumber)
}

function ShowPax()
{
	var iPax = parseInt(document.getElementById("ddlPassengers").value);
	for (var i=1;i<=10;i++)
		{if (i<=iPax)
			{document.getElementById("pax"+i).className="nothidden"}
		else
			{document.getElementById("pax"+i).className="hidden"}
		}
}

function swapVisibility(p_oImg,sItem)
	{var p_oTbl=document.getElementById(sItem);
		if(p_oTbl.style.visibility == "hidden")
		{
			p_oImg.src = "/engine/images/minus.bmp";
			p_oTbl.style.visibility = "visible";
			p_oTbl.style.display = "";
		}
		else
		{
			p_oImg.src = "/engine/images/plus.bmp";
			p_oTbl.style.visibility = "hidden";
			p_oTbl.style.display = "none";
		}		
	}
	
function expandAll(sRowName, iCount)
	{for (var i=1;i<=iCount;i++)
		{var sRow = sRowName+i;
		var sImage = sRowName+"plus"+i;
		var oRow=document.getElementById(sRow);
		var oImage=document.getElementById(sImage);
		if(oRow.style.visibility == "hidden")
			{
				oImage.src = "/engine/images/minus.bmp";
				oRow.style.visibility = "visible";
				oRow.style.display = "";
			}
		}
	}	

	
function ForwardControlValue(sControlName, sURL, sWindowName,sWidth,sHeight,sLeft,sTop)
{
	var sPageUrl = sURL + "?ControlName=" + sControlName
	var sValue = GetObjectById(sControlName).Value
	
	if(sValue != ""){
		sPageUrl += "&Date=" + sValue
		}
	
	LaunchChild(sPageUrl,sWindowName,sWidth,sHeight,sLeft,sTop);

}
	

function ParseDate(oTextBox) {
	var sDate=oTextBox.value;
	var nonDigit = /\D/g;
	var weekformat = /^w([1-5][0-9]|[1-9])$/i;
	var prodweekformat = /^p([1-5][0-9]|[1-9])$/i;
	var now=new Date();
	var dDate;
	var sDay;
	var sMonth;
	var sYear;
	var aMaxDays=new Array(31,29,31,30,31,30,31,31,30,31,30,31);
	var bValid  = false
	
	//bomb out if no characters
	if (sDate.length==0) return bValid;
	
	//strip out seperators
	sDate=Replace(sDate,'.','');
	sDate=Replace(sDate,'/','');
	sDate=Replace(sDate,' ','');
	sDate=Replace(sDate,'-','');
	
	//if the date is in the format wnn then 
	if (weekformat.test(sDate)) {
		sDate=GetDateFromWeek(sDate.substring(1));
		oTextBox.value=sDate;
		bValid = true;
		return bValid;
	}
	
	//if the date is in the format wnn then 
	if (prodweekformat.test(sDate)) {
		sDate=GetProductionDateFromWeek(sDate.substring(1));
		oTextBox.value=sDate;
		bValid = true;
		return bValid;
	}
	
	//make sure only numbers, if not leave values bomb out
	if (nonDigit.test(sDate)) return bValid;
	
	//do the bizzo
	if (sDate.length==4 || sDate.length==6 || sDate.length==8) {
		sDay=sDate.substr(0,2);
		sMonth=sDate.substr(2,2);
		if (sDate.length==4) {
			sYear=now.getFullYear();
		} else if (sDate.length==6) {
			sYear=sDate.substr(4,2);
			if (sYear>50) {
				sYear='19'+sYear;
			} else {
				sYear='20'+sYear;
			}
		} else {
			sYear=sDate.substr(4,4);
		}
		
		//if invalid number of days bomb out
		if (sDay>aMaxDays[sMonth-1]) return bValid;
		
		//create new date
		dDate=new Date(sYear, sMonth-1, sDay);
		bValid = true;
		oTextBox.value=GetDisplayDate(dDate);
		
		return bValid
		
	} else return bValid;	
}


function LaunchChild(sPage,sWindowName,sWidth,sHeight, sLeft, sTop)
	{window.open(sPage,sWindowName,"toolbars=no,scrollbars=no,status=no,resizable=no,width="+
		sWidth+",height="+sHeight+",left="+sLeft+",top="+sTop);	
	}

function CheckDate(oTextBox){	//  Used to check a date is not only valid but if it is part of a date range 

	if (ParseDate(oTextBox) == false){			//  If the date is not valid
		if (oTextBox.value!=""){ 
		confirm("Textbox date is not valid");
		var dDate = new Date()
		oTextBox.value = GetDisplayDate(dDate);		//  Use todays dates
		}
		else{
			return;
		}
	}
				
	var sTextBoxID = oTextBox.id;
	var iStartIndex = sTextBoxID.indexOf("Start");  //  Check to see if this text box contains 'Start' or 'End'
	var iEndIndex = sTextBoxID.indexOf("End");
			
	if (iStartIndex!=-1 || iEndIndex!=-1) {	//  If it does contain 'Start' or 'End' it might be part of a date range
		
		var sNextTextBoxID = ""
		
		if (iStartIndex != -1){			//  If the box we are currently in is a Start box
		
			sNextTextBoxID = sTextBoxID.substring(0, iStartIndex);		//  Work out what the 'End' date textbox would be called
			sNextTextBoxID += "End" + sTextBoxID.substring(iStartIndex+5);
		
		}
		else{															//  We are in an 'End' box
			sNextTextBoxID = sTextBoxID.substring(0, iEndIndex);		//  Work out what the 'Start' date textbox would be called
			sNextTextBoxID += "Start" + sTextBoxID.substring(iEndIndex+3);
		}
		
		if (GetObjectById(sNextTextBoxID) != null){			//  If the next textbox 'Start' or 'End' exists
			
			var sNextDateValue = "";
			var sPrevDateValue = GetObjectById(sTextBoxID).value;
						
			
			if (GetObjectById(sNextTextBoxID).value==""){		//  If the next textboxes value is null then we must set it to the value of the current textbox
//confirm("The other date range textbox value is null so we set to the prev date value");				

				GetObjectById(sNextTextBoxID).value = sPrevDateValue;
				sNextDateValue = sPrevDateValue;

			}
			else
			{
				sNextDateValue = GetObjectById(sNextTextBoxID).value;		//  Get end date value and convert to correct date format
			}
			
			var sYear = sNextDateValue.substring(sNextDateValue.length-4);		//  Break both start and end date values down into date components
			var sPrevYear = sPrevDateValue.substring(sPrevDateValue.length-4);				
			
			var sMonth = sNextDateValue.substring(3,5);
			var sPrevMonth = sPrevDateValue.substring(3,5);
			
			var sDay = sNextDateValue.substring(0,2);
			var sPrevDay = sPrevDateValue.substring(0,2);
			
			
			var dDate = new Date(sYear, sMonth-1, sDay);
			var dPrevDate = new Date(sPrevYear, sPrevMonth-1, sPrevDay);

			
			if (iStartIndex != -1){				//  We are in an 'End' date box check value is greater otherwise make same
				//confirm("We are checking end date is greater than or equal to");
				if (dDate < dPrevDate)								{				

					//confirm("The date range was not valid.  Must make end date equal to start date");
					GetObjectById(sNextTextBoxID).value = sPrevDateValue
				}
			}
			else			//  In a 'Start' date box check value is less than otherwise make same
			{
				//confirm("We are checking start date is less than or equal to");
				if (dDate > dPrevDate)			//  Check End date is greater than the start date otherwise correct
				{				
					//confirm("The date range was not valid.  Must make startdate equal to end date");
					GetObjectById(sNextTextBoxID).value = sPrevDateValue
					
				}
			}
		
		}
		
	}
}
	
function GetObjectById(sID) {
	if (document.getElementById) {
		return document.getElementById(sID);	
	} else {
		return document.layers[sID];
	}
}
	
function progress(){
	intWidth = parseInt(document.getElementById("progbar").style.width) + 2;
	if (intWidth <= 580)
		{
		document.getElementById("progbar").style.width = intWidth;
		}
	else{
		document.getElementById("progbar").style.width = 0;
		}
	setTimeout("progress()",40)}
	
	
function roundDecimals(fOriginalNumber, iDecimals){

	var result1 = fOriginalNumber * Math.pow(10, iDecimals);
	var result2 = Math.round(result1);
	var result3 = result2 / Math.pow(10, iDecimals);
	return padZeros(result3, iDecimals);
}
	

function padZeros(fValue, iDecimalPlaces)
{
	var sValue = fValue.toString();
	var iDecimalLoc = sValue.indexOf(".");
	var iDecimalPartLen = 0;

	if (iDecimalPlaces > 0){
		if (iDecimalLoc == -1){
			sValue += ".";
		}
		else{
			iDecimalPartLen= sValue.length - iDecimalLoc - 1;
		}
		var iPadTotal = iDecimalPlaces - iDecimalPartLen;
		for (var counter=1; counter<=iPadTotal; counter++){
			sValue+= "0";
		}
	}

	return(sValue)
}	

function getCookie(name)
{
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    }
    else
    {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}

function upperCase(frmObj) 
	{
	frmObj.value=frmObj.value.toUpperCase();
	}

function lowerCase(frmObj) 
	{	
	frmObj.value=frmObj.value.toLowerCase();
	}
		
function properCase(frmObj) 
	{
	var index;
	var tmpStr;
	var tmpChar;
	var preString;
	var postString;
	var strlen;
	tmpStr = frmObj.value.toLowerCase();
	strLen = tmpStr.length;
	if (strLen > 0)  
	{
		for (index = 0; index < strLen; index++)  
		{
			if (index == 0)  
			{
				tmpChar = tmpStr.substring(0,1).toUpperCase();
				postString = tmpStr.substring(1,strLen);
				tmpStr = tmpChar + postString;
			}
			else
			{
			tmpChar = tmpStr.substring(index, index+1);

		if (tmpChar == " " && index < (strLen-1))  
			{
			tmpChar = tmpStr.substring(index+1, index+2).toUpperCase();
			preString = tmpStr.substring(0, index+1);
			postString = tmpStr.substring(index+2,strLen);
			tmpStr = preString + tmpChar + postString;
			}
			}
		}
	}
	frmObj.value = tmpStr;
}

function ChangeVisibility(sComboBox, sTextBox) {
    var oComboBox = document.getElementById(sComboBox);
    var oTextBox = document.getElementById(sTextBox);
    if (oComboBox != null && oTextBox != null) {
        try {
            var sOption = oComboBox.options[oComboBox.selectedIndex].text;
            if (sOption.toLowerCase() == 'other') {
                oTextBox.value = '';
                oTextBox.style.display='';
                oTextBox.focus();
            }
            else {
                oTextBox.style.display='none';
                oTextBox.value = sOption;
            }
        }
        catch (err) {}
    }
}

function Replace(sString, sStringToReplace, sReplacement) {
	while (sString.indexOf(sStringToReplace) != -1) {
		sString=sString.replace(sStringToReplace, sReplacement);
	}
	return sString;
}
	
	
function GetDisplayDate(dDate) {
	dDate=new Date(dDate)
	
	var sDay=dDate.getDate().toString()
	if (sDay.length==1) {
		sDay='0'+sDay;
	}
	
	var sMonth=dDate.getMonth()+1
	sMonth=sMonth.toString()
	if (sMonth.length==1) {
		sMonth='0'+sMonth;
	}
	
	return sDay + '/' +sMonth + '/' +dDate.getFullYear();
}	
	
	
function HideInfoBox(e){
	var Key='';				
		
	if (document.layers) 
		Key=''+ e.which ;
	else 
		Key = window.event.keyCode; 		
			
	//if info box is displayed + Key is the return key
	if (iOpacity>0 && Key==13 || Key==27) {
		CloseInfoBox();
		Key=0;
		return false;
	}	
}

function CloseInfoBox(){
	var DivRef = document.getElementById('infobox');
	var oMask = document.getElementById('infomask');			
	
	//reduce the opacity
	iOpacity=iOpacity-40;
		
	//hide frame mask
	oMask.style.display="none";
	
	//fade out the msgbox or hide the old boy
	if (iOpacity>=0) {
		DivRef.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=" + iOpacity + ")";
		setTimeout('CloseInfoBox()', 1);
	} else {
		DivRef.style.display="none";
		iOpacity=100;
	}
}

function ShowInfoBox(){
	var DivRef = document.getElementById('infobox');
	var oMask = document.getElementById('infomask');

	//set the top and left		
	var iTop=(document.body.clientHeight-120)/2;
	var iLeft=(document.body.clientWidth-333)/2;

	//set the div old boy				
	DivRef.style.top=iTop;
	DivRef.style.left=iLeft;
	
	//move mask behind info box			
	oMask.style.width = DivRef.offsetWidth;
	oMask.style.height = DivRef.offsetHeight;
	oMask.style.top = DivRef.style.top;
	oMask.style.left = DivRef.style.left;
	oMask.style.zIndex = DivRef.style.zIndex - 1;
	oMask.style.display = "block";		
}	
	
function IsIE()
	{
	var strBVersion = new String(navigator.appVersion); 
	var iVersion = strBVersion.indexOf("MSIE 6") + strBVersion.indexOf("MSIE 7")
	var bName = navigator.appName;
	return (bName == "Microsoft Internet Explorer" && iVersion >= -2) }


function GetDomain()
	{
	var the_url=unescape(document.location);
	var lead_slashes = the_url.indexOf("//");
	var domain_start = lead_slashes + 2;
	var without_resource = the_url.substring(domain_start, the_url.length);
	var next_slash = without_resource.indexOf("/");
	var domain = without_resource.substring(0, next_slash);
	return domain
	}
	
function GetPageName()
{
    var sPath = window.location.pathname;
    var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
    return sPage.toLowerCase();
	}
	
	
function getInnerText (node) { 
    
   if (typeof node.textContent != 'undefined') { 
     return node.textContent; 
   } 
   else if (typeof node.innerText != 'undefined') { 
     return node.innerText; 
   } 
   else if (typeof node.text != 'undefined') { 
     return node.text; 
   } 
   else if (node.nodeType==1)
        {if (node.childNodes.length=1)
            {return node.childNodes[0].nodeValue}
        }
   
   }

function ClearNodes(sNode)
	{var divHolder=document.getElementById(sNode);
	while (divHolder.childNodes[0]) {
    divHolder.removeChild(divHolder.childNodes[0])}
    }

function coverChange(item)
{
    var seniors = document.getElementById('seniors');
    var seniors2 = document.getElementById('seniors2');
    var winter = document.getElementById('winter');
    var staylength = document.getElementById('ddlLengthOfStay');
    var days17 = document.createElement('option');
    var days5 = document.createElement('option');
    
    days17.text = '17 days';
    days5.text = '5 days';
    
    if (item == "Bronze")
    {
        seniors.style.display = "none";
        seniors2.style.display = "none";
        winter.style.display = "none";
        staylength.remove(0);
        staylength.remove(0);
        document.getElementById('ddlWinterSportsCover').selectedIndex = 0
        document.getElementById('ddlSeniors').selectedIndex = 0
        document.getElementById('ddlSeniors2').selectedIndex = 0
        
    }
    else
    {
        seniors.style.display = ""; 
        seniors2.style.display = "";   
        winter.style.display = "";
             
        if (staylength.length < 6)
        {
            staylength.add(days17, 0);
            staylength.add(days5, 0);
        }
    }
}


function ShowGoogleMap(nXCoord, nYCoord) {
    if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("googlemap"));
        map.addControl(new GLargeMapControl());
        map.addControl(new GMapTypeControl());
        map.addControl(new GMapTypeControl());
        map.setCenter(new GLatLng(nXCoord, nYCoord), 15);
        
        function createMarker(point) {
          var marker = new GMarker(point);
          GEvent.addListener(marker, "click", function() {
            marker.openInfoWindowHtml("We are here");
          });
          return marker;
        }

        // Add 10 markers to the map at random locations
        var bounds = map.getBounds();
        var southWest = bounds.getSouthWest();
        var northEast = bounds.getNorthEast();
        var lngSpan = northEast.lng() - southWest.lng();
        var latSpan = northEast.lat() - southWest.lat();
        for (var i = 0; i < 1; i++) {
          var point = new GLatLng(nXCoord, nYCoord);
          map.addOverlay(createMarker(point));
        }    
      }
    }
 
 function ShowGoogleMapStreetView(nXCoord, nYCoord)
 {
    var myPano;

     function initialize() 
     {
         var fenwayPark = new GLatLng(nXCoord,nYCoord);
         panoramaOptions = { latlng:fenwayPark };
         myPano = new GStreetviewPanorama(document.getElementById("googlemap"), panoramaOptions);
         GEvent.addListener(myPano, "error", handleNoFlash);
     }

     function handleNoFlash(errorCode) 
     {
         if (errorCode == FLASH_UNAVAILABLE) 
         {
             alert("Error: Flash doesn't appear to be supported by your browser");
             return;
         }
     }
 }
    
function resetpage()
{
    document.getElementById('flightinfo').style.display = "none";
    document.getElementById('tailorinfo').style.display = "none";
    document.getElementById('packageinfo').style.display = "none";
    
    if (document.getElementById('tailorform'))
    {
        document.getElementById('tailorform').style.display = "none";
    }
    
    if (document.getElementById('packageform'))
    {
        document.getElementById('packageform').style.display = "none";
    }
    
    
    document.getElementById('package').style.backgroundImage = "url('/engine/images/quotebtnoff.jpg')";
    document.getElementById('tailormade').style.backgroundImage = "url('/engine/images/quotebtnoff.jpg')";
    document.getElementById('flight').style.backgroundImage = "url('/engine/images/quotebtnoff.jpg')";		        
}

function btnOver(sentButton)
{
    var button = document.getElementById(sentButton)
    var bg = button.style.backgroundImage
    //alert(button.style.backgroundImage)
    if (bg.match("quotebtnoff") == "quotebtnoff" || bg == "")
    {
        button.style.backgroundImage = "url('/engine/images/quotebtnover.jpg')"
    }
}

function btnOut(sentButton)
{
    var button = document.getElementById(sentButton)
    var bg = button.style.backgroundImage
    //alert(bg)
    if (bg.match("quotebtnover") == "quotebtnover" || bg == "")
    {
        button.style.backgroundImage = "url('/engine/images/quotebtnoff.jpg')"
    }
}

function flexChange()
{
    if (document.getElementById("radYes").checked)
    {
        document.getElementById("flexdiv").style.display = "block";
    }
    else
    {
        document.getElementById("flexdiv").style.display = "none";
    }
}

function ChameleonCheck(obj)
{
	if (confirm('Please click Ok to confirm that you are not in Page 2 of Chameleon!')==false) 
	{
		return;
	}
	
	Postback(obj)
}

function CheckExpectedArrivalTime(dropdown)
{
    //get selected index
    var index = dropdown.selectedIndex;
    var sSelectedValue = new Array();
    
    //split selectedValue
    sSelectedValue = dropdown.options[index].value.split(":");
    
    //Default arrival
    var defaultArrival = new Date();
    defaultArrival.setHours("14", "00", "00"); 
    
    var expectedArrival = new Date();
    expectedArrival.setHours(sSelectedValue[0], sSelectedValue[1], "00");
    
    //if expected arrival is before 14:00, 
    //Please inform client hotel may not permit check-in until 14:00
    if(expectedArrival.getHours() < defaultArrival.getHours())
    {
        alert("Please inform client hotel may not permit check-in until 14:00pm")
    }

}
function ShowChildrenAges(childrenDropdown)
{
    var dropdownIndex = childrenDropdown.selectedIndex
    var dropdownvalue = childrenDropdown.value
    var maxValue = childrenDropdown.length
    var counter 
    
    // Doing something so turn the row on.
    if(dropdownvalue == 0)
    {
     changeClass('childAgeRow', 'hide');
    }
    else
    {
     changeClass('childAgeRow', 'show');
    }

    for (counter = 0; counter < maxValue; counter++)
    {
        if(counter <= dropdownvalue)
        {
                changeClass('childAge' + (counter), 'show');
        }
        else
        {
                changeClass('childAge' + (counter), 'hide');
        }
    }
    
    
}
function changeClass(id, cssClass) 
{
    var identity = document.getElementById(id);
    if (identity) 
    {
        identity.className = cssClass;
    }
}
