
/**********************************************************************************************************************************************/

/* All search form specific JS files and functions merged into searchForm.js START*/

/**********************************************************************************************************************************************/
/**
      * This method will be used for default text hiding in text box
     
     function hideText(id){
     var elem;      
     elem = document.getElementById(id);	 
     elem.value = "" ;  // if the style.display value is blank we try to figure it out here     
     }

	 function showText(){
		 var elem1, elem2, elem3, elem4;

		 elem1 = document.getElementById('hotelName');
		 elem1.value = "Enter Hotel Name";

		 elem2 = document.getElementById('brochureCode');
		 elem2.value = "Enter Brochure Code";

		 elem3 = document.getElementById('holidayLocator');
		 elem3.value = "Enter holiday locator";

      	 elem4 = document.getElementById('brochureSelect');
		 elem4.options[0].selected = true;
	 } **/
    
     /**
      * This method disables the specific div when required.
      **/                                                          
     function disableRest(id1,id2){
		 
		 if('brochureCode'==id1){
			if(document.getElementById('brochureCode')) document.getElementById('brochureCode').disabled=false;
			if(document.getElementById('brochureSelect')) document.getElementById('brochureSelect').disabled=false;
			if(document.getElementById('brochureCodeSpan')) document.getElementById('brochureCodeSpan').className="ncol1";
			
			if(document.getElementById('hotelName')) document.getElementById('hotelName').disabled=true;
			if(document.getElementById('hotelNameSpan')) document.getElementById('hotelNameSpan').className="ncol1 greyout";

			if(document.getElementById('holidayLocator')) document.getElementById('holidayLocator').disabled=true;
			if(document.getElementById('holidayLocatorSpan')) document.getElementById('holidayLocatorSpan').className="ncol1 greyout";
            		if(document.getElementById('hotelName')) document.getElementById('hotelName').value = 'Enter Hotel Name';
			if(document.getElementById('holidayLocator')) document.getElementById('holidayLocator').value='Enter holiday locator';
			if(document.getElementById('hotelImportantInfo')) document.getElementById('hotelImportantInfo').style.display="none";
	
		}
		else if('hotelName'==id1){
			if(document.getElementById('hotelName')) document.getElementById('hotelName').disabled=false;
			if(document.getElementById('hotelNameSpan')) document.getElementById('hotelNameSpan').className="ncol1";

			if(document.getElementById('brochureCode')) document.getElementById('brochureCode').disabled=true;
			if(document.getElementById('brochureSelect')) document.getElementById('brochureSelect').disabled=true;
			if(document.getElementById('brochureCodeSpan')) document.getElementById('brochureCodeSpan').className="ncol1 greyout";

			if(document.getElementById('holidayLocator')) document.getElementById('holidayLocator').disabled=true;
			if(document.getElementById('holidayLocatorSpan')) document.getElementById('holidayLocatorSpan').className="ncol1 greyout";
			if(document.getElementById('brochureCode')) document.getElementById('brochureCode').value='Enter Brochure Code';
			if(document.getElementById('holidayLocator')) document.getElementById('holidayLocator').value='Enter holiday locator';
			if(document.getElementById('hotelImportantInfo')) document.getElementById('hotelImportantInfo').style.display="block";
		}
		else if('holidayLocator'==id1){
			if(document.getElementById('holidayLocatorSpan')) document.getElementById('holidayLocatorSpan').className="ncol1";
			if(document.getElementById('holidayLocator')) document.getElementById('holidayLocator').disabled=false;
			if(document.getElementById('hotelImportantInfo')) document.getElementById('hotelImportantInfo').style.display="none";

			if(document.getElementById('brochureCode')) document.getElementById('brochureCode').disabled=true;
			if(document.getElementById('brochureSelect')) document.getElementById('brochureSelect').disabled=true;
			if(document.getElementById('brochureCodeSpan')) document.getElementById('brochureCodeSpan').className="ncol1 greyout";

			if(document.getElementById('hotelName')) document.getElementById('hotelName').disabled=true;
			if(document.getElementById('hotelNameSpan')) document.getElementById('hotelNameSpan').className="ncol1 greyout";
			if(document.getElementById('hotelName')) document.getElementById('hotelName').value = 'Enter Hotel Name';
			if(document.getElementById('brochureCode')) document.getElementById('brochureCode').value='Enter Brochure Code';
		}
    }
     /**
      * This method disables the text fields.
      **/ 
    function disableThis(id){
		if('brochureCode'==id){
			if(document.getElementById('brochureCode')) document.getElementById('brochureCode').disabled=true;
			if(document.getElementById('brochureSelect')) document.getElementById('brochureSelect').disabled=true;
			if(document.getElementById('brochureCodeSpan')) document.getElementById('brochureCodeSpan').className="ncol1 greyout";
			if(document.getElementById('hotelImportantInfo')) document.getElementById('hotelImportantInfo').style.display="none";
		}
		if('hotelName'==id){
			if(document.getElementById('hotelName')) document.getElementById('hotelName').disabled=true;
			if(document.getElementById('hotelNameSpan')) document.getElementById('hotelNameSpan').className="ncol1 greyout";	
			if(document.getElementById('hotelImportantInfo')) document.getElementById('hotelImportantInfo').style.display="none";	
		}
		if('holidayLocator'==id){
			if(document.getElementById('holidayLocatorSpan')) document.getElementById('holidayLocatorSpan').className="ncol1 greyout";
			if(document.getElementById('holidayLocator')) document.getElementById('holidayLocator').disabled=true;
			if(document.getElementById('hotelImportantInfo')) document.getElementById('hotelImportantInfo').style.display="none";
		}
     }

	 /**
     * This function creates a pop-up on click of info.
     **/
	 function popitup(divId,displayInfo,url,height,width,top,left) {
		newwindow=window.open(url,'name','height='+height+',width='+width+',top='+top+',left='+left);
		if (window.focus) {newwindow.focus()}
		return false;
	    }

	  function hideText(id,text){ 
		 var elem; 	 
		 elem = document.getElementById( id ); 
		 if(elem.value == text){  
		 	elem.value = '';
		 }
	  }
	 
	  function showText(id,text){
		 
	  	 var elem;
		 elem4 = document.getElementById('brochureSelect');
		 elem4.options[0].selected = true;
		 elem = document.getElementById( id );
		 if(elem.value == ''){  
		 	elem.value = ''+text;
		 }     
	  }
	  
	  function redirect(url){
	  	window.location = url;
	  }
	  
	  
	  function searchPanelHider(){
	  	var searchDiv = document.getElementById('searchDiv');
	  	if(searchDiv != null){
	  		if(searchDiv.style.display == 'none'){
	  			searchDiv.style.display = 'block';
	  		} else {
	  			searchDiv.style.display = 'none';
	  		}
	  	}
	  }
	  
	  function changeSearchButton(){
	  	var dealBut = document.getElementById('search_button1');
	  	fSearch = document.getElementById('fSearch');
	  	
	  	
		if(fSearch.checked == false){
			dealBut.src = "http://www.thomascook.com/images/siteElements/buttons/search.gif";
		} else {
			dealBut.src = "http://www.thomascook.com/images/siteElements/updatecalendar.gif";
		}
		
}


// added for FF:8416:Search Additions - to set the Number of nights drop-downs color in Holiday Seacrh Page
  function setColor()
	 {
		
		var index=document.getElementById('inputnights').selectedIndex;
		var duration=document.getElementById('inputnights');
		duration.style.backgroundColor = duration.options[index].style.backgroundColor;  
	 }


/**********************************************************************************************************************************************/

/* validations.js START*/

/**********************************************************************************************************************************************/
var month_names = new Array();
month_names["Jan"] = "01";
month_names["Feb"] = "02";
month_names["Mar"] = "03";
month_names["Apr"] = "04";
month_names["May"] = "05";
month_names["Jun"] = "06";
month_names["Jul"] = "07";
month_names["Aug"] = "08";
month_names["Sep"] = "09";
month_names["Oct"] = "10";
month_names["Nov"] = "11";
month_names["Dec"] = "12";


{ "Jan", " Feb", " Mar", " Apr", " May", " Jun", " Jul", " Aug",
                    " Sep", " Oct", " Nov", " Dec" };
function isNumber(number) {
  var numbers = "0123456789";
  if(number.length > 0){
	for(var i=0;i<number.length;i++){
		if(numbers.indexOf(number.charAt(i)) < 0)
		   return false;
	}
  }
  return true;
}

function isValidDate(validDateField,labelId,errorSpanId){
	var dateSplit=validDateField.value.split("/"); 
	if(dateSplit.length!=3){
		return displayError(labelId,errorSpanId); 
	}else if(dateSplit.length==3){
		if (isNumber(dateSplit[0]) && isNumber(dateSplit[1]) && isNumber(dateSplit[2])){ 
			if (dateSplit[2].length != 2) 
				return displayError(labelId,errorSpanId) 
			var date=new Date(dateSplit[1]+"/"+dateSplit[0]+"/"+'20'+dateSplit[2]); 
			if (date.getMonth()!=dateSplit[1]-1) 
				return displayError(labelId,errorSpanId); 
		}else{
			return displayError(labelId,errorSpanId);
		}
	}
	return hideError(labelId,errorSpanId);
} 

function isValidOptionSelected(selectBox,labelId,errorSpanId){
	if(selectBox.options[0].selected)
	  return displayError(labelId,errorSpanId);

	  return hideError(labelId,errorSpanId);
}

function requiredField(requiredField,labelId,errorSpanId){
	if(requiredField == null || isUndefined(requiredField))
		return true;
	if(requiredField.value.replace(" ","").length == 0)
		return displayError(labelId,errorSpanId);
	else
		return hideError(labelId,errorSpanId);
}

function displayError(labelId,errorSpanId){
	//document.getElementById(labelId).innerHTML=document.getElementById(labelId).innerHTML;
  	document.getElementById(labelId).className="error";
	if(errorSpanId.length > 0 )
		document.getElementById(errorSpanId).style.display="inline";
	document.getElementById(errorSpanId).style.width="200px";
	return false;
}

function hideError(labelId,errorSpanId){
	//document.getElementById(labelId).innerText.replace("*","");
  	document.getElementById(labelId).className="";
	if(errorSpanId.length > 0 )
		document.getElementById(errorSpanId).style.display="none";
	return true;
}
	
function validateEmail(emailAddrObj,labelId,errorSpanId) {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(emailAddrObj.value)){
		return hideError(labelId,errorSpanId);
	}
	return displayError(labelId,errorSpanId);
}

function isValidDateOfBirth(validDateField,labelId,errorSpanId,isValue){
	var dateSplit;
	if(isValue)
		dateSplit=validDateField.split("/"); 
	else
		dateSplit=validDateField.value.split("/"); 

	if(dateSplit.length!=3){
		return displayError(labelId,errorSpanId); 
	}else if(dateSplit.length==3){
		dateSplit[1] = month_names[dateSplit[1]];
		if (isNumber(dateSplit[0]) && isNumber(dateSplit[1]) && isNumber(dateSplit[2])){ 
			if (dateSplit[2].length != 4) 
				return displayError(labelId,errorSpanId) 
			var date=new Date(dateSplit[1]+"/"+dateSplit[0]+"/"+dateSplit[2]); 
			if (date.getMonth()!=dateSplit[1]-1) 
				return displayError(labelId,errorSpanId); 
		}else{
			return displayError(labelId,errorSpanId);
		}
	}
	return hideError(labelId,errorSpanId);
} 

function isNumberFeild(numberFeild,labelId,errorSpanId,isValue) {
	var number = 0;
	if(isValue)
		number = numberFeild;
	else
		number = numberFeild.value;
  var numbers = "0123456789";
  if(number.length > 0){
	for(var i=0;i<number.length;i++){
		if(numbers.indexOf(number.charAt(i)) < 0)
		   return displayError(labelId,errorSpanId);
	}
  }
  return hideError(labelId,errorSpanId);
}

function isValidPhoneNumber(numberFeild,labelId,errorSpanId,isValue) {
	var number = 0;
	if(isValue)
		number = numberFeild;
	else
		number = numberFeild.value;
  var numbers = "0123456789 -";
  if(number.length > 0){
	for(var i=0;i<number.length;i++){
		if(numbers.indexOf(number.charAt(i)) < 0)
		   return displayError(labelId,errorSpanId);
	}
  }
  return hideError(labelId,errorSpanId);
}

function isUndefined(elem){
	if(typeof(elem) !== 'undefined' && elem != null) {
		return false;
	} else {
		return true;
	}
}

var locationStr = document.location+"";
var urlSplit = locationStr.split("?");
if(urlSplit.length == 2 && urlSplit[1].substring(0,25) == "sinav=topnav_destinations" ){
	document.location=urlSplit[0];
}
/**********************************************************************************************************************************************/

/* validations.js END*/

/**********************************************************************************************************************************************/

/**********************************************************************************************************************************************/

/* passenger_details.js START*/

