// JavaScript Document
function hoverIcon(i, d) {
	var icon = document.getElementById("i"+i);
	var cap = document.getElementById("icon-cap");
	var lable = document.getElementById("icon-cap-t");
	if(d == 1) {
		icon.style.backgroundPosition = (i*-57)+"px -57px";
		cap.style.top = "400px";
		var offset;
		if(i == 0) {
			lable.innerHTML = "GARAGE DOORS";
			offset = -404;
		} else if(i == 1) {
			lable.innerHTML = "GATES";
			offset = -289;
		} else if(i == 2) {
			lable.innerHTML = "GARAGE DOOR OPENERS";
			offset = -244;
		} else if(i == 3) {
			lable.innerHTML = "ACCESSORIES";
			offset = 310;
		} else if(i == 4) {
			lable.innerHTML = "INDUSTRIAL OPENERS";
			offset = 196;
		} else if(i == 5) {
			lable.innerHTML = "GATE OPENERS";
			offset = 123;
		}
		var leftPos = getBrowserWidthHeight().width/2+offset;
		if(!noVScroll()) leftPos -= 8;
		cap.style.left = leftPos+"px";
	} else {
		icon.style.backgroundPosition = (i*-57)+"px 0";
		cap.style.top = "-999px";
	}
}
function getBrowserWidthHeight() {
	var intH = 0;
	var intW = 0;
	if(typeof window.innerWidth  == 'number') {
		intH = window.innerHeight;
		intW = window.innerWidth;
	} else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
		intH = document.documentElement.clientHeight;
		intW = document.documentElement.clientWidth;
	} else if(document.body && (document.body.clientWidth || document.body.clientHeight)) {
		intH = document.body.clientHeight;
		intW = document.body.clientWidth;
	}
	return {width:parseInt(intW), height:parseInt(intH)};
}
function noVScroll() {
	var yScroll;
	if(window.innerHeight && window.scrollMaxY) {	
		yScroll = window.innerHeight+window.scrollMaxY;
	} else if(document.body.scrollHeight > document.body.offsetHeight) { // all but Explorer Mac
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		yScroll = document.body.offsetHeight;
	}
	var windowHeight;
	if(self.innerHeight) {	// all except Explorer
		windowHeight = self.innerHeight;
	} else if(document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowHeight = document.documentElement.clientHeight;
	} else if(document.body) { // other Explorers
		windowHeight = document.body.clientHeight;
	}	
	// for small pages with total height less then height of the viewport
	if(yScroll > windowHeight) {
		return false;
	} else { 
		return true;
	}
}