/* 
Set of Functions to power the frontpage dynamic map and the availabilty of map features
*/

var nameEnabledClass='nameEnabled';
var nameDisabledClass='nameDisabled';
var priceEnabledColour='#3336A0';
var priceDisabledColour='#aaa';
var opacity=0;
var opacityRate=50;
var timer;
var popupMaximised=false;

function ajax(url, vars, callbackFunction)
{
	var request = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("MSXML2.XMLHTTP.3.0");
	
	request.open("GET", url, true);
	request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 
	
	request.onreadystatechange = function()
	{
		try
		{
			if (request.readyState == 4 && request.status == 200) 
			{
				if (request.responseText)
				{
						callbackFunction(request.responseText);
				}
			}
		}
		catch (e)
		{
		// this stops problem with trying to get the status or ready state before the XMLHttpRequest 
		// is ready
		}
	
	}
	request.send(vars);
}


function initHotels()
{
	offsets=getDivPosition('mapDiv');
	mapOffsetX=offsets.x;
	mapOffsetY=offsets.y;

	widths=new Array();

	//hack needed to solve weird ie behavior
	for (i in hotelPositions)
	{
		div=document.getElementById(i);
		widths[i]=div.offsetWidth;
		
	}
	
	for (i in hotelPositions)
	{
		div=document.getElementById(i);
		price=document.getElementById(i+'Price');
		
		if ((hotelPositions[i][0]==-1) || (hotelPositions[i][1]==-1 ))
		{
			// if hotel position not set then hide it on map
			div.style.display='none';
			if (price)	price.style.display='none';
			
		}
		else
		{
			div.style.display='block';
			div.style.left=(mapOffsetX+hotelPositions[i][0])+'px';
			div.style.top=(mapOffsetY+hotelPositions[i][1])+'px';
		
			//if it has a price move it beside the hotel name
			if (price)
			{
				price.style.display='block';
				if (div.className=='hotelNameRight' || div.className=='hotelNameNoneRight')
				{
					price.style.left=(mapOffsetX+hotelPositions[i][0]-price.offsetWidth)+'px';
					price.style.top=div.style.top;

				}
				else
				{
					//divWidth=(div.offsetWidth || div.css.pixelWidth || div.css.width || 0);
					divWidth=widths[i];
					price.style.left=(divWidth+mapOffsetX+hotelPositions[i][0])+'px';
					if (div.className=='hotelNameTop')
					{
						priceTop=parseInt(div.style.top);
						priceTop+=fontSize+5;
						price.style.top=priceTop+'px';
					}
					else
					{				
						price.style.top=div.style.top;
					}
					//div.style.width=(divWidth-fontSize)+'px';
				}

			}
			
			// if hotel available change link colour.
			if (hotelPositions[i][4]) 
			{
				hLink=document.getElementById('link'+i);
				hLink.className=nameEnabledClass;
				
			}
			else
			{
				hLink=document.getElementById('link'+i);
				hLink.className=nameDisabledClass;
				if (div.className!='hotelNameNoneLeft' && div.className!='hotelNameNoneRight')
				div.style.backgroundImage='url('+imageHost+'greyDot'+fontSize+'.gif)';
			}
			
		}
	
	}

}



function toggleSize(divId)
{

	div=document.getElementById('hotelInfo');
	maximiseLink=document.getElementById('maxLink');
	contentDiv=document.getElementById('hotelInfoContent');
	ticDiv=document.getElementById('hotelInfoTic');
	topMid=document.getElementById('hotelInfoTM');
	bottomMid=document.getElementById('hotelInfoBM');	

	if ( !popupMaximised )
	{
		
		//save the windows current position	
		oldTop=div.style.top;
		oldLeft=div.style.left;
		oldWidth=contentDiv.style.width;
		oldHeight=contentDiv.style.height;
		oldMidWidth=topMid.style.width;
		
		topMid.style.width='610px';
		bottomMid.style.width='610px';
				
		div.style.width='646px';
		div.style.height='460px';
		div.style.left=mapOffsetX+'px';
		div.style.top=mapOffsetY+'px';
		
		contentDiv.style.height='420px';//(400+ticHeight)+'px';
		contentDiv.style.width='632px';	
		ticDiv.style.display='none';
		
		maximiseLink=document.getElementById('maxLink');
		// update the info window content
		getHotelContent(divId,true);
		popupMaximised = true;
		return false;
		
	}
	else
	{
		//restore window to correct small position
		div.style.top=oldTop;
		div.style.left=oldLeft;
		div.style.width=(parseInt(oldWidth)+12)+'px';
		div.style.height=oldHeight;
		
		topMid.style.width=oldMidWidth;
		bottomMid.style.width=oldMidWidth;
		
		
		contentDiv.style.width=oldWidth;
		contentDiv.style.height=oldHeight;	
		ticDiv.style.display='none';

		// update the info window content
		if (divId) getHotelContent(divId,false);
		popupMaximised = false;
		return false;
	}


	
	
	
	
}

