// JavaScript Document<script type='text/javascript'>
var ie  = document.all;
var nn6 = document.getElementById && !document.all;
 
var isdrag=false;
var x,y;
var dobj;
 
function movemouse(e){
 if (isdrag){
  dobj.style.left = nn6 ? (tx+e.clientX-x)+"px" : tx+event.clientX-x;
  dobj.style.top  = nn6 ? (ty+e.clientY-y)+"px" : ty+event.clientY-y;
  return false;
 }
}
 
function selectmouse(e) {
 var fobj       = nn6 ? e.target : event.srcElement;
 var topelement = nn6 ? "HTML" : "BODY";
 while (fobj.tagName!=topelement && fobj.className!="ampliacion"){
  fobj = nn6 ? fobj.parentNode : fobj.parentElement;
 }
 if (fobj.className=="ampliacion"){
  isdrag = true;
  //dobj  = fobj.cloneNode(true);
  dobj = fobj;
  
  if (dobj.filters) {
   try {
    dobj.style.filter="alpha(opacity=70)";
   }
   catch (e) { }
  }
  else if (dobj.style.opacity) {
   dobj.style.opacity = .7;
  }
  
  tx = parseInt(dobj.style.left+0);
  ty = parseInt(dobj.style.top+0);
  x = nn6 ? e.clientX : event.clientX;
  y = nn6 ? e.clientY : event.clientY;
  
  document.onmousemove=movemouse;
  return false;
 }
}

 
function unselectmouse(e){
 if (dobj){
  if (dobj.filters) {
   try {
    dobj.style.filter="alpha(opacity=100)";
   }
   catch(e){ }
  }
 }
  isdrag=false;
  
 dobj=null;
}
 
document.onmousedown = selectmouse;
document.onmouseup   = unselectmouse;








function muestra_imagen(archivo,ancho,alto){
	//xInnerHtml('c1','')
	xWidth ('ampliacion',ancho + 12);
	xHeight ('ampliacion',alto + 6 + 20 + 18);
	xWidth ('c1',ancho);
	xHeight ('c1',alto);
	
	xWidth ('cerrarampliacion',ancho);
	
	
	
	document.getElementById('c1').innerHTML ='<img src="' + archivo + '" width="' + ancho + '" height="' + alto + '" border="0" align="middle" style="border: 1px solid #663300">';	
		
	pos_left = parseInt((xClientWidth()-ancho+3)/2);
	pos_top = xScrollTop() + parseInt((xClientHeight()-alto+10)/2);
	//if (pos_top>150) pos_top = 150
	if (pos_top<10) { pos_top=10; }
	//pos_left=200; // Mueve la ventana, el margen izquierdo
	xMoveTo('ampliacion',pos_left,pos_top);
	setTimeout("xShow('ampliacion')",50);
}

function cerrar_ampliacion(){
	xHide('ampliacion');
	
}