// Olovs JavaScript Document

function displayLi(){ //Expandera länklista i vänsternav-bar
	var div_nav=document.getElementById('nav_v');
   var lis=div_nav.getElementsByTagName("LI");
    for (var i=0; i < lis.length; i++) {
      restore(lis[i]); 
    }
}
  
  function restore(spanElement) {
		spanElement.style.display = 'list-item';
  }

/*toggle functions */
function toggleLayer( whichLayer )
{
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}

/* END toggel functions */


/*
	mfsct - Microformats scanner class tool 
	written by Chris Heilmann (http://icant.co.uk) building on scripts by 
	Jonathan Snook, http://www.snook.ca/jonathan and 
	Robert Nyman, http://www.robertnyman.com
*/	
mfsct = {
	check:function(oElm, strClassName){
	    strClassName = strClassName.replace(/\-/g, "\\-");
	    var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
		return oRegExp.test(oElm.className);
	},
	add:function(oElm, strClassName){
		if(!mfsct.check(oElm, strClassName)){
			oElm.className+=oElm.className?' '+strClassName:strClassName;
		}
	},
	remove:function(oElm, strClassName){
		var rep=oElm.className.match(' '+strClassName)?' '+strClassName:strClassName;
	    oElm.className=oElm.className.replace(rep,'');
	    oElm.className.replace(/^\s./,'');
	},
	display:function(o){
		if(o.className){o = o.className;}
		if(window.console){
			window.console.log(o);
		} else {
			alert(o);
		}
	},
	getElements:function(oElm, strTagName, strClassName){
	    var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
	    var arrReturnElements = [];
	    for(var i=0; i<arrElements.length; i++){
	        var temp = arrElements[i];      
			if(mfsct.check(temp, strClassName)){
				arrReturnElements.push(temp);
			}
	    }
	    return (arrReturnElements)
	}
}	

//textscroll mainpage

/***********************************************
* Sequential Content Revealer- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
* Visit DynamicDrive.com for hundreds of original DHTML scripts
* This notice must stay intact for legal use
* Manual finns på http://www.dynamicdrive.com/dynamicindex17/seqreveal.htm
***********************************************/

var contentpause=2000 //customize time each content should pause for before the next one is revealed (1000=1 second)
var once_session=0 //Should "reveal" animation only be applied once per browser session? (0=no, 1=yes):

var curobjindex=0
var orderoffset=100

function collectElementbyClass(){
var classname="revealcontent"
glidearray=new Array()
var inc=0
var alltags=document.all? document.all : document.getElementsByTagName("*")
for (i=0; i<alltags.length; i++){
if (alltags[i].className==classname){
glidearray[inc++]=alltags[i]
glidearray[inc-1].displayorder=(glidearray[inc-1].getAttribute("displayorder"))? parseInt(glidearray[inc-1].getAttribute("displayorder")) : inc+orderoffset
}
}
if (glidearray.length>0){
glidearray.sort(compareorder)
seqreveal()
}
}

function seqreveal(){
if (curobjindex<glidearray.length){
glidearray[curobjindex].style.visibility="visible"
var actualpause=(glidearray[curobjindex].getAttribute("pausesec"))? parseFloat(glidearray[curobjindex].getAttribute("pausesec"))*1000 : parseFloat(contentpause)
glidetimer=setTimeout("seqreveal()",actualpause)
curobjindex++
}
}

function compareorder(a, b){
return a.displayorder-b.displayorder
}

function get_cookie(Name) {
var search = Name + "="
var returnvalue = ""
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset)
if (end == -1)
end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

if (once_session && get_cookie("textdisplayed")=="" || !once_session){
if (window.addEventListener)
window.addEventListener("load", collectElementbyClass, false)
else if (window.attachEvent)
window.attachEvent("onload", collectElementbyClass)
else if (document.getElementById)
window.onload=collectElementbyClass

if (once_session)
document.cookie="textdisplayed=yes"
}
else
document.write('<style>\n.revealcontent{visibility:visible;}\n</style>')