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 getCookie(c_name){
   var i,x,y,ARRcookies=document.cookie.split(";");
   for (i=0;i<ARRcookies.length;i++){
      x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
      y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
      x=x.replace(/^\s+|\s+$/g,"");
      if (x==c_name){
         return unescape(y);
      }
   }
}
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 sRV(formName, radioGroup, val, evt){
   var group=gFO(formName, radioGroup);
   for (var i=0;i<group.length;++i){
      group[i].checked = group[i].value == val;
      if(group[i].checked){
         fE(group[i], evt);
      }
   }
}
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";
   }
   var obj;
   if(document.getElementById && document.getElementById(objectId)) {
      obj = document.getElementById(objectId);
   } else if (document.all && document.all(objectId)) {
      obj = document.all(objectId);
   } else {
      incompatible();
      return;
   }
      if(visible && display == "inlineBlock"){
         try{
         obj.style.display = "-moz-inline-box";
         }
         catch(Exception){
         obj.style.display = "inline-block";
         }
      }
      else if(visible && display == "tableCell"){
         try{
         obj.style.display = "table-cell";
         }
         catch(Exception){
         obj.style.display = "block";
         }
      }
      else if(visible && display == "table"){
         try{
         obj.style.display = "table";
         }
         catch(Exception){
         obj.style.display = "block";
         }
      }
      else{
      obj.style.display = visible?display:"none";
      }
   obj = obj.parentNode;
   if(obj.tagName.toLowerCase() == "tr"){
      if(visible){
         try{
            obj.style.display="table-row";
         }
         catch(Exception){
            obj.style.display="block";
         }
      }
      else{
         var hide = true;
         for(var i=0, cell; cell=obj.cells[i]; i++){
            if(cell.style.display != "none"){
               hide = false;
               break;
         }
      }
         if(hide){
            obj.style.display="none";
         }
         }
      }
}
function oe(o1, o2){
   if(typeof(o1) != 'object'){
      return o1 === o2;
   }
   for(var p in o1){
      if(!oe(o1[p], o2[p])){
         return false;
      }
   }
   return true;
}
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);
   retDate.setHours(0,0,0,0);
	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.ldformat=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){
var regions = {
'CA':{'AB':'Alberta','BC':'British Columbia','MB':'Manitoba','NB':'New Brunswick','NF':'Newfoundland and Labrador','NT':'Northwest Territories','NS':'Nova Scotia','NU':'Nunavut','ON':'Ontario','PE':'Prince Edward Island','QC':'Quebec','SK':'Saskatchewan','YT':'Yukon Territory'},
'AU':{'NSW':'New South Wales','SA':'South Australia','QLD':'Queensland','TAS':'Tasmania','VIC':'Victoria','WA':'Western Australia','ACT':'Australian Capital Territory','NT':'Northern Territory','NI':'Norfolk Island','ACI':'Ashmore and Cartier Islands','CI':'Christmas Islands','CCI':'Cocos Islands','CSI':'Coral Sea Islands','HI':'Heard Islands','JB':'Jervis Bay','MU':'McDonald Islands'},
'GB':{'EN':'England','NI':'Northern Ireland','SCT':'Scotland','WAL':'Wales'},
'US':{'sel':'Select the State', 'AL':'Alabama', 'AK':'Alaska', 'AZ':'Arizona', 'AR':'Arkansas', 'CA':'California', 'CO':'Colorado', 'CT':'Connecticut', 'DE':'Delaware', 'DC':'District of Columbia', 'FL':'Florida', 'GA':'Georgia', 'GU':'Guam', 'HI':'Hawaii', 'ID':'Idaho', 'IL':'Illinois', 'IN':'Indiana', 'IA':'Iowa', 'KS':'Kansas', 'KY':'Kentucky', 'LA':'Louisiana', 'ME':'Maine', 'MD':'Maryland', 'MA':'Massachusetts', 'MI':'Michigan', 'MN':'Minnesota', 'MS':'Mississippi', 'MO':'Missouri', 'MT':'Montana', 'NE':'Nebraska', 'NV':'Nevada', 'NH':'New Hampshire', 'NJ':'New Jersey', 'NM':'New Mexico', 'NY':'New York', 'NC':'North Carolina', 'ND':'North Dakota', 'OH':'Ohio', 'OK':'Oklahoma', 'OR':'Oregon', 'PA':'Pennsylvania', 'PR':'Puerto Rico', 'RI':'Rhode Island', 'SC':'South Carolina', 'SD':'South Dakota', 'TN':'Tennessee', 'TX':'Texas', 'VI':'U.S. Virgin Islands', 'UT':'Utah', 'VT':'Vermont', 'VA':'Virginia', 'WA':'Washington', 'WV':'West Virginia', 'WI':'Wisconsin', 'WY':'Wyoming'}};
if(cc in regions) return regions[cc][rc];
else 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 == null || typeof(str) == 'undefined') return '.';
   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(over){
   if(over === undefined){
      over = true;
   }
   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 && over){
      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 fD(date, format){
   if(date != null && typeof(date.format) == "function"){
      return date.ldformat(format);
   }
   return 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 = Math.round(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);
function isOrderOrProductSelectionPage() {
	var url = top.location.href.toLowerCase();
	var d1, d2, d3;
	if((d1 = url.indexOf('dcsmain')) != -1 && 
		(d2 = url.indexOf('dcsdefinitions', d1)) != -1 &&
		(d3 = url.indexOf('order', d2)) != -1 &&
		url.indexOf('xml', d3) != -1) {
		return true;
	}
	if(url.indexOf('/contracts/order') != -1)
		return true;
	return false;
}
function rewriteFooterLinks() {
	if(isOrderOrProductSelectionPage()) {
		var footer = getObject('footer');
		var tags = footer.getElementsByTagName('A');
		for(var i=0; i<tags.length; i++) {
			tags[i].target = '_blank';
		}
	}
}
rE(window, 'onload', rewriteFooterLinks);
var monthArr = new Array( 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 );
function sDFM(monthID, dayID, leap){
   var month = gI(monthID);
   var day = gI(dayID);
   var maxDay = monthArr[month.value-1];
   if(maxDay == 28 && leap){
      maxDay = 29;
   }
   for(var i=day.options.length; i<maxDay; i++){
      day.options[i] = new Option(i+1, i+1);
   }
   for(var i=day.options.length-1; i>=maxDay; i=i-1){
      day.options[i] = null;
   }
}
/* Value Handler */
function ValueHandler(){
   // Array of values. Each name has an object with several properties.
   // Value is the actual value
   // Events is the array of change events for this value. Each change event is an array of the names functions to call when it is triggered. The functions are contained in the UpdateFuncs array.
   // Edited is if the value has changed.
   this.Values = new Object();
   // An array of functions and names associated with them.
   // Also indicates if each function is for a validator or not.
   this.UpdateFuncs = new Object();
   this.VS = function(){
      var size = 0, key;
      for (key in this.Values) {
         if (this.Values.hasOwnProperty(key)) size++;
      }
      return size;
   }
   this.CC = function(){
      for(var n in this.Values){
         this.Values[n].Edited = false;
      }
   }
   this.HC = function(){
      for(var n in this.Values){
         if(this.Values[n].Edited){
            return true;
         }
      }
      return false;
   }
   this.C = function(){
      this.UpdateFuncs = new Object();
      for(var n in this.Values){
         this.Values[n].Events = new Object();
      }
   }
   this.IA = function(){
      for(var n in this.Values){
         for(var e in this.Values[n].Events){
            this.FireChange(n, e);
         }
      }
   }
   this.S = function(name, value, evt){
      this.InitEvent(name, evt);
      if(!oe(this.Values[name].Value, value)){
      this.Values[name].Value = value;
      this.Values[name].Edited = true;
      this.FireChange(name, evt);
   }
   }
   this.G = function(name){
      this.Init(name);
      return this.Values[name].Value;
   }
   this.Init = function(name){
      if(typeof(this.Values[name]) == 'undefined'){
         this.Values[name] = new Object();
         this.Values[name].Edited = false;
         this.Values[name].Events = new Object();
         this.Values[name].Value = "";
      }
   }
   this.InitEvent = function(name, evt){
      this.Init(name);
      if(typeof(evt) != 'undefined' && typeof(this.Values[name].Events[evt.toLowerCase()]) == 'undefined'){
         this.Values[name].Events[evt.toLowerCase()] = new Array();
      }
      }
   this.UA = function(excludeVals){
      if(excludeVals === undefined){
         excludeVals = false;
   }
      for(var n in this.UpdateFuncs){
         if(!excludeVals || !this.UpdateFuncs[n].IsVal){
            this.UpdateFuncs[n].Func();
         }
      }
      }
   this.SF = function(name, func, isVal){
      if(isVal === undefined){
         isVal = false;
   }
      if(!isVal && (typeof(this.UpdateFuncs[name]) == 'undefined' || this.UpdateFuncs[name].Func != func)){
         func();
      }
      this.UpdateFuncs[name] = new Object();
      this.UpdateFuncs[name].IsVal = isVal;
      this.UpdateFuncs[name].Func = func;
   }
   this.R = function(name, funcName, func, evt, isVal){
      this.SF(funcName, func, isVal);
      this.InitEvent(name, evt);
      for(var i = 0; i < this.Values[name].Events[evt.toLowerCase()].length; ++i){
         if(this.Values[name].Events[evt.toLowerCase()][i] == funcName){
            return;
         }
      }
      this.Values[name].Events[evt.toLowerCase()].push(funcName);
   }
   this.FireChange = function(name, evt){
      if(typeof(evt) != 'undefined'){
         for(var i = 0; i < this.Values[name].Events[evt.toLowerCase()].length; ++i){
            this.UpdateFuncs[this.Values[name].Events[evt.toLowerCase()][i]].Func();
         }
      }
      else{
         for(var evnt in this.Values[name].Events){
            if(typeof(this.Values[name].Events[evnt]) != "function"){
               this.FireChange(name, evnt);
            }
         }
      }
   }
}
var vh = new ValueHandler();
/* End Value Handler */
/* Tab Handler */
function TabHandler(){
   this.Info = new Array();
   this.Current = "";
   this.Init = function (name){
      if(typeof(this.Info[name]) == "undefined"){
         this.Info[name] = new Array();
         this.Info[name].tabs = new Array();
         this.Info[name].sections = new Array();
      }
   }
   this.A = function(name, tab, sectionID){
      this.AT(name, tab);
      this.AS(name, sectionID);
   }
   this.AT = function (name, tab){
      this.Init(name);
      for(var i = 0; i < this.Info[name].tabs.length; ++i){
         if(this.Info[name].tabs[i] == tab){
            return;
         }
      }
      this.Info[name].tabs.push(tab);
   }
   this.AS = function (name, sectionID){
      this.Init(name);
      for(var i = 0; i < this.Info[name].sections.length; ++i){
         if(this.Info[name].sections[i] == sectionID){
            return;
         }
      }
      this.Info[name].sections.push(sectionID);
   }
   this.ST = function(name, forcePostBack){
      if(!ajaxInProgress && cV(false)){
         if(forcePostBack === undefined){
            forcePostBack = false;
         }
         for(var i=0; i<this.Info[this.Current].tabs.length; ++i){
            this.Info[this.Current].tabs[i].className=this.Info[this.Current].tabs[i].className.replace( /(?:^|\s)selected(?!\S)/ , '' );
         }
         for(var i=0; i<this.Info[name].tabs.length; ++i){
            this.Info[name].tabs[i].className += " selected";
         }
         var exists = true;
         for(var i=0; i<this.Info[name].sections.length; ++i){
            var temp = gI(this.Info[name].sections[i]);
            if(temp == null){
               exists = false;
            }
         }
         if(exists){
            for(var i=0; i<this.Info[this.Current].sections.length; ++i){
               sD(this.Info[this.Current].sections[i], false);
            }
            for(var i=0; i<this.Info[name].sections.length; ++i){
               sD(this.Info[name].sections[i], true);
            }
            this.Current = name;
            window.location.hash="";
            window.location.hash="questions";
            return forcePostBack;
         }
         else{
            needSave = false;
            var loadingPanel = getLoadingPanel();
            for(var i=0; i<this.Info[this.Current].sections.length; ++i){
               loadingPanel.show(this.Info[this.Current].sections[i]);
            }
            for(var i=0; i<this.Info[this.Current].tabs.length; ++i){
               this.Info[this.Current].tabs[i].parentNode.disabled=true;
            }
         }
         window.location.hash="";
         window.location.hash="questions";
      }
      else{
         return false;
      }
      return true;
   }
   this.SS = function(name){
      needSave = true;
      if(name != this.Current){
         var loadingPanel = getLoadingPanel();
         for(var i=0; i<this.Info[this.Current].sections.length; ++i){
            loadingPanel.hide(this.Info[this.Current].sections[i]);
            sD(this.Info[this.Current].sections[i], false);
         }
         for(var i=0; i<this.Info[this.Current].tabs.length; ++i){
            this.Info[this.Current].tabs[i].parentNode.disabled=false;
         }
         this.Current = name;
      }
   }
}
var th = new TabHandler();
/* End Tab Handler */
/* Load On Demand */
var ajaxMan;
var ajaxInProgress = false;
function getAjaxMan(){
   if(typeof(ajaxMan) == 'string'){
      ajaxMan = $find(ajaxMan);
   }
   return ajaxMan;
}
function getLoadingPanel(){
   return $find(getAjaxMan().get_defaultLoadingPanelID());
}
function AjaxWait(full){
   if(full){
   getLoadingPanel().show('wrapper');
   }
   else{
      getLoadingPanel().show('contentMain');
   }
}
function AjaxRequestStart(){
   vh.C();
   ajaxInProgress = true;
}
function AjaxResponseEnd(){
   getLoadingPanel().hide('wrapper');
   getLoadingPanel().hide('contentMain');
   ajaxInProgress = false;
   needSave=true;
}
function EndRequestHandler(sender, args){
   if(args.get_error() != undefined && args.get_error().httpStatusCode == '500'){
      alert(args.get_error().message);
      args.set_errorHandled(true);
   }
}
/*End Load on Demand*/
var messageDiv;
registerOnLoadScript(function() {
   messageDiv = document.createElement('div');
   messageDiv.style.textAlign = "center";
   document.body.appendChild(messageDiv);
   messageDiv = $(messageDiv);
   messageDiv.dialog({
		autoOpen: false,
		width:280,
		height:120,
		draggable: false,
		resizable: false,
		modal: true,
      dialogClass: 'noTitle',
		close: function(ev, ui) {
			logMyDocsActivity("Parent: Closing dialog (3).");
			invalidateCache(); 
		}
	});
});
function showMessage(message){
   messageDiv.context.innerHTML = '<img src="/common/jquery-ui/css/LawDepot/images/ajax-loader.gif" alt="' + message + '" width="220" height="19" /><br/>' + message;
   messageDiv.dialog('open');
}
function hideMessage(){
   messageDive.dialog('close');
}
/* Read the site.xml config for JavaScript 
 * Author: Chris Poirier
 * Date: October 4, 2011
 */
var __CONFIG;
// Set the configuration
function __setConfig() {
	if(!__CONFIG) {
		var brand = __getBrandCookie();
		if(!brand) brand = '';
		var technology = __getTechnology();
		__readConfig(brand, technology);
	}
}
// Get the brand cookie
function __getBrandCookie() {
	var start = document.cookie.indexOf( "brand=" );
	var len = start + 6;
	if ( ( !start ) && ( 'brand' != document.cookie.substring( 0, 5 ) ) )
	{
		return null;
	}
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ";", len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}
// Get the technology of the page
function __getTechnology() {
	// Check for aspnetForm
	if(document.forms['aspnetForm'])
		return '.NET';
	// Check for __VIEWSTATE
	if(document.forms[0] && document.forms[0].elements['__VIEWSTATE'])
		return '.NET';
	// If aspnetForm and __VIEWSTATE don't exists, then we are on PHP
	return 'PHP';
}
// Read the configuration from site.xml using the given brand and technology
function __readConfig(brand, technology) {
	// Read the XML
	var xmlHTTP;
	if(window.XMLHttpRequest)
		xmlHTTP = new XMLHttpRequest();
	else
		xmlHTTP = new ActiveXObject("Microsoft.XMLHTTP");
	xmlHTTP.open("GET", "/common/xml/site.xml.php", false);
	xmlHTTP.send();
	var xmlDoc = xmlHTTP.responseXML;
	if(xmlDoc.normalize) xmlDoc.normalize();
	var configuration = xmlDoc.getElementsByTagName("configuration")[0];

	// Find the host node
	var hosts = configuration.getElementsByTagName("hosts")[0];
	var host = __getChildElementByAttribute(hosts, 'host', 'name', document.location.hostname);

	if(host != null) {
		// Do not continue if the node is a redirect
		var redirect = host.getElementsByTagName("redirect");
		if(redirect.length == 0) {
			// Read the host configuration
			__CONFIG = {};
			__readConfigSettings(host, brand, technology);

			// Find the family node
			var families = configuration.getElementsByTagName("site_families")[0];
			var family = __getChildElementByAttribute(families, "site_family", "name", __CONFIG["site_family"]);

			// Read the family configuration
			if(family != null)
				__readConfigSettings(family, brand, technology);
		}
	}
}
// Get the child element of the given parent with the given element name
// where the given attribute equals the given value.
function __getChildElementByAttribute(parentElement, elementName, attrName, attrValue) {
	var elements = parentElement.getElementsByTagName(elementName);
	for(var i=0; i<elements.length; i++) {
		if(elements[i].attributes.getNamedItem(attrName).value == attrValue)
			return elements[i];
	}
	return null;
}
// Read the configuration settings from the given parent
function __readConfigSettings(parentElement, brand, technology) {
	var elements = parentElement.getElementsByTagName("*");
	for(var i=0; i<elements.length; i++) {
		if(elements[i].parentNode.nodeName == parentElement.nodeName) {
			// If the element has a technology attribute, check that it contains the current technology
			if(elements[i].attributes.getNamedItem('technology')) {
				var technologies = elements[i].attributes.getNamedItem('technology').value.toUpperCase().split(',');
				var hasTechnology = false;
				for(var j=0; j<technologies.length; j++) {
					if(technologies[j] == technology.toUpperCase()) {
						hasTechnology = true;
						break;
					}
				}
				if(!hasTechnology)
					continue;
			}

			// If the element has a brand attribute, check that it contains the current brand
			if(elements[i].attributes.getNamedItem('brand')) {
				var brands = elements[i].attributes.getNamedItem('brand').value.toLowerCase().split(',');
				var hasBrand = false;
				for(var j=0; j<brands.length; j++) {
					if(brands[j] == brand.toLowerCase()) {
						hasBrand = true;
						break;
					}
				}
				if(!hasBrand)
					continue;
			}

			// If the element has an is_secure attribute, check if we are on https
			if(elements[i].attributes.getNamedItem('is_secure')) {
				var is_https = document.location.protocol == "https:";
				var is_secure = elements[i].attributes.getNamedItem('is_secure').value.toLowerCase() == "true";
				if(is_https && !is_secure)
					continue;
				if(!is_https && is_secure)
					continue;
			}

			// Setup an empty node
			if(elements[i].childNodes.length == 0) {
				__CONFIG[elements[i].nodeName] = '';
			}
			// Read the value of the text node	
			else if(elements[i].childNodes.length == 1) {
				__CONFIG[elements[i].nodeName] = elements[i].firstChild.nodeValue;
			}
			// Parse the sub-nodes of an array node
			else {
				__CONFIG[elements[i].nodeName] = {};
				var subelements = elements[i].getElementsByTagName("*");
				for(var j=0; j<subelements.length; j++) {
					if(subelements[j].parentNode.nodeName == elements[i].nodeName) {
						if(subelements[j].childNodes.length == 0)
							__CONFIG[elements[i].nodeName][subelements[j].nodeName] = '';
						else
							__CONFIG[elements[i].nodeName][subelements[j].nodeName] = subelements[j].firstChild.nodeValue;
					}
				}
			}
		}
	}
}
rE(window, 'load', __setConfig);
/* END: Read the site.xml config for JavaScript */

/* Hide the find a lawyer, ask a lawyer and resource network links for Recorded Books. 
 * Author: Chris Poirier
 * Date: October 4, 2011
 */
function hideLinksRecordedBooks() {
	// Ensure that __CONFIG is setup
	if(!__CONFIG) __setConfig();

	// Find the LawDepot menu and footer
	var LDMenu;
	if(document.getElementById('LAWDEPOT')) {
		LDMenu = getObject('LAWDEPOT').getElementsByTagName('ul')[0];
	}
	else if(document.getElementById('mm')) {
		var mm = getObject('mm');
		var lis = mm.getElementsByTagName('li');
		for(var i=0; i<lis.length; i++) {
			var li = lis[i];
			if(li.className.indexOf('LAWDEPOT') >= 0) {
				LDMenu = li.getElementsByTagName('ul')[0];
			}
		}
	}
	var footer = getObject('footer');

	// Read settings from the config array
	var showAsk = __CONFIG["showAskALawyer"].toLowerCase() == "true";
	var showFind = __CONFIG["showFindALawyer"].toLowerCase() == "true";
	var showRN = __CONFIG["showResourceNetwork"].toLowerCase() == "true";
	var showDivorce = __CONFIG["showDivorceLinks"].toLowerCase() == "true";
	
	// Don't proceed if there is nothing to hide
	if(!showAsk || !showFind || !showRN) {
		// Hide the menu links
		if(LDMenu) {
			var menuLinks = LDMenu.getElementsByTagName('a');
			for(var i=0; i<menuLinks.length; i++) {
				if(!showAsk && menuLinks[i].innerHTML.toLowerCase() == 'ask a lawyer online') {
					LDMenu.removeChild(menuLinks[i].parentNode);
					i--;
				}
				if(!showFind && menuLinks[i].innerHTML.toLowerCase() == 'find a lawyer') {
					LDMenu.removeChild(menuLinks[i].parentNode);
					i--;
				}
				if(!showRN && menuLinks[i].innerHTML.toLowerCase() == 'resource network') {
					LDMenu.removeChild(menuLinks[i].parentNode);
					i--;
				}
			}
		}

		// Hide the footer links
		if(footer) {
			var footerLinks = footer.getElementsByTagName('a');
			for(var i=0; i<footerLinks.length; i++) {
				if(!showAsk && footerLinks[i].innerHTML.toLowerCase() == 'ask a lawyer online') {
					if(footerLinks[i].nextSibling.nodeType == 3)
						footerLinks[i].parentNode.removeChild(footerLinks[i].nextSibling);
					footerLinks[i].parentNode.removeChild(footerLinks[i]);
					i--;
				}
				if(!showFind && footerLinks[i].innerHTML.toLowerCase() == 'find a lawyer') {
					if(footerLinks[i].nextSibling.nodeType == 3)
						footerLinks[i].parentNode.removeChild(footerLinks[i].nextSibling);
					footerLinks[i].parentNode.removeChild(footerLinks[i]);
					i--;
				}
				if(!showRN && footerLinks[i].innerHTML.toLowerCase() == 'resource network') {
					if(footerLinks[i].nextSibling.nodeType == 3)
						footerLinks[i].parentNode.removeChild(footerLinks[i].nextSibling);
					footerLinks[i].parentNode.removeChild(footerLinks[i]);
					i--;
				}
			}
		}
	}

	// Find the marriage menu and left navigation
	var menuMarriage;
	if(document.getElementById('FAMILY')) {
		menuMarriage = getObject('FAMILY').getElementsByTagName('ul')[0];
	}
	else if(document.getElementById('mm')) {
		var mm = getObject('mm');
		var lis = mm.getElementsByTagName('li');
		for(var i=0; i<lis.length; i++) {
			var li = lis[i];
			if(li.className.indexOf('FAMILY') >= 0) {
				menuMarriage = li.getElementsByTagName('ul')[0];
			}
		}
	}
	var leftNav = getObject('navigation');

	if(!showDivorce) {
		// Hide the menu divorce links
		if(menuMarriage) {
			var menuLinks = menuMarriage.getElementsByTagName('a');
			for(var i=0; i<menuLinks.length; i++) {
				if(menuLinks[i].innerHTML.toLowerCase().indexOf('divorce') >= 0) {
					menuMarriage.removeChild(menuLinks[i].parentNode);
					i--;
				}
			}
		}
		
		// Hide the left nav divorce links
		if(leftNav) {
			var navLinks = leftNav.getElementsByTagName('a');
			for(var i=0; i<navLinks.length; i++) {
				var link = navLinks[i].firstChild;
				if(link && link.nodeType == 3) {
					if(link.nodeValue.toLowerCase().indexOf('divorce') >= 0) {
						navLinks[i].parentNode.removeChild(navLinks[i]);
						i--;
					}
				}
			}
		}
	}
}
rE(window, 'load', hideLinksRecordedBooks);
/* END: Hide the find a lawyer, ask a lawyer and resource network links for Recorded Books. */

