nTimeOut = 0;
nActiveMenu = '';

function SfindObj(n, d) 
{	//v4.01
	var p, i, x;
	if (!d) 
		d = document; 
	if ((p = n.indexOf("?") ) > 0 && parent.frames.length) 
	{
		d = parent.frames [n.substring(p + 1)].document; 
		n = n.substring(0, p);
	}
	if (!(x = d [n]) && d.all) 
		x = d.all [n]; 
	for (i = 0; !x && i < d.forms.length; i ++) 
		x = d.forms [i] [n];
	for (i = 0; !x && d.layers && i < d.layers.length; i ++)
		x = SfindObj(n, d.layers [i].document);
	if(!x && d.getElementById) 
		x = d.getElementById(n);
	return x;
}


function ShowMenu (id) {
	clearTimeout(nTimeOut);
	
	if (nActiveMenu)
		realHideMenu (nActiveMenu);
	
	
	obj = SfindObj ('pulldown'+id);
	if (obj)
		obj.style.display = 'block';
	
	nActiveMenu = id;
}

function HideMenu (id) {
	nTimeOut=window.setTimeout('realHideMenu ("'+id+'")',200);
}

function realHideMenu (id) {
	obj = SfindObj ('pulldown'+id);
	if (obj)
		obj.style.display = 'none';
}

function ShowProd (wwidth,wheight,isrc,modelid) {
	obj1=SfindObj('preview');
	obj2=SfindObj('previewimg');
	obj3=SfindObj('previewtbl');
	if (modelid >=0 ) {
		objLoad=SfindObj("loaddata");
		objLoad.innerHTML='';
		objLoad.style.display='none';
	}
	
	obj2.src='/i/dot.gif';

	obj1.style.width=wwidth+'px';
	obj1.style.height=wheight+'px';
	
	obj3.style.width=wwidth+'px';
	obj3.style.height=wheight+'px';

	CenterLayer('preview',wwidth,wheight,window.document);
	obj1.style.visibility='visible';
	
	
	obj2.src=isrc;
}

function HideProd () {
	obj1=SfindObj('preview');
	obj2=SfindObj('previewimg');
	objLoad=SfindObj("loaddata");
	objLoad.innerHTML='';
	objLoad.style.display='none';
	
	obj2.src='/i/dot.gif';
	
	obj1.style.visibility='hidden';
}

function CenterLayer (layer,width,height,target) {
	if (!target)
		target=window.document;

	leftLayer = ((target.body.clientWidth - width)/2);
	topLayerABS = (target.body.clientHeight - height)/2;

	topLayer=target.body.scrollTop;
	
	newTop = topLayer + topLayerABS;
	if (newTop < 0)
		newTop=0;

	target.getElementById(layer).style.left = leftLayer;
	target.getElementById(layer).style.top=topLayer + topLayerABS;
}

function findPosY(sObj)
{
	obj=SfindObj(sObj);
	var curtop = 0;
	if (obj) {
		if (obj && obj.offsetParent)
			{
				while (obj.offsetParent)
				{
					curtop += obj.offsetTop
					obj = obj.offsetParent;
				}
			}
		else if (obj.y)
			curtop += obj.y;

	}
	return curtop;
} 