// Init Navigation
function initNavigation(theLink) {
	highlightMenu(theLink);
}

function changeColor(obj,state) {
	if (state == "on")
		obj.style.color='#e16d26'
	else
		obj.style.color='#122959'
}

// Highlight Navigation Menu
function highlightMenu(menuSelection) 
{
  var menu = document.getElementById('middleNav');
	var menuItem = menu.getElementsByTagName('a');
   //reset all menu item color
   for ( var t = 0; t < menuItem.length; ++t ) {
			menuItem[t].style.color = "#555555";
			menuItem[t].style.fontWeight = "normal";
			menuItem[t].style.background  = "url('/static/images/bullet.png') no-repeat";
			menuItem[t].style.backgroundPosition = "1px 0px";
	}
	var selectedItem = document.getElementById(menuSelection);
		selectedItem.style.color = "#000000";
		selectedItem.style.fontWeight = "bold";
		selectedItem.style.background  = "url('/static/images/bulletOn.png') no-repeat";
		selectedItem.style.backgroundPosition = "1px 0px";
}
	
// Rotate logos
$(function() {
	$(".bannerCarousel").jCarouselLite({
	    visible: 1,
			easing: "backout",
			speed: 1000,
			mouseWheel: true,
			vertical: true,
			circular: true,
	    btnGo:
	    [".1", ".2",
	    ".3", ".4",
	    ".5", ".6",
	    ".7", ".8",
			".9"],
        start: 2  // Just manually change to current event (lazy)
	});
	$(".sponsorCarousel").jCarouselLite({
	    visible: 1,
			btnNext: ".sponsorNext",
      btnPrev: ".sponsorPrev",
			easing: "linear",
			speed: 1000,
			auto: 8000,
			mouseWheel: true,
			pauseOnHover: true,
			vertical: true
	});
});

// Slide Panel: http://www.ultramegatech.com/blog/2009/06/create-a-slide-in-panel-jquery/
	var sipPos = 0;
	$(document).ready(function() {
		$("#facebookPanelHandle").click(function() {
			$("#facebookPanel").animate({ left: sipPos }, 800, 'linear', function() {
			if(sipPos == 0) { sipPos = -320; }
			else { sipPos = 0; }
		});
	});

	
	// Show Menu
	// http://wkamwai.googlepages.com/
	// http://wkamwai.googlepages.com/test.html
	$("#mainmenu li:nth-child(even)").hide();
	$("#mainmenu li:nth-child(odd)").click(
		function(){
		if($(this).next().css("display")=="none" ){
			$(this).parent().find("li:nth-child(even)").slideUp("fast");
			$(this).parent().find("li:nth-child(odd)").removeClass("selected");
			$(this).addClass("selected").next().slideDown("fast");
			}else{
			$(this).next().slideUp("fast");
			} 
		}
	);
});
