/*
     I n d e x P a n e l
     ===================
*/
var W_Width, W_Height,
    mousestate=0,
    ctrlKeystate=0,
    rootObj,
    imgfocusX=0,imgfocusY=0,
    zoomfocusX=0, zoomfocusY=0,
    zoomfX=.5, zoomfY=.5,
    FramBorder=0, c=0,
    curtainfactor=1., curtainfade=0;

function DynImage()
    {        this.index = 0;
             this.path = null;
             this.strt = 0;
             this.end = 0;
             this.count = 0;
             this.display_width = 0;
             this.display_height = 0;
             this.naturalWidth = 0;
             this.naturalHeight = 0;
             this.name = null;
             this.initial = 0;
             this.title = null;
             this.Preview = null;
    }
    
function ButRange()
{
             this.top = 0;
             this.mid = 0;
             this.bot = 0;
             this.HighlightText = null;
             this.Presentation = 0;
}


function MyRootObjects()
   {
             this.xmlDoc = null;
             this.StartupScreen0 = null;
             this.MenueLayer0 = null;
             this.MenueElementLayer = new Array;
             this.ViewWin = null;
             this.ViewerLayer0 = null;
             this.teilung = 122;
             this.NavigationCover = null;
             this.VFrame = null;
             this.VFrameLayer = null;
             this.MFrame = null;
             this.MFrameShadowB = null;
             this.MFrameShadowR = null;
             this.MFrameShadowT = null;
             this.MFrameShadowL = null;
             this.MFrameSchadowBox = null;
             this.MFrameShadowBm = null;
             this.MFrameClose = null;
             this.MFrameBorder = null;
             this.Curtain = null;
             this.IntroCurLeftButA = null;
             this.ICurLeftButACont = null;
             this.ICurLeftButALCont = null;
             this.IntroCurLeftButB = null;
             this.ICurLeftButBCont = null;
             this.ICurLeftButBLCont = null;
             this.IntroCurLeftButC = null;
             this.ICurLeftButCCont = null;
             this.ICurLeftButCLCont = null;
             this.IntroCurLeftButD = null;
             this.ICurLeftButDCont = null;
             this.ICurLeftButDLCont = null;
             this.IntroCurLeftButE = null;
             this.ICurLeftButECont = null;
             this.ICurLeftButELCont = null;
             this.CurtainStepCounter = 0;
             this.CurtainStepsR = new Array;
             this.CurtainStepsCount = 0;
             this.CurtainStepsL = new Array; 
             this.CurtainStepsO = new Array; 
             this.Curtaincontainer = new Array;
             this.IntroTextContainer = null;
             this.IntroCurtainLeftText = null;
             this.IntroCurtainRightText = null;
             this.IntroCurtainLeftLayer = new Array;
             this.IntroCurtainRightLayer = new Array;
             this.IntroCurtainLeftContainer = new Array;
             this.ButtonArray = null;
             this.ButtonRange = null;
             this.ReturnButD = null;
             this.ReturnButtonLayerMap = new Array;
             this.ReturnButDLCont = null;
             this.ReturnButDdivisor = 3;
             this.ActiveButton = null;
             this.ActiveButtonHL = null;
             this.SelectedLink = null;
             this.ReturnBut = null;
             this.MRStein = null;
             this.MSkulpt = null;
             this.MBilder = null;
             this.MFotos = null;
             this.TextLinks = null;
             this.InfoWindowFlag = 0;
             this.LoadTime = null;
             this.RequestPresentation = 0;
             this.HelpAnim = null;
             this.HelptextAnim = null;
    }



var RootObj = new MyRootObjects;

var CntrlObj = new MyCntrlObj;

var UBC, UBCev;


function StartMenuWindow()
{
        var MyWidth, MyHeight, UBX, URLString, Cmnd,
            VSize, Smargin, iW, iH, indx, CmndList, 
            MyObj, Mydoc, mytime;

		
        RootObj.LoadTime = new LoadPerformance();
        
        Mydoc = document;
        BrowserDetect.init();
        UBC = new UniBrowserCode( BrowserDetect, 
								document.getElementById( "Background" ), 
											       document.documentElement );
        CntrlObj.UBC = UBC;
        
        MyWidth=UBC.getInnerWidth( window );
        MyHeight=UBC.getInnerHeight( window );
        
        UrlString = window.location.href;
        CntrlObj.UrlRequest = new ParseParameter( UrlString );
        
        CntrlObj.ActiveInfoItem = "Navigation.html";
        
        
        if ( UBC.browserdata.browser == "Firefox" )
        {
             MyObj=document.getElementById( "ICurtain0");
             MyObj.style.left="88px";
        }
        
        CntrlObj.Index = this;
        this.MyHistoryStart = history.length - 1;
        
        RootObj.ButtonArray = new Array;
        RootObj.ButtonRange = new Array;
        RootObj.ButtonRange[0] = new ButRange;
        RootObj.ButtonRange[1] = new ButRange;
        RootObj.ButtonRange[2] = new ButRange;
        RootObj.ButtonRange[3] = new ButRange;
        RootObj.ButtonRange[4] = new ButRange; 
        RootObj.ButtonRange[5] = new ButRange;
        
        RootObj.Curtain = document.getElementById( "Curtain");
        RootObj.Curtaincontainer[0] = document.getElementById( "CurtainContainerA");
        RootObj.Curtaincontainer[1] = document.getElementById( "CurtainContainerB");
        
        RootObj.VFrame = document.getElementById( "VFrame");
        CntrlObj.VFrame = RootObj.VFrame;
        RootObj.StartupScreen0 = document.getElementById( "StartupScreen0");
        UBC.setStyleOpacity( RootObj.StartupScreen0, 1. );
        
        RootObj.NavigationCover = document.getElementById( "NavigationCover" );
        
        RootObj.MRStein = document.getElementById("Profil");
        RootObj.MSkulpt = document.getElementById("Skulpt");
        RootObj.MBilder  = document.getElementById("Bilder");
        RootObj.MFotos = document.getElementById("Fotos");

        RootObj.MFrame = document.getElementById("MFrame");
        RootObj.MFrame.LocalCntrlObj = CntrlObj;
        RootObj.MFrame.MyLayer = document.getElementById("MFrameLayer");
        RootObj.MFrame.MyContainer = document.getElementById("MFrameContainer");
        RootObj.MFrame.MyLayerCover = document.getElementById("MFrameLayerCover");
        RootObj.MFrame.MyFadeCover = document.getElementById("MFrameFadeCover");
        RootObj.MFrame.MyDecoration = document.getElementById("MFrameDecoration");
       
        RootObj.MFrameShadowB = document.getElementById("MFrameShadowB");
        RootObj.MFrameShadowR = document.getElementById("MFrameShadowR");
        RootObj.MFrameShadowT = document.getElementById("MFrameShadowT");
        RootObj.MFrameShadowL = document.getElementById("MFrameShadowL");
        RootObj.MFrameSchadowBox = document.getElementById("MFrameSchadowBox");
        RootObj.MFrameShadowBm = document.getElementById("MFrameShadowBm");
        RootObj.MFrameBorder = document.getElementById("MFrameBorder");
        RootObj.MFrameClose = document.getElementById("MFrameClose");
        RootObj.TextLinks = document.getElementById("MyTextLinks");
        RootObj.TextLinks.visibility = "hidden";
        RootObj.TextLinks.zIndex = 0;
       
               
        RootObj.VFrameLayer = document.getElementById("VFrameLayer");
       
        if ( UBC.browserdata.family == "Mozilla" )
        {
            window.scrollbars.visible=false;
        }
        else if ( UBC.browserdata.family == "MSIE" )
        {
            document.onselectstart = function() { return false; };
            
            if ( UBC.browserdata.version < 8 )
            {
			             document.getElementsByTagName('html')[0].style.overflow = 'hidden';
			      
			             correctPng( "ICurLeftButA" );
			             correctPng( "ICurLeftButAL");
                         correctPng( "ICurLeftButB");
			             correctPng( "ICurLeftButBL");
			             correctPng( "ICurLeftButC");
			             correctPng( "ICurLeftButCL");
			             correctPng( "ICurLeftButD");
			             correctPng( "ICurLeftButDL");
			             correctPng( "ReturnButDImg");
			             correctPng( "ReturnButDL" );
			             correctPng( "ReturnButDBgr");
			             //correctPngDivBackground( "MFrameShadowRm" );
			             //correctPngDivBackground( "MFrameShadowRt" );
			             //correctPngDivBackground( "MFrameShadowBr" );
			             //correctPngDivBackground( "MFrameShadowBl" );
			             //correctPngDivBackground( "MFrameShadowLm" );
			             //correctPngDivBackground( "MFrameShadowLt" );
			             //correctPngDivBackground( "MFrameShadowTm" );
			              
            }
	    }
	    else
	    {
		        document.body.style.overflow = 'hidden';
		}
		
		SetNativeImageWidth( "IntroCurtainLeftA" ); 
        SetNativeImageWidth( "IntroCurtainRightA" ); 
        SetNativeImageWidth( "IRSteinText" ); 
        SetNativeImageWidth( "ISkulptText" ); 
        SetNativeImageWidth( "IBilderText" ); 
        SetNativeImageWidth( "IFotosText" ); 
        SetNativeImageWidth( "IPraesentationText" ); 
        SetNativeImageWidth( "IRSteinTextHL" ); 
        SetNativeImageWidth( "ISkulptTextHL" ); 
        SetNativeImageWidth( "IBilderTextHL" ); 
        SetNativeImageWidth( "IFotosTextHL" ); 
        SetNativeImageWidth( "IPraesentationTextKurzHL" );
        SetNativeImageWidth( "IPraesentationTextLangHL" );
        
            
        RootObj.IMHighLight = document.getElementById("IMHighLight");
		  
        PositionStartCurtain();     
        
        RootObj.Curtaincontainer[0].style.visibility = "visible";
        RootObj.Curtaincontainer[1].style.visibility = "hidden";
        RootObj.IntroTextContainer.style.visibility = "visible";
        
        RootObj.MFrame.MyLayer.style.visibility = "hidden";
        RootObj.MFrame.MyDecoration.style.visibility = "hidden";  
        UBC.setStyleOpacity( RootObj.MFrame.MyLayer, 0.01 );
        UBC.setStyleOpacity( RootObj.MFrame.MyDecoration, 0.01 );
        UBC.setStyleOpacity( RootObj.MFrame.MyLayerCover, 0.2 );
        UBC.setStyleOpacity( RootObj.MFrameBorder, 1 );
        UBC.setStyleOpacity( RootObj.MFrameSchadowBox, 0.7 );
        UBC.setStyleOpacity( RootObj.MFrameShadowB, 0.7 );
        UBC.setStyleOpacity( RootObj.MFrameShadowR, 0.7 );
        UBC.setStyleOpacity( RootObj.MFrameShadowL, 0.7 );
        UBC.setStyleOpacity( RootObj.MFrameShadowT, 0.7 );
        UBC.setStyleOpacity( RootObj.NavigationCover, 1. );
        
        RootObj.MFrame.Viewer_ButtonState = 0;
        /*createConsole();
        showConsole();*/
        
        RootObj.TextLinks.visibility = "hidden";
        RootObj.TextLinks.zIndex = 0;
        
        mytime=setTimeout('fadeInStart( )',1000 );
}