function Position()
{
	this.x=0;
	this.y=0;
}


function getDivPosition(divId)

{
	var pos=new Position();
	var d=document.getElementById(divId);
	
	var offsetX=0;
	var offsetY=0;
	
	while (d!=null)
	{
		offsetX+=d.offsetLeft;
		offsetY+=d.offsetTop;
		d=d.offsetParent;
	}
	
	pos.x=offsetX
	pos.y=offsetY
	
	return pos;

}


function displayHotelLocation(e,divId)
{
	// code for dealing with positioning and display of hotelInfo div
	div=document.getElementById('hotelInfo');
	tic=document.getElementById('hotelInfoTic');
	setOpacity(div,0);
	setOpacity(tic,0);
	position=getDivPosition(divId);
	hotelName=hotelPositions[divId][3];

	html='<div class="topBand">';
	html+=hotelName;
	html+='</div>';
	html+='<br> <div style="text-align:center"> Searching for availabilty for hotel</div>';
	hotelCode=divId.toLowerCase();
	imgUrl='http://www.justonehotel.com/images/map/'+cityCode+'/'+hotelCode+'.jpg';
	var img=new Image();
	img.src=imgUrl;

	imgHeight=90;
	imgWidth=90;


	contentDiv=document.getElementById('hotelInfoContent');
	
	// code to deal with size of box;
	contentPadding=contentDiv.style.padding||0;
	contentWidth=334;
	bottomMid=document.getElementById('hotelInfoBM');	
	topMid=document.getElementById('hotelInfoTM');
	topMid.style.width='312px';
	bottomMid.style.width='312px';
	
	contentHeight=80+imgHeight;
	div.style.width=(contentWidth+12)+'px';
	
	contentDiv.style.height=contentHeight+'px';
	contentDiv.style.width=contentWidth+'px';
	divTop=position.y;
	divLeft=position.x;	
	
	contentDiv.innerHTML=html;

	div.style.display='block';
	divTop=position.y;
	divLeft=position.x;	

	// work out if we should display above or below
	if (position.y<contentHeight+ticHeight+90)
	{
		positionBox(divLeft,divTop,false);
	}
	else
	{
		positionBox(divLeft,divTop,true);
	}


	div.style.display='block';
	opacity=0;
	window.clearInterval(timer);
	timer=window.setInterval('updateOpacity()',opacityRate)
	return false;	
}

function displayHotelInfo(e,divId)
{
	popupMaximised = false;
	
	// code for dealing with positioning and display of hotelInfo div
    window.clearInterval(timer);
	div=document.getElementById('hotelInfo');
	tic=document.getElementById('hotelInfoTic');
	setOpacity(div,0);
	setOpacity(tic,0);
//	div.style.display='block';	


	position=getDivPosition(divId);
	available=hotelPositions[divId][4];
	hotelFname=hotelPositions[divId][6];

	hotelCode=divId.toLowerCase();
	imgUrl='http://www.justonehotel.com/images/map/'+cityCode+'/'+hotelCode+'.jpg';
	var img=new Image();
	img.src=imgUrl;


		imgHeight=90;
		imgWidth=90;


	contentDiv=document.getElementById('hotelInfoContent');
	
	// code to deal with size of box;
	contentPadding=contentDiv.style.padding||0;
	contentWidth=334;
	contentHeight=80+imgHeight;
	div.style.width=(contentWidth+12)+'px';
	
	contentDiv.style.height=contentHeight+'px';
	contentDiv.style.width=contentWidth+'px';
	divTop=position.y;
	divLeft=position.x;	

	getHotelContent(divId);
	return false;
			
}

function hideHotelInfo(divId)
{
	ticDiv=document.getElementById('hotelInfoTic');
	ticDiv.style.display='none';
	div=document.getElementById('hotelInfo');
	div.style.display='none';
	ifr=document.getElementById('popupMask');
	ifr.style.display='none';

	//if closing maximised window reset sizes	
	maximiseLink=document.getElementById('maxLink');
 	if (maximiseLink.innerHTML==' - ')
	{
	toggleSize();
	}
	return false;
	
	
	
}





