/***********************************************
* 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 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.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 scrollerinstance=this
if (window.addEventListener) //run onload in DOM2 browsers
window.addEventListener("load", function(){scrollerinstance.initialize()}, false)
else if (window.attachEvent) //run onload in IE5.5+
window.attachEvent("onload", function(){scrollerinstance.initialize()})
else if (document.getElementById) //if legacy DOM browsers, just start scroller after 0.5 sec
setTimeout(function(){scrollerinstance.initialize()}, 500)
}

// -------------------------------------------------------------------
// initialize()- Initialize scroller method.
// -Get div objects, set initial positions, start up down animation
// -------------------------------------------------------------------

pausescroller.prototype.initialize=function(){
this.tickerdiv=document.getElementById(this.tickerid)
this.visiblediv=document.getElementById(this.tickerid+"1")
this.hiddendiv=document.getElementById(this.tickerid+"2")
this.visibledivleft=parseInt(pausescroller.getCSSpadding(this.tickerdiv))
//set width of inner DIVs to outer DIV's width minus padding (padding assumed to be top padding x 2)
this.visiblediv.style.width=this.hiddendiv.style.width=this.tickerdiv.offsetWidth-(this.visibledivleft*2)+"px"
this.getinline(this.visiblediv, this.hiddendiv)
this.hiddendiv.style.visibility="visible"
var scrollerinstance=this
document.getElementById(this.tickerid).onmouseover=function(){scrollerinstance.mouseoverBol=1}
document.getElementById(this.tickerid).onmouseout=function(){scrollerinstance.mouseoverBol=0}
if (window.attachEvent) //Clean up loose references in IE
window.attachEvent("onunload", function(){scrollerinstance.tickerdiv.onmouseover=scrollerinstance.tickerdiv.onmouseout=null})
setTimeout(function(){scrollerinstance.animateup()}, this.delay)
}


// -------------------------------------------------------------------
// animateup()- Move the two inner divs of the scroller up and in sync
// -------------------------------------------------------------------

pausescroller.prototype.animateup=function(){
var scrollerinstance=this
if (parseInt(this.hiddendiv.style.left)>(this.visibledivleft+5)){
this.visiblediv.style.left=parseInt(this.visiblediv.style.top)-5+"px"
this.hiddendiv.style.left=parseInt(this.hiddendiv.style.left)-5+"px"
setTimeout(function(){scrollerinstance.animateup()}, 50)
}
else{
this.getinline(this.hiddendiv, this.visiblediv)
this.swapdivs()
setTimeout(function(){scrollerinstance.setmessage()}, this.delay)
}
}

// -------------------------------------------------------------------
// swapdivs()- Swap between which is the visible and which is the hidden div
// -------------------------------------------------------------------

pausescroller.prototype.swapdivs=function(){
var tempcontainer=this.visiblediv
this.visiblediv=this.hiddendiv
this.hiddendiv=tempcontainer
}

pausescroller.prototype.getinline=function(div1, div2){
div1.style.left=this.visibledivleft+"px"
div2.style.left=Math.max(div1.parentNode.offsetHeight, div1.offsetHeight)+"px"
}

// -------------------------------------------------------------------
// setmessage()- Populate the hidden div with the next message before it's visible
// -------------------------------------------------------------------

pausescroller.prototype.setmessage=function(){
var scrollerinstance=this
if (this.mouseoverBol==1) //if mouse is currently over scoller, do nothing (pause it)
setTimeout(function(){scrollerinstance.setmessage()}, 100)
else{
var i=this.hiddendivpointer
var ceiling=this.content.length
this.hiddendivpointer=(i+1>ceiling-1)? 0 : i+1
this.hiddendiv.innerHTML=this.content[this.hiddendivpointer]
this.animateup()
}
}

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
}

////// SCROLLER SCRIPT start ///////////////////////////////////////////////////////////////////

////// SCROLLER CONFIGURATION ///////////////////////////////////////////////////////////////////  

orientation = "horizontal"        // Orientation of scroller (Horizontal or vertical)
scrollerWidth = "159"             // Width of entire scroller.
scrollerHeight = "240"             // Height of Scroller.
borderWidth = 0                   // Width of border. (use 0 for no border).
borderColour = "#006600"          // Colour of scroller border. (Use either hexadecimal or text values. e.g. "#FF0000" or "Red") 
backColour = ""              // Colour of scroller background. (Use either hexadecimal or text values. e.g. "#FF0000" or "Red") 
backImage = ""
staticColour = "#000000"          // Colour of scroller items that are NOT a link. (including scrollerDivider characters)
stopScroll = 1                    // Pause the scroller on mouseOver. (use 0 for no.)
textAlignment="left"            // Alignment of each scroller item.  Only really makes a difference on vertical scroller
                                  // (center, left, right, justify)
								  
paddingTop = "0px"
paddingBottom = "0px"
paddingLeft = "0px"
paddingRight = "0px"

// Scroller Links
linkFont = "arial"                // Font of scroller links;
linkWeight = "normal"             // Weight of scroller links;
linkColour = "#094FA3"            // Colour of scroller links
linkSize = "11"                   // Size of links (in points)
linkDecoration = "none"           // Decoration of links. (underline, overline, none)

// Scroller Links On MouseOver
slinkFont = "arial"               // Font of scroller links;
slinkWeight = "normal"            // Weight of scroller links;
slinkColour = "#cc3333"           // Colour of scroller links
slinkSize = "10"                  // Size of links (in points)
slinkDecoration = "underline"     // Decoration of links. (underline, overline, none)

scrollerDivider = "&nbsp;&nbsp;" // Character to place between each scroller item. 
                                  // <img> tags can be used if an image is required. 
                                  // Use "0" for nothing.  For Vertical scrollers, it is best to use "<br>"

/* 
  Because Netscape version 4 does not support this scroller, configure the values below so NS4 users do not see an error. 
  In the scroller's place will be a static title which can be a link if require.  The appearance of the static text (colour, scroller border etc)
  will be exactly the same as for the working version in other browsers.
*/
ns4Text = "Click Here to visit the PlanMagic Software";  // Alternative text to display in Netscape 4.
ns4URL = "http://planmagic.com";            // URL of link in NS4. If no URL is required, enter "none"
ns4Target = "_top";                           // Frame target for link in NS4

