		var currentPage;


		function checkCurrentPageValidty()
		{
			var error = true;
			currentPage = document.location.hash;			
			if (currentPage == '' || currentPage.indexOf('/') == -1)
				error = true;
			else
			{	
				var topNavi = currentPage.substr(1,currentPage.indexOf('/') -1);				
				var subNavi = currentPage.substr(currentPage.indexOf('/') + 1);												
				
				if (arrValidNavis[topNavi])
				{
					if (subNavi == '' && arrValidNavis[topNavi] == true)
						error = false;
					else
					{
						if (arrValidNavis[topNavi] && arrValidNavis[topNavi][subNavi])
							error = false;
					}
				}				
			}				
			if (error)
				currentPage = '#home/';
			else
				currentPage = '#' + topNavi + '/' + subNavi;			
		}		
		
		function navigate(target)
		{
			if( strFlashDefaultPage != location.pathname )
				document.location = strFlashDefaultPage + '#' + target;
			else		
				document.location.hash = '#' + target;
					
			followHash();
			switchFlash();
		}
		
		var toHide = false;
		var toUnHover = false;
		var toUnHoverSub = false;
		function followHash()
		{
			checkCurrentPageValidty();							
			var topNavi = currentPage.substr( 1,currentPage.indexOf( '/' ) - 1);
			var subNavi = currentPage.substr( currentPage.indexOf( '/' ) + 1);
			
			if (toHide)
			{
				toHide.style.display = 'none';
				toHide = false;
			}			
			if (toUnHover)
			{
				var t = toUnHover;
				toUnHover = false;
				hoverOut(t);				
			}
			if (toUnHoverSub)
			{
				var t = toUnHoverSub;
				toUnHoverSub = false;
				hoverOut(t);		
			}
			var el = document.getElementById( 'fill_' + topNavi);
			if (el)
			{								
				toHide = el;
				el.style.display = 'inline';								
			}						
			
			el = document.getElementById( 'navi_' + topNavi);
			if (el)
			{
				doHover(el);
				toUnHover = el;
			}
			
			el = document.getElementById('navi_' + topNavi + subNavi);
			if (el)
			{
				doHover(el);
				toUnHoverSub = el;
			}
			
		}
		
		function hoverOut( objNavi )
		{
			objNavi.className = '';
		}	
			
		function doHover( objNavi )
		{
			objNavi.className = 'act';
		}		

		function switchFlash()		
		{
			checkCurrentPageValidty();							
			var topNavi = currentPage.substr( 1, currentPage.indexOf( '/' ) - 1 );
			var subNavi = currentPage.substr( currentPage.indexOf( '/' ) + 1 );
			var el = document.getElementById( 'flashContainer' );
			var strFlashName;		
			if( el )
			{	
				strFlashName = ( !subNavi ) ?  '0' : arrFlashNames[ topNavi ][ subNavi ];
				
				var flashFile = 'flash/' + strFlashName + '.swf';
			
				var so = new SWFObject ( flashFile, "movie", "996", "315", "7", "#FFFFFF" );
				so.addParam( "wmode", "transparent");
				so.addParam( "base", "flash/");
				so.write(el);
			}
		}
		
		var naviToHide = new Array();
		function ShowSubNavi( strSubNaviId )
		{
			document.getElementById( strSubNaviId ).style.display = 'inline';
			naviToHide [ strSubNaviId ] = false;
			document.getElementById( strSubNaviId ); 
		}
		
		function preventNaviHide ( strSubNaviId )
		{
			naviToHide [ strSubNaviId ] = false;
		}
		
		function HideSubNavi( strSubNaviId )
		{
			naviToHide[ strSubNaviId ] = true;
			window.setTimeout( doHideNavis, 50 );
		}
		
		function doHideNavis()
		{
			for ( var e in naviToHide )				
			{
				if ( 
						( naviToHide[ e ] ) &&
						( e != toHide.id )
					)
					document.getElementById( e ).style.display = 'none';
			}

		}		

		function SetPageHeight()
		{
			var winH;
			if (self.innerWidth)					  
				  winH = self.innerHeight;
			 else if (document.documentElement && document.documentElement.clientHeight)
				  winH = document.documentElement.clientHeight;
			 else if (document.body)					  
				  winH = document.body.clientHeight;

			document.getElementById( 'page' ).style.height = winH + 'px';
			document.getElementById( 'PageContainer' ).style.height = winH + 'px';	
		}
