var gAutoPrint = true; // Flag for whether or not to automatically call the print function
function doPrint(tagName)
{
	if (document.getElementById != null)
	{
		var html = '<html>\n<head>\n';

		html += '\n<link href="/css/print.css" rel="stylesheet" type="text/css">';
		
		html += '\n</head>\n<body>\n';
		
		var printReadyElem = document.getElementById(tagName);
		
		if (printReadyElem != null)
		{
				html += printReadyElem.innerHTML;
		}
		else
		{
			alert("Could not find the printReady section in the HTML");
			return;
		}
		html += '\n</body>\n</html>';
		
		var printWin = window.open("","printSpecial", "toolbar=yes,location=no,status=no,menubar=no,scrollbars=yes");
		printWin.document.open();
		printWin.document.write(html);
		printWin.document.close();
		if (gAutoPrint)
			printWin.print();
	}
	else
	{
		alert("Sorry, the print ready feature is only available in modern browsers.");
	}
}

// Required for I.E.
sfHover = function() {
    var i;
	var sfEls = document.getElementById("topnavList").getElementsByTagName("li");
	for (i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
	var sfEls2 = document.getElementById("mainnavList").getElementsByTagName("li");
	for (i=0; i<sfEls2.length; i++) {
		sfEls2[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls2[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
	
	var selectorList = document.getElementById("selectorList");
	if (selectorList)
	{
	    var sfEls3 = selectorList.getElementsByTagName("li");
	    for (i=0; i<sfEls3.length; i++) {
		    sfEls3[i].onmouseover=function() {
			    this.className+=" sfhover";
		    }
		    sfEls3[i].onmouseout=function() {
			    this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		    }
	    }
	}
	
	var lstOffices = document.getElementById("lstSpecialisms");
	if (lstOffices)
	{
	    var sfEls3 = lstOffices.getElementsByTagName("li");
	    for (i=0; i<sfEls3.length; i++) {
		    sfEls3[i].onmouseover=function() {
			    this.className+=" sfhover";
		    }
		    sfEls3[i].onmouseout=function() {
			    this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		    }
	    }
	}
	
	var lstOffices = document.getElementById("lstOffices");
	if (lstOffices)
	{
	    var sfEls3 = lstOffices.getElementsByTagName("li");
	    for (i=0; i<sfEls3.length; i++) {
		    sfEls3[i].onmouseover=function() {
			    this.className+=" sfhover";
		    }
		    sfEls3[i].onmouseout=function() {
			    this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		    }
	    }
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);


selectLink = function(sel) {

 if(sel.options.selectedIndex > 0){
    window.location = sel.options[sel.options.selectedIndex].value;
   }
}

toggleDiv = function(id) {
    
    var divObj = document.getElementById(id);
    toggleDivExpansion(divObj);
if (divObj)
    {
        if (divObj.style.visibility == 'visible')
        {
            divObj.style.visibility = 'hidden';
            divObj.style.display = 'none';
        }
        else
        {
            divObj.style.visibility = 'visible';
            divObj.style.display = 'block';
        }
    }
}