function schedule(start, end, headline, image){
	this.start = start;
	this.end = end;
	this.headline = headline;
	this.image = image;
}

var nextShow = ""; var laterShow = "";
var radioArray = new Array();


/* days of week */



/* Sunday */ 

radioArray[0] = new Array();

/* Monday */ 

radioArray[1] = new Array();
radioArray[1][0] = new schedule(000,559,"The Best of The Alan Colmes Show", "");
radioArray[1][1] = new schedule(130,200,"Cavuto on Business", "");
radioArray[1][2] = new schedule(200,230,"Forbes on FOX", "");
radioArray[1][3] = new schedule(230,300,"Cashin' In", "");
radioArray[1][4] = new schedule(300,359,"Geraldo", "");
radioArray[1][5] = new schedule(400,459,"FOX Report Sunday", "");
radioArray[1][6] = new schedule(500,559,"FOX News Sunday", "");
radioArray[1][7] = new schedule(600,659,"Geraldo", "");
radioArray[1][8] = new schedule(700,729,"Bulls &amp; Bears", "");
radioArray[1][9] = new schedule(730,759,"Cavuto on Business", "");
radioArray[1][10] = new schedule(800,829,"Forbes on FOX", "");
radioArray[1][11] = new schedule(830,859,"Cashin' In", "");
radioArray[1][12] = new schedule(900,1200,"Kilmeade and Friends<br/>Call In! 1-866-408-7669", "http://radio.foxnews.com/wp-content/uploads/2010/05/brian1-600-150x150.jpg");
radioArray[1][13] = new schedule(1200,1500,"John Gibson<br/>Call In! 1-888-788-9910", "http://radio.foxnews.com/wp-content/uploads/2010/05/gibson1-600-150x150.jpg");
radioArray[1][14] = new schedule(1500,1800,"Tom Sullivan<br/>Call In! 1-888-788-9910", "http://radio.foxnews.com/admin/images/sullivan.jpg");
radioArray[1][15] = new schedule(1800,2000,"FOX Across America w/ Spencer Hughes<br/>Call In! 1-866-868-6861", "http://radio.foxnews.com/wp-content/uploads/2010/05/spencer4-600-150x150.jpg");
radioArray[1][16] = new schedule(2000,2100,"Glenn Beck", "");
radioArray[1][17] = new schedule(2100,2200,"O'Reilly Factor", "");
radioArray[1][18] = new schedule(2200,000,"Alan Colmes<br/>Call In! 1-877-FOR-ALAN", "");

/* Tuesday */ 

radioArray[2] = new Array();
radioArray[2][0] = new schedule(000,100,"Alan Colmes<br/>Call In! 1-877-FOR-ALAN", "http://radio.foxnews.com/wp-content/uploads/2010/05/alan-600-150x150.jpg");
radioArray[2][1] = new schedule(100,400,"Alan Colmes Encore", "http://radio.foxnews.com/wp-content/uploads/2010/05/alan-600-150x150.jpg");
radioArray[2][2] = new schedule(400,500,"Your World with Neil Cavuto", "");
radioArray[2][3] = new schedule(500,600,"Special Report", "");
radioArray[2][4] = new schedule(600,700,"O'Reilly Factor", "");
radioArray[2][5] = new schedule(700,800,"Hannity", "");
radioArray[2][6] = new schedule(800,900,"On the Record", "");
radioArray[2][7] = new schedule(900,1200,"Kilmeade and Friends<br/>Call In! 1-866-408-7669", "http://radio.foxnews.com/wp-content/uploads/2010/05/brian1-600-150x150.jpg");
radioArray[2][8] = new schedule(1200,1500,"John Gibson<br/>Call In! 1-888-788-9910", "http://radio.foxnews.com/wp-content/uploads/2010/05/gibson1-600-150x150.jpg");
radioArray[2][9] = new schedule(1500,1800,"Tom Sullivan<br/>Call In! 1-888-788-9910", "http://radio.foxnews.com/admin/images/sullivan.jpg");
radioArray[2][10] = new schedule(1800,2000,"FOX Across America w/ Spencer Hughes<br/>Call In! 1-866-868-6861", "http://radio.foxnews.com/wp-content/uploads/2010/05/spencer4-600-150x150.jpg");
radioArray[2][11] = new schedule(2000,2100,"Glenn Beck", "");
radioArray[2][12] = new schedule(2100,2200,"O'Reilly Factor", "");
radioArray[2][13] = new schedule(2200,000,"Alan Colmes<br/>Call In! 1-877-FOR-ALAN", "");

