function registerEvent(s,evt,f) {
if(s) {
var e=evt.replace(/^on(.+)/,"$1");
if(s.attachEvent) s.attachEvent("on"+e,f);
else if(s.addEventListener) s.addEventListener(e,f,false);
else alert("Your browser does not support the features required to use LawDepot. Please consider upgrading to a modern browser such as Mozilla Firefox (getfirefox.com)");
}}
function rE(s,evt,f) { registerEvent(s,evt,f); }
function fE(s,evt){
if(s){
var ev=evt.replace(/^on(.+)/,"$1");
if(document.createEvent){
var e=document.createEvent('Events');
e.initEvent(ev,true,false);
s.dispatchEvent(e);
}else if(document.createEventObject){
s.fireEvent('on'+ev);
}}}
function registerOnLoadScript(script) { registerEvent(window,"onload",script);}
function incompatible() {
   var msg = "Your web browser may not be capable of accessing our site. Please go to our contact page and contact our technical support.";
	for(var i=0; i<arguments.length; i++){
		msg+="\n\n"+arguments[i];
	}
   alert(msg);
}
function getForm(formName) {
   if(document.forms) {
      var f;
      f=document.forms[formName];
      if(f) return f;
      else {
         incompatible("Please contact us and let us know what page you were on and let us know that \"the form '"+formName+"' was not found\"");
         return false;
      }
   } else {
      alert("We are sorry. Your Browser may not support the features needed to use this site properly.");
      return false;
   }
}
function getFormObject(formName,objectId) {
   var obj;
   obj=getForm(formName);
   if(obj) obj=obj.elements[objectId];
   if(obj) return obj;
   else {
      if(arguments.length == 2 || arguments[2]){
         incompatible("Please contact us and let us know what page you were on and that we \"could not find '"+objectId+"' in the form '"+formName+"'\"");
      }
      return false;
   }
}
function gFO(formName, objectID) {
   if(arguments.length > 2){
      return getFormObject(formName, objectID, arguments[2]);
   }
   else{
      return getFormObject(formName, objectID);
   }
}
function rV(formName, radioGroup){
   var group=gFO(formName, radioGroup);
   for (var i=0;i<group.length;++i){
      if(group[i].checked){
         return group[i].value;
      }
   }
   return null;
}
function getObject(objectId) {
   var obj = false;
   if(document.getElementById) {
      obj=document.getElementById(objectId);
   } else {
      incompatible();
   }
   return obj;
}
function gI(id) { return getObject(id);}
function setVis(objectId,visible,display) {
   if(typeof(display) == "undefined"){
      display = "block";
   }
   if(document.getElementById && document.getElementById(objectId)) {
      if(visible && display == "inlineBlock"){
         try{
            document.getElementById(objectId).style.display = "-moz-inline-box";
         }
         catch(Exception){
            document.getElementById(objectId).style.display = "inline-block";
         }
      }
      else if(visible && display == "tableCell"){
         try{
            document.getElementById(objectId).style.display = "table-cell";
         }
         catch(Exception){
            document.getElementById(objectId).style.display = "block";
         }
      }
      else{
         document.getElementById(objectId).style.display = visible?display:"none";
      }
   } else if (document.all && document.all(objectId)) {
      if(visible && display == "inlineBlock"){
         try{
            document.all(objectId).style.display = "-moz-inline-box";
         }
         catch(Exception){
            document.all(objectId).style.display = "inline-block";
         }
      }
      else if(visible && display == "tableCell"){
         try{
            document.all(objectId).style.display = "block";
         }
         catch(Exception){
            document.all(objectId).style.display = "block";
         }
      }
      else{
         document.all(objectId).style.display = visible?display:"none";
      }
   } else {
      incompatible();
   }
}
function sD(objectId,visible,display) {setVis(objectId,visible,display);}
function getVis(objectId) {
   return getStyleObject(objectId).display != "none";
}
function getStyleObject(objectId) {
   if(document.getElementById && document.getElementById(objectId)) {
      return document.getElementById(objectId).style;
   } else if (document.all && document.all(objectId)) {
      return document.all(objectId).style;
   } else {
      incompatible();
      return false;
   }
}
function setStatus(msg) {
   window.status = msg;
}
function bookmark() {
   window.external.AddFavorite(window.location.href,window.document.title);
}
function cf(action,newWindow) {
   var f = document.createElement("FORM");
   f.method="POST";
   f.action=action;
   if(newWindow)
   	f.target='_blank';
   document.body.appendChild(f);
   return f;
}
function cfi(parentForm,name,value) {
   var i = document.createElement("INPUT");
   i.type="hidden";
   i.name=name;
   i.value=value;
   parentForm.appendChild(i);
}
function postLink(a) {
   var SID;
   postTo(a.href,{"SID":SID});
}
function postTo(url) {
   var f = cf(url,arguments[2]);
   var v = arguments[1];
   for(var n in v) cfi(f,n,v[n]);
   f.submit();
   return false;
}
function addSiteCatalystEvent(eventName){
   if(typeof(s) != 'undefined'){
      if(s.events.indexOf(eventName)<0){
         if(s.events != ""){
            s.events += ",";
         }
         s.events+=eventName;
         s.t();
      }
   }
}
function setFocusValidator(source) {
   ctl = gI(source.controltovalidate);
   if(ctl != null){
      if(!isInput(ctl)){
         ctl = findFirstInput(ctl.childNodes);
      }

      if(ctl != null && ctl.focus){
         try{
         ctl.focus();
         }catch(e){
         }
      }
   }
}
function isInput(ctl){
   return ctl.tagName == "INPUT" || ctl.tagName == "TEXTAREA" || ctl.tagName == "SELECT";
}
function findFirstInput(nodes){
   for (i = 0; i < nodes.length; i++) {
      if(isInput(nodes[i])){
         return nodes[i];
      }
      ctl = findFirstInput(nodes[i].childNodes);
      if(ctl != null){
         return ctl;
      }
   }
   return null;
}
function stringToDate(dateString) {
	var retDate = new Date();
	var month, day, year;
	month = dateString.substring(0,2);
	day = dateString.substring(3,5);
	year = dateString.substring(6);
	retDate.setFullYear(year,month-1,day);
	return retDate;
}
// This script from The JavaScript Source : http://javascript.internet.com
// Created by Oded Arbel : http://geek.co.il/wp
Date.MONTH_NAMES=["January","February","March","April","May","June","July","August","September","October","November","December"];
Date.WEEKDAY_NAMES=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
Date.prototype.clone=function(){return new Date(this.getTime());}
Date.prototype.clearTime=function(){
  this.setHours(0);
  this.setMinutes(0);
  this.setSeconds(0);
  this.setMilliseconds(0);
  return this;
}
Date.prototype.lastDay=function(){
  var tempDate=this.clone();
  tempDate.setMonth(tempDate.getMonth()+1);
  tempDate.setDate(0);
  return tempDate.getDate();
}
Date.prototype.getYearDay=function(){
  var today=new Date(this);
  today.setHours(0);
  today.setMinutes(0);
  today.setSeconds(0);
  var tempDate = new Date(today);
  tempDate.setDate(1);
  tempDate.setMonth(0);
  return Math.round((today.getTime()-tempDate.getTime())/86400/1000)+1;
}
Date.prototype.format=function(formatString){
  var out=new String();
  var token="";
  for (var i=0;i<formatString.length;i++) {
  	 if(formatString.charAt(i) == '\\') {
    	out=out.concat(this.getDatePart(token));
	 	out=out.concat(formatString.charAt(i+1));
		i++;
		token="";
	 }
	 else{
		 if (formatString.charAt(i)==token.charAt(0)) {
			token=token.concat(formatString.charAt(i));
			continue;
		 }
  	 
    	out=out.concat(this.getDatePart(token));
 	   token=formatString.charAt(i);
	 }
  }
  return out+this.getDatePart(token);
}
Date.prototype.getDatePart=function (str) {
  switch(str.charAt(0)) {
    case 'y':
      if (str.length>2)return this.getFullYear();
      return this.getFullYear().toString().substring(2);
    case 'd':
      if(str.length<3) return Date.zeroPad(this.getDate(),str.length);
      else if (str.length==3) return this.getShortDOWName();
      else if (str.length>3) return this.getDOWName()
    case 'D':
      return this.getYearDay();
    case 't':
      return this.getHours()>11?"PM":"AM";
    case 'H':
      return Date.zeroPad(this.getHours(),str.length);
    case 'h':;
      return Date.zeroPad(this.get12Hours(),str.length);
    case 'm':
      return Date.zeroPad(this.getMinutes(),2);
    case 's':
      return Date.zeroPad(this.getSeconds(),2);
    case 'S':
      return Date.zeroPad(this.getMilliseconds(),str.length);
    case 'x':
      return this.getTime();
    case 'Z':
      return (this.getTimezoneOffset()/60)+":"+Date.zeroPad(this.getTimezoneOffset()%60,2);
    case 'M':
      if (str.length>3)return this.getFullMonthName();
      if (str.length>2)return this.getShortMonthName();
      return Date.zeroPad(this.getMonth()+1,str.length);
	 case '#':
	 	if(this.getDate() % 10 == 1)
			return 'st';
		else if(this.getDate() % 10 == 2)
			return 'nd';
		else if(this.getDate() % 10 == 3)
			return 'rd';
		else
			return 'th';
    default:
      return str;
  }
}
Date.prototype.getFullMonthName=function(){
  return Date.MONTH_NAMES[this.getMonth()];
}
Date.prototype.getShortMonthName=function(){
  return Date.MONTH_NAMES[this.getMonth()].substring(0,3);
}
Date.prototype.getDOWName=function(){
  return Date.WEEKDAY_NAMES[this.getDay()];
}
Date.prototype.getShortDOWName=function(){
  return Date.WEEKDAY_NAMES[this.getDay()].substring(0,3);
}
Date.prototype.get12Hours=function(){
  return this.getHours()==0?12:(this.getHours()>12?this.getHours()-12:this.getHours());
}
Date.zeroPad=function(num,width){
  num=num.toString();
  while (num.length<width)
  num="0"+num;
  return num;
}
Date.prototype.addDays = function(num){
   return new Date(this.getTime() + num * 1000 * 60 * 60 *24);
}
Date.prototype.addMonths = function(num){
   var t=new Date(this);
   t.setMonth(this.getMonth()+num);
   if (t.getMonth()!=(this.getMonth()+num+12)%12)t.setDate(0);
   return t;
}
Date.prototype.addYears = function(num){
   return this.clone().setYear(this.getFullYear() + num);
}
function gCN(cc){
   return cc;
}
function gRN(cc, rc){
   return rc;
}
function gFJ(cc, rc){
   n = gRN(cc, rc);
   switch (cc.toUpperCase()){
      case "US":
         switch (rc.toUpperCase()){
            case "KY":
            case "MA":
            case "PA":
            case "PR":
            case "VA":
               return "The Commonwealth of " + n;
            case "DC":
               return "The " + n;
            case "GU":
               return "The Territory of " + n;
            case "VI":
               return "The Territory of the " + n;
            default:
               return "The State of " + n;
         }
      case "CA":
          switch (rc.toUpperCase()){
              case "YT":
              case "NT":
                  return "The " + n;
              case "NU":
                  return "The Territory of " + n;
              default:
                  return "The Province of " + n;
          }
      case "AU":
          switch (rc.toUpperCase())
          {
              case "ACT":
              case "NT":
                  return "The " + n;
              default:
                  return "The State of " + n;
          }
      case "GB":
          return "The Country of " + n;
      default:
          return "The State of " + n;
   }
}
function gJ(cc, rc)
{
    switch (cc.toUpperCase())
    {
        case "US":
            switch (rc.toUpperCase())
            {
                case "KY":
                case "MA":
                case "PA":
                case "PR":
                case "VA":
                    return "Commonwealth";
                case "DC":
                    return "District";
                case "GU":
                case "VI":
                    return "Territory";
                default:
                    return "State";
            }
        case "CA":
            switch (rc.toUpperCase())
            {
                case "YT":
                case "NT":
                case "NU":
                    return "Territory";
                default:
                    return "Province";
            }
        case "AU":
            switch (rc.toUpperCase())
            {
                case "ACT":
                case "NT":
                    return "Territory";
                default:
                    return "State";
            }
        case "GB":
            return "Country";
        default:
            return "State";
    }
}
function gS(cc, rc){
   var val = "Share";
   if (cc == "US"){
      switch (rc){
         case "DE":
         case "KS":
         case "MA":
            val = "Stock";
            break;
      }
   }
   return val;
}
function r(c){
   var d="inline";
   if(arguments.length > 1) d = arguments[1];
   if(c.style.display!="none"){
      c.style.display="none";
      c.style.display=d;
   }
}
function sLD(id,v,fn,g){
   sD(id, v, "inline");
   sD(id+"_lb", v, "inline");
   var o=gI(id);
   if(!v && o.checked){
      var gr=gFO(fn,g);
      for (var i=0;i<gr.length;++i){
         if(gr[i].style.display!="none"){
            gr[i].checked=true;
            fE(gr[i], 'click');
            break;
         }
      }
   }
}
function sDD(arr, id){
   var o=gI(id);
   var v=o.value;
   o.options.length=0;
   var i=0;
   for(var item in arr){
      if(arr[item]["visible"]){
         var opt = new Option(arr[item]["text"], arr[item]["value"]);
         opt.id = item;
         o.options[i] = opt;
         ++i;
         if(arr[item]["value"] == v){
            o.value = v;
         }
      }
   }
   fE(gI(id), 'change');
}
function sMM(s,max,min){
   var val = s.value;
   s.options.length=0;
   for(var i=min;i<=max;++i){
      s.options[i-min] = new Option(i.toString(), i.toString());
   }
   if(val < min){
      s.value = min;
      fE(s, 'change');
   }
   else if (val > max){
      s.value = max;
      fE(s, 'change');
   }
   else{
      s.value = val;
   }
}
var nums=new Array("one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen");
var numsOrdinal=new Array("first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eighth", "ninth", "tenth", "eleventh", "twelfth", "thirteenth", "fourteenth", "fifteenth", "sixteenth", "seventeenth", "eighteenth", "nineteenth");
var numsTens=new Array("twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety");
var numsTensOrdinal = new Array("twentieth", "thirtieth", "fortieth", "fiftieth", "sixtieth", "seventieth", "eightieth", "ninetieth");
function nTS(num, zeroAsBlank, ordinal){
   var numsInner;
	if(num == 0){
		return (zeroAsBlank?"":(ordinal? "zeroth":"none"));
	}
	else if(num > 0 && num < 20){
      if(ordinal){
         numsInner = numsOrdinal;
      }
      else{
         numsInner = nums;
      }
		return numsInner[num-1];
	}
	else if(num >= 20 && num < 100){
      if(ordinal && num % 10 == 0){
         numsInner = numsTensOrdinal;
      }
      else{
         numsInner = numsTens;
      }
		return numsInner[Math.floor(num/10)-2] + " " + nTS(num % 10, true, ordinal);
	}
	else if(num >= 100 && num < 1000){
      if(ordinal && num % 100 == 0){
         return nTS(Math.floor(num/100), false, false) + " hundredth";
      }
      else{
   		return nTS(Math.floor(num/100), false, false) + " hundred " + nTS(num % 100, true, ordinal);
      }
	}
	else if(num >= 1000 && num < 1000000){
      if(ordinal && num % 1000 == 0){
         return nTS(Math.floor(num/1000), false, false) + " thousandth";
      }
      else{
		   return nTS(Math.floor(num/1000), false) + " thousand " + nTS(num % 1000, true, ordinal);
      }
	}
	else if(num >= 1000000 && num < 1000000000){
      if(ordinal && num % 1000000 == 0){
         return nTS(Math.floor(num/1000000), false, false) + " millionth";
      }
      else{
		   return nTS(Math.floor(num/1000000), false) + " million " + nTS(num % 1000000, true, ordinal);
      }
	}
	else if(num >= 1000000000){
      if(ordinal && num % 1000000000 == 0){
         return nTS(Math.floor(num/1000000000), false, false) + " billionth";
      }
      else{
		   return nTS(Math.floor(num/1000000000), false) + " billion " + nTS(num % 1000000000, true, ordinal);
      }
	}
	else{
		return "";
	}
}
function bSL(sep, finalSep){
   var strings=new Array();
   for(var i=2; i<arguments.length;++i){ 
      if(arguments[i] != ""){
         strings.push(arguments[i]);
      }
   }
   if(strings.length==1) return strings[0];
   var retVal="";
   for(var i=0;i<strings.length;++i){
      if(i==strings.length-1) retVal += finalSep;
      else if(i>0) retVal += sep;
      retVal += strings[i];
   }
   return retVal;
}
function eP(str){
   if(str.length < 1 || str.substring(str.length - 1) != ".") return str + ".";
   return str;
}
var vals=new Array();
var focusVal=false;
function iV(f){
   vals.push(f);
}
var __oldAnswers=false;
function cV(){
   var valid=true;
   focusVal=true;
   for(var i=0; i<vals.length; ++i){
      if(!vals[i]()){
         valid=false;
         focusVal=false;
      }
   }
   focusVal=false;
   if(valid && __oldAnswers){
      return confirm('This will overwrite the answers stored for the old version.');
   }
   return valid;
}
function scrollToEl(el){
   var pos = GetElementPosition(el);
   window.scrollTo(pos.x, pos.y);
}
function getStyle(el,styleProp){
	if (el.currentStyle)
		var y = el.currentStyle[styleProp];
	else if (window.getComputedStyle)
		var y = document.defaultView.getComputedStyle(el,null).getPropertyValue(styleProp);
	return y;
}
function isV(el){
   var p=gI(el).parentNode;
   do {
      var display=getStyle(p, 'display');
      if(display != null && display.toLowerCase()=='none') return false;
      p=p.parentNode;
   } while(p!=null && p.parentNode != null);
   return true;
}
function fN(num, format){
   return new Number(num).numberFormat(format, null);
}
function r(num, decimals){
   var change = Math.pow(10, decimals);
   return Math.round(num * change)/change;
}
function log(x){
   if(arguments.length == 1){
      return Math.log(x);
   }
   else{
      return Math.log(x)/Math.log(arguments[1]);
   }
}

