// JavaScript Document
function def_over(def_item, e)
{
    alert('fov');
	var x,y;
	saf = ( navigator.userAgent.indexOf( 'Safari' ) != -1 );
	if (self.pageYOffset) // all except Explorer
	{
		x = self.pageXOffset;
		if (saf)
			y = 0;
		else
			y = self.pageYOffset;
	}
	else if (document.documentElement && document.documentElement.scrollTop)
		// Explorer 6 Strict
	{
		x = document.documentElement.scrollLeft;
		y = document.documentElement.scrollTop;
	}
	else if (document.body) // all other Explorers
	{
		x = document.body.scrollLeft;
		y = document.body.scrollTop;
	}
	var posY = e.clientY + y + 20;
	var posX = e.clientX + x;	
	var div = returnDiv(def_item);
	posX = posX - div.width;
	div.top = posY + "px";
	div.left = posX + "px";
	div.visibility = "visible";
}

function def_out(def_item)
{
	var div = returnDiv(def_item);
	div.visibility = "hidden";
}

function switchAnswer(toswitch) {
    if (document.selected != undefined) {
        document.getElementById(document.selected).style.display='none';
    }
    document.selected = toswitch;
    document.getElementById(toswitch).style.display='block';
}

// Show answers
function switchAnswer(toswitch) {
    if (document.selected != undefined) {
        document.getElementById(document.selected).style.display='none';
    }
    document.selected = toswitch;
    document.getElementById(toswitch).style.display='block';
}


function FixBoxModel(bForce){
        if(!window.external || document.compatMode=="CSS1Compat" || navigator.platform=="MacPPC")
                return;
        for(var i=0, S=document.styleSheets, il=S.length, C, R; i<il; i++){
                C = S[i]; if(!C) continue;
                FixBoxModelCollection( C, bForce );
        }
}

function FixBoxModelCollection( oStyleCol, bForce ){
        var I = oStyleCol.imports;
        for(var a=0, al=(I?I.length:0); a<al; a++){
                FixBoxModelCollection( I[a], bForce );
        }
        var R = oStyleCol.rules; if(!R) return;
        for(var j=0, jl=R.length, CR, CS; j<jl; j++){
                CR = R[j]; if(!CR) continue;
                CS = CR.style; if(!CS) continue;
                FixBoxModelStyle( CS, bForce );
        }
}
function FixBoxModelStyle(oStyle, bForce){
        if(!oStyle || (oStyle.FixBoxModelDone&&!bForce)) return;
        var p = FixBoxModel_parseInt;
        var re = /([.0-9]*)(.+)/;
        var r = oStyle.width.match(re);
        if(r && r[2].toLowerCase()!='auto') {
                var cWidth = p(r[1]), uWidth=r[2];
                var wBorder = p(oStyle.borderLeftWidth) + p(oStyle.borderRightWidth);
                var wPadding = p(oStyle.paddingLeft) + p(oStyle.paddingRight);
                if(wBorder>0||wPadding>0) oStyle.width = (cWidth + wBorder + wPadding) + uWidth;
        }
        r = oStyle.height.match(re);
        if(r && r[2].toLowerCase()!='auto') {
                var cHeight = p(r[1]), uHeight = r[2];
                var hBorder = p(oStyle.borderTopWidth) + p(oStyle.borderBottomWidth);
                var hPadding = p(oStyle.paddingTop) + p(oStyle.paddingBottom);
                if(hBorder>0||hPadding>0) oStyle.height = (cHeight + hBorder + hPadding) + uHeight;
        }
        oStyle.FixBoxModelDone = true;
}
function FixBoxModel_parseInt(s){
        return parseInt(s)||0;
}
FixBoxModel();

function relExt() {
    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") {
             var ihm = anchor.innerHTML;
             var toset = "http://www.mentalhealthpartd.org/extlink.php?url="+anchor.getAttribute("href");
             anchor.setAttribute("href",toset);
             anchor.innerHTML = ihm;
        }
       if (anchor.getAttribute("href") &&           anchor.getAttribute("id") == "goext")
         anchor.target = "_blank";    }
}

window.onload = relExt;

var req;

function loadXMLDoc(url) 
{
  // branch for native XMLHttpRequest object
  if (url == null) {
    return;
  }
  else {
    if (window.XMLHttpRequest) {
      req = new XMLHttpRequest();
      req.onreadystatechange = processReqChange;
      req.open("GET", url, true);
      req.send(null);
      // branch for IE/Windows ActiveX version
    } else if (window.ActiveXObject) {
      req = new ActiveXObject("Microsoft.XMLHTTP");
      if (req) {
    	req.onreadystatechange = processReqChange;
    	req.open("GET", url, true);
    	req.send(null);
      }
    }
  }
}
