// JavaScript Document
// firebug degradiation
if (! ("console" in window) || !("firebug" in console)) {
    var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group"
                 , "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
    window.console = {};
    for (var i = 0; i <names.length; ++i) window.console[names[i]] = function() {};
}


$(document).ready(function(){
/*	$("#leftMenu input[type=text]").focus(function() { this.value=""; }).blur( function() {
		if(this.id=="term") {
			this.value = ($.trim(this.value).length > 0) ? $.trim(this.value): currValue[0];
		}
		else {
			this.value = ($.trim(this.value).length > 0) ? $.trim(this.value): currValue[1];
		}
	  }
	);
	var ulHeight = $(".row ul").height();
	$(".row ul:gt(0)").height(ulHeight);
//	console.debug("uls" , uls );
	
	$(".tabs a").each(function() {
		$(this).bind("click", function() {
			$(".tabs li").removeClass("currTab");
			$(".panel").removeClass("currTab").removeAttr("style");;
			var $id = $(this).attr("class");
			$("#"+$id).slideDown().addClass("currTab");
			$(this).parent().addClass("currTab");
		});				  
	});
	$(".tabs a:eq(0)").trigger("click");
	
	$("#campus .campBlock").each( function(i, domEle) {
		if(i%3 == 2) {
			$(domEle).addClass("noRightMargin");
		}
	});
	//showParentNav();
	//fixstuff();
*/	

	//$("#nav-main li:first").addClass("first-child");
	$("#nav-main li:last").addClass("last-child");
	$("#nav-footer ul li:last").addClass("last-child");

	$(".contact .table-row .table-col").equalizeCols();
	
	$(".landing-link-group .table-row .table-col").equalizeCols();
	
	$('#sites').selectbox();


});

/* =jQuery Plugins*/
(function($) {
/* =plug-in : equal-heights */
  
	$.fn.equalizeCols = function() {
        var height = 0,
			reset = $.browser.msie ? "1%" : "auto";

        return this
			.css("height", reset)
			.each(function() {
			    height = Math.max(height, $(this).outerHeight(true));
			})
			.css("height", height)
			.each(function() {
			    var h = $(this).outerHeight(true);
			    if (h > height) {
			        $(this).css("height", height - (h - height));
			    };
			});

    };
	
})(jQuery);

/* START Navigation */
var navTree = {
	  			 "index.php": ["sel_presidents_blog.php"],
				 "sel_tools_and_resources.php": [],
				 "corp_info.php": ["corp_info_bios.php", "corp_info_bios_pres.php","corp_info_details.php", "corp_info_management.php", "corp_info_news.php"],
				 "business_groups.php": ["business_groups_details.php", "business_groups_form.php"],
				 "sel_campus_links.php": [],
				 "sel_employee_corner.php": [],
				 "sel_goals_mission_values.php": []
	  };



var navStruct = {
			"nav-sel": "index.php",
			"nav-tools": "sel_tools_and_resources.php",
			"nav-corp":  "corp_info.php",
			"nav-bus": "business_groups.php",
			"nav-camp": "sel_campus_links.php",
			"nav-emp": "sel_employee_corner.php",
			"nav-goals": "sel_goals_mission_values.php"
};

function showParentNav()
{
	var page = location.href.split("/");
	var currPage = page[page.length-1];
	var parent = null;
	var x = 0, i = 0;
	var menuName = null;
	
	if(currPage.indexOf("?") > -1)
	{
		currPage = currPage.substring(0, currPage.indexOf("?"));
	}
	
	for(x in navTree)
	{
		currLength = navTree[x].length;
		if(currLength > 0)
		{
			for(i=0; i < currLength; i++)
			{
				if(currPage.toLowerCase() == navTree[x][i].toLowerCase())
					parent = x;
			}
		}
		
		if( currPage.toLowerCase() == x.toLowerCase())
		parent = x;
		
		if(parent != null)
		break
	}
	if(parent == null)
	return;
	
	x= null;
	for(x in navStruct)
	{
		if(navStruct[x].toLowerCase() == parent.toLowerCase())
			menuName = x;
	
	}

	if(menuName != null)
	{
		var element = document.getElementById(menuName);
		element.className+=' curTab';
		// change the 'submit ideas' button if inside one of the inner pages
		if (currPage != "index.php")
		{
			var $ideas = $("#ideas img");
			$ideas.attr("src","/common/images/buttons/feedback-inner.png");
			$("#ideas").insertBefore("#searchCol").addClass("searchCol");
			
			// remove padding if inner page
			//document.getElementById("content").style.paddingBottom=0;
			$("#content").css({paddingBottom: 0});
			// add bottom border on inner pages from nav-goals
			$("#nav-goals a").addClass("nav-goals-inner");
			// remove top border from search on inner pages
			$("#search").addClass("search-inner");
		}
	}
}
/* END Navigation */