/* TimeSpan Object Definition */

function DaysInMonth(year,month) {
var dd = new Date(year, month+1, 0);
return dd.getDate();
}
function DateDiff(date1,date2){
   var years = 0, months = 0, weeks = 0, days = 0;
   var sooner, later;
   var isNegative;

   if (date1 > date2){
      isNegative = false;
      later = date1;
      sooner = date2;
   }
   else
   {
      isNegative = true;
      later = date2;
      sooner = date1;
   }
   years = later.getFullYear() - sooner.getFullYear();
   months = later.getMonth() - sooner.getMonth();
   days = later.getDate() - sooner.getDate();
   if (days < 0){
      --months;
      days += DaysInMonth(sooner.getFullYear(), sooner.getMonth());
   }
   if (months < 0){
      --years;
      months += 12;
   }
   if (days > 7){
      weeks = Math.floor(days / 7);
      days -= weeks * 7;
   }
   var totalDays = (later.getTime() - sooner.getTime())/(1000*60*60*24);
   if (isNegative){
      days *= -1;
      weeks *= -1;
      months *= -1;
      years *= -1;
      totalDays *= -1;
   }
   return new TimeSpan(days, weeks, months, years, totalDays);
}
function TimeSpan(days, weeks, months, years, totalDays){
   var cDays=days;
   var cWeeks=weeks;
   var cMonths=months;
   var cYears=years;
   var cTotalDays=totalDays;

   this.GetDays=function(){return cDays;};
   this.SetDays=function(newDays){cDays=newDays;};
   this.GetWeeks=function(){return cWeeks;};
   this.SetWeeks=function(newWeeks){cWeeks=newWeeks;};
   this.GetMonths=function(){return cMonths;};
   this.SetMonths=function(newWeeks){cMonths=newWeeks;};
   this.GetYears=function(){return cYears;};
   this.SetYears=function(newYears){cYears=newYears;};
   this.GetTotalDays=function(){if(cTotalDays != 0) return cTotalDays; else return this.GetYears()*365+this.GetMonths()*30+this.GetWeeks()*7+this.GetDays();};
   this.SetTotalDays=function(newTotalDays){cTotals=newTotalDays;};
}
TimeSpan.prototype.GetPart=function(part){switch(part){case "days":return this.GetDays();case "weeks":return this.GetWeeks();case "months":return this.GetMonths();case "years":return this.GetYears();case "totalDays":return this.GetTotalDays();default:return 0;}};
TimeSpan.MINIMUM=new TimeSpan(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);
TimeSpan.MAXIMUM=new TimeSpan(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY);
TimeSpan.AddToDate=function(d,ts){return new Date(d.addDays(ts.GetDays()+7*ts.GetWeeks()).addMonths(ts.GetMonths()).addYears(ts.GetYears()));};
TimeSpan.SubtractFromDate=function(d,ts){return new Date(d.addDays(-ts.GetDays()-7*ts.GetWeeks()).addMonths(-ts.GetMonths()).addYears(-ts.GetYears()));};
TimeSpan.Add=function(ts1,ts2){return new TimeSpan(ts1.GetDays()+ts2.GetDays(),ts1.GetWeeks()+ts2.GetWeeks(),ts1.GetMonths()+ts2.GetMonths(),ts1.GetYears()+ts2.GetYears(),ts1.GetTotalDays()+ts2.GetTotalDays());};
TimeSpan.Subtract=function(ts1,ts2){return new TimeSpan(ts1.GetDays()-ts2.GetDays(),ts1.GetWeeks()-ts2.GetWeeks(),ts1.GetMonths()-ts2.GetMonths(),ts1.GetYears()-ts2.GetYears(),ts1.GetTotalDays()-ts2.GetTotalDays());};
TimeSpan.Multiply=function(ts,num){return new TimeSpan(ts.GetDays()*num,ts.GetWeeks()*num,ts.GetMonths()*num,ts.GetYears()*num,ts.GetTotalDays()*num);};
TimeSpan.Divide=function(ts,num){return new TimeSpan(ts.GetDays()/num,ts.GetWeeks()/num,ts.GetMonths()/num,ts.GetYears()/num,ts.GetTotalDays()/num);};
TimeSpan.Max=function(ts1,ts2){if(ts1.GetTotalDays()>ts.GetTotalDays())return ts1;else return ts2;};
TimeSpan.Min=function(ts1,ts2){if(ts1.GetTotalDays()<ts.GetTotalDays())return ts1;else return ts2;};
TimeSpan.prototype.toString=function(){var str="";if(this.GetYears()!=0){str+=this.GetYears()+" Years";}if(this.GetMonths()!=0){if(str.length>0)str+=", ";str+=this.GetMonths()+" Months";}if(this.GetWeeks()!=0){if(str.length>0)str+=", ";str+=this.GetWeeks()+" Weeks";}if(this.GetDays()!=0){if(str.length>0)str+=", ";str+=this.GetDays()+" Days";str+=", ";str+=this.GetTotalDays()+" Total Days";}return str;};

