// JavaScript Document
var domainHome = "/";
//var domainHome = "http://"+document.domain+"/";
//var domainHome = "http://"+document.domain+"/new_instyle/";
var offset = 0;

var page = 1;
var pageStep = 3;
var chapterStart = 1;
var chapterEnd = pageStep + 1;

var objGetHotels;
var objGetDestinations;
var objGetSpecialOffers;
var objGetEvents;
var objSetPages;
var objGetPlaces;
var objSetCalendar;

//for zapatech functionalities only
var startDate;
	var endDate;
	var ONEDAY = 3600 * 24;

var defDate = new Date();

	var fy = defDate.getFullYear();
	var mon = defDate.getMonth();

var objCheckIn;
var objCheckOut;

var browserHistory;
var browserCatch = false;
var browseType = "";

function playtransition(obj,ct){
	constant = 4000;
	showTime = constant;
	$('replayLink').style.display = "none";
	for(j=0; j<2; j++)
	{
		for(i=0;i<ct;i++)
		{
			showTime += (constant*1);
			vals = $('article'+(i*1+1)).value;
			url = $('article'+(i*1+1)).title;
			setTimeout("changeTXT('"+vals+"','"+obj+"','"+url+"')",showTime); 		
		}	
		setTimeout("showReplay()",(constant*(ct+1))*2); 
	}
}
function showReplay ()
{
	$('replayLink').style.display = "block";
}
function changeTXT(txt, obj, url, replay)
{ 
	$(obj).innerHTML="<a style='color:#999999' href='"+url+"'>"+txt+"</a>";
	
}


function chkin(objCheckin){

	var dates = $('checkIn').value.split('-'); 
	
	$('checkInMY').value = dates[0]+"-"+(dates[1]*1);
	var maxDays = objSetCalendar.buildDays((1*dates[0]),(1*dates[1]),'checkInDay',dates[2]);			
	var dayValue = $('checkInDay').value;	
			
	if($('checkInMY').selectedIndex == 13 && $('checkInDay').options.length == $('checkInDay').value)
	{												
		objSetCalendar.last($('checkInMY'),$('checkInDay'),$('checkOutMY'),$('checkOutDay'));						
		$('checkIn').value = $('checkInMY').value+"-"+$('checkInDay').value;
		$('checkOut').value = $('checkOutMY').value+"-"+$('checkOutDay').value;
		return 'last values';
	}
				
	if($('checkIn').value != "" && $('checkOut').value != "")
	{
		if(!objSetCalendar.checkDate($('checkInMY').value+"-"+$('checkInDay').value,$('checkOutMY').value+"-"+$('checkOutDay').value))
		{
			$('checkIn').value = $('checkInMY').value+"-"+$('checkInDay').value;
			return true;
		}
	}																			
	
	objSetCalendar.adjust((1*dayValue+1),maxDays,$('checkInMY'),$('checkInDay'),$('checkOutMY'),$('checkOutDay'));
	$('checkOut').value = $('checkOutMY').value+"-"+$('checkOutDay').value;

}

function chkoute(objCheckOut){
				
	var dates = $('checkOut').value.split("-");
	$('checkOutMY').value = dates[0]+"-"+(dates[1]*1);
								
	objSetCalendar.buildDays((1*dates[0]),(1*dates[1]),'checkOutDay',dates[2]);	
	$('checkOut').value = $('checkOutMY').value+"-"+$('checkOutDay').value;

}
//end of zapatech
function disallowDateBefore(date) {
			date = date.getTime();
			
			if ((startDate != null) && (date < (startDate + ONEDAY))) {
				//start date can't be prior to end date
				return true; 
			} 						
			
			var now = new Date().getTime();
			if ((date) < (now - (1000*ONEDAY))) {
				//start date can't be prior to today
				return true;
			}

			return false;
		}

