

/***********************************************
*  1
***********************************************/





/***********************************************
* Pausing up-down scroller- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

function ex1_pausescroller(content, divId, divClass, delay){
this.content=content 					//message array content
this.tickerid=divId 					//ID of ticker div to display information
this.delay=delay 					//Delay between msg change, in miliseconds.
this.mouseoverBol=0 					//Boolean to indicate whether mouse is currently over scroller (and pause it if it is)
this.ex1_hiddendivpointer=1 				//index of message array for hidden div
document.write('<div id="'+divId+'" class="'+divClass+'" style="position: relative; overflow: hidden"><div class="innerDiv" style="position: absolute; width: 100%" id="'+divId+'1">'+content[0]+'</div><div class="innerDiv" style="position: absolute; width: 100%; visibility: hidden" id="'+divId+'2">'+content[1]+'</div></div>')
var ex1_scrollerinstance=this
if (window.addEventListener) 				//run onload in DOM2 browsers
window.addEventListener("load", function(){ex1_scrollerinstance.initialize()}, false)
else if (window.attachEvent) 				//run onload in IE5.5+
window.attachEvent("onload", function(){ex1_scrollerinstance.initialize()})
else if (document.getElementById) 			//if legacy DOM browsers, just start scroller after 0.5 sec
setTimeout(function(){ex1_scrollerinstance.initialize()}, 500)
}

// -------------------------------------------------------------------
// initialize()- Initialize scroller method.
// -Get div objects, set initial positions, start up down animation
// -------------------------------------------------------------------

ex1_pausescroller.prototype.initialize=function(){
this.ex1_tickerdiv=document.getElementById(this.tickerid)
this.ex1_visiblediv=document.getElementById(this.tickerid+"1")
this.ex1_hiddendiv=document.getElementById(this.tickerid+"2")
this.ex1_visibledivtop=parseInt(ex1_pausescroller.getCSSpadding(this.ex1_tickerdiv))
//set width of inner DIVs to outer DIV's width minus padding (padding assumed to be top padding x 2)
this.ex1_visiblediv.style.width=this.ex1_hiddendiv.style.width=this.ex1_tickerdiv.offsetWidth-(this.ex1_visibledivtop*2)+"px"
this.getinline(this.ex1_visiblediv, this.ex1_hiddendiv)
this.ex1_hiddendiv.style.visibility="visible"
var ex1_scrollerinstance=this
document.getElementById(this.tickerid).onmouseover=function(){ex1_scrollerinstance.mouseoverBol=1}
document.getElementById(this.tickerid).onmouseout=function(){ex1_scrollerinstance.mouseoverBol=0}
if (window.attachEvent) //Clean up loose references in IE
window.attachEvent("onunload", function(){ex1_scrollerinstance.ex1_tickerdiv.onmouseover=ex1_scrollerinstance.ex1_tickerdiv.onmouseout=null})
setTimeout(function(){ex1_scrollerinstance.animateup()}, this.delay)
}


// -------------------------------------------------------------------
// animateup()- Move the two inner divs of the scroller up and in sync
// -------------------------------------------------------------------

ex1_pausescroller.prototype.animateup=function(){
var ex1_scrollerinstance=this
if (parseInt(this.ex1_hiddendiv.style.top)>(this.ex1_visibledivtop+5)){
this.ex1_visiblediv.style.top=parseInt(this.ex1_visiblediv.style.top)-5+"px"
this.ex1_hiddendiv.style.top=parseInt(this.ex1_hiddendiv.style.top)-5+"px"
setTimeout(function(){ex1_scrollerinstance.animateup()}, 50)
}
else{
this.getinline(this.ex1_hiddendiv, this.ex1_visiblediv)
this.swapdivs()
setTimeout(function(){ex1_scrollerinstance.setmessage()}, this.delay)
}
}

// -------------------------------------------------------------------
// swapdivs()- Swap between which is the visible and which is the hidden div
// -------------------------------------------------------------------

ex1_pausescroller.prototype.swapdivs=function(){
var ex1_tempcontainer=this.ex1_visiblediv
this.ex1_visiblediv=this.ex1_hiddendiv
this.ex1_hiddendiv=ex1_tempcontainer
}

ex1_pausescroller.prototype.getinline=function(div1, div2){
div1.style.top=this.ex1_visibledivtop+"px"
div2.style.top=Math.max(div1.parentNode.offsetHeight, div1.offsetHeight)+"px"
}

// -------------------------------------------------------------------
// setmessage()- Populate the hidden div with the next message before it's visible
// -------------------------------------------------------------------

ex1_pausescroller.prototype.setmessage=function(){
var ex1_scrollerinstance=this
if (this.mouseoverBol==1) //if mouse is currently over scoller, do nothing (pause it)
setTimeout(function(){ex1_scrollerinstance.setmessage()}, 100)
else{
var i=this.ex1_hiddendivpointer
var ex1_ceiling=this.content.length
this.ex1_hiddendivpointer=(i+1>ex1_ceiling-1)? 0 : i+1
this.ex1_hiddendiv.innerHTML=this.content[this.ex1_hiddendivpointer]
this.animateup()
}
}

ex1_pausescroller.getCSSpadding=function(tickerobj){ //get CSS padding value, if any
if (tickerobj.currentStyle)
return tickerobj.currentStyle["paddingTop"]
else if (window.getComputedStyle) //if DOM2
return window.getComputedStyle(tickerobj, "").getPropertyValue("padding-top")
else
return 0
}






/***********************************************
*  11
***********************************************/



