var expDays = 30; // number of days the cookie should last

//var page = "wmv.html?keepThis=true&TB_iframe=true&height=640&width=480";
//var windowprops = "width=300,height=200,location=no,toolbar=no,menubar=no,scrollbars=no,resizable=yes";

function popup() {
<!--
// -----------------------------------------------------------------------------
// Globals
// Major version of Flash required
var requiredMajorVersion = 8;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Minor version of Flash required
var requiredRevision = 0;
// -----------------------------------------------------------------------------
// -->
<!--
// Version check based upon the values entered above in "Globals"
var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);

// Check to see if the version meets the requirements for playback
if (hasReqestedVersion) {
	// if we've detected an acceptable version
	// embed the Flash Content SWF when all tests are passed
	AC_FL_RunContent(
				"src", "flash/popup_new",
				"width", "320",
				"height", "240",
				"align", "middle",
				"wmode", "transparent",
				"quality", "high",
				"scale", "noscale",
				"title", "NYSCRUL :30 TV",
				"allowScriptAccess","sameDomain",
				"type", "application/x-shockwave-flash",
				'codebase', 'http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab',
				"pluginspage", "http://www.adobe.com/go/getflashplayer"
	);
} else {  // flash is too old or we can't detect the plugin
//	var alternateContent = 'NYSCUL :30 TV'
	+ 'This content requires Adobe Flash Player 8 or higher. '
	+ '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
//	document.write(alternateContent);  // insert non-flash content
}
// -->
}

function GetCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
    return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break;
  }
  return null;
}

function SetCookie (name, value) {
  var argv = SetCookie.arguments;
  var argc = SetCookie.arguments.length;
  var expires = (argc > 2) ? argv[2] : null;
  var path = (argc > 3) ? argv[3] : null;
  var domain = (argc > 4) ? argv[4] : null;
  var secure = (argc > 5) ? argv[5] : false;
  document.cookie = name + "=" + escape (value) +
    ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
    ((path == null) ? "" : ("; path=" + path)) +
    ((domain == null) ? "" : ("; domain=" + domain)) +
    ((secure == true) ? "; secure" : "");
}

function DeleteCookie (name) {
  var exp = new Date();
  exp.setTime (exp.getTime() - 1);
  var cval = GetCookie (name);
  document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

var exp = new Date();
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

function amt(){
  var count = GetCookie('count')
  if(count == null) {
    SetCookie('count','1')
    return 1
  } else {
    var newcount = parseInt(count) + 1;
    DeleteCookie('count')
    SetCookie('count',newcount,exp)
    return count
  }
}

function getCookieVal(offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
  endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}

function checkCount() {
  var count = GetCookie('count');
  if (count == null) {
    count=1;
    SetCookie('count', count, exp);
	document.write('<div id="popup_container">');
	document.write('<div id="popup">');
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="320" height="240">');
    document.write('<param name="movie" value="flash/popup_new.swf" />');
    document.write('<param name="quality" value="high" />');
    document.write('<embed src="flash/popup_new.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="320" height="240"></embed>');
    document.write('</object>');
	document.write('<br /><img src="images/empty.gif" width="59" height="42" /><a href="index.html" title="close" onclick="javascript:document.getElementById(\'popup\').style.display=\'none\';javascript:document.getElementById(\'popup\').style.visibility=\'hidden\';" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'popupclose\',\'\',\'images/h_popup_butover.gif\',1)"><img src="images/h_popup_but.gif" alt="CLOSE TV to ENTER SITE" name="popupclose" width="217" height="32" border="0" id="popupclose" /></a>');
	document.write('</div></div>');
  } else {
    count++;
    SetCookie('count', count, exp);
  }
}

function popItUp() {
	document.write('<div style="position:relative; margin: 0 auto 0 auto; padding:0 0 0 0; text-align:left; width:745px; z-index:99;">');
	document.write('<div style="position:absolute; top:130px; left:195px; width:337px; height:313px; z-index:100; background-image:url(images/h_popup_bg.gif); background-position:top left; background-repeat:no-repeat; padding:11px 0px 0px 13px;">');
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="320" height="240">');
    document.write('<param name="movie" value="flash/popup_new1.swf" />');
    document.write('<param name="quality" value="high" />');
    document.write('<embed src="flash/popup_new1.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="320" height="240"></embed>');
    document.write('</object>');
	document.write('<br /><img src="images/empty.gif" width="59" height="42" /><a href="index.html" title="close" onclick="javascript:document.getElementById(\'popup\').style.display=\'none\';javascript:document.getElementById(\'popup\').style.visibility=\'hidden\';" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'popupclose\',\'\',\'images/h_popup_butover.gif\',1)"><img src="images/h_popup_but.gif" alt="CLOSE TV to ENTER SITE" name="popupclose" width="217" height="32" border="0" id="popupclose" /></a>');
	document.write('</div></div>');
}

fls = document.getElementsByTagName("object");
for (var a = 0; a < fls.length; a++){fls[a].outerHTML = fls[a].outerHTML;}
//window.onload=checkCount;