var initEverything = Class.create();
initEverything.prototype = {	
		initialize: function(){
				
				objGetHotels = new getHotelList();
				objGetDestinations = new getDestinations();
				objGetSpecialOffers = new getSpecialOffers();
				objSetPages = new setPages();
				objGetPlaces = new getPlaces();
				objGetEvents = new getEvents();
				objSetCalendar = new setCalendar();				
				
				/*objCheckOut = Zapatec.Calendar.setup({
        		inputField     :    "checkOut",	
				firstDay          : 1,
        		electric          : false,
				range             : [fy+"."+(mon++), (fy+1)+"."+(mon++)],
        		button            : "btnHSCheckOutCal",
        		ifFormat          : "%Y-%m-%d",
        		daFormat          : "%Y-%m-%d",
       			align             : "br",
				dateStatusFunc    :  disallowDateBefore,
				onUpdate		  : chkoute
      			});
				mon--;*/
				/*"october" fix for first calendar*/
				
				/*objCheckIn = Zapatec.Calendar.setup({
        		inputField     :    "checkIn",	
				firstDay          : 1,
        		electric          : false,
				range             : [fy+"."+(mon++), (fy+1)+"."+(mon++)],
        		button            : "btnHSCheckInCal",
        		ifFormat          : "%Y-%m-%d",
        		daFormat          : "%Y-%m-%d",
       			align             : "br",
				dateStatusFunc    :  disallowDateBefore,
				onUpdate		  : chkin
      			});
				mon--;*/
				/*
				objCheckOut = Zapatec.Calendar.setup({
        		inputField     :    "checkOut",
				button 		   :    "btnHSCheckOutCal",
				firstDay          : 1,
       			electric          : false,
				range             : [fy+"."+(mon++), (fy+1)+"."+(mon++)],
        		ifFormat          : "%Y-%m-%d",
        		daFormat          : "%Y-%m-%d",
        		align             : "br",
				dateStatusFunc    :  disallowDateBefore,
				onUpdate		  : chkoute
      			});*//*
				objCheckIn = Zapatec.Calendar.setup({
        		inputField     :    "checkIn",	
				firstDay          : 1,
        		electric          : false,
				range             : [fy+"."+(mon++), (fy+1)+"."+(mon++)],
        		button            : "btnHSCheckInCal",
        		ifFormat          : "%Y-%m-%d",
        		daFormat          : "%Y-%m-%d",
       			align             : "br",
				dateStatusFunc    :  disallowDateBefore,
				onUpdate		  : chkin
      			});*/
			}
		}

var getHotelList = Class.create();
getHotelList.prototype = {
		
		initialize: function(){
				//none								
			},
			
		listHotels: function(param1,param2){									
				
					//loaderShow();
					var domain = domainHome+"boutique-hotels/searchResults.php";										
					
					if(param1 == 'destinations' || param1 == 'hotels')
					{								
						domain += "?searchParam="+param2;
						domain += "&lookIn="+param1;						
					}
					else
					{					
						domain += "?countryName="+param1;
						if(param2 != "" && param2 != 'all' && param2 != 'All')
						{
							domain += "&placeName="+param2;
							domain += "&loctype="+$('loctype').value;
						}
						
						if($("arrival").value != "" && $("departure").value != "")
						{
							domain += "&arrival="+$('arrival').value+"&departure="+$('departure').value;
							domain += "&numChil="+$('numChil').value+"&numAdults="+$('numAdults').value;
						}
						
						if($('opts[activities]').value != "" || $('opts[attributes]').value != "" || $('opts[hotel_types]').value != "" || $('opts[geographics]').value != "" || $('priceRange').value != "")
						{
							
							domain += "&opts_activities="+$('opts_activities').value;
							domain += "&opts_attributes="+$('opts_attributes').value;
							domain += "&opts_hotel_types="+$('opts_hotel_types').value;
							domain += "&opts_geographics="+$('opts_geographics').value;
							domain += "&priceRange="+$('priceRange').value;
						
						}
						
					}
					
					domain += "&offset="+offset;

								var objAjax = new Ajax.Updater('searchResults',domain, {
																   
																   				method: 'post',
																   				asynchronous: true,																				
																				evalScripts: true,
																   				onComplete: function(){
																					
																					page = page*1;																																																																																				
																					var count = $("hotelCount").value;
																					var end = offset+3;
																					var endPage = page+pageStep;
																					
																					if(end > count)
																					{end = count;}																					
																					if(endPage > Math.ceil(count/3))
																					{endPage = Math.ceil(count/3);}
																					
																					$('currentBatch').innerHTML = (offset+1)+"-"+end;																					objSetPages.paginate(page,endPage,Math.ceil(count/3));loaderHide();
																					}
															   }
																			   )						   
			},
			getVariables: function(info){														
					//this gets 2 variables from the url				
					var variables = Array();				
					info = info.split("/");					
					
										
					for(ctr=0; ctr<info.length; ctr++)
					{						
						variables[ctr] = info[ctr];						
					}
										
					return variables;
				
			},
			
			getStep: function(nStep, container,param){
				var fileNum = container.substring(4,container.length);				
				var domain = domainHome+'advanced-search/step'+fileNum+'.php';
				var objAjax = new Ajax.Updater(container,domain,{
											   						method: 'post',
																	asynchronous: true,
																	postBody: param || "",
																	evalScripts: true,
											   						onComplete: function()
																		{
																			$('step'+nStep).style.display = 'none';
																			$(container).style.display = '';
																			Behaviour.apply();
																		}
											   					}
											   )
			
			},
			
			addToVars: function(container, value, delimiter)
			{
				var val = value, cont = $(container);				
				if(cont.value != ""){cont.value+=delimiter;}
				cont.value += val;
			},
			
			removeFromVars: function(container, value, delimiter)
			{
				var cont = $(container);
				var val = cont.value;				
				
				if(val.split(delimiter).length < 2)
				{val = "";}
				else
				{
					val = val.split(delimiter);
					var temp = "";
					for(ctr=0; ctr<val.length;ctr++)
					{						
						if(val[ctr] != value)
						{
							temp += val[ctr]+",";							
						}
					}
					val = temp.substring(0,temp.length-1);
				}				
				cont.value = val;								
			}						
	}
	
