/***********************************************
* Memory Ticker script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

//configure tickercontents[] to set the messges you wish be displayed (HTML codes accepted)
//Backslash any apostrophes within your text (ie: I\'m the king of the world!)
var tickercontents=new Array()
tickercontents[0]='<div class="lurisen"><div class="bilarna"><img src="/bilar/WOS082_bil.gif" style="z-index:10; position: absolute; top:-10px; filter:alpha(opacity=100); -moz-opacity: 1.0;"></div><div class="bilarna"><img src="/bilar/WOS082_win.gif" style="z-index:11; position: absolute; top: -10px; filter:alpha(opacity=50); -moz-opacity: 0.50;"></div></div>'
tickercontents[1]='<div class="lurisen"><div class="bilarna"><img src="/bilar/JJP995_bil.gif" style="z-index:10; position: absolute; top: 18px; filter:alpha(opacity=100); -moz-opacity: 1.0;"></div><div class="bilarna"><img src="/bilar/JJP995_win.gif" style="z-index:11; position: absolute; top: 18px; filter:alpha(opacity=50); -moz-opacity: 0.50;"></div></div>'
tickercontents[2]='<div class="lurisen"><div class="certifikat"><a href="javascript:sidbytare(\'sida_certifiering\',\'sida_\');"><img src="/bilar/certifikat1.gif" style="z-index:16;"></a></div></div>'
tickercontents[3]='<div class="lurisen"><div class="bilarna"><img src="/bilar/SMN373_bil.gif" style="z-index:10; filter:alpha(opacity=100); -moz-opacity: 1.0;"></div><div class="bilarna"><img src="/bilar/SMN373_win.gif" style="z-index:11; filter:alpha(opacity=50); -moz-opacity: 0.50;"></div></div>'
tickercontents[4]='<div class="lurisen"><div class="bilarna"><img src="/bilar/WFE089_bil.gif" style="z-index:10; position: absolute; top:-10px; filter:alpha(opacity=100); -moz-opacity: 1.0;"></div><div class="bilarna"><img src="/bilar/WFE089_win.gif" style="z-index:11; position: absolute; top:-10px; filter:alpha(opacity=50); -moz-opacity: 0.50;"></div></div>'
tickercontents[5]='<div class="lurisen"><div class="certifikat"><a href="javascript:sidbytare(\'sida_expressfrakter\',\'sida_\');"><img src="/bilar/certifikat2.gif" style="z-index:16;"></a></div></div>'
tickercontents[6]='<div class="lurisen"><div class="bilarna"><img src="/bilar/SNN839_bil.gif" style="z-index:10; position: absolute; top:-2px; filter:alpha(opacity=100); -moz-opacity: 1.0;"></div><div class="bilarna"><img src="/bilar/SNN839_win.gif" style="z-index:11; position: absolute; top:-2px; filter:alpha(opacity=50); -moz-opacity: 0.50;"></div></div>'

var persistlastviewedmsg=1 //should messages' order persist after users navigate away (1=yes, 0=no)?
var persistmsgbehavior="onload" //set to "onload" or "onclick".

//configure the below variable to determine the delay between ticking of messages (in miliseconds):
var tickdelay=3500

////Do not edit pass this line////////////////

var divonclick=(persistlastviewedmsg && persistmsgbehavior=="onclick")? 'onClick="savelastmsg()" ' : ''
var currentmessage=0

function changetickercontent(){
if (crossfadetick.filters && crossfadetick.filters.length>0)
crossfadetick.filters[0].Apply()
crossfadetick.innerHTML=tickercontents[currentmessage]
if (crossfadetick.filters && crossfadetick.filters.length>0)
crossfadetick.filters[0].Play()
currentmessage=(currentmessage==tickercontents.length-1)? currentmessage=0 : currentmessage+1
//currentmessage=Math.round(Math.random()*(tickercontents.length-1))
var filterduration=(crossfadetick.filters&&crossfadetick.filters.length>0)? crossfadetick.filters[0].duration*750 : 0
setTimeout("changetickercontent()",tickdelay+filterduration)
}

function beginticker(){
if (persistlastviewedmsg && get_cookie("lastmsgnum")!="")
revivelastmsg()
crossfadetick=document.getElementById? document.getElementById("bil_dimmer") : document.all.bil_dimmer
changetickercontent()
}

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;
}

function savelastmsg(){
document.cookie="lastmsgnum="+currentmessage
}

function revivelastmsg(){
currentmessage=parseInt(get_cookie("lastmsgnum"))
currentmessage=(currentmessage==0)? tickercontents.length-1 : currentmessage-1
}

if (persistlastviewedmsg && persistmsgbehavior=="onload")
window.onunload=savelastmsg

if (document.all||document.getElementById)
document.write('<div id="bil_dimmer" '+divonclick+'></div>')
if (window.addEventListener)
window.addEventListener("load", beginticker, false)
else if (window.attachEvent)
window.attachEvent("onload", beginticker)
else if (document.all || document.getElementById)
window.onload=beginticker