function positionBox(x,y,above)
{	var appVer = navigator.appVersion.toLowerCase();
	var iePos = appVer.indexOf('msie');
	
	div=document.getElementById('hotelInfo');
	cDiv=document.getElementById('hotelInfoContent');
	ticDiv=document.getElementById('hotelInfoTic');
	actualHeight=cDiv.offsetHeight;
	bottomBorder=11;
	
	

	//contentHeight-ticHeight-nameOffset
	if (above)
	{
		ticDiv.style.backgroundImage='url('+imageHost+'tic.gif)';
		ticDiv.style.top=(y-ticHeight-1)+'px';
		ticDiv.style.left=(x)+'px';
		ticDiv.style.display='block';
		left=Math.round((x-(cDiv.offsetWidth/2.5)));
		//div.style.left=(x-(cDiv.offsetWidth/2.5))+'px';
		tp=(y-ticHeight-actualHeight-bottomBorder-9)+'px';
		//div.style.top=(y-ticHeight-actualHeight-bottomBorder)+'px';
		
	}
	else
	{
		left=Math.round(x-(cDiv.offsetWidth/2.5));
		tp=(y+ticHeight+nameOffset)+'px';
		ticDiv.style.backgroundImage='url('+imageHost+'ticDown.gif)';
		//2px nudge for margin
		ticDiv.style.top=(y+nameOffset+2)+'px';
		ticDiv.style.left=(x)+'px';
		ticDiv.style.display='block';
	}
	
	//mask the select controls if necessary
	if (iePos !=-1) 
	{
		var is_minor = parseFloat(appVer.substring(iePos+5,appVer.indexOf(';',iePos)));
		var is_major = parseInt(is_minor);
	}
	if ((navigator.appName.substring(0,9) == "Microsoft") &&  (is_major <= 6) )
	{
		ifr=document.getElementById('popupMask');	
		ifr.style.top=tp;
		ifr.style.left=parseInt(left)-10;
		ifr.style.width=div.offsetWidth;
		ifr.style.height=cDiv.offsetHeight+30;
		ifr.style.filter='alpha(opacity=0)';
		setOpacity(ifr,0);
		ifr.style.display='block';
	}
	
	
	
	//position the div
	div.style.left=left+'px';
	div.style.top=tp;


}



function getHotelContent(hotelId,maximised)
{

	html='';
	controls='<div id="hotelInfoControls" style="float:right">';
	controls+='<a id="maxLink" href="#" onclick="return toggleSize(\''+hotelId+'\')">';
	controls+= (maximised) 
		? '<img src="' + imageHost + '../mapResults/control_minus.gif" alt="-">'
		: '<img src="' + imageHost + '../mapResults/control_plus.gif" alt="+">';
	controls+="<\/a>";
	controls+=' <a href="#" class="closeLink" onclick="return hideHotelInfo(\''+hotelId+'\')">' +
		'<img src="' + imageHost + '../mapResults/control_cross.gif" alt="x">' +
		"<\/a><\/div>";
	html+='<div class="topBand">';
	html+=controls;
	
	if (maximised)
	{
		// site url currently undefined.
		iFWidth=parseInt(contentDiv.style.width)-10;
		iFHeight=(parseInt(contentDiv.style.height)-40)+'px';
		html+='<iframe id="hotelInfoIframe" src="http://'+siteUrl+'/hotel_popup.php?hotel_id='+hotelId+ 
		'&searchId='+searchId+'&website=' 
		+siteUrl+'" height="'+iFHeight+'" width="'+iFWidth+'" frameborder=0>'+"<\/iframe>";
		html+='<div style="text-align:center;font-size:10px;z-index:1001;"><a href="#" onclick="return hideHotelInfo()">[close window]</a></div>';
		contentDiv.innerHTML=html;
		return false;
	}
	else
	{
		/* stops problem when user clicks on a new hotel without closing the window */
		bottomMid=document.getElementById('hotelInfoBM');	
		topMid=document.getElementById('hotelInfoTM');
		topMid.style.width='312px';
		bottomMid.style.width='312px';
		
	}
	
	stars=hotelPositions[hotelId][2];
	hotelName=hotelPositions[hotelId][3];
	html+='<strong>'+hotelName+' '+stars+"<\/strong>";
	html+='</div>';
	/*
	for (x=0;x<stars;x++)
	{
		html+='<img  src="/interface/mapResults/star.gif" height="15px" class="star" alt="star">';
	}
	*/
	html+='<br>';
	html+='<div id="roomDescription">';

	html+='<div class="hotelPicDiv" ><img src="'+imgUrl+'" alt="hotel picture" class="hotelPic"></div>';
	
	if (!available)	html+='<br><span style="font-size:1.4em">Sorry unavailable on these dates</span>';
	
	
	html+="<\/div>"
	html+='<div class="roomOptions"  id="roomOptions">'+"<\/div>";
	
	contentDiv.innerHTML=html;
	url='http://'+websiteHostName+'/getAvailDetails.php';
	vars=null;
	
	url+='?hotelId='+hotelId;
	url+='&searchId='+searchId;
	url+='&clientId='+clientId;

	// if hotel is available details via ajax
	if (available)
	{
		ajax(url, vars, ajaxCallBack);
	}
	else
	{
		// if not available show content now
		div.style.display='block';
		divTop=position.y;
		divLeft=position.x;	

	
		// work out if we should display above or below
		if (position.y<contentHeight+ticHeight+90)
		{
			positionBox(divLeft,divTop,false);
		}
		else
		{
			positionBox(divLeft,divTop,true);
		}

		
		
		opacity=0;
		window.clearInterval(timer);
		timer=window.setInterval('updateOpacity()',opacityRate)
	}
	html+='<\/div>';

	return false;
}

