var activeBtn = "none";

function offSite(nextURL) {
    var popThis = 'leaving_site.html?url=' + nextURL;
    window.open(popThis,'','toolbar=no,scrollbars=no,resizable=no,width=500,height=360');
}

function popUp(page2pop, width, height) {
    window.open(page2pop,'','toolbar=no,scrollbars=yes,resizable=no,width=' + width + ',height=' + height);
}

function popNoscroll(page2pop, width, height) {
    window.open(page2pop,'','toolbar=no,scrollbars=no,resizable=no,width=' + width + ',height=' + height);
}

function positionCarat(newSection) {
	var carat = document.getElementById('carat');
	
	activeBtn = newSection;

	switch(newSection) {
		case 'hic':
			endX = 92;
			break;
		case 'hemo-a':
			endX = 248;
			break;
		case 'hemo-b':
			endX = 350;
			break;
		case 'programs':
			endX = 510;
			break;
		case 'news':
			endX = 686;
			break;
		case 'contact':
			endX = 790;
			break;
		default: break;
	}
	endPosition = endX + "px";
    carat.style.left = endPosition;
}
	
function deactDropdowns(dropdownDiv)
{
  if(dropdownDiv!="hic_drop") {deactDropdown('hic_drop','hic')}
  if(dropdownDiv!="hemo-a_drop") {deactDropdown('hemo-a_drop','hemo-a')}
  if(dropdownDiv!="programs_drop") {deactDropdown('programs_drop','programs')}
}

function enactDropdown(dropdownDiv,dropdownButton) {
  	deactDropdowns(dropdownDiv);
	dropdownDiv = document.getElementById(dropdownDiv) ;
	dropdownButton = document.getElementById(dropdownButton) ;

	if (dropdownDiv && dropdownButton) {
		dropdownDiv.style.display = "block";
		dropdownDiv.style.visibility = "visible";
		dropdownButton.style.backgroundPosition = "0 -19px";
	}
	
}
function deactDropdown(dropdownDiv,dropdownButton) {
	dropDiv = document.getElementById(dropdownDiv) ;
	dropButton = document.getElementById(dropdownButton) ;

	if (dropDiv && dropButton) {
		dropDiv.style.display = "none";
		dropDiv.style.visibility = "hidden";
      	if (activeBtn != dropdownButton) {dropButton.style.backgroundPosition = "0 0"}
	}
}

function hideDiv(div2hide) {
	div2hide = document.getElementById(div2hide) ;
	if (div2hide) {
		div2hide.style.display = "none";
		div2hide.style.visibility = "hidden";
	}
}

function showDiv(div2show) {
	div2show = document.getElementById(div2show) ;
	if (div2show) {
		div2show.style.display = "block";
		div2show.style.visibility = "visible";
	}
}

