
/***********************************************
* George's Expandable Ticker- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

//configure KDUM_tickercontents[] to set the messges you wish be displayed (HTML codes accepted)
// Lyfter in denna i koden
//var KDUM_tickercontents=new Array()
//KDUM_tickercontents[0]='Visit our partner site <a href="http://freewarejava.com">Freewarejava.com</a> for free Java applets and resources!'
//KDUM_tickercontents[1]='Got JavaScript? <a href="http://www.javascriptkit.com">JavaScript Kit</a> is the most comprehensive JavaScript site online. Also features a developer\'s help forum.'
//KDUM_tickercontents[2]='Show your support for Dynamic Drive by linking to us on your site. Please visit our <a href="http://www.dynamicdrive.com/link.htm">links page</a>.'

//specify how many characters of a message (for each msg) to show in expanded menu:
var KDUM_charslimit=30

//Below specifies the "expand text". Do not remove onClick=".." portion.
var KDUM_expandtext='<a class="showAllLink" href="#" onClick="KDUM_dropdownit(event);return false">Visa alla</a> &#9660;' // ▼=&#9660;

//configure below variables to set dimensions and main color of the ticker
var KDUM_tickerwidth='150px'
var KDUM_tickerheight='75px' //not including "Expand" text
var KDUM_tickerbgcolor='#FFFFFF'

//configure the below variable to determine the delay between ticking of messages (in miliseconds)
var KDUM_tickdelay=2500

////Do not edit pass this line////////////////

//var ie4=document.all || navigator.userAgent.search(/opera.7/i)!=-1 //lump Opera 7 with IE
//var ns6=document.getElementById && !document.all && !window.opera
//var ns4=document.layers


function KDUM_ietruebody(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

if (ns4){
	KDUM_expandtext=KDUM_expandtext.replace(/KDUM_dropdownit\(event\); *return false/gi, "return KDUM_dropdownitNS4(event,this)")
	KDUM_tickerheightNS4=parseInt(KDUM_tickerheight)+19
	KDUM_tickerlistheightNS4=KDUM_tickerheight
}

var KDUM_currentmessage=0
var KDUM_tickercontentstotal=''

if (ie4||ns6) //OUTPUT DROP DOWN MENU
document.write('<div id="KDUM_tickerexpand" class="expandmenu" style="visibility:hidden"></div>')

function KDUM_rotatecontent()
{
	if (KDUM_tickercontents.length==0)
		return; 
		
	if (ns4){ //OUTPUT HTML for ticker area for NS4
		KDUM_tickerobj.document.KDUM_tickernssub.document.write(KDUM_tickercontents[KDUM_currentmessage]+'')
		KDUM_tickerobj.document.KDUM_tickernssub.document.close()
	}
	else if (ie4||ns6){
		KDUM_tickerobj.innerHTML=KDUM_tickercontents[KDUM_currentmessage]
		previousmessage=(KDUM_currentmessage==0)? KDUM_tickercontents.length-1 : KDUM_currentmessage-1
		KDUM_tickerexpand_item=ns6? document.getElementById("KDUM_expand"+KDUM_currentmessage) : eval("KDUM_expand"+KDUM_currentmessage)
		KDUM_tickerexpand_previousitem=ns6? document.getElementById("KDUM_expand"+previousmessage) : eval("KDUM_expand"+previousmessage)
		KDUM_tickerexpand_previousitem.className=""
		KDUM_tickerexpand_item.className="expandmenu_highlight"
	}
	KDUM_currentmessage=(KDUM_currentmessage==KDUM_tickercontents.length-1)? 0 : KDUM_currentmessage+1
	KDUM_rotatemsgtimer=setTimeout("KDUM_rotatecontent()",KDUM_tickdelay)
}

function KDUM_dropdownit(e){
	if (ns6) e.stopPropagation()
	else e.cancelBubble=true
	KDUM_tickerexpandobj.style.visibility=KDUM_tickerexpandobj.style.visibility=="hidden"? "visible" : "hidden"
	KDUM_expandbuttonLeft=ns6? e.pageX-e.layerX : KDUM_ietruebody().scrollLeft+event.clientX-event.offsetX
	KDUM_expandbuttonTop=ns6? e.pageY-e.layerY : KDUM_ietruebody().scrollTop+event.clientY-event.offsetY
	KDUM_tickerexpandobj.style.left=KDUM_expandbuttonLeft+"px"
	KDUM_tickerexpandobj.style.top=KDUM_expandbuttonTop+KDUM_expandbuttonobj.offsetHeight-3+"px"
}

function KDUM_dropdownitNS4(e, currentobj){
	KDUM_tickerexpandobj.left=KDUM_tickerobj.pageX
	KDUM_tickerexpandobj.top=KDUM_tickerobj.pageY+parseInt(KDUM_tickerlistheightNS4)+KDUM_tickerobj.document.KDUM_expandbuttonNS4.document.height
	KDUM_tickerexpandobj.visibility=(KDUM_tickerexpandobj.visibility=="hide")? "show" : "hide"
	return false
}

function KDUM_jumptomsg(whichmsg){
	clearTimeout(KDUM_rotatemsgtimer)
	if (ie4||ns6)
	KDUM_tickerexpand_item.className=""
	KDUM_currentmessage=whichmsg
	KDUM_rotatecontent()
}

function KDUM_initialize_ticker(){
	if (ns4) document.KDUM_tickernsmain.visibility="show"
	KDUM_tickerobj=ie4? KDUM_tickerlist : ns6? document.getElementById("KDUM_tickerlist") : ns4? document.KDUM_tickernsmain : ""
	KDUM_tickerexpandobj=ie4? KDUM_tickerexpand : ns6? document.getElementById("KDUM_tickerexpand") : ns4? document.KDUM_expandlayer : ""
	KDUM_expandbuttonobj=ie4? KDUM_expandbutton : ns6? document.getElementById("KDUM_expandbutton") : ""
	for (i=0;i<KDUM_tickercontents.length;i++){ //get total scroller contents
		tempstringcontainer=KDUM_tickercontents[i].replace(/\<[^\>]+\>/g, ''); //remove HTML tags
		KDUM_tickercontentstotal+='<div id="KDUM_expand'+i+'">- <a href="javascript:KDUM_jumptomsg('+i+')">'+tempstringcontainer.substring(0, KDUM_charslimit)+'...</a></div>'
	}
	if (ie4||ns6){
		KDUM_tickerexpandobj.innerHTML=KDUM_tickercontentstotal
		KDUM_expandbuttonobj.innerHTML=KDUM_expandtext
		document.onclick=function(){
			KDUM_tickerexpandobj.style.visibility="hidden"
		}
	}
	else if (ns4){
		KDUM_tickerexpandobj.document.write(KDUM_tickercontentstotal)
		KDUM_tickerexpandobj.document.close()
		KDUM_tickerexpandobj.clip.width=parseInt(KDUM_tickerwidth)*0.9
		KDUM_tickerobj.document.KDUM_expandbuttonNS4.document.write(KDUM_expandtext)
		KDUM_tickerobj.document.KDUM_expandbuttonNS4.document.close()
		KDUM_tickerexpandobj.captureEvents(Event.CLICK)
		KDUM_tickerexpandobj.onclick=function(){
			KDUM_tickerexpandobj.visibility="hide"
		}
	}
	KDUM_rotatecontent()
}

if (ie4||ns6) //OUT HTML FOR TICKER AREA for IE/NS6
document.write('<table id="KDUM_tickerarea" border="0" style="width:'+KDUM_tickerwidth+';" bgcolor="'+KDUM_tickerbgcolor+'" cellspacing="0" cellpadding="0"><tr><td id="KDUM_tickerlist" width="100%" height="'+KDUM_tickerheight+'" style="padding-left:3px" valign="top"></td></tr><tr><td width="90%"><div id="KDUM_expandbutton" style="position:relative"></div></td></tr></table>')

//window.onload=KDUM_initialize_ticker