function SetNativeImageWidth( imagename )
{
        var MyObj, iw, ih;
        
        MyObj = document.getElementById( imagename );
        iW =  UBC.getNaturalWidth( MyObj );
        UBC.setNativeWidth( MyObj, iW );
        iH = UBC.getNaturalHeight( MyObj );
        UBC.setNativeHeight( MyObj, iH );
}


function ScaleImage( imagename, fact )
{
        var MyObj, iw, ih;
        
        MyObj = document.getElementById( imagename );
        iW =  UBC.getNativeWidth( MyObj );
        UBC.setImageWidth( MyObj, iW * fact );
        iH = UBC.getNativeHeight( MyObj );
        UBC.setImageHeight( MyObj, iH * fact );
}

function StartCurtainEventListeners()
{
        var time;
        
        UBC.addEventListener( window, 'resize', MyResize, true);
        UBC.addEventListener( document.documentElement, 'mousedown', MyMouseDown, true);
        UBC.addEventListener( document.documentElement, 'mousemove', MyMouseMove, false);
}

function StartInnerEventListeners()
{
        UBC.addEventListener( RootObj.ReturnButD, 'mousedown', MyMouseDownInnerButton, true);
        UBC.addEventListener( RootObj.ReturnButD, 'mouseout', MyMouseOutBut, true);
        UBC.addEventListener( RootObj.ReturnButD, 'mousemove', MyMouseMoveBut, false);
        
        UBC.addEventListener( RootObj.MRStein, 'select', MyDoNothing, false);
        UBC.addEventListener( RootObj.MBilder, 'select', MyDoNothing, false);
        UBC.addEventListener( RootObj.MFotos, 'select', MyDoNothing, false);
        UBC.addEventListener( RootObj.MSkulpt, 'select', MyDoNothing, false);
        
}


function StopCurtainEventListeners()
{
        UBC.removeEventListener( document.documentElement, 'mousedown', MyMouseDown, true);
        UBC.removeEventListener( document.documentElement, 'mousemove', MyMouseMove, false);

}

function StopInnerEventListeners()
{
        UBC.removeEventListener( RootObj.ReturnButD, 'mousedown', MyMouseDownInnerButton, true);
        UBC.removeEventListener( RootObj.ReturnButD, 'mouseout', MyMouseOutBut, true);
        UBC.removeEventListener( RootObj.ReturnButD, 'mousemove', MyMouseMoveBut, true);
        
        UBC.removeEventListener( RootObj.MRStein, 'select', MyDoNothing, true);
        UBC.removeEventListener( RootObj.MBilder, 'select', MyDoNothing, true);
        UBC.removeEventListener( RootObj.MFotos, 'select', MyDoNothing, true);
        UBC.removeEventListener( RootObj.MSkulpt, 'select', MyDoNothing, true);
}        

function fadeInStart()
{
       var MyObj, opacity, time;

       MyObj = RootObj.StartupScreen0;
       
       opacity = UBC.getStyleOpacity( MyObj ) - .06;
       
       CntrlObj.Index_ReadyFlag = 1;
       
       if ( opacity > 0. )
       {
             UBC.setStyleOpacity( MyObj, opacity );
             mytime=setTimeout('fadeInStart()',20 );
       }
       else
       {
              MyObj.style.visibility = "hidden"; 
              MyObj.style.zIndex = 1;
              UBC.setStyleOpacity( MyObj, 1. );
              
              CntrlObj.MainLoadTime = RootObj.LoadTime.EndTest();
              
              if ( CntrlObj.UrlRequest.FrameCmd )
              {     
                    UBC.addEventListener( window, 'resize', MyResize, true);
                    
                    RootObj.SelectedLink = CntrlObj.UrlRequest.FrameCmd;
                    RootObj.VFrame.LocalCntrlObj = CntrlObj;
                    CntrlObj.BackButtonFlag = false;
                    RootObj.VFrame.src = RootObj.SelectedLink;
       
                    CntrlObj.Panel_ReadyFlag = 0;
        
                    StopCurtainEventListeners();
        
                    WaitForPanelReady( 2 );
              }
              else
                    StartCurtainEventListeners();
       }
}




