﻿
var numberOfSections = 5;
var navHeight = 0;

function showPopup(i) {
    var rootEl = jQuery('.popup' + i);
    rootEl.show();
    rootEl.children('.scroll-pane').jScrollPane();
    closeAll();
    rootEl.show();
}

function scrollToTop(){
	jQuery('.popup2 .scroll-pane').jScrollPane();
	//if it's ie 6 then shorten it more
	if (navigator.userAgent.toLowerCase().indexOf("msie") != -1){ 
		jQuery(".BodyWrapper").css("margin-top", "-26px");
	}
	jQuery('.popup2 .scroll-pane')[0].scrollTo(0);
}
function hoverScrollToTop(){
	jQuery(".popupHover .jScrollPaneContainer").show();
	jQuery('.popupHover .scroll-pane').jScrollPane();
	//if it's ie 6 then shorten it more
	if (navigator.userAgent.toLowerCase().indexOf("msie") != -1){ 
		jQuery(".BodyWrapper").css("margin-top", "-13px");
	}
	jQuery('.popupHover .scroll-pane')[0].scrollTo(0);
}
function closeAll() {
    for(var i = 1; i <= numberOfSections; i++){
        jQuery('.popup' + i).hide();
    }
    jQuery('.popupHover').hide();
}
function closeHover() {
    jQuery('.popupHover').hide();
    jQuery('.popup3').show();
}

jQuery(document).ready(function(){
	
	// make pop-up detail area same hieght as left column
	navHeight = jQuery(".LeftCol").height();
    
    // consider the top and bottom padding for the height calculation
	var detPadTop = jQuery(".OfficeDetail").css("padding-top").replace("px","");
	var detPadBot = jQuery(".OfficeDetail").css("padding-bottom").replace("px","");
	navHeight = (navHeight - detPadTop - detPadBot);
    
    jQuery(".OfficeDetail").css("height", navHeight);
});