/* End TimeSpan */

/*
 * Copyright (C) 2006 Baron Schwartz <baron at sequent dot org>
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by the
 * Free Software Foundation, version 2.1.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
 * details.
 *
 * $Revision: 1.3 $
 */

// Abbreviations: LODP = Left Of Decimal Point, RODP = Right Of Decimal Point
Number.formatFunctions = {count:0};

// Constants useful for controlling the format of numbers in special cases.
Number.prototype.NaN         = 'NaN';
Number.prototype.posInfinity = 'Infinity';
Number.prototype.negInfinity = '-Infinity';

Number.prototype.numberFormat = function(format, context) {
    if (isNaN(this) ) {
        return Number.prototype.NaNstring;
    }
    else if (this == +Infinity ) {
        return Number.prototype.posInfinity;
    }
    else if ( this == -Infinity) {
        return Number.prototype.negInfinity;
    }
    else if (Number.formatFunctions[format] == null) {
        Number.createNewFormat(format);
    }
    return this[Number.formatFunctions[format]](context);
}

Number.createNewFormat = function(format) {
    var funcName = "format" + Number.formatFunctions.count++;
    Number.formatFunctions[format] = funcName;
    var code = "Number.prototype." + funcName + " = function(context){\n";

    // Decide whether the function is a terminal or a pos/neg/zero function
    var formats = format.split(";");
    switch (formats.length) {
        case 1:
            code += Number.createTerminalFormat(format);
            break;
        case 2:
            code += "return (this < 0) ? this.numberFormat(\""
                + String.escape(formats[1])
                + "\", 1) : this.numberFormat(\""
                + String.escape(formats[0])
                + "\", 2);";
            break;
        case 3:
            code += "return (this < 0) ? this.numberFormat(\""
                + String.escape(formats[1])
                + "\", 1) : ((this == 0) ? this.numberFormat(\""
                + String.escape(formats[2])
                + "\", 2) : this.numberFormat(\""
                + String.escape(formats[0])
                + "\", 3));";
            break;
        default:
            code += "throw 'Too many semicolons in format string';";
            break;
    }
    eval(code + "}");
}

