var fwHideMenuTimer;

agent = navigator.appName;
if (agent == "Microsoft Internet Explorer") 
{
	ie=true; nn=false;
}
if (agent == "Netscape")
{
	ie=false; nn=true;
};

function FW_clearTimeout()
{
	if (fwHideMenuTimer) clearTimeout(fwHideMenuTimer);
	fwHideMenuTimer = null;
	fwDHFlag = false;
}
function FW_startTimeout()
{
	fwStart = new Date();
	fwDHFlag = true;
	fwHideMenuTimer = setTimeout("fwDoHide()", 500);
}

function fwDoHide()
{
	if (!fwDHFlag) return;
	var elapsed = new Date() - fwStart;
	if (elapsed < 500) {
		fwHideMenuTimer = setTimeout("fwDoHide()", 600-elapsed);
		return;
	}
	fwDHFlag = false;
	HideAllLayers();
}

function over(n) {
    HideAllLayers();
	showDiv(n)
}

function out(n) {
	  hideDiv(n)
}

function ClientWidth()
{
	w=(ie) ? document.body.clientWidth : (nn) ? innerWidth : 0;
	return w;
}

function showDiv(which) {
		divobj= new getObj(which);
		divobj.style.left = ClientWidth()-407;//333;//window.width - 200;
		divobj.style.visibility='visible';
		divobj=null;
}

function hideDiv(which) {
		divobj= new getObj(which);
		divobj.style.visibility='hidden';
		divobj=null;
}

function HideAllLayers()
{
  FW_clearTimeout();
  hideDiv('reports');
  hideDiv('meat');
  hideDiv('vegetable');
  hideDiv('blender');
}

//////////////// new //////////////////

if (document.images) {
buttons = new Array
 buttons[32] = new Image()
 buttons[32].src="img/pimpa.gif"
}

function bover(n) {
img = new getObj(n)
if (img.obj){
	newsrc = "img/pimpa.gif";
	img.obj.src = newsrc;
}
img = null;
}
function bout(n) {
img = new getObj(n)
if (img.obj){
	newsrc = "img/transparent.gif";
	img.obj.src = newsrc;
}
img = null;
}

function getObj(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	if (!this.obj) return null;
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	if (!this.obj) return null;
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
	this.obj = getObjNN4(document,name);
	if (!this.obj) return null;
	this.style = this.obj;
  }
}

function getObjNN4(obj,name)
{
	var x = obj.layers;
	if (obj.document)
	{
		var y = obj.document.images;
	}
	else
	{
		var y = obj.images;
	};
	var thereturn;
	var ss="";
	for (var i=0;i<y.length;i++)
	{
		if (y[i].name)
		{
			ss=ss+y[i].name+" , ";
			if (y[i].name == name)
			{
				return y[i];
			}; //if (y[i].name == name)
		};// if (y[i].name)
	}; // for i
	for (var i=0;i<x.length;i++)
	{
		if (x[i].id == name)
		{
		 	thereturn = x[i];
		}
		else
		{
			if (x[i].layers.length||x[i].document.images.length)
			{
				var tmp = getObjNN4(x[i],name);
			};
			if (tmp) thereturn = tmp;
		};
	};
	return thereturn;
};

function windowOpener(fileName, w, h, l, t){
	msgWindow=window.open(fileName,"winName","width="+w+",height="+h+",left="+l+",top="+t+",toolbar=0,directories=0,menubar=1;resizable=0,location=0,scrollbars=1,copyhistory=0");
}
