var popupWinmousemoveBack,popupWinmouseupBack;
var popupWinofsX,popupWinofsY;
var popupWintmrHide=-1;
var popupWintmrId=-1;

var incHeight = 26;
var incWidth = 8;
var minHeight = 76;

if (navigator.appName == "Netscape") {
	incHeight = 23;
	incWidth = 68;
	minHeight = 76;
}

        
function popupWinespopup_DragDrop(e) {
  popupWinmousemoveBack=document.body.onmousemove;
  popupWinmouseupBack=document.body.onmouseup;
  ox=(e.offsetX==null)?e.layerX:e.offsetX;
  oy=(e.offsetY==null)?e.layerY:e.offsetY;
  popupWinofsX=ox; popupWinofsY=oy;

  document.body.onmousemove=popupWinespopup_DragDropMove;
  document.body.onmouseup=popupWinespopup_DragDropStop;
  if (popupWintmrHide!=-1) clearInterval(popupWintmrHide);
}


function popupWinespopup_DragDropMove(e) {
	el=document.getElementById('popupWin');          
	if (e==null&&event!=null)
	{
	  el.style.left=(event.clientX*1+document.body.scrollLeft-popupWinofsX)+'px';
	  el.style.top=(event.clientY*1+document.body.scrollTop-popupWinofsY)+'px';
	  event.cancelBubble=true;
	}
	else
	{
	  el.style.left=(e.pageX*1-popupWinofsX)+'px';
	  el.style.top=(e.pageY*1-popupWinofsY)+'px';
	  e.cancelBubble=true;
	}
	if ((event.button&1)==0) popupWinespopup_DragDropStop();
}

function popupWinespopup_DragDropStop() {
  document.body.onmousemove=popupWinmousemoveBack;
  document.body.onmouseup=popupWinmouseupBack;
}
        
function popupWinespopup_Close() {
  if (popupWintmrId==-1)
  {
    el=document.getElementById('popupWin');
    el.style.filter='';
    el.style.display='none';
    if (popupWintmrHide!=-1) clearInterval(popupWintmrHide); popupWintmrHide=-1;
    
  }
}  

//DUPLICADO DE FUNCIONES PARA 2 CAPAS

function popupWinespopup_DragDrop_2(e) {
  popupWinmousemoveBack=document.body.onmousemove;
  popupWinmouseupBack=document.body.onmouseup;
  ox=(e.offsetX==null)?e.layerX:e.offsetX;
  oy=(e.offsetY==null)?e.layerY:e.offsetY;
  popupWinofsX=ox; popupWinofsY=oy;

  document.body.onmousemove=popupWinespopup_DragDropMove_2;
  document.body.onmouseup=popupWinespopup_DragDropStop_2;
  if (popupWintmrHide!=-1) clearInterval(popupWintmrHide);
}


function popupWinespopup_DragDropMove_2(e) {
	el=document.getElementById('popupWin_2');          
	if (e==null&&event!=null)
	{
	  el.style.left=(event.clientX*1+document.body.scrollLeft-popupWinofsX)+'px';
	  el.style.top=(event.clientY*1+document.body.scrollTop-popupWinofsY)+'px';
	  event.cancelBubble=true;
	}
	else
	{
	  el.style.left=(e.pageX*1-popupWinofsX)+'px';
	  el.style.top=(e.pageY*1-popupWinofsY)+'px';
	  e.cancelBubble=true;
	}
	if ((event.button&1)==0) popupWinespopup_DragDropStop_2();
}

function popupWinespopup_DragDropStop_2() {
  document.body.onmousemove=popupWinmousemoveBack;
  document.body.onmouseup=popupWinmouseupBack;
}
        
function popupWinespopup_Close_2() {
  if (popupWintmrId==-1)
  {
    el=document.getElementById('popupWin_2');
    el.style.filter='';
    el.style.display='none';
    if (popupWintmrHide!=-1) clearInterval(popupWintmrHide); popupWintmrHide=-1;
    
  }
}  

//FIN FUNCIONES REPETIDAS

function resizeLayer() {
	var objMain = document.getElementById("popupWin");
	var objTitle = document.getElementById("popupWin_header");
	var obj = document.getElementById("popupWin_content");
	
	var alto = obj.scrollHeight;   	
	var ancho = obj.scrollWidth;
	   	   	
	if (alto < 76) {
		alto = minHeight;
		obj.style.height=minHeight;
	}
	   	
	if (ancho < 224) {
		ancho = 223;
		obj.style.width=224;
	}  	
	objMain.style.height=alto+incHeight;   	
	objMain.style.width=ancho+incWidth;
	objTitle.style.width=ancho;   	
}      
   
function showLayerAdvise(title,textHTML) {
	
	var objMain = document.getElementById("popupWin");
	var objMsgTitle = document.getElementById("popupWintitleEl");
 	var obj = document.getElementById("popupWin_content");
 	obj.innerHTML = textHTML;
 	objMsgTitle.innerHTML	= title;   	
 	objMain.style.display='block';	   		   		   	
 	resizeLayer();

}

function showLayerAdviseBB(title,textHTML) {
	
	var objMain = document.getElementById("popupWin");
	var objMsgTitle = document.getElementById("popupWintitleEl");
 	var obj = document.getElementById("popupWin_content");usemap="#Map_<?=$LANG?>"
 	obj.innerHTML = '<html><body><img border="0" src="Images/popup_descarga.jpg" width="290" height="290" usemap="#Mapa" alt="Aviso Importante"><map name="Mapa"><area shape="rect" alt="Pulsa aqui" coords="190,190,280,280" href="/images/formatoHD.pdf" target="_blank"></map></body></html>';
 	objMsgTitle.innerHTML	= title;   	
 	objMain.style.display='block';	   		   		   	
 	// resizeLayer();
}

//Capa provisional
function showLayerAdviseBB_Importante(title,textHTML) {
	
	var objMain = document.getElementById("popupWin_2");
	var objMsgTitle = document.getElementById("popupWintitleEl_2");
 	var obj = document.getElementById("popupWin_content_2");usemap="#Map_<?=$LANG?>"
 	obj.innerHTML = '<html><body><table><tr><td>Estimados clientes:</td></tr><tr><td><br>Por ajustes de carácter técnico actualmente nuestros números de atención telefónica 902 408 408 y 902 15 72 78 permanecen fuera de servicio. Para ponerse en contacto con la empresa, por favor, utilicen estos números de teléfono:</td></tr><tr><td><u>DIVISIÓN CONSUMER PRODUCTS</u></td></tr><tr><td>Servicio Técnico Consumer Products:93 300 11 81</td></tr><tr><td>Teléfono comercial y de atención:93 300 11 76</td></tr><tr><td><u>DIVISIÓN COMPUTER PRODUCTS</u></td></tr><tr><td>Servicio Técnico Computer Products:902 366 711 </td></tr><tr><td>Teléfono comercial y de atención:902 234 444</td></tr><tr><td><br>Rogamos que disculpen las posibles molestias.</td></tr></table></body></html>';
 	objMsgTitle.innerHTML	= title;   
 	objMain.style.display='block';	   		   		   	
 	// resizeLayer();
}