
/*  makes text in search text box disappear*/
var navname,navvers,newsnavc=0,sidebarcnt;
navname=navigator.appName;
navvers=parseInt(navigator.appVersion);
js_ok = ((navname == "Microsoft Internet Explorer") && (navvers >= 4 )) || ((navname == "Netscape") && (navvers >= 4 ));
function inputswap(me,def,setto) {
 if(js_ok) {
  if(me.value==def) {
   me.value=setto;
  }
 }
}
/*  image rollover script*/
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
/* Pop-up definition*/
var newWin = null;
function popUp(strURL, strType, strWidth, strHeight) {  
 if (newWin != null && !newWin.closed)    
  newWin.close();  
 var strOptions="";  
 
 if (strType=="fixednooptions")    
  strOptions="height="+strHeight+",width="+strWidth; 
 
 if (strType=="resizablenooptions")    
  strOptions="resizable,height="+strHeight+",width="+strWidth;
  
if (strType=="fixedscroll")    
  strOptions="scrollbars,"+"height="+strHeight+",width="+strWidth;  
if (strType=="fixedmenuscroll")    
  strOptions="menubar,scrollbars,"+"height="+strHeight+",width="+strWidth;  
 if (strType=="resizablemenuscroll")    
  strOptions="menubar,scrollbars,"+"resizable,height="+strHeight+",width="+strWidth;
 
 if (strType=="fixedtoolsmenuscroll")    
  strOptions="toolbar,menubar,scrollbars,"+"height="+strHeight+",width="+strWidth;  
 if (strType=="resizabletoolsmenuscroll")    
  strOptions="toolbar,menubar,scrollbars,"+"resizable,height="+strHeight+",width="+strWidth;
  
 if (strType=="fixedtoolslocationmenuscroll")    
  strOptions="toolbar,menubar,scrollbars,"+"location,height="+strHeight+",width="+strWidth;  
 if (strType=="resizabletoolslocationmenuscroll")    
  strOptions="toolbar,menubar,scrollbars,"+"resizable,location,height="+strHeight+",width="+strWidth;
  
 if (strType=="resizablelocationmenuscroll")    
  strOptions="menubar,scrollbars,"+"resizable,location,height="+strHeight+",width="+strWidth;
 /* For printer-friendly pop-ups */
 if (strType=="printerfriendlypage")    
  strOptions="toolbar,menubar,scrollbars,"+"resizable,location,height="+strHeight+",width="+strWidth;
 
 newWin = window.open(strURL, 'newWin', strOptions);  
 newWin.focus();
}