function fadeObject( MyObjName, zIndex, mode, endfunc )
{
       var MyObj, opacity;

       MyObj = document.getElementById( MyObjName );
       
       if ( mode == "in" )
       {
           opacity = UBC.getStyleOpacity( MyObj ) - .05;

           if ( opacity > 0. )
           {
               UBC.setStyleOpacity( MyObj, opacity );
               mytime=setTimeout('fadeObject("'+MyObjName+'",'+zIndex+',"'+mode+'","'+endfunc+'")',20 );
           }
           else
           {
               MyObj.style.visibility = "hidden";
               MyObj.style.zIndex = zIndex;
               UBC.setStyleOpacity( MyObj, 0. );
               
               mytime=setTimeout( endfunc, 1 );
           }
       }
       else
       {
           opacity = UBC.getStyleOpacity( MyObj ) + .05;
           
           if ( MyObj.style.visibility == "hidden" )
           {
                MyObj.style.visibility = "visible";
                MyObj.style.zIndex = zIndex;
           }
           
           if ( opacity < 1. )
           {
               UBC.setStyleOpacity( MyObj, opacity );
               
               mytime=setTimeout('fadeObject("'+MyObjName+'",'+zIndex+',"'+mode+'","'+endfunc+'")',20 );
           }
           else
           {

               UBC.setStyleOpacity( MyObj, 1. );
               
               
               mytime=setTimeout( endfunc, 1 );
               /*StartCurtainEventListeners();*/
           }
       }
}


