// JavaScript Document<!-- Javascript Functions -->
<!--
function win( pageToLoad, winName, width, height, center) {
    xposition=0; yposition=0;
    if ((parseInt(navigator.appVersion) >= 4 ) && (center)){
        xposition = (screen.width - width) / 2;
        yposition = (screen.height - height) / 2;
    }
    args = "width=" + width + "," 
    + "height=" + height + "," 
    + "location=0," 
    + "menubar=0,"
    + "resizable=1,"
    + "scrollbars=0,"
    + "status=0," 
    + "titlebar=0,"
    + "toolbar=0,"
    + "hotkeys=0,"
    + "screenx=" + xposition + ","  //NN Only
    + "screeny=" + yposition + ","  //NN Only
    + "left=" + xposition + ","     //IE Only
    + "top=" + yposition;           //IE Only

    window.open( pageToLoad,winName,args );
}

function win2( pageToLoad, winName, width, height, center) {
    xposition=0; yposition=0;
    if ((parseInt(navigator.appVersion) >= 4 ) && (center)){
        xposition = (screen.width - width) / 2;
        yposition = (screen.height - height) / 2;
    }
    args = "width=" + width + "," 
    + "height=" + height + "," 
    + "location=0," 
    + "menubar=0,"
    + "resizable=0,"
    + "scrollbars=1,"
    + "status=1," 
    + "titlebar=0,"
    + "toolbar=0,"
    + "hotkeys=0,"
    + "screenx=" + xposition + ","  //NN Only
    + "screeny=" + yposition + ","  //NN Only
    + "left=" + xposition + ","     //IE Only
    + "top=" + yposition;           //IE Only

    window.open( pageToLoad,winName,args );
}

function win3( pageToLoad, winName, width, height, center) {
    xposition=0; yposition=0;
    if ((parseInt(navigator.appVersion) >= 4 ) && (center)){
        xposition = (screen.width - width) / 2;
        yposition = (screen.height - height) / 2;
    }
    args = "width=" + width + "," 
    + "height=" + height + "," 
    + "location=0," 
    + "menubar=0,"
    + "resizable=0,"
    + "scrollbars=1,"
    + "status=0," 
    + "titlebar=0,"
    + "toolbar=0,"
    + "hotkeys=0,"
    + "screenx=" + xposition + ","  //NN Only
    + "screeny=" + yposition + ","  //NN Only
    + "left=" + xposition + ","     //IE Only
    + "top=" + yposition;           //IE Only

    window.open( pageToLoad,winName,args );
}

function winpop( pageToLoad, winName, width, height, center, scrollbars) {
    xposition=0; yposition=0;
    if ((parseInt(navigator.appVersion) >= 4 ) && (center)){
        xposition = (screen.width - width) / 2;
        yposition = (screen.height - height) / 2;
    }
    args = "width=" + width + "," 
    + "height=" + height + "," 
    + "location=0," 
    + "menubar=0,"
    + "resizable=1,"
    + "scrollbars=" + scrollbars + ","
    + "status=0," 
    + "titlebar=0,"
    + "toolbar=0,"
    + "hotkeys=0,"
    + "screenx=" + xposition + ","  //NN Only
    + "screeny=" + yposition + ","  //NN Only
    + "left=" + xposition + ","     //IE Only
    + "top=" + yposition;           //IE Only

    window.open( pageToLoad,winName,args );
}

window.name = 'accountingWindow';

// toggles an elements visibility on and off
function toggleforminfo(srcElement) {
	if (srcElement.style.display == "none") {
		srcElement.style.display = "";
	} else {
		srcElement.style.display = "none"
	}
}

function toggle(id)
{
	el = id; //document.getElementById(id);
	var display = el.style.display = "";
	el.style.display = display;
}

function untoggle(id)
{
	el = id; //document.getElementById(id);
	var display = el.style.display = "none";
	el.style.display = display;
}


function checkIsNum(field) {
	if (isNaN(field.value)) {
		alert('Number field can contain only numbers!');
		field.select();
		field.focus();
		return false;
	}
}
// function to populate the specials listing when a resort is selected.
function ClearOptions(OptionList) {

	//Always clear an option list from the last entry to the first
	for (x = OptionList.length; x >= 0; x = x - 1) {
		OptionList[x] = null;
	}
}
function AddToOptionList(OptionList, OptionValue, OptionText) {
	OptionList[OptionList.length] = new Option(OptionText, OptionValue);
}
// js wrapper functions to make use of vbscripts nicer MsgBox's instead of js alerts
IE4 = document.all;
function newAlert(title,mess,icon,mods) {
  (IE4) ? makeMsgBox(title,mess,icon,0,0,mods) : alert(mess);
}
function newConfirm(title,mess,icon,defbut,mods) {
  if (IE4) {
     icon = (icon==0) ? 0 : 2;
     defbut = (defbut==0) ? 0 : 1;
     retVal = makeMsgBox(title,mess,icon,4,defbut,mods);
     retVal = (retVal==6);
  }
  else {
     retVal = confirm(mess);
  }
  return retVal;
}
function IEBox(title,mess,icon,buts,defbut,mods) {
  retVal = (IE4) ? makeMsgBox(title,mess,icon,buts,defbut,mods) : null;
  return retVal;
}
function newConfirm(title,mess,icon,defbut,mods) {
  if (IE4) {
     icon = (icon==0) ? 0 : 2;
     defbut = (defbut==0) ? 0 : 1;
     retVal = makeMsgBox(title,mess,icon,4,defbut,mods);
     retVal = (retVal==6);
  }
  else {
     retVal = confirm(mess);
  }
  return retVal;
}

