﻿// EACH NEWS LINK REQUIRES A BLOCK OF VARIABLES:
// A LINK, A TITLE FOR THE LINK, AND WINDOW TARGET FOR THE LINK.
// 0 = SAME WINDOW, 1 = NEW WINDOW

var link0 ="http://www.meatanddeliretailer.com/Articles/Feature_Article/BNP_GUID_9-5-2006_A_10000000000000717860"; // link
var title0 = "DDR Discusses Ethnic Marketing in Meat & Deli Retailer Magazine"; // title
var w0 = 1;var link1 ="http://www.usatoday.com/money/perfi/retirement/2009-07-06-saving-retirement-minorities_N.htm"; // link
var title1 = "DDR Featured in USA TODAY on Hispanic Marketing and Retirement Savings"; // title
var w0 = 1;var link2 ="http://www.linz09.at/en/projekt-2112099/kommen_und_gehen.html"; // link
var title2 = "DDR Ushers in Linz 2009 European Capital of Culture Visitors"; // title
var w1 = 1;var link3 = "http://www.targetmarketingmag.com/article/focusing-your-message-african-american-market-98162_1.html"; // link
var title3 = "DDR Featured in Target Marketing on Marketing to African Americans"; // title
var w2 = 1;var link4 ="http://www.ddrglobal.com/press/Summit.htm"; // link
var title4 = "DDR CEO and Congressman John Murtha Discuss Interpreting in Iraq"; // title
var w3 = 1;var link5 ="http://www.ddrglobal.com/press/Midd.htm"; // link
var title5 = "DDR CEO Invited to Speak at Middlebury College"; // title
var w4 = 1;var link6 = "http://www.srinstitute.com/conf_page.cfm?pt=includes/webpages/webwysiwyg.cfm&web_page_id=5144&web_id=842&instance_id=29&pid=449"; // link
var title6 = "DDR Sponsors Hispanic Marketing Conference in Mia, FL, 1/21-23"; // title
var w5 = 1;var link7 = "http://www.ddrglobal.com/press/CASA.htm"; // link
var title7 = "DDR Provides Pro Bono Services to CASA of NJ"; // title
var w6 = 1;var link8 = "http://www.ddrglobal.com/press/FHB.htm"; // link
var title8 = "DDR Localizes Online Budget Tool for Humana"; // title
var w7 = 1;var link9 = "http://www.ddrglobal.com/press/luce.htm"; // link
var title9 = "DDR Partner ARA and LUCE Score Big on Radio"; // title
var w8 = 1;

var link10 = "http://www.ddrglobal.com/press/sesame.htm"; // link
var title10 = "?Sesame Street? Gets Local to Go Global"; // title
var w9 = 1; // var link11 = "http://www.ddrglobal.com/press/nbilc.html"; // link
var title11 = "DDR Global Provides Pro Bono Services to NBILC"; // title
var w10 = 1; // target

var link12 = "http://www.ddrglobal.com/press/newbrand.html"; // link
var title12 = "New DDR Global Logo and Branding"; // title
var w11 = 1; // 

var link13 = "http://www.ddrglobal.com/press/joinsforces.html"; // link
var title13 = "Alliance: Green Tea, Tactile Media, ARA"; // title
var w12 = 1; // target


var targetWin=new Array();
targetWin[0]="_self";
targetWin[1]="_blank";


var delay = 250; //delay between message changes (in ms)
var maxsteps = 50; // number of steps from startcolor to endcolor
var stepdelay = 30; // time in ms of single step / **Note: maxsteps*stepdelay = total time for fading effect in ms
var startcolor= new Array(255, 255, 255); // start color (R,G,B)
var endcolor=new Array(84, 120, 136); // end color (R,G,B)


var tContent=new Array();
begintag='<div class="newsBar">'; //set opening tag

tContent[0]="<a href=" +link0+ " style='color: #ffffff; visited: #ffffff;' target=" +targetWin[w0]+ ">" +title0+ "</a>";
tContent[1]="<a href=" +link1+ " style='color: #ffffff; visited: #ffffff;' target=" +targetWin[w1]+ ">" +title1+ "</a>";
tContent[2]="<a href=" +link2+ " style='color: #ffffff; visited: #ffffff;' target=" +targetWin[w2]+ ">" +title2+ "</a>";

closetag='</div>';

var fadelinks=1;  //fade links? 0 = no, 1 = yes.




var ie4=document.all&&!document.getElementById;
var DOM2=document.getElementById;
var faderdelay=3000; // time in ms to hold link at full color
var index=0;


function changecontent(){
  if (index>=tContent.length)
    index=0
  if (DOM2){
    document.getElementById("newsBar").style.color="rgb("+startcolor[0]+", "+startcolor[1]+", "+startcolor[2]+")"
    document.getElementById("newsBar").innerHTML=begintag+tContent[index]+closetag
    if (fadelinks)
      setTimeout("linkcolorchange(1)", faderdelay);
    setTimeout("colorfade(1, 15)", faderdelay);
  }
  else if (ie4)
    document.all.newsBar.innerHTML=begintag+tContent[index]+closetag;
  index++
}


function linkcolorchange(step){
  var obj=document.getElementById("newsBar").getElementsByTagName("A");
  if (obj.length>0){
    for (i=0;i<obj.length;i++)
      obj[i].style.color=getstepcolor(step);
  }
}


var fadecounter;
function colorfade(step) {
  if(step<=maxsteps) {
    document.getElementById("newsBar").style.color=getstepcolor(step);
    if (fadelinks)
      linkcolorchange(step);
    step++;
    fadecounter=setTimeout("colorfade("+step+")",stepdelay);
  }else{
    clearTimeout(fadecounter);
    document.getElementById("newsBar").style.color="rgb("+endcolor[0]+", "+endcolor[1]+", "+endcolor[2]+")";
    // FORCE LINK COLOR TO ENDCOLOR & DELETE HTML TEXT TO REMOVE SCREEN ARTIFACTS
    obj=document.getElementById("newsBar").getElementsByTagName("A");
    tVal="rgb("+endcolor[0]+","+endcolor[1]+","+endcolor[2]+")";
    obj[0].style.color=tVal;
    document.getElementById("newsBar").innerHTML=begintag+"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+closetag
    setTimeout("changecontent()", delay);
  }
}


function getstepcolor(step) {
  var diff
  var newcolor=new Array(3);
  for(var i=0;i<3;i++) {
    diff = (startcolor[i]-endcolor[i]);
    if(diff > 0) {
      newcolor[i] = startcolor[i]-(Math.round((diff/maxsteps))*step);
    } else {
      newcolor[i] = startcolor[i]+(Math.round((Math.abs(diff)/maxsteps))*step);
    }
  }
  return ("rgb(" + newcolor[0] + ", " + newcolor[1] + ", " + newcolor[2] + ")");
}


if (ie4||DOM2)
  document.write('<div id="newsBar"></div>');

if (window.addEventListener)
window.addEventListener("load", changecontent, false)
else if (window.attachEvent)
window.attachEvent("onload", changecontent)
else if (document.getElementById)
window.onload=changecontent

