// taken from x_core.js
// X v3.15.1, Cross-Browser DHTML Library from Cross-Browser.com
// Copyright (c) 2002,2003,2004 Michael Foster (mike@cross-browser.com)
// This library is distributed under the terms of the LGPL (gnu.org)

/* all functions here are used cross browser */ 

// Variables:
var xVersion='3.15.1',xNN4=false,xOp7=false,xOp5or6=false,xIE4Up=false,xIE4=false,xIE5=false,xUA=navigator.userAgent.toLowerCase();
if(window.opera){
  xOp7=(xUA.indexOf('opera 7')!=-1 || xUA.indexOf('opera/7')!=-1);
  if (!xOp7) xOp5or6=(xUA.indexOf('opera 5')!=-1 || xUA.indexOf('opera/5')!=-1 || xUA.indexOf('opera 6')!=-1 || xUA.indexOf('opera/6')!=-1);
}
else if (document.all) {
  xIE4Up=xUA.indexOf('msie')!=-1 && parseInt(navigator.appVersion)>=4;
  xIE4=xUA.indexOf('msie 4')!=-1;
  xIE5=xUA.indexOf('msie 5')!=-1;
};
// Object:
function xGetElementById(e) {
  if(typeof(e)!='string') return e;
  if(document.getElementById) e=document.getElementById(e);
  else if(document.all) e=document.all[e];
  else e=null;
  return e;
}
/* Cookie handler */
function readCookie(cookieName) {
  var docCookies = document.cookie;
  var startIndex = docCookies.indexOf(cookieName);
  if (startIndex == -1) return false;
  startIndex += cookieName.length + 1;
  var endIndex = docCookies.indexOf(";",startIndex);
  if (endIndex == -1) endIndex = docCookies.length;
  var cookieValue = docCookies.substring(startIndex, endIndex);
  return unescape(cookieValue);
}

/* XHTML target attribute */
function externalLinks() {
	if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external") 
       anchor.target = "_blank";
 }
} 

/* Accessible popups */
function acpopup(strURL,strType,strHeight,strWidth) {
var strOptions="";
if (strType=="console") strOptions="resizable,scrollbars,height="+strHeight+",width="+strWidth;
if (strType=="fixed") strOptions="status,height="+strHeight+",width="+strWidth;
if (strType=="elastic") strOptions="toolbar,menubar,scrollbars,resizable,location,height="+strHeight+",width="+strWidth;
window.open(strURL, 'newWin', strOptions);
}
 
/* Stack up window.onload event using this function from Simon Willison - http://www.sitepoint.com/blog-post-view.php?id=171578 */
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}



function openwindow(url) 
{
	window.open(url, "popme", "width=560, height=420, location=no, menubar=no, status=no, toolbar=no, scrollbars=auto, resizable=yes");
	focus();
} 




addLoadEvent(function() {
	//collapseSidebarPreference();
	externalLinks();
});
