/****************************************************************************
**	
**	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 option_selected = resort_sel.options[resort_sel.selectedIndex];
	var resort_href = option_selected.value;

	if (option_selected.className.indexOf('heading') == -1) {
		location.href = "/resorts/" + option_selected.value;

	} else {
		alert('Please select a more specific location.');
	}

	return false;
}

// Copied from www.worldmarktheclub.com
function jumpNow(targ,selObj,restore){ 

	if (selObj.options[selObj.selectedIndex].value != '') {

		eval(targ+".location='http://www.worldmarktheclub.com"+selObj.options[selObj.selectedIndex].value+"'");
		if (restore) selObj.selectedIndex=0;

	} else {
		alert('Please select a more specific location.');
	}
}

function show_website() {
	
	var website_sel = document.getElementById('website_sel');
	var website_href = website_sel.options[website_sel.selectedIndex].value;

	if (website_href != '')
		window.open(website_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;
}

// rates
function changeRoomType (roomType) {

    var tableID = roomType.options[roomType.selectedIndex].value;

    var rateTables = document.getElementsByTagName('table');

    for (i = 0; i < rateTables.length; i++) {

        if (rateTables[i].className.indexOf('rates') != -1 && rateTables[i].id != 'calendar') {    

            rateTables[i].style.display = rateTables[i].id == tableID ? 'inline' : 'none';
        }
    }
}