function PositionStartCurtain()
{
        var MyWidth, MyHeight,
            VSize, Smargin, rWidth, rPos, tpos,
            MyObj, MyObjL, fact, tLen, tHeight,
            Iwidth, Iheight, wfw, wfh, wfwF, wfhF, wSld,
            Inatwidth, Inatheight, fw, fh, ft, fl,
            MarginA, MarginB, fRs, fSk, fBi, fFo, fPr,
            teilung, wret;

        
        MyWidth = UBC.getInnerWidth( window );
        MyHeight = UBC.getInnerHeight( window );
        
        if ( UBC.browserdata.family == "MSIE" )
        {
            MyObj = document.getElementById( "Background" );
            MyObj.style.width = MyWidth + "px";
            MyObj.style.height = MyHeight + "px";
        
            MyObj = RootObj.StartupScreen0;
            MyObj.style.width = MyWidth + "px";
            MyObj.style.height = MyHeight + "px";
        }
        
        MarginA = CntrlObj.ViewermarginA;
        MarginB = CntrlObj.ViewermarginB;
        
        teilung = RootObj.teilung;
        
        wfw = MyWidth - MarginA - MarginB;
        if (wfw < 100) wfw = 100;
        wfh = MyHeight - MarginA - MarginB;
        if (wfh < 100) wfh = 100;
        
        fw = MyWidth / 1024; 
        fh = MyHeight / 768;
        fth = Math.sqrt(fh);
        ftw = ( fh < 1. ) ? fth : 1.;
        fl = (MyWidth - teilung) / 1024;
        fl = ( fl > MyHeight / 768 ) ? MyHeight / 768: fl;
        if ( fl < .1 ) fl=.1;
        
        // F R A M E S
        
        wfwF = wfw-MarginA - 3*MarginB;
        wfhF = wfh-MarginA - 3*MarginB;
        
        MyObj = RootObj.MFrame.MyLayer;
        MyObj.style.top = MarginA -1 + "px";
        MyObj.style.left =  MarginA - 1 + "px";
        MyObj.style.width = wfw + 1+ "px";
        MyObj.style.height= wfh + 1 + "px";
        
        MyObj = RootObj.MFrame.MyFadeCover;
        MyObj.style.top = MarginA - 2 + "px";
        MyObj.style.left =  MarginA - 2 + "px";
        MyObj.style.width = wfw - 6 + "px";
        MyObj.style.height= wfh - 6 + "px";
                 
        MyObj = RootObj.MFrame.MyDecoration;
        MyObj.style.top = MarginA -1 + "px";
        MyObj.style.left =  MarginA - 1 + "px";
        MyObj.style.width = wfw + 1+ "px";
        MyObj.style.height= wfh + 1 + "px";      
                                      
        MyObj = RootObj.MFrame.MyContainer;
        MyObj.style.top = .9*MarginA + "px";
        MyObj.style.left =  .9*MarginA + "px";
        MyObj.style.width = wfwF + "px";
        MyObj.style.height= wfhF + "px";
        
        MyObj = RootObj.MFrameBorder;
        MyObj.style.top = .9*MarginA - 1 + "px";
        MyObj.style.left =  .9*MarginA - 1 + "px";
        MyObj.style.width = wfwF  + "px";
        MyObj.style.height= wfhF  + "px";
                                          
        MyObj = RootObj.MFrame.MyLayerCover;
        MyObj.style.top = 0 + "px";
        MyObj.style.left = 0 + "px";
        MyObj.style.width = MyWidth + "px";
        MyObj.style.height= MyHeight + "px";
        
        MyObj = RootObj.MFrameSchadowBox;
        MyObj.style.top = .9*MarginA - 8 + "px";
        MyObj.style.left =  .9*MarginA - 8 + "px";
        MyObj.style.width = wfwF + 20+ "px";
        MyObj.style.height= wfhF + 20 + "px";
        
        MyObj = RootObj.MFrameShadowB;
        MyObj.style.top = (wfhF + 8) +"px";
        MyObj.style.left = 0 +"px";
        MyObj.style.width = wfwF + 20 + "px";
        MyObj.style.height= 12 + "px";
        
        MyObj = RootObj.MFrameShadowBm;
        MyObj.style.width = wfwF - 4 + "px";
        
        MyObj = RootObj.MFrameShadowR;
        MyObj.style.top = 0 +"px";
        MyObj.style.left = 8 + wfwF +"px";
        MyObj.style.width = 12 + "px";
        MyObj.style.height= (wfhF + 8) + "px";
        
        MyObj = RootObj.MFrameShadowL;
        MyObj.style.top = 0 +"px";
        MyObj.style.left = 0 +"px";
        MyObj.style.width = 8 + "px";
        MyObj.style.height= (wfhF) + "px";
        
        MyObj = RootObj.MFrameShadowT;
        MyObj.style.top = 0 +"px";
        MyObj.style.left = 8 +"px";
        MyObj.style.width = wfwF  + "px";
        MyObj.style.height= 8 + "px";
        
        MyObj = RootObj.MFrameClose;
        MyObj.style.top = .9*MarginA - 18 +"px";
        MyObj.style.left = .9*MarginA + wfwF - 32 +"px";

        MyObj = RootObj.MFrame;
        MyObj.top = 0;
        MyObj.left = 0;
        MyObj.width = wfwF;
        MyObj.height= wfhF;
        //RootObj.MFrame.Viewer_ButtonState = 0;
        
        MyObj = RootObj.VFrameLayer; 
        MyObj.style.top = MarginA +"px";
        MyObj.style.left = MarginA +"px";
        MyObj.style.width = wfw + "px";
        MyObj.style.height= wfh + "px";
        
        MyObj = RootObj.VFrame;
        MyObj.top = 0;
        MyObj.left = 0;
        MyObj.width = wfw;
        MyObj.height= wfh;
        
        // N A V I G A T I O N
          
        MyObj =  RootObj.NavigationCover;
        MyObj.top = 0;
        MyObj.left = 0;
        MyObj.style.width = MyWidth + "px";
        MyObj.style.height=  MarginA + "px";
        
        // C U R T A I N
        wfw += 1;
        wfh += 1;
        MyObj = RootObj.Curtain;
        MyObj.style.top = (MarginA) +"px";
        MyObj.style.left =  (MarginA) +"px";
        MyObj.style.width = (wfw) + "px";
        MyObj.style.height= (wfh) + "px";
        MyObj.style.clip = "rect( 0px " + wfw + "px " + wfh + "px " + "0px)";
       
        MyObj = document.getElementById( "IntroCurtainLeftA" );
        
        Inatwidth =  UBC.getNativeWidth( MyObj );
        Inatheight = UBC.getNativeHeight( MyObj );
        
        fact =  wfh / Inatheight;
        
        Iwidth = Math.ceil(Inatwidth * fact) + 1;
        UBC.setImageWidth( MyObj, Iwidth );
        Iheight = Math.ceil(Inatheight * fact);
        UBC.setImageHeight( MyObj, Iheight ) + 1;
        
        
        MyObj = document.getElementById( "IntroCurtainLeftB" );
        UBC.setImageWidth( MyObj, Iwidth );;
        UBC.setImageHeight( MyObj, Iheight );

        MyObj = RootObj.Curtaincontainer[0];
        MyObj.style.width = Iwidth + "px";
        MyObj.style.height = Iheight + "px";
        MyObj.style.left = 0 + "px";
        MyObj.style.top = 0 + "px"; 
        MyObj = RootObj.Curtaincontainer[1];
        MyObj.style.width = Iwidth + "px";
        MyObj.style.height = Iheight + "px";
        MyObj.style.left = 0 + "px";
        MyObj.style.top = 0 + "px"; 
        
        // L E F T
        
        MyObj = document.getElementById( "IntroCurtainLeftContainerA" );
        RootObj.IntroCurtainLeftContainer[0] = MyObj;
        MyObj.style.width = Iwidth + "px";
        MyObj.style.height = Iheight + "px";
        MyObj.style.left = 0 + "px";
        MyObj.style.top = 0 + "px";
        MyObj.oncontextmenu = MyDoNothing;
         
        MyObj = document.getElementById( "IntroCurtainLeftContainerB" );
        RootObj.IntroCurtainLeftContainer[1] = MyObj;
        MyObj.style.width = Iwidth + "px";
        MyObj.style.height = Iheight + "px";
        MyObj.style.left = 0 + "px";
        MyObj.style.top = 0 + "px";
        MyObj.oncontextmenu = MyDoNothing;
        
        MyObj = document.getElementById( "IntroCurtainLeftBGA" );
        MyObj.style.width = (teilung + 4) + "px";
        MyObj.style.height = Iheight + "px";
        MyObj.style.left = ( - teilung)+ "px";
        MyObj.oncontextmenu = MyDoNothing;
        MyObj = document.getElementById( "IntroCurtainLeftBGB" );
        MyObj.style.width = (teilung + 4) + "px";
        MyObj.style.height = Iheight + "px";
        MyObj.style.left = ( - teilung)+ "px";
        MyObj.oncontextmenu = MyDoNothing;

        MyObj = document.getElementById("IntroCurtainLeftLayerA");
        RootObj.IntroCurtainLeftLayer[0] = MyObj;
        MyObj.style.width = (teilung + Iwidth) +"px";
        MyObj.style.height= Iheight + "px";
        MyObj.style.left = teilung + "px";
        MyObj.oncontextmenu = MyDoNothing;
        MyObj = document.getElementById("IntroCurtainLeftLayerB");
        RootObj.IntroCurtainLeftLayer[1] = MyObj;
        MyObj.style.width = (teilung + Iwidth) +"px";
        MyObj.style.height= Iheight + "px";
        MyObj.style.left = teilung + "px";
        MyObj.oncontextmenu = MyDoNothing;
        
        // R I G H T
        
        MyObj = document.getElementById( "IntroCurtainRightA" );
        
        Inatwidth =  UBC.getNativeWidth( MyObj );
        Inatheight = UBC.getNativeHeight( MyObj );

        fact =  wfh / Inatheight;
        teilung = RootObj.teilung;
        
        Iwidth = Math.ceil(Inatwidth * fact) + 1;
        UBC.setImageWidth( MyObj, Iwidth );
        Iheight = Math.ceil(Inatheight * fact) + 1;
        
        UBC.setImageHeight( MyObj, Iheight );
        UBC.setImageWidth( MyObj, Iwidth );
        UBC.setImageHeight( MyObj, Iheight );
        MyObj.oncontextmenu = MyDoNothing;
        MyObj = document.getElementById( "IntroCurtainRightB" );
        UBC.setImageWidth( MyObj, Iwidth );
        UBC.setImageHeight( MyObj, Iheight );
        MyObj.oncontextmenu = MyDoNothing;
        
        MyObj = document.getElementById("IntroCurtainRightLayerA");
        RootObj.IntroCurtainRightLayer[0] = MyObj;
        MyObj.style.width = (MyWidth - teilung ) + "px";
        MyObj.style.height= Iheight + "px";
        MyObj.style.left = teilung +"px";
        MyObj.style.top = 0 + "px";
        MyObj.oncontextmenu = MyDoNothing; 
        MyObj = document.getElementById("IntroCurtainRightLayerB");
        RootObj.IntroCurtainRightLayer[1] = MyObj;
        MyObj.style.width = (MyWidth - teilung ) + "px";
        MyObj.style.height= Iheight + "px";
        MyObj.style.left = teilung +"px";
        MyObj.style.top = 0 + "px";
        MyObj.oncontextmenu = MyDoNothing; 
        
        MyObj = document.getElementById( "IntroCurtainRightContainerA" );
        MyObj.style.width = Iwidth + "px";
        MyObj.style.height = Iheight + "px";
        MyObj.style.left = 0 + "px";
        MyObj.style.top = 0 + "px";
        MyObj.oncontextmenu = MyDoNothing;
        MyObj = document.getElementById( "IntroCurtainRightContainerB" );
        MyObj.style.width = Iwidth + "px";
        MyObj.style.height = Iheight + "px";
        MyObj.style.left = 0 + "px";
        MyObj.style.top = 0 + "px";
        MyObj.oncontextmenu = MyDoNothing; 

        MyObj = document.getElementById( "IntroCurtainRightBGA" );
        rWidth = wfw - teilung - (Iwidth - 8);
        if ( rWidth < 30 ) rWidth = 30;
        MyObj.style.width = (rWidth) + "px";
        MyObj.style.height = Iheight + "px";
        MyObj.oncontextmenu = MyDoNothing;
        if ( UBC.browserdata.family == "MSIE" )
        {
           /*MyObj.style.background ="#C6C6C6";*/
            MyObj.style.left = (Iwidth) + "px";
        }
        else
           MyObj.style.left = (Iwidth-2) + "px";
           
        MyObj = document.getElementById( "IntroCurtainRightBGB" );
        MyObj.style.width = (rWidth) + "px";
        MyObj.style.height = Iheight + "px";
        MyObj.oncontextmenu = MyDoNothing;
        if ( UBC.browserdata.family == "MSIE" )
        {
            /*MyObj.style.background ="#C6C6C6";*/
            MyObj.style.left = (Iwidth) + "px";
        } 
        else
            MyObj.style.left = (Iwidth-2) + "px";
        
        // T E X T  &  A U G E N
        
        MyObj = document.getElementById( "IntroTextContainer" );
        RootObj.IntroTextContainer = MyObj;
        MyObj.style.width = wfw + "px";
        MyObj.style.height = wfh + "px";
        MyObj.style.left = 0 + "px";
        MyObj.style.top = 0 + "px";
        UBC.setStyleOpacity( MyObj, 1. );
        MyObj.oncontextmenu = MyDoNothing;
        
        MyObj = document.getElementById("IntroCurtainLeftText");
        RootObj.IntroTextLeftContainer = MyObj;
        MyObj.style.width = (teilung + Iwidth) +"px";
        MyObj.style.height= Iheight + "px";
        MyObj.style.left = teilung + "px";
        MyObj.oncontextmenu = MyDoNothing;
        
        
        RootObj.IntroCurLeftButA = EyePosition( -70 * ftw, (wfh * .36 - fh * 25), 95 * ftw, fth * 55, 
                                    "IntroCurLeftButA", "ICurLeftButA", "ICurLeftButAL", 0 );
        
        RootObj.ICurLeftButACont = document.getElementById("ICurLeftButACont");
        RootObj.ICurLeftButALCont = document.getElementById("ICurLeftButALCont");
        RootObj.IntroCurLeftButA.HighLight =  RootObj.ICurLeftButALCont;
        RootObj.IntroCurLeftButA.NormalBut = RootObj.ICurLeftButACont;
        RootObj.IntroCurLeftButA.MyLinkSrc = "RalfenSteinViewerPanel.html";
        RootObj.IntroCurLeftButA.InfoItem = "H-Kunst.html";

        
        RootObj.IntroCurLeftButB = EyePosition( -120 * ftw, (wfh * .525 - fh * 35), 140 * ftw, fth * 70,
                                      "IntroCurLeftButB", "ICurLeftButB", "ICurLeftButBL", 1 )
        
        RootObj.ICurLeftButBCont = document.getElementById("ICurLeftButBCont");
        RootObj.ICurLeftButBLCont = document.getElementById("ICurLeftButBLCont");
        RootObj.IntroCurLeftButB.HighLight =  RootObj.ICurLeftButBLCont;
        RootObj.IntroCurLeftButB.NormalBut = RootObj.ICurLeftButBCont;
        RootObj.IntroCurLeftButB.MyLinkSrc = "SculptureViewerPanel.html";
        RootObj.IntroCurLeftButB.InfoItem = "H-Skulpturen.html";
       
        
        RootObj.IntroCurLeftButC = EyePosition( -80 * ftw, (wfh * .680 - fh * 30 ), 90 * ftw, fth * 50, 
                                      "IntroCurLeftButC", "ICurLeftButC", "ICurLeftButCL", 2 )
        
        RootObj.ICurLeftButCCont = document.getElementById("ICurLeftButCCont");
        RootObj.ICurLeftButCLCont = document.getElementById("ICurLeftButCLCont");
        RootObj.IntroCurLeftButC.HighLight =  RootObj.ICurLeftButCLCont;
        RootObj.IntroCurLeftButC.NormalBut = RootObj.ICurLeftButCCont;
        RootObj.IntroCurLeftButC.MyLinkSrc = "PictureViewerPanel.html";
        RootObj.IntroCurLeftButC.InfoItem = "H-Bilder.html";
        
       
        RootObj.IntroCurLeftButD = EyePosition( -108 * ftw, (wfh * .85 - fh * 50), 95 * ftw, fth * 55, 
                                      "IntroCurLeftButD", "ICurLeftButD", "ICurLeftButDL", 3 )
        
        RootObj.ICurLeftButDCont = document.getElementById("ICurLeftButDCont");
        RootObj.ICurLeftButDLCont = document.getElementById("ICurLeftButDLCont");
        RootObj.IntroCurLeftButD.HighLight =  RootObj.ICurLeftButDLCont;
        RootObj.IntroCurLeftButD.NormalBut = RootObj.ICurLeftButDCont;
        RootObj.IntroCurLeftButD.MyLinkSrc = "FotoViewerPanel.html";
        RootObj.IntroCurLeftButD.InfoItem = "H-Fotografie.html";
        
        
        RootObj.IntroCurLeftButE = EyePosition( -60 * ftw, (wfh * .11 - fh * 25), 75 * ftw, fth * 40, 
                                    "IntroCurLeftButE", "ICurLeftButE", "ICurLeftButEL", 4 );
        
        RootObj.ICurLeftButECont = document.getElementById("ICurLeftButECont");
        RootObj.ICurLeftButELCont = document.getElementById("ICurLeftButELCont");
        RootObj.IntroCurLeftButE.HighLight =  RootObj.ICurLeftButELCont;
        RootObj.IntroCurLeftButE.NormalBut = RootObj.ICurLeftButECont;
        RootObj.IntroCurLeftButE.MyLinkSrc = "SculptureViewerPanel.html";
        RootObj.IntroCurLeftButE.InfoItem = "H-Skulpturen.html";
        RootObj.ButtonArray[5] = RootObj.IntroCurLeftButE;

        fRs = .5 * fl;
        ScaleImage( "IRSteinText", fRs );
        fSk =  fl;
        ScaleImage( "ISkulptText", fSk );
        fBi = .85 * fl;
        ScaleImage( "IBilderText", fBi );
        fFo = .75 * fl;
        ScaleImage( "IFotosText", fFo ); 
        fPr = .7 * fl;
        ScaleImage( "IPraesentationText", fPr );
        ScaleImage( "IRSteinTextHL", fRs );
        ScaleImage( "ISkulptTextHL", fSk );
        ScaleImage( "IBilderTextHL", fBi );
        ScaleImage( "IFotosTextHL", fFo );
        ScaleImage( "IPraesentationTextKurzHL", fPr ); 
        ScaleImage( "IPraesentationTextLangHL", fPr );
        
        
        MyObj = document.getElementById( "IRSteinText" );
        tLen = UBC.getImageWidth( MyObj );
        tHeight = UBC.getImageHeight( MyObj );
        
        MyObj = document.getElementById( "IntroCurtainRightText" );
        rWidth = wfw - teilung - Iwidth;
        if ( rWidth < 30 ) rWidth = 30;
        MyObj.style.width = (rWidth) + "px";
        MyObj.style.height = Iheight + "px";
        rPos = wfw - 2.1 * tLen;
        MyObj.style.left = rPos + "px";
        RootObj.IntroCurtainRightText = MyObj;
        MyObj.oncontextmenu = MyDoNothing;
        
        RootObj.ButtonRange[0].top = RootObj.ButtonRange[0].mid - .7 * tHeight;
        RootObj.ButtonRange[0].bot = RootObj.ButtonRange[0].mid + .7 * tHeight;
        
        MyObj = document.getElementById( "RSteinText" );
        MyObj.style.left = (tLen * .1) + "px";
        MyObj.style.top = (RootObj.ButtonRange[0].mid - CntrlObj.ViewermarginA - tHeight / 2) + "px";
        MyObj.style.width = tLen + "px";
        MyObj.style.height = tHeight + "px";
        MyObj = document.getElementById( "RSteinTextHL" );
        MyObj.style.left = (tLen * .1) + "px";
        MyObj.style.top = (RootObj.ButtonRange[0].mid - CntrlObj.ViewermarginA - tHeight / 2) + "px";
        MyObj.style.width = tLen + "px";
        MyObj.style.height = tHeight + "px";
        RootObj.ButtonRange[0].HighlightText = MyObj;
        UBC.setStyleOpacity( MyObj, .01 );
        
        MyObj = document.getElementById( "ISkulptText" );
        tLen = UBC.getImageWidth( MyObj );
        tHeight = UBC.getImageHeight( MyObj );
        RootObj.ButtonRange[1].top = RootObj.ButtonRange[1].mid - .7 * tHeight;
        RootObj.ButtonRange[1].bot = RootObj.ButtonRange[1].mid + .7 * tHeight;
        
        MyObj = document.getElementById( "SkulptText" );
        MyObj.style.left = (0) + "px";
        MyObj.style.top = (RootObj.ButtonRange[1].mid - CntrlObj.ViewermarginA - tHeight / 2) + "px";
        MyObj.style.width = tLen + "px";
        MyObj.style.height = tHeight + "px";
        MyObj = document.getElementById( "SkulptTextHL" );
        MyObj.style.left = (0) + "px";
        MyObj.style.top = (RootObj.ButtonRange[1].mid - CntrlObj.ViewermarginA - tHeight / 2) + "px";
        MyObj.style.width = tLen + "px";
        MyObj.style.height = tHeight + "px";
        RootObj.ButtonRange[1].HighlightText = MyObj;
        UBC.setStyleOpacity( MyObj, .01 );
        
        MyObj = document.getElementById( "IBilderText" );
        tLen = UBC.getImageWidth( MyObj );
        tHeight = UBC.getImageHeight( MyObj );
        RootObj.ButtonRange[2].top = RootObj.ButtonRange[2].mid - .7 * tHeight;
        RootObj.ButtonRange[2].bot = RootObj.ButtonRange[2].mid + .7 * tHeight;
        
        MyObj = document.getElementById( "BilderText" );
        MyObj.style.left = (tLen * .3) + "px";
        MyObj.style.top = (RootObj.ButtonRange[2].mid - CntrlObj.ViewermarginA - tHeight / 2) + "px";
        MyObj.style.width = tLen + "px";
        MyObj.style.height = tHeight + "px";
        MyObj = document.getElementById( "BilderTextHL" );
        MyObj.style.left = (tLen * .3) + "px";
        MyObj.style.top = (RootObj.ButtonRange[2].mid - CntrlObj.ViewermarginA - tHeight / 2) + "px";
        MyObj.style.width = tLen + "px";
        MyObj.style.height = tHeight + "px";
        RootObj.ButtonRange[2].HighlightText = MyObj;
        UBC.setStyleOpacity( MyObj, .01 );
        
        MyObj = document.getElementById( "IFotosText" );
        tLen = UBC.getImageWidth( MyObj );
        tHeight = UBC.getImageHeight( MyObj );
        RootObj.ButtonRange[3].top = RootObj.ButtonRange[3].mid - .7 * tHeight;
        RootObj.ButtonRange[3].bot = RootObj.ButtonRange[3].mid + .7 * tHeight;
        
        MyObj = document.getElementById( "FotosText" );
        MyObj.style.left = (tLen * .2) + "px";
        MyObj.style.top = (RootObj.ButtonRange[3].mid - CntrlObj.ViewermarginA - tHeight / 2) + "px";
        MyObj.style.width = tLen + "px";
        MyObj.style.height = tHeight + "px";
        MyObj = document.getElementById( "FotosTextHL" );
        MyObj.style.left = (tLen * .2) + "px";
        MyObj.style.top = (RootObj.ButtonRange[3].mid - CntrlObj.ViewermarginA - tHeight / 2) + "px";
        MyObj.style.width = tLen + "px";
        MyObj.style.height = tHeight + "px";
        RootObj.ButtonRange[3].HighlightText = MyObj;
        UBC.setStyleOpacity( MyObj, .01 );
        
        MyObj = document.getElementById( "IPraesentationText" );
        tLen = UBC.getImageWidth( MyObj );
        tHeight = UBC.getImageHeight( MyObj );
        RootObj.ButtonRange[4].top = RootObj.ButtonRange[4].mid -  tHeight;
        RootObj.ButtonRange[4].bot = RootObj.ButtonRange[4].mid -2;
        RootObj.ButtonRange[4].Presentation = 1;
        RootObj.ButtonRange[5].top = RootObj.ButtonRange[4].mid +2;
        RootObj.ButtonRange[5].bot = RootObj.ButtonRange[4].mid +  tHeight;
        RootObj.ButtonRange[5].Presentation = 2;
        RootObj.ButtonRange[4].mid = ( RootObj.ButtonRange[4].top + RootObj.ButtonRange[4].bot) /2;
        RootObj.ButtonRange[5].mid = ( RootObj.ButtonRange[5].top + RootObj.ButtonRange[5].bot) /2;
        
        MyObj = document.getElementById( "PraesentationText" );
        MyObj.style.left = (tLen * .2) + "px";
        tpos = RootObj.ButtonRange[4].bot - CntrlObj.ViewermarginA - tHeight / 2;
        MyObj.style.top = tpos + "px";
        MyObj.style.width = tLen + "px";
        MyObj.style.height = tHeight + "px";
        MyObj = document.getElementById( "PraesentationTextKurzHL" );
        MyObj.style.left = (tLen * .2) + "px";
        MyObj.style.top = tpos + "px";
        MyObj.style.width = tLen + "px";
        MyObj.style.height = tHeight + "px";
        RootObj.ButtonRange[4].HighlightText = MyObj;
        UBC.setStyleOpacity( MyObj, .01 );
        MyObj = document.getElementById( "PraesentationTextLangHL" );
        MyObj.style.left = (tLen * .2) + "px";
        MyObj.style.top = tpos + "px";
        MyObj.style.width = tLen + "px";
        MyObj.style.height = tHeight + "px";
        RootObj.ButtonRange[5].HighlightText = MyObj;
        UBC.setStyleOpacity( MyObj, .01 );
        
        // P R E S E N T A T I O N  A B F R A G E
        /*
        MyObj = document.getElementById( "DebugBorder1" );
        
        MyObj.style.top = RootObj.ButtonRange[4].top + "px";
        MyObj.style.height = RootObj.ButtonRange[4].bot  - RootObj.ButtonRange[4].top + "px";
        
        MyObj = document.getElementById( "DebugBorder2" );
        
        MyObj.style.top = RootObj.ButtonRange[5].top + "px";
        MyObj.style.height = RootObj.ButtonRange[5].bot  - RootObj.ButtonRange[5].top + "px";
        */
        RootObj.RequestPresentation = 0;
        
        // R E T U R N  B U T T O N
        
        RootObj.ReturnButDImg = document.getElementById("ReturnButDImg");
        wret = UBC.getImageWidth( RootObj.ReturnButDImg );
        MyObj = document.getElementById("ReturnBut");
        RootObj.ReturnButD = MyObj;
        MyObj.style.top = 0 +"px";
        MyObj.style.left = (MyWidth - MarginB - wret) +"px";
        
        MyObj = document.getElementById("ReturnButDLCont");
        RootObj.ReturnButDLCont = MyObj;
        MyObj.style.visibility = "hidden";
        /*
        MyObj = document.getElementById("HelpAnim");
        RootObj.HelpAnim = MyObj;
        MyObj.style.top = (MyHeight - 284 + 8 ) +"px";
        MyObj.style.left = (MyWidth - 325 + 12 - 105) +"px";
        
        MyObj = document.getElementById("HelpAnimT");
        RootObj.HelpAnim = MyObj;
        MyObj.style.top = ( - 13 ) +"px";
        MyObj.style.left = (MyWidth - 325 + 12 - 79) +"px";
        
        MyObj = document.getElementById("HelpTextContainerT");
        MyObj.style.top = (MyHeight - 284 + 8 - 200) +"px";
        MyObj.style.left = (MyWidth - 325 + 12 - 105 - 260) +"px";
        
        MyObj = document.getElementById("HelpTextContainerB");
        MyObj.style.top = (MyHeight - 284 + 8 - 200) +"px";
        MyObj.style.left = (MyWidth - 325 + 12 - 105 - 260) +"px";
        */
        
        wz = wret /  RootObj.ReturnButDdivisor;
        for ( indx = 0; indx <= RootObj.ReturnButDdivisor; indx++)
                   RootObj.ReturnButtonLayerMap[indx] = wz * indx;

        MyObj = RootObj.MRStein;
        MyObj.MyLinkSrc = "RalfenSteinViewerPanel.html";
        MyObj.InfoItem = "H-Kunst.html";

        MyObj = RootObj.MSkulpt;
        MyObj.MyLinkSrc = "SculptureViewerPanel.html";
        MyObj.InfoItem = "H-Skulpturen.html";

        MyObj = RootObj.MBilder;
        MyObj.MyLinkSrc = "PictureViewerPanel.html";
        MyObj.InfoItem = "H-Bilder.html";

        MyObj = RootObj.MFotos;
        MyObj.MyLinkSrc = "FotoViewerPanel.html";
        MyObj.InfoItem = "H-Fotografie.html";
        
        

}

