var Gproduct;
 
 
function f_clientWidth() {
	return f_filterResults (
		window.innerWidth ? window.innerWidth : 0,
		document.documentElement ? document.documentElement.clientWidth : 0,
		document.body ? document.body.clientWidth : 0
	);
}
function f_clientHeight() {
	return f_filterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}
function f_scrollLeft() {
	return f_filterResults (
		window.pageXOffset ? window.pageXOffset : 0,
		document.documentElement ? document.documentElement.scrollLeft : 0,
		document.body ? document.body.scrollLeft : 0
	);
}

function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}

function f_filterResults(n_win, n_docel, n_body) {
var n_result = n_win ? n_win : 0;
// alert("n_win : " + n_win);
// alert("n_docel : " + n_docel);
// alert("n_body : " + n_body);
// alert("n_result : " + n_result);

	
if (n_docel && (!n_result || (n_result > n_docel))) { n_result = n_docel; }
return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
// return n_result ? n_result : n_docel;

}
 

function prodpop(imgname) {
	document.getElementById('prodpop').style.top = f_scrollTop() + 200 + "px";
	document.getElementById('greyout').style.top = f_scrollTop() + "px";
	
	
	div = document.getElementById("prodpop");
	div.innerHTML = '<div onclick="closepop()" style="background-color: #ffffff; text-align:-moz-right; text-align:right" class="pointer"><b> close x</b>&nbsp;&nbsp;</div>';
	// div.innerHTML = '<div align=center onclick="closepop()" class="pointer">test';
	div.innerHTML += '<img src="' + imgname + '" ></div>';
	// alert("Put In Div : " + div.innerHTML);
	document.getElementById('greyout').style.display='';
	document.getElementById('prodpop').style.display='';
	// document.body.scroll='no';
	// scroll(0,0);
	// window.moveTo(0,0);
}

function closepop(imgname) {
	document.getElementById('greyout').style.display='none';
	document.getElementById('prodpop').style.display='none';
	// document.body.scroll='yes';
	// scroll(0,0);
	// window.moveTo(0,0);
}

function scrollEvent() {
	// alert ("Scrolling");
	document.getElementById('prodpop').style.top = f_scrollTop() + 200 + "px";
	document.getElementById('greyout').style.top = f_scrollTop() + "px";
}

// works in all browsers
window.onscroll = scrollEvent;