var getPlaces = Class.create();
getPlaces.prototype = {		
		initialize: function(){		
			//none		
		},
		
		getCityRegion : function (cName,container,selected)
		{
	
			var objContainer = $(container);
	
			if(cName == "")
			{
				objContainer.innerHTML = "";
				return false;	
			}
	
			var addtnl = "";
	
			if(document.domain != "localhost" || document.domain != "zambales")
			{
				addtnl = document.domain+"/";	
			}
	
			path = domainHome+"lib/cityregion.php";
	
			objContainer.innerHTML = "";

			var opt = document.createElement('option');
				opt.innerHTML = "Loading...";
	
				objContainer.appendChild(opt);
	
			var param = "cName="+cName;

			var objAjax = new Ajax.Request(path, {
																   
																  method: 'post',
																  asynchronous: true,
																  postBody:param || "",
																  onComplete: function()
																  { 																  																  
																  	var content = objAjax.transport.responseText;
																  	eval(content);
															  		objContainer.innerHTML = "";
																	
																	
																		opt = document.createElement('option');
																		opt.innerHTML = "Select city";																	
																		objContainer.appendChild(opt);	
																	
																		opt = document.createElement('option');
																		opt.innerHTML = "All";																	
																		objContainer.appendChild(opt);																		
																	
																	for(ctr=0;ctr<Country.places.length;ctr++)
																	{
																	
																		opt = document.createElement('option');
																		if(Country.places[ctr].type == "Region"){opt.innerHTML = Country.places[ctr].type+": ";}																																				
																		opt.innerHTML += Country.places[ctr].place;
																		opt.value = Country.places[ctr].pId;
																		
																		if(selected == opt.value)
																		{
																			opt.selected = true;	
																		}
																		
																		objContainer.appendChild(opt);	
																		
																	}
																  	
																  	
																  }
																  
									            	}
																   
									)

}
	
	
	
	
	}

var getDestinations = Class.create();
getDestinations.prototype = {
		initialize:function(){
			//none
		},
		listDest: function(continent,offset){
			//loaderShow();
			var domain = domainHome+"boutique-hotels-destinations/mainbody-destlisting.php?offset="+offset+"&contID="+continent;
			var objAjax = new Ajax.Updater('listDestinations',domain, {
										   									method: 'post',
																   				asynchronous: true,																				
																				evalScripts: true,
																   				onComplete: function(){
																				
																					page = page*1;																																																																																				
																					var count = $("destCount").value;
																					var end = offset+6;
																					var endPage = page+pageStep;
																					
																					if(end > count)
																					{end = count;}																					
																					if(endPage > Math.ceil(count/6))
																					{endPage = Math.ceil(count/6);}
																					
																					objSetPages.paginate(page,endPage,Math.ceil(count/6));loaderHide();
																				
																					}
										   							  }
										  );
			
			
		}	
}

