//*
//* positionning function
//*
function SetPosition(o,x,y)
 {  
    if (document.all)
	 { document.all[o].style.pixelTop  = y;
       document.all[o].style.pixelLeft  = x;	 
	 }
	else
	if (document.layers) 
     { document.layers[o].top  = y;
       document.layers[o].left  = x;	 
	 }
	else
	if (document.getElementById) 
	 {document.getElementById(o).style.top  = y;
  	  document.getElementById(o).style.left  = x;
	 }

 } 	 

function GetPositionX(o)
 { 
   if (!document.getElementById(o)) alert('elmt not found: ('+0+')');
 if (document.all) return document.all[o].style.pixelLeft
  else
   if (document.layers) return document.layers[o].left; 
  else  
  if (document.getElementById) return parseInt(document.getElementById(o).style.left);  
 }	  
 
function GetPositionY(o)
 { if (document.all) return document.all[o].style.pixelTop
  else
   if (document.layers) return document.layers[o].top; 
  else  
  if (document.getElementById) return parseInt(document.getElementById(o).style.top);  
 }	  


function  GetWidth(o)
 {	if (document.layers) return parseInt(document.layers[o].width);
	else if (document.getElementById) return parseInt(document.getElementById(o).style.width);
	return 0;
 } 
 
function  GetHeight(o)
 {	if (document.layers) return parseInt(document.layers[o].height);
	else if (document.getElementById) return parseInt(document.getElementById(o).style.height);
		return 0;
 }
 

 function  GetWindowWidth()
 {	 return parseInt(document.body.clientWidth);
 }

 function  GetWindowHeight()
 {	 return parseInt(document.body.clientHeight);
 }

 
function  SetWidth(o,w)
 {	if (document.getElementById(o)==null)
        alert('not found:'+o);
  if (document.layers) 
     { document.layers[o].width  = w;
	 }
	else
	if (document.getElementById) 
	 {document.getElementById(o).style.width  = w;
	 }
 }

 function  SetSize(o,w,h)
 {	if (document.layers) 
     { document.layers[o].width  = w;
	   document.layers[o].height  = h;
	 }
	else
	if (document.getElementById) 
	 {document.getElementById(o).style.width  = w;
	  document.getElementById(o).style.height  = h;
	 }
 }
 
 
function TimeToStr(float_time)
 { var hours   = parseInt(float_time);
   var minutes = parseInt(60*(float_time - hours));
   if  (minutes<10) return hours+':0'+minutes;
   return hours+':'+minutes;
 } 
 
 
function ParseObject(obj)
 { var res='';
   for (var k in obj) {res=res+'obj.'+k+'='+obj[k]+'<br>';}
   return res;
 } 
 
 
 //
// used by set visible
// 
function getRefToDiv(divID,oDoc) {
    if( !oDoc ) { oDoc = document; }
    if( document.layers ) {
        if( oDoc.layers[divID] ) { return oDoc.layers[divID]; } else {
            //repeatedly run through all child layers
            for( var x = 0, y; !y && x < oDoc.layers.length; x++ ) {
                //on success, return that layer, else return nothing
                y = getRefToDiv(divID,oDoc.layers[x].document); }
            return y; } }
    if( document.getElementById ) {
        return document.getElementById(divID); }
    if( document.all ) {
        return document.all[divID]; }
    return false;
}

//
//   Make a div visible or not
//   divID_as_a_string :  div's ID
//   visible (boolean):  true or false
function setVisible(divID_as_a_string,visible) {
    //get a reference as above ...
    myReference = getRefToDiv(divID_as_a_string);
    if( !myReference ) {
        window.alert('Nothing works in this browser');
        return false; //don't go any further
        //return anything would work,
        //but I am using false to show failure
    }
    //now we have a reference to it
    if( myReference.style ) { //DOM & proprietary DOM
	  
       if (visible) myReference.style.visibility = 'visible';
	           else myReference.style.visibility = 'hidden';
    } else {
        if( myReference.visibility ) { //Netscape
		    
            if (visible) myReference.visibility = 'show';
  			        else myReference.visibility = 'hide';
        } else {
            window.alert('Nothing works in this browser');
            return false; //don't go any further
        }
    }
    return true;
}

function isVisible(divID_as_a_string) 
 { myReference = getRefToDiv(divID_as_a_string);
   if( !myReference )        return false;
   if( myReference.style ) 
     { 
	   if (myReference.style.visibility == 'visible') return true;
	   return false;
	 }
   if( myReference.visibility ) 
    {  if (myReference.visibility == 'show') return true;
	   return false;
    }
   return false;	
 } 
 