function openLinksNewWindow()
{
  theDiv = document.getElementById('openExternalBlank');
  links = theDiv.getElementsByTagName('a');
  for (var i=0, len=links.length; i < len; i++) {
    links[i].setAttribute('target', '_blank');
  }
}

function changeState(state) {
    if (!state) return;
    location.href = '/State/' + state;    
}

function loadOptions(p) {
    
    deleteOptions({select: p.select});
    for (var i = 0; i < p.options.length; i++) {
        
        p.select.options[i] = new Option(p.options[i].text, p.options[i].value, null, (p.options[i].selected) ? true : false);
        
    }
    
}

function deleteOptions(p) {
    
    p.select.options.length = 0;
    return;
    
}

function xmlHttpRequestLoader() {
    
    if (window.XMLHttpRequest) {
        
        return new XMLHttpRequest();
        
    } else {
        
        return new ActiveXObject('Microsoft.XMLHTTP');
        
    }
    
}

function getURL(url) {
    
    var xhr = xmlHttpRequestLoader();
    xhr.open("GET", url, false);
    xhr.send(null);
    return xhr.responseText;
    
}

function setCookie(name, value, expires, path, domain, secure) {
    var curCookie = name + "=" + escape(value) +
                    ((expires) ? "; expires=" + expires.toGMTString() : "") +
                    ((path) ? "; path=" + path : "") +
                    ((domain) ? "; domain=" + domain : "") +
                    ((secure) ? "; secure" : "");
    document.cookie = curCookie;
}


function getCookie(name) {
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1) {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    } else
        begin += 2;
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
        end = dc.length;
    return unescape(dc.substring(begin + prefix.length, end));
}


function deleteCookie(name, path, domain) {
    if (getCookie(name)) {
        document.cookie = name + "=" +
                          ((path) ? "; path=" + path : "") +
                          ((domain) ? "; domain=" + domain : "") +
                          "; expires=Thu, 01-Jan-70 00:00:01 GMT";
    }
}

function toggleDisplay(id) {
    
    var e = document.getElementById(id);
    if (e.style.display == 'none') {
        
        e.style.display = 'block';
        
    } else {
        
        e.style.display = 'none';
        
    }
    
}

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_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function NewWindow(mypage, myname, w, h, scroll) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function openWin(url,windowName,options){
  var WindowHandle=window.open(url,windowName,options);
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function showlayer(whichLayer) {
    document.getElementById(whichLayer).style.display = 'block';
}

function hidelayer(whichLayer) {
    document.getElementById(whichLayer).style.display = 'none';
}

