// JavaScript for opening external links in XHTML document

function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}

// JavaScript for suckerfish drop-downs <http://www.htmldog.com/articles/suckerfish/>
sfHover = function() {
	var sfEls = document.getElementById("navMain").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}

// JavaScript for loading above functions into the page
var PageInitializer = {
    start : function(){
        PageInitializer.addLoadEvent(function(){
            //Add Functions Here
			externalLinks();
			var FO = { movie:"/flash/slideshow.swf", width:"361", height:"255", majorversion:"7", build:"0", wmode:"transparent", flashvars:"xmlFeedURL=/flash/imageSet.xml" };
			if(document.getElementsByTagName("body")[0].className=="pgHorse"){
				FO = { movie:"/flash/slideshow.swf", width:"361", height:"255", majorversion:"7", build:"0", wmode:"transparent", flashvars:"xmlFeedURL=/flash/horseImageSet.xml" };	
			}
			if(document.getElementsByTagName("body")[0].className=="pgLodging"){
				FO = { movie:"/flash/slideshow.swf", width:"361", height:"255", majorversion:"7", build:"0", wmode:"transparent", flashvars:"xmlFeedURL=/flash/lodgingsImageSet.xml" };	
			}
			if(document.getElementsByTagName("body")[0].className=="pgFishing"){
				FO = { movie:"/flash/slideshow.swf", width:"361", height:"255", majorversion:"7", build:"0", wmode:"transparent", flashvars:"xmlFeedURL=/flash/fishingImageSet.xml" };	
			}
			if(document.getElementsByTagName("body")[0].className=="pgHunting"){
				FO = { movie:"/flash/slideshow.swf", width:"361", height:"255", majorversion:"7", build:"0", wmode:"transparent", flashvars:"xmlFeedURL=/flash/huntingImageSet.xml" };	
			}
			UFO.create(FO, "ufo");
			//sfHover();
        });
    },
    addLoadEvent:function(f){var w=window;var o=w.onload;if(typeof w.onload!='function'){w.onload=f;}else{w.onload=function(){o();f();}}}
}
PageInitializer.start();
