$(function(){
    var lo=location.pathname.substr(1);
    $("[href='"+lo+"']").addClass("active");
    var lo1=lo.substr(0,1).toUpperCase()+lo.substr(1).replace("-"," ").replace("-"," ").replace("-"," ").replace(".php","");
    var lo2=$("#leftC h1").html()==""?lo1.replace(" and "," & "):lo1.replace(" and "," & ")+$("#leftC h1").html();
    lo2=lo2.replace(/\w\S*/g,function(txt){return txt.charAt(0).toUpperCase()+txt.substr(1).toLowerCase();});
    $("#leftC h1").html(lo2);
    document.title=lo2=="Null" || lo2=="null" || lo2=="Indexnull"?document.title:"Dr. Milan Sen :: "+$("#leftC h1").html().replace("amp;","");
    $("#submit").click(function(){
	if($("#term").val()=="search term here" || $("#term").val()=="") alert("Please enter a search term."); else $("form").submit();
    });
    $("#term").focus(function(){
	if($(this).val()=="search term here") $(this).val(""); $(this).blur(function(){ if($(this).val()=="") $(this).val("search term here"); });
    });
    $("#nav a:last").css("background-image","none");
    $("tr:even").addClass("even");
    if($("#box").length>0){
	if($("#box").height()>0){ $("#mid").height($("#leftC").height()+$("#box").height()+40); $("#box").height($("#leftC").height()-314); }
	if($("#box").height()>420){ $("#mid").height($("#leftC").height()+$("#box").height()+40); $("#box").height($("#leftC").height()-168); }
	if($("#box").height()>599){ $("#mid").height($("#leftC").height()+80); $("#box").height($("#leftC").height()-290); }
	if($("#box").height()>780){ $("#mid").height($("#leftC").height()+340); $("#box").height($("#leftC").height()-33); }
	if($("#box").height()>1270){ $("#mid").height($("#leftC").height()+90); $("#box").height($("#leftC").height()-285); }
	if($("#box").height()>1450){ $("#mid").height($("#leftC").height()+135); $("#box").height($("#leftC").height()-240); }
	else{ $("#mid").height($("#leftC").height()+85); $("#box").height($("#leftC").height()-288); }
	if(lo=="our-surgeons-and-staff.php" && $.browser.safari || lo=="our-surgeons-and-staff.php" && $.browser.chrome){ $("#mid").height($("#leftC").height()+320); $("#box").height($("#leftC").height()-55); }
    }
});