function ex11_changecontent(){
  if (ex11_index>=ex11_fcontent.length)
    ex11_index=0
  if (ex11_DOM2){
    document.getElementById("ex11_fscroller").style.color="rgb("+ex11_startcolor[0]+", "+ex11_startcolor[1]+", "+ex11_startcolor[2]+")"
    document.getElementById("ex11_fscroller").innerHTML=ex11_begintag+ex11_fcontent[ex11_index]+ex11_closetag
    if (ex11_fadelinks)
      ex11_linkcolorchange(1);
    ex11_colorfade(1, 15);
  }
  else if (ex11_ie4)
    document.all.ex11_fscroller.innerHTML=ex11_begintag+ex11_fcontent[ex11_index]+ex11_closetag;
  ex11_index++
}


function ex11_linkcolorchange(step){
  var obj=document.getElementById("ex11_fscroller").getElementsByTagName("A");
  if (obj.length>0){
    for (i=0;i<obj.length;i++)
      obj[i].style.color=ex11_getstepcolor(step);
  }
}

var ex11_fadecounter;
function ex11_colorfade(step) {
  if(step<=ex11_maxsteps) {
    document.getElementById("ex11_fscroller").style.color=ex11_getstepcolor(step);
    if (ex11_fadelinks)
      ex11_linkcolorchange(step);
    step++;
    ex11_fadecounter=setTimeout("ex11_colorfade("+step+")",stepex11_delay);
  }else{
    clearTimeout(ex11_fadecounter);
    document.getElementById("ex11_fscroller").style.color="rgb("+ex11_endcolor[0]+", "+ex11_endcolor[1]+", "+ex11_endcolor[2]+")";
    setTimeout("ex11_changecontent()", ex11_delay);

  }
}

function ex11_getstepcolor(step) {
  var ex11_diff
  var ex11_newcolor=new Array(3);
  for(var i=0;i<3;i++) {
    ex11_diff = (ex11_startcolor[i]-ex11_endcolor[i]);
    if(ex11_diff > 0) {
      ex11_newcolor[i] = ex11_startcolor[i]-(Math.round((ex11_diff/ex11_maxsteps))*step);
    } else {
      ex11_newcolor[i] = ex11_startcolor[i]+(Math.round((Math.abs(ex11_diff)/ex11_maxsteps))*step);
    }
  }
  return ("rgb(" + ex11_newcolor[0] + ", " + ex11_newcolor[1] + ", " + ex11_newcolor[2] + ")");
}



