//***************** GENERAL FUNCTIONS

   function GetElement(name)						// returns a reference to an element contained in the document
   {
    if (document.getElementById) { this.obj = document.getElementById(name) }
    else if (document.all) { this.obj = document.all[name] }                  // for IE4.0
    return this.obj;
   }

   
//***************** GENERAL COMMANDS


   function PopUpWindow(theHref,theWidth,theHeight,theScroll,theTool,theMenu)		// opens a popup window
   {
    window.open(theHref,'_blank','resizable=yes,toolbar="'+theTool+'" scrollbars="'+theScroll+'" menubar="'+theMenu+'" width='+theWidth+',height='+theHeight);
   }


   function RunFoldMenu(active)
   {
    var isin = 0
    
    if (active.id == "foldmenuhead") {isin = 1}
    else while (active.parentElement)
    {
     if (active.id == "foldmenuhead" || active.id == "foldmenulist")
     {
      if (active.id == "foldmenuhead") {isin = 1} else {isin = 0}
      break
     }
     active = active.parentElement
    }
    if (isin)
    {
     var foldercontent = active.all.tags("UL")[0]
     if (foldercontent.style.display == "none")
     {
      foldercontent.style.display = ""
      active.style.listStyleImage = "url(res/nav-foldopen.png)"
     }
     else
     {
      foldercontent.style.display = "none"
      active.style.listStyleImage = "url(res/nav-foldclose.png)"
     }
    }
   }

   function DisplayHelpPage(pageName)
   {
    GetElement('iframeHelp').src=pageName;
   }


//***************** MAIN COMMUNICATION FUNCTIONS


   function PDScript(theScript) 					// sends 4dscript to the plug-in
   { 
    opener.PageDive.runscript(theScript) 
   }

//***************** DRAG AND DROP


   function ShowDragCursor()						// sets dragging behaviour
   {
    PageDive.Runscript('gcode(396,1)');
    window.event.returnValue = false;
    window.event.dataTransfer.dropEffect = 'copy';
   }

