﻿//Translucent scroller- By Dynamic Drive
//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
//This credit MUST stay intact for use

var bgcolor='#000000'
var pause=8000 //SET PAUSE BETWEEN SLIDE (1000=1 seconds)

var scrollercontent=new Array()
var news = new Array()

var scroller_width='380px'
var scroller_height='545px'
var itemHt = new Array()

attachEventListener(window, "resize", setScrollSize, false);
attachEventListener(window, "resize", resizeScroller, false);
setScrollSize();

//Define scroller contents. Extend or contract array as needed
scrollercontent[0]='<table width="100%" class="photoTable2"><tr><td class="whatsnew_photo4"></td></tr><!---<tr><th scope="col">Caption</th></tr>---></table>'
scrollercontent[1]='<table width="100%" class="photoTable2"><tr><td class="whatsnew_photo7"></td></tr><!---<tr><th scope="col">Caption</th></tr>---></table>'
scrollercontent[2]='<table width="100%" class="photoTable2"><tr><td class="whatsnew_photo6"></td></tr><!---<tr><th scope="col">Caption</th></tr>---></table>'
news[0] = "The Journal of Consumer Psychology announces a special issue on the Application of Behavioral Decision Theory (BDT) in Consumer Psychology. The call for papers can be found <a class=\"icon pdf-file\" href=\"pdf/Special Issue of JCP on Behavioral Decision Theory.pdf\">here</a>.<br /><br />";
news[1] = "Editor CW Park wants authors to think of these jolly cute puppies when they think of JCP.<br /><br />";
news[2] = "The Journal of Consumer Psychology announces a call for papers on topics related to brands from psychological and neurophysiological perspectives. More information can be found <a class=\"icon pdf-file\" href=\"pdf/JCP_Special Issue_CFP.pdf\">here</a>.<br /><br />";

////NO need to edit beyond here/////////////

var ie4=document.all
var dom=document.getElementById&&navigator.userAgent.indexOf("Opera")==-1

if (ie4||dom)
document.write('<div id="scrollerdiv" style="position:relative;width:'+scroller_width+';height:'+scroller_height+';overflow:hidden"><div id="canvas0" style="position:absolute;background-color:'+bgcolor+';width:'+scroller_width+';height:'+scroller_height+';top:'+scroller_height+';filter:alpha(opacity=20);-moz-opacity:0.2;"></div><div id="canvas1" style="position:absolute;background-color:'+bgcolor+';width:'+scroller_width+';height:'+scroller_height+';top:'+scroller_height+';filter:alpha(opacity=20);-moz-opacity:0.2;"></div></div>')
else if (document.layers){
document.write('<ilayer id=tickernsmain visibility=hide width='+scroller_width+' height='+scroller_height+' bgColor='+bgcolor+'><layer id=tickernssub width='+scroller_width+' height='+scroller_height+' left=0 top=0>'+scrollercontent[0]+'</layer></ilayer>')
}

var curpos=scroller_height*(1)
var degree=10
var curcanvas="canvas0"
var curindex=0
var nextindex=1
var txtindex = 0

function movenews(){
if (curpos>0){
curpos=Math.max(curpos-degree,0)
tempobj.style.top=curpos+"px"
}
else{
clearInterval(dropslide)
if (crossobj.filters)
crossobj.filters.alpha.opacity=100
else if (crossobj.style.MozOpacity)
crossobj.style.MozOpacity=1
nextcanvas=(curcanvas=="canvas0")? "canvas0" : "canvas1"
tempobj=ie4? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas)
tempobj.innerHTML=scrollercontent[curindex]
document.getElementById("newscontent").innerHTML = news[txtindex];
nextindex=(nextindex<scrollercontent.length-1)? nextindex+1 : 0
setTimeout("rotatenews()",pause)
}
}

function rotatenews(){
if (ie4||dom){
resetit(curcanvas)
crossobj=tempobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
crossobj.style.zIndex++
if (crossobj.filters)
document.all.canvas0.filters.alpha.opacity=document.all.canvas1.filters.alpha.opacity=20
else if (crossobj.style.MozOpacity)
document.getElementById("canvas0").style.MozOpacity=document.getElementById("canvas1").style.MozOpacity=0.2
var temp='setInterval("movenews()",50)'
dropslide=eval(temp)
curcanvas=(curcanvas=="canvas0")? "canvas1" : "canvas0"
}
else if (document.layers){
crossobj.document.write(scrollercontent[curindex])
crossobj.document.close()
}

resizeScroller();

txtindex = curindex;
curindex=(curindex<scrollercontent.length-1)? curindex+1 : 0
}

function resizeScroller() {
    scroller_height = itemHt[curindex];
    document.getElementById("scrollerdiv").style.height = scroller_height;
    document.getElementById("canvas0").style.height = scroller_height;
    document.getElementById("canvas1").style.height = scroller_height;
    document.getElementById("scrollerdiv").style.width = scroller_width;
    document.getElementById("canvas0").style.width = scroller_width;
    document.getElementById("canvas1").style.width = scroller_width;
}

function resetit(what){
	curpos=parseInt(scroller_height)*(1)
	var crossobj=ie4? eval("document.all."+what) : document.getElementById(what)
	crossobj.style.top=curpos+"px"
}

function startit(){
	crossobj=ie4? eval("document.all."+curcanvas) : dom? document.getElementById(curcanvas) : document.tickernsmain.document.tickernssub
	if (ie4||dom){
		crossobj.innerHTML=scrollercontent[curindex]
		rotatenews()
	} else {
		document.tickernsmain.visibility='show'
		curindex++
		setInterval("rotatenews()",pause)
	}
}

function setScrollSize() {
    var theWidth = getBrowserWidth();
    if (theWidth <= 800) {
        scroller_width='180px'
        scroller_height='167px'
        itemHt[0] = "167px";
        itemHt[1] = "152px";
        itemHt[2] = "281px";
    } else {
        scroller_width='280px'
        scroller_height='253px'
        itemHt[0] = "253px";
        itemHt[1] = "232px";
        itemHt[2] = "281px";
    }
}

if (ie4||dom||document.layers)
window.onload=startit
//moved this to slideshow-horz.js