function toggleSelection(index)
{
	
	tbl=document.getElementById('mealOptions');
	cells=tbl.getElementsByTagName("td");
	for (i=0;i<cells.length;i++)
	{
		cells[i].className='';
	}
	td=document.getElementById('option'+index);
	td.className='selectedOption';
}

function ajaxCallBack(result)
{
	tic=document.getElementById('hotelInfoTic');
	div=document.getElementById('hotelInfo');
	setOpacity(div,0);


	maxChars=300;
	var html='';
	var resultObject=eval("("+result+")");
	roomDesc=document.getElementById('roomDescription');
	//solves prob with empty hotel description
	hotelDescription=(resultObject.hotelDescription)?resultObject.hotelDescription:'';

	shortDesc=hotelDescription.substring(0,maxChars);
	shortDesc+='.... [<a href="#" onclick="return toggleSize(\''+resultObject.hotelId+'\')">more</a>]';
	
	roomDesc.innerHTML = '<div class="hotelPicDiv" ><img src="'+imgUrl+'" alt="hotel picture" class="hotelPic"></div>'
		+ shortDesc;
	
	//should we show extended content 
	div=document.getElementById('hotelInfo');
	rmOptions=document.getElementById('roomOptions');
	maximiseLink=document.getElementById('maxLink');
	if (popupMaximised)
	{
		html+='<span style="text-align:left">'+hotelDescription+"<\/span><br>";
	}

	html += '<em class="priceInfoSummary">Prices are the total for all guests over all nights</em>';
	html += ' <img style="cursor:help" onMouseOver="openPopTip(this,\'<strong>Price Details</strong><br>Prices are total prices - they are the <span style=\\\'text-decoration:underline\\\'>total price for all guests</span> for the complete stay. Prices include all local taxes.<br>(These rates are <span style=\\\'text-decoration:underline\\\'>not</span> per person)\',200)"  ' + 
		'src="http://www.justonehotel.com/templates/j1h-default/images/search/information_orange_tiny.gif">';	
	html += '<br>';
	html+='<div class="bottomBand" >';
	html+='<form name="bookit" action="https://secure.justonehotel.com/booking/booking.php?mode=startBook" method="post">';
	html+='<input type="hidden" name="website_client_id" value="'+clientId+'">';
	html+='<input type="hidden" name="booking_currency" value="'+currency+'">';
	html+='<input type="hidden" name="searchId" value="'+searchId+'">';
	html+='<input type="hidden" name="j1h_visit_id" value="'+J1hVisitId+'">';
	html+='<input type="hidden" name="result_pref" value="map">';
	
	html+='<ol class="mapAvailOptions">';
	for (i in resultObject.rOptions)
	{
		rOption=resultObject.rOptions[i];
		optionClass = ( i%2 == 0 ) ? '' : 'alt';
		checked=(i==0)?'checked="checked"':'';
		html += '<li class="' + optionClass + '">';
		html += '<p class="optionSelect">';
		html += '<strong class="optionmealPlan">' + rOption.boardType + '</strong> ';
		html += '<strong class="optionPrice">' + rOption.currencySymbol+rOption.price + '</strong> ';
		html += '<input type="radio" name="group_id" value="'+rOption.groupId+'" '+checked+'>';
		html += '</p>';
		html += '<p class="' + ( rOption.offerName==null ? 'o' : 'offerO' ) + 'ptionDescription">';
		if ( rOption.offerName != null )
		{
			html += '<strong class="offerName">' + rOption.offerName + '</strong>';
			if ( rOption.offerDescription != null && rOption.offerDescription != '' )
			{
				html += ' <img style="cursor:help" onMouseOver="openPopTip(this,\'<strong>' + 
					rOption.offerName + '</strong><br>' + rOption.offerDescription + 
					'\',200)" onMouseOut="closePopTip()" ' + 
					'src="http://www.justonehotel.com/templates/j1h-default/images/search/information_tiny.gif">';	
			}
			html += '<br>';
		}
		for (j in rOption.rooms)
		{	
			rooms = rOption.rooms[j];
			html += ( j==0 ) ? '' : ', ';			
			html += rooms.numRooms + "&nbsp;x&nbsp;" + rooms.roomType;
		}
		html += '</p>';
		html += '</li>';
	}
	html+='</ol>';

	html += '<div style="text-align:center;padding-top:8px;">';

	//if private price don't show bookit button
	if (resultObject.showPrices)
	{
	html+='<div style="height:31px"><input type="submit" class="bookit" name="groupbooking" value="Book It" onclick="document.bookit.submit()" ></div>';
	}
	else
	{
		//html+='<div style="height:31px;font-size:16px">Call for rates</div>';
		html+='<div style="height:40px;font-size:16px"><span style="font-weight:bold">Call for rates</span><br> \
		<span style="font-size:14px"><strong>UK</strong> 0845 644 2283   <strong>Intl</strong> +44 141 270 2171</span></div>';			
	}
	html+="<\/div>";
	html+="<\/form>";
	html+='</div>';
	rmOptions.innerHTML=html;
	//alert(rmOptions.innerHTML.length);

	div.style.display='block';
	//ajust the height of pop up to suit more rooms
	cDiv=document.getElementById('hotelInfoContent'); 
	cDiv.style.height='auto';
	if (cDiv.offsetHeight<150) cDiv.style.height='150px';


	//reposition box
	position=getDivPosition(resultObject.hotelId);
	contentHeight=cDiv.offsetHeight;
	// work out if we should display above or below
	if (position.y<contentHeight+ticHeight+90)
	{
		positionBox(divLeft,divTop,false);
	}
	else
	{
		positionBox(divLeft,divTop,true);
	}
	// start the fade up
	opacity=0;
	timer=window.setInterval('updateOpacity()',opacityRate)

	

	
	
}