/**********************************************************************************************************************************************/
/**
 * This method is used to display room blocks and hide age children blocks as per selection.
 */

    function showDefaultAdults()
	{

		
	}

	function addRoom(){
		var roomDropdown = document.getElementById('inputrooms');
		if(roomDropdown){
			var value = roomDropdown.selectedIndex;
			
			if(value != 2){
				++value;
				roomDropdown.selectedIndex = value;
				showInfo(); 
			}
		}
	
	}
	
	function removeRoom(){

		var roomDropdown = document.getElementById('inputrooms');
		if(roomDropdown){
			var value = roomDropdown.selectedIndex;
			if(value != 0){
				--value;
				roomDropdown.selectedIndex = value;
				showInfo(); 
			}
		}
		
	}
	
	
	function showInfo()
	{
		var roomDropdown = document.getElementById('inputrooms');
		if(roomDropdown){
			var value = roomDropdown.selectedIndex;
			var removeLink = document.getElementById('removeRoom');
			var addLink = document.getElementById('addRoom');
			
			if(value == 0){
				if(removeLink != null)
				removeLink.style.display = 'none';
			} else {
				if(removeLink != null)
				removeLink.style.display = 'block';
			}
			
			if(value == 2){
				if(addLink != null)
				addLink.style.display = 'none';
			} else {
				if(addLink != null)
				addLink.style.display = 'block';
			}
		}
	
		var elemBlockRoom2 = document.getElementById('room2block');
		var elemLabelRoom2 = document.getElementById('room2label');
		var elemBlockRoom3 = document.getElementById('room3block');
		var elemLabelRoom3 = document.getElementById('room3label');
		var elemChilda = document.getElementById('childa');
		var elemChildb = document.getElementById('childb');
		var elemChildc = document.getElementById('childc');
		var elemChildd = document.getElementById('childd');
		var elemChilde = document.getElementById('childe');
		var elemChildf = document.getElementById('childf');
		var elemChildg = document.getElementById('childg');
		var elemChildh = document.getElementById('childh');
		var elemChildi = document.getElementById('childi');
		
		
		if(document.forms["search"].noOfRooms.value == "2")
		{

				elemBlockRoom2.style.display="inline";
				elemLabelRoom2.style.display="inline";	
				elemBlockRoom3.style.display="none";
				elemLabelRoom3.style.display="none";
				elemChildd.style.display="inline";
				elemChilde.style.display="inline";
				elemChildf.style.display="inline";
				elemChildg.style.display="none";
				elemChildh.style.display="none";
				elemChildi.style.display="none";
				
				showChildAge2(document.getElementById('inputchildren2'));
				
				if(document.getElementById('inputchildren2').value != "0"){
					if(document.getElementById('childAgeContainer2')){
						document.getElementById('childAgeContainer2').style.width = "245px";
						document.getElementById('childAgeContainer2').style.margin = "5px 0 5px 0";
						document.getElementById('childAgeContainer2').style.background = "#ffffff";
						document.getElementById('childAgeContainer2').style.borderBottom = "#de1c85 1px solid";
						document.getElementById('childAgeContainer2').style.borderLeft = "#de1c85 1px solid";
						document.getElementById('childAgeContainer2').style.borderRight = "#de1c85 1px solid";
						document.getElementById('childAgeContainer2').style.borderTop = "#de1c85 1px solid" ;
						}
				
				} else {
					if(document.getElementById('childAgeContainer2')){
						document.getElementById('childAgeContainer2').style.width = "0px";
						document.getElementById('childAgeContainer2').style.margin = "0 0 0 0";
						document.getElementById('childAgeContainer2').style.background = "none";
						document.getElementById('childAgeContainer2').style.borderBottom = "#de1c85 0px solid";
						document.getElementById('childAgeContainer2').style.borderLeft = "#de1c85 0px solid";
						document.getElementById('childAgeContainer2').style.borderRight = "#de1c85 0px solid";
						document.getElementById('childAgeContainer2').style.borderTop = "#de1c85 0px solid" ;
					}
		  		}
		  		
		  		if(document.getElementById('childAgeContainer3')){
		  			document.getElementById('childAgeContainer3').style.width = "0px";
					document.getElementById('childAgeContainer3').style.margin = "0 0 0 0";
					document.getElementById('childAgeContainer3').style.background = "none";
					document.getElementById('childAgeContainer3').style.borderBottom = "#de1c85 0px solid";
					document.getElementById('childAgeContainer3').style.borderLeft = "#de1c85 0px solid";
					document.getElementById('childAgeContainer3').style.borderRight = "#de1c85 0px solid";
					document.getElementById('childAgeContainer3').style.borderTop = "#de1c85 0px solid" ;
				}
		  
		}
		else if(document.forms["search"].noOfRooms.value == "3")
		{

				elemBlockRoom3.style.display="inline";
				elemLabelRoom3.style.display="inline";	
				elemBlockRoom2.style.display="inline";
				elemLabelRoom2.style.display="inline";	
				elemChildg.style.display="inline";
				elemChildh.style.display="inline";
				elemChildi.style.display="inline";
			
				showChildAge2(document.getElementById('inputchildren2'));
				showChildAge3(document.getElementById('inputchildren3'));
			
				if(document.getElementById('inputchildren2').value != "0"){
					if(document.getElementById('childAgeContainer2')){
				
						document.getElementById('childAgeContainer1').style.background = "#ffffff";
						document.getElementById('childAgeContainer1').style.borderBottom = "#de1c85 1px solid";
						document.getElementById('childAgeContainer1').style.borderLeft = "#de1c85 1px solid";
						document.getElementById('childAgeContainer1').style.borderRight = "#de1c85 1px solid";
						document.getElementById('childAgeContainer1').style.borderTop = "#de1c85 1px solid" ;
					}
				
				} else {
					if(document.getElementById('childAgeContainer2')){
						document.getElementById('childAgeContainer2').style.width = "0px";
						document.getElementById('childAgeContainer2').style.margin = "0 0 0 0";
						document.getElementById('childAgeContainer2').style.background = "none";
						document.getElementById('childAgeContainer2').style.background = "none";
						document.getElementById('childAgeContainer2').style.borderBottom = "#de1c85 0px solid";
						document.getElementById('childAgeContainer2').style.borderLeft = "#de1c85 0px solid";
						document.getElementById('childAgeContainer2').style.borderRight = "#de1c85 0px solid";
						document.getElementById('childAgeContainer2').style.borderTop = "#de1c85 0px solid" ;
					}
		  		}
		  		
		  		if(document.getElementById('inputchildren3').value != "0"){
		  			if(document.getElementById('childAgeContainer3')){
						document.getElementById('childAgeContainer3').style.width = "245px";
						document.getElementById('childAgeContainer3').style.margin = "5px 0 5px 0";
						document.getElementById('childAgeContainer3').style.background = "#ffffff";
						document.getElementById('childAgeContainer3').style.borderBottom = "#de1c85 1px solid";
						document.getElementById('childAgeContainer3').style.borderLeft = "#de1c85 1px solid";
						document.getElementById('childAgeContainer3').style.borderRight = "#de1c85 1px solid";
						document.getElementById('childAgeContainer3').style.borderTop = "#de1c85 1px solid" ;
					}
				} else {

					if(document.getElementById('childAgeContainer3')){
						document.getElementById('childAgeContainer3').style.width = "0px";
						document.getElementById('childAgeContainer3').style.margin = "0 0 0 0";
						document.getElementById('childAgeContainer3').style.background = "none";
						document.getElementById('childAgeContainer3').style.borderBottom = "#de1c85 0px solid";
						document.getElementById('childAgeContainer3').style.borderLeft = "#de1c85 0px solid";
						document.getElementById('childAgeContainer3').style.borderRight = "#de1c85 0px solid";
						document.getElementById('childAgeContainer3').style.borderTop = "#de1c85 0px solid" ;
					}
				}
			
		} else if(document.forms["search"].noOfRooms.value == "1") {
			
			elemBlockRoom2.style.display="none";
			elemLabelRoom2.style.display="none";
			elemBlockRoom3.style.display="none";
			elemLabelRoom3.style.display="none";
			elemChilda.style.display="inline";
			elemChildb.style.display="inline";
			elemChildc.style.display="inline";
			elemChildd.style.display="none";
			elemChilde.style.display="none";
			elemChildf.style.display="none";
			elemChildg.style.display="none";
			elemChildh.style.display="none";
			elemChildi.style.display="none";

			showChildAge(document.getElementById('inputchildren'));
					
			
			if(document.getElementById('childAgeContainer2')){
				
				document.getElementById('childAgeContainer2').style.width = "0px";
				document.getElementById('childAgeContainer2').style.margin = "0 0 0 0";
				document.getElementById('childAgeContainer2').style.background = "none";
				document.getElementById('childAgeContainer2').style.borderBottom = "#de1c85 0px solid";
				document.getElementById('childAgeContainer2').style.borderLeft = "#de1c85 0px solid";
				document.getElementById('childAgeContainer2').style.borderRight = "#de1c85 0px solid";
				document.getElementById('childAgeContainer2').style.borderTop = "#de1c85 0px solid" ;
			}
		  
		 	if(document.getElementById('childAgeContainer3')){
		  		document.getElementById('childAgeContainer3').style.width = "0px";
		  		document.getElementById('childAgeContainer3').style.margin = "0 0 0 0";
		  		document.getElementById('childAgeContainer3').style.background = "none";
				document.getElementById('childAgeContainer3').style.borderBottom = "#de1c85 0px solid";
				document.getElementById('childAgeContainer3').style.borderLeft = "#de1c85 0px solid";
				document.getElementById('childAgeContainer3').style.borderRight = "#de1c85 0px solid";
				document.getElementById('childAgeContainer3').style.borderTop = "#de1c85 0px solid" ;
		  	}

		}
	
}
	  
/*
 * This method is used to display and hide children age blocks corresponding to room1 as per selection.
 */
function showChildAge(obj,pageOnload) {
	var elemChild1Label = document.getElementById('child1label');
	var elemChild1 = document.getElementById('child1');
	var elemChild2 = document.getElementById('child2');
	var elemChild3 = document.getElementById('child3');
	var elemChild4 = document.getElementById('child4');
	var elemChild5 = document.getElementById('child5');
	var elemChild6 = document.getElementById('child6');
	var elemChilda = document.getElementById('childa');
	var elemChildb = document.getElementById('childb');
	var elemChildc = document.getElementById('childc');	
	var childPerRoom;
		
	if(pageOnload){
		childPerRoom = childrenPerRoomArray[0];	
		
		for(var c=0; c< parseInt(childPerRoom); c++){
			var childAgeDropDown =	document.getElementById('child'+parseInt(c + 1)+'Combo');
			for(var x = 0; x < childAgeDropDown.length; x++){
				if(childAgesPerRoomArray[c] == childAgeDropDown[x].value){
					childAgeDropDown.selectedIndex = x;
					break;
				}	
			}
		}
		
	}else{
		childPerRoom = obj.value;
	}
		
		
	if(childPerRoom == "1"){
		elemChilda.style.display="inline";
		elemChild1Label.style.display="inline";
		elemChild1.style.display="inline";
		elemChild2.style.display="none";
		elemChild3.style.display="none";
		elemChild4.style.display="none";
		elemChild5.style.display="none";
		elemChild6.style.display="none";	
		elemChildb.style.display="none";
		elemChildc.style.display="none";
		
		if(document.getElementById('childAgeContainer1')){
			document.getElementById('childAgeContainer1').style.width = "245px";
			document.getElementById('childAgeContainer1').style.margin = "5px 0 5px 0";
			document.getElementById('childAgeContainer1').style.background = "#ffffff";
			document.getElementById('childAgeContainer1').style.borderBottom = "#de1c85 1px solid";
			document.getElementById('childAgeContainer1').style.borderLeft = "#de1c85 1px solid";
			document.getElementById('childAgeContainer1').style.borderRight = "#de1c85 1px solid";
			document.getElementById('childAgeContainer1').style.borderTop = "#de1c85 1px solid" ;
			
		}
			
	}else if(childPerRoom == "2"){
		elemChild1Label.style.display="inline";
		elemChild1.style.display="inline";
		elemChild2.style.display="inline";
		elemChild3.style.display="none";
		elemChild4.style.display="none";
		elemChild5.style.display="none";
		elemChild6.style.display="none";
		elemChilda.style.display="inline";
		elemChildb.style.display="none";
		elemChildc.style.display="none";
		
		if(document.getElementById('childAgeContainer1')){
			document.getElementById('childAgeContainer1').style.width = "245px";
			document.getElementById('childAgeContainer1').style.margin = "5px 0 5px 0";
			document.getElementById('childAgeContainer1').style.background = "#ffffff";
			document.getElementById('childAgeContainer1').style.border = "#de1c85";
			document.getElementById('childAgeContainer1').style.borderBottom = "#de1c85 1px solid";
			document.getElementById('childAgeContainer1').style.borderLeft = "#de1c85 1px solid";
			document.getElementById('childAgeContainer1').style.borderRight = "#de1c85 1px solid";
			document.getElementById('childAgeContainer1').style.borderTop = "#de1c85 1px solid" ;
		}

	}else if(childPerRoom == "3"){
		elemChild1Label.style.display="inline";
		elemChild1.style.display="inline";
		elemChild2.style.display="inline";
		elemChild3.style.display="inline";
		elemChild4.style.display="none";
		elemChild5.style.display="none";
		elemChild6.style.display="none";
		elemChilda.style.display="inline";
		elemChildb.style.display="inline";
		elemChildc.style.display="none";
			
		if(document.getElementById('childAgeContainer1')){
			document.getElementById('childAgeContainer1').style.width = "245px";
			document.getElementById('childAgeContainer1').style.margin = "5px 0 5px 0";
			document.getElementById('childAgeContainer1').style.background = "#ffffff";
			document.getElementById('childAgeContainer1').style.border = "#de1c85";
			document.getElementById('childAgeContainer1').style.borderBottom = "#de1c85 1px solid";
			document.getElementById('childAgeContainer1').style.borderLeft = "#de1c85 1px solid";
			document.getElementById('childAgeContainer1').style.borderRight = "#de1c85 1px solid";
			document.getElementById('childAgeContainer1').style.borderTop = "#de1c85 1px solid" ;
		}
		
	} else if(childPerRoom == "4") {
		elemChild1Label.style.display="inline";
		elemChild1.style.display="inline";
		elemChild2.style.display="inline";
		elemChild3.style.display="inline";
		elemChild4.style.display="inline";
		elemChild5.style.display="none";
		elemChild6.style.display="none";
		elemChilda.style.display="inline";
		elemChildb.style.display="inline";
		elemChildc.style.display="none";
		
		if(document.getElementById('childAgeContainer1')){
		document.getElementById('childAgeContainer1').style.width = "245px";
		document.getElementById('childAgeContainer1').style.margin = "5px 0 5px 0";
		document.getElementById('childAgeContainer1').style.background = "#ffffff";
		document.getElementById('childAgeContainer1').style.borderBottom = "#de1c85 1px solid";
		document.getElementById('childAgeContainer1').style.borderLeft = "#de1c85 1px solid";
		document.getElementById('childAgeContainer1').style.borderRight = "#de1c85 1px solid";
		document.getElementById('childAgeContainer1').style.borderTop = "#de1c85 1px solid" ;
		}

	} else if(childPerRoom == "5") {
		elemChild1Label.style.display="inline";
		elemChild1.style.display="inline";
		elemChild2.style.display="inline";
		elemChild3.style.display="inline";
		elemChild4.style.display="inline";
		elemChild5.style.display="inline";
		elemChild6.style.display="none";
		elemChilda.style.display="inline";
		elemChildb.style.display="inline";
		elemChildc.style.display="inline";
		if(document.getElementById('childAgeContainer1')){
		document.getElementById('childAgeContainer1').style.width = "245px";
		document.getElementById('childAgeContainer1').style.margin = "5px 0 5px 0";
		document.getElementById('childAgeContainer1').style.background = "#ffffff";
		document.getElementById('childAgeContainer1').style.borderBottom = "#de1c85 1px solid";
		document.getElementById('childAgeContainer1').style.borderLeft = "#de1c85 1px solid";
		document.getElementById('childAgeContainer1').style.borderRight = "#de1c85 1px solid";
		document.getElementById('childAgeContainer1').style.borderTop = "#de1c85 1px solid" ;
		}

	} else if(childPerRoom == "6") {
		elemChild1Label.style.display="inline";
		elemChild1.style.display="inline";
		elemChild2.style.display="inline";
		elemChild3.style.display="inline";
		elemChild4.style.display="inline";
		elemChild5.style.display="inline";
		elemChild6.style.display="inline";
		elemChilda.style.display="inline";
		elemChildb.style.display="inline";
		elemChildc.style.display="inline";

		if(document.getElementById('childAgeContainer1')){
		document.getElementById('childAgeContainer1').style.width = "245px";
		document.getElementById('childAgeContainer1').style.margin = "5px 0 5px 0";
		document.getElementById('childAgeContainer1').style.background = "#ffffff";
		document.getElementById('childAgeContainer1').style.borderBottom = "#de1c85 1px solid";
		document.getElementById('childAgeContainer1').style.borderLeft = "#de1c85 1px solid";
		document.getElementById('childAgeContainer1').style.borderRight = "#de1c85 1px solid";
		document.getElementById('childAgeContainer1').style.borderTop = "#de1c85 1px solid" ;
		}

	} else if(childPerRoom == "0") {
		elemChild1Label.style.display="none";
		elemChild1.style.display="none";
		elemChild2.style.display="none";
		elemChild3.style.display="none";
		elemChild4.style.display="none";
		elemChild5.style.display="none";
		elemChild6.style.display="none";
		elemChilda.style.display="none";
		elemChildb.style.display="none";
		elemChildc.style.display="none";
		if(document.getElementById('childAgeContainer1')){
		document.getElementById('childAgeContainer1').style.width = "0px";
		document.getElementById('childAgeContainer1').style.margin = "0 0 0 0";
		document.getElementById('childAgeContainer1').style.background = "none";
		document.getElementById('childAgeContainer1').style.borderBottom = "#de1c85 0px solid";
		document.getElementById('childAgeContainer1').style.borderLeft = "#de1c85 0px solid";
		document.getElementById('childAgeContainer1').style.borderRight = "#de1c85 0px solid";
		document.getElementById('childAgeContainer1').style.borderTop = "#de1c85 0px solid" ;
			
		}
	}
}



