var items = new Array();
var menus = new Array();
var hideOnlineSelect = false;
var hideOnlineObject = false;

function oPreload(_imgname, _newimg)
{
	this.imgname = _imgname;
	this.newimg = new Image();
	this.newimg.src = _newimg;

	this.oldloaded = false;
	this.oldimg = new Image();

	this.over = oPreload_over;
	this.out = oPreload_out;
}

function oPreload_over()
{
	if (document.images)
	{
		if (!this.oldloaded)
		{
			this.oldimg.src = document.images[this.imgname].src;
			this.oldloaded = true;
		}
		document.images[this.imgname].src = this.newimg.src;
	}
}

function oPreload_out()
{
	if (document.images && this.oldloaded) document.images[this.imgname].src = this.oldimg.src;
}
function oMenuPanel(_id, _x, _y)
{
	this.id = _id;
	this.x = _x;
	this.y = _y;
	this.obj = this.id + "_object"; eval(this.obj + " = this");

	this.items = new Array();
	this.itemCounter = 0;
	this.closeTimer = false;
	this.visible = false;
	this.exitCommand = '';
	this.openCommand = '';

	this.contentStr = '<div id="' + this.id + '" style="position:absolute; left:' + this.x + 'px; top:' + this.y + 'px; visibility:hidden;"><table cellpadding="0" cellspacing="0" border="0">';

	this.addImage = oMenuPanel_addimage;
	this.addMenu = oMenuPanel_addMenu;
	this.create = oMenuPanel_create;
	this.over = oMenuPanel_over;
	this.out = oMenuPanel_out;
	this.closePanel = oMenuPanel_closepanel;
	this.show = oMenuPanel_show;
	this.hide = oMenuPanel_hide;
	this.addExitCommand = oMenuPanel_addexitcommand;
	this.addOpenCommand = oMenuPanel_addopencommand;
}

function oMenuPanel_addimage(_src)
{
	this.contentStr += '<tr><td><img src="' + _src + '" border="0" onmouseover="' + this.obj + '.over()" onmouseout="' + this.obj + '.out()"></td></tr>';
}

function oMenuPanel_addMenu(_h, _oimg, _nimg, _toolt, _url)
{
	_imgname = this.id + '_img_' + this.itemCounter;
	this.items[this.itemCounter] = new oPreload(_imgname, _nimg);
	this.contentStr += '<tr><td><a href="' + _url + '" onmouseover="' + this.obj + '.items[' + this.itemCounter + '].over(); ' + this.obj + '.over()" onmouseout="' + this.obj + '.items[' + this.itemCounter + '].out(); ' + this.obj + '.out()"><img src="' + _oimg + '" name="' + _imgname + '" height="' + _h + '" border="0" alt="' + _toolt + '"></a></td></tr>';
	this.itemCounter++;
}

function oMenuPanel_create()
{
	this.contentStr += "</table></div>";
	document.write(this.contentStr);
}

function oMenuPanel_over()
{
	if (this.closeTimer)
	{
		clearTimeout(this.closeTimer);
		this.closeTimer = false;
	}
	if (!this.visible)
	{
		closeAnotherMenu(this.id);
		this.show();
		if (this.openCommand)
		{
			eval(this.openCommand);
		}
	}
}

function oMenuPanel_out()
{
	if (this.closeTimer)
	{
		clearTimeout(this.closeTimer);
		this.closeTimer = false;
	}

	this.closeTimer = setTimeout(this.obj + '.closePanel()', 500);
}

function oMenuPanel_closepanel()
{
	if (this.closeTimer)
	{
		clearTimeout(this.closeTimer);
		this.closeTimer = false;
	}
	this.hide();
	if (this.exitCommand)
	{
		eval(this.exitCommand);
	}
}

function oMenuPanel_show()
{
	if (document.getElementById)
	{
		document.getElementById(this.id).style.visibility = 'visible';
	}
	else if (document.all)
	{
		document.all[this.id].style.visibility = 'visible';
	}
	this.visible = true;
}

function oMenuPanel_hide()
{
	if (document.getElementById)
	{
		document.getElementById(this.id).style.visibility = 'hidden';
	}
	else if (document.all)
	{
		document.all[this.id].style.visibility = 'hidden';
	}
	this.visible = false;
}

function oMenuPanel_addexitcommand(_str)
{
	this.exitCommand += _str;
}

function oMenuPanel_addopencommand(_str)
{
	this.openCommand += _str;
}