var getSpecialOffers = Class.create();
getSpecialOffers.prototype = {
		initialize:function(){
			//none
		},
		listOffers: function(continent,offset){	
			//loaderShow();
			var domain = domainHome+"boutique-hotels-special-offers/specialoffers-listing.php?offset="+offset+"&contID="+continent;			
			var objAjax = new Ajax.Updater('listOffers',domain, {
										   									method: 'post',
																   				asynchronous: true,																				
																				evalScripts: true,
																   				onComplete: function(){
																				
																					page = page*1;																																																																																				
																					var count = $("offersCount").value;
																					var end = offset+3;
																					var endPage = page+pageStep;
																					
																					if(end > count)
																					{end = count;}																					
																					if(endPage > Math.ceil(count/3))
																					{endPage = Math.ceil(count/3);}
																					
																					objSetPages.paginate(page,endPage,Math.ceil(count/3)); loaderHide();
																				
																					}
										   							  }
										  );
			
			
		}	
}
//integration nov 23
var getEvents = Class.create();
getEvents.prototype = {
		initialize:function(){
			//none
		},
		listEvents: function(param,offset){
			//loaderShow();
			var info = this.getVariables(param);	
			var domain = domainHome+"events/eventResults.php?offset="+offset;
			
			if($('eventDate').value == "")
			{
				domain += "&country="+info[0]+"&destination="+info[1]+"&eventType="+info[2];			
			
				if($('loctype').value != "")
				{domain += "&loctype="+$('loctype').value;}
			
				if($('eventBegin').value != "" && $('eventEnd').value != "")
				{
					domain+="&eventBegin="+$('eventBegin').value+"&eventEnd="+$('eventEnd').value;	
				}
			
				if($('eventKey').value != "")
				{
					domain+="&eventKey="+$('eventKey').value;	
				}
			}
			else
			{
				domain += "&eDate="+$('eventDate').value;	
			}
			
			var objAjax = new Ajax.Updater('eventResults',domain, {
										   									method: 'post',
																   				asynchronous: true,																				
																				evalScripts: true,
																   				onComplete: function(){
																					
																					page = page*1;																																																																																				
																					var count = $("eventCount").value;
																					var end = offset+3;
																					var endPage = page+pageStep;
																					
																					if(end > count)
																					{end = count;}																					
																					if(endPage > Math.ceil(count/3))
																					{endPage = Math.ceil(count/3);}																	
																					objSetPages.paginate(page,endPage,Math.ceil(count/3)); loaderHide();
																				
																					}
										   							  }
										  );
			
			
		},
		getVariables: function(info){														
					//this gets 2 variables from the url				
					var variables = Array();				
					info = info.split("/");					
					
										
					for(ctr=0; ctr<info.length; ctr++)
					{						
						variables[ctr] = info[ctr];						
					}
										
					return variables;
				
		}
}

var setPages = Class.create();
setPages.prototype = {
		
		initialize: function(){
			//none
		},
		paginate: function(start,end,total){
			
			if(start > chapterEnd)
			{				
				chapterEnd += pageStep+1;
					if(chapterEnd >= total)
					{chapterEnd = total;}
				
				chapterStart += pageStep+1;
				
				start = chapterStart;
				end = chapterEnd;								
			}
			else if(start < chapterStart)
			{
				chapterStart -= pageStep+1;
					if(chapterStart <= 0)
					{chapterStart = 1;}
				
				chapterEnd = chapterStart + pageStep;
					if(chapterEnd >= total)
					{chapterEnd = total;}
				
				start = chapterStart;
				end = chapterEnd;
				
			}
			else
			{
				
				start = chapterStart;
				end = chapterEnd;
				
				if(end >= total)
				{end = total;}
				
			}
									
			var cont = "";					
		
			if(start > 1)
			{cont += " <span title='move first' class='hMoveFirst clickable'>...</span>&nbsp;&nbsp;|&nbsp;&nbsp;";}		
									
			for(ctr=start; ctr<=end; ctr++)
			{												
				cont += "<span title='page "+ctr+"' ";
				
				if(ctr == page)
				{
					cont += "style='color: #863638; font-weight:bold;' ";
				}
				
				cont += "class='hPage clickable'>"+ctr+"</span>";				
				if(ctr < end)
				{cont += "&nbsp;&nbsp;|&nbsp;&nbsp;";}
			}
		
			if(end < total)
			{cont += "&nbsp;&nbsp;|&nbsp;&nbsp;<span title='move last' class='hMoveLast clickable'>...</span> ";}		
		
			$("topPage").innerHTML = cont;
			$("bottomPage").innerHTML = cont;
			Behaviour.apply();			
		}
	}
	