/*
 * This method is used to display and hide children age blocks corresponding to room2 as per selection.
 */   

function showChildAge2(obj,pageOnload) {
		if(document.forms["search"].noOfRooms.value == "2" || document.forms["search"].noOfRooms.value == "3")
		{
	var elemChild2Label = document.getElementById('child2label');
	var elemChild7 = document.getElementById('child7');
	var elemChild8 = document.getElementById('child8');
	var elemChild9 = document.getElementById('child9');
	var elemChild10 = document.getElementById('child10');
	var elemChild11 = document.getElementById('child11');
	var elemChild12 = document.getElementById('child12');
	var elemChildd = document.getElementById('childd');
	var elemChilde = document.getElementById('childe');
	var elemChildf = document.getElementById('childf');

	if(pageOnload){
		childPerRoom = childrenPerRoomArray[1];
		
		for(var c=0; c< parseInt(childPerRoom); c++){
			var childAgeDropDown =	document.getElementById('child'+parseInt(c + 7)+'Combo');
			for(var x = 0; x < childAgeDropDown.length; x++){
				if(childAgesPerRoomArray[(c+6)] == childAgeDropDown[x].value){
					childAgeDropDown.selectedIndex = x;
					break;
				}	
			}
		}
	}else{
		childPerRoom = obj.value;
	}

	if(childPerRoom == "1"){
		elemChild2Label.style.display="inline";
		elemChild7.style.display="inline";
		elemChild8.style.display="none";
		elemChild9.style.display="none";
		elemChild10.style.display="none";
		elemChild11.style.display="none";
		elemChild12.style.display="none";
		elemChildd.style.display="inline";
		elemChilde.style.display="none";
		elemChildf.style.display="none";


		if(document.getElementById('childAgeContainer2')){
		document.getElementById('childAgeContainer2').style.width = "245px";
		document.getElementById('childAgeContainer2').style.margin = "5px 0 5px 0";
		document.getElementById('childAgeContainer2').style.background = "#ffffff";
		document.getElementById('childAgeContainer2').style.borderBottom = "#de1c85 1px solid";
		document.getElementById('childAgeContainer2').style.borderLeft = "#de1c85 1px solid";
		document.getElementById('childAgeContainer2').style.borderRight = "#de1c85 1px solid";
		document.getElementById('childAgeContainer2').style.borderTop = "#de1c85 1px solid" ;
		}

	}else if(childPerRoom == "2"){
		elemChild2Label.style.display="inline";
		elemChild7.style.display="inline";
		elemChild8.style.display="inline";
		elemChild9.style.display="none";
		elemChild10.style.display="none";
		elemChild11.style.display="none";
		elemChild12.style.display="none";
		elemChildd.style.display="inline";
		elemChilde.style.display="none";
		elemChildf.style.display="none";
		if(document.getElementById('childAgeContainer2')){
		document.getElementById('childAgeContainer2').style.width = "245px";
		document.getElementById('childAgeContainer2').style.margin = "5px 0 5px 0";
		document.getElementById('childAgeContainer2').style.background = "#ffffff";
		document.getElementById('childAgeContainer2').style.borderBottom = "#de1c85 1px solid";
		document.getElementById('childAgeContainer2').style.borderLeft = "#de1c85 1px solid";
		document.getElementById('childAgeContainer2').style.borderRight = "#de1c85 1px solid";
		document.getElementById('childAgeContainer2').style.borderTop = "#de1c85 1px solid" ;
		}	    

	} else if(childPerRoom == "3"){
		elemChild2Label.style.display="inline";
		elemChild7.style.display="inline";
		elemChild8.style.display="inline";
		elemChild9.style.display="inline";
		elemChild10.style.display="none";
		elemChild11.style.display="none";
		elemChild12.style.display="none";
		elemChildd.style.display="inline";
		elemChilde.style.display="inline";
		elemChildf.style.display="none";

		if(document.getElementById('childAgeContainer2')){
		document.getElementById('childAgeContainer2').style.width = "245px";
		document.getElementById('childAgeContainer2').style.margin = "5px 0 5px 0";
		document.getElementById('childAgeContainer2').style.background = "#ffffff";
		document.getElementById('childAgeContainer2').style.borderBottom = "#de1c85 1px solid";
		document.getElementById('childAgeContainer2').style.borderLeft = "#de1c85 1px solid";
		document.getElementById('childAgeContainer2').style.borderRight = "#de1c85 1px solid";
		document.getElementById('childAgeContainer2').style.borderTop = "#de1c85 1px solid" ;
	    }
	} else if(childPerRoom == "4"){
		elemChild2Label.style.display="inline";
		elemChild7.style.display="inline";
		elemChild8.style.display="inline";
		elemChild9.style.display="inline";
		elemChild10.style.display="inline";
		elemChild11.style.display="none";
		elemChild12.style.display="none";
		elemChildd.style.display="inline";
		elemChilde.style.display="inline";
		elemChildf.style.display="none";
		if(document.getElementById('childAgeContainer2')){
		document.getElementById('childAgeContainer2').style.width = "245px";
		document.getElementById('childAgeContainer2').style.margin = "5px 0 5px 0";
		document.getElementById('childAgeContainer2').style.background = "#ffffff";
		document.getElementById('childAgeContainer2').style.borderBottom = "#de1c85 1px solid";
		document.getElementById('childAgeContainer2').style.borderLeft = "#de1c85 1px solid";
		document.getElementById('childAgeContainer2').style.borderRight = "#de1c85 1px solid";
		document.getElementById('childAgeContainer2').style.borderTop = "#de1c85 1px solid" ;
		}

	} else if(childPerRoom == "5"){
		elemChild2Label.style.display="inline";
		elemChild7.style.display="inline";
		elemChild8.style.display="inline";
		elemChild9.style.display="inline";
		elemChild10.style.display="inline";
		elemChild11.style.display="inline";
		elemChild12.style.display="none";
		elemChildd.style.display="inline";
		elemChilde.style.display="inline";
		elemChildf.style.display="inline";
		if(document.getElementById('childAgeContainer2')){
		document.getElementById('childAgeContainer2').style.width = "245px";
		document.getElementById('childAgeContainer2').style.margin = "5px 0 5px 0";
		document.getElementById('childAgeContainer2').style.background = "#ffffff";
		document.getElementById('childAgeContainer2').style.borderBottom = "#de1c85 1px solid";
		document.getElementById('childAgeContainer2').style.borderLeft = "#de1c85 1px solid";
		document.getElementById('childAgeContainer2').style.borderRight = "#de1c85 1px solid";
		document.getElementById('childAgeContainer2').style.borderTop = "#de1c85 1px solid" ;
}
	} else if(childPerRoom == "6"){
		elemChild2Label.style.display="inline";
		elemChild7.style.display="inline";
		elemChild8.style.display="inline";
		elemChild9.style.display="inline";
		elemChild10.style.display="inline";
		elemChild11.style.display="inline";
		elemChild12.style.display="inline";
		elemChildd.style.display="inline";
		elemChilde.style.display="inline";
		elemChildf.style.display="inline";
		if(document.getElementById('childAgeContainer2')){
		document.getElementById('childAgeContainer2').style.width = "245px";
		document.getElementById('childAgeContainer2').style.margin = "5px 0 5px 0";
		document.getElementById('childAgeContainer2').style.background = "#ffffff";
		document.getElementById('childAgeContainer2').style.borderBottom = "#de1c85 1px solid";
		document.getElementById('childAgeContainer2').style.borderLeft = "#de1c85 1px solid";
		document.getElementById('childAgeContainer2').style.borderRight = "#de1c85 1px solid";
		document.getElementById('childAgeContainer2').style.borderTop = "#de1c85 1px solid" ;
	    }
	}else if(childPerRoom == "0"){
		elemChild2Label.style.display="none";
		elemChild7.style.display="none";
		elemChild8.style.display="none";
		elemChild9.style.display="none";
		elemChild10.style.display="none";
		elemChild11.style.display="none";
		elemChild12.style.display="none";
		elemChildd.style.display="none";
		elemChilde.style.display="none";
		elemChildf.style.display="none";
		if(document.getElementById('childAgeContainer2')){
		document.getElementById('childAgeContainer2').style.width = "0px";
		document.getElementById('childAgeContainer2').style.margin = "0 0 0 0";
		document.getElementById('childAgeContainer2').style.background = "none";
		document.getElementById('childAgeContainer2').style.borderBottom = "#de1c85 0px solid";
		document.getElementById('childAgeContainer2').style.borderLeft = "#de1c85 0px solid";
		document.getElementById('childAgeContainer2').style.borderRight = "#de1c85 0px solid";
		document.getElementById('childAgeContainer2').style.borderTop = "#de1c85 0px solid" ;
		}
	}
	}
}		

/*
 * This method is used to display and hide children age blocks corresponding to room3 as per selection.
 */
 function showChildAge3(obj,pageOnload) {
 		if(document.forms["search"].noOfRooms.value == "3")
		{
 	var elemChild3Label = document.getElementById('child3label');
	var elemChild13 = document.getElementById('child13');
	var elemChild14 = document.getElementById('child14');
	var elemChild15 = document.getElementById('child15');
	var elemChild16 = document.getElementById('child16');
	var elemChild17 = document.getElementById('child17');
	var elemChild18 = document.getElementById('child18');
	var elemChildg = document.getElementById('childg');
	var elemChildh = document.getElementById('childh');
	var elemChildi = document.getElementById('childi');

	if(pageOnload){
		childPerRoom = childrenPerRoomArray[2];
		
		for(var c=0; c < parseInt(childPerRoom); c++){
			var childAgeDropDown =	document.getElementById('child'+parseInt(c + 13)+'Combo');
			for(var x = 0; x < childAgeDropDown.length; x++){
				if(childAgesPerRoomArray[(c + 12)] == childAgeDropDown[x].value){
					childAgeDropDown.selectedIndex = x;
					break;
				}	
			}
		}
	}else{
		childPerRoom = obj.value;
	}

	if(childPerRoom == "1"){
		elemChild3Label.style.display="inline";
		elemChild13.style.display="inline";
		elemChild14.style.display="none";
		elemChild15.style.display="none";
		elemChild16.style.display="none";
		elemChild17.style.display="none";
		elemChild18.style.display="none";
		elemChildg.style.display="inline";
		elemChildh.style.display="none";
		elemChildi.style.display="none";
		if(document.getElementById('childAgeContainer3')){
		document.getElementById('childAgeContainer3').style.width = "245px";
		document.getElementById('childAgeContainer3').style.margin = "5px 0 5px 0";
		document.getElementById('childAgeContainer3').style.background = "#ffffff";
		document.getElementById('childAgeContainer3').style.borderBottom = "#de1c85 1px solid";
		document.getElementById('childAgeContainer3').style.borderLeft = "#de1c85 1px solid";
		document.getElementById('childAgeContainer3').style.borderRight = "#de1c85 1px solid";
		document.getElementById('childAgeContainer3').style.borderTop = "#de1c85 1px solid" ;
		}

	}else if(childPerRoom == "2"){
		elemChild3Label.style.display="inline";
		elemChild13.style.display="inline";
		elemChild14.style.display="inline";
		elemChild15.style.display="none";
		elemChild16.style.display="none";
		elemChild17.style.display="none";
		elemChild18.style.display="none";
		elemChildg.style.display="inline";
		elemChildh.style.display="none";
		elemChildi.style.display="none";
		if(document.getElementById('childAgeContainer3')){
		document.getElementById('childAgeContainer3').style.width = "245px";
		document.getElementById('childAgeContainer3').style.margin = "5px 0 5px 0";
		document.getElementById('childAgeContainer3').style.background = "#ffffff";
		document.getElementById('childAgeContainer3').style.borderBottom = "#de1c85 1px solid";
		document.getElementById('childAgeContainer3').style.borderLeft = "#de1c85 1px solid";
		document.getElementById('childAgeContainer3').style.borderRight = "#de1c85 1px solid";
		document.getElementById('childAgeContainer3').style.borderTop = "#de1c85 1px solid" ;
		}

	}else if(childPerRoom == "3"){

		elemChild3Label.style.display="inline";
		elemChild13.style.display="inline";
		elemChild14.style.display="inline";
		elemChild15.style.display="inline";
		elemChild16.style.display="none";
		elemChild17.style.display="none";
		elemChild18.style.display="none";
		elemChildg.style.display="inline";
		elemChildh.style.display="inline";
		elemChildi.style.display="none";
		if(document.getElementById('childAgeContainer3')){
		document.getElementById('childAgeContainer3').style.width = "245px";
		document.getElementById('childAgeContainer3').style.margin = "5px 0 5px 0";	
		document.getElementById('childAgeContainer3').style.background = "#ffffff";
		document.getElementById('childAgeContainer3').style.borderBottom = "#de1c85 1px solid";
		document.getElementById('childAgeContainer3').style.borderLeft = "#de1c85 1px solid";
		document.getElementById('childAgeContainer3').style.borderRight = "#de1c85 1px solid";
		document.getElementById('childAgeContainer3').style.borderTop = "#de1c85 1px solid" ;
		}
	    
	}else if(childPerRoom == "4"){

		elemChild3Label.style.display="inline";
		elemChild13.style.display="inline";
		elemChild14.style.display="inline";
		elemChild15.style.display="inline";
		elemChild16.style.display="inline";
		elemChild17.style.display="none";
		elemChild18.style.display="none";
		elemChildg.style.display="inline";
		elemChildh.style.display="inline";
		elemChildi.style.display="none";
		if(document.getElementById('childAgeContainer3')){
		document.getElementById('childAgeContainer3').style.width = "245px";
		document.getElementById('childAgeContainer3').style.margin = "5px 0 5px 0";
		document.getElementById('childAgeContainer3').style.background = "#ffffff";
		document.getElementById('childAgeContainer3').style.borderBottom = "#de1c85 1px solid";
		document.getElementById('childAgeContainer3').style.borderLeft = "#de1c85 1px solid";
		document.getElementById('childAgeContainer3').style.borderRight = "#de1c85 1px solid";
		document.getElementById('childAgeContainer3').style.borderTop = "#de1c85 1px solid" ;
		}
		
	}else if(childPerRoom == "5"){

		elemChild3Label.style.display="inline";
		elemChild13.style.display="inline";
		elemChild14.style.display="inline";
		elemChild15.style.display="inline";
		elemChild16.style.display="inline";
		elemChild17.style.display="inline";
		elemChild18.style.display="none";
		elemChildg.style.display="inline";
		elemChildh.style.display="inline";
		elemChildi.style.display="inline";
		if(document.getElementById('childAgeContainer3')){
		document.getElementById('childAgeContainer3').style.width = "245px";
		document.getElementById('childAgeContainer3').style.margin = "5px 0 5px 0";
		document.getElementById('childAgeContainer3').style.background = "#ffffff";
		document.getElementById('childAgeContainer3').style.borderBottom = "#de1c85 1px solid";
		document.getElementById('childAgeContainer3').style.borderLeft = "#de1c85 1px solid";
		document.getElementById('childAgeContainer3').style.borderRight = "#de1c85 1px solid";
		document.getElementById('childAgeContainer3').style.borderTop = "#de1c85 1px solid" ;
		}
	}else if(childPerRoom == "6"){

		elemChild3Label.style.display="inline";
		elemChild13.style.display="inline";
		elemChild14.style.display="inline";
		elemChild15.style.display="inline";
		elemChild16.style.display="inline";
		elemChild17.style.display="inline";
		elemChild18.style.display="inline";
		elemChildg.style.display="inline";
		elemChildh.style.display="inline";
		elemChildi.style.display="inline";
		if(document.getElementById('childAgeContainer3')){
		document.getElementById('childAgeContainer3').style.width = "245px";
		document.getElementById('childAgeContainer3').style.margin = "5px 0 5px 0";
		document.getElementById('childAgeContainer3').style.background = "#ffffff";
		document.getElementById('childAgeContainer3').style.borderBottom = "#de1c85 1px solid";
		document.getElementById('childAgeContainer3').style.borderLeft = "#de1c85 1px solid";
		document.getElementById('childAgeContainer3').style.borderRight = "#de1c85 1px solid";
		document.getElementById('childAgeContainer3').style.borderTop = "#de1c85 1px solid" ;
	    	}
	}else if(childPerRoom == "0"){
		elemChild3Label.style.display="none";
		elemChild13.style.display="none";
		elemChild14.style.display="none";
		elemChild15.style.display="none";
		elemChild16.style.display="none";
		elemChild17.style.display="none";
		elemChild18.style.display="none";
		elemChildg.style.display="none";
		elemChildh.style.display="none";
		elemChildi.style.display="none";
		if(document.getElementById('childAgeContainer3')){
		document.getElementById('childAgeContainer3').style.width = "0px";
		document.getElementById('childAgeContainer3').style.margin = "0 0 0 0";
		document.getElementById('childAgeContainer3').style.background = "none";
		document.getElementById('childAgeContainer3').style.borderBottom = "#de1c85 0px solid";
		document.getElementById('childAgeContainer3').style.borderLeft = "#de1c85 0px solid";
		document.getElementById('childAgeContainer3').style.borderRight = "#de1c85 0px solid";
		document.getElementById('childAgeContainer3').style.borderTop = "#de1c85 0px solid" ;
		}
	}
	}
}
   /*
 * This method is used to set the paxmix option to default
 * for destination landing page for ECIS-1
 */
