
/*
  // make the two columns of the bottom part of the page the same height (for Safari, who knows the correct width only after everything is loaded)
  $(window).bind('load',function()
  {

 //   $('#knowledgebase').toggleClass('active');
 //   $('#knowledgebaseselector').toggleClass('active');
    
  //  $('#welcome_less a').click(function(ev)
  //  {
  //    $('#welcome_more').show();
  //    $('#welcome_less').hide();
  //    ev.preventDefault(); 
  //  });
    
    // show or hide the knowledgebase when a user clicks on the 'button'
    $('#knowledgebaseselector a,#welcomebar_layover a').bind('click', function(ev)
    {
      $('#knowledgebaseselector').toggleClass('active');
      $('#welcome').toggle();
      $('#welcomebar_layover').toggle();
      return false;
    });
    
    $('#agendacontainer, #headlinescontainer, #blogscontainer').vjustify();
    $('#sections div.section div.menublock').vjustify();
  });

  var highlight = function(what)
  {
    //$('#knowledgebase').toggleClass('active');    
    
  }
*/  
	var global_actionpanel_timer = -1;
	var global_actionpanel_interval = 8000; // milliseconds actionpanel items are shown
	var global_actionpanel_init = 8000; // milliseconds initial screen is shown

	var busy;
	busy = false;

	$(document).ready(function(){

		global_actionpanel_timer = setTimeout("actionpanel_callback();", global_actionpanel_init); // if using flash, call actionpanel_callback() on flash movie end, instead
		
		$("#control h1 a").click(function(e) {
			e.preventDefault();
		});
		
		$("#control h1").click(function(e) {
			if(busy==false) {
				clearTimeout(global_actionpanel_timer);
				bid = $(this).attr('id');
				bid = bid.replace("controlitem","");
				doHideAndShowThis(bid);
			}
		});
		
		$("#actionpanel .showPart").click(function(e) {
			clearTimeout(global_actionpanel_timer);
		});
		$("#actionpanel .showPart input").focus(function(e) {
			clearTimeout(global_actionpanel_timer);
		});
		
		// get first show item
		bid = $("#actionpanel .showPart:first");
		bid = $(bid).attr('id');
		bid = bid.replace("show","");
		
		doHideAndShowThis(bid);
	});
	
	function doHideAndShowThis(bid) {
		hideActionpanelItems();
		showActionpanelItem(bid);
	}
	
	function actionpanel_callback() {
		var bid;
		busy=true;
		clearTimeout(global_actionpanel_timer);
		global_actionpanel_timer = setTimeout("actionpanel_callback();", global_actionpanel_interval);
		
		if($("#actionpanel .showPart.show").hasClass('projects')) {
			GUnload();
			$("#actionpanel .showPart.show").hide();
			hideActionpanelItems();
			hidemaps = $("#actionpanel .showPart.projects");
			var index = $("#actionpanel .showPart").index(hidemaps);
			numparts = $("#actionpanel .showPart").length;
			numparts = numparts-1;
			//alert(index);alert(numparts);
			if(index < numparts) {
				nex=index+1;
				//alert(nex);
				bid = $("#actionpanel .showPart").eq(index+1);
			} else {
				bid = $("#actionpanel .showPart:first"); //.next(); // next(): skip intro on second run // no intro atm
			}
			next_fade(bid);
		} else {
			$("#actionpanel .showPart.show").fadeOut(500, function() {
				hideActionpanelItems();
				if($(this).next().length > 0) {
					bid = $(this).next();
				} else {
					bid = $("#actionpanel .showPart:first"); //.next(); // next(): skip intro on second run // no intro atm
				}
				next_fade(bid);
			});
		}
		
	}
	
	function next_fade(bid) {
		$(bid).fadeIn(750, function() {
			if(jQuery.browser.msie) $(this).get(0).style.removeAttribute('filter');
			bid = $(bid).attr('id');
			bid = bid.replace("show","");
			showActionpanelItem(bid);
			busy=false;
		});
	}
	
	function hideActionpanelItems() {
		$("#actionpanel .showPart.show").removeClass('show');
		$("#actionpanel .showPart").hide();
		$("#control h1").removeClass('open');
		//$("#control h1 a").removeClass('open');
	}

	function showActionpanelItem(bid) {
		$("#control h1#controlitem"+bid).addClass('open');
		$("#actionpanel #show"+bid).show().addClass('show');
		if($("#actionpanel #show"+bid).hasClass('projects')) { 
			GMaps_panel_load();
		} else {
			//GUnload();
		}

		
		// do_sIFR("#actionpanel #show"+bid+" h1");

/*		$("#control h1 a#controlitem"+bid).addClass('open');
		$("#actionpanel #show"+bid).show().addClass('show');
//		$("#actionpanel .showPart.show").show();*/
	}