/* Wednesday */ 

radioArray[3] = new Array();
radioArray[3][0] = new schedule(000,100,"Alan Colmes<br/>Call In! 1-877-FOR-ALAN", "http://radio.foxnews.com/wp-content/uploads/2010/05/alan-600-150x150.jpg");
radioArray[3][1] = new schedule(100,400,"Alan Colmes Encore", "http://radio.foxnews.com/wp-content/uploads/2010/05/alan-600-150x150.jpg");
radioArray[3][2] = new schedule(400,500,"Your World with Neil Cavuto", "");
radioArray[3][3] = new schedule(500,600,"Special Report", "");
radioArray[3][4] = new schedule(600,700,"O'Reilly Factor", "");
radioArray[3][5] = new schedule(700,800,"Hannity", "");
radioArray[3][6] = new schedule(800,900,"On the Record", "");
radioArray[3][7] = new schedule(900,1200,"Kilmeade and Friends<br/>Call In! 1-866-408-7669", "http://radio.foxnews.com/wp-content/uploads/2010/05/brian1-600-150x150.jpg");
radioArray[3][8] = new schedule(1200,1500,"John Gibson<br/>Call In! 1-888-788-9910", "http://radio.foxnews.com/wp-content/uploads/2010/05/gibson1-600-150x150.jpg");
radioArray[3][9] = new schedule(1500,1800,"Tom Sullivan<br/>Call In! 1-888-788-9910", "http://radio.foxnews.com/admin/images/sullivan.jpg");
radioArray[3][10] = new schedule(1800,2000,"FOX Across America w/ Spencer Hughes<br/>Call In! 1-866-868-6861", "http://radio.foxnews.com/wp-content/uploads/2010/05/spencer4-600-150x150.jpg");
radioArray[3][11] = new schedule(2000,2100,"Glenn Beck", "");
radioArray[3][12] = new schedule(2100,2200,"O'Reilly Factor", "");
radioArray[3][13] = new schedule(2200,000,"Alan Colmes<br/>Call In! 1-877-FOR-ALAN", "");

/* Thursday */ 

radioArray[4] = new Array();
radioArray[4][0] = new schedule(000,100,"Alan Colmes<br/>Call In! 1-877-FOR-ALAN", "http://radio.foxnews.com/wp-content/uploads/2010/05/alan-600-150x150.jpg");
radioArray[4][1] = new schedule(100,400,"Alan Colmes Encore", "http://radio.foxnews.com/wp-content/uploads/2010/05/alan-600-150x150.jpg");
radioArray[4][2] = new schedule(400,500,"Your World with Neil Cavuto", "");
radioArray[4][3] = new schedule(500,600,"Special Report", "");
radioArray[4][4] = new schedule(600,700,"O'Reilly Factor", "");
radioArray[4][5] = new schedule(700,800,"Hannity", "");
radioArray[4][6] = new schedule(800,900,"On the Record", "");
radioArray[4][7] = new schedule(900,1200,"Kilmeade and Friends<br/>Call In! 1-866-408-7669", "http://radio.foxnews.com/wp-content/uploads/2010/05/brian1-600-150x150.jpg");
radioArray[4][8] = new schedule(1200,1500,"John Gibson<br/>Call In! 1-888-788-9910", "http://radio.foxnews.com/wp-content/uploads/2010/05/gibson1-600-150x150.jpg");
radioArray[4][9] = new schedule(1500,1800,"Tom Sullivan<br/>Call In! 1-888-788-9910", "http://radio.foxnews.com/admin/images/sullivan.jpg");
radioArray[4][10] = new schedule(1800,2000,"FOX Across America w/ Spencer Hughes<br/>Call In! 1-866-868-6861", "http://radio.foxnews.com/wp-content/uploads/2010/05/spencer4-600-150x150.jpg");
radioArray[4][11] = new schedule(2000,2100,"Glenn Beck", "");
radioArray[4][12] = new schedule(2100,2200,"O'Reilly Factor", "");
radioArray[4][13] = new schedule(2200,000,"Alan Colmes<br/>Call In! 1-877-FOR-ALAN", "");

