
switcherSelected = "leftBtn";
function $(o){
  if(document.getElementById(o))
    return document.getElementById(o);
  else
    return document.getElementsByTagName('embed')[0];
  
}
function switcher(e){
  if(!e) e=window.event;
  act = e.type;
  if (e.target) targ = e.target;
  else if (e.srcElement) targ = e.srcElement;
  if (targ.nodeType == 3) // defeat Safari bug
	targ = targ.parentNode;
  if(targ.id == "rightBtn" || targ.id == "leftBtn"){
    lsideShow = targ.id == "leftBtn" ? document.getElementById('leftProd') : document.getElementById('leftTech');
    rsideShow = targ.id == "leftBtn" ? document.getElementById('rightProd') : document.getElementById('rightTech');
    lsideHide = targ.id == "rightBtn" ? document.getElementById('leftProd') : document.getElementById('leftTech');
    rsideHide = targ.id == "rightBtn" ? document.getElementById('rightProd') : document.getElementById('rightTech');
    otherOpt = targ.id == "rightBtn" ?  document.getElementById("leftBtn") :  document.getElementById("rightBtn");
    if(act == "mouseover")
      targ.className="btnActive";
    else if(act == "mouseout")
      switcherSelected == targ.id ? targ.className="btnActive" : targ.className="btn";
    else if(act == "mouseup"){
      targ.className="btnActive";
      switcherSelected = targ.id;
      otherOpt.className="btn";
      lsideShow.className="leftSwitcher";
      rsideShow.className="rightSwitcher";
      lsideHide.className="hidden";
      rsideHide.className="hidden";
    }
  }
}

var toScroll=new Array()
var ie=document.all
var dom=document.getElementById
var firstNews_obj;
var secondNews_obj;

function newsScroll(name){
  var c=this; c.name=name; c.mc=0; c.i=2;
  return this;
}

newsScroll.prototype.addItem = function(text,link,font,fontSize,fontStyle){
  var c = this;
  if (link !=''){
    if (font != '')
      toScroll[c.mc]="<a href='"+link+"'><font face='"+font+"' size='"+fontSize+"' Class='"+fontStyle+"'>"+text+"</font></a>";
    else
      toScroll[c.mc]="<a href='"+link+"'><font Class='"+fontStyle+"'>"+text+"</font></a>";
  }
  else {
    if (font != '')
      toScroll[c.mc]="<font face='"+font+"' size='"+fontSize+"' Class='"+fontStyle+"'>"+text+"</font>";
    else
      toScroll[c.mc]="<font Class='"+fontStyle+"'>"+text+"</font>";
  }
  c.mc++;
}

newsScroll.prototype.construct = function(){
  var c = this; theWidth = c.scrollerwidth; theHeight=c.scrollerheight; thebgColor = c.scrollerbgcolor; theBackground =c.scrollerbackground; theDelay=c.scrollerdelay;
  scroll_obj=eval(c.name);
  if (ie||dom){
    document.writeln('<div id="main2" style="position:relative;width:'+theWidth+';height:'+theHeight+';overflow:hidden;background-color:'+thebgColor+' ;background-image:url('+theBackground+')">')
    document.writeln('<div style="position:absolute;width:'+theWidth+';height:'+theHeight+';clip:rect(0 '+theWidth+' '+theHeight+' 0);left:0;top:0">')
    document.writeln('<div id="firstNews" style="position:absolute;width:'+theWidth+';left:0;top:1">')
    document.write(toScroll[0])
    document.writeln('</div>')
    document.writeln('<div id="secondNews" style="position:absolute;width:'+theWidth+';left:0;top:0;visibility:hidden">')
    document.write(toScroll[dyndetermine=(toScroll.length==1)? 0 : 1])
    document.writeln('</div>')
    document.writeln('</div>')
    document.writeln('</div>')
  }
}

newsScroll.prototype.move = function(whichdiv){
  var c = this; theDelay = c.scrollerdelay; theHeight = c.scrollerheight;
  scroll_obj=eval(c.name);
  tdiv=eval(whichdiv)

  if (parseInt(tdiv.style.top)>0&&parseInt(tdiv.style.top)<=5){
    tdiv.style.top=0+"px"
    setTimeout("scroll_obj.move(tdiv)",theDelay)
    setTimeout("scroll_obj.move2(secondNews_obj)",theDelay)
    //document.write('Got Milk?')
  return
  }
  if (parseInt(tdiv.style.top)>=tdiv.offsetHeight*-1){
    tdiv.style.top=parseInt(tdiv.style.top)-5+"px"
    setTimeout("scroll_obj.move(tdiv)",50)
  }
  else {
    tdiv.style.top=parseInt(theHeight)+"px"
    tdiv.innerHTML=toScroll[c.i]
    if (c.i==toScroll.length-1)
      c.i=0
    else
      c.i++
  }
}

