		function tab(layerName) {
           		if (document.getElementById) // Netscape 6 and IE 5+
           		{
					setLayers(layerName)
					setCookie('ActiveLayer', layerName);
            	}
		}
		function setCookie(name, value, expires, path, domain, secure)
		{
			var days = 0;
			var expdate = new Date("January 1, 2031");
			expdate.setTime(expdate.getTime() + days*24*60*60*1000);
			expires = expdate;
							
			document.cookie= name + "=" + escape(value) +
				((expires) ? "; expires=" + expires.toGMTString() : "") +
				((path) ? "; path=" + path : "") +
				((domain) ? "; domain=" + domain : "") +
				((secure) ? "; secure" : "");
		}
		function getCookie(name)
		{
			var dc = document.cookie;
			var prefix = name + "=";
			var begin = dc.indexOf("; " + prefix);
			if (begin == -1)
			{
				begin = dc.indexOf(prefix);
				if (begin != 0) return null;
			}
			else
			{
				begin += 2;
			}
			var end = document.cookie.indexOf(";", begin);
			if (end == -1)
			{
				end = dc.length;
			}
			return unescape(dc.substring(begin + prefix.length, end));
		}
		function setLayers(layerName)
		{
		        var helpLayer = document.getElementById('lyrHelp');
			var advancedSearchOptions = document.getElementById('lyrAdvancedSearchOptions');
			var dropdownSearchOptions = document.getElementById('lyrDropDownSearchOptions');

			if (layerName == 'lyrAdvancedSearchOptions') {
				if (advancedSearchOptions.style.display == 'none') {
					dropdownSearchOptions.style.display = 'block';
					advancedSearchOptions.style.display = 'block';
					helpLayer.style.display = 'none';
				} else {
					dropdownSearchOptions.style.display = 'none';
					advancedSearchOptions.style.display = 'none';
					helpLayer.style.display = 'none';
				}
			}
			if (layerName == 'lyrHelp') {
				if (helpLayer.style.display == 'none') {
					dropdownSearchOptions.style.display = 'none';
					advancedSearchOptions.style.display = 'none';
					helpLayer.style.display = 'block';
				} else {
					dropdownSearchOptions.style.display = 'none';
					advancedSearchOptions.style.display = 'none';
					helpLayer.style.display = 'none';
				}
			}

		}
		function setDivs()
		{
			var layerName = getCookie('ActiveLayer');
			setLayers(layerName);
		}
		function openWindow(theURL,winName,features) {
			TVStation = window.open(theURL,winName,features);
		}
		function gridMouseOver(obj,channelId) {
			for (var i = 1; i <= obj.id.substring(obj.id.length, obj.id.length-1); i++)
			{
				document.getElementById(channelId + 'star' + i).src='images/rating-filled-star.gif';
			}
		}
		function gridMouseOut(obj,channelId) {
			for (var i = 1; i <= 5; i++)
			{
				document.getElementById(channelId + 'star' + i).src='images/rating-empty-star.gif';
			}
		}
		function openDiv(channelId,userId)
		{
			document.getElementById('ratinggrid' + channelId).innerHTML = '<img src="images/rating-empty-star.gif" name="' + channelId + 'star1" id="' + channelId + 'star1" border="0" width="14" height="14" style="cursor:pointer;" onclick="RateStation(1,' + channelId + ',1,' + userId + ')" onmouseout="gridMouseOut(this,' + channelId + ')" onmouseover="gridMouseOver(this,' + channelId + ')" onerror="" vspace="4"><img src="images/rating-empty-star.gif" name="' + channelId + 'star2" id="' + channelId + 'star2" border="0" width="14" height="14" style="cursor:pointer;" onclick="RateStation(2,' + channelId + ',1,' + userId + ')" onmouseout="gridMouseOut(this,' + channelId + ')" onmouseover="gridMouseOver(this,' + channelId + ')" onerror="" vspace="4"><img src="images/rating-empty-star.gif" name="' + channelId + 'star3" id="' + channelId + 'star3" border="0" width="14" height="14" style="cursor:pointer;" onclick="RateStation(3,' + channelId + ',1,' + userId + ')" onmouseout="gridMouseOut(this,' + channelId + ')" onmouseover="gridMouseOver(this,' + channelId + ')" onerror="" vspace="4"><img src="images/rating-empty-star.gif" name="' + channelId + 'star4" id="' + channelId + 'star4" border="0" width="14" height="14" style="cursor:pointer;" onclick="RateStation(4,' + channelId + ',1,' + userId + ')" onmouseout="gridMouseOut(this,' + channelId + ')" onmouseover="gridMouseOver(this,' + channelId + ')" onerror="" vspace="4"><img src="images/rating-empty-star.gif" name="' + channelId + 'star5" id="' + channelId + 'star5" border="0" width="14" height="14" style="cursor:pointer;" onclick="RateStation(5,' + channelId + ',1,' + userId + ')" onmouseout="gridMouseOut(this,' + channelId + ')" onmouseover="gridMouseOver(this,' + channelId + ')" onerror="" vspace="4">'; 
		}
		function closeDiv(channelId,rating)
		{
			//setCookie(channelId, rating);
			document.getElementById('ratinggrid' + channelId).style.display = 'none';
			document.getElementById('alink' + channelId).style.display = 'none';
		}
		function rld()
		{
			setTimeout('window.location = window.location', 3000);
		}
		function flipChannel(channelId,memberUsername,flag)
		{
			if (flag == "Add")
			{
				document.getElementById('addTVlink' + channelId).innerHTML = '<a href=\"javascript:RemoveMyTV(\'' + channelId + '\',\'' + memberUsername + '\',true)\" onMouseover=\"WriteStatus(\'\');return true;\" onMouseout=\"WriteStatus(\'\');return true;\" rel=\"nofollow\"><img src=images/r_mytv.gif  height=31 width=88 border=0 alt=\"Remove from My TV\" /></a>';
			}
			else
			{
				document.getElementById('addTVlink' + channelId).innerHTML = '<a href=\"javascript:AddMyTV(\'' + channelId + '\',\'' + memberUsername + '\',true)\" onMouseover=\"WriteStatus(\'\');return true;\" onMouseout=\"WriteStatus(\'\');return true;\" rel=\"nofollow\"><img src=images/a_mytv.gif  height=31 width=88 border=0 alt=\"Add to My TV\" /></a>';
			}
		}