Number.createTerminalFormat = function(format) {
    // If there is no work to do, just return the literal value
    if (format.length > 0 && format.search(/[0#?]/) == -1) {
        return "return '" + String.escape(format) + "';\n";
    }
    // Negative values are always displayed without a minus sign when section separators are used.
    var code = "var val = (context == null) ? new Number(this) : Math.abs(this);\n";
    var thousands = false;
    var lodp = format;
    var rodp = "";
    var ldigits = 0;
    var rdigits = 0;
    var scidigits = 0;
    var scishowsign = false;
    var sciletter = "";
    // Look for (and remove) scientific notation instructions, which can be anywhere
    m = format.match(/\..*(e)([+-]?)(0+)/i);
    if (m) {
        sciletter = m[1];
        scishowsign = (m[2] == "+");
        scidigits = m[3].length;
        format = format.replace(/(e)([+-]?)(0+)/i, "");
    }
    // Split around the decimal point
    var m = format.match(/^([^.]*)\.(.*)$/);
    if (m) {
        lodp = m[1].replace(/\./g, "");
        rodp = m[2].replace(/\./g, "");
    }
    // Look for %
    if (format.indexOf('%') >= 0) {
        code += "val *= 100;\n";
    }
    // Look for comma-scaling to the left of the decimal point
    m = lodp.match(/(,+)(?:$|[^0#?,])/);
    if (m) {
        code += "val /= " + Math.pow(1000, m[1].length) + "\n;";
    }
    // Look for comma-separators
    if (lodp.search(/[0#?],[0#?]/) >= 0) {
        thousands = true;
    }
    // Nuke any extraneous commas
    if ((m) || thousands) {
        lodp = lodp.replace(/,/g, "");
    }
    // Figure out how many digits to the l/r of the decimal place
    m = lodp.match(/0[0#?]*/);
    if (m) {
        ldigits = m[0].length;
    }
    m = rodp.match(/[0#?]*/);
    if (m) {
        rdigits = m[0].length;
    }
    // Scientific notation takes precedence over rounding etc
    if (scidigits > 0) {
        code += "var sci = Number.toScientific(val,"
            + ldigits + ", " + rdigits + ", " + scidigits + ", " + scishowsign + ");\n"
            + "var arr = [sci.l, sci.r];\n";
    }
    else {
        // If there is no decimal point, round to nearest integer, AWAY from zero
        if (format.indexOf('.') < 0) {
            code += "val = (val > 0) ? Math.ceil(val) : Math.floor(val);\n";
        }
        // Numbers are rounded to the correct number of digits to the right of the decimal
        code += "var arr = val.round(" + rdigits + ").toFixed(" + rdigits + ").split('.');\n";
        // There are at least "ldigits" digits to the left of the decimal, so add zeros if needed.
        code += "arr[0] = (val < 0 ? '-' : '') + String.leftPad((val < 0 ? arr[0].substring(1) : arr[0]), "
            + ldigits + ", '0');\n";
    }
    // Add thousands separators
    if (thousands) {
        code += "arr[0] = Number.addSeparators(arr[0]);\n";
    }
    // Insert the digits into the formatting string.  On the LHS, extra digits are copied
    // into the result.  On the RHS, rounding has chopped them off.
    code += "arr[0] = Number.injectIntoFormat(arr[0].reverse(), '"
        + String.escape(lodp.reverse()) + "', true).reverse();\n";
    if (rdigits > 0) {
        code += "arr[1] = Number.injectIntoFormat(arr[1], '" + String.escape(rodp) + "', false);\n";
    }
    if (scidigits > 0) {
        code += "arr[1] = arr[1].replace(/(\\d{" + rdigits + "})/, '$1" + sciletter + "' + sci.s);\n";
    }
    return code + "return arr.join('.');\n";
}

Number.toScientific = function(val, ldigits, rdigits, scidigits, showsign) {
    var result = {l:"", r:"", s:""};
    var ex = "";
    // Make ldigits + rdigits significant figures
    var before = Math.abs(val).toFixed(ldigits + rdigits + 1).trim('0');
    // Move the decimal point to the right of all digits we want to keep,
    // and round the resulting value off
    var after = Math.round(new Number(before.replace(".", "").replace(
        new RegExp("(\\d{" + (ldigits + rdigits) + "})(.*)"), "$1.$2"))).toFixed(0);
    // Place the decimal point in the new string
    if (after.length >= ldigits) {
        after = after.substring(0, ldigits) + "." + after.substring(ldigits);
    }
    else {
        after += '.';
    }
    // Find how much the decimal point moved.  This is #places to LODP in the original
    // number, minus the #places in the new number.  There are no left-padded zeroes in
    // the new number, so the calculation for it is simpler than for the old number.
    result.s = (before.indexOf(".") - before.search(/[1-9]/)) - after.indexOf(".");
    // The exponent is off by 1 when it gets moved to the left.
    if (result.s < 0) {
        result.s++;
    }
    // Split the value around the decimal point and pad the parts appropriately.
    result.l = (val < 0 ? '-' : '') + String.leftPad(after.substring(0, after.indexOf(".")), ldigits, "0");
    result.r = after.substring(after.indexOf(".") + 1);
    if (result.s < 0) {
        ex = "-";
    }
    else if (showsign) {
        ex = "+";
    }
    result.s = ex + String.leftPad(Math.abs(result.s).toFixed(0), scidigits, "0");
    return result;
}

Number.prototype.round = function(decimals) {
    if (decimals > 0) {
        var m = this.toFixed(decimals + 1).match(
            new RegExp("(-?\\d*)\.(\\d{" + decimals + "})(\\d)\\d*$"));
        if (m && m.length) {
            return new Number(m[1] + "." + String.leftPad(Math.round(m[2] + "." + m[3]), decimals, "0"));
        }
    }
    return this;
}

Number.injectIntoFormat = function(val, format, stuffExtras) {
    var i = 0;
    var j = 0;
    var result = "";
    var revneg = val.charAt(val.length - 1) == '-';
    if ( revneg ) {
       val = val.substring(0, val.length - 1);
    }
    while (i < format.length && j < val.length && format.substring(i).search(/[0#?]/) >= 0) {
        if (format.charAt(i).match(/[0#?]/)) {
            // It's a formatting character; copy the corresponding character
            // in the value to the result
            if (val.charAt(j) != '-') {
                result += val.charAt(j);
            }
            else {
                result += "0";
            }
            j++;
        }
        else {
            result += format.charAt(i);
        }
        ++i;
    }
    if ( revneg && j == val.length ) {
        result += '-';
    }
    if (j < val.length) {
        if (stuffExtras) {
            result += val.substring(j);
        }
        if ( revneg ) {
             result += '-';
        }
    }
    if (i < format.length) {
        result += format.substring(i);
    }
    return result.replace(/#/g, "").replace(/\?/g, " ");
}

Number.addSeparators = function(val) {
    return val.reverse().replace(/(\d{3})/g, "$1,").reverse().replace(/^(-)?,/, "$1");
}

String.prototype.reverse = function() {
    var res = "";
    for (var i = this.length; i > 0; --i) {
        res += this.charAt(i - 1);
    }
    return res;
}

String.prototype.trim = function(ch) {
    if (!ch) ch = ' ';
    return this.replace(new RegExp("^" + ch + "+|" + ch + "+$", "g"), "");
}

String.leftPad = function (val, size, ch) {
    var result = new String(val);
    if (ch == null) {
        ch = " ";
    }
    while (result.length < size) {
        result = ch + result;
    }
    return result;
}

String.escape = function(string) {
    return string.replace(/('|\\)/g, "\\$1");
}

if(!Array.indexOf){
	 Array.prototype.indexOf = function(obj){
		  for(var i=0; i<this.length; i++){
				if(this[i]==obj){
					 return i;
				}
		  }
		  return -1;
	 }
}

/**** End Number format stuff ****/
var contentFixed=false;
function fixContent() {
   if(contentFixed) return;
   var ct=gI("contentTop");
   if(ct!=null) return;
   var c=gI("content");
   if(c==null) return;
   var w=gI("wrapper");
   if(w==null) return;
   ct=c;
   ct.id="contentTop";
   c=document.createElement("DIV");
   c.id="content";
   ct.parentNode.insertBefore(c,ct);
   c.parentNode.removeChild(ct);
   c.appendChild(ct);
   var ce=document.createElement("DIV");
   ce.id="contentEnd";
   c.appendChild(ce);
   contentFixed=true;
   var n=gI("navigation");
   if(n==null || (getStyle(n,"display")=="none")) w.className += " noNav";
} //function fixContent()
fixContent();
rE(window,"onload",fixContent);