////// DO NOT EDIT BELOW THIS LINE  ///////////////////////////////////////////////////////////////////

//Browser Sniffer
var isIE = (document.getElementById && document.all)?true:false;
var isNS4 = (document.layers)?true:false;
var isNS6 = (document.getElementById && !document.all)?true:false;

style='<style type="text/css">';
style+='p{font-family:'+linkFont+'; color:'+staticColour+'; font-size:'+linkSize+'px; font-weight:'+linkWeight+'; text-align:'+textAlignment+'; padding:'+paddingTop+' '+paddingRight+' '+paddingBottom+' '+paddingLeft+';}';
style+='a.rcScroller,a.rcScroller:active,a.rcScroller:visited{color:'+linkColour+';text-decoration:'+linkDecoration+'; font-weight:'+linkWeight+'}';
style+='a.rcScroller:hover{color:'+slinkColour+';text-decoration:'+slinkDecoration+'; font-weight:'+slinkWeight+'}';
style+='rcScrollerHoverNS{color:red;text-decoration:'+slinkDecoration+'; font-weight:'+slinkWeight+'}';
style+='<\/style>';
document.writeln(style);

// Build the scroller and place it on the page
function buildScroller()
{
  if(isNS4){
    scroller='<table border="0" cellpadding="0" cellspacing="0" width="'+scrollerWidth+'" bgcolor="'+borderColour+'"><tr><td>'
    scroller+='<table border="0" cellpadding="0" cellspacing="0" width="100%" height="'+scrollerHeight+'" bgcolor="'+backColour+'" background="'+backImage+'"><tr><td align="center" nowrap><p>';
    if(ns4URL.toLowerCase()!="none"){scroller+='<a href="'+ns4URL+'" class="rcScroller" target="'+ns4Target+'">'+ns4Text+'</a>';}
    else{scroller+=ns4Text;} 
    scroller+='</p></td></tr></table></td></tr></table>'   
  }else{
    scroller='';
    scroller+='<div id="div" style="';
    if(orientation.toLowerCase()=="vertical"){scroller+='height:'+scrollerHeight+';';}
    scroller+='width:'+scrollerWidth+'; position:relative; background-color:'+backColour+'; overflow:hidden">';
    scroller+='<div id="div1" style="position:relative; z-index:1">';
    scroller+='<table border="0" cellpadding="0" cellspacing="0" name="table" id="table"';
    if(orientation.toLowerCase()=="vertical"){scroller+='style="width:'+scrollerWidth+'"';}
    scroller+='><tr><td><ul>';
    y=0;
    while (y<4)
    {
      for (x=0; x<(Article.length); x++)
      {
        if(orientation.toLowerCase()=="vertical"){scroller+='';}
        scroller+='<li><a ';
        if(orientation.toLowerCase()=="horizontal"){scroller+='';} if(stopScroll==1){scroller+='onMouseOver="stopScroller();" onMouseOut="setWidth()"';}
        scroller+='';
        if(Article[x][1].toLowerCase()!="none"){scroller+=' href="'+Article[x][1]+'" target="'+Article[x][2]+'" >'+Article[x][0];
        }else{scroller+=Article[x][0];}          
        scroller+='<\/a><\/li>';
      }
      y++
    }
    scroller+='<\/ul><\/td><\/tr><\/table><\/div><\/div>';  
  }
  document.writeln(scroller);
}
// Ensure the width of the scroller is divisible by 2. This allows smooth flowing of the scrolled content
function setWidth()
{ 
  tableObj=(isIE)?document.all("table"):document.getElementById("table"); 
  obj=(isIE)?document.all.div1:document.getElementById("div1");   
  objWidth=(orientation.toLowerCase()=="horizontal")?getOffset(tableObj,"width"):getOffset(tableObj,"height");
  HalfWidth=Math.floor(objWidth/2);
  newWidth = (HalfWidth*2)+2;
  obj.style.width=newWidth
  moveLayer(obj, newWidth);
  
}

