var meny_bg_color;
var meny_bg_image;
var meny_over_bg_color;
var meny_over_bg_image;
var is_ie;

function getCssRuleBySelectorText(st)
{
	var styles;

	if(is_ie)
		styles=document.styleSheets[0].rules;
	else
		styles=document.styleSheets[0].cssRules;

	for(var x=0;styles.length && styles[x]!=null;x++)
	{
		if(styles[x].selectorText.toLowerCase()==st.toLowerCase())
			return styles[x];
	}

	return false;
}

function init_meny()
{	
	if(document.all)
		is_ie=true;
	else
		is_ie=false;

	meny_bg_color=getCssRuleBySelectorText('#hovedmeny a').style.backgroundColor;
	meny_bg_image=getCssRuleBySelectorText('#hovedmeny a').style.backgroundImage;
	meny_over_bg_color=getCssRuleBySelectorText('#hovedmeny a:hover').style.backgroundColor;
	meny_over_bg_image=getCssRuleBySelectorText('#hovedmeny a:hover').style.backgroundImage;

	change_meny_color();
}

function change_meny_color()
{
	var meny_items=document.getElementById('hovedmeny').getElementsByTagName('a');

	var curent_frame='';
	
	if(arguments[0])
		curent_frame=arguments[0];
	else
		curent_frame=parent.frames['innhold'].location.href;

	
	for(var x=0;x<meny_items.length;x++)
	{
		if(curent_frame==meny_items[x].href)
		{
			meny_items[x].style.backgroundColor=meny_over_bg_color;
			meny_items[x].style.backgroundImage=meny_over_bg_image;
		}
		else
		{
			meny_items[x].style.backgroundColor='';
			meny_items[x].style.backgroundImage='';
		}
	}
	
}
