/*
son of suckerfish menu script from:
http://www.htmldog.com/articles/suckerfish/dropdowns/
 */
 
 sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
			this.style.zIndex=200; //this line added to force flyout to be above relatively positioned stuff in IE
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

/**
 * 
 * @param {Image} img
 */
function isImageLoaded(img) {
	
    if (!img.complete && img.complete !== undefined) {

        return false;

    }

    if (typeof img.naturalWidth != "undefined" && img.naturalWidth == 0) {

        return false;

    }

    // No other way of checking: assume it's ok.
    return true;
	
}



window.onload = function() {

	for (var i = 0; i < document.images.length; i++) {
		
		if(document.images[i].src.indexOf("www.espc.com") > 0){
			
			if(!isImageLoaded(document.images[i])){
				
				document.images[i].src = "http://hunters-residential.co.uk/images/notavailable.gif";
				
			}
			
		}

	}
	
};