var WebSiteDebug=false;
var ActiveMenu=''
var ClosedHeight=440
var SubMenu=false
var SubMenuStatus="Close"
var ActivePageID=''
function OpenMenuWindow(m,tm)
{
	if (SubMenu==true)
	{
		$("#mainMenuWindow").animate({"top":"385px"},function() {LoadMenuData(m,tm);});

	}
	else
	{	
	if (ActiveMenu==m)
	{
		CloseMenuWindow()
	}
	else
	{
	ActiveMenu=m;
	if ($("#mainMenuWindow").position().top!=ClosedHeight)
		{
			$("#mainMenuWindow").animate({"top": ClosedHeight+"px"},function() {LoadMenuData(m,tm);});
		}
		else
		{
		LoadMenuData(m,tm);
		}
	}
	}
}
function LoadMenuData(m,tm)
{
	var MenuURL='files/mainmenuengine.asp?m='+m+'&tm='+tm
	//alert(MenuURL);
	$.ajax({
	  url: MenuURL,
	  success: function(data) {
		//alert(data);
		$('#mainMenuWindowContent').html(data);
		var WindowHeight=ClosedHeight-$('#mainMenuWindowContent').height()
		$("#mainMenuWindow").animate({"top": WindowHeight });	
	  }
	});

}

function CloseMenuWindow()
{
	$("#mainMenuWindow").animate({"top": ClosedHeight+"px"},function() {$('#mainMenuWindowContent').html('');})
	ActiveMenu='';	
}

function LoadPageData(PageID,PageParameter)
{
if (PageParameter==null){PageParameter=''}
if (PageParameter=='0'){PageParameter=''}
if (PageParameter==0){PageParameter=''}

$('#HiddenBar').height(1500)
	if ($('#mainMenuBottom').height()!="3")
		{
		//$('html,body').animate({scrollTop:0},1500)
		//$("#MainPageContent").animate({"top": "-"+$('#MainPageContent').height()+"px" });
		$("#mainMenuBottom").animate({"height":"3px"},function(){GetPageData(PageID,PageParameter)});
		}
		else
		{
		GetPageData(PageID,PageParameter)
		}
}
function GetPageData(PageID,PageParameter)
{
if (PageParameter==null){PageParameter=''}
if (PageParameter=='0'){PageParameter=''}
if (PageParameter==0){PageParameter=''}
$('#HiddenBar').height(1500)
	$('#MainPageContent').hide()
	if (ActivePageID!=unescape(PageID+PageParameter))
	{
	$.ajax({
	  url: 'files/pageengine.asp?PageID='+PageID + PageParameter,
	  success: function(data) {
		$('#MainPageContent').html(data);
		$('#MainPageContent').css("top","-"+$('#MainPageContent').height()+"px");
		$('#MainPageContent').show();
		$("#MainPageContent").animate({"top": "0px" });	
		$("#mainMenuBottom").animate({"height": $('#MainPageContent').height() });	
		ActivePageID=unescape(PageID+PageParameter)
	  }
	});
	}
	else
	{
	ActivePageID=''
	}
window.setTimeout(function(){$('#HiddenBar').height(0)},5000);
}