/* Friday */ 

radioArray[5] = new Array();
radioArray[5][0] = new schedule(000,100,"Alan Colmes<br/>Call In! 1-877-FOR-ALAN", "http://radio.foxnews.com/wp-content/uploads/2010/05/alan-600-150x150.jpg");
radioArray[5][1] = new schedule(100,400,"Alan Colmes Encore", "http://radio.foxnews.com/wp-content/uploads/2010/05/alan-600-150x150.jpg");
radioArray[5][2] = new schedule(400,500,"Your World with Neil Cavuto", "");
radioArray[5][3] = new schedule(500,600,"Special Report", "");
radioArray[5][4] = new schedule(600,700,"O'Reilly Factor", "");
radioArray[5][5] = new schedule(700,800,"Hannity", "");
radioArray[5][6] = new schedule(800,900,"On the Record", "");
radioArray[5][7] = new schedule(900,1200,"Kilmeade and Friends<br/>Call In! 1-866-408-7669", "http://radio.foxnews.com/wp-content/uploads/2010/05/brian1-600-150x150.jpg");
radioArray[5][8] = new schedule(1200,1500,"John Gibson<br/>Call In! 1-888-788-9910", "http://radio.foxnews.com/wp-content/uploads/2010/05/gibson1-600-150x150.jpg");
radioArray[5][9] = new schedule(1500,1800,"Tom Sullivan<br/>Call In! 1-888-788-9910", "http://radio.foxnews.com/admin/images/sullivan.jpg");
radioArray[5][10] = new schedule(1800,2000,"FOX Across America w/ Spencer Hughes<br/>Call In! 1-866-868-6861", "http://radio.foxnews.com/wp-content/uploads/2010/05/spencer4-600-150x150.jpg");
radioArray[5][11] = new schedule(2000,2100,"Glenn Beck", "");
radioArray[5][12] = new schedule(2100,2200,"O'Reilly Factor", "");
radioArray[5][13] = new schedule(2200,000,"Alan Colmes<br/>Call In! 1-877-FOR-ALAN", "");

/* Saturday */ 

radioArray[6] = new Array();
radioArray[6][0] = new schedule(000,100,"Alan Colmes<br/>Call In! 1-877-FOR-ALAN", "http://radio.foxnews.com/wp-content/uploads/2010/05/alan-600-150x150.jpg");
radioArray[6][1] = new schedule(100,400,"Alan Colmes Encore", "http://radio.foxnews.com/wp-content/uploads/2010/05/alan-600-150x150.jpg");
radioArray[6][2] = new schedule(400,500,"Your World with Neil Cavuto", "");
radioArray[6][3] = new schedule(500,600,"Special Report", "");
radioArray[6][4] = new schedule(600,700,"O'Reilly Factor", "");
radioArray[6][5] = new schedule(700,800,"Hannity", "");
radioArray[6][6] = new schedule(800,900,"On the Record", "");
radioArray[6][7] = new schedule(900,1200,"Best of Kilmeade and Friends", "http://radio.foxnews.com/wp-content/uploads/2010/05/brian1-600-150x150.jpg");
radioArray[6][8] = new schedule(1200,1500,"Best of John Gibson", "");
radioArray[6][9] = new schedule(1500,1800,"Tom Sullivan Replay", "");
radioArray[6][10] = new schedule(1800,2000,"Best of Fox Across America", "");
radioArray[6][11] = new schedule(2100,2130,"Journal Editorial Report", "");
radioArray[6][12] = new schedule(2130,2200,"FOX News Watch", "");
radioArray[6][13] = new schedule(2200,2300,"America's News Headquarters", "");
radioArray[6][14] = new schedule(2300,000,"Geraldo", "");


