﻿
//
// global variables
//
var isMozilla;
var objDiv = null;
var originalDivHTML = "";
var DivID = "";
var over = false;

//
// dinamically add a div to 
// dim all the page
//
function buildDimmerDiv()
{

    document.write('<div id="dimmer" class="dimmer" style="width:'+ window.screen.width + 'px; height:' + window.screen.height +'px"></div>');
}


//
//
//
function displayFloatingDiv(divId, title, width, height, left, top) 
{
	DivID = divId;


//	document.getElementById('dimmer').style.visibility = "visible";

    //document.getElementById(divId).style.width = width + 'px';
    //document.getElementById(divId).style.height = height + 'px';
    //document.getElementById(divId).style.left = left + 'px';
    //document.getElementById(divId).style.top = top + 'px';
	document.getElementById(divId).style.width = width + 'px';
    document.getElementById(divId).style.height = height + 'px';
    document.getElementById(divId).style.left = left + 'px';
    document.getElementById(divId).style.top = top + 'px';
	
	var addHeader;
	
	if (originalDivHTML == "")
	    originalDivHTML = document.getElementById(divId).innerHTML;
	
	

    // add to your div an header	
	document.getElementById(divId).innerHTML = originalDivHTML;
	
	
	//document.getElementById(divId).className = 'dimming';
	document.getElementById(divId).style.visibility = "visible";


}


//
//
//
function hiddenFloatingDiv(divId) 
{
	document.getElementById(divId).innerHTML = originalDivHTML;
	document.getElementById(divId).style.visibility='hidden';
//	document.getElementById('dimmer').style.visibility = 'hidden';
	
	
	DivID = "";
}
var toggleCounter = 0;
//
 function displayWindow(obj)
		    {
		       
		        var w, h, l, t, parent;
		        w = 400;
		        h =55;
		        parent = obj;
		        t = 0; l = 0;
		        while(parent != null)
		        {
		            t += parent.offsetTop;
		            l += parent.offsetLeft;
		            parent = parent.offsetParent;
		            if(parent == document.body)
		                break;
		        }
		        t += obj.offsetHeight + 5;
		        //l = obj.offsetLeft;
		        //l = 630;
		        //t = obj.style.top + obj.offsetTop;
		        //t = 100;
                
                // no title		        
		        // displayFloatingDiv('windowcontent', '', w, h, l, t);

                // with title		
                if(document.getElementById("windowcontent").style.visibility=='visible')
                    document.getElementById("windowcontent").style.visibility='hidden';
                else
                    displayFloatingDiv('windowcontent', 'Floating and Dimming Div', w, h, l, t);
		        
		        
		    }