var setCalendar = Class.create();
setCalendar.prototype = {
	
		initialize: function()
		{
			//none
		},
		
		buildDays: function ( year, month, container, defDay)
		{
			
			var obj = $(container);
			obj.innerHTML = "";
				
			var days3=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'];
			// Month index starts on 0(-11) in Date()-object
			var monthDate = new Date(year, month-1);			
			
			var orgMonth = monthDate.getMonth();
			var weekDay;
			var ctr = 1;
			var opt = "";			
			
			while(monthDate.getMonth() == orgMonth) 
			{
				// Week starts on Sunday in Date()-object
				opt = document.createElement('option');
				
				weekDay = (monthDate.getDay() == 0) ? 6 : (monthDate.getDay()-1);				
								
				opt.innerHTML = days3[weekDay]+", "+ctr;				
				
				opt.value = ctr;
				
				if(ctr == defDay)
				{					
					opt.selected = true;	
				}
				else if(month == 2 && defDay >= 28) // February trap
				{
					opt.selected = true;
				}
				
				obj.appendChild(opt);				
				
				ctr++;
				monthDate.setDate(monthDate.getDate()+1);
			}
				obj.selectedIndex = defDay-1;
				return ctr-1;
		},
		
		setMY : function(objName, valNew){		
			obj = $(objName);			
			obj.value = valNew; 		
		},
		
		checkDate : function(val1,val2)
		{
			val1 = val1.split("-");
			val2 = val2.split("-");
			if((val1[0]*1) > (val2[0]*1))
			{
				return true;				
			}
			else if((val1[0]*1) < (val2[0]*1))
			{
				return false;
			}
			else
			{
			
				if((val1[1]*1) > (val2[1]*1))
				{
					return true;						
				}
				else if((val1[1]*1) < (val2[1]*1))
				{ 
					return false;
					
				}
				else
				{		
					if((val1[2]*1) >= (val2[2]*1))
					{				
						return true;					
					}
					else
					{
						return false;	
					}
				}
			}
			
		},
		
		last: function(obj1,obj2,obj3,obj4)
		{
			var YM  = obj1.value.split('-');
			var now = new Date();			
			obj3.value = obj1.value;			
			objSetCalendar.buildDays((1*YM[0]),(1*YM[1]),obj4.id,now.getDate());
			obj4.value = obj2.value;	
		},
		
		clear: function(obj1,obj2,obj3,obj4)
		{			
			obj1.value = obj3.value = "";			
			obj2.innerHTML = "";
			obj4.innerHTML = "";						
			var opt = document.createElement('option');
			opt.value = "";
			obj3.appendChild(opt);
			obj4.appendChild(opt);			
		},
		
		adjust: function(day,maxDay,obj1,obj2,obj3,obj4)
		{			
			if(day > maxDay)
					{
						objSetCalendar.setMY(obj3.id,obj1.options[obj1.selectedIndex+1].value);
						YM = obj1.options[obj1.selectedIndex+1].value.split('-');
						objSetCalendar.buildDays((1*YM[0]),(1*YM[1]),obj4.id);
						obj4.value = 1;
					}
					else
					{
						objSetCalendar.setMY(obj3.id,obj1.value);
						YM = obj1.value.split('-');
						objSetCalendar.buildDays((1*YM[0]),(1*YM[1]),obj4.id,(obj2.value*1)+1);
					}			
		}
	
	}
	

function wsa_include_js(){
		/*var js = document.createElement('script');
		js.setAttribute('language','javascript');
		js.setAttribute('type','text/javascript');
		js.setAttribute('src','http://www.websitealive6.com/432/Visitor/vTracker_v2.asp?groupid=432&departmentid=');
		document.getElementsByTagName('head').item(0).appendChild(js);*/
	}

	
