﻿function div_height()
{
    var right = document.getElementById("right").clientHeight - 13.5;
    var left = document.getElementById("left").clientHeight - 14;
    var diff = left - right;
    var extra = 0;
    
    if(document.title == "Mt. Baker Scholarship Foundation")
        extra = 72;
    else if (document.title == "Mt. Baker Scholarship Foundation :: Scholarships")
        extra = 101;
    else
        extra = 5;    
 
    if(diff <0 )
    {
        var top1 = right - left + extra;
        document.getElementById("left").style.height = right+ "px";
        document.getElementById("span_adobe").style.paddingTop = top1 + "px";
        
        if(navigator.userAgent == "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/530.5 (KHTML, like Gecko) Chrome/2.0.172.37 Safari/530.5")
        {
            top1 = top1 + 52;
            
            if (document.title.replace(/^\s+|\s+$/g, '') == "Mt. Baker Scholarship Foundation :: Scholarships")
                top1 = top1 + 30;
            else if (document.title.replace(/^\s+|\s+$/g, '') == "Mt. Baker Scholarship Foundation :: Newsletters")
                top1 = top1 - 67;
            
            
            document.getElementById("span_adobe").style.paddingTop = top1 +"px";
            
        }      
        //alert(diff + " L < R");
    }
    else
    {
        if(diff < 90 )
        {
            var h = 0;
            if (document.title.replace(/^\s+|\s+$/g, '') == "Mt. Baker Scholarship Foundation :: Contact Us")
                h = left - 6;
            document.getElementById("right").style.height = h + "px";
           //alert(diff + " L > R");
        }
    }
}


function active()
{
    if(document.title.replace(/^\s+|\s+$/g, '') == "Mt. Baker Scholarship Foundation")
        document.getElementById("home").style.color = "#FFFFFF";
    else if(document.title.replace(/^\s+|\s+$/g, '') == "Mt. Baker Scholarship Foundation :: Scholarships")
        document.getElementById("scholar").style.color = "#FFFFFF";
    else if(document.title.replace(/^\s+|\s+$/g, '') == "Mt. Baker Scholarship Foundation :: Donation")
        document.getElementById("donation").style.color = "#FFFFFF";
    else if(document.title.replace(/^\s+|\s+$/g, '') == "Mt. Baker Scholarship Foundation :: Newsletters")
        document.getElementById("newsletters").style.color = "#FFFFFF";
    else if(document.title.replace(/^\s+|\s+$/g, '') == "Mt. Baker Scholarship Foundation :: Past Recipients")
        document.getElementById("recipient").style.color = "#FFFFFF";
    else if(document.title.replace(/^\s+|\s+$/g, '') == "Mt. Baker Scholarship Foundation :: Contact Us")
        document.getElementById("contact").style.color = "#FFFFFF";
        
    
}


  // highlight and fade background on named anchors
// requires jquery.color.js http://plugins.jquery.com/project/color
function highlight(elemId){
    var elem = $(elemId);
    elem.css("backgroundColor", "#ffffff"); // hack for Safari
    elem.animate({ backgroundColor: '#ffffaa' }, 2000);
    setTimeout(function(){$(elemId).animate({ backgroundColor: "#ffffff" }, 3000)},1000);
}
   
if (document.location.hash) {
    highlight(document.location.hash);
}
$('a[href*=#]').click(function(){
    var elemId = '#' + $(this).attr('href').split('#')[1];
    highlight(elemId);
});
