// JavaScript Document
var weekday=new Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
var months=new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");

// Sarissa - http://sarissa.sourceforge.net/doc/ suggested by
// http://www.yourhtmlsource.com/javascript/ajax.html

// http://www.albionresearch.com/misc/urlencode.php
// Manually edited to make it a input / return function
// The Javascript escape and unescape functions do not correspond
// with what browsers actually do...
function URLEncode(plaintext)
 {
  var SAFECHARS = "0123456789" +                 // Numeric
                  "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + // Alphabetic
                  "abcdefghijklmnopqrstuvwxyz" +
                  "-_.!~*'()";                   // RFC2396 Mark characters
  var HEX = "0123456789ABCDEF";
  var encoded = "";
  for (var i = 0; i < plaintext.length; i++ )
   {
    var ch = plaintext.charAt(i);
    if (ch == " ")
     {
      encoded += "+";   // x-www-urlencoded, rather than %20
     }
    else if (SAFECHARS.indexOf(ch) != -1)
     {
      encoded += ch;
     }
    else
     {
      var charCode = ch.charCodeAt(0);
      if (charCode > 255)
       {
// alert( "Unicode Character '" + ch + "' cannot be encoded using standard URL encoding.\n" + "(URL encoding only supports 8-bit characters.)\n" + "A space (+) will be substituted." );
        encoded += "+";
       }
      else
       {
        encoded += "%";
        encoded += HEX.charAt((charCode >> 4) & 0xF);
        encoded += HEX.charAt(charCode & 0xF);
       }
     }
   } // for
  return encoded;
 }

// http://xindiff.cvs.sourceforge.net/*checkout*/xindiff/XinDiff/POC/XinDiff.html
function doDiff(left, right)
 {
  var diff = new DiffEngine();
  diff.assign(left.words, 1);
  diff.assign(right.words, 0);
  var output = new DiffOutput();
  output.diff = diff;
  output.symbols = [right.symbols, left.symbols];
  diff.doDiff().serialize(diff, output);
  return output.getHTML();
 }
function isLiteral(ch)
 {
  return ((ch <= 'z') && (ch >= 'a')) || ((ch <= 'Z') && (ch >= 'A')) || ((ch <= '9') && (ch >= '0')) || (ch == '_') || (ch == '-') || (ch == '+');
 }
function splitWords(text)
 {
  var words = [];
  var symbols = {};
  var length = text.length;
  var word = '';
  var symbol = '';
  for (var i = 0; i < length; ++i)
   {
    if (text.charCodeAt(i) >= 256)
     {
      if (word != '')
       {
        words.push(word);
        word = '';
       }
      else if (symbol != '')
       {
        symbols[words.length] = symbol;
        symbol = '';
       }
      words.push(text.charAt(i));
     }
    else
     {
      var ch = text.charAt(i);
      if (isLiteral(ch))
       {
        if (symbol != '')
         {
          symbols[words.length] = symbol;
          symbol = '';
         }
        word += ch;
       }
      else
       {
        if (word != '')
         {
          words.push(word);
          word = '';
         }
        symbol += ch;
       }
     }
   }
  if (word != '')
   {
    words.push(word);
   }
  else if (symbol != '')
   {
    symbols[words.length] = symbol;
   }
  return {'words': words, 'symbols': symbols};
 }

// Days and Months for Javascript date updated
var weekday=new Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
var months=new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
// Popup Software Screenshots
function popup(windowname,versionid)
 {
  if (!window.focus)return true;
  window.open("/screenpop.php?Version_ID="+versionid, windowname, 'width=810,height=442,scrollbars=no');
  return false;
 }
// Popup Compilation Screenshots
function comppop(windowname,compilationid)
 {
  if (!window.focus)return true;
  window.open("/screenpop.php?Compilation_ID="+compilationid, windowname, 'width=910,height=260,scrollbars=no');
  return false;
 }
// Highlight / Unhighlight current row
function trackrow(rowid,rowcol)
 {
  if (document.getElementById) document.getElementById("rowno"+rowid).style.backgroundColor=rowcol;
 }
// Click through to link (on non a anchors)
function ClickThru(x)
 {
  if (document.getElementById)
   if (document.getElementById(x))
    parent.document.location = document.getElementById(x).href;
 }
