
//new power search page javascript code

function initiate(version)
{
  var div = document.getElementById("tab0");
  showPane(div,version);
}

function showPane(div,version)

{
  if(currentTab != 0)
  {
	currentTab.className=((!version)?'unselectedTab tabSize':'unselectedTab');
  }
  div.className = ((!version)?'selectedTab tabSize':'selectedTab');
  currentTab = div;

  if(currentPaneStyle != 0)
    currentPaneStyle.display = "none";
  var paneId = "pn_" + div.id;
  var objPaneStyle = document.getElementById(paneId).style;
  objPaneStyle.display = "block";
  currentPaneStyle = objPaneStyle;
  //document.forms[0].tab.value = div.id;
  HotelSearch.tab.value = div.id;
}


// clear out any selected city radio button if any characters are entered in the city text field
function clearPreSelectedCity()
{
	var preSelectRadio = document.HotelSearch.pre_selected;
	if(preSelectRadio != null)
	{
		for(var i = 0; i < preSelectRadio.length; i++)
		{
			if(preSelectRadio[i].checked)
			{
				preSelectRadio[i].checked = false;
			}
		}
	}
	return;
}

// clear out the values (if any are present) when somebody clicks on a city radio button
function clearBasicElements()
{
	var city    = document.HotelSearch.city;
	var state   = document.HotelSearch.state;
	var country = document.HotelSearch.country;
	if(city.value != null)
	{
		city.value = '';
	}
	if(state.selectedIndex != 0)
	{
		state.selectedIndex = 0;
	}
	if(country.selectedIndex != 1)
	{
		country.selectedIndex = 1;
	}
	return;
}

function hide_div(){
		// hide all the divs
		document.getElementById('the_div_1').style.display = 'none';
		document.getElementById('the_div_2').style.display = 'none';
		document.getElementById('the_div_3').style.display = 'none';
		document.getElementById('the_div_4').style.display = 'none';
		}
			
function show_divGrp(div_id) {
		// show the requested div
		document.getElementById('the_div_2').style.display = 'block';
		document.getElementById('the_div_3').style.display = 'block';
		document.getElementById('the_div_4').style.display = 'block';
		} 
			
function show_div1(){
		document.getElementById('amenitiesImg').style.visibility = 'hidden';
		document.getElementById('chainImg').style.visibility = 'hidden';
		document.getElementById('hotelImg').style.visibility = 'hidden';
		document.getElementById('ratingImg').style.visibility = 'hidden';
		document.getElementById('the_div_container').style.display = 'none';
			
		if (document.getElementById('the_div_1').style.display == 'none'){
			document.getElementById('the_div_1').style.display ='block'; 
			document.getElementById('name').focus(); 
			document.getElementById('hotelImg').src = "http://images.wctravel.com/images-general/abo/arrowreddown.gif";
			document.getElementById('hotelImg').style.visibility = 'visible';
		}
		else{
			document.getElementById('hotelImg').src = "http://images.wctravel.com/images-general/powersearch/null.gif";
			document.getElementById('hotelImg').style.visibility = 'hidden';					
			document.getElementById('the_div_1').style.display ='none'; 
		}
					
	}

function clearFields()
	{

	document.HotelSearch.city.value = '';
	document.HotelSearch.state.selectedIndex = 0;
	document.HotelSearch.country.selectedIndex = 0;
	document.HotelSearch.airport.value = '';
	document.HotelSearch.t1_addr.value = '';
	document.HotelSearch.t1_city.value = '';
	document.HotelSearch.t1_state.selectedIndex = 0;
	document.HotelSearch.t1_country.selectedIndex = 0;
	document.HotelSearch.t3_landmark.value = '';
	document.HotelSearch.t3_state.selectedIndex = 0;
	document.HotelSearch.t3_country.selectedIndex = 0;
	document.HotelSearch.name.value = '';
	document.HotelSearch.star_rating.selectedIndex = 0;
	document.HotelSearch.brand.selectedIndex = 0;

	return true;
	}

function createDiv(divName){
    var oDivElement = document.createElement("div"); 
    oDivElement.width="100%"; 
    oDivElement.height="100%";
    oDivElement.name = divName;
    oDivElement.id = divName;
	return oDivElement;
}

function build_div(divClick, div_Img){
	var div2 = createDiv("div1");
	var div3 = createDiv("div2");
	var div4 = createDiv("div3");

	document.getElementById('amenitiesImg').style.visibility = 'hidden';
	document.getElementById('chainImg').style.visibility = 'hidden';
	document.getElementById('hotelImg').style.visibility = 'hidden';
	document.getElementById('ratingImg').style.visibility = 'hidden';

	document.getElementById('the_div_1').style.display ='none'; 

	div2.innerHTML = document.getElementById('the_div_2').innerHTML;
	div3.innerHTML = document.getElementById('the_div_3').innerHTML;
	div4.innerHTML = document.getElementById('the_div_4').innerHTML;
	parentContainer = document.getElementById('the_div_container');
	parentContainer.style.display = 'block';
	parentContainer.innerHTML = '';
	if (divClick == 'the_div_2') {
		parentContainer.appendChild(div2);
		parentContainer.appendChild(div3);
		parentContainer.appendChild(div4);
		}
	else if (divClick == 'the_div_3') {
		parentContainer.appendChild(div3);
		parentContainer.appendChild(div2);
		parentContainer.appendChild(div4);
		document.getElementById('brand').focus();
		}
	else if (divClick == 'the_div_4') {
		parentContainer.appendChild(div4);
		parentContainer.appendChild(div2);
		parentContainer.appendChild(div3);
		document.getElementById('star_rating').focus();
		}

	document.getElementById(div_Img).src = "http://images.wctravel.com/images-general/abo/arrowreddown.gif";
	document.getElementById(div_Img).style.visibility = 'visible';

}

//number children is changed
function childChange(inN)
{
document.getElementById("divAge1").style.display = 'none';
document.getElementById("divAge2").style.display = 'none';
document.getElementById("divAge3").style.display = 'none';
document.getElementById("divAge4").style.display = 'none';
if (inN == 0)
{
	document.getElementById("multichild").style.display = 'none';
	document.getElementById("multichildLabel").style.display = 'none';
	document.getElementById("multichildLabel0").style.display = 'none';
}
else
{
	document.getElementById("multichildLabel0").style.display = 'block';
	document.getElementById("multichildLabel").style.display = 'block';
	document.getElementById("multichild").style.display = 'block';
	for(var i = 0; i < inN; i++)
	{
		document.getElementById("divAge"+(i+1)).style.display = 'block';
	}
}

return true;
}


function validateForm (inF)
{
	b_valid = true;
	for(var j = 1; j <= inF.num_children.options[inF.num_children.selectedIndex].text; j++)
		{
		minorAge = document.getElementById("minorAge"+j);
		if(minorAge.selectedIndex == 0){
			alert("Please enter the age of each child. See highlighted element below");
			minorAge.focus();
			b_valid = false;
			j = 255;
			}
		}
		
	if(!htlDoaCal.returnSelectedDate("doa_yy","doa_mm","doa_dd"))
	{
		b_valid = false;
	}
	if(!htlDodCal.returnSelectedDate("dod_yy","dod_mm","dod_dd"))
	{
		b_valid = false;
	}		
	return (b_valid);
}

// -->