
//set up thr date vars
function y2k(number) { return (number < 1000) ? number + 1900 : number; }
var dt = new Date();
if (dt.getDay() == 6){
  var sat = true;
  //var dt2 = new Date(Date.UTC(y2k(dt.getYear()),dt.getMonth(),dt.getDate(),dt.getHours(),dt.getMinutes(),dt.getSeconds()) - 24*60*60*1000);
  //dt=dt2;
}
if (dt.getDay() == 0){
  var sun = true;
  //var dt2 = new Date(Date.UTC(y2k(dt.getYear()),dt.getMonth(),dt.getDate(),dt.getHours(),dt.getMinutes(),dt.getSeconds()) - 48*60*60*1000);
  //dt=dt2;
}
var year = y2k(dt.getYear());
var month = (dt.getMonth() + 1).toString();
var date = dt.getDate().toString();

//check to see if we need leadin zero
if (month.length == 1)
	{month = '0' + month;}
if (date.length == 1)
	{date = '0' + date;}

//create the link
var wholeDate = year+month+date;
var strURL = '<li><a href="javascript:void(0)" onclick="window.open(\'http://www.oneplace.com/common/player/OnePlace/CustomPlayer_ThruTheBible.asp?url=http://boss.streamos.com/real/swn/oneplace/rm/tbd/tbd' + wholeDate + '.ram&MinTitle=Thru+The+Bible+-+English&Refresh=&AdsCategory=MINISTRY.TBD&Show_ID=424\',\'player\',\'toolbar=no,location=no,status=no,directories=no,menubar=no,scrolling=auto,scrollbars=auto,width=500,height=400,resizable=no\');">RealAudio</a> (16 kbps)</li>';

var strURL2 = '<li><a href="javascript:void(0)" onclick="window.open(\'http://www.oneplace.com/common/player/OnePlace/CustomPlayer_ThruTheBible.asp?url=http://boss.streamos.com/wmedia/swn/oneplace/wm/tbd/tbd' + wholeDate + '.wax&MinTitle=Thru+The+Bible+-+English&Refresh=&AdsCategory=MINISTRY.TBD&Show_ID=424\',\'player\',\'toolbar=no,location=no,status=no,directories=no,menubar=no,scrolling=auto,scrollbars=auto,width=500,height=400,resizable=no\');">Windows Media</a> (32 kbps)</li>';


var strURL3 = '<li><a href="http://www.oneplace.com/ministries/thru_the_bible_with_jvernon_mcgee/Archives.asp">MP3 Download</a> (Free)</li>';


//var strURL3 = '<li><a href="javascript:void(window.open(\'http://www.oneplace.com/common/download-free.asp?fn=/TBD/TBD' + wholeDate + //'.mp3\',\'player\',\'toolbar=no,location=no,status=no,directories=no,menubar=no,scrolling=auto,scrollbars=auto,width=500,height=400,resizable=no\'));">MP3 Download</a>(Free)</li>';

// Code for registration to get the MP3
// var strURL3 = '<li><a href="http://www.oneplace.com/ministries/thru_the_bible_with_jvernon_mcgee/" target="new">MP3</a></li>';

if (!sat && !sun){
  //$("#broadcastLink").attr("href", "http://www.oneplace.com/player/thru-the-bible-with-j-vernon-mcgee/" );
  $("#broadcastLink").click(function(){
		window.open("http://www.oneplace.com/ministries/thru-the-bible-with-j-vernon-mcgee/custom-player/", "Weekday", "width=707,height=642");
		return false;
	});
} else if (sat){
 //$("#broadcastLink").attr("href", "http://www.oneplace.com/player/thru-the-bible-questions-and-answers/" );
 $("#broadcastLink").click(function(){
		window.open("http://www.oneplace.com/ministries/thru-the-bible-questions-and-answers/custom-player/", "Saturday","width=707,height=642");
		return false;
	});
} else if (sun){
// $("#broadcastLink").attr("href", "http://www.oneplace.com/player/thru-the-bible-sunday-sermon/" );
 $("#broadcastLink").click(function(){
		window.open("http://www.oneplace.com/ministries/thru-the-bible-sunday-sermon/custom-player/", "Sunday", "width=707,height=642");
		return false;
	});
}

