scrollLeft = 0;
scrollTop = 0;

var obj_textarea_cible_smileys = null;

function getBrowserHeight()
{
	
	if (window.innerHeight && window.scrollMaxY) {// Firefox
		yWithScroll = window.innerHeight + window.scrollMaxY;
		xWithScroll = window.innerWidth + window.scrollMaxX;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yWithScroll = document.body.scrollHeight;
		xWithScroll = document.body.scrollWidth;
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
	yWithScroll = document.body.offsetHeight;
	xWithScroll = document.body.offsetWidth;
	}

 return { width: parseInt(xWithScroll), height: parseInt(yWithScroll) };
} 

function setLayerPosition()
{
	
 var shadow = document.getElementById('shadow');
 var details = document.getElementById('divEmoticones');

 var bws = getBrowserHeight();
 
 shadow.style.width = bws.width + 'px';
 shadow.style.height = bws.height + 'px';

 var i = parseInt((bws.width - 550) / 2);
 
 var scrollTop = window.pageYOffset || document.documentElement.scrollTop || 0;
 var j = scrollTop + 150;

 details.style.left = i + 'px';
 details.style.top = j + 'px';

 var shadowIframe = document.getElementById('shadowIframe');
 shadowIframe.style.width = bws.width + 'px';
 shadowIframe.style.height = bws.height + 'px';

 shadow = null;
 details = null;
} 

function showLayer(param_obj_textarea_cible_smileys)
{

 obj_textarea_cible_smileys = param_obj_textarea_cible_smileys;
 
 setLayerPosition();

 var shadowIframe = document.getElementById('shadowIframe');
 var shadow = document.getElementById('shadow');
 var details = document.getElementById('divEmoticones');

 shadowIframe.style.display = 'block';
 shadow.style.display = 'block';
 details.style.display = 'block';

 shadow = null;
 details = null;
 
 scrollLeft = window.pageXOffset || document.documentElement.scrollLeft || 0;
 scrollTop = window.pageYOffset || document.documentElement.scrollTop || 0;            
}

function hideLayer()
{
 var shadowIframe = document.getElementById('shadowIframe');
 var shadow = document.getElementById('shadow');
 var details = document.getElementById('divEmoticones');

 shadowIframe.style.display = 'none';
 shadow.style.display = 'none';
 details.style.display = 'none';

 shadow = null;
 details = null;

}

window.onresize = setLayerPosition;
