/*
var gActiveMenuId = 1;

function onMenuClicked( menuId )
{
	if ( menuId == gActiveMenuId ) { return; }
	
	document.getElementById( "menu_" + gActiveMenuId ).className = "menu";
	document.getElementById( "menu_" + menuId ).className = "menuActive";
	gActiveMenuId = menuId;
	
	document.getElementById( "contentBody" ).src = "p" + menuId + ".html";
	
	//var api = $("#panes").data("scrollable");
	//api.seekTo( menuId );
}
*/

var menu_items; // = $("#menu a");
var loading; // = $("#loading");
var contentRoot; // = $("#contentRoot" );
var content; // = $("#content" );
  //var logo = $("#logoSlide");
      
var crt_menu_item_id = "";
var new_menu_item_id = "menu_1";
var new_page_name = "";
      
function init(){
	menu_items = $("#menu a");
	loading = $("#loading");
	contentRoot = $("#contentRoot" );
	content = $("#content" );
}

function loadContent( pageName ) {
    if ( crt_menu_item_id == new_menu_item_id )
    {
        return;
    }
    loading.css({visibility:"visible"}).css({opacity:"1"}).css({display:"block"});

    if ( crt_menu_item_id != "" )
    {
  	     document.getElementById(crt_menu_item_id).className = "menu";
    }
    document.getElementById(new_menu_item_id).className = "menuActive";
    crt_menu_item_id = new_menu_item_id;
    new_page_name = pageName;

    contentRoot.animate({left:'10px'}, 750, pageOutFinished );
}

function pageOutFinished() {
   content.load( new_page_name, loadingFinished );
}

function loadingFinished() {
    contentRoot.animate({left:'-650px'}, 750 );
    loading.fadeTo( 500, 0 );
}
