var frTime = null;
var currentShow = "http://www.freekradio.com/shownames/1pxshowname.png";
var checkShow = "http://www.freekradio.com/shownames/1pxshowname.png";


/*
Sunday: 1
Monday: 2
Tuesday: 3
Wednesday: 4
Thursday: 5
Friday: 6
Saturday: 7
*/


function lookforShow(frTime) {

// edit for one-offs

if (frTime >= 00000 && frTime < 99999)
   checkShow = "http://www.freekradio.com/shownames/1pxshowname.png"

else if (frTime >= 00000 && frTime < 00000)
   checkShow = "http://www.freekradio.com/shownames/1pxshowname.png"

else if (frTime >= 00000 && frTime < 00000)
   checkShow = "http://www.freekradio.com/shownames/1pxshowname.png"


// fixed shows

else if (frTime >= 10800 && frTime < 11200)
   checkShow = "http://www.freekradio.com/shownames/maxfathom.png"

else if (frTime >= 11600 && frTime < 11900)
   checkShow = "http://www.freekradio.com/shownames/sundayjazz.png"

else if (frTime >= 11900 && frTime < 12100)
   checkShow = "http://www.freekradio.com/shownames/jazzjumpin.png"

else if (frTime >= 21200 && frTime < 21400)
   checkShow = "http://www.freekradio.com/shownames/musicofegypt.png"

/*
else if (frTime >= 21900 && frTime < 22000)
   checkShow = "http://www.freekradio.com/shownames/tonightinaustin.png"
*/

else if (frTime >= 22000 && frTime < 22200)
   checkShow = "http://www.freekradio.com/shownames/downekingdom.png"

else if (frTime >= 31200 && frTime < 31330)
   checkShow = "http://www.freekradio.com/shownames/hanleystruck.png"

else if (frTime >= 32200 && frTime < 32400)
   checkShow = "http://www.freekradio.com/shownames/tendertuesdays.png"

else if (frTime >= 41500 && frTime < 41600)
   checkShow = "http://www.freekradio.com/shownames/jordansjazzhour.png"

else if (frTime >= 41600 && frTime < 41800)
   checkShow = "http://www.freekradio.com/shownames/downekingdom.png"

/*
else if (frTime >= 41900 && frTime < 42000)
   checkShow = "http://www.freekradio.com/shownames/tonightinaustin.png"
*/

else if (frTime >= 42100 && frTime < 50000)
   checkShow = "http://www.freekradio.com/shownames/hiphoproyale.png"

else if (frTime >= 50100 && frTime < 50300)
   checkShow = "http://www.freekradio.com/shownames/afurydivine.png"

else if (frTime >= 52300 && frTime < 60030)
   checkShow = "http://www.freekradio.com/shownames/hanleystruck.png"

else if (frTime >= 61700 && frTime < 61900)
   checkShow = "http://www.freekradio.com/shownames/floydroyal.png"

else if (frTime >= 62000 && frTime < 62300)
   checkShow = "http://www.freekradio.com/shownames/hiphoproyale.png"

else if (frTime >= 70000 && frTime < 70300)
   checkShow = "http://www.freekradio.com/shownames/metalchurch.png"

else if (frTime >= 71100 && frTime < 71130)
   checkShow = "http://www.freekradio.com/shownames/thinktank.png"

else if (frTime >= 71400 && frTime < 71800)
   checkShow = "http://www.freekradio.com/shownames/maxfathom.png"

else if (frTime >= 72100 && frTime < 72155)
   checkShow = "http://www.freekradio.com/shownames/djtabuspins.png"

else if (frTime >= 72200 && frTime < 72400)
   checkShow = "http://www.freekradio.com/shownames/maxfathomwa.png"

else if (frTime >= 10000 && frTime < 10100)
   checkShow = "http://www.freekradio.com/shownames/maxfathomwa.png"
 

// stop editing

else checkShow = "http://www.freekradio.com/shownames/1pxshowname.png"; // no show running

}

// no more edits after this line!


function updateShow() {

// get GMT time

var currentDate = new Date();
var dayofWeek = currentDate.getUTCDay();
var utcDate = currentDate.toGMTString();
var currentHour = +utcDate.slice(17,19);
var currentMin = +utcDate.slice(20,22);
var minPileUTC = (currentHour*100) + currentMin;

if (minPileUTC < 600 && dayofWeek > 0)
   dayofWeek = dayofWeek - 1
else if (minPileUTC < 600 && dayofWeek == 0)
   dayofWeek = 6;

if (minPileUTC >= 600)
   var minPile = minPileUTC - 600
else minPile = 2400 - (600 - minPileUTC);

if (dayofWeek == 0)
	var frTime = minPile + 10000
else if (dayofWeek == 1)
	var frTime = minPile + 20000
else if (dayofWeek == 2)
	var frTime = minPile + 30000
else if (dayofWeek == 3)
	var frTime = minPile + 40000
else if (dayofWeek == 4)
	var frTime = minPile + 50000
else if (dayofWeek == 5)
	var frTime = minPile + 60000
else if (dayofWeek == 6)
	var frTime = minPile + 70000;

// is show running?

lookforShow(frTime);

// change image to match show

if (checkShow != currentShow) {
   currentShow = checkShow;
   document.getElementById('showtag').src = currentShow;
	}

}

// end file