function initScripts()
{	
	myScr = new initEverything();	
	wsa_include_js();
	/*
	if(browserCatch == true)
	{		
		var defLoc = window.location.hash;			
		var defPage = defLoc.replace("#pg","");
		var new_page_value = "1";	
		
		if (defPage != "")
		{			
			new_page_value = defPage;						
			
			page = (new_page_value*1); 
			
			if(browseType == 'Destination')
			{
				var param = ($('sVars').value*1);
				
				offset = ((new_page_value-1) * 6);
				
				objGetDestinations.listDest(param,offset);							
			}
			else if(browseType == 'Hotels')
			{
				var info = objGetHotels.getVariables($('sVars').value);
				
				offset = ((new_page_value-1) * 3);
				
				objGetHotels.listHotels(info[0],info[1]);
			}
			else if(browseType == 'SpecialOffers')
			{
				var param = ($('sVars').value*1);
		
				offset = ((new_page_value-1) * 3);
				
				objGetSpecialOffers.listOffers(param,offset);
			}
			else if(browseType == 'Events')
			{
				var param = $('sVars').value;	
				offset = ((new_page_value-1) * 3);
				
				objGetEvents.listEvents(param,offset);	
			}
		}
		
		browserHistory = new historyStack("browserHistory", ""); 	

		browserHistory.onBrowserAddressChanged = function()
		{								
			var curH = window.location.hash;
			
			var curPage = curH.replace("#pg","");	  
			
			var page_value = "1";
		  
			if (curPage != "")
			{
			  page_value = curPage;
			}
		  
			var newPage = (page_value*1);												
							 
			page = newPage;
			
			var page_start = newPage;						
			
			if(page_start < 4)
			{
				chapterStart = 1;
				chapterEnd = 4;
			}
									
			if(firstload==false)
			{
				if(browseType == 'Destination')
				{
					var param = ($('sVars').value*1);
					
					offset = ((page_value-1) * 6);
					
					objGetDestinations.listDest(param,offset);							
				}
				else if(browseType == 'Hotels')
				{
					var info = objGetHotels.getVariables($('sVars').value);
					
					offset = ((page_value-1) * 3);
					
					objGetHotels.listHotels(info[0],info[1]);
				}
				else if(browseType == 'SpecialOffers')
				{
					var param = ($('sVars').value*1);
		
					offset = ((page_value-1) * 3);
					
					objGetSpecialOffers.listOffers(param,offset);
				}
				else if(browseType == 'Events')
				{
					var param = $('sVars').value;	
					offset = ((page_value-1) * 3);
					
					objGetEvents.listEvents(param,offset);	
				}
			}
			
			firstload=false;
		};
								
		browserHistory.put("pg" + new_page_value);	
	}*/
}	
Event.observe(window,'load',initScripts,false);

//:: ajax load (nov. 2, 2006)



function searchItem(url)
{ 
	//loaderShow();
	var myAjax = new Ajax.Request(
		url, 
			{
				method: 'post', 
				postBody: '', 
				evalScripts: true,
				onComplete: showResponse
				
			}
			
			);
			
		var myGlobalHandlers = {
		onCreate: function(){
			Element.show('loadingDiv');
		},

		onComplete: function() {
			if(Ajax.activeRequestCount == 0){
				Element.hide('loadingDiv');
			}
		}
	};

	Ajax.Responders.register(myGlobalHandlers);
}

function showResponse(originalRequest)
{ 
	loaderHide();
	$('mainDivBody').innerHTML = originalRequest.responseText;
	Behaviour.apply();
	
}

//integration nov. 23
function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}
//end integration nov. 23

function mimic(clone, parent)
{
	
	var pos = findPos(parent);
	clone.style.left = pos[0]+"px";
	clone.style.top = pos[1]+"px";
	
	clone.style.width = parent.scrollWidth+"px";
	clone.style.height = parent.scrollHeight+"px";
	
}

