var seconds = new Array();

seconds[0] = "00";
seconds[1] = "15";
seconds[2] = "30";
seconds[3] = "45";


var d = new Date()
var curr_date = d.getDate();
var curr_date = d.getDate();
var weekday=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")


k=0;
dow = (weekday[d.getDay()+k]);
hour = d.getHours();
hourToday = d.getHours()-1;
document.write("<div class='title'>" + dow+" (Today)<\/div>");
var sel="<div id='"+d.getDay()+"'  class='selwrap'><select onchange='playit(this.options[this.selectedIndex].value, "+d.getDay()+"  );' >";

sel+="<option value='' selected=true id='"+d.getDay()+"sel'> Choose Time<\/option>";
for (j=-1;j<hourToday;j++){
jdisp = j+1;
if(jdisp <12){
mutual = "am";
}
else{
jdisp = jdisp -12;
mutual = "pm";
}
if(jdisp=="0"){jdisp=12;}
sel+="<optgroup label='"+jdisp+""+mutual+"'>";
for (i=0;i<seconds.length;i++)
{
mnth = (d.getMonth()+1);if(mnth <10){mnth = "0"+mnth;}
dday = (d.getDate()+k);if(dday  <10){dday  = "0"+dday ;}
ddayYest = (d.getDate()-1);if(ddayYest  <10){ddayYest  = "0"+ddayYest ;}
ddayTomorrow = (d.getDate()+1);if(ddayTomorrow  <10){ddayTomorrow  = "0"+ddayTomorrow ;}

hhour = j+1;
hhourActual = hhour;
SPEChhour = j+0;

/*
hhour = j+1;
hhourActual = hhour ;
SPEChhour = j+2;
<option value="2009.11.19-0-1.15.00-D.mp3"> Nov 19, 2009 0.15</option>
<option value="2009.11.19-00.15.00-D.mp3"> Nov 19, 2009 1.15</option>


*/

;if(hhour  <10){hhour  = "0"+hhour ;}
if(SPEChhour ==-1){
	SPEChhour =23;
	dday =dday -1;
	}
;if(SPEChhour  <10){SPEChhour  = "0"+SPEChhour ;}

if(j  =="22"){hhour  = "00" ;
fileloc=""+d.getFullYear()+"."+mnth+"."+ddayYest +"-23."+seconds[i] + ".00-D.mp3";
}
else{

fileloc=""+d.getFullYear()+"."+mnth+"."+dday +"-"+SPEChhour+"."+seconds[i] + ".00-D.mp3";
}

sel+="<option value='"+fileloc+"'> "+ dateFormat("2009/"+mnth+"/"+dday+"", "mediumDate")+" "+hhourActual+"."+seconds[i] +"<\/option>\n";

} 
sel+="<\/optgroup>\n";
}
sel +="<\/select><\/div><div class='cl'><\/div>";
document.write(sel)
document.write("<hr/>")


td = d.getDate();

//for (k=0;k<7;k++){
for(var k=1; k<7; k++) {
d.setDate(d.getDate()-1);
mm = (d.getMonth()+1);if(mm <10){mm = "0"+mm;}
dd = (d.getDate());if(dd  <10){dd  = "0"+dd ;}

//(weekday[d.getDay()+k]);
dow = weekday[d.getDay()]
document.write("<div class='title'>" + dow+" <small>("+dd+"/"+mm+")<\/small><\/div>");

//var sel="<div id='"+d.getDay()+"'  class='selwrap'><select onchange='changeAudio(this.options[this.selectedIndex].value, "+d.getDay()+" );' >";
var sel="<div id='"+d.getDay()+"'  class='selwrap'><select onchange='playit(this.options[this.selectedIndex].value, "+d.getDay()+"  );' >";
sel+="<option value='' selected=true id='"+d.getDay()+"sel'> Choose Time<\/option>";
 // sel+="<option value='' selected=true > Choose Audio</option>";
for (j=-1;j<23;j++){
jdisp = j+1;
if(jdisp <12){
mutual = "am";
}
else{
jdisp = jdisp -12;
mutual = "pm";
}
if(jdisp=="0"){jdisp=12;}

sel+="\n\n<optgroup label='"+jdisp+""+mutual+"'>\n";
for (i=0;i<seconds.length;i++)
{
yyear = d.getYear();
mnth = (d.getMonth()+1);if(mnth <10){mnth = "0"+mnth;}
dday = (d.getDate());if(dday  <10){dday  = "0"+dday ;}
ddayYest = (d.getDate()-1);if(ddayYest  <10){ddayYest  = "0"+ddayYest ;}
ddayTomorrow = (d.getDate()+1);if(ddayTomorrow  <10){ddayTomorrow  = "0"+ddayTomorrow ;}
hhour = j+1;
hhourActual = hhour ;
SPEChhour = j+0;

;if(hhour  <10){hhour  = "0"+hhour ;}
if(SPEChhour ==-1){
	SPEChhour =23;
	dday =dday -1;
	}
;if(SPEChhour  <10){SPEChhour  = "0"+SPEChhour ;}

/*if(j  =="22"){hhour  = "00" ;
fileloc=""+d.getFullYear()+"."+mnth+"."+ddayTomorrow +"-00."+seconds[i] + ".00-D.mp3"
}
else{

fileloc=""+d.getFullYear()+"."+mnth+"."+dday +"-"+SPEChhour+"."+seconds[i] + ".00-D.mp3"
}*/

fileloc=""+d.getFullYear()+"."+mnth+"."+dday +"-"+SPEChhour+"."+seconds[i] + ".00-D.mp3";
sel+="<option value='"+fileloc+"'>"+ dateFormat(d.getFullYear()+"/"+mnth+"/"+dday+"", "mediumDate")+" "+hhourActual+"."+seconds[i] +"</option>\n";

} 
sel+="<\/optgroup>\n\n";
}
sel +="<\/select><\/div><div class='cl'><\/div>\n\n";
document.write(sel)
}
