// *************************************
//  Common JavaScript Document for Trooval.com Resort pages - Created by Raster Media, LLC
//  Author: Michael Smith
//	Created: 09/25/2008
//  Last Edited: 09/25/2008
//	Last Edited By: Michael Smith
//	Version: 0.1
//	Notes:
// *************************************

//shorthand for document.getElementById (BS)
/*********************************/
function $(id,d){
/*********************************/
	if(!d){
		d = document;
		return d.getElementById(id);
	}
}

//shorthand for window.location.href
/*********************************/
function goto(url){
/*********************************/
	window.location.href = url;
}

//include javascript files on the fly
/*********************************/
function includeJS(filename) {
/*********************************/
	var htmlHead = document.getElementsByTagName('head').item(0);
    var js = document.createElement('script');
    js.setAttribute('language', 'javascript');
    js.setAttribute('type', 'text/javascript');
    js.setAttribute('src', filename);
    htmlHead.appendChild(js);
	return false;
}

//manual drop down list
/*********************************/
function dropDown(id){
/*********************************/
	var list = $(id);
	var state = getStyle(id,'display');
	if(state == 'none'){
		list.style.display = 'block';
	} else {
		list.style.display = 'none';
	}
}

/*********************************/
function getResortList(){
/*********************************/
	var list = document.getElementById('resorts_list');
	list.style.display = 'block';
	var name = document.getElementById('resort_name');
	ref = name.getElementsByTagName("a")[0];
	ref.className = 'over';
	document.getElementById('resort_select').style.background = '#c3ddef';
}

/*********************************/
function hideResortList(){
/*********************************/
	var list = document.getElementById('resorts_list');
	list.style.display = 'none';
	var name = document.getElementById('resort_name');
	ref = name.getElementsByTagName("a")[0];
	ref.className = '';
	document.getElementById('resort_select').style.background = '';
}

//use to get style of any element (MS)
/*********************************/
function getStyle(el,style) {
/*********************************/
	var x = document.getElementById(el);
	var mozStyle = (style == "backgroundColor") ? "background-color" : style;
	if (x.currentStyle){
		var y = x.currentStyle[style];
	} else if (document.defaultView && document.defaultView.getComputedStyle) {
		var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(mozStyle);
	}
	return y;
}