var da = (document.all) ? 1 : 0;
var pr = (window.print) ? 1 : 0;
var mac = (navigator.userAgent.indexOf("Mac") != -1);

function printPage()
{
  if (pr)
  {
    window.print();
  }
  else if (da && !mac)
  {
    vbPrintPage();
  }
  else
  {
    alert("Sorry, your browser doesn't support this feature. You need choose File and then Print from your browser's menu bar");
    return false;
  }
}

function popGlossary(url)
{
	  bmiWin = window.open("", "CEGlossary", "height=380,width=390,scrollbars=yes,resizable=yes,menubar=no");
	  bmiWin.location.href= "/ceweb/glossary?term=" + url;
	  bmiWin.focus();
}

function popGlossary2(url)
{
	  bmiWin = window.open("", "CEGlossary", "height=380,width=390,scrollbars=yes,resizable=yes,menubar=no");
	  bmiWin.location.href = url;
	  bmiWin.focus();
}

function popTools(url)
{
	  bmiWin = window.open("", "CETools", "height=420,width=650,scrollbars=yes,resizable=yes,menubar=no");
	  bmiWin.location.href= "/ceweb/tools.jsp?file=" + url;
	  bmiWin.focus();
}

function popTools2(url)
{
	  bmiWin = window.open("", "CETools", "height=420,width=650,scrollbars=yes,resizable=yes,menubar=no");
	  bmiWin.location.href= url;
	  bmiWin.focus();
}

function popOpenUrl(url)
{
	  bmiWin = window.open("", "OpenURL", "height=480,width=460,scrollbars=yes,resizable=yes,menubar=no");
	  bmiWin.location.href = url;
	  bmiWin.focus();
}

function closeCurrentOpenNew(url)
{
    window.open(url, "_blank");
    window.close();
}

function popUp(url, scrollbars, toolbar, resizable, width, height, menubar,location)
{
    var day = new Date();
    var id = day.getTime();
    var newWindow = window.open(url, id ,'top=1,left=1,scrollbars=' + scrollbars + ',toolbar=' + toolbar + ',resizable=' + resizable + ',width=' + width + ',height=' + height + ',menubar=' + menubar + ',location=' + location);
}


function MM_popupMsg(msg) { //v1.0
  alert(msg);
}

    var cookieEnabled=(navigator.cookieEnabled)? true : false
    var mess = "";

    //if not IE4+ nor NS6+
    if(typeof navigator.cookieEnabled=="undefined" && !cookieEnabled)
    {
        document.cookie="testcookie"
        cookieEnabled=(document.cookie=="testcookie")? true : false
        document.cookie="" //erase dummy value
    }

    if(!cookieEnabled)
    {
    	document.write("<p><span class=\"errMsg\">Your Web browser options are currently set to disable cookies. To use Clinical Evidence, you must enable cookies.</span></p>");
    }

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";
 }
}
window.onload = externalLinks;

// Show/Hide div toggle

function show_hide(itemID){
 if ((document.getElementById(itemID).style.display == 'none'))
 {
   document.getElementById(itemID).style.display = 'block';
 }
 else
 {
   document.getElementById(itemID).style.display = 'none';
 }
} 