// Main.js

var InsertChanged = false ;
var URLPos = 0 ;
var URLMaxPos = 50 ;
var URLList = new Array(URLMaxPos) ;

var CurURL ;

URLList[0] = "./ScriptBuilder.php?indhold=0" ;

if (top.location != self.location)
  {
  top.location = self.location ;
  }

//alert('JavaScript Reloading !') ;

// simplePreload( '01.gif', '02.gif' ); 

function
simplePreload()
  { 
  var args = simplePreload.arguments ;

  document.imageArray = new Array(args.length) ;

  for(var i=0; i<args.length; i++)
    {
    document.imageArray[i] = new Image ;
    document.imageArray[i].src = args[i] ;
    }
  }

function 
InsertPageCenter(ElURL)
  {
//alert("InsertPageCenter !!? : "+ElURL) ;
  InsertChanged = true ;

//  top.ScriptBuild.location = ElURL ;
  CurURL = ElURL ;
  setTimeout("InsertDelayedPageURL()", 50) ; 
  
  return true ;
  }

function
InsertDelayedPageURL()
  {
//alert("Inserting !!?") ;
  top.ScriptBuild.location = CurURL ;
  }

function 
InsertLastPageCenter()
  {
  InsertChanged = false ;

  if (top.URLPos <= 1)
    top.URLPos = 0 ;
  else
    top.URLPos = top.URLPos - 1 ;
  
//  top.ScriptBuild.location.href = top.URLList[top.URLPos] ; 
  setTimeout("InsertDelayedLastPageURL()", 50) ; 
//  alert("2. URLPos = "+top.URLPos+",\nURLList[URLPos] = "+top.URLList[top.URLPos]+",\nURLList = "+top.URLList);

//  return true ;
  }

function
InsertDelayedLastPageURL()
  {
//alert("Inserting !!?") ;
  top.ScriptBuild.location = top.URLList[top.URLPos] ;
//  alert("3. URLPos = "+top.URLPos+",\nURLList[URLPos] = "+top.URLList[top.URLPos]+",\nURLList = "+top.URLList);
  }

var LastMenuItem ;

function
ToggVisy(SubMenu)
  {
  var SubMenuElement ;

// alert("Toggling SubMenu !!? "+SubMenu) ;
/*
  if (LastMenuItem != SubMenu)
    {
    if (LastMenuItem != undefined)
      {
//alert("Toggling SubMenu !!? "+LastMenuItem) ;

      with (top.MainCont.document.getElementById(LastMenuItem).style)
        {
	    visibility = 'hidden' ;
	    position = 'absolute' ;
	    }
        top.MainCont.document.getElementById(LastMenuItem+"Img").src = "./Images/TenBall01.png" ;
	  }
*/
    LastMenuItem = SubMenu ;

  SubMenuElement = top.MainCont.document.getElementById(SubMenu).style ;
//  with (top.MainCont.document.getElementById(SubMenu).style)
//    {
   if (SubMenuElement.visibility == 'visible')
	  {
	  SubMenuElement.visibility = 'hidden' ;
	  SubMenuElement.position = 'absolute' ;
      top.MainCont.document.getElementById(SubMenu+"Img").src = "./Images/TenBall01.png" ;
	  }
	else
	  {
      SubMenuElement.visibility = 'visible' ;
	  SubMenuElement.position = 'relative' ;
      top.MainCont.document.getElementById(SubMenu+"Img").src = "./Images/TenBall02.png" ;
	  }
//    } // End With

//	} // End If
  }

// Definition List Scripting

OpenCloseStatus = new Array();

function 
InitDefList() 
  {
  var ElDocu = top.MainCont.document ;
  var ElTago = ElDocu.getElementsByTagName("dt") ;
  var Antal = ElTago.length ;

  simplePreload('./Images/plus.png', './Images/minus.png') ;

  for (n = 0; n < Antal; n++)
    {
    OpenCloseStatus[n] = true ;
    Data = ElTago[n].innerHTML ;
    DataNy = "<a href='javascript:void(null)' onClick='return(top.OpenClose(" + n + "));')><img class='deflist' name='ExpPic' src='./Images/plus.png'></a>" + Data ;
    ElTago[n].innerHTML = DataNy ;
    }

  ElTago = ElDocu.getElementsByTagName("dd") ;
  Antal = ElTago.length ;
  for (n = 0; n < Antal; n++)
    ElTago[n].style.display = "none";

  return true ;
  }

function 
OpenClose(Id) 
  {
  var ElDocu = top.MainCont.document ;
  if (OpenCloseStatus[Id]) 
    {
    ElDocu.getElementsByTagName("dd")[Id].style.display = "block"; 
    ElDocu.getElementsByName("ExpPic")[Id].src = "./Images/minus.png";
    OpenCloseStatus[Id] = false ;
    } 
  else 
    {
    ElDocu.getElementsByTagName("dd")[Id].style.display = "none"; 
    ElDocu.getElementsByName("ExpPic")[Id].src = "./Images/plus.png";
    OpenCloseStatus[Id] = true ;
    }

  return true ;
  }

