var ajax = new sack();

function getResortList(sel)
{
	var countryCode = sel.options[sel.selectedIndex].value;
	document.getElementById('resortid').options.length = 0;	// Empty resort select box

	if(countryCode.length>0){
		ajax.requestFile = 'classes/getResorts.php?countryCode='+countryCode;	// Specifying which file to get
		ajax.onCompletion = createResorts;	// Specify function that will be executed after file has been found
		ajax.runAJAX();		// Execute AJAX function
	}
}

function createResorts()
{
	var obj = document.getElementById('resortid');
	eval(ajax.response);	// Executing the response from Ajax as Javascript code	
}

function hideWait(){
	var w3c=(document.getElementById)? true: false;
	var ns4=(document.layers)?true:false;
	var ie5=(w3c && document.all)? true : false;
	var ns6=(w3c && !document.all)? true: false;
	var d=document;
	if(w3c){ 	d.getElementById('divWait').style.display='none'; }
}

function detectRes() {
	var res;
	var sh = screen.height;
	var sw = screen.width;
	if ((sw <= 800) && (sh <= 600)) res = 0800;
	else if ((sw <= 1024) && (sh <= 768)) res = 1024;
	else if ((sw <= 1280) && (sh < 1024)) res = 1280;
	else res = 1280;
	return res; }

function changeBG(wallpaper) {
	var res = detectRes();
	document.body.style.backgroundImage='url('+wallpaper+'-'+res+'.jpg)';
	void(0); 
}

isCSS = (document.body && document.body.style) ? true : false;
isW3C = (isCSS && document.getElementById) ? true : false;
isIE4 = (isCSS && document.all && readIEVer() >= 4.0) ? true : false;

function readIEVer() {
	var agent = navigator.userAgent;
	var offset = agent.indexOf( "MSIE" );
	if( offset < 0 ) {
		return 0;
	}
	return parseFloat( agent.substring( offset + 5, agent.indexOf( ";", offset ) ) );
}

/* Stack up window.onload events using this function from Simon Willison - http://www.sitepoint.com/blog-post-view.php?id=171578 */
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

function TG(id, changeTo) {
	var a,lok;
	lok = false;
	if(navigator.appName == 'Netscape') {
		a = document.getElementById("tr_"+id);
		if(document.getElementById("expander_"+id).src == "http://www.easywarez.com/images/ArrowPoint2.gif") lok=true;
	}
	else {
		a = document.all("tr_"+id);
		if(document.all("expander_"+id).src == "http://www.easywarez.com/images/ArrowPoint2.gif") lok=true;
	}

	if(lok) a.style.backgroundImage = 'url(/images/BGoverimg_1.gif)';
	else if(changeTo=="on") a.style.backgroundImage = 'url(/images/BGoverimg.gif)';
	else a.style.backgroundImage = '';
}