function Help( daLink ) {
  var comwin = window.open(daLink, 'Help', 'width=560, height=450, scrollbars=yes, resize=no');
  comwin.focus();
}
function credWindow( daLink ) {
  var comwin = window.open(daLink, 'Credential', 'width=280, height=420, scrollbars=yes, resize=no');
  comwin.focus();
}
function tip( daLink ) {
  var comwin = window.open(daLink, 'Credential', 'width=400, height=420, scrollbars=yes, resize=no');
  comwin.focus();
}
/**
* FlashObject v1.2.3: Flash detection and embed - http://blog.deconcept.com/flashobject/
*
* FlashObject is (c) 2005 Geoff Stearns and is released under the MIT License:
* http://www.opensource.org/licenses/mit-license.php
*
*/
if (typeof com == "undefined") var com = new Object();
if (typeof com.deconcept == "undefined") com.deconcept = new Object();
if (typeof com.deconcept.util == "undefined") com.deconcept.util = new Object();
if (typeof com.deconcept.FlashObjectUtil == "undefined") com.deconcept.FlashObjectUtil = new Object();
com.deconcept.FlashObject = function(swf, id, w, h, ver, c, useExpressInstall, quality, redirectUrl, detectKey) {
  this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
  this.skipDetect = com.deconcept.util.getRequestParameter(this.DETECT_KEY);
  this.params = new Object();
  this.variables = new Object();
  this.attributes = new Array();
  if (swf) this.setAttribute('swf', swf);
  if (id) this.setAttribute('id', id);
  if (w) this.setAttribute('width', w);
  if (h) this.setAttribute('height', h);
  if (ver) this.setAttribute('version', new com.deconcept.PlayerVersion(ver.toString().split(".")));
  if (c) this.addParam('bgcolor', c);
  var q = quality ? quality : 'high';
  this.addParam('quality', q);
  this.setAttribute('redirectUrl', '');
  if (redirectUrl) this.setAttribute('redirectUrl', redirectUrl);
  if (useExpressInstall) {
    // check to see if we need to do an express install
    var expressInstallReqVer = new com.deconcept.PlayerVersion([6, 0, 65]);
    var installedVer = com.deconcept.FlashObjectUtil.getPlayerVersion();
    if (installedVer.versionIsValid(expressInstallReqVer) && !installedVer.versionIsValid(this.getAttribute('version'))) {
      this.setAttribute('doExpressInstall', true);
    }
  } else {
    this.setAttribute('doExpressInstall', false);
  }
}
com.deconcept.FlashObject.prototype.setAttribute = function(name, value) {
  this.attributes[name] = value;
}
com.deconcept.FlashObject.prototype.getAttribute = function(name) {
  return this.attributes[name];
}
com.deconcept.FlashObject.prototype.getAttributes = function() {
  return this.attributes;
}
com.deconcept.FlashObject.prototype.addParam = function(name, value) {
  this.params[name] = value;
}
com.deconcept.FlashObject.prototype.getParams = function() {
  return this.params;
}
com.deconcept.FlashObject.prototype.getParam = function(name) {
  return this.params[name];
}
com.deconcept.FlashObject.prototype.addVariable = function(name, value) {
  this.variables[name] = value;
}
com.deconcept.FlashObject.prototype.getVariable = function(name) {
  return this.variables[name];
}
com.deconcept.FlashObject.prototype.getVariables = function() {
  return this.variables;
}
com.deconcept.FlashObject.prototype.getParamTags = function() {
  var paramTags = ""; var key; var params = this.getParams();
  for (key in params) {
    paramTags += '<param name="' + key + '" value="' + params[key] + '" />';
  }
  return paramTags;
}
com.deconcept.FlashObject.prototype.getVariablePairs = function() {
  var variablePairs = new Array();
  var key;
  var variables = this.getVariables();
  for (key in variables) {
    variablePairs.push(key + "=" +  variables[key]);
  }
  return variablePairs;
}
com.deconcept.FlashObject.prototype.getHTML = function() {
  var flashHTML = "";
  if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
    if (this.getAttribute("doExpressInstall")) { this.addVariable("MMplayerType", "PlugIn"); }
    flashHTML += '<embed type="application/x-shockwave-flash" src="' +  this.getAttribute('swf') + '" width="' +  this.getAttribute('width') + '" height="' +  this.getAttribute('height') + '" id="' +  this.getAttribute('id') + '" name="' +  this.getAttribute('id') + '"';
    var params = this.getParams();
    for (var key in params) { flashHTML += ' ' +  key + '="' +  params[key] + '"'; }
    pairs = this.getVariablePairs().join("&");
    if (pairs.length > 0) { flashHTML += ' flashvars="' +  pairs + '"'; }
    flashHTML += '></embed>';
  } else { // PC IE
    if (this.getAttribute("doExpressInstall")) { this.addVariable("MMplayerType", "ActiveX"); }
    flashHTML += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' +  this.getAttribute('width') + '" height="' +  this.getAttribute('height') + '" id="' +  this.getAttribute('id') + '">';
    flashHTML += '<param name="movie" value="' + this.getAttribute('swf') + '" />';
    var tags = this.getParamTags();
    if (tags.length > 0) { flashHTML += tags; }
    var pairs = this.getVariablePairs().join("&");
    if (pairs.length > 0) { flashHTML += '<param name="flashvars" value="' +  pairs + '" />'; }
    flashHTML += '</object>';
  }
  return flashHTML;
}
com.deconcept.FlashObject.prototype.write = function(elementId) {
  if (this.skipDetect || this.getAttribute('doExpressInstall') || com.deconcept.FlashObjectUtil.getPlayerVersion().versionIsValid(this.getAttribute('version'))) {
    if (document.getElementById) {
      if (this.getAttribute('doExpressInstall')) {
        this.addVariable("MMredirectURL", escape(window.location));
        document.title = document.title.slice(0, 47) + " - Flash Player Installation";
        this.addVariable("MMdoctitle", document.title);
      }
      document.getElementById(elementId).innerHTML = this.getHTML();
    }
  } else {
    if (this.getAttribute('redirectUrl') != "") {
      document.location.replace(this.getAttribute('redirectUrl'));
    }
  }
}
/* ---- detection functions ---- */
com.deconcept.FlashObjectUtil.getPlayerVersion = function() {
  var PlayerVersion = new com.deconcept.PlayerVersion(0, 0, 0);
  if (navigator.plugins && navigator.mimeTypes.length) {
    var x = navigator.plugins["Shockwave Flash"];
    if (x && x.description) {
      PlayerVersion = new com.deconcept.PlayerVersion(x.description.replace(/([a-z]|[A-Z]|\s) + /, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
    }
  } else if (window.ActiveXObject) {
    try {
      var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
      PlayerVersion = new com.deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
    } catch (e) {}
  }
  return PlayerVersion;
}
com.deconcept.PlayerVersion = function(arrVersion) {
  this.major = parseInt(arrVersion[0]) || 0;
  this.minor = parseInt(arrVersion[1]) || 0;
  this.rev = parseInt(arrVersion[2]) || 0;
}
com.deconcept.PlayerVersion.prototype.versionIsValid = function(fv) {
  if (this.major < fv.major) return false;
  if (this.major > fv.major) return true;
  if (this.minor < fv.minor) return false;
  if (this.minor > fv.minor) return true;
  if (this.rev < fv.rev) return false;
  return true;
}
/* ---- get value of query string param ---- */
com.deconcept.util.getRequestParameter = function(param) {
  var q = document.location.search || document.location.href.hash;
  if (q) {
    var startIndex = q.indexOf(param + "=");
    var endIndex = (q.indexOf("&", startIndex) > -1) ? q.indexOf("&", startIndex) : q.length;
    if (q.length > 1 && startIndex > -1) {
      return q.substring(q.indexOf("=", startIndex) + 1, endIndex);
    }
  }
  return "";
}
/* add Array.push if needed (ie5) */
if (Array.prototype.push == null) {
  Array.prototype.push = function(item) { this[this.length] = item; return this.length; }
}
/* add some aliases for ease of use / backwards compatibility */
var getQueryParamValue = com.deconcept.util.getRequestParameter;
var FlashObject = com.deconcept.FlashObject;
var weekend = [0, 6];
var weekendColor = "#e0e0e0";
var fontface = "Verdana";
var fontsize = 2;
var gNow = new Date();
var ggWinCal;
isNav = (navigator.appName.indexOf("Netscape") != -1) ? true : false;
isIE = (navigator.appName.indexOf("Microsoft") != -1) ? true : false;
Calendar.Months = ["January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"];
// Non-Leap year Month days..
Calendar.DOMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
// Leap year Month days..
Calendar.lDOMonth = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
function Calendar(p_item, p_WinCal, p_month, p_year, p_format) {
  if ((p_month == null) && (p_year == null))  return;
  if (p_WinCal == null)
  this.gWinCal = ggWinCal;
  else
  this.gWinCal = p_WinCal;
  if (p_month == null) {
    this.gMonthName = null;
    this.gMonth = null;
    this.gYearly = true;
  } else {
    this.gMonthName = Calendar.get_month(p_month);
    this.gMonth = new Number(p_month);
    this.gYearly = false;
  }
  this.gYear = p_year;
  this.gFormat = p_format;
  this.gBGColor = "white";
  this.gFGColor = "black";
  this.gTextColor = "black";
  this.gHeaderColor = "black";
  this.gReturnItem = p_item;
}
Calendar.get_month = Calendar_get_month;
Calendar.get_daysofmonth = Calendar_get_daysofmonth;
Calendar.calc_month_year = Calendar_calc_month_year;
Calendar.print = Calendar_print;
function Calendar_get_month(monthNo) {
  return Calendar.Months[monthNo];
}
function Calendar_get_daysofmonth(monthNo, p_year) {
  /*
  Check for leap year ..
  1.Years evenly divisible by four are normally leap years, except for...
  2.Years also evenly divisible by 100 are not leap years, except for...
  3.Years also evenly divisible by 400 are leap years.
  */
  if ((p_year % 4) == 0) {
    if ((p_year % 100) == 0 && (p_year % 400) != 0)
    return Calendar.DOMonth[monthNo];
    return Calendar.lDOMonth[monthNo];
  } else
  return Calendar.DOMonth[monthNo];
}
function Calendar_calc_month_year(p_Month, p_Year, incr) {
  /*
  Will return an 1-D array with 1st element being the calculated month
  and second being the calculated year
  after applying the month increment/decrement as specified by 'incr' parameter.
  'incr' will normally have 1/-1 to navigate thru the months.
  */
  var ret_arr = new Array();
  if (incr == -1) {
    // B A C K W A R D
    if (p_Month == 0) {
      ret_arr[0] = 11;
      ret_arr[1] = parseInt(p_Year) - 1;
    }
    else {
      ret_arr[0] = parseInt(p_Month) - 1;
      ret_arr[1] = parseInt(p_Year);
    }
  } else if (incr == 1) {
    // F O R W A R D
    if (p_Month == 11) {
      ret_arr[0] = 0;
      ret_arr[1] = parseInt(p_Year) + 1;
    }
    else {
      ret_arr[0] = parseInt(p_Month) + 1;
      ret_arr[1] = parseInt(p_Year);
    }
  }
  return ret_arr;
}
function Calendar_print() {
  ggWinCal.print();
}
function Calendar_calc_month_year(p_Month, p_Year, incr) {
  /*
  Will return an 1-D array with 1st element being the calculated month
  and second being the calculated year
  after applying the month increment/decrement as specified by 'incr' parameter.
  'incr' will normally have 1/-1 to navigate thru the months.
  */
  var ret_arr = new Array();
  if (incr == -1) {
    // B A C K W A R D
    if (p_Month == 0) {
      ret_arr[0] = 11;
      ret_arr[1] = parseInt(p_Year) - 1;
    }
    else {
      ret_arr[0] = parseInt(p_Month) - 1;
      ret_arr[1] = parseInt(p_Year);
    }
  } else if (incr == 1) {
    // F O R W A R D
    if (p_Month == 11) {
      ret_arr[0] = 0;
      ret_arr[1] = parseInt(p_Year) + 1;
    }
    else {
      ret_arr[0] = parseInt(p_Month) + 1;
      ret_arr[1] = parseInt(p_Year);
    }
  }
  return ret_arr;
}
// This is for compatibility with Navigator 3, we have to create and discard one object before the prototype object exists.
new Calendar();
Calendar.prototype.getMonthlyCalendarCode = function() {
  var vCode = "";
  var vHeader_Code = "";
  var vData_Code = "";
  // Begin Table Drawing code here..
  vCode = vCode + "<TABLE BORDER=1 BGCOLOR=\"" + this.gBGColor + "\">";
  vHeader_Code = this.cal_header();
  vData_Code = this.cal_data();
  vCode = vCode + vHeader_Code + vData_Code;
  vCode = vCode + "</TABLE>";
  return vCode;
}
Calendar.prototype.show = function() {
  var vCode = "";
  this.gWinCal.document.open();
  // Setup the page...
  this.wwrite("<html>");
  this.wwrite("<head><title>Calendar</title>");
  this.wwrite("</head>");
  this.wwrite("<body " +
  "link=\"" + this.gLinkColor + "\" " +
  "vlink=\"" + this.gLinkColor + "\" " +
  "alink=\"" + this.gLinkColor + "\" " +
  "text=\"" + this.gTextColor + "\">");
  this.wwriteA("<FONT FACE='" + fontface + "' SIZE=2><B>");
  this.wwriteA(this.gMonthName + " " + this.gYear);
  this.wwriteA("</B><BR>");
  // Show navigation buttons
  var prevMMYYYY = Calendar.calc_month_year(this.gMonth, this.gYear, -1);
  var prevMM = prevMMYYYY[0];
  var prevYYYY = prevMMYYYY[1];
  var nextMMYYYY = Calendar.calc_month_year(this.gMonth, this.gYear, 1);
  var nextMM = nextMMYYYY[0];
  var nextYYYY = nextMMYYYY[1];
  this.wwrite("<TABLE WIDTH='100%' BORDER=1 CELLSPACING=0 CELLPADDING=0 BGCOLOR='#e0e0e0'><TR><TD ALIGN=center>");
  this.wwrite("[<A HREF=\"" +
  "javascript:window.opener.Build(" +
  "'" + this.gReturnItem + "', '" + this.gMonth + "', '" + (parseInt(this.gYear)-1) + "', '" + this.gFormat + "'" +
  ");" +
  "\"><<<\/A>]</TD><TD ALIGN=center>");
  this.wwrite("[<A HREF=\"" +
  "javascript:window.opener.Build(" +
  "'" + this.gReturnItem + "', '" + prevMM + "', '" + prevYYYY + "', '" + this.gFormat + "'" +
  ");" +
  "\"><<\/A>]</TD><TD ALIGN=center>");
  this.wwrite("[<A HREF=\"javascript:window.print();\">Print</A>]</TD><TD ALIGN=center>");
  this.wwrite("[<A HREF=\"" +
  "javascript:window.opener.Build(" +
  "'" + this.gReturnItem + "', '" + nextMM + "', '" + nextYYYY + "', '" + this.gFormat + "'" +
  ");" +
  "\">><\/A>]</TD><TD ALIGN=center>");
  this.wwrite("[<A HREF=\"" +
  "javascript:window.opener.Build(" +
  "'" + this.gReturnItem + "', '" + this.gMonth + "', '" + (parseInt(this.gYear) + 1) + "', '" + this.gFormat + "'" +
  ");" +
  "\">>><\/A>]</TD></TR></TABLE><BR>");
  // Get the complete calendar code for the month..
  vCode = this.getMonthlyCalendarCode();
  this.wwrite(vCode);
  this.wwrite("</font></body></html>");
  this.gWinCal.document.close();
}
Calendar.prototype.showY = function() {
  var vCode = "";
  var i;
  var vr, vc, vx, vy;    // Row, Column, X-coord, Y-coord
  var vxf = 285;      // X-Factor
  var vyf = 200;      // Y-Factor
  var vxm = 10;      // X-margin
  var vym;        // Y-margin
  if (isIE)  vym = 75;
  else if (isNav)  vym = 25;
  this.gWinCal.document.open();
  this.wwrite("<html>");
  this.wwrite("<head><title>Calendar</title>");
  this.wwrite("<style type='text/css'>\n<!--");
  for (i=0; i<12; i++) {
    vc = i % 3;
    if (i>=0 && i<= 2)  vr = 0;
    if (i>=3 && i<= 5)  vr = 1;
    if (i>=6 && i<= 8)  vr = 2;
    if (i>=9 && i<= 11)  vr = 3;
    vx = parseInt(vxf * vc) + vxm;
    vy = parseInt(vyf * vr) + vym;
    this.wwrite(".lclass" + i + " {position:absolute;top:" + vy + ";left:" + vx + ";}");
  }
  this.wwrite("-->\n</style>");
  this.wwrite("</head>");
  this.wwrite("<body " +
  "link=\"" + this.gLinkColor + "\" " +
  "vlink=\"" + this.gLinkColor + "\" " +
  "alink=\"" + this.gLinkColor + "\" " +
  "text=\"" + this.gTextColor + "\">");
  this.wwrite("<FONT FACE='" + fontface + "' SIZE=2><B>");
  this.wwrite("Year : " + this.gYear);
  this.wwrite("</B><BR>");
  // Show navigation buttons
  var prevYYYY = parseInt(this.gYear) - 1;
  var nextYYYY = parseInt(this.gYear) + 1;
  this.wwrite("<TABLE WIDTH='100%' BORDER=1 CELLSPACING=0 CELLPADDING=0 BGCOLOR='#e0e0e0'><TR><TD ALIGN=center>");
  this.wwrite("[<A HREF=\"" +
  "javascript:window.opener.Build(" +
  "'" + this.gReturnItem + "', null, '" + prevYYYY + "', '" + this.gFormat + "'" +
  ");" +
  "\" alt='Prev Year'><<<\/A>]</TD><TD ALIGN=center>");
  this.wwrite("[<A HREF=\"javascript:window.print();\">Print</A>]</TD><TD ALIGN=center>");
  this.wwrite("[<A HREF=\"" +
  "javascript:window.opener.Build(" +
  "'" + this.gReturnItem + "', null, '" + nextYYYY + "', '" + this.gFormat + "'" +
  ");" +
  "\">>><\/A>]</TD></TR></TABLE><BR>");
  // Get the complete calendar code for each month..
  var j;
  for (i=11; i >= 0; i--) {
    if (isIE)
    this.wwrite("<DIV ID=\"layer" + i + "\" CLASS=\"lclass" + i + "\">");
    else if (isNav)
    this.wwrite("<LAYER ID=\"layer" + i + "\" CLASS=\"lclass" + i + "\">");
    this.gMonth = i;
    this.gMonthName = Calendar.get_month(this.gMonth);
    vCode = this.getMonthlyCalendarCode();
    this.wwrite(this.gMonthName + "/" + this.gYear + "<BR>");
    this.wwrite(vCode);
    if (isIE)
    this.wwrite("</DIV>");
    else if (isNav)
    this.wwrite("</LAYER>");
  }
  this.wwrite("</font><BR></body></html>");
  this.gWinCal.document.close();
}
Calendar.prototype.wwrite = function(wtext) {
  this.gWinCal.document.writeln(wtext);
}
Calendar.prototype.wwriteA = function(wtext) {
  this.gWinCal.document.write(wtext);
}
Calendar.prototype.cal_header = function() {
  var vCode = "";
  vCode = vCode + "<TR>";
  vCode = vCode + "<TD WIDTH='14%'><FONT SIZE='2' FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Sun</B></FONT></TD>";
  vCode = vCode + "<TD WIDTH='14%'><FONT SIZE='2' FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Mon</B></FONT></TD>";
  vCode = vCode + "<TD WIDTH='14%'><FONT SIZE='2' FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Tue</B></FONT></TD>";
  vCode = vCode + "<TD WIDTH='14%'><FONT SIZE='2' FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Wed</B></FONT></TD>";
  vCode = vCode + "<TD WIDTH='14%'><FONT SIZE='2' FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Thu</B></FONT></TD>";
  vCode = vCode + "<TD WIDTH='14%'><FONT SIZE='2' FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Fri</B></FONT></TD>";
  vCode = vCode + "<TD WIDTH='16%'><FONT SIZE='2' FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Sat</B></FONT></TD>";
  vCode = vCode + "</TR>";
  return vCode;
}
Calendar.prototype.cal_data = function() {
  var vDate = new Date();
  vDate.setDate(1);
  vDate.setMonth(this.gMonth);
  vDate.setFullYear(this.gYear);
  var vFirstDay=vDate.getDay();
  var vDay=1;
  var vLastDay=Calendar.get_daysofmonth(this.gMonth, this.gYear);
  var vOnLastDay=0;
  var vCode = "";
  /*
  Get day for the 1st of the requested month/year..
  Place as many blank cells before the 1st day of the month as necessary.
  */
  vCode = vCode + "<TR>";
  for (i=0; i<vFirstDay; i++) {
    vCode = vCode + "<TD WIDTH='14%'" + this.write_weekend_string(i) + "><FONT SIZE='2' FACE='" + fontface + "'> </FONT></TD>";
  }
  // Write rest of the 1st week
  for (j=vFirstDay; j<7; j++) {
    vCode = vCode + "<TD WIDTH='14%'" + this.write_weekend_string(j) + "><FONT SIZE='2' FACE='" + fontface + "'>" +
    "<A HREF='#' " +
    "onClick=\"self.opener.document." + this.gReturnItem + ".value='" +
    this.format_data(vDay) +
    "';window.close();\">" +
    this.format_day(vDay) +
    "</A>" +
    "</FONT></TD>";
    vDay=vDay + 1;
  }
  vCode = vCode + "</TR>";
  // Write the rest of the weeks
  for (k=2; k<7; k++) {
    vCode = vCode + "<TR>";
    for (j=0; j<7; j++) {
      vCode = vCode + "<TD WIDTH='14%'" + this.write_weekend_string(j) + "><FONT SIZE='2' FACE='" + fontface + "'>" +
      "<A HREF='#' " +
      "onClick=\"self.opener.document." + this.gReturnItem + ".value='" +
      this.format_data(vDay) +
      "';window.close();\">" +
      this.format_day(vDay) +
      "</A>" +
      "</FONT></TD>";
      vDay=vDay + 1;
      if (vDay > vLastDay) {
        vOnLastDay = 1;
        break;
      }
    }
    if (j == 6)
    vCode = vCode + "</TR>";
    if (vOnLastDay == 1)
    break;
  }
  // Fill up the rest of last week with proper blanks, so that we get proper square blocks
  for (m = 1; m < (7 - j); m++) {
    if (this.gYearly)
    vCode = vCode + "<TD WIDTH='14%'" + this.write_weekend_string(j + m) +
    "><FONT SIZE='2' FACE='" + fontface + "' COLOR='gray'> </FONT></TD>";
    else
    vCode = vCode + "<TD WIDTH='14%'" + this.write_weekend_string(j + m) +
    "><FONT SIZE='2' FACE='" + fontface + "' COLOR='gray'>" + m + "</FONT></TD>";
  }
  return vCode;
}
Calendar.prototype.format_day = function(vday) {
  var vNowDay = gNow.getDate();
  var vNowMonth = gNow.getMonth();
  var vNowYear = gNow.getFullYear();
  if (vday == vNowDay && this.gMonth == vNowMonth && this.gYear == vNowYear)
  return ("<FONT COLOR=\"RED\"><B>" + vday + "</B></FONT>");
  else
  return (vday);
}
Calendar.prototype.write_weekend_string = function(vday) {
  var i;
  // Return special formatting for the weekend day.
  for (i = 0; i < weekend.length; i++) {
    if (vday == weekend[i])
    return (" BGCOLOR=\"" + weekendColor + "\"");
  }
  return "";
}
Calendar.prototype.format_data = function(p_day) {
  var vData;
  var vMonth = 1 + this.gMonth;
  vMonth = (vMonth.toString().length < 2) ? "0" + vMonth : vMonth;
  var vMon = Calendar.get_month(this.gMonth).substr(0, 3).toUpperCase();
  var vFMon = Calendar.get_month(this.gMonth).toUpperCase();
  var vY4 = new String(this.gYear);
  var vY2 = new String(this.gYear.substr(2, 2));
  var vDD = (p_day.toString().length < 2) ? "0" + p_day : p_day;
  switch (this.gFormat) {
    case "MM\/DD\/YYYY" :
    vData = vMonth + "\/" + vDD + "\/" + vY4;
    break;
    case "MM\/DD\/YY" :
    vData = vMonth + "\/" + vDD + "\/" + vY2;
    break;
    case "MM-DD-YYYY" :
    vData = vMonth + "-" + vDD + "-" + vY4;
    break;
    case "YYYY-MM-DD" :
    vData = vY4 + "-" + vMonth + "-" + vDD;
    break;
    case "MM-DD-YY" :
    vData = vMonth + "-" + vDD + "-" + vY2;
    break;
    case "DD\/MON\/YYYY" :
    vData = vDD + "\/" + vMon + "\/" + vY4;
    break;
    case "DD\/MON\/YY" :
    vData = vDD + "\/" + vMon + "\/" + vY2;
    break;
    case "DD-MON-YYYY" :
    vData = vDD + "-" + vMon + "-" + vY4;
    break;
    case "DD-MON-YY" :
    vData = vDD + "-" + vMon + "-" + vY2;
    break;
    case "DD\/MONTH\/YYYY" :
    vData = vDD + "\/" + vFMon + "\/" + vY4;
    break;
    case "DD\/MONTH\/YY" :
    vData = vDD + "\/" + vFMon + "\/" + vY2;
    break;
    case "DD-MONTH-YYYY" :
    vData = vDD + "-" + vFMon + "-" + vY4;
    break;
    case "DD-MONTH-YY" :
    vData = vDD + "-" + vFMon + "-" + vY2;
    break;
    case "DD\/MM\/YYYY" :
    vData = vDD + "\/" + vMonth + "\/" + vY4;
    break;
    case "DD\/MM\/YY" :
    vData = vDD + "\/" + vMonth + "\/" + vY2;
    break;
    case "DD-MM-YYYY" :
    vData = vDD + "-" + vMonth + "-" + vY4;
    break;
    case "DD-MM-YY" :
    vData = vDD + "-" + vMonth + "-" + vY2;
    break;
    default :
    vData = vMonth + "\/" + vDD + "\/" + vY4;
  }
  return vData;
}
function Build(p_item, p_month, p_year, p_format) {
  var p_WinCal = ggWinCal;
  gCal = new Calendar(p_item, p_WinCal, p_month, p_year, p_format);
  // Customize your Calendar here..
  gCal.gBGColor="white";
  gCal.gLinkColor="black";
  gCal.gTextColor="black";
  gCal.gHeaderColor="darkgreen";
  // Choose appropriate show function
  if (gCal.gYearly)  gCal.showY();
  else  gCal.show();
}
function show_calendar() {
  /*
  p_month : 0-11 for Jan-Dec; 12 for All Months.
  p_year  : 4-digit year
  p_format: Date format (mm/dd/yyyy, dd/mm/yy, ...)
  p_item  : Return Item.
  */
  p_item = arguments[0];
  if (arguments[1] == null)
  p_month = new String(gNow.getMonth());
  else
  p_month = arguments[1];
  if (arguments[2] == "" || arguments[2] == null)
  p_year = new String(gNow.getFullYear().toString());
  else
  p_year = arguments[2];
  if (arguments[3] == null)
  p_format = "YYYY-MM-DD";
  else
  p_format = arguments[3];
  vWinCal = window.open("", "Calendar",
  "width=250, height=250, status=no, resizable=no, top=200, left=200");
  vWinCal.opener = self;
  ggWinCal = vWinCal;
  Build(p_item, p_month, p_year, p_format);
}
/*
Yearly Calendar Code Starts here
*/
function show_yearly_calendar(p_item, p_year, p_format) {
  // Load the defaults..
  if (p_year == null || p_year == "")
  p_year = new String(gNow.getFullYear().toString());
  if (p_format == null || p_format == "")
  p_format = "MM/DD/YYYY";
  var vWinCal = window.open("", "Calendar", "scrollbars=yes");
  vWinCal.opener = self;
  ggWinCal = vWinCal;
  Build(p_item, null, p_year, p_format);
}
/**
/ new member advertising
*/
/*
Pleas leave this notice.
DHTML tip message version 1.5.4 copyright Essam Gamal 2003
Home Page: (http://migoicons.tripod.com)
Email: (migoicons@hotmail.com)
Updated on :7/30/2003
*/
var MI_IE=MI_IE4=MI_NN4=MI_ONN=MI_NN=MI_pSub=MI_sNav=0;mig_dNav()
var Style=[], Text=[], Count=0, move=0, fl=0, isOK=1, hs, e_d, tb, w=window, PX=(MI_pSub)?"px":""
var d_r=(MI_IE&&document.compatMode == "CSS1Compat")? "document.documentElement":"document.body"
var ww=w.innerWidth
var wh=w.innerHeight
var sbw=MI_ONN? 15:0
function mig_hand() {
  if (MI_sNav) {
    w.onresize=mig_re
    document.onmousemove=mig_mo
    if (MI_NN4) document.captureEvents(Event.MOUSEMOVE)
  }
}
function mig_dNav() {
  var ua=navigator.userAgent.toLowerCase()
  MI_pSub=navigator.productSub
  MI_OPR=ua.indexOf("opera")>-1?parseInt(ua.substring(ua.indexOf("opera") + 6, ua.length)):0
  MI_IE=document.all&&!MI_OPR?parseFloat(ua.substring(ua.indexOf("msie") + 5, ua.length)):0
  MI_IE4=parseInt(MI_IE) == 4
  MI_NN4=navigator.appName.toLowerCase() == "netscape"&&!document.getElementById
  MI_NN=MI_NN4||document.getElementById&&!document.all
  MI_ONN=MI_NN4||MI_pSub<20020823
  MI_sNav=MI_NN||MI_IE||MI_OPR>=7
}
function mig_cssf() {
  if (MI_IE>=5.5&&FiltersEnabled) {fl=1
  var d=" progid:DXImageTransform.Microsoft."
  mig_layCss().filter="revealTrans()" + d + "Fade(Overlap=1.00 enabled=0)" + d + "Inset(a   SAzenabled=0)" + d + "Iris(irisstyle=PLUS, motion=in enabled=0)" + d + "Iris(irisstyle=PLUS, motion=out enabled=0)" + d + "Iris(irisstyle=DIAMOND, motion=in enabled=0)" + d + "Iris(irisstyle=DIAMOND, motion=out enabled=0)" + d + "Iris(irisstyle=CROSS, motion=in enabled=0)" + d + "Iris(irisstyle=CROSS, motion=out enabled=0)" + d + "Iris(irisstyle=STAR, motion=in enabled=0)" + d + "Iris(irisstyle=STAR, motion=out enabled=0)" + d + "RadialWipe(wipestyle=CLOCK enabled=0)" + d + "RadialWipe(wipestyle=WEDGE enabled=0)" + d + "RadialWipe(wipestyle=RADIAL enabled=0)" + d + "Pixelate(MaxSquare=35, enabled=0)" + d + "Slide(slidestyle=HIDE, Bands=25 enabled=0)" + d + "Slide(slidestyle=PUSH, Bands=25 enabled=0)" + d + "Slide(slidestyle=SWAP, Bands=25 enabled=0)" + d + "Spiral(GridSizeX=16, GridSizeY=16 enabled=0)" + d + "Stretch(stretchstyle=HIDE enabled=0)" + d + "Stretch(stretchstyle=PUSH enabled=0)" + d + "Stretch(stretchstyle=SPIN enabled=0)" + d + "Wheel(spokes=16 enabled=0)" + d + "GradientWipe(GradientSize=1.00, wipestyle=0, motion=forward enabled=0)" + d + "GradientWipe(GradientSize=1.00, wipestyle=0, motion=reverse enabled=0)" + d + "GradientWipe(GradientSize=1.00, wipestyle=1, motion=forward enabled=0)" + d + "GradientWipe(GradientSize=1.00, wipestyle=1, motion=reverse enabled=0)" + d + "Zigzag(GridSizeX=8, GridSizeY=8 enabled=0)" + d + "Alpha(enabled=0)" + d + "Dropshadow(OffX=3, OffY=3, Positive=true, enabled=0)" + d + "Shadow(strength=3, direction=135, enabled=0)"
  }
}
function stm(head, ts) {
  var s = new Array();
  s = ["#324D78", "#9BBAE8", "", "center", "arial", 2, "black", "white", "", "", "",,,, 1, "#9BBAE8", 2,,,,, "", 1,,,]
  if (MI_sNav&&isOK) {
    if (document.onmousemove!=mig_mo||w.onresize!=mig_re) mig_hand()
    if (fl&&s[17]>-1&&s[18]>0)mig_layCss().visibility="hidden"
    var ab="";var ap=""
    var titCol=s[0]?"COLOR='" + s[0] + "'":""
    var titBgCol=s[1]&&!s[2]?"BGCOLOR='" + s[1] + "'":""
    var titBgImg=s[2]?"BACKGROUND='" + s[2] + "'":""
    var titTxtAli=s[3]?"ALIGN='" + s[3] + "'":""
    var txtCol=s[6]?"COLOR='" + s[6] + "'":""
    var txtBgCol=s[7]&&!s[8]?"BGCOLOR='" + s[7] + "'":""
    var txtBgImg=s[8]?"BACKGROUND='" + s[8] + "'":""
    var txtTxtAli=s[9]?"ALIGN='" + s[9] + "'":""
    var tipHeight=s[13]? "HEIGHT='" + s[13] + "'":""
    var brdCol=s[15]? "BGCOLOR='" + s[15] + "'":""
    if (!s[4])s[4]="Verdana, Arial, Helvetica"
    if (!s[5])s[5]=1
    if (!s[10])s[10]="Verdana, Arial, Helvetica"
    if (!s[11])s[11]=1
    if (!s[12])s[12]=200
    if (!s[14])s[14]=0
    if (!s[16])s[16]=0
    if (!s[24])s[24]=10
    if (!s[25])s[25]=10
    hs=s[22]
    if (MI_pSub == 20001108) {
      if (s[14])ab="STYLE='border:" + s[14] + "px solid" + " " + s[15] + "'";
      ap="STYLE='padding:" + s[16] + "px " + s[16] + "px " + s[16] + "px " + s[16] + "px';"}
      var title= 'well'||hs == 3?"<TABLE WIDTH='100%' BORDER='0' CELLPADDING='2' CELLSPACING='0' " + titBgCol + " " + titBgImg + " ><TR><TD nowrap " + titTxtAli + "><FONT SIZE='" + s[5] + "' FACE='" + s[4] + "' " + titCol + "><B>" + head + "</B></FONT></TD>" + closeLink + "</TR></TABLE>":"";
      var txt="<TABLE " + ab + " class='pop_dialog_table' style='width:200px;' WIDTH='" + s[12] + "' BORDER='0' CELLSPACING='0' CELLPADDING='0'><tr><td class='pop_topleft'></td><td class='pop_top'></td><td class='pop_topright'></td></tr><tr><TR><td class='pop_side'></td><TD>" + title + "<TABLE WIDTH='100%' " + tipHeight + " BORDER='0' CELLPADDING='4' CELLSPACING='0' " + txtBgCol + " " + txtBgImg + "><TR><TD " + txtTxtAli + " " + ap + " VALIGN='top'><FONT SIZE='" + s[11] + "' FACE='" + s[10] + "' " + txtCol + ">" + ts + "</FONT></TD></TR></TABLE></TD><td class='pop_side'></td></TR><tr><td class='pop_bottomleft'></td><td class='pop_bottom'></td><td class='pop_bottomright'></td></tr></TABLE>"
      mig_wlay(txt)
      tb={trans:s[17], dur:s[18], opac:s[19], st:s[20], sc:s[21], pos:s[23], xpos:s[24], ypos:s[25]}
      if (MI_IE4)mig_layCss().width=s[12]
      e_d=mig_ed()
      Count=0
      move=1
  }
}
function mig_mo(e) {
  if (move) {
    var X=0, Y=0, s_d=mig_scd(), w_d=mig_wd()
    var mx=MI_NN?e.pageX:MI_IE4?event.x:event.x + s_d[0]
    var my=MI_NN?e.pageY:MI_IE4?event.y:event.y + s_d[1]
    if (MI_IE4)e_d=mig_ed()
    switch(tb.pos) {
      case 1:X=mx-e_d[0]-tb.xpos + 6;Y=my + tb.ypos;break
      case 2:X=mx-(e_d[0]/2);Y=my + tb.ypos;break
      case 3:X=tb.xpos + s_d[0];Y=tb.ypos + s_d[1];break
      case 4:X=tb.xpos;Y=tb.ypos;break
      default:X=mx + tb.xpos;Y=my + tb.ypos}
      if (w_d[0] + s_d[0]<e_d[0] + X + sbw)X=w_d[0] + s_d[0]-e_d[0]-sbw
      if (w_d[1] + s_d[1]<e_d[1] + Y + sbw) {if (tb.pos>2)Y=w_d[1] + s_d[1]-e_d[1]-sbw;else Y=my-e_d[1]}
      if (X<s_d[0])X=s_d[0]
      with(mig_layCss()) {left=X + PX;top=Y + PX}
      mig_dis()
  }
}
function mig_dis() {
  Count++
  if (Count == 1) {
    if (fl) {
      if (tb.trans == 51)tb.trans=parseInt(Math.random()*50)
      var at=tb.trans>-1&&tb.trans<24&&tb.dur>0
      var af=tb.trans>23&&tb.trans<51&&tb.dur>0
      var t=mig_lay().filters[af?tb.trans-23:0]
      for (var p=28;p<31;p++) {mig_lay().filters[p].enabled=0}
      for (var s=0;s<28;s++) {if (mig_lay().filters[s].status)mig_lay().filters[s].stop()}
      for (var e=1;e<3;e++) {if (tb.sc&&tb.st == e) {with(mig_lay().filters[28 + e]) {enabled=1;color=tb.sc}}}
      if (tb.opac>0&&tb.opac<100) {with(mig_lay().filters[28]) {enabled=1;opacity=tb.opac}}
      if (at||af) {if (at)mig_lay().filters[0].transition=tb.trans;t.duration=tb.dur;t.apply()}}
      mig_layCss().visibility=MI_NN4?"show":"visible"
      if (fl&&(at||af))t.play()
      if (hs>0&&hs<4)move=0
  }
}
function mig_layCss() {
  return MI_NN4?mig_lay():mig_lay().style
}
function mig_lay() {
  with(document)return MI_NN4?layers[TipId]:MI_IE4?all[TipId]:getElementById(TipId)
}
function mig_wlay(txt) {
  if (MI_NN4) {
    with(mig_lay().document) {
      open();
      write(txt);
      close()
    }
  } else mig_lay().innerHTML=txt
}
function mig_hide(C) {
  if (!MI_NN4||MI_NN4&&C)mig_wlay("");
  with(mig_layCss()) {
    visibility=MI_NN4?"hide":"hidden";
    left=0;
    top=-800
  }
}
function mig_scd() {return [parseInt(MI_IE?eval(d_r).scrollLeft:w.pageXOffset), parseInt(MI_IE?eval(d_r).scrollTop:w.pageYOffset)]}
function mig_re() {var w_d=mig_wd();if (MI_NN4&&(w_d[0]-ww||w_d[1]-wh))location.reload();else if (hs == 3||hs == 2) mig_hide(1)}
function mig_wd() {return [parseInt(MI_ONN?w.innerWidth:eval(d_r).clientWidth), parseInt(MI_ONN?w.innerHeight:eval(d_r).clientHeight)]}
function mig_ed() {return [parseInt(MI_NN4?mig_lay().clip.width:mig_lay().offsetWidth) + 3, parseInt(MI_NN4?mig_lay().clip.height:mig_lay().offsetHeight) + 5]}
function htm() {
  if (MI_sNav&&isOK) {
    if (hs!=4) {
      move=0;
      if (hs!=3&&hs!=2) {
        mig_hide(1)
      }
    }
  }
}
function checkCompanyOptions() {
  if (document.getElementById("rep_freelancer").checked) {
    var show_publicly = document.getElementById("show_publicly");
    show_publicly.checked = true;
    $("#row_contact_name").hide();
    $("#row_company_name").hide();
    $("#company_name_msg").hide();
  } else {
    $("#row_contact_name").show();
    $("#row_company_name").show();
    $("#company_name_msg").show();
  }
}
/*
function wait() {
timer="htm();";
var timing = setTimeout(timer, 1500);
}
function end_wait() {
clearTimeout(timing);
}
*/
function mig_clay() {
  if (!mig_lay()) {
    isOK = 0;
  } else {
    mig_hand();
    mig_cssf();
  }
}
function doWish(wish_step) {
  if (wish_step == "wish_comment") {
    var wish_code = document.getElementById("wish_code").value;
    var wish_comment1 = document.getElementById("wish_comment1").value;
    var wish_comment2 = document.getElementById("wish_comment2").value;
    var url = "/ajax/ajax_wish.php?action=do_wish_comments" + "&wish_code=" + wish_code + "&wish_comment1=" + wish_comment1 + "&wish_comment2=" + wish_comment2;
    $.ajax({
      type: "POST",
      url: url,
      success: function (value) {
        $("#ajax_output_wish_form").html(value);
      }
    });
    var el = document.getElementById("ajax_output_wish_form");
    el.innerHTML = '<img src="/images/wikiwords/loading.gif"> Please wait...<br>' + el.innerHTML;
  }
  else if (wish_step == "wish") {
    var form_wish_id = document.getElementById("form_wish_id").value;
    var wish = document.getElementById("wish").value;
    var public_wish = "n";
    if (document.getElementById("public_wish").checked == true) public_wish = "y";
    var url = "/ajax/ajax_wish.php?action=do_wish" + "&form_wish_id=" + form_wish_id + "&wish=" + wish + "&public_wish=" + public_wish;
    $.ajax({
      type: "POST",
      url: url,
      success: function (value) {
        $("#ajax_output_wish_form").html(value);
      }
    });
    var el = document.getElementById("ajax_output_wish_form");
    el.innerHTML = '<img src="/images/wikiwords/loading.gif"> Please wait...<br>' + el.innerHTML;
  }
  else {
    var url = "/ajax/ajax_wish.php?action=reload_wish_form";
    $.ajax({
      type: "POST",
      url: url,
      success: function (value) {
        $("#ajax_output_wish_form").html(value);
      }
    });
    var el = document.getElementById("ajax_output_wish_form");
    el.innerHTML = '<img src="/images/wikiwords/loading.gif"> Please wait...<br>' + el.innerHTML;
  }
}
function getAnotherWish() {
  var current_wish = document.getElementById("current_wish").value;
  var url = "/ajax/ajax_wish.php?action=get_another_wish" + "&current_wish=" + current_wish;
  $.ajax({
    type: "POST",
    url: url,
    success: function (value) {
      $("#wish_box").html(value);
    }
  });
  var el = document.getElementById("wish_messages");
  el.innerHTML = '<img src="/images/wikiwords/loading.gif"> Loading wish, please wait...' + el.innerHTML;
}
function findPos(obj) {
  var curleft = curtop = 0;
  if (obj.offsetParent) {
    curleft = obj.offsetLeft
    curtop = obj.offsetTop
    while (obj = obj.offsetParent) {
      curleft += obj.offsetLeft
      curtop += obj.offsetTop
    }
  }
  return [curleft, curtop];
}
HelpBubbleTimeout = null;
function showHelpBubble(content, reference_obj, time_open) {
  var coords = findPos(document.getElementById(reference_obj));
  var content_div = document.getElementById(content);
  var HelpBubble;
  hideHelpBubble();
  HelpBubble = document.createElement('div');
  HelpBubble.setAttribute("id", 'helpbubble');
  HelpBubble.style.left = (coords[0] + document.getElementById(reference_obj).offsetWidth-20) + "px";
  HelpBubble.style.top = (coords[1] + 10) + "px";
  HelpBubble.style.position = "absolute";
  HelpBubble.style.display = "none";
  HelpBubble.innerHTML += '<img src="http://www.proz.com/images/start_balloon_help.gif">';
  HelpBubble.innerHTML += '<div class="gb_ul"><div class="gb_ur"><div class="gb_brd_top"></div></div></div>';
  HelpBubble.innerHTML += '<div class="gb_inner">' + content_div.innerHTML + '</div>';
  HelpBubble.innerHTML += '<div class="gb_inner"><p align="right"><input type="button" onClick="javascript: hideHelpBubble();" value="Close"></p></div>';
  HelpBubble.innerHTML += '<div class="gb_bl"><div class="gb_br"><div class="gb_brd_bot"></div></div></div>';
  document.body.appendChild(HelpBubble);
  $(HelpBubble).fadeIn();
  if (time_open > 0) HelpBubbleTimeout = window.setTimeout("hideHelpBubble()", time_open);
}
function hideHelpBubble() {
  if (HelpBubbleTimeout != null) window.clearTimeout(HelpBubbleTimeout);
  if (document.getElementById('helpbubble') != null) {
    var helpBubble = document.getElementById('helpbubble');
    $(helpBubble).fadeOut('', function () {$(helpBubble).remove();});
  }
}
function showHelpBubbleConn(content, reference_obj, time_open) {
  var coords = findPos(document.getElementById(reference_obj));
  var content_div = document.getElementById(content);
  var HelpBubble;
  hideHelpBubble();
  HelpBubble = document.createElement('div');
  HelpBubble.setAttribute("id", 'helpbubble');
  HelpBubble.style.left = (coords[0] + document.getElementById(reference_obj).offsetWidth-40) + "px";
  HelpBubble.style.top = (coords[1] + 15) + "px";
  HelpBubble.style.position = "absolute";
  HelpBubble.style.display = "none";
  HelpBubble.innerHTML += '<table cellspacing="0" cellpadding="0" border="0">';
  HelpBubble.innerHTML += '<tr>';
  HelpBubble.innerHTML += '<td width="5"><img border="0" src="/images/ffffde-tl.gif"></td>';
  HelpBubble.innerHTML += '<td><img border="0" src="/images/ffffde-tpl.gif"></td>';
  HelpBubble.innerHTML += '<td><img border="0" src="/images/ffffde-t.gif"></td>';
  HelpBubble.innerHTML += '<td><img border="0" src="/images/ffffde-t.gif"></td>';
  HelpBubble.innerHTML += '<td><img border="0" src="/images/ffffde-t.gif"></td>';
  HelpBubble.innerHTML += '<td><img border="0" src="/images/ffffde-tr.gif"></td>';
  HelpBubble.innerHTML += '</tr>';
  HelpBubble.innerHTML += '</table>';
  HelpBubble.innerHTML += '<table cellspacing="0" cellpadding="0" border="0" bgcolor="#ffffde">';
  HelpBubble.innerHTML += '<tr>';
  HelpBubble.innerHTML += '<td td width="5"><img border="0" src="/images/ffffde-l.gif"></td>';
  HelpBubble.innerHTML += '<td bgcolor="#ffffde"></td>';
  HelpBubble.innerHTML += '<td colspan="3" width="50">';
  HelpBubble.innerHTML += '<div width="5" style="background-color:#ffffde;" align="right"><img src="/images/a-bt-x.gif" onClick="javascript: hideHelpBubble();" value="Close">&nbsp;</div><div style="background-color:#ffffde;">' + content_div.innerHTML + '<br></div>';
  HelpBubble.innerHTML += '</td>';
  HelpBubble.innerHTML += '<td width="5"><img border="0" src="/images/ffffde-r.gif"></td>';
  HelpBubble.innerHTML += '</tr>';
  HelpBubble.innerHTML += '</table>';
  HelpBubble.innerHTML += '<table cellspacing="0" cellpadding="0" border="0">';
  HelpBubble.innerHTML += '<tr>';
  HelpBubble.innerHTML += '<td><img border="0" src="/images/ffffde-bl.gif"></td>';
  HelpBubble.innerHTML += '<td><img border="0" src="/images/ffffde-b.gif"></td>';
  HelpBubble.innerHTML += '<td><img border="0" src="/images/ffffde-b.gif"></td>';
  HelpBubble.innerHTML += '<td><img border="0" src="/images/ffffde-b.gif"></td>';
  HelpBubble.innerHTML += '<td><img border="0" src="/images/ffffde-b.gif"></td>';
  HelpBubble.innerHTML += '<td><img border="0" src="/images/ffffde-br.gif"></td>';
  HelpBubble.innerHTML += '</tr>';
  HelpBubble.innerHTML += '</table>';
  document.body.appendChild(HelpBubble);
  $(HelpBubble).fadeIn();
  if (time_open > 0) HelpBubbleTimeout = window.setTimeout("hideHelpBubble()", time_open);
}
var userAgent = navigator.userAgent.toLowerCase(); // http://dixso.net/jquery/jquery-browser-detect-1-1/
jQuery.browser = {
  version: (userAgent.match( /.+(?:rv|it|ra|ie|me)[\/: ]([\d.]+)/ ) || [])[1],
  chrome: /chrome/.test( userAgent ),
  safari: /webkit/.test( userAgent ) && !/chrome/.test( userAgent ),
  opera: /opera/.test( userAgent ),
  msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
  mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
}
jQuery.fn.center = function (absolute) { // http://andreaslagerkvist.com/jquery/center/
  return this.each(function () {
    var t = jQuery(this);
    t.css({
      position: absolute ? 'absolute' : 'fixed',
      left: '50%',
      top: '50%',
      zIndex: '99'
    }).css({
      marginLeft: '-' + (t.outerWidth() / 2) + 'px',
      marginTop: '-' + (t.outerHeight() / 2) + 'px'
    });
    if (absolute) {
      t.css({
        marginTop: parseInt(t.css('marginTop'), 10) + jQuery(window).scrollTop(),
        marginLeft: parseInt(t.css('marginLeft'), 10) + jQuery(window).scrollLeft()
      });
    }
  });
}
function checkURL(link) { // based on jquery validation regex, but now you can use it anywhere.
  return /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&\'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&\'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&\'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&\'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&\'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(link);
}
function toggleExpandableSection(id, method) {
  if (method == undefined || method == "") method = "show";
  if ($("#" + id + "_bd").is(":hidden")) {
    $("#" + id + "_hd").addClass("hd-up");
    if (method == "show") $("#" + id + "_bd").show("fast");
    else $("#" + id + "_bd").slideDown("fast");
  } else {
    $("#" + id + "_hd").removeClass("hd-up");
    if (method == "show") $("#" + id + "_bd").hide("fast");
    else $("#" + id + "_bd").slideUp("fast");
  }
}
/*------------------
  http://blog.amnuts.com/2009/02/17/text-box-hint-values-with-jquery/
------------------*/
(function($) {
  $.fn.textboxhint = function(userOptions) {
    var options = $.extend({}, $.fn.textboxhint.defaults, userOptions);
    return $(this).filter(':text, textarea').each(function() {
      if ($(this).val() == '') {
        $(this).focus(function() {
          if ($(this).attr('typedValue') == '') {
            $(this).removeClass(options.classname).val('');
          }
        }).blur(function() {
          $(this).attr('typedValue', $(this).val());
          if ($(this).val() == '') {
            $(this).addClass(options.classname).val(options.hint);
          }
        }).blur();
      }
    });
  }
  $.fn.textboxhint.defaults = {
    hint: 'Please enter a value',
    classname: 'light-grey'
  }
})(jQuery);
function machineTranslationOption(text_to_translate, target_id, target_lang) {
 if ($("#translation_target_" + target_id).css("display") == "none" && $("#translation_target_" + target_id).text().length == 0) {
    $("#translation_target_" + target_id).html("<img id=loading_img src=/images/wikiwords/loading.gif>");
    $.translate(text_to_translate, target_lang,  { complete:
      function (translation) {
        if (translation) {
          $("#translation_target_" + target_id).html(translation);
        } else $("#translation_target_" + target_id).html("");
      }
    });
  }
  $("#translation_target_" + target_id).toggle();
}
/*---------------------
  Help divs that popup when you
  click on the form elements.
---------------------*/
$(document).ready (function() {
  $(".help-form :input").click(function() {
    var id = $(this).attr("class");
    // Start out by hiding all help divs
    $(".help-div").hide();
    // If there is a help section for this element
    if ($("#" + id + "-help").length > 0) {
      $("#" + id + "-help").show();
    }
  });
  $(".help-form .flq").click(function() {
    var id = $(this).attr("id");
    var temp_length = id.length;
    // Shave the last character off.
    id = id.slice(0, temp_length-2);
    // Start out by hiding all help divs
    $(".help-div").hide();
    // If there is a help section for this element
    if ($("#" + id + "-help").length > 0) {
      $("#" + id + "-help").toggle();
    }
  });
  $(".float-question").click(function() {
    var id = $(this).attr("id");
    var temp_length = id.length;
    // Shave the last character off.
    id = id.slice(0, temp_length-2);
    // Start out by hiding all help divs
    $(".help-div").hide();
    // If there is a help section for this element
    if ($("#"+id+"-help").length > 0) {
      $("#"+id+"-help").toggle();
    }
  });
});
