/****************************************************************************
**	
**	Filename:	wyndhamvrap_resorts.js
**	Date:		8/03/2007
**	Author:		Troy Lutton & Naomi Ngawaka
**	Purpose:	To provide resort specific functions for the WyndhamVRAP website
**
*****************************************************************************/

function show_resort() {
	
	var resort_sel = document.getElementById('resort_sel');
	var resort_href = resort_sel.options[resort_sel.selectedIndex].value;

	if (resort_href != '')
		location.href = "/resorts/" + resort_href;

	return false;
}

function displayLrgImg(imgId, currentName) 
{	
	if (eval(currentName) == undefined)
		eval(currentName + ' = \'img0\'');

	var currentImgId = eval(currentName);

	if (currentImgId != imgId) {
		opacityTweenIn = new OpacityTween(document.getElementById(imgId),Tween.regularEaseOut, 0, 100, 2); 
		opacityTweenIn.start();

		if (currentImgId != '') {
			opacityTweenOut = new OpacityTween(document.getElementById(currentImgId),Tween.regularEaseOut, 100, 0, 2); 
			opacityTweenOut.start();
		}		
	}
	eval(currentName + ' = \'' + imgId + '\'');	
}

function trialPopUp(href) {
	
	window.open(href,'contact','toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=250,height=50,left=300,top=300');
	
	return false;
}

// load google map
function loadMap(lat, lng, description, address) {
  if (GBrowserIsCompatible()) {
	var point = new GLatLng(lat,lng);

	var map = new GMap2(document.getElementById("map"));
	map.setCenter(point, 17);
	map.addControl(new GSmallMapControl());

	var icon = new GIcon();
	icon.image = "http://images.trendwest.com.au/resorts/google_maps_arrow.gif";
	icon.iconSize = new GSize(39, 39);
	icon.iconAnchor = new GPoint(5, 30);
	icon.infoWindowAnchor = new GPoint(15, 12);

	var marker = new GMarker(point, icon);
	map.addOverlay(marker);

	GEvent.addListener(marker, "click", function() {
	  marker.openInfoWindowHtml('<div style="display:inline; float:left;"><strong>' + description + '</strong><br />' + address + '</div>');
	});

	return marker;
  }
}