//  Toggles elements show/hide
function toggledisplay(srcElement) {
	if (srcElement.style.display == "none") {
		srcElement.style.display = "";
	} else {
		srcElement.style.display = "none"
	}
}

function untoggledisplay(srcElement) {
	if (srcElement.style.display == "") {
		srcElement.style.display = "none";
	} else {
		srcElement.style.display = ""
	}
}

function bnePrices(){
	var target = "bnerates.asp";
	var windowname = "booknow";
	var resize = "no";
	var w = "350";
	var h = "500";
	var newWindow = null;var i = 0;
	if (navigator.appName == "Microsoft Internet Explorer")	{
		if ( (navigator.appVersion.indexOf('Windows 3.1') < 0) && (navigator.appVersion.indexOf('Macintosh') < 0)  ) {
			newWindow = window.open("",windowname,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable="+resize+",copyhistory=no,width="+w+",height="+h);
			if (newWindow){
				newWindow.close();
				while((! newWindow.closed)&&(i<100))i++;
			}
		}
	}		
	newWindow = window.open(target,windowname,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable="+resize+",copyhistory=no,width="+w+",height="+h);
	if (navigator.appName != "Microsoft Internet Explorer")	{
		newWindow.focus()
	}
}
function gcPrices(){
	var target = "gcrates.asp";
	var windowname = "booknow";
	var resize = "no";
	var w = "350";
	var h = "500";
	var newWindow = null;var i = 0;
	if (navigator.appName == "Microsoft Internet Explorer")	{
		if ( (navigator.appVersion.indexOf('Windows 3.1') < 0) && (navigator.appVersion.indexOf('Macintosh') < 0)  ) {
			newWindow = window.open("",windowname,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable="+resize+",copyhistory=no,width="+w+",height="+h);
			if (newWindow){
				newWindow.close();
				while((! newWindow.closed)&&(i<100))i++;
			}
		}
	}		
	newWindow = window.open(target,windowname,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable="+resize+",copyhistory=no,width="+w+",height="+h);
	if (navigator.appName != "Microsoft Internet Explorer")	{
		newWindow.focus()
	}
}
function mkyPrices(){
	var target = "mkyrates.asp";
	var windowname = "booknow";
	var resize = "no";
	var w = "350";
	var h = "500";
	var newWindow = null;var i = 0;
	if (navigator.appName == "Microsoft Internet Explorer")	{
		if ( (navigator.appVersion.indexOf('Windows 3.1') < 0) && (navigator.appVersion.indexOf('Macintosh') < 0)  ) {
			newWindow = window.open("",windowname,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable="+resize+",copyhistory=no,width="+w+",height="+h);
			if (newWindow){
				newWindow.close();
				while((! newWindow.closed)&&(i<100))i++;
			}
		}
	}		
	newWindow = window.open(target,windowname,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable="+resize+",copyhistory=no,width="+w+",height="+h);
	if (navigator.appName != "Microsoft Internet Explorer")	{
		newWindow.focus()
	}
}

function scPrices(){
	var target = "http://sunshinecoast.con-x-ion.com/scrates.asp";
	var windowname = "booknow";
	var resize = "no";
	var w = "350";
	var h = "500";
	var newWindow = null;var i = 0;
	if (navigator.appName == "Microsoft Internet Explorer")	{
		if ( (navigator.appVersion.indexOf('Windows 3.1') < 0) && (navigator.appVersion.indexOf('Macintosh') < 0)  ) {
			newWindow = window.open("",windowname,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable="+resize+",copyhistory=no,width="+w+",height="+h);
			if (newWindow){
				newWindow.close();
				while((! newWindow.closed)&&(i<100))i++;
			}
		}
	}		
	newWindow = window.open(target,windowname,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable="+resize+",copyhistory=no,width="+w+",height="+h);
	if (navigator.appName != "Microsoft Internet Explorer")	{
		newWindow.focus()
	}
}
//contact.asp
var good;
function checkEmailAddress(field) {

// Note: The next expression must be all on one line...
//       allow no spaces, linefeeds, or carriage returns!
var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);

if (goodEmail){
   good = true
} else {
   alert('Please enter a valid e-mail address.')
   field.focus()
   field.select()
   good = false
   }
}

function sendOff(){ 
	if (document.contact.name.value.length <1) {
		self.scrollTo(0, 0);
		alert('Please enter your Name.');
		document.contact.name.focus();
		document.contact.name.select();
		return
	}
	else if (document.contact.phone.value.length <1) {
		self.scrollTo(0, 0);
		alert('Please enter a contact PHONE number.');
		document.contact.phone.focus();
		document.contact.phone.select();
		return
	}
	else if (document.contact.comments.value.length <1) {
		self.scrollTo(0, 0);
		alert('Please write something to send us!');
		document.contact.comments.focus();
		document.contact.comments.select();
		return
	}
   checkEmailAddress(document.contact.email);
   if (good == true) {
	document.contact.submit()
	}
}

function collapseAll() {
//		document.getElementById('btncontact').
}
//-->