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 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 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';
	
	if (wheight > document.body.clientHeight) {
		wwidth = wwidth + 50;
		obj1.style.width=wwidth+'px';
		obj1.style.height=document.body.clientHeight - 50 +'px';
		obj1.style.overflow = 'auto';
		CenterLayer('preview',wwidth,document.body.clientHeight - 50,window.document);
	}
	else {
		wheight = wheight + 12;
		
		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';
} 