function updateHotels()
{

showHotelByStar=Array();
showHotelByStar[0]=false;
showHotelByStar[1]=document.getElementById('oneStar').value;
showHotelByStar[2]=document.getElementById('twoStar').value;
showHotelByStar[3]=document.getElementById('threeStar').value;
showHotelByStar[4]=document.getElementById('fourStar').value;
showHotelByStar[5]=document.getElementById('fiveStar').value;
priceLimit=parseInt(document.getElementById('priceFilterValue').value);
for (i in hotelPositions)
{
	div=document.getElementById(i);
	nameLink=document.getElementById('link'+i);
	price=document.getElementById(i+'Price');
	if (price)
	{
		hotelPrice=(parseInt(price.innerHTML.substring(1)));
		belowLimit=(price.innerHTML==currencySymbol+hiddenPriceText) || hotelPrice<priceLimit ;
		if ((!(showHotelByStar[parseInt(hotelPositions[i][2])]) || !(belowLimit) ) )
		{
			//price colour comparison limits number of changes made in IE which speeds up the redraw
			if (price.style.color!=priceDisabledColour)
			{
				price.style.color=priceDisabledColour;
				nameLink.className=nameDisabledClass;
				//check not one of the dotless classes
				if (div.className!='hotelNameNoneLeft' && div.className!='hotelNameNoneRight') 
				{
				div.style.backgroundImage='url('+imageHost+'greyDot'+fontSize+'.gif)'
				}
			}
		}
		else if (price.style.color!=priceEnabledColour)
		{
			price.style.color=priceEnabledColour;
			nameLink.className=nameEnabledClass;
			//check not one of the dotless classes
			if (div.className!='hotelNameNoneLeft' && div.className!='hotelNameNoneRight')
			{
				div.style.backgroundImage='url('+imageHost+'dot'+fontSize+'.gif)'
			}
		}
		else
		{
			
			//alert(i+'hmm something wrong:'+price.style.color);
		}
	}

}
return false;
}

