<!--
/* 	------------------------------------------
	XML Reader
	Written by Sheridan Gove
	© 2006 Copyright Sheridan Gove
	Customized for and Licensed to Glen Smith
---------------------------------------------- */

// Variables & Page Setup
// --------------------------------------------
var CURRENT_BROWSER = browserCheck();
var CURRENT_CLASS = classCheck();
var SELECTED_COTTAGE = 0;

function pageSetup(){
	importXML("navigation");
	importXML("cottageNav");
	importXML("home");
}

// Standard Reader Functions
// --------------------------------------------
function clearChildren(node){
	if(node!=null){
		while ( node.hasChildNodes() ) { node.removeChild(node.firstChild); }
	}
}
function setNav(node){
	var nodeAssociation = node.Association;
	
	if (nodeAssociation!='cottageNav'){
		importXML("cottageNav");
	} else {
		var nodeName = node.Name;
		var nodeParent = node.parentNode;
		var chCount = nodeParent.childNodes.length;
		var i = 0;
		while(i<chCount)
		{
			var currAssociation = nodeParent.childNodes[i].Association;
			var currName = nodeParent.childNodes[i].Name;
			if(currName!=undefined){
				if(currName==nodeName){
					nodeParent.childNodes[i].setAttribute(CURRENT_CLASS,'CottageLinkSelected');
					nodeParent.childNodes[i].onmouseover = function(){this.setAttribute(CURRENT_CLASS,'CottageLinkSelected');}
					nodeParent.childNodes[i].onmouseout = function(){this.setAttribute(CURRENT_CLASS,'CottageLinkSelected');}
				}else{
					nodeParent.childNodes[i].setAttribute(CURRENT_CLASS,'CottageLink');
					nodeParent.childNodes[i].onmouseover = function(){this.setAttribute(CURRENT_CLASS,'CottageLinkOver');}
					nodeParent.childNodes[i].onmouseout = function(){this.setAttribute(CURRENT_CLASS,'CottageLink');}
				}
			}
		   i++;
		}
	}
}
function importXML(CURRENT_XMLTYPE)
{
	if (document.implementation && document.implementation.createDocument)
	{
		switch(CURRENT_XMLTYPE){
			case "navigation":
				clearChildren(document.getElementById('pageNav'));
				xmlNav = document.implementation.createDocument("", "", null);
				xmlNav.onload = populateNavigation;
				xmlNav.load("documents/xml/navigation.xml");
				break
			case "cottageNav":
				clearChildren(document.getElementById('pageRight'));
				xmlCottageNav = document.implementation.createDocument("", "", null);
				xmlCottageNav.onload = populateCottageNav;
				xmlCottageNav.load("documents/xml/cottages.xml");
				break
			case "cottage":
				//clearChildren(document.getElementById('pageMid'));
				xmlCottage = document.implementation.createDocument("", "", null);
				xmlCottage.onload = populateCottage;
				xmlCottage.load("documents/xml/cottages.xml");
				break
			case "imageviewer":
				clearChildren(document.getElementById('pageMid'));
				xmlViewer = document.implementation.createDocument("", "", null);
				xmlViewer.onload = populateViewer;
				xmlViewer.load("documents/xml/imagelist.xml");
				break
			default:
				clearChildren(document.getElementById('pageMid'));
				xmlBody = document.implementation.createDocument("", "", null);
				xmlBody.onload = populateBody;
				xmlBody.load("documents/xml/" + CURRENT_XMLTYPE + ".xml");
				break
		}
	}
	else if (window.ActiveXObject)
	{
		switch(CURRENT_XMLTYPE){
			case "navigation":
				clearChildren(document.getElementById('pageNav'));
				xmlNav = new ActiveXObject("Microsoft.XMLDOM");
				xmlNav.onreadystatechange = function () {
					if (xmlNav.readyState == 4) populateNavigation();
				};
				xmlNav.load("documents/xml/navigation.xml");
				break
			case "cottageNav":
				clearChildren(document.getElementById('pageRight'));
				xmlCottageNav = new ActiveXObject("Microsoft.XMLDOM");
				xmlCottageNav.onreadystatechange = function () {
					if (xmlCottageNav.readyState == 4) populateCottageNav();
				};
				xmlCottageNav.load("documents/xml/cottages.xml");
				break
			case "cottage":
				//clearChildren(document.getElementById('pageMid'));
				xmlCottage = new ActiveXObject("Microsoft.XMLDOM");
				xmlCottage.onreadystatechange = function () {
					if (xmlCottage.readyState == 4) populateCottage();
				};
				xmlCottage.load("documents/xml/cottages.xml");
				break
			case "imageviewer":
				clearChildren(document.getElementById('pageMid'));
				xmlViewer = new ActiveXObject("Microsoft.XMLDOM");
				xmlViewer.onreadystatechange = function () {
					if (xmlViewer.readyState == 4) populateViewer();
				};
				xmlViewer.load("documents/xml/imagelist.xml");
				break
			default:
				clearChildren(document.getElementById('pageMid'));
				xmlBody = new ActiveXObject("Microsoft.XMLDOM");
				xmlBody.onreadystatechange = function () {
					if (xmlBody.readyState == 4) populateBody();
				};
				xmlBody.load("documents/xml/" + CURRENT_XMLTYPE + ".xml");
				break
		}
		
 	}
	else
	{
		alert('Our apologies but it appears your browser is incompatible with the features of this web page. Please ensure Javascript is enabled on your browser.');
		return;
	}
}
function populateBody(){
	var x = xmlBody.getElementsByTagName('item');
	for (i=0;i<x.length;i++)
	{	
		var itemImage,itemTitle,itemDate,itemDesc,itemEmail,itemLinkDisplay,itemLink;
		for (j=0;j<x[i].childNodes.length;j++)
		{
			if (x[i].childNodes[j].nodeType != 1) continue;
			var nName = x[i].childNodes[j].nodeName;
			var nValue = x[i].childNodes[j].firstChild.nodeValue;
			if (nName=="image"){itemImage=nValue;}
			if (nName=="title"){itemTitle=nValue;}
			if (nName=="date"){itemDate=nValue;}
			if (nName=="description"){itemDesc=nValue;}
			if (nName=="email"){itemEmail=nValue;}
			if (nName=="linkdisplay"){itemLinkDisplay=nValue;}
			if (nName=="link"){itemLink=nValue;}
		}
		var sectionDIV = document.createElement('DIV');
		sectionDIV.setAttribute(CURRENT_CLASS,'Section');
		
			if (itemImage!="-"&&itemImage!=undefined){
				var divItem = document.createElement('img');
				divItem.setAttribute(CURRENT_CLASS,'bodyImage');
				divItem.src = "images/" + itemImage;
				sectionDIV.appendChild(divItem);
			}
			if (itemDate!="-"&&itemDate!=undefined){
				var divItem = document.createElement('DIV');
				divItem.setAttribute(CURRENT_CLASS,'Date');
				var txtItem = document.createTextNode(itemDate);
				divItem.appendChild(txtItem);
				sectionDIV.appendChild(divItem);
			}
			if (itemTitle!="-"&&itemTitle!=undefined){
				var divItem = document.createElement('DIV');
				divItem.setAttribute(CURRENT_CLASS,'Title');
				var txtItem = document.createTextNode(itemTitle);
				divItem.appendChild(txtItem);
				sectionDIV.appendChild(divItem);
			}
			if (itemDesc!="-"&&itemDesc!=undefined){
				var divItem = document.createElement('DIV');
				var txtItem = document.createTextNode(itemDesc);
				divItem.appendChild(txtItem);
				sectionDIV.appendChild(divItem);
			}
			if (itemEmail!="-"&&itemEmail!=undefined){
				var divItem = document.createElement('a');
				divItem.href = "mailto:" + itemEmail;
				var txtItem = document.createTextNode(itemEmail);
				divItem.appendChild(txtItem);
				sectionDIV.appendChild(txtItem);
			}
			if (itemLink!="-"&&itemLink!=undefined){
				var divItem = document.createElement('div');
				divItem.setAttribute(CURRENT_CLASS,'Link');
				divItem.onmouseover = function(){this.setAttribute(CURRENT_CLASS,'LinkOver');}
				divItem.onmouseout = function(){this.setAttribute(CURRENT_CLASS,'Link');}
				divItem.onclick = function(){navOut(this.urlName);}
				divItem.urlName = itemLink;
				var txtItem;
				if (itemLinkDisplay!="-"&&itemLinkDisplay!=undefined) {txtItem = document.createTextNode(itemLinkDisplay);}else{txtItem = document.createTextNode(itemLink);}
				divItem.appendChild(txtItem);
				sectionDIV.appendChild(divItem);
			}
			
		document.getElementById('pageMid').appendChild(sectionDIV);
	}
}
// IMAGE VIEWER
//---------------------------------------------
function populateViewer(){
	var x = xmlViewer.getElementsByTagName('item');
	var defaultSet = false;
	for (i=0;i<x.length;i++)
	{	
		var bodyImage, bodyCottage;
		for (j=0;j<x[i].childNodes.length;j++)
		{
			if (x[i].childNodes[j].nodeType != 1) continue;
			var nName = x[i].childNodes[j].nodeName;
			var nValue = x[i].childNodes[j].firstChild.nodeValue;
			if (nName=="unitnumber"){bodyCottage=nValue;}
			if (nName=="filename"){bodyImage=nValue;}
		}
		if (SELECTED_COTTAGE==bodyCottage&&bodyCottage!="-"&&bodyCottage!=undefined&&bodyImage!="-"&&bodyImage!=undefined){
			if(defaultSet!=true){
				var ViewerDiv = document.createElement('DIV');
				ViewerDiv.setAttribute('id','ImageViewer');
				
				var vScreenDiv = document.createElement('DIV');
				vScreenDiv.setAttribute('id','ViewerScreen');
				ViewerDiv.appendChild(vScreenDiv);
				
				var vListDiv = document.createElement('DIV');
				vListDiv.setAttribute('id','ViewerList');
				ViewerDiv.appendChild(vListDiv);
				
				var vImageDiv = document.createElement('img');
				vImageDiv.setAttribute('id','ViewerImage');
				vImageDiv.count = 0;
				vImageDiv.alt = "";
				vImageDiv.src = "images/cottages/" + bodyCottage + "/" + bodyImage;
				//vImageDiv.onclick = function(){vImageDiv.count=vImageDiv.count+1;}
				vScreenDiv.appendChild(vImageDiv);
				
				var vItemDiv = document.createElement('img');
				vItemDiv.setAttribute('id','cot_' + bodyCottage);
				vItemDiv.Name = 'cot_' + bodyCottage;
				vItemDiv.alt = "";
				vItemDiv.src = "images/cottages/" + bodyCottage + "/" + bodyImage;
				vItemDiv.onmouseover = function(){vImageDiv.src=this.src;}
				//vItemDiv.onclick = function(){navIn(this.src);}
				vListDiv.appendChild(vItemDiv);
								
				defaultSet = true;
				
				document.getElementById('pageMid').appendChild(ViewerDiv);				
			} else {
				var vItemDiv = document.createElement('img');
				vItemDiv.setAttribute('id','cot_' + bodyCottage);
				vItemDiv.Name = 'cot_' + bodyCottage;
				vItemDiv.alt = "";
				vItemDiv.src = "images/cottages/" + bodyCottage + "/" + bodyImage;
				vItemDiv.onmouseover = function(){vImageDiv.src=this.src;}
				//vItemDiv.onclick = function(){navIn(this.src);}
				vListDiv.appendChild(vItemDiv);
			}
			
		}
	}
	importXML('cottage');
}
// Populate Cottage
//---------------------------------------------
function populateCottage(){
	var x = xmlCottage.getElementsByTagName('item');
	for (i=0;i<x.length;i++)
	{	
		var bodyUnitNumber,bodyTitle,bodyDesc,bodyAmen,bodyBedrooms,bodySleeps,bodyBeds,bodySmoking,bodyPets,bodyRate1,bodyRate2,bodyRate3,bodyRate4,bodyRate5,bodyCalendar,bodyContact,bodyHomePhone,bodyCellPhone,bodyBusinessPhone,bodyOtherPhone,bodyEmail,bodyMasterCard,bodyVisa,bodyDiscover,bodyCash,bodyCheck;		
		for (j=0;j<x[i].childNodes.length;j++)
		{
			if (x[i].childNodes[j].nodeType != 1) continue;
			var nName = x[i].childNodes[j].nodeName;
			var nValue = x[i].childNodes[j].firstChild.nodeValue;
			if (nName=="unitnumber"){bodyUnitNumber=nValue;}
			if (nName=="title"){bodyTitle=nValue;}
			if (nName=="description"){bodyDesc=nValue;}
			if (nName=="amenities"){bodyAmen=nValue;}
			if (nName=="bedrooms"){bodyBedrooms=nValue;}
			if (nName=="sleeps"){bodySleeps=nValue;}
			if (nName=="bedsetup"){bodyBeds=nValue;}
			if (nName=="smoking"){bodySmoking=nValue;}
			if (nName=="pets"){bodyPets=nValue;}
			if (nName=="rate1"){bodyRate1=nValue;}
			if (nName=="rate2"){bodyRate2=nValue;}
			if (nName=="rate3"){bodyRate3=nValue;}
			if (nName=="rate4"){bodyRate4=nValue;}
			if (nName=="rate5"){bodyRate5=nValue;}
			if (nName=="calendar"){bodyCalendar=nValue;}
			if (nName=="contact"){bodyContact=nValue;}
			if (nName=="homephone"){bodyHomePhone=nValue;}
			if (nName=="cellphone"){bodyCellPhone=nValue;}
			if (nName=="businessphone"){bodyBusinessPhone=nValue;}
			if (nName=="otherphone"){bodyOtherPhone=nValue;}
			if (nName=="email"){bodyEmail=nValue;}
			if (nName=="mastercard"){bodyMasterCard=nValue;}
			if (nName=="visa"){bodyVisa=nValue;}
			if (nName=="discover"){bodyDiscover=nValue;}
			if (nName=="cash"){bodyCash=nValue;}
			if (nName=="check"){bodyCheck=nValue;}
		}
		if (SELECTED_COTTAGE==bodyUnitNumber){
				var sectionDIV = document.createElement('DIV');
				sectionDIV.setAttribute(CURRENT_CLASS,'SmallSection');
				
				var titleDIV = document.createElement('DIV');
				titleDIV.setAttribute(CURRENT_CLASS,'Title');
				var txtTitle = document.createTextNode("Details");
				titleDIV.appendChild(txtTitle);
				sectionDIV.appendChild(titleDIV);
				
				if (bodyUnitNumber!="-"&&bodyUnitNumber!=undefined){
					var titleDIV = document.createElement('DIV');
					var txtTitle = document.createTextNode("Cottage #" + bodyUnitNumber);
					titleDIV.appendChild(txtTitle);
					sectionDIV.appendChild(titleDIV);
				}
				if (bodyBedrooms!="-"&&bodyBedrooms!=undefined){
					var titleDIV = document.createElement('DIV');
					var txtTitle = document.createTextNode("Bedrooms: " + bodyBedrooms);
					titleDIV.appendChild(txtTitle);
					sectionDIV.appendChild(titleDIV);
				}
				if (bodySleeps!="-"&&bodySleeps!=undefined){
					var titleDIV = document.createElement('DIV');
					var txtTitle = document.createTextNode("Sleeps: " + bodySleeps);
					titleDIV.appendChild(txtTitle);
					sectionDIV.appendChild(titleDIV);
				}
				if (bodyBeds!="-"&&bodyBeds!=undefined){
					var titleDIV = document.createElement('DIV');
					var txtTitle = document.createTextNode("Beds: " + bodyBeds);
					titleDIV.appendChild(txtTitle);
					sectionDIV.appendChild(titleDIV);
				}
				if (bodySmoking!="-"&&bodySmoking!=undefined){
					var titleDIV = document.createElement('DIV');
					var txtTitle = document.createTextNode("Smoking: " + bodySmoking);
					titleDIV.appendChild(txtTitle);
					sectionDIV.appendChild(titleDIV);
				}
				if (bodyPets!="-"&&bodyPets!=undefined){
					var titleDIV = document.createElement('DIV');
					var txtTitle = document.createTextNode("Pets: " + bodyPets);
					titleDIV.appendChild(txtTitle);
					sectionDIV.appendChild(titleDIV);
				}
				
			document.getElementById('pageMid').appendChild(sectionDIV);
			
			var sectionDIV = document.createElement('DIV');
			sectionDIV.setAttribute(CURRENT_CLASS,'SmallSection');
				
				var titleDIV = document.createElement('DIV');
				titleDIV.setAttribute(CURRENT_CLASS,'Title');
				var txtTitle = document.createTextNode("Rates");
				titleDIV.appendChild(txtTitle);
				sectionDIV.appendChild(titleDIV);
				
				if (bodyRate1!="-"&&bodyRate1!=undefined){
					var titleDIV = document.createElement('DIV');
					var txtTitle = document.createTextNode(bodyRate1);
					titleDIV.appendChild(txtTitle);
					sectionDIV.appendChild(titleDIV);
				}
				if (bodyRate2!="-"&&bodyRate2!=undefined){
					var titleDIV = document.createElement('DIV');
					var txtTitle = document.createTextNode(bodyRate2);
					titleDIV.appendChild(txtTitle);
					sectionDIV.appendChild(titleDIV);
				}
				if (bodyRate3!="-"&&bodyRate3!=undefined){
					var titleDIV = document.createElement('DIV');
					var txtTitle = document.createTextNode(bodyRate3);
					titleDIV.appendChild(txtTitle);
					sectionDIV.appendChild(titleDIV);
				}
				if (bodyRate4!="-"&&bodyRate4!=undefined){
					var titleDIV = document.createElement('DIV');
					var txtTitle = document.createTextNode(bodyRate4);
					titleDIV.appendChild(txtTitle);
					sectionDIV.appendChild(titleDIV);
				}
				if (bodyRate5!="-"&&bodyRate5!=undefined){
					var titleDIV = document.createElement('DIV');
					var txtTitle = document.createTextNode(bodyRate5);
					titleDIV.appendChild(txtTitle);
					sectionDIV.appendChild(titleDIV);
				}
				
			document.getElementById('pageMid').appendChild(sectionDIV);
				
			var sectionDIV = document.createElement('DIV');
			sectionDIV.setAttribute(CURRENT_CLASS,'SmallSection');
				
				var titleDIV = document.createElement('DIV');
				titleDIV.setAttribute(CURRENT_CLASS,'Title');
				var txtTitle = document.createTextNode("Payment Options");
				titleDIV.appendChild(txtTitle);
				sectionDIV.appendChild(titleDIV);
			
				if (bodyMasterCard.toUpperCase()=="YES"){
					var divImage = document.createElement('img');
					divImage.alt = "MasterCard";
					divImage.setAttribute(CURRENT_CLASS,'imgIcon');
					divImage.src = "images/site/ico_mastercard.gif";
					sectionDIV.appendChild(divImage);
				}
				if (bodyVisa.toUpperCase()=="YES"){
					var divImage = document.createElement('img');
					divImage.alt = "Visa";
					divImage.setAttribute(CURRENT_CLASS,'imgIcon');
					divImage.src = "images/site/ico_visa.gif";
					sectionDIV.appendChild(divImage);
				}
				if (bodyDiscover.toUpperCase()=="YES"){
					var divImage = document.createElement('img');
					divImage.alt = "Discover";
					divImage.setAttribute(CURRENT_CLASS,'imgIcon');
					divImage.src = "images/site/ico_discover.gif";
					sectionDIV.appendChild(divImage);
				}
				if (bodyCash.toUpperCase()=="YES"){
					var divImage = document.createElement('img');
					divImage.alt = "Cash";
					divImage.setAttribute(CURRENT_CLASS,'imgIcon');
					divImage.src = "images/site/ico_cash.gif";
					sectionDIV.appendChild(divImage);
				}
				if (bodyCheck.toUpperCase()=="YES"){
					var divImage = document.createElement('img');
					divImage.alt = "Check & Money Order";
					divImage.setAttribute(CURRENT_CLASS,'imgIcon');
					divImage.src = "images/site/ico_check.gif";
					sectionDIV.appendChild(divImage);
				}
				if (bodyCalendar!="-"&&bodyCalendar!=undefined){
					var divImage = document.createElement('img');
					divImage.alt = "";
					divImage.navout = bodyCalendar;
					divImage.src = "images/site/btn_availability_blue.gif";
					divImage.srcOne = "images/site/btn_availability_blue.gif";
					divImage.srcTwo = "images/site/btn_availability_green.gif";
					divImage.onclick = function(){navOut(this.navout);}
					divImage.onmouseover = function(){this.setAttribute('src',this.srcTwo);}
					divImage.onmouseout = function(){this.setAttribute('src',this.srcOne);}
					sectionDIV.appendChild(divImage);
				}

			document.getElementById('pageMid').appendChild(sectionDIV);
			
			var lineDIV = document.createElement('img');
			lineDIV.src = "images/site/bit_6699cc.gif";
			lineDIV.setAttribute('width','480');
			lineDIV.setAttribute('height','2');
			document.getElementById('pageMid').appendChild(lineDIV);
			
			var lineDIV = document.createElement('img');
			lineDIV.src = "images/site/bit_clear.gif";
			lineDIV.setAttribute('width','480');
			lineDIV.setAttribute('height','5');
			document.getElementById('pageMid').appendChild(lineDIV);
			
			var sectionDIV = document.createElement('DIV');
			sectionDIV.setAttribute(CURRENT_CLASS,'Section');
				
				var titleDIV = document.createElement('DIV');
				titleDIV.setAttribute(CURRENT_CLASS,'Title');
				var txtTitle = document.createTextNode(bodyTitle);
				titleDIV.appendChild(txtTitle);
				sectionDIV.appendChild(titleDIV);
			
				if (bodyDesc!="-"&&bodyDesc!=undefined){
					var titleDIV = document.createElement('DIV');
					var txtTitle = document.createTextNode(bodyDesc);
					titleDIV.appendChild(txtTitle);
					sectionDIV.appendChild(titleDIV);
				}
			
			document.getElementById('pageMid').appendChild(sectionDIV);

			var sectionDIV = document.createElement('DIV');
			sectionDIV.setAttribute(CURRENT_CLASS,'Section');
				
				var titleDIV = document.createElement('DIV');
				titleDIV.setAttribute(CURRENT_CLASS,'Title');
				var txtTitle = document.createTextNode("Amenities");
				titleDIV.appendChild(txtTitle);
				sectionDIV.appendChild(titleDIV);
				
				if (bodyAmen!="-"&&bodyAmen!=undefined){
					var titleDIV = document.createElement('DIV');
					var txtTitle = document.createTextNode(bodyAmen);
					titleDIV.appendChild(txtTitle);
					sectionDIV.appendChild(titleDIV);
				}							
				
			document.getElementById('pageMid').appendChild(sectionDIV);
						
			var sectionDIV = document.createElement('DIV');
			sectionDIV.setAttribute(CURRENT_CLASS,'Section');
				
				var titleDIV = document.createElement('DIV');
				titleDIV.setAttribute(CURRENT_CLASS,'Title');
				var txtTitle = document.createTextNode("Contact Information");
				titleDIV.appendChild(txtTitle);
				sectionDIV.appendChild(titleDIV);
				
				if (bodyContact!="-"&&bodyContact!=undefined){
					var titleDIV = document.createElement('DIV');
					var txtTitle = document.createTextNode("Contact: " + bodyContact);
					titleDIV.appendChild(txtTitle);
					sectionDIV.appendChild(titleDIV);
				}
				if (bodyHomePhone!="-"&&bodyHomePhone!=undefined){
					var titleDIV = document.createElement('DIV');
					var txtTitle = document.createTextNode("Home Phone: " + bodyHomePhone);
					titleDIV.appendChild(txtTitle);
					sectionDIV.appendChild(titleDIV);
				}
				if (bodyCellPhone!="-"&&bodyCellPhone!=undefined){
					var titleDIV = document.createElement('DIV');
					var txtTitle = document.createTextNode("Cell Phone: " + bodyCellPhone);
					titleDIV.appendChild(txtTitle);
					sectionDIV.appendChild(titleDIV);
				}
				if (bodyBusinessPhone!="-"&&bodyBusinessPhone!=undefined){
					var titleDIV = document.createElement('DIV');
					var txtTitle = document.createTextNode("Work Phone: " + bodyBusinessPhone);
					titleDIV.appendChild(txtTitle);
					sectionDIV.appendChild(titleDIV);
				}
				if (bodyOtherPhone!="-"&&bodyOtherPhone!=undefined){
					var titleDIV = document.createElement('DIV');
					var txtTitle = document.createTextNode("Other Phone: " + bodyOtherPhone);
					titleDIV.appendChild(txtTitle);
					sectionDIV.appendChild(titleDIV);
				}
				/*if (bodyEmail!="-"&&bodyEmail!=undefined){
					var emailSpan = document.createElement('a');
					emailSpan.setAttribute(CURRENT_CLASS,'Link');
					emailSpan.href = "mailto:" + bodyEmail;
					var txtEmail = document.createTextNode("Email: " + bodyEmail);
					emailSpan.appendChild(txtEmail);
					sectionDIV.appendChild(emailSpan);
				}*/
				
			document.getElementById('pageMid').appendChild(sectionDIV);
			
			//if (bodyEmail!="-"&&bodyEmail!=undefined){displayContact(bodyEmail);}
		}
	}
}
// Navigation
// --------------------------------------------
function populateNavigation(){
	var x = xmlNav.getElementsByTagName('item');
	
	var imgIMG = document.createElement('img');
	imgIMG.Association = 'home';
	imgIMG.src = 'images/site/weirsbeach.jpg';
	imgIMG.onclick = function(){setNav(this);importXML(this.Association);}
	imgIMG.setAttribute(CURRENT_CLASS,'NavImage');
	imgIMG.onmouseover = function(){this.setAttribute(CURRENT_CLASS,'NavImageOver');}
	imgIMG.onmouseout = function(){this.setAttribute(CURRENT_CLASS,'NavImage');}
	document.getElementById('pageNav').appendChild(imgIMG);
	
	for (i=0;i<x.length;i++)
	{
		var linkName,linkAssociation;
		for (j=0;j<x[i].childNodes.length;j++)
		{
			if (x[i].childNodes[j].nodeType != 1) continue;
			var nName = x[i].childNodes[j].nodeName;
			var nValue = x[i].childNodes[j].firstChild.nodeValue;
			if (nName=="name"){linkName=nValue;}
			if (nName=="association"){linkAssociation=nValue;}
		}
		var newDiv = document.createElement('DIV');
		newDiv.Association = linkAssociation;
		newDiv.Name = linkName;
		newDiv.setAttribute(CURRENT_CLASS,'NavLink')
		newDiv.onmouseover = function(){this.setAttribute(CURRENT_CLASS,'NavLinkOver');}
		newDiv.onmouseout = function(){this.setAttribute(CURRENT_CLASS,'NavLink');}
		newDiv.onclick = function(){setNav(this);importXML(this.Association);}
		var textName = document.createTextNode(linkName);
		newDiv.appendChild(textName);
		document.getElementById('pageNav').appendChild(newDiv);
	}
}
// Cottage Navigation
// --------------------------------------------
function populateCottageNav(){
	var x = xmlCottageNav.getElementsByTagName('item');
	
	var titleDIV = document.createElement('DIV');
	titleDIV.setAttribute(CURRENT_CLASS,'RightTitle')
	var txtTitle = document.createTextNode("Cottage Rentals");
	titleDIV.appendChild(txtTitle);
	document.getElementById('pageRight').appendChild(titleDIV);
	
	for (i=0;i<x.length;i++)
	{
		var cotNumber,cotSleeps,cotImage;
		for (j=0;j<x[i].childNodes.length;j++)
		{
			if (x[i].childNodes[j].nodeType != 1) continue;
			var nName = x[i].childNodes[j].nodeName;
			var nValue = x[i].childNodes[j].firstChild.nodeValue;
			if (nName=="unitnumber"){cotNumber=nValue;}
			if (nName=="mainimage"){cotImage=nValue;}
			if (nName=="sleeps"){cotSleeps=nValue;}
		}
		
		var cottageDiv = document.createElement('div');
		cottageDiv.Association = "cottageNav";
		cottageDiv.Unit = cotNumber;
		cottageDiv.Name = "nav_" + cotNumber;
		cottageDiv.setAttribute(CURRENT_CLASS,'CottageLink');
		cottageDiv.onmouseover = function(){this.setAttribute(CURRENT_CLASS,'CottageLinkOver');}
		cottageDiv.onmouseout = function(){this.setAttribute(CURRENT_CLASS,'CottageLink');}
		cottageDiv.onclick = function(){SELECTED_COTTAGE=this.Unit;setNav(this);importXML("imageviewer");}
	
		if (cotImage!="-"&&cotImage!=undefined){
			var divImage = document.createElement('img');
			divImage.Name = "Cottage" + cotNumber;
			divImage.src = "images/cottages/" + cotNumber + "/" + cotImage;
			cottageDiv.appendChild(divImage);
		} 
		
		var txtText = document.createTextNode("Cottage " + cotNumber);
		cottageDiv.appendChild(txtText);
		var txtBR = document.createElement('br');
		cottageDiv.appendChild(txtBR);
		var txtText = document.createTextNode("Sleeps " + cotSleeps);
		cottageDiv.appendChild(txtText);

		document.getElementById('pageRight').appendChild(cottageDiv);
	}
}
// Standard Functions
// --------------------------------------------
function navOut(x){
	var strURL="HTTP://" + x;
	var openWindow = window.open(strURL,"TempWindow",'top=10,left=10,width=830,height=600,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes');
	openWindow.focus();
}
function navIn(x){
	var openWindow = window.open(x,"TempWindow",'top=10,left=10,width=600,height=400,toolbar=yes,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes');
	openWindow.focus();
}
function browserCheck(){
	var browserName = navigator.appName;
	if(browserName=="Microsoft Internet Explorer"){return 0;}else{return 1;}
}
function classCheck(){
	var browserName = navigator.appName;
	if(browserName=="Microsoft Internet Explorer"){return "className";}else{return "class";}
}
function randomID(){
	do{
		var randomNumber = Math.floor(Math.random()*100000000);
	} while (document.getElementById(randomNumber)!=null)
	return randomNumber;
}
function openFileBox(sentFile){
	var fileID = randomID();
	var displayID = "sub" + fileID;
	var newFileBox = document.createElement('DIV');
	newFileBox.setAttribute('id',fileID);
	newFileBox.setAttribute(CURRENT_CLASS,'fileBox');
	
	var newFileNav = document.createElement('DIV');
	newFileNav.setAttribute(CURRENT_CLASS,'fileNavbar');
	newFileBox.appendChild(newFileNav);
	
	var newFileNavClose = document.createElement("img");
	newFileNavClose.setAttribute('src','images/buttons/box-x.gif');
	newFileNavClose.onclick = function(){document.body.removeChild(newFileBox);}
	newFileNavClose.setAttribute(CURRENT_CLASS,'fileNavButton');
	newFileNav.appendChild(newFileNavClose);
	
	var newFileDisplay = document.createElement('iframe');
	newFileDisplay.setAttribute('id',displayID);
	newFileDisplay.setAttribute(CURRENT_CLASS,'fileDisplay');
	newFileDisplay.setAttribute('src',sentFile);
	newFileDisplay.frameBorder = 0;
	newFileDisplay.scrolling = 'yes';
	newFileBox.appendChild(newFileDisplay);
	
	document.body.appendChild(newFileBox);
	
	newFileBox.style.visibility = "visible";
}
// CONTACT FORM
// --------------------------------------------
function displayContact(xEmail){
	var sectionDIV = document.createElement('DIV');
	sectionDIV.setAttribute(CURRENT_CLASS,'Section');
		
	var titleDIV = document.createElement('DIV');
	titleDIV.setAttribute(CURRENT_CLASS,'Title');
	var txtTitle = document.createTextNode("Quick Contact Form");
	titleDIV.appendChild(txtTitle);
	sectionDIV.appendChild(titleDIV);
	
	var contactForm = document.createElement('form');
	contactForm.action = "http://www.jebrel.com/solutions/F2TEX/F2TEX.asp";
	contactForm.method = "post";
	contactForm.name = "F2TEX";
	contactForm.id = "F2TEX";
	
	var hiddenType = document.createElement('input');
	hiddenType.type = "hidden";
	hiddenType.name = "PARSETYPE";
	hiddenType.value = "EMAIL";
	contactForm.appendChild(hiddenType);
	
	var hiddenPath = document.createElement('input');
	hiddenPath.type = "hidden";
	hiddenPath.name = "DATAPATH";
	hiddenPath.value = "";
	contactForm.appendChild(hiddenPath);
	
	var hiddenRedirect = document.createElement('input');
	hiddenRedirect.type = "hidden";
	hiddenRedirect.name = "REDIRECTTO";
	hiddenRedirect.value = "http://www.holidaybaycottages.com";
	contactForm.appendChild(hiddenRedirect);
	
	var hiddenEmail = document.createElement('input');
	hiddenEmail.type = "hidden";
	hiddenEmail.name = "EMAILTO";
	hiddenEmail.value = xEmail;
	contactForm.appendChild(hiddenEmail);
	
	var hiddenContact = document.createElement('input');
	hiddenContact.type = "hidden";
	hiddenContact.name = "From";
	hiddenContact.value = "Contact Form for Cottage " + SELECTED_COTTAGE;
	contactForm.appendChild(hiddenContact);
	
	var titleDIV = document.createElement('DIV');
	var txtTitle = document.createTextNode("Name");
	titleDIV.appendChild(txtTitle);
	contactForm.appendChild(titleDIV);
	
	var inputName = document.createElement('input');
	inputName.type = "text";
	inputName.name = "Name";
	contactForm.appendChild(inputName);
	
	var titleDIV = document.createElement('DIV');
	var txtTitle = document.createTextNode("Email");
	titleDIV.appendChild(txtTitle);
	contactForm.appendChild(titleDIV);
	
	var inputEmail = document.createElement('input');
	inputEmail.type = "text";
	inputEmail.name = "Email";
	contactForm.appendChild(inputEmail);
	
	var titleDIV = document.createElement('DIV');
	var txtTitle = document.createTextNode("Message");
	titleDIV.appendChild(txtTitle);
	contactForm.appendChild(titleDIV);
	
	var inputMessage = document.createElement('textarea');
	inputMessage.rows = 10;
	inputMessage.name = "Message";
	contactForm.appendChild(inputMessage);
	
	var titleDIV = document.createElement('DIV');
	
	var buttonSubmit = document.createElement('img');
	buttonSubmit.src = "images/site/btn_blue.gif";
	buttonSubmit.srcOut = "images/site/btn_blue.gif";
	buttonSubmit.srcOver = "images/site/btn_green.gif";
	buttonSubmit.setAttribute(CURRENT_CLASS,'Link');
	buttonSubmit.onmouseover = function(){this.setAttribute('src',this.srcOver);this.setAttribute(CURRENT_CLASS,'LinkOver');}
	buttonSubmit.onmouseout = function(){this.setAttribute('src',this.srcOut);this.setAttribute(CURRENT_CLASS,'Link');}
	buttonSubmit.alt = "Submit Form";
	buttonSubmit.onclick = function(){if(inputName.value!=""&&inputEmail.value!=""&&inputMessage.value!=""){contactForm.submit();};}
	titleDIV.appendChild(buttonSubmit);
	contactForm.appendChild(buttonSubmit);
	
	var titleDIV = document.createElement('DIV');
	titleDIV.setAttribute(CURRENT_CLASS,'Note');
	var txtTitle = document.createTextNode("Your message will be automatically emailed and you will be returned to the home page. Please note all fields are required for form submission.");
	titleDIV.appendChild(txtTitle);
	contactForm.appendChild(titleDIV);
	
	sectionDIV.appendChild(contactForm);
	
	document.getElementById('pageMid').appendChild(sectionDIV);
}
-->