function uknow(who2, dom2, who1, disp, cl, dom1) {
var h = '<a href="';
var m = "ma***o:";
var a = "@";
  m = m.replace('***', 'ilt');
  if (disp == "") {
    document.write(h+m+who1+who2+a+dom1+dom2+'" class="' + cl + '">'+who1+who2+a+dom1+dom2+'</a>');
  }
  else {
    document.write(h+m+who1+who2+a+dom1+dom2+'" class="' + cl + '">'+disp+'</a>');
  }
}

function display_pic(src, width, height, caption) {
  window_handle = window.open('', 'pics',
      'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,'+
      'resizable=yes,copyhistory=no,width=' + (width+50) + ',height=' + (height+95) + ',top=20,left=20');
  window_handle.document.open();
  window_handle.document.writeln("<html>");
  window_handle.document.writeln("<head>");
  window_handle.document.writeln("<title>Northern Little League</title>");
  window_handle.document.writeln("<LINK REL='StyleSheet' HREF='style.css' TYPE='text/css'>");
  window_handle.document.writeln("</head>");
  window_handle.document.writeln("<body>");
  window_handle.document.writeln("<center>");
  window_handle.document.writeln("<div class='title' style='margin-left:20; margin-right:20'>" + caption + "</div>");
  window_handle.document.writeln("<img src='" + src.href + "' width=" + width + " height=" + height + " border=0>");
  window_handle.document.writeln("</center>");
  window_handle.document.writeln("</body>");
  window_handle.document.writeln("</html>");
  window_handle.document.close();
  window_handle.focus();
  return false;
}

function getWindowWidth(){
  var ww = 0;
  d = document;
   if ( typeof window.innerWidth != 'undefined' )
     ww = window.innerWidth;  // NN and Opera version
   else
   {
     if ( d.documentElement
       && typeof d.documentElement.clientWidth!='undefined'
       && d.documentElement.clientWidth != 0 )
       ww = d.documentElement.clientWidth;
     else
       if ( d.body
         && typeof d.body.clientWidth != 'undefined' )
         ww = d.body.clientWidth;
     else ww = 800;
   }
   return ww;
}

function Show_Tab(which) {
  x = document.getElementById("header");
  y = x.getElementsByTagName("li");
  for (var i=0;i<y.length;i++) {
    if (y[i].id == "current") {
      y[i].id = "";
    }
    d = document.getElementById("div"+i);
    if (d) {
      d.style.display="none";
    }
  }
  y[which].id="current";
  d = document.getElementById("div"+which);
  if (d) {
    d.style.display="block";
  }
  return false;
}

var rtclockID = 0;
var seconds = 60;
function UpdateClock() {
  if(rtclockID) {
    clearTimeout(rtclockID);
    rtclockID  = 0;
  }
  seconds++;
  if (seconds > 30) {
    ajaxFunction();
    seconds = 0;
  }   
  rtclockID = setTimeout("UpdateClock()", 1000);
}

function StartClock() {
  rtclockID = setTimeout("UpdateClock()", 1000);
}

function ajaxFunction() {
var xmlhttp;
  if (window.XMLHttpRequest) {
    // code for IE7+, Firefox, Chrome, Opera, Safari
    xmlhttp=new XMLHttpRequest();
  }
  else if (window.ActiveXObject) {
    // code for IE6, IE5
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
  else {
    alert("Your browser does not support XMLHTTP!");
  }
  xmlhttp.onreadystatechange=function() {
    if(xmlhttp.readyState==4) {
      response=xmlhttp.responseText;
      document.getElementById("rt_scores").innerHTML=response;
    }
  }
  xmlhttp.open("GET","get_rtscores.php?sid="+Math.random() + "&game=" + rtGames,true);
  xmlhttp.send(null);
}
