// Rollovers
window.onload = rolloverInit,preloadImages;
//Only allow images to rollover if they are in the nav ul.
function rolloverInit() {
	for(var i=0; i<document.images.length; i++) {
			if (document.images[i].parentNode.tagName == "A") {
				if (document.images[i].parentNode.parentNode.parentNode.id == "nav") {
			setupRollover(document.images[i]);
				}
		}
	}
}

function setupRollover(thisImage) {
	thisImage.outImage = new Image();
	thisImage.outImage.src = thisImage.src;
	thisImage.onmouseout = rollOut;
	
	thisImage.overImage = new Image();
	thisImage.overImage.src = "http://golf.hiltonheadvacation.com/wp-content/themes/golfblog/images/" + thisImage.id + "-over.jpg";
	thisImage.onmouseover = rollOver;
}

function rollOver() {
	this.src = this.overImage.src;
}

function rollOut() {
	this.src = this.outImage.src;
}


var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		golf_packages_over = newImage("http://golf.hiltonheadvacation.com/wp-content/themes/golfblog/images/golf_packages-over.jpg");
		course_info_over = newImage("http://golf.hiltonheadvacation.com/wp-content/themes/golfblog/images/course_info-over.jpg");
		lodging_info_over = newImage("http://golf.hiltonheadvacation.com/wp-content/themes/golfblog/images/lodging_info-over.jpg");
		area_info_over = newImage("http://golf.hiltonheadvacation.com/wp-content/themes/golfblog/images/area_info-over.jpg");
		golf_lessons_over = newImage("http://golf.hiltonheadvacation.com/wp-content/themes/golfblog/images/golf_lessons-over.jpg");
		request_quote_over = newImage("http://golf.hiltonheadvacation.com/wp-content/themes/golfblog/images/request_quote-over.jpg");
		about_us_over = newImage("http://golf.hiltonheadvacation.com/wp-content/themes/golfblog/images/about_us-over.jpg");
		home_over = newImage("http://golf.hiltonheadvacation.com/wp-content/themes/golfblog/images/home-over.jpg");
		preloadFlag = true;
	}
}
//Bookmark This Page
var urlAddress = "http://golf.hiltonheadvacation.com/"; 
var pageName = "Hilton Head Rentals and Golf"; 
function addToFavorites() { if (window.external) { window.external.AddFavorite(urlAddress,pageName) 
} else { alert("Sorry! Your browser doesn't support this function."); 
} } 

// JavaScript for Navigation
sfHover = function() {
	var sfEls = document.getElementById("nav").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"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);