/* ************ */

function returnArray(d){
	switch(d){
		case 0: return radioArray[0]; break;
		case 1: return radioArray[1]; break;
		case 6: return radioArray[3]; break;
		default: return radioArray[2];
	}
}

function writeStreamHeadline(t, d){
	var o = "Listen Live!";
	var currentTime = "20:35";
	currentTime = currentTime.replace(":","");
	//var currentDay = <%= Weekday(date, 2) %>;
	var dayArray = radioArray[0];
	for(var i=0;i<dayArray.length;i++){	
		if(currentTime >= dayArray[i].start && currentTime <= dayArray[i].end){
			o = "<strong>ON NOW &#151 </strong>" + dayArray[i].headline;
			if((i + 1) >= dayArray.length){
				var tempDay = currentDay == 6 ? 0 : currentDay + 1;
				var tempArray = returnArray(tempDay);
				var startNum = 0;
				if(tempArray[startNum].headline == dayArray[i].headline){ startNum++; }
				nextShow = tempArray[startNum];
				laterShow = tempArray[startNum + 1];
			} else {
				nextShow = dayArray[i+1];
				if((i + 2) >= dayArray.length){
					var tempDay = currentDay == 6 ? 0 : currentDay + 1;
					var tempArray = returnArray(tempDay);
					laterShow = tempArray[0].headline == nextShow.headline ? tempArray[1] : tempArray[0];
				} else {
					laterShow = dayArray[i+2];
				}
			}
		}
	}
	return o;
}

function writeShowName(t, d){
	var o = "";
	var currentTime = "20:35";
	currentTime = currentTime.replace(":","");
	//var currentDay = <%= Weekday(date, 2) %>;
	var dayArray = radioArray[0];
	for(var i=0;i<dayArray.length;i++){	
		if(currentTime >= dayArray[i].start && currentTime <= dayArray[i].end){
			o = dayArray[i].headline;
			if((i + 1) >= dayArray.length){
				var tempDay = currentDay == 6 ? 0 : currentDay + 1;
				var tempArray = returnArray(tempDay);
				var startNum = 0;
				if(tempArray[startNum].headline == dayArray[i].headline){ startNum++; }
				nextShow = tempArray[startNum];
				laterShow = tempArray[startNum + 1];
			} else {
				nextShow = dayArray[i+1];
				if((i + 2) >= dayArray.length){
					var tempDay = currentDay == 6 ? 0 : currentDay + 1;
					var tempArray = returnArray(tempDay);
					laterShow = tempArray[0].headline == nextShow.headline ? tempArray[1] : tempArray[0];
				} else {
					laterShow = dayArray[i+2];
				}
			}
		}
	}
	return o;
}


function writeAlbumCover(t, d) {
	var o = "http://radio.foxnews.com/wp-content/uploads/2010/04/fnr-LOGO-150x150.jpg";
	var currentTime = "20:35";
	currentTime = currentTime.replace(":","");
	//var currentDay = <%= Weekday(date, 2) %>;
	var dayArray = radioArray[0];
	for(var i=0;i<dayArray.length;i++){	
		if(currentTime >= dayArray[i].start && currentTime <= dayArray[i].end){
			o = dayArray[i].image;

		}
	}
	return o; 
}

function createTime(t){
	var str;
	if(t > 1259){
		str = (t-1200) + "pm";
	} else {
		var time = t < 100 ? "12"+t.toString() : t;
		var suffix = t >= 1200 ? "pm" : "am";
		str = time + suffix;
	}
	str = str.length == 5 ? str.substring(0,1) + ":" + str.substring(1,5) : str.substring(0,2) + ":" + str.substring(2,6)
	return str.replace(":00","");
}

function writeStreamSchedule(){
	nextShow.headline = nextShow.headline.split('<br/>')[0];
	laterShow.headline = laterShow.headline.split('<br/>')[0];
	var s = "<strong>Next &#151; " + createTime(nextShow.start) + ":</strong> " + nextShow.headline + "<br/>";
	s += "<strong>Later &#151; " + createTime(laterShow.start) + ":</strong> " + laterShow.headline;
	return s;
}
