// JavaScript Document
var iid;

function showme( w, h, elem ) {
	//
	//	allow for the border
	//
	if (window.innerHeight && window.scrollMaxY) {// Firefox         
		yWithScroll = window.innerHeight + window.scrollMaxY - 1;         
		xWithScroll = window.innerWidth + window.scrollMaxX - 1;     
	} else if (parent.document.body.scrollHeight > parent.document.body.offsetHeight){ // all but Explorer Mac         
		yWithScroll = parent.document.body.scrollHeight - 1;         
		xWithScroll = parent.document.body.scrollWidth - 1;     
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari         
		yWithScroll = parent.document.body.offsetHeight - 1;         
		xWithScroll = parent.document.body.offsetWidth - 1;       
	} 
	
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		pw = parent.window.innerWidth - 16;
		ph = parent.window.innerHeight - 16;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		pw = parent.document.documentElement.clientWidth + 20;
		ph = parent.document.documentElement.clientHeight + 20;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		pw = parent.document.body.clientWidth + 20;
		ph = parent.document.body.clientHeight + 20;
	}

	if( typeof( window.pageYOffset ) == 'number' ) {
		//Netscape compliant
		scrOfY = parent.window.pageYOffset;
		scrOfX = parent.window.pageXOffset;
	} else {
		//DOM compliant
		scrOfY = parent.document.body.scrollTop;
		scrOfX = parent.document.body.scrollLeft;
	}

	newleft = (pw - w) / 2 + scrOfX;
	newtop = (ph - h) / 2 + scrOfY;

	var ff = parent.document.getElementById(elem.name);

	ff.style.visibility="visible";
	ff.style.width=w + "px";
	ff.style.height=h + "px";
	ff.style.left = newleft + "px";
	ff.style.top = newtop + "px";

	var oo = parent.document.getElementById('overlay');
	changeOpac(40, 'overlay')
	oo.style.visibility="visible";
	oo.style.width=xWithScroll + "px";
	oo.style.height=yWithScroll + "px";

	newleft = (pw - 120) / 2 + scrOfX;
	newtop = (ph - 120) / 2 + scrOfY;

	iid = window.setInterval("scrollme('" + elem.name + "')",500);
	
}

//change the opacity for different browsers 
function changeOpac(opacity, id) { 
	var object = parent.document.getElementById(id).style; 
	object.opacity = (opacity / 100); 
	object.MozOpacity = (opacity / 100); 
	object.KhtmlOpacity = (opacity / 100); 
	object.filter = "alpha(opacity=" + opacity + ")"; 
		} 
 
function closeframe( id ) 
{ 
	var oo = parent.document.getElementById('overlay');
	oo.style.width = "1px";
	oo.style.height = "1px";
	oo.style.visibility="hidden";
	
	var ff = parent.document.getElementById(id);
	ff.src="/includes/blank.htm";
	ff.style.left = "1px";
	ff.style.top = "1px";
	ff.style.width = "1px";
	ff.style.height = "1px";
	ff.style.visibility="hidden";

	var ll = parent.document.getElementById('loading');
	ll.style.left = "1px";
	ll.style.top = "1px";
	ll.style.width = "1px";
	ll.style.height = "1px";
	ll.style.visibility="hidden";

	window.clearInterval(iid);
} 
function scrollme( id ) {

	if (window.innerHeight && window.scrollMaxY) {// Firefox         
		yWithScroll = window.innerHeight + window.scrollMaxY - 1;         
		xWithScroll = window.innerWidth + window.scrollMaxX - 1;     
	} else if (parent.document.body.scrollHeight > parent.document.body.offsetHeight){ // all but Explorer Mac         
		yWithScroll = parent.document.body.scrollHeight - 1;         
		xWithScroll = parent.document.body.scrollWidth - 1;     
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari         
		yWithScroll = parent.document.body.offsetHeight - 1;         
		xWithScroll = parent.document.body.offsetWidth - 1;       
	} 
	
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		pw = parent.window.innerWidth - 16;
		ph = parent.window.innerHeight - 16;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		pw = parent.document.documentElement.clientWidth + 20;
		ph = parent.document.documentElement.clientHeight + 20;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		pw = parent.document.body.clientWidth + 20;
		ph = parent.document.body.clientHeight + 20;
	}

	if( typeof( window.pageYOffset ) == 'number' ) {
		//Netscape compliant
		scrOfY = parent.window.pageYOffset;
		scrOfX = parent.window.pageXOffset;
	} else {
		//DOM compliant
		scrOfY = parent.document.body.scrollTop;
		scrOfX = parent.document.body.scrollLeft;
	}


	var ff = parent.document.getElementById(id);

	w = ff.style.width;
	h = ff.style.height;

	newleft = (pw - (w.replace('px','')) ) / 2 + scrOfX;
	newtop = (ph - (h.replace('px','')) ) / 2 + scrOfY;

	ff.style.left = newleft + "px";
	ff.style.top = newtop + "px";

	var oo = parent.document.getElementById('overlay');
	oo.style.width=xWithScroll + "px";
	oo.style.height=yWithScroll + "px";

}

function additem( pid ) {
	var variation1 = 'v1_' + pid;
	var variation2 = 'v2_' + pid;
	var variation3 = 'v3_' + pid;
	var rnd= new Date();
	var e;
	
	var val1='';
	var val2='';
	var val3='';
if ( document.getElementById(variation1) )
	{
		e=document.getElementById(variation1);
		val1 = e.options[e.selectedIndex].value;
	}
	if ( document.getElementById(variation2) )
	{
		e=document.getElementById(variation2);
		val2 = e.options[e.selectedIndex].value;
	}
	if ( document.getElementById(variation3) )
	{
		e=document.getElementById(variation3);
		val3 = e.options[e.selectedIndex].value;
	}

	var sStr = "?pid=" + pid + "&v1=" + val1 + "&v2=" + val2 + "&v3=" + val3 + "&ts=" + rnd.getTime();
//	alert(sStr);
	document.getElementById("hf").src="/additem.php" + sStr;

	return false;
}

function chgitem( pid ) {
	var variation1 = 'v1_' + pid;
	var variation2 = 'v2_' + pid;
	var variation3 = 'v3_' + pid;
	var rnd= new Date();
	var e;
	
	var val1='';
	var val2='';
	var val3='';

if ( document.getElementById(variation1) )
	{
		e=document.getElementById(variation1);
		val1 = e.options[e.selectedIndex].value;
	}
	if ( document.getElementById(variation2) )
	{
		e=document.getElementById(variation2);
		val2 = e.options[e.selectedIndex].value;
	}
	if ( document.getElementById(variation3) )
	{
		e=document.getElementById(variation3);
		val3 = e.options[e.selectedIndex].value;
	}

	var sStr = "?pid=" + pid + "&v1=" + val1 + "&v2=" + val2 + "&v3=" + val3 + "&ts=" + rnd.getTime();
	document.getElementById("hf").src="/chgprice.php" + sStr;

	return false;
}

