// JavaScript Document


      //Create image objects, preload all active and inactive images.

Side1on = new Image();          // image objects for the active images
Side1on.src = "images/home_on.gif";

Side2on = new Image();
Side2on.src = "images/condo_tour_on.gif";

Side3on = new Image();
Side3on.src = "images/rp_on.gif";

Side4on = new Image();
Side4on.src = "images/reserv_on.gif";

Side5on = new Image();
Side5on.src = "images/contact_us_on.gif";

Side6on = new Image();
Side6on.src = "images/localinfo_on.gif";


Side1off = new Image();          // objects for the inactive images
Side1off.src = "images/home_off.gif";

Side2off = new Image();
Side2off.src = "images/condo_tour_off.gif";

Side3off = new Image();
Side3off.src = "images/rp_off.gif";

Side4off = new Image();
Side4off.src = "images/reserv_off.gif";

Side5off = new Image();
Side5off.src = "images/contact_us_off.gif";

Side6off = new Image();
Side6off.src = "images/localinfo_off.gif";

//Specify image paths and description:

var dynimages=new Array();
dynimages[0]=["images/bathroom.gif", "Bathroom"];
dynimages[1]=["images/bedroom1.gif", "Bedroom"];
dynimages[2]=["images/bedroom2.gif", "Another angle of the bedroom"];
dynimages[3]=["images/livingroom.gif", "Comfy Living Room"];
dynimages[4]=["images/murphybed.gif", "Extra Sleeping Room, Murphy bed and sofa sleeper"];
dynimages[5]=["images/kitchen.gif", "Fully Loaded Kitchen"];
dynimages[6]=["images/entranceway.gif", "Entryway"];
dynimages[7]=["images/dinningarea.gif", "Dinning Area with great view"];
dynimages[8]=["images/exerciseroom.gif", "Resorts exercise room"];
dynimages[9]=["images/swimmingpool.gif", "Beautiful Half Indoor/Outdoor Swimming Pool with 4 Hot Tubs"];
dynimages[10]=["images/viewfrombalcony.gif", "Great view from balcony"];
dynimages[11]=["images/outside.gif", "Outside View of Condo Resort"];
dynimages[12]=["images/condolayout.gif", "Layout of the Condo"];

var dynaHeights=new Array();
dynaHeights["index"] = 700; //index.html
dynaHeights["condotour"] = 1500; //condotour.html

//Preload images ("yes" or "no"): Faster if you don't preload it
var preloadimg="no";
//Set optional link target to be added to all images with a link:
var optlinktarget="";

//Set image border width
var imgborderwidth=0;

//Optionally, change 1.0 and 0.7 below to affect Wipe gradient size and duration in seconds in IE5.5+:
var filterstring="progid:DXImageTransform.Microsoft.GradientWipe(GradientSize=1.0 Duration=0.7)";

if (preloadimg=="yes")
{
	for (x=0; x<dynimages.length; x++)
	{
		var myimage=new Image();
		myimage.src=dynimages[x][0];
	}
}

function returnimgcode(theimg)
{
	var imghtml="";
	if (theimg[0]!="" && theimg[1]!="")
		imghtml='<img src="'+theimg[0]+'" align="texttop" border="'+imgborderwidth+'" alt="'+theimg[1]+'">';
	if(theimg[1]!="")
		imghtml+='<br><font class="caption">'+theimg[1]+'</font>';
	return imghtml;
}

function modifyimage(loadarea, imgindex)
{
	if (document.getElementById)
	{
		var imgobj=document.getElementById(loadarea);
		if (imgobj.filters && window.createPopup)
		{
			imgobj.style.filter=filterstring;
			imgobj.filters[0].Apply();
		}
		imgobj.innerHTML=returnimgcode(dynimages[imgindex]);
		if (imgobj.filters && window.createPopup)
			imgobj.filters[0].Play();
		return false;
	}
}



// Function to "activate" images.
function imgOn(imgName) 
{
	document[imgName].src = eval(imgName + "on.src");
}

// Function to "deactivate" images.
function imgOff(imgName) 
{
	document[imgName].src = eval(imgName + "off.src");
}

function getDynaHeight(pagestr)
{
	if(pagestr!="")
	{
		if(pagestr == "index")
			document.write(dynaHeights[pagestr]);
		else
			document.write(dynaHeights[pagestr]);
	}
}



function StripSpacesFromEnds(s)
{
	// developed by willmaster.com
	while((s.indexOf(' ',0) == 0) && (s.length > 1))
	{
		s = s.substring(1,s.length);
	}
	while((s.lastIndexOf(' ') == (s.length - 1) && (s.length > 1)))
	{
		s = s.substring(0,(s.length - 1));
	}
	if((s.indexOf(' ',0) == 0) && (s.length == 1)) s = '';
	return s;
}

