rpcookie = "RPVER" ;
var timeout ;

self.onerror = function() { return true ; }

function ResetInfo()
{
  state=document.video.GetPlayState() ;
  if (state == 0 && document.info.src != "http://www.wrev.net/cgi-bin/insert_info")
  {
    saved = document.info.src ;
    document.info.src = "/cgi-bin/insert_info" ;
  }
  setTimeout("ResetInfo()", 1000) ;
}

function HitPlay()
{
  document.info.src = saved ;
  document.video.DoPlay () ;
}
  
function SetCookie(name, value)
{       
  var oneweek = 7*24*60*60*1000 ;
  var never = new Date() ;
  never.setTime(never.getTime() + oneweek); // 
  document.cookie = name + "=" + escape(value) + "; expires=" + never.toGMTString() ;
}

function GetCookie(name)
{       
  var result = "" ;
  var myCookie = " " + document.cookie + ";" ;
  var searchName = " " + name + "=" ;
  var startOfCookie = myCookie.indexOf(searchName) ;
  var endOfCookie;
  if (startOfCookie != -1)
  {
    startOfCookie += searchName.length ;
    endOfCookie = myCookie.indexOf(";", startOfCookie) ;
    result = unescape(myCookie.substring(startOfCookie, endOfCookie)) ;
  }
  return result ;
}

function inc_volume()
{
  current_vol=document.video.GetVolume () ;
  current_vol=current_vol+15 ;
  if (current_vol > 100) { current_vol=100 ; } 
  document.video.SetVolume (current_vol) ;
}

function dec_volume()
{
  current_vol=document.video.GetVolume () ;
  current_vol=current_vol-15 ;
  if (current_vol < 0) { current_vol=0 ; } 
  document.video.SetVolume (current_vol) ;
}

function new_source(source, studio, show, stream)
{
  if (document.video)
  {
    document.video.SetSource (source) ;
    document.video.DoPlay () ;
    document.info.src = "/cgi-bin/insert_sql_nowplaying?studio=" + studio + "&show=" + show + "&stream=" + stream ;
    focus () ;
  }
}

function open_info(source)
{
  info = window.open (source, "info", "width=700,height=560,status=yes,resizable=yes") ;
}

function set_popup(caption, option)
{
  command = "overlib('" + caption + "', " + option + ")" ;
  if (typeof timeout != "undefined") { clearTimeout (timeout) ; }
  timeout = setTimeout (command, 750) ;
}

function clear_popup()
{
  clearTimeout (timeout) ;
  nd () ;
}
