/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Michael J. Damato | http://developing.damato.net/ */
var states = new Array();
var cities = new Array();

// US City lists
states['United States'] = new Array('State - Choose a ResortQuest Destination','Alabama','Colorado','Delaware','Florida','Idaho','Maryland','South Carolina','Utah');

cities['United States'] = new Array();
cities['Alabama'] = new Array('AL Locations','Gulf Coast');
cities['Colorado'] = new Array('CO Locations','Aspen','Breckenridge','Keystone','Steamboat');
cities['Delaware'] = new Array('DE Locations','Bethany Beach');
cities['Florida'] = new Array('FL Locations','Beaches of South Walton','Destin','Fort Walton Beach','Orlando','Navarre Beach','Panama City Beach','Perdido Key');
cities['Idaho'] = new Array('ID Locations','Sun Valley');
cities['Maryland'] = new Array('MD Locations','Ocean City');
cities['South Carolina'] = new Array('SC Locations','Charleston','Hilton Head','Isle of Palms','Kiawah','Myrtle Beach','Seabrook','Sullivans Island','Wild Dunes');
cities['Utah'] = new Array('UT Locations','Park City');

cities['State - Choose a ResortQuest Destination'] = new Array('US City');

// Default lists
states['Region'] = new Array('State/Country');
cities['Region'] = new Array();
cities['Region']['State/Country'] = new Array('City');


function setCities() {
  stateSel = document.getElementById('state-revamp');
  cityList = cities[stateSel.value];
  changeSelect('city', cityList, cityList);
}

function changeSelect(fieldID, newOptions, newValues) {
  selectField = document.getElementById(fieldID);
  selectField.options.length = 0;
  for (i=0; i<newOptions.length; i++) {
    selectField.options[selectField.length] = new Option(newOptions[i], newValues[i]);
  }
}

function getURL()   {
   var w = document.myform.loclist.selectedIndex;
   var url_add = document.myform.loclist.options[w].value;
   // window.location.href = url_add;
   goURL(url_add);   
   }

