// JavaScript Document

	var aIdCurrent = 'a1';
	var divIdCurrent = 'element1';
	
	function select(aId, divId)
	{
		document.getElementById(aIdCurrent).className = '';
		document.getElementById(divIdCurrent).style.display = 'none';
		aIdCurrent = aId;
		divIdCurrent = divId;
		document.getElementById(aIdCurrent).className = 'selected';
		document.getElementById(divIdCurrent).style.display = 'block';
	}

   function show(element, showPrefix, hidePrefix)
   {
      var children = element.childNodes;
      for (var i = 0; i < children.length; i++)
      {
         var child = children[i];
         if (child.className != null)
            if (child.className.indexOf(showPrefix) == 0)
            {
               if (child.displayBackup != null)
                  child.style.display = child.displayBackup;
               child.style.display = 'block';
            }
            else
            if (child.className.indexOf(hidePrefix) == 0)
            {
               if (child.displayBackup == null)
                  child.displayBackup = child.style.display;
               child.style.display = "none";
            }
         show(child, showPrefix, hidePrefix);
      }
   }
   function getCookie(name, defaultValue)
   {
   	var start = document.cookie.indexOf(name + '=');
   	var value = defaultValue;
   	if (start != -1)
   	{
   		start += name.length + 1;
   		var end = document.cookie.indexOf(';', start);
   		if (end == -1)
	   		value = document.cookie.slice(start);
	   	else
	   		value = document.cookie.slice(start, end);
   	}
   	return value;
   }
   function english()
   {
   	document.cookie = 'language=english;path=/;max-age=31536000';
   	document.body.className = 'english';
      //show(document.body, "en_", "no_");
   }
   function norsk()
   {
   	document.cookie = 'language=norsk;path=/;max-age=31536000';
   	document.body.className = 'norsk';
      //show(document.body, "no_", "en_");
   }
   
   window.onload = function()
   {
   	var language = getCookie('language', 'norsk');
   	if (language == 'norsk')
   		norsk();
   	else
   		english();
   }
   
function MM_findObj(n, d) { //v4.01
  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=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

