//	-------------------------------------------------------------------
var _menu_color = null;
var _menu_bgcolor = null;
function _mover( ob, color, bgcolor, textdec )
{
	if ( color == null ) color = ob.style.color;
	if ( bgcolor == null ) bgcolor = ob.style.color;
	if ( textdec == null ) textdec = ob.style.textDecoration;
	_menu_color = ob.style.color;
	_menu_bgcolor = ob.style.backgroundColor;
	ob.style.color = color;
	ob.style.backgroundColor = bgcolor;
	ob.style.textDecoration = textdec;
}

function _mout( ob )
{
	ob.style.color = _menu_color;
	ob.style.backgroundColor = _menu_bgcolor;
}
//	-------------------------------------------------------------------
//	dinamic image menu
//	restore image
function _imgRestore()
{
	var i,x,a=document.MM_sr;
	for( i=0; a&&i < a.length && ( x=a[i] ) && x.oSrc; i++ ) x.src=x.oSrc;
}
//	load all images
function _imgPreload()
{
	var d=document;
	if (d.images)
	{
		if (!d.MM_p) d.MM_p=new Array();
    	var i,j=d.MM_p.length,a=_imgPreload.arguments; for(i=0; i<a.length; i++)
    	if (a[i].indexOf("#")!=0)
    	{
    		d.MM_p[j]=new Image;
    		d.MM_p[j++].src=a[i];
    	}
	}
}
//	find image
function _imgFind(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);
	}
  if (!(x=d[n])&&d.all) x=d.all[n];
  for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for (i=0;!x&&d.layers&&i<d.layers.length;i++) x=_imgFind(n,d.layers[i].document);
  if (!x && d.getElementById) x=d.getElementById(n);
  return x;
}
//	swap image
function _imgSwap()
{
	var i,j=0,x,a=_imgSwap.arguments;
	document.MM_sr=new Array;
	for(i=0;i<(a.length-2);i+=3)
		if ((x=_imgFind(a[i]))!=null)
		{
			document.MM_sr[j++]=x;
			if(!x.oSrc) x.oSrc=x.src;
			x.src=a[i+2];
		}
}
//	-------------------------------------------------------------------
//	dinamic popup menu
//	array of all layers
var layersToHide = [];
//
function hideAll()
{
	for ( i = 0; i < layersToHide.length; i++ )
	{
		hide( layersToHide[i] );
	}
}
//	hide layer
function hide(leerId)
{
	if (document.layers)
	{
		document.layers[leerId].visibility = 'hide';
	}
	else if (document.getElementById)
	{
		document.getElementById(leerId).style.visibility = 'hidden';
	}
	else if (document.all)
	{
		document.all[leerId].style.visibility = 'hidden';
	}
}
// show layer
function show(leerId)
{
	if (document.layers)
	{
		document.layers[leerId].visibility = 'show';
	}
	else if (document.getElementById)
	{
		document.getElementById(leerId).style.visibility = 'visible';
	}
	else if (document.all)
	{
		document.all[leerId].style.visibility = 'visible';
	}
}
//	set layer position
function setLayerPosition(leerId,ancName)
{
	var leerPos = new getLayerPosition(ancName);
	if (document.getElementById)
	{
		var leerElem = document.getElementById(leerId);
		leerElem.style.left = leerPos.x+1;
		leerElem.style.top = leerPos.y;
	}
	else if (document.all)
	{
		var leerElem = document.all[leerId];
		leerElem.style.left = leerPos.x;
		leerElem.style.top = leerPos.y;
	}
	else if (document.layers)
	{
		document.layers[leerId].left = leerPos.x;
		document.layers[leerId].top = leerPos.y;
	}
}
//	get x position of layer
function ancPosX(anchorPtr)
{
	if (document.layers)
	{
		return anchorPtr.x-2;
	}
	else if (document.getElementById || document.all)
	{
		var pos = anchorPtr.offsetLeft;
		while (anchorPtr.offsetParent != null)
		{
			anchorPtr = anchorPtr.offsetParent;
			pos += anchorPtr.offsetLeft;
		}
		return pos-2;
	}
}
//	get y position of layer
function ancPosY(anchorPtr)
{
	if (document.layers)
	{
		return anchorPtr.y+1;
	}
	else if (document.getElementById || document.all)
	{
		var pos = anchorPtr.offsetTop;
		while (anchorPtr.offsetParent != null)
		{
			anchorPtr = anchorPtr.offsetParent;
			pos += anchorPtr.offsetTop;
		}
		return pos+1;
	}
}
//	get layer position
function getLayerPosition(ancName)
{
	for (var i = 0; i < document.anchors.length; i++)
	{
		if (document.anchors[i].name == ancName)
		{
			this.x = ancPosX(document.anchors[i]);
			this.y = ancPosY(document.anchors[i]);
			return this;
		}
	}
}

if (document.layers)
{
	origWidth = window.innerWidth;
	origHeight = window.innerHeight;
}
//	window resize
function resizing()
{
	if (document.layers)
	{
		if (window.innerWidth != origWidth || window.innerHeight != origHeight) location.reload();
	}
	else hideAll();
}
window.onresize = resizing;