// Move the layer by one pixel to the left
function moveLayer(obj, width)
{
  
  maxLeft = (0-(width/2)+2)/2
  if(orientation.toLowerCase()=="horizontal"){
    obj.style.left=(parseInt(obj.style.left) <= maxLeft)?0:parseInt(obj.style.left)-1
  }else{
    if(obj.style.left==""){obj.style.left=0;}
   // alert(obj.style.top)
    if (parseInt(obj.style.left)<(0-(width/2)+6)){
      obj.style.left = 0
    }else{
      obj.style.left = parseInt(obj.style.left)-1
    }
  }
  // @20060920 Set Scroller Speed
  //timer = setTimeout ("moveLayer(obj, "+width+");", 25); [0.025 seconds]
  timer = setTimeout ("moveLayer(obj, "+width+");", 50);
}

// Get width and height of layer
function getOffset(obj, dim) 
{
  if(dim=="width")
  {
    oWidth = obj.offsetWidth
    return oWidth
  }  
  else if(dim=="height")
  {
    oHeight = obj.offsetHeight
    return oHeight
  }    
}

function stopScroller()
{
  clearTimeout(timer)  
}

function runScroller(){
  if(!isNS4){setWidth()}
}
////// END OF SCRIPT  ///////////////////////////////////////////////////////////////////

/************************** Open Browser Windows *********************************/

function openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}