function resetHotels()
{
	pDiv=document.getElementById('priceFilter');
	pInp=document.getElementById('priceFilterValue');


	dd.elements.slider1.moveTo(dd.elements.slider1.defx+70,dd.elements.slider1.defy);	
	pDiv.innerHTML=maxPrice;	
	pInp.value=maxPrice;	

	stars=new Array('one','two','three','four','five');
	for (i in stars)
	{
		inp=document.getElementById(stars[i]+'Star');
		inp.value="1";
		img=document.getElementById(stars[i]+'StarImage');
		img.src=img.src.replace(stars[i]+'StarFilled',stars[i]+'Star');
		img.src=img.src.replace(stars[i]+'Star',stars[i]+'StarFilled');
	}
	value=maxPrice;
	updateHotels();
	updateHelpText();

	return false;
}




function priceSliderDrop()
{
	div=document.getElementById('priceFilter');
	inp=document.getElementById('priceFilterValue');
	
	minx=dd.obj.defx-70;
	maxx=dd.obj.defx+70;
	value=dd.obj.x-minx;
	unit=(maxPrice-minPrice)/140;
	
	value=Math.round(value*unit)+minPrice;
	div.innerHTML=value;
	inp.value=value;
	updateHotels();
	updateHelpText();
	
	
}

function updateHelpText()
{
	helpDiv=document.getElementById('helpMessage');

	if (value==maxPrice)
	{
		helpDiv.innerHTML='Available hotels shown in <span style="color:#4227cc">blue<\/span>';
	}
	else
	{
		helpDivHtml='Available hotels between ';
		helpDivHtml+='<span style="color:#4227cc">'+currencySymbol+(minPrice-1)+' - '+currencySymbol+value+'<\/span>';	
		helpDivHtml+=' shown in <span style="color:#4227cc">blue<\/span>';
		helpDiv.innerHTML=helpDivHtml;
	}
}


function sliderDrag()
{

	minx=dd.obj.defx;
	maxx=dd.obj.defx+140;
	value=dd.obj.x-minx;
	alert("objx "+dd.obj.x+" minx "+minx);
	newX=(Math.round(value/20))*20+minx;
	dd.obj.moveTo(newX,dd.obj.y);	
}

function moveSlider(evt)
{

	div=document.getElementById('priceFilter');
	inp=document.getElementById('priceFilterValue');
	minx=dd.elements.slider1.defx-70;
	maxx=dd.elements.slider1.defx+70;

	//stops slider being clicked off end of track
	cx=(evt.clientX>maxx)?maxx:evt.clientX;
	change=cx-dd.elements.slider1.x;


	value=evt.clientX-minx;
	unit=(maxPrice-minPrice)/140;
	
	value=Math.round(value*unit)+minPrice;
	div.innerHTML=value;
	inp.value=value;

	dd.elements.slider1.moveBy(change,0);	

	updateHelpText();
	updateHotels();
	

}

function displayHelp(url,h)
{
	if (h) height=h;
	else height=450;
	newwindow=window.open(url,'Help','height='+height+',width=300,resizable=yes');
	if (window.focus) {newwindow.focus()}
	return false;

}



function updateOpacity()
{
	div=document.getElementById('hotelInfo');
	tic=document.getElementById('hotelInfoTic');

	opacity=opacity+0.1;
	setOpacity(div,opacity);
	setOpacity(tic,opacity);
	if (opacity>=1) window.clearInterval(timer);

}

function setOpacity(obj,opacity)
{
	if (navigator.appName=="Microsoft Internet Explorer")
	{
		obj.style.filter="alpha(opacity="+opacity*100+")";
	}
	else
	{
		obj.style.opacity=opacity;
	}
}

function swapStar(starNum)
{
	inp=document.getElementById(starNum);
	img=document.getElementById(starNum+'Image');
	newImgSrc=img.src.replace(starNum+'Filled',starNum)
	if (inp.value==true)
	{
		inp.value='';//needs to be empty string to get around anoying '0'==true feature of js
		newImgSrc=img.src.replace(starNum+'Filled',starNum)
		img.src=newImgSrc;
	}
	else
	{
		inp.value=1
		newImgSrc=img.src.replace(starNum,starNum+'Filled')
		img.src=newImgSrc;

	}
updateHotels();

}