function EyePosition( left, top, width, height, EyeNameA, EyeNameB, EyeNameC, indx )
{
 var MyObj, Button;
 
        MyObj = document.getElementById( EyeNameA );
        RootObj.ButtonArray[indx] = MyObj;
        Button = MyObj;
        MyObj.style.left = left + "px";
        MyObj.style.top = top + "px";
        RootObj.ButtonRange[indx].top = top + CntrlObj.ViewermarginA - .2 * height;
        RootObj.ButtonRange[indx].mid = top + CntrlObj.ViewermarginA +  height / 2;
        RootObj.ButtonRange[indx].bot = top + CntrlObj.ViewermarginA +  1.2 * height;
        MyObj = document.getElementById( EyeNameB );
        UBC.setImageWidth( MyObj, width );
        UBC.setImageHeight( MyObj, height );
        MyObj = document.getElementById( EyeNameC );
        UBC.setImageWidth( MyObj, width );
        UBC.setImageHeight( MyObj, height );
        
        return( Button );
}

function CloseCurtain()
{         
          RootObj.Curtaincontainer[0].style.visibility = "hidden";
          RootObj.Curtaincontainer[1].style.visibility = "hidden";
          RootObj.Curtain.style.visibility = "visible";
          RootObj.Curtaincontainer[0].style.zIndex = 189;
          RootObj.Curtaincontainer[1].style.zIndex = 188;
          RootObj.CurtainStepCounter = 0;
          
          StopInnerEventListeners();

          UpdateCurtainSteps( UBC.getInnerWidth( window ) );
                
          fadeObject( "NavigationCover", 199, "out", "InvokeCurtainClose()" );
          
}

