
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 MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=SfindObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

var nTimeOut='';
var nActiveDiv='';
function showLayer (num) {
	if (nTimeOut>0)
		clearTimeout(nTimeOut);
	
	MM_showHideLayers(nActiveDiv,'','hide');
	
	nActiveDiv=num;
	MM_showHideLayers(num,'','show');
}

function hideLayer (num) {
	MM_showHideLayers(num,'','hide');
}

sLayer1='bm2';

function ShowProd (wwidth,wheight,isrc,modelid,txtl) {
	obj1=SfindObj('preview');
	obj2=SfindObj('previewimg');
	obj3=SfindObj('previewtbl');
	if (modelid >=0 ) {
		objLoad=SfindObj("loaddata");
		objLoad.innerHTML=txtl;
	}
	
	obj2.src='/i/dot.gif';

	obj1.style.width=wwidth+25+'px';
	obj1.style.height=wheight+25+'px';
	
	obj3.style.width=wwidth+25+'px';
	obj3.style.height=wheight+45+'px';

	if (modelid == -2) {
		X=findPosX('down');
		Y=findPosY('down');
		obj1.style.left=X-180+'px';
		obj1.style.top=Y-10+'px';
	}
	else
		CenterLayer('preview',wwidth+25,wheight+7,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;
}
