function browser_check()
{
	this.ver = navigator.appVersion;
	this.agent = navigator.userAgent;
	this.dom = document.getElementById ? 1 : 0;

	this.ie5 = this.ver.indexOf("MSIE 5") > -1  &&  this.dom ? 1 : 0;
	this.ie6 = this.ver.indexOf("MSIE 6") > -1  &&  this.dom ? 1 : 0;
	this.ie4 = document.all  &&  !this.dom ? 1 : 0;
	this.ie = this.ie4  ||  this.ie5  ||  this.ie6;

	this.mac = this.agent.indexOf("Mac") > -1;
	this.op5 = this.agent.indexOf("Opera 5") > -1;

	this.ns6 = this.dom  &&  parseInt(this.ver) >= 5 ? 1 : 0; 
	this.ns4 = document.layers  &&  !this.dom ? 1 : 0;
	this.ns = this.ns4  ||  this.ns6;

	this.bw = this.ie  ||  this.ns  ||  this.mac  ||  this.op5  ||  this.dom;
	this.name = "";
	if( this.op5 )      this.name = "op5";
	else if( this.ie4 ) this.name = "ie4";
	else if( this.ie5 ) this.name = "ie5";
	else if( this.ie6 ) this.name = "ie6";
	else if( this.ns4 ) this.name = "ns4";
	else if( this.ns6 ) this.name = "ns6";
	else if( this.mac ) this.name = "mac";

	return this;
}
bw = new browser_check();

//Object constructor
function makeMenuObj(obj, nest)
{
	nest = (!nest) ? '' : 'document.' + nest + '.';
	this.name=obj;
	this.el = bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
	this.css = bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
	this.obj = obj + "Object";
	eval(this.obj + "=this");
	return this;
}

var menu_loaded = false;
var optic_hidden = true;

function ShowShop() { if( menu_loaded ) { HideAll(); oShopItems.css.visibility='visible'; } }
function HideShop() { if( menu_loaded ) oShopItems.css.visibility='hidden'; }

function ShowShop1() { if( menu_loaded ) { HideAll(); oShop1Items.css.visibility='visible'; } }
function HideShop1() { if( menu_loaded ) oShop1Items.css.visibility='hidden'; }

function ShowShop2() { if( menu_loaded ) { HideAll(); oShop2Items.css.visibility='visible'; } }
function HideShop2() { if( menu_loaded ) oShop2Items.css.visibility='hidden'; }


function ShowPhotos() { if( menu_loaded ) { HideAll(); oPhotosItems.css.visibility='visible'; } }
function HidePhotos() { if( menu_loaded  &&  optic_hidden ) oPhotosItems.css.visibility='hidden'; }

//function ShowPhotos() { if( menu_loaded ) { oEyeCenterItems.css.visibility='visible'; optic_hidden = false; oOpticsItems.css.visibility='visible'; } }
//function HidePhotos() { if( menu_loaded ) { oEyeCenterItems.css.visibility='hidden'; oPhotosItems.css.visibility='hidden'; optic_hidden = true; } }

function ShowMebel() { if( menu_loaded ) { HideAll(); oScienceCenterItems.css.visibility='visible'; } }
function HideMebel() { if( menu_loaded ) oScienceCenterItems.css.visibility='hidden'; }

function HideAll()
{
	if( menu_loaded ) {
		HideShop();
HideShop1();
HideShop2();
		HidePhotos();
	
		HideMebel();
	}
}

// Makes the menu object
function menuInit()
{
	oShop = new makeMenuObj('divShop');
	oShopItems = new makeMenuObj('divShopItems', 'divShop');
	HideShop();

	oShop1 = new makeMenuObj('divShop1');
	oShop1Items = new makeMenuObj('divShop1Items', 'divShop1');
	HideShop1();

	oShop2 = new makeMenuObj('divShop');
	oShop2Items = new makeMenuObj('divShop2Items', 'divShop2');
	HideShop2();

	

	oPhotos = new makeMenuObj('divPhotos');
	oPhotosItems = new makeMenuObj('divPhotosItems', 'divPhotos');
	HidePhotos();

	oMebel = new makeMenuObj('mebel');
	oScienceCenterItems = new makeMenuObj('divScienceCenterItems', 'mebel');
	HideMebel();

	menu_loaded = true;
}

var mp = 40, is = 10, ec = 70, sc = 10, sm = 1, gb = 1, cp = 1;
var total = (mp + is + ec + sc + sm + gb + cp);

function menuMove()
{
	if( menu_loaded ) {
		// Get X positions for oShop, oEyeCenter, oPhotos and oMebel
		oShop.css.left = 10;

		w1 = Math.max(700, document.body.clientWidth * 70.0 / 100.0);
		dx = (document.body.clientWidth - w1 - ec - sc - sm - gb - cp);
		if( dx > 0 ) dx = dx / 10.; else dx = 10;
oEyeCenter.css.left = parseInt(oShop.css.left) + is + dx;
//		oEyeCenter.css.left = w1 + dx;
oShop1.css.left =  parseInt(oEyeCenter.css.left)  + 6;
oShop2.css.left = parseInt(oEyeCenter.css.left) + 30;
		oPhotos.css.left = parseInt(oEyeCenter.css.left) + 30;
		oMebel.css.left = parseInt(oEyeCenter.css.left) +  dx;

	}
}

function menuMove2()
{
	if( menu_loaded ) {
		dx = document.body.clientWidth - total;
		if( dx > 0 ) dx = dx / 14.; else dx = 0;
		// Get X positions for oShop, oEyeCenter, oPhotos and oMebel
		oShop.css.left = 3 * dx + mp;
oShop1.css.left = 3 * dx + mp;
oShop2.css.left = 3 * dx + mp;
		oEyeCenter.css.left = parseInt(oShop.css.left) + is + 2 * dx + 3;
		oPhotos.css.left = parseInt(oEyeCenter.css.left) + 30;
		oMebel.css.left = parseInt(oEyeCenter.css.left) + ec + 2 * dx + 6;
	}
}