    //CONST
    PAGE_WIDTH = 960;
    
    origTitle = document.title;
    
    function setAnchor(a){
		var myURL = new String(document.location);
		myURL = myURL.split('#')[0] + '#' + a;;
		var newTitle = origTitle.split('-')[0] + ' - ' + a.split('/').join(' - ');
		if (document.location != myURL){
    		document.location  = myURL;
    		document.title = newTitle;
    	}
	}	

	/* To Catch FSCommand. Use this for IE because it is bugged. */
	
	var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;

	// Handle all the the FSCommand messages in a Flash movie
	function myFlash_DoFSCommand(command, args) {
	 	var FSCommandObj = InternetExplorer ?  myFlash : document.myFlash;
		if(command=="setAnchor") setAnchor(args)
		if(command=="GetMyURL") GetMyURL(args)
	}
	
	// Hook for Internet Explorer 
	if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1){
		document.write('<'+'SCRIPT LANGUAGE=VBScript\> \n');
		document.write('on error resume next \n');
		document.write('Sub myFlash_FSCommand(ByVal command, ByVal args)\n');
		document.write('	call myFlash_DoFSCommand(command, args)\n');
		document.write('end sub\n');
		document.write('<'+'/SCRIPT\> \n');
    }
    
    function getAnchor(){
       var a = new String(document.location).split("#")[1];
	   var anchor = a==undefined ? '' : a;
	   return anchor;
    }
    
    function hasAnchor(){
		if (new String(document.location).split('#')[1] != undefined)
		    return true;
        return false;
	}
	
	function HideHTMLDiv(){
	     HideDiv(GetHTMLDiv());
    }
    
    function ShowHTMLDiv(){
	     ShowDiv(GetHTMLDiv());
    }
    
    function HideFlashDiv(){
	     HideDiv(GetFlashDiv());
    }
    
    function ShowFlashDiv(){
	     ShowDiv(GetFlashDiv());
    }
    	
	function HideContainerDiv(){
	     HideDiv(GetContainerDiv());
    }
    
    function ShowContainerDiv(){
	     ShowDiv(GetContainerDiv());
    }
    
	function HideDiv(div){
	    if (div!=undefined)
	        div.style.visibility = 'hidden';
	}
	
	function ShowDiv(div){
	    if (div!=undefined)
    	    div.style.visibility = 'visible';
	}
	
    function GetMyURL(variableName){
        var movie = GetFlashMovie();
        //setFlashVariable(movie,variableName, new String(document.location));
        //we are going to set gotoAnchor directly now, for mozilla
        setFlashVariable(movie,'gotoAnchor', getAnchor());
    }
    
    function GetFlashMovie() {
        return document.getElementById('myFlash');
    }
    
    function GetFlashDiv(){
       return document.getElementById('flashDiv');
    }
    
    function GetHTMLDiv(){
       return document.getElementById('htmlDiv');
    }
    
    function GetContainerDiv(){
       return document.getElementById('containerDiv');
    }
        
    function MoveFlashToTop(){
        GetFlashDiv().style.zIndex = '200';
    }
    
    function MoveFlashToBack(){
        GetFlashDiv().style.zIndex = '0';
    }
    
    function CenterContainerDiv(){
        //center in big browser, or snap to left edge if small
        if(document.body.clientWidth > PAGE_WIDTH){
            GetContainerDiv().style.marginLeft = ((document.body.clientWidth/2)-(PAGE_WIDTH/2) + 8 ) + "px";
        } else {
            GetContainerDiv().style.marginLeft = 0;  
        }
        
        //prevent scrolling with browser is big enough to display whole page
        if (document.body.clientWidth < PAGE_WIDTH-10){
            document.body.scroll='auto'
        } else {   
            document.body.scroll='no'
        }
    }

    function checkBrowser(){
        //if (navigator.appName=="Netscape"){
            CenterContainerDiv();
        //   }        
    }
    
    function MaximizeBrowser(){
        //window.moveTo(0,0)
        //window.resizeTo(screen.width,screen.height)
        //safari
        //self.resizeTo(screen.availWidth,screen.availHeight);

        window.moveTo(0,0);
        window.resizeTo(screen.availWidth,screen.availHeight);
        /*
        if (document.all) {
            window.resizeTo(screen.availWidth,screen.availHeight);

        } else if (document.layers||document.getElementById) {
            if (window.outerHeight < screen.availHeight||window.outerWidth < screen.availWidth){
                window.outerHeight = screen.availHeight;
                window.outerWidth = screen.availWidth;
            }
        }*/
        
    }
    
    //MaximizeBrowser();
    
    function PageOnLoad(){
        checkBrowser();
        ShowContainerDiv();
        ShowFlashDiv()   
        if (!hasAnchor())
            ShowHTMLDiv();
    }