function InvokeCurtainClose()
{
         CurtainStep( 0, RootObj.CurtainStepsCount, 1,
                "fadeObject('IntroTextContainer',198,'out', 'StartCurtainEventListeners()')");

}



function UpdateCurtainSteps( winWidth )
{
     var xL, xR, indx,
         limR, limL, xRs, xLs, xOs, teilung,
         xr1, xrt, xlt, xrtlast, cnt;

         teilung = RootObj.teilung;
         xRs = RootObj.CurtainStepsR;
         xLs = RootObj.CurtainStepsL;
         xOs = RootObj.CurtainStepsO;
         
         xR = winWidth - teilung;
         xL =  1.5 * teilung;
         

         
         for (indx=0, step=0, xr1=teilung, xrtlast=winWidth, cnt =0; xr1 > 1; indx++, step += .25 )
         {
               xr1 = xR / Math.pow(1.6,step);
               xrt = Math.floor(teilung + xr1);
               xlt = Math.floor(teilung - xL / Math.pow(1.6,step));
               
               if ( xrt >= xrtlast ) continue;
               
               cnt++; 
                    
               xrtlast = xrt;
               
               if ( indx < 1 ) continue;
               
               xRs[cnt] = xrt;
               xLs[cnt] = xlt;
               
         }
         cnt++;
         xRs[cnt] = teilung;
         xLs[cnt] = teilung + 1;
         
         xRs[0] = winWidth + 3*teilung;
         xLs[0] = - 3.5 * teilung;
         
         for ( indx = 0, step = 4 /cnt, xr1 = 0; indx < cnt; indx++)
         {
              
              xr1 += step;
              if ( xr1 > 1) xr1 = 1;
              xOs[indx] = xr1;
              
              /*report( "-"+indx+"  xr="+xRs[indx]+"  op="+xOs[indx] );*/
         }
         
         RootObj.CurtainStepsCount = cnt;
}