function goURL(loc) {
//Colorado
	if (loc == 'CO Locations')			{newurl= "http://www.resortquestcolorado.com/?cid=RQRD00000028";}
	else if (loc == 'Aspen')			{newurl= "http://www.resortquestaspen.com/?cid=RQRD00000028";}	
	else if (loc == 'Breckenridge')		{newurl= "http://www.resortquestbreckenridge.com/?cid=RQRD00000028";}	
	else if (loc == 'Keystone')			{newurl= "http://www.resortquestkeystone.com/?cid=RQRD00000028";}
	else if (loc == 'Steamboat')		{newurl= "http://www.resortqueststeamboat.com/?cid=RQRD00000028";}
	
//Other West Coast
	else if (loc == 'UT Locations')		{newurl= "http://www.resortquestparkcity.com/?cid=RQRD00000028";}
	else if (loc == 'Park City')		{newurl= "http://www.resortquestparkcity.com/?cid=RQRD00000028";}
	else if (loc == 'ID Locations')		{newurl= "http://www.resortquestsunvalley.com/?cid=RQRD00000028";}
	else if (loc == 'Sun Valley')		{newurl= "http://www.resortquestsunvalley.com/?cid=RQRD00000028";}	
	
//South Carolina
	else if (loc == 'SC Locations')		{newurl= "http://www.resortquest.com/vacation-rentals/south-carolina/index.htm?cid=RQRD00000028";}	
	else if (loc == 'Charleston')		{newurl= "http://www.resortquestcharleston.com/?cid=RQRD00000028";}	
	else if (loc == 'Hilton Head')		{newurl= "http://www.resortquesthiltonhead.com/?cid=RQRD00000028";}
	else if (loc == 'Isle of Palms')	{newurl= "http://www.resortquestisleofpalms.com/?cid=RQRD00000028";}	
	else if (loc == 'Kiawah')			{newurl= "http://www.resortquestkiawah.com/?cid=RQRD00000028";}
	else if (loc == 'Myrtle Beach')		{newurl= "http://www.resortquestmyrtlebeach.com/?cid=RQRD00000028";}	
	else if (loc == 'Seabrook')			{newurl= "http://www.resortquestseabrook.com/?cid=RQRD00000028";}
	else if (loc == 'Sullivans Island')	{newurl= "http://www.resortquest.com/vacation-rentals/south-carolina/charleston/isle-of-palms/sullivans-island.htm?cid=RQRD00000028";}	
	else if (loc == 'Wild Dunes')		{newurl= "http://www.resortquest.com/vacation-rentals/south-carolina/charleston/isle-of-palms/wild-dunes.htm?cid=RQRD00000028";}		
	
//Other East Coast
	else if (loc == 'DE Locations')		{newurl= "http://www.resortquestdelaware.com/?cid=RQRD00000028";}
	else if (loc == 'Bethany Beach')	{newurl= "http://www.resortquestdelaware.com/?cid=RQRD00000028";}
	else if (loc == 'MD Locations')		{newurl= "http://www.resortquestdelaware.com/ocean-city-vacation-rentals.htm?cid=RQRD00000028";}
	else if (loc == 'Ocean City')		{newurl= "http://www.resortquestdelaware.com/ocean-city-vacation-rentals.htm?cid=RQRD00000028";}

//NW Florida
	else if (loc == 'AL Locations')		{newurl= "http://www.resortquestal.com/?cid=RQRD00000028";}
	else if (loc == 'FL Locations')		{newurl= "http://www.resortquestnwfl.com/?cid=RQRD00000028";}
	else if (loc == 'Gulf Coast')		{newurl= "http://www.resortquestal.com/?cid=RQRD00000028";}
	else if (loc == 'Beaches of South Walton'){newurl= "http://www.resortquestbeachesofsouthwaltonvacations.com/?cid=RQRD00000028";}	
	else if (loc == 'Destin')			{newurl= "http://www.resortquestdestinvacations.com/?cid=RQRD00000028";}	
	else if (loc == 'Fort Walton Beach')	{newurl= "http://www.resortquestfortwaltonbeachvacations.com/?cid=RQRD00000028";}	
	else if (loc == 'Orlando')			{newurl= "http://www.resortquest.com/vacation-rentals/florida/orlando-vacation-rentals.htm";}	
	else if (loc == 'Navarre Beach')	{newurl= "http://www.resortquestnavarrebeachvacations.com/?cid=RQRD00000028";}
	else if (loc == 'Panama City Beach'){newurl= "http://www.resortquestpanamacitybeachvacations.com/?cid=RQRD00000028";}	
	else if (loc == 'Perdido Key')		{newurl= "http://www.resortquestperdidokeyvacations.com/?cid=RQRD00000028";}



	
//ELSE
	else	{newurl = "http://www.resortquest.com";}

//Check for empty selection
	if (newurl == 'http://www.resortquest.com')	{		
		s.tl(this,'e',loc);		}	
	else	{
		s.tl(this,'e',newurl);
		window.open(newurl);	}
}

// Multiple onload function created by: Simon Willison
// http://simonwillison.net/2004/May/26/addLoadEvent/
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}
// Expandable menu - not related to this country select script
oldTextAry = new Array();
function toggleMe(a,fieldObj, newTexStr){
  var e=document.getElementById(a);
  if(!e)return true;

  if(e.style.display=="none"){
    e.style.display="block"
  } else {
    e.style.display="none"
  }
  if (newTexStr == fieldObj.innerHTML) {
	fieldObj.innerHTML = oldTextAry[fieldObj.id];
  } else {
	oldTextAry[fieldObj.id] = fieldObj.innerHTML;
	fieldObj.innerHTML = newTexStr;
  }
  return true;
}