// ---------------------------------------------------------------------
//                      array.push (if unsupported)
// ---------------------------------------------------------------------
if(Array.prototype.push == null) {
  Array.prototype.push = function(item) {
    this[this.length] = item;
    return this.length;
  };
};
// ---------------------------------------------------------------------
//                      array.shift (if unsupported)
// ---------------------------------------------------------------------
if (Array.prototype.shift == null) {
  Array.prototype.shift = function() {
    var response = this[0];
    for (var i=0; i < this.length-1; i++) {
      this[i] = this[i + 1];
    };
    this.length--;
    return response;
  };
};
// ---------------------------------------------------------------------
//                  function.apply (if unsupported)
// ---------------------------------------------------------------------
if (!Function.prototype.apply) {
  Function.prototype.apply = function(oScope, args) {
    var sarg = [];
    var rtrn, call;
    if (!oScope) oScope = window;
    if (!args) args = [];
    for (var i = 0; i < args.length; i++) {
      sarg[i] = "args["+i+"]";
    };
    call = "oScope.__applyTemp__(" + sarg.join(",") + ");";
    oScope.__applyTemp__ = this;
    rtrn = eval(call);
    oScope.__applyTemp__ = null;
 return rtrn;
  };
};
// ---------------------------------------------------------------------
//                               inArray()
//                           [Port from PHP]
//               Hunts for a value in the specified array
// ---------------------------------------------------------------------
function inArray(needle) {
  for (var i=0; i < this.length; i++) {
    if (this[i] === needle) {
      return i;
    }
  }
  return false;
}
Array.prototype.inArray = inArray;
// ---------------------------------------------------------------------
//                               isArray()
//                           [Port from PHP]
//                  verifies if something is an array
// ---------------------------------------------------------------------
function isArray() {
  return (typeof(this.length)=="undefined") ? false : true;
};
Array.prototype.isArray = isArray;
// ---------------------------------------------------------------------
//                               ksort()
//                           [Port from PHP]
//                     sorts an array by key names
// ---------------------------------------------------------------------
function ksort() {
  var sArr = [];
  var tArr = [];
  var n = 0;
  for (i in this)
    tArr[n++] = i+"|"+this[i];
  tArr = tArr.sort();
  for (var i=0; i<tArr.length; i++) {
    var x = tArr[i].split("|");
    sArr[x[0]] = x[1];
  }
  return sArr;
}
Array.prototype.ksort = ksort;
// ---------------------------------------------------------------------
//                             addClass()
//                 appends the specified class to the object
// ---------------------------------------------------------------------
function addClass(theClass) {
  if (this.className != '') {
    this.className += ' ' + theClass;
  } else {
    this.className = theClass;
  }
}
Object.prototype.addClass = addClass;
// ---------------------------------------------------------------------
//                           removeClass()
//                 removes the specified class to the object
// ---------------------------------------------------------------------
function removeClass(theClass) {
  var oldClass = this.className;
  var regExp = new RegExp('\\s?'+theClass+'\\b');
  if (oldClass.indexOf(theClass) != -1) {
    this.className = oldClass.replace(regExp,'');
  }
}
Object.prototype.removeClass = removeClass;
// ---------------------------------------------------------------------
//                      lastChildContainingText()
//  finds the last block-level text-containing element within an object
// ---------------------------------------------------------------------
function lastChildContainingText() {
  var testChild = this.lastChild;
  var contentCntnr = ['p','li','dd'];
  while (testChild.nodeType != 1) {
    testChild = testChild.previousSibling;
  } 
  var tag = testChild.tagName.toLowerCase();
  var tagInArr = inArray.apply(contentCntnr, [tag]);
  if (!tagInArr && tagInArr!==0) {
    testChild = lastChildContainingText.apply(testChild);
  }
  return testChild;
}
Object.prototype.lastChildContainingText = lastChildContainingText;
/*------------------------------------------------------------------------------
Function:       footnoteLinks()
------------------------------------------------------------------------------*/
function footnoteLinks(containerID,targetID) {
   if (!document.getElementById || 
      !document.getElementsByTagName ||
      !document.createElement) return false;
  if (!document.getElementById(containerID)|| !document.getElementById(targetID)) return false;
var container = document.getElementById(containerID);
  var target    = document.getElementById(targetID);
  var h2        = document.createElement('h2');
  addClass.apply(h2,['printOnly']);
  var h2_txt    = document.createTextNode('Links');
  h2.appendChild(h2_txt);
  var coll = container.getElementsByTagName('A');
  var ol   = document.createElement('ol');
  addClass.apply(ol,['printOnly']);
  var myArr = [];
  var thisLink;
  var num = 1;
  for (var i=0; i<coll.length; i++) {
    var thisClass = coll[i].className;
    if ( (coll[i].getAttribute('href') ||
          coll[i].getAttribute('cite'))  && coll[i].getAttribute('href').indexOf("mailto") == -1 &&
          (thisClass == '' ||
           thisClass.indexOf('ignore') == -1) || thisClass == ('mailto')) { 
      thisLink = coll[i].getAttribute('href') ? coll[i].href : coll[i].cite;
   coll[i].innerHTML = coll[i].innerHTML + "&nbsp;";
      var note = document.createElement('sup');
      addClass.apply(note,['printOnly']);
      var note_txt;
      var j = inArray.apply(myArr,[thisLink]);
      if ( j || j===0 ) {
        note_txt = document.createTextNode(j+1);
      } else {
        var li     = document.createElement('li');
        var li_txt = document.createTextNode(thisLink);
        li.appendChild(li_txt);
        ol.appendChild(li);
        myArr.push(thisLink);
        note_txt = document.createTextNode(num);
        num++;
      }
      note.appendChild(note_txt);
      if (coll[i].tagName.toLowerCase() == 'blockquote') {
        var lastChild = lastChildContainingText.apply(coll[i]);
        lastChild.appendChild(note);
      } else {
        coll[i].parentNode.insertBefore(note, coll[i].nextSibling);
      }
    }
  }
  target.appendChild(h2);
  target.appendChild(ol);
  addClass.apply(document.getElementsByTagName('html')[0],['noted']);
  return true;
}