function resetPaxMix() {
	document.getElementById("inputrooms").selectedIndex = 0;
	document.getElementById("inputadults").selectedIndex = 1;
	/* following line is commented to implement FF8600*/
/*	document.getElementById("inputseniors").selectedIndex = 0; */
	document.getElementById("inputchildren").selectedIndex = 0;
	document.getElementById("inputadults2").selectedIndex = 0;
	document.getElementById("inputchildren2").selectedIndex = 0;
	document.getElementById("inputadults3").selectedIndex = 0;
	document.getElementById("inputchildren3").selectedIndex = 0;
	document.getElementById("child1Combo").selectedIndex = 0;
	document.getElementById("child2Combo").selectedIndex = 0;
	document.getElementById("child3Combo").selectedIndex = 0;
	document.getElementById("child4Combo").selectedIndex = 0;
	document.getElementById("child5Combo").selectedIndex = 0;
	document.getElementById("child6Combo").selectedIndex = 0;
	document.getElementById("child7Combo").selectedIndex = 0;
	document.getElementById("child8Combo").selectedIndex = 0;
	document.getElementById("child9Combo").selectedIndex = 0;
	document.getElementById("child10Combo").selectedIndex = 0;
	document.getElementById("child11Combo").selectedIndex = 0;
	document.getElementById("child12Combo").selectedIndex = 0;
	document.getElementById("child13Combo").selectedIndex = 0;
	document.getElementById("child14Combo").selectedIndex = 0;
	document.getElementById("child15Combo").selectedIndex = 0;
	document.getElementById("child16Combo").selectedIndex = 0;
	document.getElementById("child17Combo").selectedIndex = 0;
	document.getElementById("child18Combo").selectedIndex = 0;
}
/**********************************************************************************************************************************************/

/* passenger_details.js END*/

/**********************************************************************************************************************************************/

/**********************************************************************************************************************************************/

/* toggleLayer.js START*/

/**********************************************************************************************************************************************/
/**
     * This function shows and hides the div when required.
     **/
    
	function toggleLayer(whichLayer){
     var elem, vis;      
     elem = document.getElementById( whichLayer );  
     vis = elem.style;  // if the style.display value is blank we try to figure it out here  
     if(vis.display==''&& elem.offsetWidth!=undefined && elem.offsetHeight!=undefined){    
     vis.display = (elem.offsetWidth!=0 && elem.offsetHeight!=0)?'block':'none';
	 
     }else{  
		 
     vis.display = (vis.display==''|| vis.display == 'block')?'none':'block';
     if(document.getElementById('accomOrBrochure1')) document.getElementById('accomOrBrochure1').checked=false;
     if(document.getElementById('accomOrBrochure2')) document.getElementById('accomOrBrochure2').checked=false;
     if(document.getElementById('accomOrBrochure3')) document.getElementById('accomOrBrochure3').checked=false;
       
     if(document.getElementById('hotelName')) document.getElementById('hotelName').value='Enter Hotel Name';

     if(document.getElementById('brochureCode')) document.getElementById('brochureCode').value='Enter Brochure Code';

     if(document.getElementById('holidayLocator')) document.getElementById('holidayLocator').value='Enter holiday locator';
       }
     var searchButton2 = document.getElementsByName('search_button2');  
     if(vis.display == undefined ||vis.display == '' ||vis.display == 'none'){
     	document.search.accomOrBrochure.value= '';
		if(searchButton2 != null && searchButton2.length > 0)
			document.getElementsByName('search_button1')[0].style.display="inline";
     }else{
		if(searchButton2 != null && searchButton2.length > 0)
			document.getElementsByName('search_button1')[0].style.display="none";
	 }
     }

	function displayLink(whichId){
	        if(document.getElementById('brochureCodeSpan')) document.getElementById('brochureCodeSpan').className="ncol1 greyout";
		if(document.getElementById('hotelNameSpan')) document.getElementById('hotelNameSpan').className="ncol1 greyout";
		if(document.getElementById('holidayLocatorSpan')) document.getElementById('holidayLocatorSpan').className="ncol1 greyout";
		if(document.getElementById(whichId)) document.getElementById(whichId).style.display='block';
		if(document.getElementById('hotelImportantInfo')) document.getElementById('hotelImportantInfo').style.display="none";
		if(document.getElementById('hotelName')) document.getElementById('hotelName').disabled=true;
		if(document.getElementById('brochureSelect')) document.getElementById('brochureSelect').disabled=true;
	        if(document.getElementById('brochureCode')) document.getElementById('brochureCode').disabled=true;
	        if(document.getElementById('holidayLocator')) document.getElementById('holidayLocator').disabled=true;
	}

	function displayKnowWhereBlock(obj) {
		var name = obj.name;
		if (name == 'search_button1') {
			document.getElementById('knowWhereBlock').value = 'false';
			if(document.getElementById('compareDiv')){
				document.getElementById('compareDiv').style.display="none";
			}
			if(document.getElementById('minimize')){
				document.getElementById('minimize').style.display="none";
			}

			
		} else {
			document.getElementById('knowWhereBlock').value = 'true';
			if(document.getElementById('compareDiv')){
				document.getElementById('compareDiv').style.display="none";
			}
			if(document.getElementById('minimize')){
				document.getElementById('minimize').style.display="none";
			}
		}
	}

	function knowAccomOrBrochureValue(value) {		
		if(value == 'locatorCode'){
			if(document.getElementById('holidayLocator')) document.getElementById('holidayLocator').disabled=false;
			if(document.getElementById('hotelName')) document.getElementById('hotelName').disabled=true;
			if(document.getElementById('brochureCode')) document.getElementById('brochureCode').disabled=true;
			if(document.getElementById('brochureSelect')) document.getElementById('brochureSelect').disabled=true;
			if(document.getElementById('hotelName')) document.getElementById('hotelName').value='Enter Hotel Name';
		    if(document.getElementById('brochureCode')) document.getElementById('brochureCode').value='Enter Brochure Code';
		    if(document.getElementById('hotelImportantInfo')) document.getElementById('hotelImportantInfo').style.display="none";		    
		}
		else if(value == 'accomCode'){
			if(document.getElementById('brochureCode')) document.getElementById('brochureCode').disabled=false;
			if(document.getElementById('hotelName')) document.getElementById('hotelName').disabled=true;
			if(document.getElementById('holidayLocator')) document.getElementById('holidayLocator').disabled=true;
			if(document.getElementById('brochureSelect')) document.getElementById('brochureSelect').disabled=false;
			if(document.getElementById('hotelName')) document.getElementById('hotelName').value='Enter Hotel Name';
		    if(document.getElementById('holidayLocator')) document.getElementById('holidayLocator').value='Enter holiday locator';
		    if(document.getElementById('hotelImportantInfo')) document.getElementById('hotelImportantInfo').style.display="none";	
		}
		else if(value == 'accomName'){
			if(document.getElementById('hotelName')) document.getElementById('hotelName').disabled=false;
			if(document.getElementById('brochureCode')) document.getElementById('brochureCode').disabled=true;
			if(document.getElementById('holidayLocator')) document.getElementById('holidayLocator').disabled=true;
			if(document.getElementById('brochureSelect')) document.getElementById('brochureSelect').disabled=true;
		    if(document.getElementById('brochureCode')) document.getElementById('brochureCode').value='Enter Brochure Code';
		    if(document.getElementById('holidayLocator')) document.getElementById('holidayLocator').value='Enter holiday locator';
		    if(document.getElementById('hotelImportantInfo')) document.getElementById('hotelImportantInfo').style.display="block";	
		}
		else if(value == 'undefined' || value == ''|| value == 'holidaySearch'){	
		    if(document.getElementById('hotelName')) document.getElementById('hotelName').disabled=true;
		    if(document.getElementById('brochureCode')) document.getElementById('brochureCode').disabled=true;
		    if(document.getElementById('brochureSelect')) document.getElementById('brochureSelect').disabled=true;
		    if(document.getElementById('holidayLocator')) document.getElementById('holidayLocator').disabled=true;
		    if(document.getElementById('hotelName')) document.getElementById('hotelName').value='Enter Hotel Name';
		    if(document.getElementById('brochureCode')) document.getElementById('brochureCode').value='Enter Brochure Code';
		    if(document.getElementById('holidayLocator')) document.getElementById('holidayLocator').value='Enter holiday locator';
		    if(document.getElementById('searchforml2')) var vis= document.getElementById( 'searchforml2' );	
		    if(document.getElementById('hotelImportantInfo'))  document.getElementById('hotelImportantInfo').style.display="none";	    
		}
	}

function changeDisplay(id){
	if(document.getElementById(id)){
		if(document.getElementById(id).style.display == "none"){
			document.getElementById(id).style.display = "block";
		} else if(document.getElementById(id).style.display == "block"){
			document.getElementById(id).style.display = "none";
		}
	}
}
/**********************************************************************************************************************************************/

/* toggleLayer.js END*/

/**********************************************************************************************************************************************/

/**********************************************************************************************************************************************/

/* proposition_dependency.js END*/

