// JavaScript Document

function hideDialog( name )
{
   document.getElementById( 'fader' ).style.display = "none";
   document.getElementById( name ).style.display = "none"; 	
}

function showDialog( name )
{
var fader = document.getElementById( "fader" );  

changeOpac( 80, fader );
   
   
var s = getDocumentSize();



fader.style.top = "0px";
fader.style.left = "0px";


fader.style.height = s[2] + "px";
fader.style.width = s[0] + "px";
  
fader.style.display = "block";
  
var iebody=(document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body

var dsocleft=document.all? iebody.scrollLeft : pageXOffset
var dsoctop=document.all? iebody.scrollTop : pageYOffset


var dialog = document.getElementById( name );

dialog.style.display = "block";
centerForm( dialog, s );


}

function getSize( node ) {
	if (node == null)
	   return [0,0];
  var myWidth = 0, myHeight = 0;  
  if( typeof( node.innerWidth ) == 'number' ) {
	//  update( "info", "non ie" );
    //Non-IE
    myWidth = node.innerWidth;
    myHeight = node.innerHeight;
  } else if( document.documentElement && ( document.documentElement.offsetWidth || document.documentElement.offsetHeight ) ) {
	  	  //update( "info", "ie 6+ " + node + " " + node.offsetWidth +"," + node.offsetHeight );
    //IE 6+ in 'standards compliant mode'
    myWidth = node.offsetWidth;
    myHeight = node.offsetHeight;
  } else if( document.body && ( node.clientWidth || node.clientHeight ) ) {
    //IE 4 compatible
		  	//  update( "info", "ie 4 " + node.clientWidth +"," + node.clientHeight );
    myWidth = node.clientWidth;
    myHeight = node.clientHeight;
  }
  return [ myWidth, myHeight ];
}

function changeOpac(opacity, node) 
{	
    var object = node.style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}


function getDocumentSize() 
{
	
  var myWidth = 0, myWindowHeight = 0, myDocumentHeight = 0;

  if( typeof( window.innerWidth ) == 'number' ) 
  {
    //Non-IE
    myWidth = window.innerWidth;
    myDocumentHeight = document.body.parentNode.scrollHeight;  
	myWindowHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myDocumentHeight = document.body.parentNode.scrollHeight;
	myWindowHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myDocumentHeight = document.body.parentNode.scrollHeight; 
	myWindowHeight = document.body.clientHeight;	
  }
    

  return [ myWidth, myWindowHeight, myDocumentHeight ];
}


function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}

function centerForm( popup, size )
{
     var s = getSize( popup );
	  
		 
      var scroll = getScrollXY();	

      var px = size[0]/2 - (s[0]/2) + scroll[0];
      var py = size[1]/2 - (s[1]/2) + scroll[1];
             
      popup.style.top = py + "px";
      popup.style.left = px + "px";    
}