var old_menu_02 = '';
var old_sub_02 = 'sub';
var is_opened  = 'none';

function mrg_showmenu(menuid) {
	for (i=1;i<5;i++) {
		if (menuid!=('menu0'+i)) { document.getElementById('menu0'+i).style.display='none'; }
	}
    if (document.getElementById(menuid).style.display=='block') {
			document.getElementById(menuid).style.display='none';
    }
    else { document.getElementById(menuid).style.display='block'; }
}

function showMenu( menu, sub ) {
    menu_obj = document.getElementById(menu);
	sub_obj = document.getElementById(sub);
    is_opened = menu_obj.style.display;

	if (menu=='menu03' && is_opened=='block') {
		menu_obj.style.display='none';
        sub_obj.className = 'sub';
	}

	if (menu != 'menu01') {
		document.getElementById('menu01').style.display = 'none';
		document.getElementById('sub01').className = 'sub';
	}

    if (old_menu_02 != '' && is_opened == 'none') {
        old_menu_obj = document.getElementById(old_menu_02);
        old_menu_obj.style.display = 'none';
        old_sub_obj = document.getElementById(old_sub_02);
        old_sub_obj.className = 'sub';
    }

    if (old_menu_02 != menu || is_opened == 'none') {
		menu_obj.style.display = 'block';
		sub_obj.className = 'subhover';
	}

    old_menu_02 = menu;
    old_sub_02 = sub;
}

function OpenNewWindow(url, x, y) 
{
	var xc=Math.floor((screen.width-x)/2);
	var yc=Math.floor((screen.height-y)/2)-24; 
	window.open(url, Math.floor(Math.random()*100), 'status=0,screenx=0,screeny=0,left='+xc+',top='+yc+',alwaysRaised=no,toolbar=0,menubar=no,directories=0,resizable=no,scrollbars=1,width='+x+',height='+y+''); 
}

function fotovilag_popupxy(url,x,y) 
{
	var xc=Math.floor((screen.width-x)/2);
	var yc=Math.floor((screen.height-y)/2)-24; 
	window.open(url, Math.floor(Math.random()*100), 'status=0,screenx=0,screeny=0,left='+xc+',top='+yc+',alwaysRaised=no,toolbar=0,menubar=no,directories=0,resizable=1,scrollbars=1,width='+x+',height='+y+''); 
}

function fotovilag_popup(url) 
{
	var x=750;
	var y=740;
	var xc=Math.floor((screen.width-x)/2);
	var yc=Math.floor((screen.height-y)/2)-24; 
	window.open(url, Math.floor(Math.random()*100), 'status=0,screenx=0,screeny=0,left='+xc+',top='+yc+',alwaysRaised=no,toolbar=0,menubar=no,directories=0,resizable=1,scrollbars=1,width='+x+',height='+y+''); 
}

function fotovilag_popup2(url, x, y) 
{
	var xc=Math.floor((screen.width-x)/2);
	var yc=Math.floor((screen.height-y)/2)-24; 
	window.open(url, Math.floor(Math.random()*100), 'status=0,screenx=0,screeny=0,left='+xc+',top='+yc+',alwaysRaised=no,toolbar=0,menubar=no,directories=0,resizable=1,scrollbars=1,width='+x+',height='+y+''); 
}

function w(url,x,y) 
{
	var xc=Math.floor((screen.width-x)/2);
	var yc=Math.floor((screen.height-y)/2)-24; 
	window.open(url, Math.floor(Math.random()*100), 'status=0,screenx=0,screeny=0,left='+xc+',top='+yc+',alwaysRaised=no,toolbar=0,menubar=no,directories=0,resizable=1,scrollbars=0,width='+x+',height='+y+''); 
}