newsScroll.prototype.move2 = function(whichdiv){
  var c = this; theDelay = c.scrollerdelay; theHeight= c.scrollerheight;
  scroll_obj=eval(c.name);
  tdiv2=eval(whichdiv)

  if (parseInt(tdiv2.style.top)>0&&parseInt(tdiv2.style.top)<=5){
    tdiv2.style.top=0+"px"
    setTimeout("scroll_obj.move2(tdiv2)",theDelay)
    setTimeout("scroll_obj.move(firstNews_obj)",theDelay)
    return
  }
  if (parseInt(tdiv2.style.top)>=tdiv2.offsetHeight*-1){
    tdiv2.style.top=parseInt(tdiv2.style.top)-5+"px"
    setTimeout("scroll_obj.move2(secondNews_obj)",50)
  }
  else {
    tdiv2.style.top=parseInt(theHeight)+"px"
    tdiv2.innerHTML=toScroll[c.i]
    if (c.i==toScroll.length-1)
      c.i=0
    else
      c.i++
  }
}

newsScroll.prototype.startScroll = function(){
  var c = this;
  scroll_obj=eval(c.name);

  if (toScroll.length >2)
    c.i = 2;
  else
    c.i = 0;

  firstNews_obj=ie? firstNews : document.getElementById("firstNews")
  secondNews_obj=ie? secondNews : document.getElementById("secondNews")
  setTimeout("scroll_obj.move(firstNews_obj)",c.scrollerDelay);
  secondNews_obj.style.top=theHeight;
  secondNews_obj.style.visibility='visible'
}

var slidespeed=2000
var slideimages=new Array("./media/images/IntelLogo.png","./media/images/jes.png","./media/images/p2.png","./media/images/brse.png");
var slidelinks=new Array("./media/images/IntelLogo.png","./media/images/jes.png","./media/images/p2.png","./media/images/brse.logo");

var whichlink=0
var whichimage=0
var imgobj, filtersupport, blenddelay
var imageholder=new Array()
for (i=0;i<slideimages.length;i++){ //preload images
imageholder[i]=new Image()
imageholder[i].src=slideimages[i]
}

function gotoshow(){
window.location=slidelinks[whichlink]
}

function slideit(){
if (filtersupport)
imgobj.filters[0].apply()
imgobj.src=imageholder[whichimage].src
if (filtersupport)
imgobj.filters[0].play()
whichlink=whichimage
whichimage=(whichimage<slideimages.length-1)? whichimage+1 : 0
setTimeout("slideit()", slidespeed+blenddelay)
}
window.onload=function(){
  if(typeof(imgobj)!='undefined'){
	imgobj=document.getElementById("logos") //access img obj
	filtersupport=imgobj.filters //check for support for filters
	blenddelay=(filtersupport)? imgobj.filters[0].duration*1000 : 0
	slideit();
  }
  if(typeof(playVideo)!='undefined'){
     $('StandAlonePlayer').loadVideo(playVideo);
     $('StandAlonePlayer').stopVideo();
  }
}


theNews=new newsScroll("theNews"); //create our newsScroller object
   theNews.scrollerdelay = 5000; // pausetime 3000 = 3 Seconds
   theNews.scrollerwidth = 160;  // the width of the box
   theNews.scrollerheight = 80; // the height of the box
   theNews.scrollerbgcolor = ''; //  the box background color
   theNews.scrollerbackground = ''; // Set to blank if you don't want to use a background image

   //******************************************************************
   //
   // The addItem method below has 5 variables and is formated as follows:
   // addItem (text,link,font,fontSize,fontStyle)
   // text      - the text to be displayed.
   // link      - (optional) website, or page to link news item to.
   // font      - (optional) Font face to use on item.
   // fontSize  - (optional) size in pt format
   //     i.e. 1=8pt, 2=10pt, 3=12pt and so on.
   // fontStyle - (optional) css style to assign to font. You can use the class name.
   //
   //******************************************************************

   theNews.addItem('CAT1 Now has 2 versions: Mac OS-X, and Windows XP.','','','','');
   theNews.addItem('Participants can now be imported into E-SESS directly from Excel.','','','','');