/**********************************************************************************************************************************************/
 /*
  * This function hides the number of rooms and children as per the proposition selected.
  */
 function getValueCombo(){
	
			 var Index = document.getElementById("propositionSelect").selectedIndex;			 
			 var elemRoomLabel = document.getElementById("roomLabelVisibility");
			 var elemRoomSelect = document.getElementById("roomSelectBox");
			 var elemRoom2Block = document.getElementById("room2block");
			 var elemRoom3Block = document.getElementById("room3block");
			 var elemChildLabel = document.getElementById("childLabelVisibility");
			 var elemRoom1Label = document.getElementById("room1Label");
			 var elemChild1Label = document.getElementById("child1label");
			 var elemAdultSelect1 = document.getElementById("adultSelectBox1");
			 var elemChildrenSelect1 = document.getElementById("childrenSelectBox1");
			 var elemChildrenSelect2 = document.getElementById("childrenSelectBox2");
			 var elemChildrenSelect3 = document.getElementById("childrenSelectBox3");
			 var elemChildrenaBlock = document.getElementById("childa");
			 var elemChildrenbBlock = document.getElementById("childb");
			 var elemChildrencBlock = document.getElementById("childc");
			 var elemChildrendBlock = document.getElementById("childd");
			 var elemChildreneBlock = document.getElementById("childe");
			 var elemChildrenfBlock = document.getElementById("childf");
			 var elemChildrengBlock = document.getElementById("childg");
			 var elemChildrenhBlock = document.getElementById("childh");
			 var elemChildreniBlock = document.getElementById("childi");
			 if(document.getElementById('childAgeContainer1') != null){
			document.getElementById('childAgeContainer1').style.borderBottom = "#de1c85 0px solid";
			document.getElementById('childAgeContainer1').style.borderLeft = "#de1c85 0px solid";
			document.getElementById('childAgeContainer1').style.borderRight = "#de1c85 0px solid";
			document.getElementById('childAgeContainer1').style.borderTop = "#de1c85 0px solid" ;
			document.getElementById('childAgeContainer1').style.background = "none";
			document.getElementById('childAgeContainer1').style.borderBottom = "#de1c85 0px solid";
			document.getElementById('childAgeContainer2').style.borderLeft = "#de1c85 0px solid";
			document.getElementById('childAgeContainer2').style.borderRight = "#de1c85 0px solid";
			document.getElementById('childAgeContainer2').style.borderTop = "#de1c85 0px solid" ;
			document.getElementById('childAgeContainer2').style.background = "none";
			document.getElementById('childAgeContainer3').style.borderBottom = "#de1c85 0px solid";
			document.getElementById('childAgeContainer3').style.borderLeft = "#de1c85 0px solid";
			document.getElementById('childAgeContainer3').style.borderRight = "#de1c85 0px solid";
			document.getElementById('childAgeContainer3').style.borderTop = "#de1c85 0px solid" ;
			document.getElementById('childAgeContainer3').style.background = "none";
			 }

			 if ((document.getElementById("propositionSelect").options[Index].text).toLowerCase() == ("Clubbing Holidays").toLowerCase()) {
				 elemChild1Label.style.visibility="hidden";
				 elemChildLabel.style.visibility="hidden";
				 elemRoomLabel.style.visibility="visible";
				 elemRoomSelect.style.display="inline";
				 elemRoom1Label.style.display="inline";
				 elemRoom2Block.style.display="none";
				 elemRoom3Block.style.display="none";
				 elemAdultSelect1.style.display="inline";
				 elemChildrenSelect1.style.display="none";
				 elemChildrenSelect2.style.display="none";
				 elemChildrenSelect3.style.display="none";
				 elemChildrenaBlock.style.display="none";
				 elemChildrenbBlock.style.display="none";
				 elemChildrencBlock.style.display="none";
				 elemChildrendBlock.style.display="none";
				 elemChildreneBlock.style.display="none";
				 elemChildrenfBlock.style.display="none";
				 elemChildrengBlock.style.display="none";
				 elemChildrenhBlock.style.display="none";
				 elemChildreniBlock.style.display="none";

                 document.getElementById("inputrooms").selectedIndex = 0;
				 document.getElementById("inputadults").selectedIndex = 1;
				 document.getElementById("inputchildren").selectedIndex = 0;
				 document.getElementById("inputadults2").selectedIndex = 1;
				 document.getElementById("inputchildren2").selectedIndex = 0;
				 document.getElementById("inputadults3").selectedIndex = 1;
				 document.getElementById("inputchildren3").selectedIndex = 0;
				 document.getElementById("inputrooms").selectedIndex = 0;
				 document.getElementById("inputadults").selectedIndex = 1;
				 document.getElementById("inputchildren").selectedIndex = 0;
				 document.getElementById("inputadults2").selectedIndex = 1;
				 document.getElementById("inputchildren2").selectedIndex = 0;
				 document.getElementById("inputadults3").selectedIndex = 1;
				 document.getElementById("inputchildren3").selectedIndex = 0;
				 document.getElementById("child1Combo").selectedIndex = 0;
				 document.getElementById("child2Combo").selectedIndex = 0;
				 document.getElementById("child3Combo").selectedIndex = 0;
				 document.getElementById("child4Combo").selectedIndex = 0;
				 document.getElementById("child5Combo").selectedIndex = 0;
				 document.getElementById("child6Combo").selectedIndex = 0;
				 document.getElementById("child7Combo").selectedIndex = 0;
				 document.getElementById("child8Combo").selectedIndex = 0;
				 document.getElementById("child9Combo").selectedIndex = 0;
				 document.getElementById("child10Combo").selectedIndex = 0;
				 document.getElementById("child11Combo").selectedIndex = 0;
				 document.getElementById("child12Combo").selectedIndex = 0;
				 document.getElementById("child13Combo").selectedIndex = 0;
				 document.getElementById("child14Combo").selectedIndex = 0;
				 document.getElementById("child15Combo").selectedIndex = 0;
				 document.getElementById("child16Combo").selectedIndex = 0;
				 document.getElementById("child17Combo").selectedIndex = 0;
				 document.getElementById("child18Combo").selectedIndex = 0;
			 } else {
				elemRoomLabel.style.visibility="visible";
				elemRoomSelect.style.display="inline";
				elemChildLabel.style.visibility="visible";
				elemRoom1Label.style.display="inline";
				elemAdultSelect1.style.display="inline";
				elemChildrenSelect1.style.display="inline";				
				elemChildrenSelect2.style.display="inline";
				elemChildrenSelect3.style.display="inline";

                elemRoom2Block.style.display="none";
				elemRoom3Block.style.display="none";
				elemChildrenaBlock.style.display="none";
                elemChildrenbBlock.style.display="none";
				elemChildrencBlock.style.display="none";
				elemChildrendBlock.style.display="none";
				elemChildreneBlock.style.display="none";
				elemChildrenfBlock.style.display="none";
				elemChildrengBlock.style.display="none";
				elemChildrenhBlock.style.display="none";
				elemChildreniBlock.style.display="none";
				document.getElementById("inputrooms").selectedIndex = 0;
				document.getElementById("inputadults").selectedIndex = 1;
		
				 document.getElementById("inputchildren").selectedIndex = 0;
				 document.getElementById("inputadults2").selectedIndex = 1;
				 document.getElementById("inputchildren2").selectedIndex = 0;
				 document.getElementById("inputadults3").selectedIndex = 1;
				 document.getElementById("inputchildren3").selectedIndex = 0;
				 document.getElementById("child1Combo").selectedIndex = 0;
				 document.getElementById("child2Combo").selectedIndex = 0;
				 document.getElementById("child3Combo").selectedIndex = 0;
				 document.getElementById("child4Combo").selectedIndex = 0;
				 document.getElementById("child5Combo").selectedIndex = 0;
				 document.getElementById("child6Combo").selectedIndex = 0;
				 document.getElementById("child7Combo").selectedIndex = 0;
				 document.getElementById("child8Combo").selectedIndex = 0;
				 document.getElementById("child9Combo").selectedIndex = 0;
				 document.getElementById("child10Combo").selectedIndex = 0;
				 document.getElementById("child11Combo").selectedIndex = 0;
				 document.getElementById("child12Combo").selectedIndex = 0;
				 document.getElementById("child13Combo").selectedIndex = 0;
				 document.getElementById("child14Combo").selectedIndex = 0;
				 document.getElementById("child15Combo").selectedIndex = 0;
				 document.getElementById("child16Combo").selectedIndex = 0;
				 document.getElementById("child17Combo").selectedIndex = 0;
				 document.getElementById("child18Combo").selectedIndex = 0;
			 }
			 showInfo();
		}
		function changedProposition(){
			document.getElementById('childAgeContainer1').style.width = "0px";
			document.getElementById('childAgeContainer1').style.margin = "0 0 0 0";
			document.getElementById('childAgeContainer1').style.background = "none";
			document.getElementById('childAgeContainer2').style.width = "0px";
			document.getElementById('childAgeContainer2').style.margin = "0 0 0 0";
			document.getElementById('childAgeContainer2').style.background = "none";
			document.getElementById('childAgeContainer3').style.width = "0px";
			document.getElementById('childAgeContainer3').style.margin = "0 0 0 0";
			document.getElementById('childAgeContainer3').style.background = "none";
		}		
		function reCalculatePax(rooms, adultsPerRoomArray, childrenPerRoomArray, childAgesPerRoomArray){
			if(rooms && adultsPerRoomArray && childrenPerRoomArray && childAgesPerRoomArray){
				var adultDropDown1 = document.getElementById("inputadults");
				var adultDropDown2 = document.getElementById("inputadults2");
				var adultDropDown3 = document.getElementById("inputadults3");
				var childDropDown1 = document.getElementById("inputchildren");
				var childDropDown2 = document.getElementById("inputchildren2");
				var childDropDown3 = document.getElementById("inputchildren3");

				
				if(adultDropDown1 && adultDropDown2 && adultDropDown3){
					for(var i = 0; i < adultsPerRoomArray.length; i++){

								if(i== 0 && adultsPerRoomArray[i] && adultsPerRoomArray[i] != 0){
									adultDropDown1.selectedIndex = (adultsPerRoomArray[i] - 1);
								}

								if(i== 1 && adultsPerRoomArray[i] && adultsPerRoomArray[i] != 0){
									adultDropDown2.selectedIndex = (adultsPerRoomArray[i] - 1);
								}

								if(i== 2 && adultsPerRoomArray[i] && adultsPerRoomArray[i] != 0){
									adultDropDown3.selectedIndex = (adultsPerRoomArray[i] - 1);
								}

					}
				}
				
				if(childDropDown1 && childDropDown2 && childDropDown3){	
					for(var i = 0; i < childrenPerRoomArray.length; i++){

								if(i== 0 && childrenPerRoomArray[i] && childrenPerRoomArray[i] != 0){
									childDropDown1.selectedIndex = (childrenPerRoomArray[i]);
								}

								if(i== 1 && childrenPerRoomArray[i] && childrenPerRoomArray[i] != 0){
									childDropDown2.selectedIndex = (childrenPerRoomArray[i]);
								}

								if(i== 2 && childrenPerRoomArray[i] && childrenPerRoomArray[i] != 0){
									childDropDown3.selectedIndex = (childrenPerRoomArray[i]);
								}

					}
				}
				
				
				if(childAgesPerRoomArray){
					for(var i = 0; i < childAgesPerRoomArray.length; i++){
						var childAgeDropDown = document.getElementById('child'+(i+1)+'Combo');
						if(childAgeDropDown && childAgesPerRoomArray[i] != 0){
							childAgeDropDown.selectedIndex = childAgesPerRoomArray[i];
						}
					}
				}
				
				var roomDropDown = document.getElementById("inputrooms");
				if(roomDropDown && rooms != 0){
					roomDropDown.selectedIndex = (rooms - 1);
				}
				
			}
			
		}
/**********************************************************************************************************************************************/

/* proposition_dependency.js END*/

/**********************************************************************************************************************************************/

/**********************************************************************************************************************************************/

/* calendar.js START*/

/**********************************************************************************************************************************************/
/**    javascript for th calendar.     **/

checkBrowser();
var browserType;
var ieVersion; //takes up the version number of the internet explorer.
function checkBrowser()
{
	var browserUserAgent = navigator.userAgent;
	if( -1 != browserUserAgent.indexOf ("AOL") )
	{
		browserType='AOL';
	}
  else if( -1 != browserUserAgent.indexOf ("MSIE") )
  {
		browserType='MSIE';
		
		if(browserUserAgent.indexOf("MSIE 7.0")!= -1){
			ieVersion = "7";
		}
		else if(browserUserAgent.indexOf("MSIE 6.0")!= -1)
		{
			ieVersion = "6";
		}
		else if(browserUserAgent.indexOf("MSIE 9.0")!= -1)
		{
			ieVersion = "9";
			
		}
  }
  else if( -1 != browserUserAgent.indexOf ("Mozilla"))
  {
		browserType='Mozilla';

  }
  else
  {
		browserType='Other';
  }
}

function getObj(objID)
{
    if (document.getElementById) {return document.getElementById(objID);}
    else if (document.all) {return document.all[objID];}
    else if (document.layers) {return document.layers[objID];}
}

//This function closes the Calendar.
function checkClick(e) {
	e?evt=e:evt=event;
	CSE=evt.target?evt.target:evt.srcElement;
	if (getObj('fc'))
		if (!isChild(CSE,getObj('fc')))
			getObj('fc').style.display='none';
	
}

function isChild(s,d) {
	while(s) {
		if (s==d) 
			return true;
		s=s.parentNode;
	}
	return false;
}