/* the follow code applies to the sliding divs of tools to share - specifically "Blog this article" and "What's this" */
function getObject(obj) {
   if ( typeof obj != 'string') {
      return obj;
   }
   var newObj;
   if ( document.getElementById ) {
      newObj = document.getElementById(obj);
   }
   else if ( document.all ) {
      newObj = document.all(obj);
   }
   return newObj;
}
/*
var script = getObject("WIDGETMANAGER");
var query = script.src.replace(/^[^\?]+\??/,'');
var pairs = query.split(/[;&]/);
var params = new Array;
var count = 0;
for ( var i = 0; i < pairs.length; i++ ) {
   var keyval = pairs[i].split('=');
   if ( ! keyval || keyval.length != 2 ) {
      continue;
   }
   var key = unescape(keyval[0]);
   var val = unescape(keyval[1]);
   val = val.replace(/\+/g, ' ');
   params[count++] = val;
}
*/
function loadXMLDoc(url) {
   var xmlhttp = null;
   var responseText = '';
   var fetchURL = '/fetchurl.php';
   url = fetchURL + '?u=' + escape(url);
   if ( window.XMLHttpRequest ) {
      // code for Firefox, Opera, IE7, etc.
      xmlhttp = new XMLHttpRequest();
   }
   else if ( window.ActiveXObject ) {
      // code for IE6, IE5
      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
   }
   if ( xmlhttp != null ) {
      xmlhttp.onreadystatechange = function () {
         if ( xmlhttp.readyState == 4 ) {
            if (xmlhttp.status==200) {
               // 200 = "OK"
               responseText = xmlhttp.responseText;
            }
            else {
               responseText = "Problem retrieving data:" + xmlhttp.statusText;
            }
         }
      }
      xmlhttp.open("GET", url, false);
      xmlhttp.send(null);
   }
   else {
      responseText = "Your browser does not support XMLHTTP.";
   }
   return responseText;
}
function Widget (obj) {
   this.id = obj.id;
   this.oclass = obj.oclass;
   this.linkID = obj.linkID;
   this.linkClass = obj.linkClass;
   this.linkText = obj.linkText;
   this.domObj = document.getElementById(obj.id);
   this.offsetTop = obj.offsetTop;
   this.offsetLeft = obj.offsetLeft;
   this.transition = obj.transition;
   this.box = document.createElement('div');
   this.box.id = obj.wid;
   this.box.className = obj.wclass;
   this.box.innerHTML = obj.html;
   if ( obj.url ) {
      this.box.innerHTML = loadXMLDoc(obj.url);
   }
   this.box.style.visibility = 'hidden';
   this.box.style.position = 'absolute';
   this.box.style.top += obj.offsetTop + 'px';
   this.box.style.left += obj.offsetLeft + 'px';
   this.domObj.appendChild(this.box);
   this.toggle = function () {
      if ( this.box.style.visibility == 'hidden' ) {
         this.show();
         return;
      }
      this.hide();
   }
   this.show = function () {
      var dx = 30, dy = 30, dt = 5;
      var dir = -1;
      if ( this.box.style.visibility == 'visible' ) {
         dir = 1;
      }
      switch ( this.transition ) {
         case 'n':
            var lpos = 0;
            var tpos = 0;
            var rpos = this.box.offsetWidth;
            var bpos = this.box.offsetHeight;
            break;
         case 'tl':
            var lpos = 0;
            var tpos = 0;
            var rpos = 0;
            var bpos = 0;
            break;
         case 'bl':
            var lpos = 0;
            var tpos = this.box.offsetHeight;
            var rpos = 0;
            var bpos = this.box.offsetHeight;
            break;
         case 'tr':
            var lpos = this.box.offsetWidth;
            var tpos = 0;
            var rpos = this.box.offsetWidth;
            var bpos = 0;
            break;
         case 'br':
            var lpos = this.box.offsetWidth;
            var tpos = this.box.offsetHeight;
            var rpos = this.box.offsetWidth;
            var bpos = this.box.offsetHeight;
            break;
         case 't':
            var lpos = 0;
            var tpos = 0;
            var rpos = this.box.offsetWidth;
            var bpos = 0;
            break;
         case 'b':
            var lpos = 0;
            var tpos = this.box.offsetHeight;
            var rpos = this.box.offsetWidth;
            var bpos = this.box.offsetHeight;
            break;
         case 'l':
            var lpos = 0;
            var tpos = 0;
            var rpos = 0;
            var bpos = this.box.offsetHeight;
            break;
         case 'r':
            var lpos = this.box.offsetWidth;
            var tpos = 0;
            var rpos = this.box.offsetWidth;
            var bpos = this.box.offsetHeight;
            break;
         default:
            var lpos = 0;
            var tpos = 0;
            var rpos = this.box.offsetWidth;
            var bpos = this.box.offsetHeight;
      }
      var count = 0;
      var box = this.box;
      var transition = this.transition;
      var tmr = setInterval(
         function () {
            switch ( transition ) {
               case 'tl':
                  if ( rpos - lpos >= 0 || rpos - lpos < box.offsetWidth ) {
                     rpos -= (dir * dx);
                     if ( rpos - lpos < 0 ) {
                        lpos = 0;
                     }
                     if ( rpos - lpos > box.offsetWidth ) {
                        lpos = 0;
                     }
                  }
                  if ( bpos - tpos > 0 || bpos - tpos < box.offsetHeight ) {
                     bpos -= (dir * dy);
                     if ( bpos - tpos < 0 ) {
                        bpos = tpos;
                     }
                     if ( bpos - tpos > box.offsetHeight ) {
                        bpos = box.offsetHeight;
                     }
                  }
                  break;
               case 'bl':
                  if ( rpos - lpos >= 0 || rpos - lpos < box.offsetWidth ) {
                     rpos -= (dir * dx);
                     if ( rpos - lpos < 0 ) {
                        lpos = 0;
                     }
                     if ( rpos - lpos > box.offsetWidth ) {
                        lpos = 0;
                     }
                  }
                  if ( bpos - tpos > 0 || bpos - tpos < box.offsetHeight ) {
                     tpos += (dir * dy);
                     if ( bpos - tpos < 0 ) {
                        bpos = tpos;
                     }
                     if ( bpos - tpos > box.offsetHeight ) {
                        tpos = 0;
                     }
                  }
                  break;
               case 'tr':
                  if ( rpos - lpos > 0 || rpos - lpos < box.offsetWidth ) {
                     lpos += (dir * dx);
                     if ( rpos - lpos < 0 ) {
                        lpos = rpos;
                     }
                     if ( rpos - lpos > box.offsetWidth ) {
                        lpos = 0;
                     }
                  }
                  if ( bpos - tpos > 0 || bpos - tpos < box.offsetHeight ) {
                     bpos -= (dir * dy);
                     if ( bpos - tpos < 0 ) {
                        bpos = tpos;
                     }
                     if ( bpos - tpos > box.offsetHeight ) {
                        bpos = box.offsetHeight;
                     }
                  }
                  break;
               case 'br':
                  if ( rpos - lpos > 0 || rpos - lpos < box.offsetWidth ) {
                     lpos += (dir * dx);
                     if ( rpos - lpos < 0 ) {
                        lpos = rpos;
                     }
                     if ( rpos - lpos > box.offsetWidth ) {
                        lpos = 0;
                     }
                  }
                  if ( bpos - tpos > 0 || bpos - tpos < box.offsetHeight ) {
                     tpos += (dir * dy);
                     if ( bpos - tpos < 0 ) {
                        bpos = tpos;
                     }
                     if ( bpos - tpos > box.offsetHeight ) {
                        tpos = 0;
                     }
                  }
                  break;
               case 't':
                  if ( bpos - tpos > 0 || bpos - tpos < box.offsetHeight ) {
                     bpos -= (dir * dy);
                     if ( bpos - tpos < 0 ) {
                        bpos = tpos;
                     }
                     if ( bpos - tpos > box.offsetHeight ) {
                        bpos = box.offsetHeight;
                     }
                  }
                  break;
               case 't':
                  if ( bpos - tpos > 0 || bpos - tpos < box.offsetHeight ) {
                     bpos -= (dir * dy);
                     if ( bpos - tpos < 0 ) {
                        bpos = tpos;
                     }
                     if ( bpos - tpos > box.offsetHeight ) {
                        bpos = box.offsetHeight;
                     }
                  }
                  break;
               case 'b':
                  if ( bpos - tpos > 0 || bpos - tpos < box.offsetHeight ) {
                     tpos += (dir * dy);
                     if ( bpos - tpos < 0 ) {
                        bpos = tpos;
                     }
                     if ( bpos - tpos > box.offsetHeight ) {
                        tpos = 0;
                     }
                  }
                  break;
               case 'l':
                  if ( rpos - lpos >= 0 || rpos - lpos < box.offsetWidth ) {
                     rpos -= (dir * dx);
                     if ( rpos - lpos < 0 ) {
                        lpos = 0;
                     }
                     if ( rpos - lpos > box.offsetWidth ) {
                        lpos = 0;
                     }
                  }
                  break;
               case 'r':
                  if ( rpos - lpos > 0 || rpos - lpos < box.offsetWidth ) {
                     lpos += (dir * dx);
                     if ( rpos - lpos < 0 ) {
                        lpos = rpos;
                     }
                     if ( rpos - lpos > box.offsetWidth ) {
                        lpos = 0;
                     }
                  }
                  break;
            }
            var clipstring = 'rect('+ tpos +'px,'+ rpos +'px,'+ bpos + 'px,'+ lpos + 'px)';
            box.style.clip = clipstring;
            box.style.visibility = 'visible';
            if ( rpos - lpos <= 0 && bpos - tpos <= 0 ) {
               box.style.visibility = 'hidden';
               clearInterval(tmr);
            }
            else if ( rpos - lpos >= box.offsetWidth && bpos - tpos >= box.offsetHeight ) {
               clearInterval(tmr);
            }
         }, dt
      );
   }
   this.hide = function () {
      this.box.style.visibility = 'hidden';
   }
}
function WidgetManager (ns) {
   this.entries = new Array;
   this.ns = ns;
   this.addentry = function (obj) {
      var inst  = "<span id='" + obj.id + "' class='" + obj.oclass + "' style='position: relative;'><a id=\"" + obj.linkID + "\" class=\"" + obj.linkClass + "\" href='#' onclick=\"" + this.ns + ".toggle('" + obj.id + "'); return false\">" + obj.linkText + "</a></span>";
      document.write(inst);
      this.entries[obj.id] = new Widget(obj);
   }
   this.toggle = function (id) {
      for ( i in this.entries ) {
         if ( id != i ) {
            if ( this.entries[i].hide ) {
               this.entries[i].hide();
            }
         }
      }
      this.entries[id].toggle();
   }
}
var ns = 'BLOGTHIS';
var string = ns + ' = new WidgetManager("'+ ns +'")';
eval(string);
/*
if ( params.length > 0 ) {
   for ( i = 0; i < params.length; i++ ) {
      ns = params[i];
      var string = ns + ' = new WidgetManager("'+ ns +'")';
      eval(string);
   }
}
else {
   var string = ns + ' = new WidgetManager("'+ ns +'")';
   eval(string);
}
*/
/* end sliding div code */


