
// ..................................................................

function findObj(n, d)
{ 
	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);
	}

	for(i = 0; !x && i < d.forms.length; i++)
	{
		x = d.forms[i][n];
	}
	if(!x)
	{
		if(!(x = d[n]) && d.all)
		{
			x = d.all[n];
		}
		for(i = 0; !x && d.layers && i < d.layers.length; i++)
		{
			x = findObj(n, d.layers[i].document);
		}
		if(!x && document.getElementById)
		{
			x = document.getElementById(n);
		}
	}

	return x;
}

// ..................................................................

function changeMenu(id, ver)
{	
/*
	var m = findObj(id);
	if (ver == "on")
		m.src = "img/menu-left-current.gif";
	else
		m.src = "img/menu-left.gif";
	return true;
*/	
	if (ver == "on")
		document.getElementById(id).src = "/img/menu-left-current.gif";
	else if (ver == "out")
		document.getElementById(id).src = "/img/menu-left.gif";
	return true;


}

// ..................................................................

function openWindow(href, title, scroll, resizable, width, height, position)
{
	if(scroll != "yes")
	{
		scroll = "no";
	}

	if(resizable != "yes")
	{
		resizable = "no";
	}

	if(position != 'center')
	{
		xx = window.open(href, title, 'toolbar=no, scrollbars=' + scroll + ', menubar=no, directories=no, status=no, resizable=' + resizable + ', width=' + width + ', height=' + height);
	}
	else
	{
		this_top = (screen.height - height) / 2;
		this_left = (screen.width - width) / 2;
		xx = window.open(href, title, 'toolbar=no, scrollbars=' + scroll + ', menubar=no, directories=no, status=no, resizable=' + resizable + ', width=' + width + ', height=' + height + ', top=' + this_top + ', left=' + this_left);
	}

	xx.focus();

	return false;
}

// ..................................................................

function imagePopup(imageUrl, imageW, imageH, title)
{
	x3 = imageW;
	y3 = imageH;
	x4 = (screen.width < 2000) ? (screen.width / 2 - (x3 / 2)) : (screen.width / 4 - (x3 / 2));
	y4 = screen.height / 2 - (y3 / 2);
	mywin = window.open('', 'big', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,copyhistory=0,width=' + x3 + ',height=' + y3 + ',top=' + y4 + ',left=' + x4 + '');
	mywin.document.open();

	if(navigator.appName == "Microsoft Internet Explorer")
	{
		mywin.window.resizeTo(x3 + 10, y3 + 25);
	}

	mywin.document.write("<title>"+title+"</title><body bgcolor=#ffffff leftmargin=0 topmargin=0 marginheight=0 marginwidth=0 onblur='window.close();'><a href='javascript:window.close()'><img src='" + imageUrl + "' border=0></a></body>");
	mywin.document.close;
	mywin.focus();

	return false;
}

// ..................................................................

function preloadImage(src)
{
   var img=new Image();
   img.src = src;
}

// ..................................................................

function Browser() 
{                                         
          this.dom = document.getElementById?1:0;
          this.ie4 = (document.all && !this.dom)?1:0;
          this.ns4 = (document.layers && !this.dom)?1:0;
          this.ns6 = (this.dom && !document.all)?1:0;
          this.ie5 = (this.dom && document.all)?1:0;
          this.ok = this.dom || this.ie4 || this.ns4;
          this.platform = navigator.platform;

          this.ie = (this.ie5) ? 1 : 0;
          this.ns = (this.ns6 || this.name=="Netscape") ? 1 : 0;
          this.opera = (window.opera)?1:0;

          this.name = navigator.appName;
          this.version = parseFloat(navigator.appVersion);
          if (!this.opera && this.name == "Microsoft Internet Explorer" && navigator.userAgent.indexOf("MSIE 6.0") != -1)
          {
                  this.version = 6;
          }
          else if (!this.opera && this.name == "Microsoft Internet Explorer" && navigator.userAgent.indexOf("MSIE 5.5") != -1)
          {
                  this.version = 5.5;
          }
	  else if (this.opera && navigator.userAgent.indexOf("Opera 7") != -1)
          {
                  this.version = 7;
          }
          else if (this.opera && navigator.userAgent.indexOf("Opera/6") != -1)
          {
                  this.version = 6;
          }

          this.ie6 = (this.ie && this.version > 5) ? true : false;
          this.png = (this.ie6 || this.opera) ? true : false;
}

// ..................................................................

function loadPNG(png, img, width, height, extra_param)
{
    var browser = new Browser();
    if (browser.png)
        document.write("<img border=0 src='" + png + "' width='" + width + "' height='" + height + "' " + extra_param + " />");
    else
        document.write("<img border=0 src='" + img + "' width='" + width + "' height='" + height + "' " + extra_param + " />");
}

// ..................................................................