// ----------------------------------------------------------------------------

function menuOver(_num)
{
	items[_num].over();
	menus[_num].over();
}

function menuOut(_num)
{
	menus[_num].out();
}

function closeAnotherMenu(_id)
{
	for (a = 0; a < menus.length; a++)
	{
		if (menus[a].id != _id)
		{
			menus[a].closePanel();
		}
	}
}

function generateMenus()
{
	for (a = 0; a < menus.length; a++)
	{
		menus[a].create();
	}
}

function setOnlineSelect(_status)
{
	if (hideOnlineSelect)
	{
		if (_status == true)
		{
			_a = 'block'
		}
		else
		{
			_a = 'none'
		}

		if (document.getElementById)
		{
			document.getElementById('onlineselect').style.display = _a;
		}
		else if (document.all)
		{
			document.all['onlineselect'].style.visibility = _a;
		}
	}
}

function setOnlineObject(_status)
{
	if (hideOnlineObject)
	{
		if (_status == true)
		{
			_a = 'block'
		}
		else
		{
			_a = 'none'
		}

		if (document.getElementById)
		{
			document.getElementById('onlineobject').style.display = _a;
		}
		else if (document.all)
		{
			document.all['onlineobject'].style.visibility = _a;
		}
	}
}

// ----------------------------------------------------------------------------

// preloading menu items

items[0] = new oPreload('hmenu_0', 'imgmenu_ro/Menu_Servicii_1.gif');
items[1] = new oPreload('hmenu_1', 'imgmenu_ro/Menu_Factoring_1.gif');
items[2] = new oPreload('hmenu_2', 'imgmenu_ro/Menu_Produs_1.gif');
items[3] = new oPreload('hmenu_3', 'imgmenu_ro/Menu_Utile_1.gif');
items[4] = new oPreload('hmenu_4', 'imgmenu_ro/Menu_StudiuDeCaz_1.gif');
items[5] = new oPreload('hmenu_5', 'imgmenu_ro/Menu_Interbari_1.gif');
items[6] = new oPreload('hmenu_6', 'imgmenu_ro/Menu_Contact_1.gif');


// creating menu panels

// panel 'Despre Noi'

menus[0] = new oMenuPanel('hmenu_0', 89, 130);
menus[0].addImage('imgmenu_ro/Menu_DespreNoi_1.gif');
menus[0].addImage('imgmenu_ro/Spacer.gif');0
menus[0].addMenu(22, 'imgmenu_ro/MenuSub1_1_0.gif', 'imgmenu_ro/MenuSub1_1_1.gif',   'Filosofia noastră; simplu, rapid, flexibil',  'index.php?page=74&lang=_ro');
menus[0].addMenu(22, 'imgmenu_ro/MenuSub1_2_0.gif', 'imgmenu_ro/MenuSub1_2_1.gif',   'Amplasare birou, hartă',    				    'index.php?page=76&lang=_ro');
menus[0].addExitCommand('items[0].out();');

// panel 'Factoring'

menus[1] = new oMenuPanel('hmenu_1', 172, 130);
menus[1].addImage('imgmenu_ro/Menu_Factoring_1.gif');
menus[1].addImage('imgmenu_ro/Spacer.gif');
menus[1].addMenu(22, 'imgmenu_ro/MenuSub2_1_0.gif', 'imgmenu_ro/MenuSub2_1_1.gif',   'Ce este factoringul?',      					'index.php?page=78&lang=_ro');
menus[1].addMenu(22, 'imgmenu_ro/MenuSub2_2_0.gif', 'imgmenu_ro/MenuSub2_2_1.gif',   'Cui se adresează factoringul?',    			'index.php?page=79&lang=_ro');
menus[1].addMenu(22, 'imgmenu_ro/MenuSub2_3_0.gif', 'imgmenu_ro/MenuSub2_3_1.gif',   'Cum funcţionează factoringul în practică?',   'index.php?page=80&lang=_ro');
menus[1].addMenu(22, 'imgmenu_ro/MenuSub2_4_0.gif', 'imgmenu_ro/MenuSub2_4_1.gif',   'Avantajele utilizării factoringului',    		'index.php?page=81&lang=_ro');
menus[1].addExitCommand('items[1].out();');

// panel 'Produs'

