

//===============================================================================================================
//FUNCTION THAT CENTER AN OVERLAY
//===============================================================================================================
function center(element){
    try{
        element = $(element);
    }catch(e){
        return;
    }    

    if ( typeof( window.innerWidth ) == 'number' ){
        my_width  = window.innerWidth;
        my_height = window.innerHeight;
    }else if ( document.documentElement &&
             ( document.documentElement.clientWidth ||
               document.documentElement.clientHeight ) ){
        my_width  = document.documentElement.clientWidth;
        my_height = document.documentElement.clientHeight;
    }
    else if ( document.body &&
            ( document.body.clientWidth || document.body.clientHeight ) ){
        my_width  = document.body.clientWidth;
        my_height = document.body.clientHeight;
    }

    element.style.position = 'absolute';
    element.style.zIndex   = 32099;

    var scrollY = 0;

    if ( document.documentElement && document.documentElement.scrollTop ){
        scrollY = document.documentElement.scrollTop;
    }else if ( document.body && document.body.scrollTop ){
        scrollY = document.body.scrollTop;
    }else if ( window.pageYOffset ){
        scrollY = window.pageYOffset;
    }else if ( window.scrollY ){
        scrollY = window.scrollY;
    }

    var elementDimensions = Element.getDimensions(element);

    var setX = ( my_width  - elementDimensions.width  ) / 2;
    var setY = ( my_height - elementDimensions.height ) / 2 + scrollY;

    setX = ( setX < 0 ) ? 0 : setX;
    setY = ( setY < 0 ) ? 0 : setY;

	//setY = 50;
	//setY = 50;
	//alert(setY);
	//alert(setX);

    element.style.left = setX + "px";
    element.style.top  = setY + "px";

    element.style.display  = 'block';
}



//===================================================================================================================
//===================================================================================================================


//===================================================================================================================
//FUNCTION THAT SHOWS A REGULLAR OVERLAY
//===================================================================================================================

function showBox(overlay_id, box_id)
{
	center(overlay_id);
	
	
    $(overlay_id).style.height=window.document.body.scrollHeight;
   	
    $(overlay_id).style.backgroundColor='#cccccc';
    try{$(overlay_id).style.mozOpacity= 0.65;}catch(err){ }
    try{$(overlay_id).style.filter="alpha(opacity=65)";}catch(e){alert(e);}
    try{$(overlay_id).style.opacity=0.65;}catch(err){} 
    
       


	Element.show(overlay_id);
	center(box_id);

	return false;
}

//===================================================================================================================
//FUNCTION THAT CLOSE A REGULLAR OVERLAY
//===================================================================================================================


function hideBox(overlay_id, box_id)
{
	Element.hide(overlay_id);
	Element.hide(box_id);

	return false;
}