function scrollSlide(scAmt,objId)
{
	var obj = $(objId);
	if(scAmt == 0)
	{
		return true;	
	}
	else
	{
		if(scAmt < 0)
		{scAmt++;}
		else
		{scAmt--;}
		obj.scrollTop += scAmt;
		setTimeout("scrollSlide("+scAmt+",'"+objId+"')",10);
	}	
}


	function showSlideshow()
	{
		//flash
			if($('slideCount').value != 0 && $('slideCount'))
			{
					var so = new SWFObject("flash/montage_interactive.swf", "montageInteractive", "352", "319", "8", "#FFF");
					
					// PASS IMAGE PATHS HERE
					// - XML parsing done outside of SWF to ensure independence from data format
					// - ensure that parameter 1 "imagepathX" is contiguously suffixed starting with 1
					// - parameter 2 may contain relative or absolute URLs
					
					var slideCounter = $('slideCount').value;
					
					for(i=0; i<slideCounter-1; i++)
					{					
						ctr = i+1;

						so.addVariable("imagepath"+ctr,$('slide'+i+'').value);
					}				
					
					so.addVariable("textdisplay",$('copyrightHotel').value);
					so.write("flashReplaceMontageInteractive");
			}
		//end flash
	}
	
	function expandCollapse(elementId)
	{ 	if($('hD').innerHTML)
		{
			pt = 'h-details-side/';
		}
		else
		{
			pt = '';
		}
		/*$('liListHome1').setAttribute("src",domainHome+"/images/"+pt+"grey1.png");
		$('liListHome2').setAttribute("src",domainHome+"/images/"+pt+"grey2.png");
		$('liListHome3').setAttribute("src",domainHome+"/images/grey3.png");
		$('liListHome4').setAttribute("src",domainHome+"/images/grey4.png");*/
		$('liListHome1').style.background = "url(images/"+pt+"grey1.png)" 
		$('liListHome2').style.background = "url(images/"+pt+"grey2.png)" 
		$('liListHome3').style.background = "url(images/grey3.png)" 
		$('liListHome4').style.background = "url(images/grey4.png)" 

		if(elementId == "liListHome1")
		{
			if($('divListHome1').style.display == "block")
			{
//				$(elementId).setAttribute("src",domainHome+"/images/"+pt+"grey1.png");
				$(elementId).style.background = "url(images/"+pt+"grey1.png) top left no-repeat";
				$('divListHome1').style.display = "none";
			}
			else
			{
				//$(elementId).setAttribute("src",domainHome+"/images/"+pt+"hand_picked_boutique_hotels.png");				
				$(elementId).style.background = "url(images/"+pt+"hand_picked_boutique_hotels.png) top left no-repeat";
				$('divListHome1').style.display = "block";
				$('divListHome2').style.display = "none";
				$('divListHome3').style.display = "none";
				$('divListHome4').style.display = "none";
			}
		}
		if(elementId == "liListHome2")
		{
			if($('divListHome2').style.display == "block")
			{
				//$(elementId).setAttribute("src",domainHome+"/images/"+pt+"grey2.png");
				$(elementId).style.background = "url(images/"+pt+"grey2.png) top left no-repeat";
				$('divListHome2').style.display = "none";
			}
			else
			{
				//$(elementId).setAttribute("src",domainHome+"/images/"+pt+"best_room_rates_guaranteed.png");
				$(elementId).style.background = "url(images/"+pt+"best_room_rates_guaranteed.png) top left no-repeat";
				$('divListHome1').style.display = "none";
				$('divListHome2').style.display = "block";
				$('divListHome3').style.display = "none";
				$('divListHome4').style.display = "none";
			}
		}
		if(elementId == "liListHome3")
		{
			if($('divListHome3').style.display == "block")
			{
				//$(elementId).setAttribute("src",domainHome+"/images/grey3.png");
				$(elementId).style.background = "url(images/grey3.png) top left no-repeat";
				$('divListHome3').style.display = "none";
			}
			else
			{
				//$(elementId).setAttribute("src",domainHome+"/images/no_booking_fees.png");
				$(elementId).style.background = "url(images/no_booking_fees.png) top left no-repeat";
				$('divListHome1').style.display = "none";
				$('divListHome2').style.display = "none";
				$('divListHome3').style.display = "block";
				$('divListHome4').style.display = "none";
			}
		}
		if(elementId == "liListHome4")
		{
			if($('divListHome4').style.display == "block")
			{
				//$(elementId).setAttribute("src",domainHome+"/images/grey4.png");
				$(elementId).style.background = "url(images/grey4.png) top left no-repeat";
				$('divListHome4').style.display = "none";
			}
			else
			{
				//$(elementId).setAttribute("src",domainHome+"/images/unbaised_advice.png");
				$(elementId).style.background = "url(images/unbaised_advice.png) top left no-repeat";
				$('divListHome1').style.display = "none";
				$('divListHome2').style.display = "none";
				$('divListHome3').style.display = "none";
				$('divListHome4').style.display = "block";
			}
		}
	}
	