function CurtainStep( Istart, Iende, direction, finishfunc )
{
     var mytime, indx, indxA, indxB;

         
         indxA = Istart % 2;
         indxB = (Istart + 1) % 2;
         
         if ( direction < 1 )
         {
            RootObj.Curtaincontainer[indxA].style.zIndex = 189;
            RootObj.Curtaincontainer[indxB].style.zIndex = 188;
            
            RootObj.Curtaincontainer[indxB].style.visibility = "visible";
         }
         else
         {                                                      
            RootObj.Curtaincontainer[indxB].style.zIndex = 189;
            RootObj.Curtaincontainer[indxA].style.zIndex = 188;
         
            if ( RootObj.CurtainStepCounter == 0 )
                 RootObj.Curtaincontainer[indxB].style.visibility = "hidden";
            else
                 RootObj.Curtaincontainer[indxB].style.visibility = "visible";
         }     
         RootObj.Curtaincontainer[indxA].style.visibility = "hidden";
         
         RootObj.CurtainStepCounter++;
         
         Istart = Istart +  direction;
         indx = Istart;
         
         if ( direction < 0 && indx < 0 ) indx = 0;
         if ( direction > 0 && indx > Iende ) indx = Iende;
         
         RootObj.IntroCurtainRightLayer[indxA].style.left = RootObj.CurtainStepsR[indx] + "px";
         RootObj.IntroCurtainLeftLayer[indxA].style.left = RootObj.CurtainStepsL[indx] + "px";
         if ( indx == Istart )
              UBC.setStyleOpacity( RootObj.IntroCurtainRightLayer[indxA], 1. ); 
         else if ( indx == Iende )
              UBC.setStyleOpacity( RootObj.IntroCurtainRightLayer[indxA], 0. );
         else 
         { 
              if ( RootObj.CurtainStepsO[indx] != RootObj.CurtainStepsO[indx + direction] )
                   UBC.setStyleOpacity( RootObj.IntroCurtainRightLayer[indxA], RootObj.CurtainStepsO[indx] );
         }
         
         
         if ( direction < 0 )
         {
              if ( Istart >= Iende )
                   mytime=setTimeout('CurtainStep('+Istart+','+Iende+','+direction+',"'+finishfunc+'")',20 );
              else
              {
                   CntrlObj.CurtainStatus = "O";
                   mytime=setTimeout( finishfunc, 2 );
              }
         }
         else
         {
              if ( Istart <= Iende )
                   mytime=setTimeout('CurtainStep('+Istart+','+Iende+','+direction+',"'+finishfunc+'")',20 );
              else
              {
                   CntrlObj.CurtainStatus = "C";
                   mytime=setTimeout( finishfunc, 2 );
              }
         }
}



function OpenCurtain()
{
         
         RootObj.Curtain.style.visibility = "visible";
         UpdateCurtainSteps( UBC.getInnerWidth( window ) );
         
         RootObj.CurtainStepCounter = 0;
         
         CntrlObj.Curtain_WaitOpenFlag = 1;
         CntrlObj.Curtain_ReadyFlag = 1;
         
         fadeObject( "IntroTextContainer", 0, "in", 
                 "CurtainStep( RootObj.CurtainStepsCount, 0, -1, 'endOpenCurtain()' )" );
         
}

function SwitchScene( linksrc )
{  
         RootObj.SelectedLink = linksrc;
         RootObj.VFrame.LocalCntrlObj = CntrlObj;
         
         CntrlObj.BackButtonFlag = false;
         CntrlObj.Panel_ReadyFlag = 0;
         RootObj.VFrame.src = "blankViewer.html"
         RootObj.VFrame.src = RootObj.SelectedLink;

         WaitForPanelReady( 1 );
}

function WaitForPanelReady( mode )
{

          if ( CntrlObj.Panel_ReadyFlag < 1 )
          {
                   mytime=setTimeout('WaitForPanelReady('+mode+')',50 );
                   return;
          }
          else
          {
                    if ( mode == 1 )
                    {
                           UpdateCurtainSteps( UBC.getInnerWidth( window ) );

                           CurtainStep( RootObj.CurtainStepsCount, 0, -1, "endOpenCurtain()" );
                    }
                    else
                    {
                           RootObj.Curtain.style.visibility = "visible";
                           UpdateCurtainSteps( UBC.getInnerWidth( window ) );
         
                           CntrlObj.Curtain_WaitOpenFlag = 1;
                           CntrlObj.Curtain_ReadyFlag = 1;
                           UpdateCurtainSteps( UBC.getInnerWidth( window ) );

                           fadeObject( "IntroTextContainer", 0, "in", 
                                 "CurtainStep( RootObj.CurtainStepsCount, 0, -1, 'endOpenCurtain()' )" );
                    }
          }
}


function endOpenCurtain()
{
         
         RootObj.Curtain.style.visibility = "hidden";
         RootObj.Curtaincontainer[0].style.visibility = "hidden";
         RootObj.Curtaincontainer[1].style.visibility = "hidden";
         RootObj.Curtaincontainer[0].style.zIndex = 1;
         RootObj.Curtaincontainer[1].style.zIndex = 1; 
         RootObj.CurtainStepCounter = 0;
         
         CntrlObj.Panel_ReadyFlag = 2;
         
         fadeObject( "NavigationCover", 0, "in", "WaitFrameForUserReady( 0 )" ); 
                                                              
}

function WaitFrameForUserReady( count )
{
          if ( count == 0 )
               StartInnerEventListeners();
               
          if ( CntrlObj.LoadComplete == true ) 
          {
              if ( CntrlObj.UrlRequest.MFrameCmd )
              {
                   InfoWindow( RootObj.MFrame, CntrlObj.UrlRequest.MFrameCmd, "visible", 1. )
                   CntrlObj.UrlRequest.MFrameCmd = null;
              }
              
              if ( CntrlObj.UrlRequest.Presentation > 0)
              {
                   CntrlObj.UrlRequest.SlideshowComplete = false;
                   
                   WaitFrameForSlideShowReady();
              }
                 
              return;
          }
          
          count++;
          mytime=setTimeout( 'WaitFrameForUserReady('+count+')',350 );
}



function WaitFrameForSlideShowReady()
{  
          if ( CntrlObj.UrlRequest.SlideshowComplete == true ) 
          {   
              CntrlObj.UrlRequest.SlideshowComplete = false;
              CntrlObj.UrlRequest.FrameStartItem = "SlideShow";
              
              changeTo( CntrlObj.UrlRequest.FrameCmd );  
              return;
          }
          mytime=setTimeout( 'WaitFrameForSlideShowReady()',500 );
}