function IsItPresent(s,explanation)
{
	// developed by willmaster.com
	s = StripSpacesFromEnds(s);
	if(s.length) return s;
	alert('Please enter ' + explanation + '.');
	return '';
}

function CheckEmail(s_email)
{
	// developed by willmaster.com
	s_email = IsItPresent(s_email,'your email address');
	if(! s_email) return false;
	var i = s_email.indexOf(' ',0);
	while(i > -1)
	{
		s_email = s_email.substring(0,i) + 
			s_email.substring((i + 1),s_email.length);
		i = s_email.indexOf(' ',0);
	}
	document.formmail.email.value = s_email;
	if((s_email.length < 6) ||
	   (s_email.indexOf('@',0) < 1) ||
	   (s_email.lastIndexOf('@') != s_email.indexOf('@',0)) ||
	   (s_email.lastIndexOf('@') > (s_email.length - 5)) ||
	   (s_email.lastIndexOf('.') > (s_email.length - 3)) ||
	   (s_email.lastIndexOf('.') < (s_email.length - 4)) ||
	   (s_email.indexOf('..',0) > -1) ||
	   (s_email.indexOf('@.',0) > -1) ||
	   (s_email.indexOf('.@',0) > -1) ||
	   (s_email.indexOf(',',0) > -1))
	{
		alert('The email address "' + s_email + '" is not valid.');
		document.formmail.email.focus();
		return false;
	}
	return true;
}

function CheckRequiredFields() {
var errormessage = new String();
// Put field checks below this point.

if(WithoutContent(document.formmail.start_date.value))
	{ errormessage += "\n\nPlease select a \"Start date\"."; }
if(WithoutContent(document.formmail.number_of_days.value))
	{ errormessage += "\n\nPlease input the \"Number of Days\"."; }
if(WithoutContent(document.formmail.number_in_party.value))
	{ errormessage += "\n\nPlease input the \"Number of your Party\"."; }
//if(WithoutContent(document.formmail.firstName.value))
	//{ errormessage += "\n\nPlease input a \"First Name\"."; }
if(WithoutContent(document.formmail.realname.value))
	{ errormessage += "\n\nPlease input your \"name\"."; }
if(WithoutContent(document.formmail.day_phone.value))
	{ errormessage += "\n\nPlease input a \"Daytime Phone Number\"."; }
if(WithoutContent(document.formmail.evening_phone.value))
	{ errormessage += "\n\nPlease input a \"Evening Phone Number\"."; }
if(WithoutContent(document.formmail.email.value))
	{ errormessage += "\n\nPlease input a \"Email Address\"."; }
// Put field checks above this point.
if(errormessage.length > 2) {
	alert('NOTE:' + errormessage);
	return false;
	}
return true;
} // end of function CheckRequiredFields()


function checkReqContactUs() {
	var errormessage = new String();
	
	if(WithoutContent(document.formmail.email.value))
		{ errormessage += "\n\nPlease input a \"email address\"."; }
	if(WithoutContent(document.formmail.subject.value))
		{ errormessage += "\n\nPlease input a \"subject\"."; }
	if(WithoutContent(document.formmail.realname.value))
		{ errormessage += "\n\nPlease input your \"name\"."; }
	if(errormessage.length > 2) {
	alert('NOTE:' + errormessage);
	return false;
	}
	return true;
}


function WithoutContent(ss) {
if(ss.length > 0) { return false; }
return true;
}

//This is the menu stuff

/***********************************************
* Switch Menu script- by Martial B of http://getElementById.com/
* Modified by Dynamic Drive for format & NS4/IE4 compatibility
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var persistmenu="yes" //"yes" or "no". Make sure each SPAN content contains an incrementing ID starting at 1 (id="sub1", id="sub2", etc)
var persisttype="sitewide" //enter "sitewide" for menu to persist across site, "local" for this page only

if (document.getElementById){ //DynamicDrive.com change
document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('</style>\n')
}

function SwitchMenu(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change
		if(el.style.display != "block"){ //DynamicDrive.com change
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="submenu") //DynamicDrive.com change
				ar[i].style.display = "none";
			}
			el.style.display = "block";
		}else{
			el.style.display = "none";
		}
	}
}

function get_cookie(Name) { 
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { 
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function onloadfunction(){
if (persistmenu=="yes"){
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=get_cookie(cookiename)
if (cookievalue!="")
document.getElementById(cookievalue).style.display="block"
}
}

function savemenustate(){
var inc=1, blockid=""
while (document.getElementById("sub"+inc)){
if (document.getElementById("sub"+inc).style.display=="block"){
blockid="sub"+inc
break
}
inc++
}
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid
document.cookie=cookiename+"="+cookievalue
}

if (window.addEventListener)
window.addEventListener("load", onloadfunction, false)
else if (window.attachEvent)
window.attachEvent("onload", onloadfunction)
else if (document.getElementById)
window.onload=onloadfunction

if (persistmenu=="yes" && document.getElementById)
window.onunload=savemenustate

