// JavaScript Document

function getCookie(name)
{ var pos
  var token = name + "=";
  var tnlen = token.length;
  var cklen = document.cookie.length;
  var i = 0;
  var j;
  while (i < cklen)
  { j = i + tnlen;
    if (document.cookie.substring(i, j) == token)
    { pos = document.cookie.indexOf (";", j);
      if (pos == -1)
        pos = document.cookie.length;
      return unescape(document.cookie.substring(j, pos));
    }
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break;
  } //End While
  return null;
}
function setCookie(name, value)
{ document.cookie = name + "=" + escape(value)
}
function deleteCookie(name)
{ var exp = new Date();
  exp.setTime (exp.getTime() - 1);
  var cval = getCookie (name);
  document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();

}

function checkcookies()
{

var gCookieName;
var gCookieValueRet;
gCookieName="STBCOOKIETEST";
gCookieValue="STB_TESTING_COOKIE";
gCookieValueRet="???"
setCookie(gCookieName,gCookieValue,1);
gCookieValueRet=getCookie(gCookieName);


if (gCookieValueRet==null){
var win = window.open("","win","width=600,height=200"); // a window object
var doc1 = win.document;
doc1.open("text/html", "replace");
doc1.bgColor="#F5F4EB";
	doc1.write("<h4>Please enable cookies on your browser for normal browsing</h4>");
	doc1.write("To enable cookies, follow the instructions below for the browser version you are using.");
	doc1.write("<p></p>");
	doc1.write("<table border=0>");
	doc1.write("<tr><td><h4>Mozilla Firefox (1.0 final release and earlier)</h4><td>");
	doc1.write("<tr><td>-Go to the 'Tools' menu.<td>");
	doc1.write("<tr><td>-Select 'Options'.<td>");
	doc1.write("<tr><td>-Select the 'Privacy' icon in the left panel.<td>");
	doc1.write("<tr><td>-Check the box corresponding to 'Allow sites to set cookies'.<td>");
	doc1.write("<tr><td>-Click 'OK' to save changes.<td>");
	doc1.write("</table>");
	doc1.write("<p></p>");
	doc1.write("<table border=0>");
	doc1.write("<tr><td><h4>Netscape 7.1/Mozilla 5.0</h4><td>");
	doc1.write("<tr><td>-Select 'Preferences' from the Edit menu.<td>");
	doc1.write("<tr><td>-Click on the arrow next to 'Privacy & Security' in the scrolling window to expand.<td>");
	doc1.write("<tr><td>-Under 'Privacy & Security', select 'Cookies'.<td>");
	doc1.write("<tr><td>-Select 'Enable all cookies'.<td>");
	doc1.write("<tr><td>-Click 'OK'.<td>");
	doc1.write("</table>");
	doc1.write("<p></p>");
	doc1.write("<table border=0>");
	doc1.write("<tr><td><h4>Microsoft Internet Explorer 6.0+</h4><td>");
	doc1.write("<tr><td>-Select 'Internet Options' from the Tools menu.<td>");
	doc1.write("<tr><td>-Click on the 'Privacy' tab.<td>");
	doc1.write("<tr><td>-Click the 'Default' button (or manually slide the bar down to 'Medium') under 'Settings'.<td>");
	doc1.write("<tr><td>-Click 'OK'.<td>");
	doc1.write("</table>");
	doc1.write("<p></p>");
	doc1.write("<table border=0>");
	doc1.write("<tr><td><h4>Microsoft Internet Explorer 5.x</h4><td>");
	doc1.write("<tr><td>-Select 'Internet Options' from the Tools menu.<td>");
	doc1.write("<tr><td>-Click on the 'Security' tab.<td>");
	doc1.write("<tr><td>-Click the 'Custom Level' button.<td>");	
	doc1.write("<tr><td>-Scroll down to the 'Cookies' section.<td>");
	doc1.write("<tr><td>-To enable:<td>");
	doc1.write("<tr><td> o Set 'Allow cookies that are stored on your computer' to 'Enable'.<td>");
	doc1.write("<tr><td> o Set 'Allow per-session cookies' to 'Enable'.<td>");
	doc1.write("<tr><td>-Click 'OK'.<td>");
	doc1.write("</table>");

	doc1.close();}
deleteCookie(gCookieName);
}