//to make the calendar right aligned
function Left(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

//to make the calendar left aligned
function Right(obj)
{
	//if browser is mozilla
	if(browserType=='Mozilla'){
		var curleft = 0;
		var curtop = 0;
		if (obj.offsetParent)
		{
			while (obj.offsetLeft)
			{
				curleft += obj.offsetLeft-200
				obj = obj.offsetParent;
			}
		}
		else if (obj.x){
			curleft += obj.x;
		}
	}// for other browsers
	else{
		var curleft = 0;
		if (obj.offsetParent)
		{
			while (obj.offsetParent)
			{
				curleft += obj.offsetLeft-110
				obj = obj.offsetParent;
			}
		}
		else if (obj.x){
			curleft += obj.x;
		}
	}
	return curleft;
}

function Top(obj)
{
	var curtop = 0;
	if(browserType=='Mozilla'){
		if (obj.offsetParent)
		{
			while (obj.offsetParent)
			{
				curtop += obj.offsetTop+50
				obj = obj.offsetParent;
			}
		}
		else if (obj.y)
			curtop += obj.y;
	}
	else{
		if (obj.offsetParent)
		{
			while (obj.offsetParent)
			{
				curtop += obj.offsetTop-20
				obj = obj.offsetParent;
			}
		}
		else if (obj.y)
			curtop += obj.y;
	}
	return curtop;
}

document.write('<html><head><title></title>');
//document.write('<html><head><title></title><link href="/css/default.css" type="text/css" rel="stylesheet"></link>');
//document.write('<!--[if IE 6]><link href="/css/defaultIe6.css" type="text/css" rel="stylesheet"></link><![endif]-->');
//document.write('<!--[if IE 7]><link href="/css/defaultIe7.css" type="text/css" rel="stylesheet"></link><![endif]-->');
document.write('</head><body style="padding:0;margin:0;"><div class="calTable">'); 
if(browserType=='Mozilla'){
	document.write('<table id="fc" style=" border:3px solid #255cb9;left:40%;top:40%;position:absolute;border-collapse:collapse;display:none">');
	document.write('<tr id="popcalhead" style="background:#255cb9 url(/images/siteElements/boxes/calheadbg.gif) repeat-x;color:#fff; min-height:21px; height:21px; padding:1px 2px 1px 6px;font:11px Arial;"><td colspan=5 align="left"><span><strong>Calendar</strong> - Click on a date to select</span></td><td colspan=3 align="right"><a href="javascript:checkClick(this);"><img src="/images/siteElements/boxes/calclose.gif" alt="close" /></a></td></tr>');
}
else if(browserType=='MSIE' && ieVersion == "6"){
	document.write('<table id="fc" style=" border:3px solid #255cb9;left:44%;top:40%;position:absolute;border-collapse:collapse;display:none">');
	document.write('<tr id="popcalhead" style="background:#255cb9 url(/images/siteElements/boxes/calheadbg.gif) repeat-x;color:#fff; height:21px; padding:1px 0px 1px 0px;font:11px Arial;"><td colspan=5 align="left"><span><strong>Calendar</strong> - Click on a date to select</span></td><td colspan=3 align="right"><a href="javascript:checkClick(this);"><img src="/images/siteElements/boxes/calclose.gif" alt="close" /></a></td></tr>');
}
else if(browserType=='MSIE' && ieVersion == "7" ){
	document.write('<table id="fc" style=" border:3px solid #255cb9;margin-left:20%;left:25%;top:40%;position:absolute;border-collapse:collapse;display:none">');
	document.write('<tr id="popcalhead" style="background:#255cb9 url(/images/siteElements/boxes/calheadbg.gif) repeat-x;color:#fff; min-height:21px; height:21px; padding:1px 2px 1px 6px;font:11px Arial;"><td colspan=5 align="left"><span><strong>Calendar</strong> - Click on a date to select</span></td><td colspan=3 align="right"><a href="javascript:checkClick(this);"><img src="/images/siteElements/boxes/calclose.gif" alt="close" /></a></td></tr>');
}
else{
	document.write('<table id="fc" style=" border:3px solid #255cb9;margin-left:20%;left:25%;top:40%;position:absolute;border-collapse:collapse;display:none">');
	document.write('<tr id="popcalhead" style="background:#255cb9 url(/images/siteElements/boxes/calheadbg.gif) repeat-x;color:#fff; min-height:21px; height:21px; padding:1px 2px 1px 6px;font:11px Arial;"><td colspan=5 align="left"><span><strong>Calendar</strong> - Click on a date to select</span></td><td colspan=3 align="right"><a href="javascript:checkClick(this);"><img src="/images/siteElements/boxes/calclose.gif" alt="close" /></a></td></tr>');
}
document.write('<tr id="popcalbody" style="background: #d2e1ff url(/images/siteElements/boxes/calbg.gif) repeat-x; padding: 8px 2px 2px 2px; text-align:center; border-top:3px solid #a4c0ef;"><td colspan=7 id="mnsTD" align="center" style="font:bold 13px Arial"></td></tr>');
document.write('<tr align=center style="background:#FFFFFF;font:12px Arial;"><td width=14%><b>Sun</b></td><td width=14%><b>Mon</b></td><td width=14%><b>Tue</b></td><td width=14%><b>Wed</b></td><td width=14%><b>Thu</b></td><td width=14%><b>Fri</b></td><td width=14%><b>Sat</b></td></tr>');
trHTML='';
for(var kk=1;kk<=6;kk++) {
	for(var tt=1;tt<=7;tt++) {
		num=7 * (kk-1) - (-tt);
		document.write('<td colspan=1 id="v' + num + '" style="height:18px;">&nbsp;</td>');
	}
	document.write('</tr>');
}
document.write('<tr id="popcalhead" style="background: #255cb9 url(/images/siteElements/boxes/calheadbg.gif) repeat-x;color:#fff; min-height:21px; height:21px; padding:1px 2px 1px 6px;font:12px Arial;"><td colspan=7 align="center"><a style="color:#FFFFFF" href="javascript:checkClick(this);"><strong>Close</strong></a></td></tr>');
document.write('</table></div>');
document.all?document.attachEvent('onclick',checkClick):document.addEventListener('click',checkClick,false);


// Calendar script
var now = new Date;
var sccm=now.getMonth();
var sccy=now.getFullYear();
var scfd=now.getDate();
var ccm=now.getMonth();
var ccy=now.getFullYear();
var cfd=now.getDate();

//first date,month and year displayed.
var fcd=now.getDate();
var fcy=now.getFullYear();
var fcm=now.getMonth();

//variables for last month,year,date
var lastDate=new Date();
lastDate.setMonth(lastDate.getMonth()+17);
var tcd=lastDate.getDate();
var tcy=lastDate.getFullYear();
var tcm=lastDate.getMonth();

var updobj;
var updPropObj;
var index;
var updProp;
var monthSelected;
var updValue;

function lcs(ielem,selectedProposition) {
   
 	updobj=ielem;
	offsetTopPos = ielem.offsetTop-100;
	offsetTopPosPx = offsetTopPos+'px';

	offsetLeftPos = ielem.offsetLeft-560;
	offsetLeftPosPx = offsetLeftPos+'px';

	if(browserType=='Mozilla'){
		document.getElementById("fc").style.top = offsetTopPosPx;
	}
	monthSelected = parseInt(now.getMonth());
	populateMonth();
	
	updProp = '';
	if(selectedProposition){
		updPropObj = selectedProposition;
		index = updPropObj.selectedIndex;
		updProp = updPropObj.options[index].text;
		updValue = updPropObj.options[index].value;		

	}
	

	//we want to make the calendar left aligned hence commented the below method
	//getObj('fc').style.left=Left(ielem);
	getObj('fc').style.right=Right(ielem);
	getObj('fc').style.top=Top(ielem)+ielem.offsetHeight;
	getObj('fc').style.display='';

	// First check date is valid
	curdt=ielem.value;
	if(curdt == "" || curdt == null || curdt == "undefined"){
	   date = new Date;
	   curdt = date.getDate()+"/"+(date.getMonth()+1)+"/"+date.getYear();
	}
	else{
		curdtarr=curdt.split('/');
		if(curdt == curdtarr){
			date = new Date;
			curdt = date.getDate()+"/"+(date.getMonth()+1)+"/"+date.getYear();
		}
	}
	curdtarr=curdt.split('/');
	isdt=true;
	for(var k=0;k<curdtarr.length;k++) {
		if (isNaN(curdtarr[k]))
			isdt=false;
	}
	if (isdt&&(curdtarr.length==3)) {
		ccm=curdtarr[1]-1;
		ccy=curdtarr[2];
		if(browserType=='Mozilla'){
			dateValue=curdtarr[0];
			monthValue=curdtarr[1]-1;
			yearValue=curdtarr[2];
			if(yearValue.length<3){
				yearValue=1+yearValue;
			}
			if(yearValue<2000){
				yearValue=1900+parseInt(yearValue);
			}
			prepcalendar(dateValue,monthValue,yearValue);
		}
		else{
			dateValue=curdtarr[0];
			monthValue=curdtarr[1]-1;
			yearValue=curdtarr[2];
			if(yearValue<2000){
				yearValue=20+yearValue;
			}
			prepcalendar(dateValue,monthValue,yearValue);
		}
	}
}
//function to populate the day as the label for departure date.
			
function populateDay(idDate,idSpan){
	
	var weekday=new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
	var dateValue = document.getElementById(idDate).value;	
	newDate = new Date();
	dateArr=dateValue.split('/');
	for(var k=0;k<dateArr.length;k++) {
		//fetching the date
		day=dateArr[0];
		//fetching the month (0,1,2 etc)
		month=dateArr[1]-1;
		//fetching the year, yyyy
		year=20+dateArr[2];
	}
			
	newDate.setDate(day);
	newDate.setMonth(month);
	newDate.setYear(year);
	if (isNaN(parseInt(newDate.getDay()))) {
		document.getElementById(idSpan).innerHTML='';
	} else{
		document.getElementById(idSpan).innerHTML=weekday[newDate.getDay()];
	}
}
function evtTgt(e)
{
	var el;
	if(e.target)el=e.target;
	else if(e.srcElement)el=e.srcElement;
	if(el.nodeType==3)el=el.parentNode; // defeat Safari bug
	return el;
}
function EvtObj(e){if(!e)e=window.event;return e;}

// This function is called for the color for dates on mouse over.
function cs_over(e) {
	evtTgt(EvtObj(e)).style.background='#FFCC66';
}

// This function is called for the color for mouse outs from the dates.
function cs_out(e) {
	evtTgt(EvtObj(e)).style.background='#FFFFFF';
}
//This function is called when a date is clicked.
function cs_click(e) {
	//Uncomment the below code if the date format is dd/m/yyyy
	//updobj.value=calvalarr[evtTgt(EvtObj(e)).id.substring(1,evtTgt(EvtObj(e)).id.length)];
	dateObtained=calvalarr[evtTgt(EvtObj(e)).id.substring(1,evtTgt(EvtObj(e)).id.length)];
	var splitDateObtained=dateObtained.split('/');
	for(i=0;i<splitDateObtained.length;i++){
		if(parseInt(splitDateObtained[i])<10){
			splitDateObtained[i]=0+splitDateObtained[i];
		}
	}
	dateObtained=splitDateObtained[0]+'/'+splitDateObtained[1]+'/'+splitDateObtained[2];

	if(updProp.toLowerCase() == ('Snow Holidays').toLowerCase()){
			var monthName = mn[parseInt(splitDateObtained[1])-1];
			var isValidMonth = false;
			for(i=0;i<mnSnow.length;i++){
				if(mnSnow[i] == monthName){
					isValidMonth = true;
					break;
				}
			}
			if(!isValidMonth){
				alert("Valid months for Snow holidays are from December to April");
				return false;
			}
				
	}

    if(updProp.toLowerCase() == ('Active Holidays').toLowerCase() && updValue =='8500019'){
			var monthName = mn[parseInt(splitDateObtained[1])-1];
			var isValidMonth = false;
			for(i=0;i<mnYachtActive.length;i++){
				if(mnYachtActive[i] == monthName){
					isValidMonth = true;
					break;
				}
			}
			if(!isValidMonth){
				alert("Valid months for Active holidays are from May to October");
				return false;
			}
				
	}

	if(updProp.toLowerCase() == ('Yacht Holidays').toLowerCase() && updValue =='8500021'){
			var monthName = mn[parseInt(splitDateObtained[1])-1];
			var isValidMonth = false;
			for(i=0;i<mnYachtActive.length;i++){
				if(mnYachtActive[i] == monthName){
					isValidMonth = true;
					break;
				}
			}
			if(!isValidMonth){
				alert("Valid months for Yatch holidays are from May to October");
				return false;
			}
				
	}
	
	//The below code if the date format is dd/mm/yy
	updobj.value=dateObtained.substring(0,6)+dateObtained.substring(8,10);
	//where departureDate is the text field Id where date is to be populated.
	//defaultDay is the span Id where the day is to be populated.
	populateDay('departureDate','defaultDay');
	getObj('fc').style.display='none';

}
//var weekday=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
var mn=new Array('January','February','March','April','May','June','July','August','September','October','November','December');
var mnSnow = new Array ('January','February','March','April','December');
var mnYachtActive = new Array ('May','June','July','August','September','October');
var mnn=new Array('31','28','31','30','31','30','31','31','30','31','30','31');
var mnl=new Array('31','29','31','30','31','30','31','31','30','31','30','31');
var calvalarr=new Array(42);

//This function is for the dates table shown
function f_cps(obj) {
	obj.style.background='#FFFFFF';
	obj.style.font='10px Arial';
	obj.style.color='black';
	obj.style.textAlign='center';
	obj.style.textDecoration='none';
	obj.style.border='0px solid #6487AE';
	obj.style.cursor='pointer';
}

// This function is for the colour of the past dates 
function f_cpps(obj) {
	obj.style.background='#FFFFFF';
	obj.style.font='10px Arial';
	obj.style.color='#ABABAB';
	obj.style.textAlign='center';
	//the cross over the dates not required. Hence this is commented.
	//obj.style.textDecoration='line-through';
	obj.style.border='0px solid #6487AE';
	obj.style.cursor='default';
}

//This function highlights the current date and the date for mouse over.
function f_hds(obj) {
	obj.style.background='#FFF799';
	obj.style.font='bold 10px Arial';
	obj.style.color='#333333';
	obj.style.textAlign='center';
	obj.style.border='0px solid #333333';
	obj.style.cursor='pointer';
}

var selectedMonth = new Array(17);
var selectedMonthNum = new Array(17);
function populateMonth(){
	var currDate = new Date;
	var mnth=parseInt(currDate.getMonth());
	var j=mnth;
	var arrCnt=0;
	if(browserType=='Mozilla'){
		currYear=1900+parseInt(currDate.getYear());
	} else if(browserType=='MSIE' && ieVersion == "9") {
		currYear=1900+parseInt(currDate.getYear());
	}else{
		currYear=parseInt(currDate.getYear());
	}

	for(cntr=mnth;cntr<mnth+18;cntr++){
		if(j>11){
			   j=0;
			   currYear++;
		}
		selectedMonth[arrCnt] = mn[j]+ ' ' + currYear;
		selectedMonthNum[arrCnt] = j+':'+currYear;
		if(arrCnt<selectedMonth.length){
			arrCnt++;
		}
		j++;
	}
}

var selectedMonth = new Array(3);
var selectedMonthNum = new Array(3);
function populateClubMonth(){
	var currDate = new Date;
	var mnth=parseInt(currDate.getMonth());
	var j=mnth;
	var arrCnt=0;
	if(browserType=='Mozilla'){
		currYear=1900+parseInt(currDate.getYear());
	}else{
		currYear=parseInt(currDate.getYear());
	}

	for(cntr=mnth;cntr<mnth+4;cntr++){
		if(j>11){
			   j=0;
			   currYear++;
		}
		selectedMonth[arrCnt] = mn[j]+ ' ' + currYear;
		selectedMonthNum[arrCnt] = j+':'+currYear;
		if(arrCnt<selectedMonth.length){
			arrCnt++;
		}
		j++;
	}
}
var elem;

// day selected
function prepcalendar(hd,cm,cy) {

	now=new Date();
	sd=now.getDate();
	td=new Date();
	td.setDate(1);
	td.setMonth(cm);
	td.setYear(cy);
	cd=td.getDay();
	if(browserType=='Mozilla'){
		if(cy.length<3){
			cy=1+cy;
		}
		if(cy<2000){
			cy=1900+parseInt(cy);
		}
	}else{
		if(cy<2000){
			cy=20+cy;
		}
	}
	td.setFullYear(cy);
	ccy=cy;
	cd=td.getDay();
	//writing the combo box
	selectInnerHTML ='<select id="mns" onChange=csubmOnSelect(this) style="font:12px Arial;width: 120px">';
	j=cm;
	year=cy;
	yearMonthSelected = mn[cm]+' '+cy
	intYear=parseInt(year);	
	
		for(i=0;i<selectedMonth.length;i++){
			if(selectedMonth[i]==yearMonthSelected ){
					selectInnerHTML = selectInnerHTML+'<option value="'+selectedMonthNum[i]+'" selected >'+selectedMonth[i]+'</option>';			
			}
			else{
				selectInnerHTML = selectInnerHTML+'<option value="'+selectedMonthNum[i]+'">'+selectedMonth[i]+'</option>';			
			}			
		}
		 
	selectInnerHTML = selectInnerHTML + '</select>';
	getObj('mnsTD').innerHTML = selectInnerHTML;

	//providing the next and previous images if valid.

	index = document.getElementById("mns").selectedIndex;
	prevNextInnerHTML = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
	if(document.getElementById('mns').options[index].value != selectedMonthNum[0]){
		prevNextInnerHTML = '&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:csubm()"><img style="visibility:visible;" src="/images/siteElements/boxes/calback.gif" alt="previous month" /></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
	}
	else{
		prevNextInnerHTML = '&nbsp;&nbsp;&nbsp;&nbsp;<img style="visibility:hidden;" src="/images/siteElements/boxes/calback.gif" alt="previous month" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
	}
	prevNextInnerHTML = prevNextInnerHTML+selectInnerHTML+'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'
	if(document.getElementById('mns').options[index].value != selectedMonthNum[selectedMonthNum.length-1]){
		prevNextInnerHTML = prevNextInnerHTML+'<a href="javascript:caddm()"><img style="visibility:visible;" src="/images/siteElements/boxes/calforward.gif" alt="next month" /></a>&nbsp;&nbsp;&nbsp;&nbsp;';
	}
	else{
		prevNextInnerHTML = prevNextInnerHTML+'<img style="visibility:hidden;" src="/images/siteElements/boxes/calforward.gif" alt="next month" />&nbsp;&nbsp;&nbsp;&nbsp;';
	}
	getObj('mnsTD').innerHTML = prevNextInnerHTML;

	marr=((cy%4)==0)?mnl:mnn;
	for(var d=1;d<=42;d++) {
		f_cps(getObj('v'+parseInt(d)));
		
		if ((d >= (cd -(-1))) && (d<=cd-(-marr[cm]))) {
			//dip is for past dates, htd for current date, remaining dates goes to else.
			//sd has been incremented by 2 to disable current + 1 date.
			dip=((d-cd < parseInt(sd)+2)&&(cm==sccm)&&(cy==sccy));
			htd=((hd!='')&&(d-cd==hd));
			if (dip){
				f_cpps(getObj('v'+parseInt(d)));}
			else if (htd){
				f_hds(getObj('v'+parseInt(d)));}
		else {			
			
			f_cps(getObj('v'+parseInt(d)));}

			//to retain the highligting in current date.	
			getObj('v'+parseInt(d)).onmouseover=(htd)?null:cs_over;
			getObj('v'+parseInt(d)).onmouseout=(htd)?null:cs_out;

			//getObj('v'+parseInt(d)).onmouseover=(dip)?null:cs_over;
			//getObj('v'+parseInt(d)).onmouseout=(dip)?null:cs_out;
			
			getObj('v'+parseInt(d)).onclick=(dip)?null:cs_click;
			getObj('v'+parseInt(d)).innerHTML=d-cd;	
			cy1=(parseInt(cy)-2000)
			calvalarr[d]=''+(d-cd)+'/'+(cm-(-1))+'/'+cy;
		}
		else {	
			
			getObj('v'+d).innerHTML='&nbsp;';
			getObj('v'+parseInt(d)).onmouseover=null;
			getObj('v'+parseInt(d)).onmouseout=null;
			getObj('v'+parseInt(d)).style.cursor='default';
			}
	}
}



function caddm() {

	if(parseInt(ccy)<2000){
		ccy=20+ccy;
	}
	
	marr=((ccy%4)==0)?mnl:mnn;
	ccm=parseInt(ccm)+1;
	if (ccm>11) {
		ccm=0;
		ccy++;
	}
	for(var i=0;i<selectedMonth.length;i++){
		if(selectedMonth[i]==(mn[ccm]+' '+ccy)){
			monthSelected = selectedMonth[i];
			break;
		}
	}
	
	if(selectedMonth[selectedMonth.length-1]==monthSelected){
		
		var mmyy = monthSelected.split(' ');
		
		ccy = mmyy[1];
		for(var j=0;j<mn.length;j++){
			if(mmyy[0]==mn[j]){
				
				ccm = j;
				break;
			}
		}
		
	}
	prepcalendar('',ccm,ccy);
	cdayf();
}

function csubm() {
	marr=((ccy%4)==0)?mnl:mnn;
	ccm-=1;
	if (ccm<0) {
		ccm=11;
		ccy--;
	}
	for(var i=0;i<selectedMonth.length;i++){
		if(selectedMonth[i]==(mn[ccm]+' '+ccy) || selectedMonth[i]==(mn[ccm]+' 20'+ccy)){
			monthSelected = selectedMonth[i];
		}
	}
	prepcalendar('',ccm,ccy);
	cdayf();
}

function csubmOnSelect(obj) {
	monthSelected=obj.options[obj.selectedIndex].text;
    dateSelected=obj.value;
    arr=dateSelected.split(':');
    ccm=arr[0];
    ccy=arr[1];
    marr=((ccy%4)==0)?mnl:mnn;
	for(var i=0;i<selectedMonth.length;i++){
		if(selectedMonth[i]==(mn[ccm]+' '+ccy)){
			monthSelected = selectedMonth[i];
		}
	}
    cdayf();
	prepcalendar('',ccm,ccy);
}

function cdayf() {
	if ((ccy>sccy)||(((ccy==sccy)||('20'+ccy==sccy))&&(ccm>=sccm))){
		return;
	}
	else {
		ccy=sccy;
		ccm=sccm;
		cfd=scfd;
	}
}function showWinndowCardPage(dealdate,deptairport,destination,boardbasis,starrating,duration,avgprice,numadults,numchilds,numinfants,accomcode)
{

var currentTime = new Date()
var month = currentTime.getMonth() + 1
	if(month<10)
	{
	month="0"+month;
	}
var day = currentTime.getDate()
	if(day<10)
	{
	day="0"+day;
	}
var year = currentTime.getFullYear()
var printdate=day + "/" + month + "/" + year;

var currentTime = new Date()
var hours = currentTime.getHours()
if(hours<10)
	{
	hours="0"+hours;
	}


var minutes = currentTime.getMinutes()
if(minutes<10)
	{
	minutes="0"+minutes;
	}


var printtime=hours+":"+minutes;
var paxDetail;
if(numadults !=null && numadults>0)
	{
    if(numadults>1)
		{
		 paxDetail=numadults +" "+"Adults";
		}
		else
		{
         paxDetail=numadults +" "+"Adult";
		}

	}
if(numchilds!=null&& numchilds>0)
	{
	if(numchilds<2)
		{
		 paxDetail=paxDetail+"/"+numchilds+" "+"Child";
		}
      else{
		  paxDetail=paxDetail+"/"+numchilds+" "+"Children";
	  }
	}

if(numinfants!=null&& numchilds>0)
	{
      
	  if(numinfants<2)
		{
		paxDetail=paxDetail+"/"+numinfants+" "+"Infant";
		}
      else{
		  paxDetail=paxDetail+"/"+numinfants+" "+"Infants";
	  }
	  
	  
	  
	}

if(starrating==null)
{
starrating='No star rating available';
}
var url = '/templates/windowCard.jsp' + "?destination="+ destination+"&dealdate="+dealdate +"&boardbasis="+boardbasis+"&starrating="+starrating+"&duration="+duration+"&avgprice="+avgprice+"&deptairport="+deptairport+"&printdate="+printdate+"&printtime="+printtime+"&paxDetail="+paxDetail+"&accomcode="+accomcode;

window.open(url,'name','height=800,width=750,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=yes,status=yes');

}
/**********************************************************************************************************************************************/

/* calendar.js END*/

/**********************************************************************************************************************************************/


/** START --- DHTML Window js moved to one file **/	
// -------------------------------------------------------------------
// DHTML Window Widget- By Dynamic Drive, available at: http://www.dynamicdrive.com
// v1.0: Script created Feb 15th, 07'
// v1.01: Feb 21th, 07' (see changelog.txt)
// v1.02: March 26th, 07' (see changelog.txt)
// v1.03: May 5th, 07' (see changelog.txt)
// v1.1:  Oct 29th, 07' (see changelog.txt)
// -------------------------------------------------------------------

var dhtmlwindow={
imagefiles:['windowfiles/min.gif', 'windowfiles/close.gif', 'windowfiles/restore.gif', 'windowfiles/resize.gif'], //Path to 4 images used by script, in that order
ajaxbustcache: true, //Bust caching when fetching a file via Ajax?
ajaxloadinghtml: '<b>Loading Page. Please wait...</b>', //HTML to show while window fetches Ajax Content?

minimizeorder: 0,
zIndexvalue:100,
tobjects: [], //object to contain references to dhtml window divs, for cleanup purposes
lastactivet: {}, //reference to last active DHTML window

init:function(t){
	var domwindow=document.createElement("div") //create dhtml window div
	domwindow.id=t
	domwindow.className="dhtmlwindow"
	var domwindowdata=''
	domwindowdata='<div class="drag-handle">'
	//domwindowdata+='DHTML Window <div class="drag-controls"><img src="'+this.imagefiles[0]+'" title="Minimize" /><img src="'+this.imagefiles[1]+'" title="Close" /></div>'
	domwindowdata+='DHTML Window <div class="drag-controls"><img src="'+this.imagefiles[0]+'" title="Minimize" /></div>'
	domwindowdata+='</div>'
	domwindowdata+='<div class="drag-contentarea"></div>'
	domwindowdata+='<div class="drag-statusarea"><div class="drag-resizearea" style="background: transparent url('+this.imagefiles[3]+') top right no-repeat;">&nbsp;</div></div>'
	domwindowdata+='</div>'
	domwindow.innerHTML=domwindowdata
	document.getElementById("dhtmlwindowholder").appendChild(domwindow)
	//this.zIndexvalue=(this.zIndexvalue)? this.zIndexvalue+1 : 100 //z-index value for DHTML window: starts at 0, increments whenever a window has focus
	var t=document.getElementById(t)
	var divs=t.getElementsByTagName("div")
	for (var i=0; i<divs.length; i++){ //go through divs inside dhtml window and extract all those with class="drag-" prefix
		if (/drag-/.test(divs[i].className))
			t[divs[i].className.replace(/drag-/, "")]=divs[i] //take out the "drag-" prefix for shorter access by name
	}
	//t.style.zIndex=this.zIndexvalue //set z-index of this dhtml window
	t.handle._parent=t //store back reference to dhtml window
	t.resizearea._parent=t //same
	t.controls._parent=t //same
	t.onclose=function(){return true} //custom event handler "onclose"
	t.onmousedown=function(){dhtmlwindow.setfocus(this)} //Increase z-index of window when focus is on it
	t.handle.onmousedown=dhtmlwindow.setupdrag //set up drag behavior when mouse down on handle div
	t.resizearea.onmousedown=dhtmlwindow.setupdrag //set up drag behavior when mouse down on resize div
	t.controls.onclick=dhtmlwindow.enablecontrols
	t.show=function(){dhtmlwindow.show(this)} //public function for showing dhtml window
	t.hide=function(){dhtmlwindow.hide(this)} //public function for hiding dhtml window
	t.close=function(){dhtmlwindow.close(this)} //public function for closing dhtml window (also empties DHTML window content)
	t.setSize=function(w, h){dhtmlwindow.setSize(this, w, h)} //public function for setting window dimensions
	t.moveTo=function(x, y){dhtmlwindow.moveTo(this, x, y)} //public function for moving dhtml window (relative to viewpoint)
	t.isResize=function(bol){dhtmlwindow.isResize(this, bol)} //public function for specifying if window is resizable
	t.isScrolling=function(bol){dhtmlwindow.isScrolling(this, bol)} //public function for specifying if window content contains scrollbars
	t.load=function(contenttype, contentsource, title){dhtmlwindow.load(this, contenttype, contentsource, title)} //public function for loading content into window
	this.tobjects[this.tobjects.length]=t
	return t //return reference to dhtml window div
},

open:function(t, contenttype, contentsource, title, attr, recalonload){
	var d=dhtmlwindow //reference dhtml window object
	function getValue(Name){
		var config=new RegExp(Name+"=([^,]+)", "i") //get name/value config pair (ie: width=400px,)
		return (config.test(attr))? parseInt(RegExp.$1) : 0 //return value portion (int), or 0 (false) if none found
	}
	if (document.getElementById(t)==null) //if window doesn't exist yet, create it
		t=this.init(t) //return reference to dhtml window div
	else
		t=document.getElementById(t)
	this.setfocus(t)
	t.setSize(getValue(("width")), (getValue("height"))) //Set dimensions of window
	var xpos=getValue("center")? "middle" : getValue("left") //Get x coord of window
	var ypos=getValue("center")? "middle" : getValue("top") //Get y coord of window
	//t.moveTo(xpos, ypos) //Position window
	if (typeof recalonload!="undefined" && recalonload=="recal" && this.scroll_top==0){ //reposition window when page fully loads with updated window viewpoints?
		if (window.attachEvent && !window.opera) //In IE, add another 400 milisecs on page load (viewpoint properties may return 0 b4 then)
			this.addEvent(window, function(){setTimeout(function(){t.moveTo(xpos, ypos)}, 400)}, "load")
		else
			this.addEvent(window, function(){t.moveTo(xpos, ypos)}, "load")
	}
	t.isResize(getValue("resize")) //Set whether window is resizable
	t.isScrolling(getValue("scrolling")) //Set whether window should contain scrollbars
	t.style.visibility="visible"
	t.style.display="block"
	t.contentarea.style.display="block"
	t.moveTo(xpos, ypos) //Position window
	t.load(contenttype, contentsource, title)
	if (t.state=="minimized" && t.controls.firstChild.title=="Restore"){ //If window exists and is currently minimized?
		t.controls.firstChild.setAttribute("src", dhtmlwindow.imagefiles[0]) //Change "restore" icon within window interface to "minimize" icon
		t.controls.firstChild.setAttribute("title", "Minimize")
		t.state="fullview" //indicate the state of the window as being "fullview"
	}
	return t
},

setSize:function(t, w, h){ //set window size (min is 150px wide by 100px tall)
	t.style.width=Math.max(parseInt(w), 150)+"px"
	t.contentarea.style.height=Math.max(parseInt(h), 100)+"px"
},

moveTo:function(t, x, y){ //move window. Position includes current viewpoint of document
	this.getviewpoint() //Get current viewpoint numbers
	t.style.left=(x=="middle")? this.scroll_left+(this.docwidth-t.offsetWidth)/2+"px" : this.scroll_left+parseInt(x)+"px"
	t.style.top=(y=="middle")? this.scroll_top+(this.docheight-t.offsetHeight)/2+"px" : this.scroll_top+parseInt(y)+"px"
},

isResize:function(t, bol){ //show or hide resize inteface (part of the status bar)
	t.statusarea.style.display=(bol)? "block" : "none"
	t.resizeBool=(bol)? 1 : 0
},

isScrolling:function(t, bol){ //set whether loaded content contains scrollbars
	t.contentarea.style.overflow=(bol)? "auto" : "hidden"
},

load:function(t, contenttype, contentsource, title){ //loads content into window plus set its title (3 content types: "inline", "iframe", or "ajax")
	if (t.isClosed){
		alert("DHTML Window has been closed, so no window to load contents into. Open/Create the window again.")
		return
	}
	var contenttype=contenttype.toLowerCase() //convert string to lower case
	if (typeof title!="undefined")
		t.handle.firstChild.nodeValue=title
	if (contenttype=="inline")
		t.contentarea.innerHTML=contentsource
	else if (contenttype=="div"){
		var inlinedivref=document.getElementById(contentsource)
		t.contentarea.innerHTML=(inlinedivref.defaultHTML || inlinedivref.innerHTML) //Populate window with contents of inline div on page
		if (!inlinedivref.defaultHTML)
			inlinedivref.defaultHTML=inlinedivref.innerHTML //save HTML within inline DIV
		inlinedivref.innerHTML="" //then, remove HTML within inline DIV (to prevent duplicate IDs, NAME attributes etc in contents of DHTML window
		inlinedivref.style.display="none" //hide that div
	}
	else if (contenttype=="iframe"){
		t.contentarea.style.overflow="hidden" //disable window scrollbars, as iframe already contains scrollbars
		if (!t.contentarea.firstChild || t.contentarea.firstChild.tagName!="IFRAME") //If iframe tag doesn't exist already, create it first
			t.contentarea.innerHTML='<iframe src="" style="margin:0; padding:0; width:100%; height: 100%" name="_iframe-'+t.id+'"></iframe>'
		window.frames["_iframe-"+t.id].location.replace(contentsource) //set location of iframe window to specified URL
		}
	else if (contenttype=="ajax"){
		this.ajax_connect(contentsource, t) //populate window with external contents fetched via Ajax
	}
	t.contentarea.datatype=contenttype //store contenttype of current window for future reference
},

setupdrag:function(e){
	var d=dhtmlwindow //reference dhtml window object
	var t=this._parent //reference dhtml window div
	d.etarget=this //remember div mouse is currently held down on ("handle" or "resize" div)
	var e=window.event || e
	d.initmousex=e.clientX //store x position of mouse onmousedown
	d.initmousey=e.clientY
	d.initx=parseInt(t.offsetLeft) //store offset x of window div onmousedown
	d.inity=parseInt(t.offsetTop)
	d.width=parseInt(t.offsetWidth) //store width of window div
	d.contentheight=parseInt(t.contentarea.offsetHeight) //store height of window div's content div
	if (t.contentarea.datatype=="iframe"){ //if content of this window div is "iframe"
		t.style.backgroundColor="#F8F8F8" //colorize and hide content div (while window is being dragged)
		t.contentarea.style.visibility="hidden"
	}
	document.onmousemove=d.getdistance //get distance travelled by mouse as it moves
	document.onmouseup=function(){
		if (t.contentarea.datatype=="iframe"){ //restore color and visibility of content div onmouseup
			t.contentarea.style.backgroundColor="white"
			t.contentarea.style.visibility="visible"
		}
		d.stop()
	}
	return false
},

getdistance:function(e){
	var d=dhtmlwindow
	var etarget=d.etarget
	var e=window.event || e
	d.distancex=e.clientX-d.initmousex //horizontal distance travelled relative to starting point
	d.distancey=e.clientY-d.initmousey
	if (etarget.className=="drag-handle") //if target element is "handle" div
		d.move(etarget._parent, e)
	else if (etarget.className=="drag-resizearea") //if target element is "resize" div
		d.resize(etarget._parent, e)
	return false //cancel default dragging behavior
},

getviewpoint:function(){ //get window viewpoint numbers
	var ie=document.all && !window.opera
	var domclientWidth=document.documentElement && parseInt(document.documentElement.clientWidth) || 100000 //Preliminary doc width in non IE browsers
	this.standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes
	this.scroll_top=(ie)? this.standardbody.scrollTop : window.pageYOffset
	this.scroll_left=(ie)? this.standardbody.scrollLeft : window.pageXOffset
	this.docwidth=(ie)? this.standardbody.clientWidth : (/Safari/i.test(navigator.userAgent))? window.innerWidth : Math.min(domclientWidth, window.innerWidth-16)
	this.docheight=(ie)? this.standardbody.clientHeight: window.innerHeight
},

rememberattrs:function(t){ //remember certain attributes of the window when it's minimized or closed, such as dimensions, position on page
	this.getviewpoint() //Get current window viewpoint numbers
	t.lastx=parseInt((t.style.left || t.offsetLeft))-dhtmlwindow.scroll_left //store last known x coord of window just before minimizing
	t.lasty=parseInt((t.style.top || t.offsetTop))-dhtmlwindow.scroll_top
	t.lastwidth=parseInt(t.style.width) //store last known width of window just before minimizing/ closing
},

move:function(t, e){
	t.style.left=dhtmlwindow.distancex+dhtmlwindow.initx+"px"
	t.style.top=dhtmlwindow.distancey+dhtmlwindow.inity+"px"
},

resize:function(t, e){
	t.style.width=Math.max(dhtmlwindow.width+dhtmlwindow.distancex, 150)+"px"
	t.contentarea.style.height=Math.max(dhtmlwindow.contentheight+dhtmlwindow.distancey, 100)+"px"
},

enablecontrols:function(e){
	var d=dhtmlwindow
	var sourceobj=window.event? window.event.srcElement : e.target //Get element within "handle" div mouse is currently on (the controls)
	if (/Minimize/i.test(sourceobj.getAttribute("title"))) //if this is the "minimize" control
		d.minimize(sourceobj, this._parent)
	else if (/Restore/i.test(sourceobj.getAttribute("title"))) //if this is the "restore" control
		d.restore(sourceobj, this._parent)
	else if (/Close/i.test(sourceobj.getAttribute("title"))) //if this is the "close" control
		d.close(this._parent)
	return false
},

minimize:function(button, t){
	dhtmlwindow.rememberattrs(t)
	button.setAttribute("src", dhtmlwindow.imagefiles[2])
	button.setAttribute("title", "Restore")
	t.state="minimized" //indicate the state of the window as being "minimized"
	t.contentarea.style.display="none"
	t.statusarea.style.display="none"
	if (typeof t.minimizeorder=="undefined"){ //stack order of minmized window on screen relative to any other minimized windows
		dhtmlwindow.minimizeorder++ //increment order
		t.minimizeorder=dhtmlwindow.minimizeorder
	}
	t.style.left="10px" //left coord of minmized window
	t.style.width="200px"
	var windowspacing=t.minimizeorder*10 //spacing (gap) between each minmized window(s)
	t.style.top=dhtmlwindow.scroll_top+dhtmlwindow.docheight-(t.handle.offsetHeight*t.minimizeorder)-windowspacing+"px"
},

restore:function(button, t){
	dhtmlwindow.getviewpoint()
	button.setAttribute("src", dhtmlwindow.imagefiles[0])
	button.setAttribute("title", "Minimize")
	t.state="fullview" //indicate the state of the window as being "fullview"
	t.style.display="block"
	t.contentarea.style.display="block"
	if (t.resizeBool) //if this window is resizable, enable the resize icon
		t.statusarea.style.display="block"
	t.style.left=parseInt(t.lastx)+dhtmlwindow.scroll_left+"px" //position window to last known x coord just before minimizing
	t.style.top=parseInt(t.lasty)+dhtmlwindow.scroll_top+"px"
	t.style.width=parseInt(t.lastwidth)+"px"
},


close:function(t){
	try{
		var closewinbol=t.onclose()
	}
	catch(err){ //In non IE browsers, all errors are caught, so just run the below
		var closewinbol=true
 }
	finally{ //In IE, not all errors are caught, so check if variable isn't defined in IE in those cases
		if (typeof closewinbol=="undefined"){
			alert("An error has occured somwhere inside your \"onclose\" event handler")
			var closewinbol=true
		}
	}
	if (closewinbol){ //if custom event handler function returns true
		if (t.state!="minimized") //if this window isn't currently minimized
			dhtmlwindow.rememberattrs(t) //remember window's dimensions/position on the page before closing
		if (window.frames["_iframe-"+t.id]) //if this is an IFRAME DHTML window
			window.frames["_iframe-"+t.id].location.replace("about:blank")
		else
			t.contentarea.innerHTML=""
		t.style.display="none"
		t.isClosed=true //tell script this window is closed (for detection in t.show())
	}
	return closewinbol
},


setopacity:function(targetobject, value){ //Sets the opacity of targetobject based on the passed in value setting (0 to 1 and in between)
	if (!targetobject)
		return
	if (targetobject.filters && targetobject.filters[0]){ //IE syntax
		if (typeof targetobject.filters[0].opacity=="number") //IE6
			targetobject.filters[0].opacity=value*100
		else //IE 5.5
			targetobject.style.filter="alpha(opacity="+value*100+")"
		}
	else if (typeof targetobject.style.MozOpacity!="undefined") //Old Mozilla syntax
		targetobject.style.MozOpacity=value
	else if (typeof targetobject.style.opacity!="undefined") //Standard opacity syntax
		targetobject.style.opacity=value
},

setfocus:function(t){ //Sets focus to the currently active window
	this.zIndexvalue++
	t.style.zIndex=this.zIndexvalue
	t.isClosed=false //tell script this window isn't closed (for detection in t.show())
	this.setopacity(this.lastactivet.handle, 0.5) //unfocus last active window
	this.setopacity(t.handle, 1) //focus currently active window
	this.lastactivet=t //remember last active window
},


show:function(t){
	if (t.isClosed){
		alert("DHTML Window has been closed, so nothing to show. Open/Create the window again.")
		return
	}
	if (t.lastx) //If there exists previously stored information such as last x position on window attributes (meaning it's been minimized or closed)
		dhtmlwindow.restore(t.controls.firstChild, t) //restore the window using that info
	else
		t.style.display="block"
	this.setfocus(t)
	t.state="fullview" //indicate the state of the window as being "fullview"
},

hide:function(t){
	t.style.display="none"
},

ajax_connect:function(url, t){
	var page_request = false
	var bustcacheparameter=""
	if (window.XMLHttpRequest) // if Mozilla, IE7, Safari etc
		page_request = new XMLHttpRequest()
	else if (window.ActiveXObject){ // if IE6 or below
		try {
		page_request = new ActiveXObject("Msxml2.XMLHTTP")
		} 
		catch (e){
			try{
			page_request = new ActiveXObject("Microsoft.XMLHTTP")
			}
			catch (e){}
		}
	}
	else
		return false
	t.contentarea.innerHTML=this.ajaxloadinghtml
	page_request.onreadystatechange=function(){dhtmlwindow.ajax_loadpage(page_request, t)}
	if (this.ajaxbustcache) //if bust caching of external page
		bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
	page_request.open('GET', url+bustcacheparameter, true)
	page_request.send(null)
},

ajax_loadpage:function(page_request, t){
	if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)){
	t.contentarea.innerHTML=page_request.responseText
	}
},


