/*!
* 
* document listing in modal frame settings
*
* Copyright 2008, Origen Technoolgy (http://www.origen.co.nz)
*
* Author: Clifton Wright
*/

var isIE = (navigator.appName=="Microsoft Internet Explorer");
var IEversion = navigator.appVersion;
if(isIE) {
IEversion = parseInt(IEversion.substr(IEversion.indexOf("MSIE")+4));
} else {
IEversion = 0;
}

function showDocument(recId)
{     
      if( document.getElementById(recId).style.display == "block")
      {
         document.getElementById(recId).style.display = "none"
      }
      else 
      {
         document.getElementById(recId).style.display = "block"
      }
      

}


function LaunchTrapeze(TrapezePath,ImagePath)
{
   var DriveLetter = "D:"
   var myshell = new ActiveXObject("WScript.shell");
   
   DriveLetter = GetCDDriveLetter()           
   
   var FilePath = '"' + DriveLetter + TrapezePath + '" "';
   FilePath = FilePath + DriveLetter + ImagePath + '"';
   myshell.run(FilePath, 1, true );
}
function GetCDDriveLetter() 
{ 
   var FSO, enumFSO,  Drive, DriveLetter; 
   FSO  = new ActiveXObject("Scripting.FileSystemObject"); 
   enumFSO  = new Enumerator(FSO.Drives); 
   //
   do { 
      Drive  =  enumFSO.item(); 
      if (Drive.DriveType  ==  4) 
      {
         DriveLetter = Drive.DriveLetter;
         break;
      }
      enumFSO.moveNext(); 
   }  while (!enumFSO.atEnd()); 
 
 DriveLetter = DriveLetter + ":";
 return(DriveLetter); 
}  

function showModal(boxid,overlay) 
{
   var y=0;
   if (document.body)
   {
     y = document.body.scrollTop;
   }

   document.getElementById(boxid).style.top= y  + 30; 
 
      
   document.getElementById(overlay).style.top= y - 150; 		   
   document.getElementById(overlay).style.visibility="visible";

}
function hideModal(boxid,overlay) 
{
   
   document.getElementById(overlay).style.visibility="hidden";
   document.getElementById(boxid).style.width='0px';
   document.getElementById(boxid).style.height='0px';
} 


function changeWidthFinal(elm,toWidth,delay)
{               
   var y=0;
   var w=0;
   var h=0;
   var b=0;
   var a=0;
   
   if( typeof window.pageYOffset != 'undefined' )
   {
      y = window.pageYOffset; 
      w = document.documentElement.clientWidth;
      h = document.documentElement.clientHeight;
      b = document.documentElement.scrollHeight; 
      
   }
   else
   if(document.documentElement)
   {
      y = document.body.scrollTop;  
      b = document.body.scrollHeight;  
      w = document.body.clientWidth;
      h = document.body.clientHeight;                  
   }
   else
   if(document.body)
   {                
      y = document.body.scrollTop;   
      w = document.body.clientWidth;
      h = document.body.clientHeight;
      b = document.body.scrollHeight;  
   }
   
   document.getElementById('overlay').style.width = w +'px';                
   document.getElementById('overlay').style.visibility="visible";
   
   document.getElementById('overlay').style.height = h +'px';
   
   
   if(b > h)
   {    
    document.getElementById('overlay').style.height = b +'px'; 
   }
   
   
    var width  = parseInt(elm.style.width);
    var wchange = toWidth-width;
    var wtotal=width+Math.ceil((wchange/2));
    
    var height  = parseInt(elm.style.height);
    var hchange = h-height;               
    var htotal=height+Math.ceil((hchange/2));
    
    elm.style.top= y + 30 +'px';
    elm.style.top = '0px';    // want as much realestate here as possible so I'll set it to the top of the frame.           
    
    elm.style.width=wtotal+'px';
    elm.style.height=htotal+'px';
    
    
   function c() 
   {
     changeWidthFinal(elm,toWidth,delay);
   }
   if(wchange==0) 
   {
     clearTimeout(timer);
     return;
   }
   timer=setTimeout(c,delay);
   
    
}