function Is() {
	var agt=navigator.userAgent.toLowerCase();
    // Note: On IE5, these return 4, so use this.ie5up to detect IE5.
    this.major = parseInt(navigator.appVersion);
    this.minor = parseFloat(navigator.appVersion);
    // Note: Opera and WebTV spoof Navigator.  We do strict client detection.
    // If you want to allow spoofing, take out the tests for opera and webtv.
    this.ns  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
                && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
    this.ns2    = (this.nav && (this.major == 2));
    this.ns3    = (this.nav && (this.major == 3));
    this.ns4    = (this.nav && (this.major == 4));
    this.ns4up  = (this.nav && (this.major >= 4));
    this.nsonly = (this.nav && ((agt.indexOf(";nav") != -1) || (agt.indexOf("; nav") != -1)) );
    this.ns6    = (this.nav && (this.major == 5));
    this.ns6up  = (this.nav && (this.major >= 5));
    this.gecko  = (agt.indexOf('gecko') != -1);
    this.ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
    this.ie3    = (this.ie && (this.major < 4));
    this.ie4    = (this.ie && (this.major == 4) && (agt.indexOf("msie 4")!=-1) );
    this.ie4up  = (this.ie && (this.major >= 4));
    this.ie5    = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.0")!=-1) );
    this.ie55   = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.5") !=-1));
    this.ie5up  = (this.ie && !this.ie3 && !this.ie4);
    this.ie55up = (this.ie && !this.ie3 && !this.ie4 && !this.ie5);
    this.ie6    = (this.ie && (this.major == 4) && (agt.indexOf("msie 6.")!=-1) );
    this.ie6up  = (this.ie && !this.ie3 && !this.ie4 && !this.ie5 && !this.ie5_5);
    // KNOWN BUG: On AOL4, returns false if IE3 is embedded browser
    // or if this is the first browser window opened.  Thus the
    // variables this.aol, this.aol3, and this.aol4 aren't 100% reliable.
    this.aol    = (agt.indexOf("aol") != -1);
    this.aol3   = (this.aol && this.ie3);
    this.aol4   = (this.aol && this.ie4);
    this.aol5   = (agt.indexOf("aol 5") != -1);
    this.aol6   = (agt.indexOf("aol 6") != -1);
    this.op     = (agt.indexOf("opera") != -1);
    this.op2    = (agt.indexOf("opera 2") != -1 || agt.indexOf("opera/2") != -1);
    this.op3    = (agt.indexOf("opera 3") != -1 || agt.indexOf("opera/3") != -1);
    this.op4    = (agt.indexOf("opera 4") != -1 || agt.indexOf("opera/4") != -1);
    this.op5    = (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1);
    this.op5up  = (this.opera && !this.opera2 && !this.opera3 && !this.opera4);
    this.webtv  = (agt.indexOf("webtv") != -1); 
    this.TVNavigator = ((agt.indexOf("navio") != -1) || (agt.indexOf("navio_aoltv") != -1)); 
    this.AOLTV  = this.TVNavigator;
	this.mac    = (agt.indexOf("mac")!=-1);
}
var is = new Is();

var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}


function getFlashMovieObject()
{
   if (is.ie)
   {
     return window.tnnwmenu;
   }
   else
   {
     return window.document.tnnwmenu; 
	}     
}

function SendDataToFlashMovie()
{
	var flashMovie=getFlashMovieObject();
	flashMovie.SetVariable("/:message", document.controller.Data.value);
}

function ReceiveDataFromFlashMovie()
{
	var flashMovie=getFlashMovieObject();
	var message=flashMovie.GetVariable("/:message");
	document.controller.Data.value=message;
}


function aLs(layerID)
{
var returnLayer;
	if(is.ie)
	{
		returnLayer = eval("document.all." + layerID + ".style");
	}
	if(is.ns4)
	{
		returnLayer = eval("document." + layerID);
	} else if(is.ns || is.op)
	{
		returnLayer = eval("document.getElementById('" + layerID + "').style");
	}
	return returnLayer;
}

var bTranState = 1;
function fnToggle() {
    oTransContainer.filters[0].Apply();
    if (bTranState=='0') { 
		bTranState = 1;
        outerveil.style.visibility="hidden"; 
        innerveil.style.visibility="hidden"; 
		}
    else {  
		bTranState = 0;
        outerveil.style.visibility="hidden"; 
        innerveil.style.visibility="hidden"; 
		}
    	oTransContainer.filters[0].Play(duration=2);
}

function writeCookie(name, value, hours)
{
  var expire = "";
  if(hours != null)
  {
    expire = new Date((new Date()).getTime() + hours * 3600000);
    expire = "; expires=" + expire.toGMTString();
  }
  document.cookie = name + "=" + escape(value) + expire + "; domain=tnnw.com;path=/";
}

function readCookie(name)
{
  var cookieValue = "";
  var search = name + "=";
  if(document.cookie.length > 0)
  { 
    offset = document.cookie.indexOf(search);
    if (offset != -1)
    { 
      offset += search.length;
      end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      cookieValue = unescape(document.cookie.substring(offset, end))
    }
  }
  return cookieValue;
}

function slideveil() {
		aLs('oTransContainer').top = '-1600px';
		aLs('outerveil').top = '-1672px';
		aLs('innerveil').top = '-1650px';
}

function hideveil(gender) {
	if(is.ie55up && !is.mac)
	{
		fnToggle();
		moveveil = window.setTimeout("slideveil()",3000);
	}
	else
	{
		slideveil();
		aLs('outerveil').visibility = "hidden";
		aLs('innerveil').visibility = "hidden";
		aLs('oTransContainer').visibility = "hidden";
	}
	aLs('outerveil').zindex = -1;
	aLs('innerveil').zindex = -1;
	aLs('oTransContainer').zindex = -1;
	writeCookie('gender',gender,36000);
	writeCookie('agreed','1');
}

function enternow(gender) {
	writeCookie('gender',gender,36000);
	writeCookie('agreed','1');
	
	
//	window.location('http://www.tnnw.com/');
//	alert( "warned this session: " + readCookie('warned'));
}