stop:function(){
	dhtmlwindow.etarget=null //clean up
	document.onmousemove=null
	document.onmouseup=null
},

addEvent:function(target, functionref, tasktype){ //assign a function to execute to an event handler (ie: onunload)
	var tasktype=(window.addEventListener)? tasktype : "on"+tasktype
	if (target.addEventListener)
		target.addEventListener(tasktype, functionref, false)
	else if (target.attachEvent)
		target.attachEvent(tasktype, functionref)
},

cleanup:function(){
	for (var i=0; i<dhtmlwindow.tobjects.length; i++){
		dhtmlwindow.tobjects[i].handle._parent=dhtmlwindow.tobjects[i].resizearea._parent=dhtmlwindow.tobjects[i].controls._parent=null
	}
	window.onload=null
}

} //End dhtmlwindow object

document.write('<div id="dhtmlwindowholder"><span style="display:none">.</span></div>') //container that holds all dhtml window divs on page
window.onunload=dhtmlwindow.cleanup

/** END ---- DHTML Window js moved to one file **/


/**********************************************************************************************************************************************/

/* Modal.js START*/

/**********************************************************************************************************************************************/

// -------------------------------------------------------------------
// DHTML Modal window- By Dynamic Drive, available at: http://www.dynamicdrive.com
// v1.0: Script created Feb 27th, 07'
// v1.01 May 5th, 07' Minor change to modal window positioning behavior (not a bug fix)
// REQUIRES: DHTML Window Widget (v1.01 or higher): http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/
// -------------------------------------------------------------------

