
window.document.write('<script src="/js/x_core.js" type="text/javascript" language="javascript"></script>');
window.document.write('<style type="text/css" title="main" media="all">@import url(/js/layerpopup.css);</style>');


function lanza_popup(ancho,alto,html,cerrar){

	div=document.getElementById('contenedorlayerpopup');

	//popup='<div id="layerpopup" class="overlayBody"><div class="feedBack error"><div class="feedBackContent"><div class="feedBackBody"><a title="Cerrar" id="layerpopup_close" class="close" href="#"/><h2 id="feedback_title_feedBack937215" class="title hide"/><p id="feedback_content_feedBack937215">Lo sentimos, se ha producido un error. Vuelve a intentarlo en unos minutos.</p><div id="feedback_buttons_feedBack937215" class="buttons"/></div></div></div></div>'		
	//popup="esto esta en un popup";

	if (cerrar == '0'){
		popup = '<div id="layerpopup"><div id="layerpopup2"><div id="layerpopup_close">&nbsp;</div><div id="c1">'+html+'</div><div id="layerpopup_pie"><div id="cerrarampliacion">&nbsp;</div></div></div></div> ';
	}else{
		popup = '<div id="layerpopup"><div id="layerpopup2"><div id="layerpopup_close"><a id="apopup_close" href="javascript:cerrar_ampliacion()"><img src="/img/close.gif" border="0"></a></div><div id="c1">'+html+'</div><div id="layerpopup_pie"><div id="cerrarampliacion">&nbsp;</div></div></div></div> ';
	}

	xInnerHtml(div,popup);

	

	xWidth ('layerpopup',ancho + 6);
	//xHeight ('layerpopup',alto + 6 + 20 + 18);
	xWidth (div,ancho);
	//xHeight (div,alto);
	xWidth ('layerpopup_close',ancho-6);
	
	

	//xInnerHtml(div,'<img src="' + archivo + '" width="' + ancho + '" height="' + alto + '" border="0">')	
	
		
	pos_left = parseInt((xClientWidth()-ancho+3)/2);
	pos_left_actual=-ancho;

	if (xClientHeight() < alto){
		pos_top = xScrollTop() + 10;
	}else{
		pos_top = xScrollTop() + parseInt((xClientHeight() - alto - 20) / 2);
	}

// 	xMoveTo('layerpopup',pos_left_actual,pos_top);
	xMoveTo('layerpopup',pos_left,pos_top);
	
	//situar();
	
	document.getElementById('overlayopacidad').style.backgroundColor='black';
	document.getElementById('overlayopacidad').style.opacity='0.7';
	document.getElementById('overlayopacidad').style.filter='alpha(opacity=70)';
	document.getElementById('overlayopacidad').style.position='absolute';
	document.getElementById('overlayopacidad').style.top='0';
	document.getElementById('overlayopacidad').style.left='0';
	//document.getElementById('overlayopacidad').style.width='1450px';
	//document.getElementById('overlayopacidad').style.height='1100px';
	document.getElementById('overlayopacidad').style.zIndex='99';
	document.getElementById('overlayopacidad').style.display='';

	xWidth ('overlayopacidad',xClientWidth());
	xHeight ('overlayopacidad',xClientHeight()+xScrollTop()+alto);
	//xMoveTo('overlayopacidad',0,xScrollTop());

	xShow('layerpopup');
	document.getElementById('contenedorlayerpopup').style.display='';
	document.getElementById('layerpopup').style.zIndex='999';
	document.getElementById('layerpopup2').style.backgroundColor='white';
	
	if (cerrar != '0'){
		document.getElementById('apopup_close').focus();
	}
	
}

function cerrar_ampliacion(){
	xHide('layerpopup');
	
	document.getElementById('contenedorlayerpopup').style.display='none';
	document.getElementById('overlayopacidad').style.display='none';
	if (document.frm && document.frm.user) document.frm.user.focus();
}

function situar(){
	if (pos_left_actual < pos_left){
		pos_left_actual += 20;
		xMoveTo('layerpopup', pos_left_actual,pos_top);
		setTimeout ('situar()',10);
	}
}
 

