function getWindowHeight() {
	var windowHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	}
	else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		}
		else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
			else {
				if (document.all && document.documentElement.clientHeight) {
					windowHeight = document.documentElement.clientHeight;
				}
			}
		}
	}
	return windowHeight;
}

function setFooter() {
	if (document.getElementById) {
		var windowHeight = getWindowHeight();
		if (windowHeight > 0) {
			var contentHeight = document.getElementById('content').offsetHeight;
			var footerElement = document.getElementById('footer');
			var footerHeight  = footerElement.offsetHeight;
			var headerHeight  = document.getElementById('header').offsetHeight;
			if (windowHeight - (contentHeight + footerHeight + headerHeight) >= 0) {
				footerElement.style.position = 'relative';
				footerElement.style.top = (windowHeight - (contentHeight + footerHeight + headerHeight)) + 'px';
			}
			else {
				footerElement.style.position = 'static';
			}
		}
	}
}

function resize_iframe() {
	var height=getWindowHeight();
	var headH=document.getElementById("header").offsetHeight;
	var footH=document.getElementById("footer").offsetHeight;
	var conOff=document.getElementById("maincontent").offsetTop;
	document.getElementById("centerframe").style.height=parseInt(height-headH-footH-30)+"px";
	//document.getElementById("centerframe").style.height= conHeight - 30 + "px";

}

function highlight(group) {
	//group must pass in the images you want off, not on!
	for (i = 0; i < group.length; i++) {
		setOpacity(group[i], 10 );
	}		
}

function offlight() {
	var off = ["alpr","ceil","chic","deco","fell","form","gkd","gord","lamc","mech","cool","hyte","acgi","bost","petr","roxu","tect","tres","topb","werz","vm-z",'m-sh','wall','orna','arc ', 'ther', 'dri-', 'arch','east'];
	for (i = 0; i < off.length; i++) {
		setOpacity(off[i], 100 );
	}		
}

function setOpacity(object, opacity) {
	obj = parent.top.document.getElementById(object);
	if (obj == null) return;
	opacity = (opacity == 100)?99.999:opacity;
	// IE/Win
	obj.style.filter = "alpha(opacity:"+opacity+")";
	// Older Mozilla and Firefox
	obj.style.MozOpacity = opacity/100;
	// Safari 1.2, newer Firefox and Mozilla, CSS3
	obj.style.opacity = opacity/100;
}

function pop(loc,w,h) {
	w = window.open(loc,'','toolbar=1,scrollbars=1,menubar=1,location=0,resizable=yes,directories=0,status=0,width='+w+',height='+h+',left=100,top=0');
	w.focus();
}

function tweak_level(opacity, element) {
	obj = document.getElementById(element)
	obj.style.zIndex = "1";
	opacity = (opacity == 100)?99.999:opacity;
	// IE/Win
	obj.style.filter = "alpha(opacity:"+opacity+")";
	// Older Mozilla and Firefox
	obj.style.MozOpacity = opacity/100;
	// Safari 1.2, newer Firefox and Mozilla, CSS3
	obj.style.opacity = opacity/100;
}

function load_fullpix() {
	thumbArray = document.getElementsByName("thumbpix");
	thumbCount = thumbArray.length;
	for (var i=0; i<thumbCount; i++) {
		imgElement = thumbArray[i];
		imgElement.src = imgPrefix + imgElement.id + ".jpg";
		//alert(imgElement.src);
	}
	pixArray = document.getElementsByName("fullpix");
	pixCount = pixArray.length;
	for (i=0; i<pixCount; i++) {
		imgElement = pixArray[i];
		imgElement.src = imgPrefix + imgElement.id + ".jpg";
		//alert(imgElement.src);
	}
}
function wakesub(subID) {
	if (! BROWSER_IE7 && ! BROWSER_IE8) return;
	if (subID == top.submenuUp) return;
	sleepsub();
	submenu = document.getElementById(subID);
	submenu.style.display="block";	
	top.submenuUp = subID;
}
function sleepsub() {
	if (! BROWSER_IE7 && ! BROWSER_IE8) return;
	if (top.submenuUp == null) return;
	submenu = top.frames[0].document.getElementById(top.submenuUp);
	submenu.style.display="none";	
}