if (typeof dhtmlwindow=="undefined")
alert('ERROR: Modal Window script requires all files from "DHTML Window widget" in order to work!')

var dhtmlmodal={
veilstack: 0,
open:function(t, contenttype, contentsource, title, attr, recalonload){
	var d=dhtmlwindow //reference dhtmlwindow object
	this.interVeil=document.getElementById("interVeil") //Reference "veil" div
	this.veilstack++ //var to keep track of how many modal windows are open right now
	this.loadveil()
	if (typeof recalonload!="undefined" && recalonload=="recal" && d.scroll_top==0)
		d.addEvent(window, function(){dhtmlmodal.loadveil()}, "load")
		var t=d.open(t, contenttype, contentsource, title, attr, recalonload)
	t.controls.firstChild.style.display="none" //Disable "minimize" button
	//t.controls.onclick=function(){dhtmlmodal.forceclose(this._parent)} //OVERWRITE default control action with new one
	t.show=function(){dhtmlmodal.show(this)} //OVERWRITE default t.show() method with new one
	t.hide=function(){dhtmlmodal.close(this)} //OVERWRITE default t.hide() method with new one
return t
},


loadveil:function(){
	var d=dhtmlwindow
	d.getviewpoint()
	this.docheightcomplete=(d.standardbody.offsetHeight>d.standardbody.scrollHeight)? d.standardbody.offsetHeight : d.standardbody.scrollHeight
	this.interVeil.style.width=d.docwidth+"px" //set up veil over page
	this.interVeil.style.height=this.docheightcomplete+"px" //set up veil over page
	this.interVeil.style.left=0 //Position veil over page
	this.interVeil.style.top=0 //Position veil over page
	this.interVeil.style.visibility="visible" //Show veil over page
	this.interVeil.style.display="block" //Show veil over page
},

adjustveil:function(){ //function to adjust veil when window is resized
	if (this.interVeil && this.interVeil.style.display=="block") //If veil is currently visible on the screen
		this.loadveil() //readjust veil
},


close:function(t){ //user initiated function used to close modal window

	t.contentDoc=(t.contentarea.datatype=="iframe")? window.frames["_iframe-"+t.id].document : t.contentarea //return reference to modal window DIV (or document object in the case of iframe
	var closewinbol=dhtmlwindow.close(t)
	if (closewinbol){ //if var returns true
		this.veilstack--
		if (this.veilstack==0) //if this is the only modal window visible on the screen, and being closed
			this.interVeil.style.display="none"
 }
},

/*forceclose:function(t){ //function attached to default "close" icon of window to bypass "onclose" event, and just close window
alert(2);
	dhtmlwindow.rememberattrs(t) //remember window's dimensions/position on the page before closing

	t.style.display="none"
	this.veilstack--
		if (this.veilstack==0) //if this is the only modal window visible on the screen, and being closed
			this.interVeil.style.display="none"
},*/

show:function(t){
	dhtmlmodal.veilstack++
	dhtmlmodal.loadveil()
	dhtmlwindow.show(t)
}
} //END object declaration


document.write('<div id="interVeil"></div>')
dhtmlwindow.addEvent(window, function(){if (typeof dhtmlmodal!="undefined") dhtmlmodal.adjustveil()}, "resize")

/**********************************************************************************************************************************************/

/* Modal.js END*/

/**********************************************************************************************************************************************/