function MyMouseDown( event )
{	
      if ( !event ) var event = window.event;
      
      var UBCev = CheckUBCev( event );
        
      if ( !RootObj.ActiveButton )  return;
      
      if ( RootObj.ActiveButton.Presentation > 0 )
      {
              if ( RootObj.RequestPresentation > 0 )
              {
                   RootObj.RequestPresentation = 0;
                   return;
              }
              RootObj.RequestPresentation = RootObj.ActiveButton.Presentation;
              CntrlObj.UrlRequest.FrameCmd = "SculptureViewerPanel.html";
              CntrlObj.UrlRequest.FrameOption = null;
              CntrlObj.UrlRequest.MFrameCmd = null;
              CntrlObj.UrlRequest.Presentation = RootObj.ActiveButton.Presentation;
              
      }
        
      if ( RootObj.ActiveButton.MyLinkSrc )
      {
              RootObj.SelectedLink = RootObj.ActiveButton.MyLinkSrc;
              RootObj.ActiveButton.HighLight.style.visibility = "hidden";
              RootObj.ActiveButtonHL.HighlightText.style.visibility = "hidden";
              RootObj.VFrame.LocalCntrlObj = CntrlObj;
              CntrlObj.BackButtonFlag = false;
               
              CntrlObj.ActiveInfoItem = RootObj.ActiveButton.InfoItem;
              
              RootObj.VFrame.src = RootObj.SelectedLink;
              
      }
        
      CntrlObj.Panel_ReadyFlag = 0;
        
      StopCurtainEventListeners();
        
      WaitForPanelReady( 2 );
}


function MyMouseDownInnerButton( e )
{
       var Bindx, Lx, Ly, indx;

       Bindx = 0;
       
       var UBCev = CheckUBCev( e );
       
       Lx = UBCev.getLayerX( e );
       Ly = UBCev.getLayerY( e );

       for ( indx = 0; indx < RootObj.ReturnButDdivisor; indx++ )
             if ( Lx > RootObj.ReturnButtonLayerMap[indx] ) Bindx = indx + 1;

       switch( Bindx )
       {
               case 1:
                     RootObj.ReturnButDLCont.style.visibility = "hidden";
                     RootObj.MFrame.Viewer_ButtonState = 0;
                     
                     if ( CntrlObj.SculptureSlideShowON ) CntrlObj.StopSculptureSlideShow = true;
                     if ( CntrlObj.FotoSlideShowON ) CntrlObj.StopFotoSlideShow = true;
                     
                     CloseCurtain();

                     return false;

                case 2:
                     InfoWindow( RootObj.MFrame, "EMailForm.html", "visible", 1.);

                     return false;

                case 3:
                
                     InfoWindow( RootObj.MFrame, CntrlObj.ActiveInfoItem, "visible", 1.);
                     
                     return false;

                default:
       }
}



function MyResize(e)
{		
        var UBCev = CheckUBCev( e );

        PositionStartCurtain();
        //report( "Resize IndexPanel" );
        return false;
}


function MyMouseMove( event )
{
        var x, y, indx, butrange, opacity;

		if ( !event ) var event = window.event;
		
        var UBCev = CheckUBCev( event );
        
        x = UBCev.getPageX( event );
        y = UBCev.getPageY( event );
        
        for ( indx = 0; indx < 6; indx++)
        {
            butrange = RootObj.ButtonRange[indx];
            if ( y > butrange.top && y < butrange.bot )
            {
                 if (  RootObj.ActiveButton != RootObj.ButtonArray[indx] )
                 {
                      if ( RootObj.ActiveButton )
                      {
                             RootObj.ActiveButton.HighLight.style.visibility = "hidden";
                             RootObj.ActiveButtonHL.HighlightText.style.visibility = "hidden";
                      }
                      RootObj.ActiveButton = RootObj.ButtonArray[indx];
                      RootObj.ActiveButtonHL = RootObj.ButtonRange[indx];
                      RootObj.ActiveButton.HighLight.style.visibility = "visible";
                      RootObj.ActiveButton.Presentation = butrange.Presentation;
                      butrange.HighlightText.style.visibility = "visible";
                      UBC.setStyleOpacity( RootObj.ActiveButton.HighLight, .01 );
                      UBC.setStyleOpacity( butrange.HighlightText, .01 );
                      return;
                 }
                 else
                 {
                      opacity =  (1 + Math.cos( 3.14159265359 * 
                                Math.abs(((y - butrange.mid) / (butrange.mid - butrange.top)))))/2.;
                      UBC.setStyleOpacity( RootObj.ActiveButton.HighLight, opacity );
                      UBC.setStyleOpacity( butrange.HighlightText, opacity  );
                      return;
                 }
            }
        }
        if ( RootObj.ActiveButton )
        {
            RootObj.ActiveButton.HighLight.style.visibility = "hidden";
            RootObj.ActiveButtonHL.HighlightText.style.visibility = "hidden";
        }
        RootObj.ActiveButton = null;
        RootObj.ActiveButtonHL = null;

        return true;
}



function MyMouseMoveBut(e)
{
      var Bindx, Lx, Ly, Kx, Ky, indx, B3indx;

       Bindx = 0;
       
       var UBCev = CheckUBCev( e );

       if ( !e ) var e = window.event;

       Lx = UBCev.getLayerX( e );
       Ly = UBCev.getLayerY( e );

       for ( indx = 0; indx < RootObj.ReturnButDdivisor; indx++ )
             if ( Lx > RootObj.ReturnButtonLayerMap[indx] ) Bindx = indx;

       if (Bindx < 3 )
       {
              RootObj.ReturnButDLCont.style.left = RootObj.ReturnButtonLayerMap[Bindx] + 2 + "px";
              RootObj.ReturnButDLCont.style.visibility = "visible";
              RootObj.ReturnButDLCont.style.zIndex = 25;
       }
       else
       {
              RootObj.ReturnButDLCont.style.visibility = "hidden";
       }
}


function MyMouseOutBut(e)
{
        RootObj.ReturnButDLCont.style.visibility = "hidden";

        return true;
}


function changeTo( targetname )
{
        var MyTarget, w;
        
        if ( CntrlObj.SculptureSlideShowON ) CntrlObj.StopSculptureSlideShow = true;
        if ( CntrlObj.FotoSlideShowON )  CntrlObj.StopFotoSlideShow = true;
        
        RootObj.Curtain.style.visibility = "visible";
        RootObj.Curtaincontainer[0].style.visibility = "visible";
        RootObj.Curtaincontainer[1].style.visibility = "hidden";
        RootObj.Curtaincontainer[0].style.zIndex = 189;
        RootObj.Curtaincontainer[1].style.zIndex = 188;
        RootObj.CurtainStepCounter = 0;
        
        StopInnerEventListeners();
           
        UpdateCurtainSteps( UBC.getInnerWidth( window ) );

        MyTarget = document.getElementById( targetname );
        
        CntrlObj.ActiveInfoItem = MyTarget.InfoItem;
           
        CurtainStep( 0, RootObj.CurtainStepsCount, 1, "SwitchScene( '" + MyTarget.MyLinkSrc + "' )" );
          
}


function InfoWindow( FrameObj, sourcePage, visibility, opacity )
{
   var mytime;

        if ( FrameObj.Viewer_ButtonState == 0 )
        {
            FrameObj.MyLayer.style.visibility = "hidden";
            FrameObj.ViewerInfoLayer =  FrameObj.MyLayer;
            FrameObj.ViewerDecoration =  FrameObj.MyDecoration;
            FrameObj.ViewerInfo_ReadyFlag = 0;

            FrameObj.Viewer_ButtonState = 1;   

            FrameObj.src = sourcePage;

            UBC.setStyleOpacity( FrameObj.MyLayer, opacity );
        }
        else
        {
            FrameObj.RequestNewInfoPage = sourcePage;
            FrameObj.InfoLayerReadyFlag = "w";
            FrameObj.Viewer_ButtonState = 0;
        }
}