menus[2] = new oMenuPanel('hmenu_2', 255, 130);
menus[2].addImage('imgmenu_ro/Menu_Produs_1.gif');
menus[2].addImage('imgmenu_ro/Spacer.gif');
menus[2].addMenu(22, 'imgmenu_ro/MenuSub3_1_0.gif', 'imgmenu_ro/MenuSub3_1_1.gif',   'Factoring intern cu regres',      			'index.php?page=83&lang=_ro');
menus[2].addMenu(22, 'imgmenu_ro/MenuSub3_2_0.gif', 'imgmenu_ro/MenuSub3_2_1.gif',   'Factoring intern cu asigurare de credit',    	'index.php?page=84&lang=_ro');
menus[2].addExitCommand('items[2].out();');
menus[2].addOpenCommand('setOnlineObject(false);');
menus[2].addExitCommand('setOnlineObject(true);');

// panel 'Utile'

menus[3] = new oMenuPanel('hmenu_3', 338, 130);
menus[3].addImage('imgmenu_ro/Menu_Utile_1.gif');
menus[3].addImage('imgmenu_ro/Spacer.gif');
menus[3].addMenu(22, 'imgmenu_ro/MenuSub4_1_0.gif', 'imgmenu_ro/MenuSub4_1_1.gif',   'Calculator',      							'index.php?page=86&lang=_ro');
menus[3].addMenu(22, 'imgmenu_ro/MenuSub4_2_0.gif', 'imgmenu_ro/MenuSub4_2_1.gif',   'Curs valutar',    							'index.php?page=87&lang=_ro');
//menus[3].addMenu(22, 'imgmenu_ro/MenuSub4_3_0.gif', 'imgmenu_ro/MenuSub4_3_1.gif',   'Dobânzi',    									'index.php?page=88&lang=_ro');
menus[3].addMenu(22, 'imgmenu_ro/MenuSub4_4_0.gif', 'imgmenu_ro/MenuSub4_4_1.gif',   'Bursă',    									'index.php?page=89&lang=_ro');
menus[3].addExitCommand('items[3].out();');
menus[3].addOpenCommand('setOnlineSelect(false);');
menus[3].addExitCommand('setOnlineSelect(true);');

// panel 'Studiu de caz'

menus[4] = new oMenuPanel('hmenu_4', 421,  130);
menus[4].addImage('imgmenu_ro/Menu_StudiuDeCaz_1.gif');
menus[4].addImage('imgmenu_ro/Spacer.gif');
menus[4].addMenu(22, 'imgmenu_ro/MenuSub5_1_0.gif', 'imgmenu_ro/MenuSub5_1_1.gif',   '',      								'index.php?page=91&lang=_ro');
menus[4].addExitCommand('items[4].out();');
menus[4].addOpenCommand('setOnlineSelect(false);');
menus[4].addExitCommand('setOnlineSelect(true);');

// panel 'Interbari'

menus[5] = new oMenuPanel('hmenu_5', 504,  130);
menus[5].addImage('imgmenu_ro/Menu_Interbari_1.gif');
menus[5].addImage('imgmenu_ro/Spacer.gif');
menus[5].addMenu(22, 'imgmenu_ro/MenuSub6_1_0.gif', 'imgmenu_ro/MenuSub6_1_1.gif',   '',      								'index.php?page=93&lang=_ro');
menus[5].addExitCommand('items[5].out();');
menus[5].addOpenCommand('setOnlineSelect(false);');
menus[5].addExitCommand('setOnlineSelect(true);');

// panel 'Contact'

menus[6] = new oMenuPanel('hmenu_6', 587,  130);
menus[6].addImage('imgmenu_ro/Menu_Contact_1.gif');
menus[6].addImage('imgmenu_ro/Spacer.gif');
menus[6].addMenu(22, 'imgmenu_ro/MenuSub7_1_0.gif', 'imgmenu_ro/MenuSub7_1_1.gif',   'Adres',      									'index.php?page=95&lang=_ro');
menus[6].addMenu(22, 'imgmenu_ro/MenuSub4_0_0.gif', 'imgmenu_ro/MenuSub4_0_1.gif',   'Login area',      							'index.php?page=98&lang=_ro');
menus[6].addMenu(22, 'imgmenu_ro/MenuSub7_2_0.gif', 'imgmenu_ro/MenuSub7_2_1.gif',   'Trimiteti-ne un e-mail!',    							'index.php?page=97&lang=_ro');
menus[6].addExitCommand('items[6].out();');
menus[6].addOpenCommand('setOnlineSelect(false);');
menus[6].addExitCommand('setOnlineSelect(true);');


