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 trim(s,what) {
	while (s.substring(0,1) == what) {
	s = s.substring(1,s.length);
	}
	while (s.substring(s.length-1,s.length) == what) {
	s = s.substring(0,s.length-1);
	}
	return s;
}

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 = parseInt(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 = parseInt(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';
}  

function act_menu(name)
{
	obj=SfindObj(name);
	if(!obj) return;
	//obj.style.fontWeight="bold";
	obj.style.textDecoration="none";
	obj.style.color = 'red';
}

nTimeOut = null;
function showmenu()
{
	if (nTimeOut) clearTimeout(nTimeOut);
	obj=SfindObj("servicesmenu");
	obj.style.display="block";	
}
function hidemenu()
{
 	nTimeOut=window.setTimeout('obj=SfindObj("servicesmenu");obj.style.display="none";',200);
}
