function PlayMusic()
{
	// Open the player window then navigate to the InternetRadio page
	TBATPlayer = window.open ("Player.htm","TBAT_Player","menubar=no,resizable=no,status=no,directories=no,scrollbars=no,toolbar=no,width=372,height=260");
	document.location = "InternetRadio.aspx";
}

function ExecutePlayNowButton()
{
	// Save the users selections then start playing it
	document.getElementById("ctl00_ContentPlaceHolderMain_PlayNowButton").click();
//	alert("The Category Selection process is under cunstruction.");
}

function resizeContent()
{
    var browser = findBrowserSize(); // retrieve current browser dimentions
    var base = 38 + 62 + 85; // Calculate... browse stuff=38 + header=62 + footer=82

	var news = document.getElementById("ctl00_PanelNews");
	if (news)
	{
		staticLeft = base + 237; // Add PlayNow gif space
		newHeight = browser.height - staticLeft;
		news.style.height = newHeight > 0 ? newHeight+"px" : "1px";
	}
	var content = document.getElementById("ctl00_ContentPlaceHolderMain_PanelDefault");
	if (content)
	{
	    staticRight = base + 170; // Add top section space for Default page
		newHeight = browser.height - staticRight;
		content.style.height = newHeight > 0 ? newHeight+"px" : "1px";
	}
	var content = document.getElementById("ctl00_ContentPlaceHolderMain_PanelContent");
	if (content)
	{
	    staticRight = base + 43; // Add top section space for other pages
		newHeight = browser.height - staticRight;
		content.style.height = newHeight > 0 ? newHeight+"px" : "1px";
	}
}

function findBrowserSize()
{
	var viewportwidth;
	var viewportheight;

	if (typeof window.innerWidth != 'undefined') {
		viewportwidth = window.innerWidth,
		viewportheight = window.innerHeight
	}
	// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
	else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) {
		viewportwidth = document.documentElement.clientWidth,
		viewportheight = document.documentElement.clientHeight
	}
	// older versions of IE
	else {
		viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
		viewportheight = document.getElementsByTagName('body')[0].clientHeight
	}
	return {width: viewportwidth, height: viewportheight}
}

function createCookie(name, value, days)
{
	var expires;
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		expires = "; expires=" + date.toGMTString();
	}
	else
		expires = "";
	document.cookie = name + "=" + value + expires + "; path=/";
}

function readCookie(name)
{
	var ca = document.cookie.split(';');
	var nameEQ = name + "=";
	for(var i=0; i < ca.length; i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1, c.length); //delete spaces
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
	}
	return null;
}

function pause(numberMillis) 
{
	var now = new Date();
	var exitTime = now.getTime() + numberMillis;
	while (true) {
		now = new Date();
		if (now.getTime() > exitTime) {
			return;
		}
	}
}

/*
function wait(millisec)
{
	var date = new Date();
	var curDate = null;

	do { curDate = new Date(); }
		while(curDate - date < millisec);
} 

function findBrowserSize()
{
	// determine browser size
	var winW, winH
	if (parseInt(navigator.appVersion) > 3) {
		if (navigator.appName == "Netscape") {
			winW = window.innerWidth;
			winH = window.innerHeight;
		}
		if (navigator.appName.indexOf("Microsoft")!= -1) {
			winW = document.body.offsetWidth;
			winH = document.body.offsetHeight;
		}
	}
	if (winW == null) {winW = 800; winH = 450;}
	return {width: winW, height: winH}
}

function setCookie()
{
    var the_name = "nimrod";//prompt("What's your name?","");
    var the_cookie = "cookie_puss=" + escape(the_name) + ";" ;
    var the_cookie = the_cookie + "path=/;";
    var the_cookie = the_cookie + "domain=webmonkey.com;";
    document.cookie = the_cookie;
}

function myOpenWindow(winURL, winName, winFeatures, winObj)
{
  var theWin; // this will hold our opened window

  // first check to see if the window already exists
  if (winObj != null)
  {
    // the window has already been created, but did the user close it?
    // if so, then reopen it. Otherwise make it the active window.
    if (!winObj.closed) {
      winObj.focus();
      return winObj;
    }
    // otherwise fall through to the code below to re-open the window
  }
  // if we get here, then the window hasn't been created yet, or it
  // was closed by the user.
  theWin = window.open(winURL, winName, winFeatures);
  return theWin;
}
*/
