
/***********************************************
* 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 KDUT_tickercontents[] to set the messges you wish be displayed (HTML codes accepted)
// Lyfter in denna i koden
//var KDUT_tickercontents=new Array()
//KDUT_tickercontents[0]='Visit our partner site <a href="http://freewarejava.com">Freewarejava.com</a> for free Java applets and resources!'
//KDUT_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.'
//KDUT_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 KDUT_charslimit=30

//Below specifies the "expand text". Do not remove onClick=".." portion.
var KDUT_expandtext='<a class="showAllLink" href="#" onClick="KDUT_dropdownit(event);return false">Visa alla</a> &#9660;' // ▼=&#9660;

//configure below variables to set dimensions and main color of the ticker
var KDUT_tickerwidth='150px'
var KDUT_tickerheight='55px' //not including "Expand" text
var KDUT_tickerbgcolor='#FFFFFF'

//configure the below variable to determine the delay between ticking of messages (in miliseconds)
var KDUT_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 KDUT_ietruebody(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

if (ns4){
	KDUT_expandtext=KDUT_expandtext.replace(/KDUT_dropdownit\(event\); *return false/gi, "return KDUT_dropdownitNS4(event,this)")
	KDUT_tickerheightNS4=parseInt(KDUT_tickerheight)+19
	KDUT_tickerlistheightNS4=KDUT_tickerheight
}

var KDUT_currentmessage=0
var KDUT_tickercontentstotal=''

if (ie4||ns6) //OUTPUT DROP DOWN MENU
document.write('<div id="KDUT_tickerexpand" class="expandmenu" style="visibility:hidden"></div>')

function KDUT_rotatecontent()
{
	if (KDUT_tickercontents.length==0)
		return; 
		
	if (ns4){ //OUTPUT HTML for ticker area for NS4
		KDUT_tickerobj.document.KDUT_tickernssub.document.write(KDUT_tickercontents[KDUT_currentmessage]+'')
		KDUT_tickerobj.document.KDUT_tickernssub.document.close()
	}
	else if (ie4||ns6){
		KDUT_tickerobj.innerHTML=KDUT_tickercontents[KDUT_currentmessage]
		previousmessage=(KDUT_currentmessage==0)? KDUT_tickercontents.length-1 : KDUT_currentmessage-1
		KDUT_tickerexpand_item=ns6? document.getElementById("KDUT_expand"+KDUT_currentmessage) : eval("KDUT_expand"+KDUT_currentmessage)
		KDUT_tickerexpand_previousitem=ns6? document.getElementById("KDUT_expand"+previousmessage) : eval("KDUT_expand"+previousmessage)
		KDUT_tickerexpand_previousitem.className=""
		KDUT_tickerexpand_item.className="expandmenu_highlight"
	}
	KDUT_currentmessage=(KDUT_currentmessage==KDUT_tickercontents.length-1)? 0 : KDUT_currentmessage+1
	KDUT_rotatemsgtimer=setTimeout("KDUT_rotatecontent()",KDUT_tickdelay)
}

function KDUT_dropdownit(e){
	if (ns6) e.stopPropagation()
	else e.cancelBubble=true
	KDUT_tickerexpandobj.style.visibility=KDUT_tickerexpandobj.style.visibility=="hidden"? "visible" : "hidden"
	KDUT_expandbuttonLeft=ns6? e.pageX-e.layerX : KDUT_ietruebody().scrollLeft+event.clientX-event.offsetX
	KDUT_expandbuttonTop=ns6? e.pageY-e.layerY : KDUT_ietruebody().scrollTop+event.clientY-event.offsetY
	KDUT_tickerexpandobj.style.left=KDUT_expandbuttonLeft+"px"
	KDUT_tickerexpandobj.style.top=KDUT_expandbuttonTop+KDUT_expandbuttonobj.offsetHeight-3+"px"
}

function KDUT_dropdownitNS4(e, currentobj){
	KDUT_tickerexpandobj.left=KDUT_tickerobj.pageX
	KDUT_tickerexpandobj.top=KDUT_tickerobj.pageY+parseInt(KDUT_tickerlistheightNS4)+KDUT_tickerobj.document.KDUT_expandbuttonNS4.document.height
	KDUT_tickerexpandobj.visibility=(KDUT_tickerexpandobj.visibility=="hide")? "show" : "hide"
	return false
}

function KDUT_jumptomsg(whichmsg){
	clearTimeout(KDUT_rotatemsgtimer)
	if (ie4||ns6)
	KDUT_tickerexpand_item.className=""
	KDUT_currentmessage=whichmsg
	KDUT_rotatecontent()
}

function KDUT_initialize_ticker(){
	if (ns4) document.KDUT_tickernsmain.visibility="show"
	KDUT_tickerobj=ie4? KDUT_tickerlist : ns6? document.getElementById("KDUT_tickerlist") : ns4? document.KDUT_tickernsmain : ""
	KDUT_tickerexpandobj=ie4? KDUT_tickerexpand : ns6? document.getElementById("KDUT_tickerexpand") : ns4? document.KDUT_expandlayer : ""
	KDUT_expandbuttonobj=ie4? KDUT_expandbutton : ns6? document.getElementById("KDUT_expandbutton") : ""
	for (i=0;i<KDUT_tickercontents.length;i++){ //get total scroller contents
		tempstringcontainer=KDUT_tickercontents[i].replace(/\<[^\>]+\>/g, ''); //remove HTML tags
		KDUT_tickercontentstotal+='<div id="KDUT_expand'+i+'">- <a href="javascript:KDUT_jumptomsg('+i+')">'+tempstringcontainer.substring(0, KDUT_charslimit)+'...</a></div>'
	}
	if (ie4||ns6){
		KDUT_tickerexpandobj.innerHTML=KDUT_tickercontentstotal
		KDUT_expandbuttonobj.innerHTML=KDUT_expandtext
		document.onclick=function(){
			KDUT_tickerexpandobj.style.visibility="hidden"
		}
	}
	else if (ns4){
		KDUT_tickerexpandobj.document.write(KDUT_tickercontentstotal)
		KDUT_tickerexpandobj.document.close()
		KDUT_tickerexpandobj.clip.width=parseInt(KDUT_tickerwidth)*0.9
		KDUT_tickerobj.document.KDUT_expandbuttonNS4.document.write(KDUT_expandtext)
		KDUT_tickerobj.document.KDUT_expandbuttonNS4.document.close()
		KDUT_tickerexpandobj.captureEvents(Event.CLICK)
		KDUT_tickerexpandobj.onclick=function(){
			KDUT_tickerexpandobj.visibility="hide"
		}
	}
	KDUT_rotatecontent()
}

if (ie4||ns6) //OUT HTML FOR TICKER AREA for IE/NS6
document.write('<table id="KDUT_tickerarea" border="0" style="width:'+KDUT_tickerwidth+';" bgcolor="'+KDUT_tickerbgcolor+'" cellspacing="0" cellpadding="0"><tr><td id="KDUT_tickerlist" width="100%" height="'+KDUT_tickerheight+'" style="padding-left:3px" valign="top"></td></tr><tr><td width="90%"><div id="KDUT_expandbutton" style="position:relative"></div></td></tr></table>')

//window.onload=KDUT_initialize_ticker
