var lastEvent = 0;
var isClose = 0;
var svi;
var svs;
var scrWidth = 783;

function writeCookie(name,value) {
  var a = arguments.length;
  var yr = "2023";
  if (arguments.length == 3) {
      yr = arguments[2];
  }
  var today = new Date();
  var the_date = new Date("December 31, " + yr);
  var the_cookie_date = the_date.toGMTString();
  var the_cookie = name+"="+value;
  var the_cookie = the_cookie + ";path=/;expires=" + the_cookie_date;
  document.cookie=the_cookie;
}

function bdyLoad(url) {
  var n = document.getElementById('tblNav');
  var l = document.getElementById('frmLive');
  var t = document.getElementById('frmTitles');
  var x = document.getElementById('xxx');
  var a = document.getElementById('frmAds');
  var e = document.getElementById('frmEvents');
  var y = document.getElementById('frmToday');
  var f = document.getElementById('frmProfile');
// a= 452x160
  var p = document.getElementById('frmPics');
// p= 331x160
  l.style.top = 0;
//  l.style.left = n.offsetWidth-6;
  l.style.left = 417;
  l.style.width = scrWidth - n.offsetWidth -20;
  l.src = url+"/live";
//  a.style.top = x.offsetTop + x.offsetHeight;
  a.style.top = n.offsetTop + n.offsetHeight;
  a.style.left = 0;
  a.style.width = 400; //n.offsetWidth;
  a.style.height = 160;
//  p.style.top = a.style.top;
//  p.style.width = l.offsetWidth;
//  p.style.left = parseInt(a.style.left) + a.offsetWidth;
//  p.style.height = 160;
  t.style.top = parseInt(a.style.top) + a.offsetHeight;
  t.style.width = n.offsetWidth;
  t.style.left = 0;
  e.style.top = t.style.top;
  e.style.height = t.offsetHeight / 2;
  e.style.left = t.offsetWidth;
  y.style.top = parseInt(t.style.top) + (t.offsetHeight / 2);
  y.style.height = t.offsetHeight / 2;
  y.style.left = t.offsetWidth;
//  p.style.top = x.style.top;
  p.style.top = parseInt(a.style.top)-(197-160);
  p.style.width = 348; //l.offsetWidth;
  p.style.left = 417; //t.offsetWidth; //parseInt(a.style.left) + a.offsetWidth;
  p.style.height = 197; //x.offsetHeight + a.offsetHeight;
//alert("w="+p.style.width + " l+" + p.style.left + " h=" + p.style.height);
  f.style.left = 0;
  f.style.top = parseInt(t.style.top)+t.offsetHeight*2;
  f.style.width = scrWidth - 20;
  t.src = url+"/ondemand";
  a.src = url+"/ads";
  p.src = url+"/pics";
//  e.src = url+"/event";
//  y.src = url+"/today";
}

function frmLiveMOver() {
//  var f = document.getElementById('frmLive');
//  var n = document.getElementById('tblNav');
//  var s = document.getElementById('tblSponsor');
//  var i = document.getElementById('ifrAds');
//  svi = i.style.width;
//  svs = s.style.width;
//  if (parseInt(f.style.height) > parseInt(s.style.top)) {
//    i.style.width = n.offsetWidth;
//    s.style.width = n.offsetWidth;
//  }
}

function frmLiveMOut() {
//  var s = document.getElementById('tblSponsor');
//  var i = document.getElementById('ifrAds');
//  i.style.width = svi;
//  s.style.width = svs;
}

// Script Source: CodeLifter.com
// Copyright 2003
// Do not remove this header

isIE=document.all;
isNN=!document.all&&document.getElementById;
isN4=document.layers;
isHot=false;

function ddInit(e){
  topDog=isIE ? "BODY" : "HTML";
  whichDog=isIE ? document.all.theLayer : document.getElementById("theLayer");
  hotDog=isIE ? event.srcElement : e.target;
  while (hotDog.id!="titleBar"&&hotDog.tagName!=topDog){
    hotDog=isIE ? hotDog.parentElement : hotDog.parentNode;
  }
  if (hotDog.id=="titleBar"){
    offsetx=isIE ? event.clientX : e.clientX;
    offsety=isIE ? event.clientY : e.clientY;
    nowX=parseInt(whichDog.style.left);
    nowY=parseInt(whichDog.style.top);
    ddEnabled=true;
    document.onmousemove=dd;
  }
}

function dd(e){
  if (!ddEnabled) return;
  whichDog.style.left=isIE ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx;
  whichDog.style.top=isIE ? nowY+event.clientY-offsety : nowY+e.clientY-offsety;
  return false;
}

function ddN4(whatDog){
  if (!isN4) return;
  N4=eval(whatDog);
  N4.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
  N4.onmousedown=function(e){
    N4.captureEvents(Event.MOUSEMOVE);
    N4x=e.x;
    N4y=e.y;
  }
  N4.onmousemove=function(e){
    if (isHot){
      N4.moveBy(e.x-N4x,e.y-N4y);
      return false;
    }
  }
  N4.onmouseup=function(){
    N4.releaseEvents(Event.MOUSEMOVE);
  }
}

function hideMe(){
  isClose = 1;
  if (isIE||isNN) whichDog.style.visibility="hidden";
  else if (isN4) document.theLayer.visibility="hide";
var obj = document.getElementById('plr');
  obj.controls.stop();
  obj.URL = "";
}

function showMe(){
  isClose = 0;
  if (isIE||isNN) whichDog.style.visibility="visible";
  else if (isN4) document.theLayer.visibility="show";
}

document.onmousedown=ddInit;
document.onmouseup=Function("ddEnabled=false");

