//relative location of the top click here img
var imgannouncebefore = "http://johnjay.jjay.cuny.edu/jjbanner/hclinton/clinton_main.jpg";//first top img of event
var imgannouncetoday = "http://johnjay.jjay.cuny.edu/jjbanner/hclinton/clinton_today.jpg";//event is today img
var imgclick = "http://johnjay.jjay.cuny.edu/jjbanner/hclinton/clinton_now.jpg";//img of click to show stream
var imglive = "http://johnjay.jjay.cuny.edu/jjbanner/hclinton/clinton_live.jpg";//img when it is steaming
var imgbottom = "http://johnjay.jjay.cuny.edu/jjbanner/hclinton/clinton_bottom.jpg";//bottom banner image
var imgleft = "http://johnjay.jjay.cuny.edu/jjbanner/hclinton/clinton_left.jpg";//left banner image
var streamurl = "http://www.ustream.tv/channel/hillary-clinton";//"http://stream.jjay.cuny.edu:8971/liveevent/liveevent.htm";//stream url
var eventdate = [2011,9,9];//[year, month, day]
var eventhour = [10,38];//[hour, minute] time hour of event 
var pm = false;//pm time or false for am


//do not change bellow here***************************************************************************************

document.write('<table width="950" border="0" cellpadding="0" cellspacing="0" align="center">');
document.write('<tr>');
document.write('<td rowspan="2" width="347" valign="top">');
document.write('<div id="stream"><img src="' + imgleft + '" /></div>');
document.write('</td>');
document.write('<td valign="top"><div id="topbanner"></div></td></tr>');
document.write('<tr>');
document.write('<td width="603" valign="top"><img src="' + imgbottom + '" /></td>');

var today;// = false;//change to true if the event is today
var live = false;//change to true to show click img for stream
eventdate[1] = eventdate[1] - 1;
var myDate=new Date();
myDate.setFullYear(eventdate[0],eventdate[1],eventdate[2]);
if (pm==true){
myDate.setHours((eventhour[0]+12),eventhour[1]);
}
else{
myDate.setHours((eventhour[0]),eventhour[1]);
}
var d = new Date();

if (myDate.getDate()<=d.getDate() && myDate.getMonth()==d.getMonth())
  {
  today = true;
		if(myDate<=d){
			live = true;
		}//end if
		else{
			live = false;
		}//end else 
   }
else
  {
  today = false;
  }

var imgannouce;
if (today){
imgannounce = imgannouncetoday;
}
else{
imgannounce = imgannouncebefore;
}
var clickedimg = false;
topimg();
//bottomimg();
function viewstream(){
  if((navigator.appName == "Microsoft Internet Explorer") && (2==3))
  {
var str='';
str+='<object id="MediaPlayer1" CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http:\/\/activex.microsoft.com\/activex\/controls\/mplayer\/en\/nsmp2inf.cab#Version=5,1,52,701" ';
str+='standby="Loading Microsoft Windows® Media Player components..." type="application\/x-oleobject" width="345" height="324"> ';
str+='<param name="fileName" value="' + streamurl + '"> ';
str+='<param name="animationatStart" value="true"> ';
str+='<param name="transparentatStart" value="true"> ';
str+='<param name="autoStart" value="true"> ';
str+='<param name="showControls" value="true"> ';
str+='<param name="Volume" value="-450"> ';
str+='<param name="ShowStatusBar" value="true">';
str+='<embed type="application\/x-mplayer2" pluginspage="http:\/\/www.microsoft.com\/Windows\/MediaPlayer\/" src="' + streamurl + '" name="MediaPlayer1" width=345 height=324 autostart=1 showstatusbar=1 showcontrols=1  > ';
str+='<\/object>';

stream.innerHTML = str;
}
else{
window.location.href = streamurl;
}
clickedimg = true;
topimg();
}

function topimg(){
var str = '';
var topbanner = document.getElementById('topbanner');
if (live == true){
if (clickedimg == false){
str+= "<a href='#' onclick='viewstream()'><img src='" + imgclick + "' /></a>";
}
else {
str+= "<img id='nowimg' src='" + imglive + "' width='603' height='195' />";
}
}//end if
else{
str+= "<a href='#' onclick='viewstream()'><img src='" + imgannounce + "' /></a>";
}//end main if
topbanner.innerHTML = str;
}

function imgbottom(){
document.write(" ");
}
