
function bookmark(url,title){
  if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
  window.external.AddFavorite(url,title);
  } else if (navigator.appName == "Netscape") {
    window.sidebar.addPanel(title,url,"");
  } else {
    alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");
  }
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function onSearchEnter( evt, frm ) {
  var keyCode = null;

  if( evt.which ) {
  keyCode = evt.which;
  } else if( evt.keyCode ) {
  keyCode = evt.keyCode;
  }
  if( 13 == keyCode ) {
  window.location='/search/search-results.aspx?zoom_query=' + document.getElementById('zoom_query').value;
  return false;
  }
  return true;
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function clearBox(textboxId)
{
	if (document.getElementById(textboxId).value == "SEARCH") document.getElementById(textboxId).value = "";
}


function populateBox(textboxId)
{
	if (document.getElementById(textboxId).value == "") document.getElementById(textboxId).value = "SEARCH";
}

function clickTab(tabId)
{
    document.getElementById("contentPatient").style.display = "none";
    document.getElementById("contentPrescriber").style.display = "none";
    document.getElementById("tabPrescriber").className = "itemTabOff";
    document.getElementById("tabPatient").className = "itemTabOff";
    if (tabId == "patient")
    {
        document.getElementById("contentPatient").style.display = "block";
        document.getElementById("tabPatient").className = "itemTabOn";
    }
    if (tabId == "prescriber")
    {
        document.getElementById("contentPrescriber").style.display = "block";
        document.getElementById("tabPrescriber").className = "itemTabOn";
    }
}

function textSize(sizeId)
{
	wrapper = (document.getElementById("mainContent") ? "mainContent" : "mainContent2Col");
	if (document.getElementById(wrapper) != null)
	{
		if (sizeId == 0) document.getElementById(wrapper).className = "textSmall";
		if (sizeId == 1) document.getElementById(wrapper).className = "textMedium";
		if (sizeId == 2) document.getElementById(wrapper).className = "textLarge";
	}
	createCookie("textSizeId", sizeId, 30);
}

function loadPage()
{
	var cookieTextSize = readCookie("textSizeId");

	if (cookieTextSize) 
	{
		textSize(cookieTextSize);
	}
}

var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

window.onload = loadPage;