// news messages: to add more, simply add a comma and new "quoted text" with corresponding web link in order
// news
var ticker_text = new Array ("kSA Selling Sorption Pumps and Gate Valves - Click for Our Listing on EBAY","Read the Latest kSA Newsletter Online", "k-Space Associates Awarded a U.S. Patent");

// news URLs
var ticker_URL = new Array ("http://shop.ebay.com/merchant/kspace9", "kspaceNewsletter/No18/NewsletterNo18.html", "Company/news.html");

// news "Target" (1 for NEW WINDOW, 0 for SAME WINDOW)
var ticker_target = new Array ("1", "0", "0");

var ticker_width = 600; // The width of the Ticker
var ticker_height = 40; // The height of the Ticker
var ticker_borderw=0; // Border width
var ticker_borderc="#808080"; // Border Color right now is non-existant because width set to 0
var timeoutval=250; // Delay in milliseconds
var isPause=false; // true for pause on mouseover, but doesn't always work.
var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1;
var ns6=document.getElementById&&navigator.userAgent.indexOf("Opera")==-1;
var ns4=document.layers;
var tickerObj;
var ticker_left_ns4=(screen.width/2-20)-Math.round(ticker_width/2);

// Setting tickerObj depending on Browser
function setTickerObj()
{
 if(ie4)
 {
  tickerObj=document.all.js_ticker;
 }
 if(ns6)
 {
  tickerObj=document.getElementById("js_ticker");
 }
}

// isPause Content
var isPauseContent;
if(isPause)
{
 isPauseContent=' onMouseOver="delay_timeoutval();" onMouseOut="resume_timeoutval();"';
}
else
{
 isPauseContent='';
}

if(ie4||ns6)
{
 document.write('<table' + isPauseContent + '  onMouseUp="goURL();" width="' + ticker_width + '" height="' +  ticker_height + '" style="cursor:pointer; background:#FFFFFF; border:' + ticker_borderw + 'px solid ' + ticker_borderc + '"><tr><td align="left">');
 document.write('<div id="js_ticker">');
 document.write('</div>');
 document.write('</td></tr></table>');
}

var def_10='A',def_11='B',def_12='C',def_13='D',def_14='E',def_15='F';
var colorVal=15;
var div_count=0;

// Fading Color code Generating function
function fade_desat(getColorIntVal)
{
 var returnVal;
 if(getColorIntVal>=10)
 {
  for(var i=0; i<=15; i++)
  {
   if((getColorIntVal==i))
   {
    returnVal = eval('def_' + i);
   }
  }
 }
 else
 {
  returnVal=getColorIntVal;
 }
 return(returnVal);
} 

// Main
function writeDiv()
{
 if(ie4||ns6)
 {
  tickerObj.innerHTML= '<font face="verdana,arial,helvetica" size="-1" color="#' +  joinColor(fade_desat(colorVal)) + '"><b>' + ticker_text[div_count] +  '</b></font>' ;
 }
 if(ns4)
 {
  tickerObj=document.ticker_ns4;
  tickerObj.document.write('<table border="1" bordercolor="' + ticker_borderc + '"width="100%"><tr><td align="center"><a href="javascript:void(0);"' + isPauseContent + '  onMouseUp="javascript:goURL();"><font face="verdana,arial,helvetica" size="-1" color="#' +  joinColor(fade_desat(colorVal)) + '"><b>' + ticker_text[div_count] +  '</b></font></a></td></tr></table>');
  tickerObj.document.close();
 }
 if((colorVal>0)  && (colorVal!=0))
 {
  colorVal--;
 }
 else
 {
  colorVal=15;
  if(div_count<ticker_text.length)
  {
   div_count++;
  }
  if(div_count==ticker_text.length)
  {
   setTimeout("resetAll()",timeoutval);
   setTimeout("writeDiv()",timeoutval);
  }
 }

 if(div_count<ticker_text.length)
 {
  setTimeout("writeDiv()",timeoutval);
 }
}

// Generating Final Hex Color
function joinColor(getColor)
{
 return (getColor + '0' + getColor + '0' + getColor + '0');
}

// Reset
function resetAll()
{
 div_count=0;
 colorVal=15;
}

// URL Navigation function
function goURL()
{
 if(ticker_target[div_count]=="0")
 {
  location.href=ticker_URL[div_count];
 }
 else
 {
  if(ticker_target[div_count]=="1")
  {
   window.open(ticker_URL[div_count]);
  }
 }
}

// Setting Delay on MouseOver and MouseOut
var temp_timeoutval=timeoutval;
function delay_timeoutval()
{
 timeoutval=100000000000000;
 setTimeout("writeDiv()",timeoutval);
}

function resume_timeoutval()
{
 timeOutVal=temp_timeoutval;
 setTimeout("writeDiv()",timeoutval);
}

setTickerObj(); 
window.onload=writeDiv;

if(ns4)
{
 document.write('<layer id="ticker_ns4" width="' + ticker_width + '" left="' + ticker_left_ns4 + '"></layer>');
}
