// JavaScript Document
function mv(id,dir,inc,int){if (inc == null) {inc=2;}if (int == null) {int=20;}var obv=document.getElementById(id);var axv=obv.offsetWidth;var ayv=obv.offsetHeight;var ob=document.getElementById('i'+id);var ax=ob.offsetWidth;var ay=ob.offsetHeight;var px=ob.offsetLeft;var py=ob.offsetTop;nx=px;ny=py;switch (dir) {case 'i':nx=px-inc;break;case 'd':nx=px+inc;break;case 'a':ny=py-inc;break;case 'b':ny=py+inc;break;case 'ii':nx=0;break;case 'ia':ny=0;break;case 'fi':nx=axv-ax;break;case 'fa':ny=ayv-ay;break;case 'ini':nx=0;ny=0;break;case 'fin':nx=axv-ax;ny=ayv-ay;break;}
if (eval(ax+nx) < axv-1){nx=px;}if (nx >0) {nx=px;}if (eval(ay+ny) < ayv-1){ny=py;}if (ny >0) {ny=py;}ob.style.left=nx;ob.style.top=ny;mvd=setTimeout("mv('" + id + "','" + dir + "',"+ inc + "," + int + ")",int)}
function stopmv(){if (window.mvd) clearTimeout(mvd)}
function vvisor(IDname,img){document[IDname].src=img}
function iframevisor(IDname,img){parent.document[IDname].src=img}
function awin(URL,winName,features) {window.open(URL,winName,features);}
function imprimir(){	window.focus();window.print();}
function ietruebody(){return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement:document.body}
function swv(id){if (document.getElementById(id) != null) {if (document.getElementById(id).style.display=='none') {document.getElementById(id).style.display='block';}else {document.getElementById(id).style.display='none';}}return;}
function visible(id,acc){if (document.getElementById(id) != null){if (acc=='+') {document.getElementById(id).style.display='block';}if (acc=='-') {document.getElementById(id).style.display='none';}}return;}
function playMp3(id,soundfile,loop){document.getElementById(id).innerHTML="";document.getElementById(id).innerHTML="<embed src=\""+soundfile+"\" hidden=\"true\" autostart=\"true\" volume=\"0\" loop=\""+loop+"\" /></embed>";return;}
function swtabs(id,ct,ab){for (i=1; i<ct+1; i++){if (document.getElementById(id + "-" + i) != null){document.getElementById(id + "-" + i).style.display='none';document.getElementById('o' + id + "-" + i).className='o' + id + 'none';}}if (document.getElementById(id + "-" + ab) != null){	document.getElementById(id + "-" + ab).style.display='block';document.getElementById('o' + id + "-" + ab).className='o' + id + 'block';}}
function cflo(id,thetext,ev,tipo,tm,tw,th,iw,ih){z=9
var ob=document.createElement('div');ob.id=id;ob.className="cvflomov";
//ob.style.zIndex = z++;
document.body.appendChild(ob);vflo(id,thetext,ev,tipo,tm,tw,th,iw,ih);Drag.init(ob);return;}

// trata el tamaño de la ventana flotante
function tflo(id,acc){if (document.getElementById('i-'+id) != null) {
var vi=30;var mw=200;var mh=100;
var ob=document.getElementById('i-'+id);var obv=document.getElementById(id);
var ax=ob.offsetWidth;var ay=ob.offsetHeight;
var axv=obv.offsetWidth;var ayv=obv.offsetHeight;
var by=document.body.clientHeight;var bx=document.body.clientWidth;
var sx=(window.pageXOffset)? pageXOffset:ietruebody().scrollLeft;var sy=(window.pageYOffset)? pageYOffset:ietruebody().scrollTop;
switch (acc) {
case '+':ix=ax+eval((bx*vi)/100);iy=ay+eval((by*vi)/100);
if (eval(ob.style.left+ix)>bx){ix=bx-0;obv.style.left=0;}
if (iy>by){iy=by;}
ix=ix+"px";iy=iy+"px";break;
case '-':ix=ax-eval((ax*vi)/100);iy=ay-eval((ay*vi)/100);
if (ix<mw){ix=mw}
if (iy<mh){iy=mh}
ix=ix+"px";iy=iy+"px";break;
case 'M':ix=bx-eval((axv-ax)+0);iy=by-eval((ayv-ay)+0);
ix=ix+"px";iy=iy+"px";obv.style.top=sy;obv.style.left=0;break;
case 'N':ix="auto";iy="auto";break;}
if (document.getElementById('a-'+id).style.display=='none'){document.getElementById('a-'+id).style.display='block';}
ob.style.width=ix;ob.style.height=iy;}
return;}


// visualiza y posiciona el flo
function vflo(id,thetext,ev,tipo,tm,tw,th,iw,ih){
var sx=(window.pageXOffset)? pageXOffset:ietruebody().scrollLeft
var sy=(window.pageYOffset)? pageYOffset:ietruebody().scrollTop;
var ob=document.getElementById(id)
var by=document.body.clientHeight;var bx=document.body.clientWidth;
do {thetext=thetext.replace('“','\"');} while(thetext.indexOf('“') >= 0);
ob.innerHTML=thetext;
// se le da tamaño si trae tm
if (document.getElementById('i-'+id) != null) {
var obi=document.getElementById('i-'+id)
if (tm>0){ix=eval((bx*tm)/100);iy=eval((by*tm)/100);obi.style.width=ix+"px";obi.style.height=iy+"px";}
if (tw>0){ix=eval(tw);obi.style.width=ix+"px";}
if (th>0){iy=eval(th);obi.style.height=iy+"px";}
}
var ax=ob.offsetWidth;var ay=ob.offsetHeight;
py=eval(ev.y+sy);px=eval(ev.x+sx);
if(tipo == "") {tipo="PCC"}
// sx sy valor del scroll
// by bx ancho pantalla
//ev.x ev.y posicion actual del evento
//ix iy tamaño q se le da al iframe
// ax ay tamaño de la ventana con table
// px py valor final
switch (tipo){
case 'O':py=eval(ev.y+sy);px=eval(ev.x+sx);break;
case 'AUT':
//if (document.getElementById('i-'+id) != null) {
//var obb=document.getElementById('i-'+id)
//iy=document.getElementById('i-'+id).document.body.offsetHeight; 
//ix=document.getElementById('i-'+id).document.body.offsetWidth;
//iy=document.getElementById('i-'+id).document.body.scrollHeight; 
//ix=document.getElementById('i-'+id).document.body.scrollWidth;

//obb.style.height=iy+"px";
//obb.style.Width=ix+"px";
//obb.style.height=ay+"px";
//obb.style.width=ax+"px";
//}
// lo posiciona en el centro
py=eval(eval(by/2)-eval(ay/2))+sy;px=((bx/2)-eval(ax/2))+sx;break;
case 'OAI':py=eval(eval(ev.y+sy)-ay);px=eval(ev.x+sx-ax);break;
case 'OAD':py=eval(eval(ev.y+sy)-ay);px=eval(ev.x+sx);break;
case 'OBI':py=eval(ev.y+sy);px=eval(ev.x+sx-ax);break;
case 'OBD':py=eval(ev.y+sy);px=eval(ev.x+sx);break;
case 'OAC':py=eval(eval(ev.y+sy)-ay);px=eval(eval(ev.x+sx)-eval(ax/2));break;
case 'OBC':py=eval(ev.y+sy);px=eval(ev.x+sx-eval(ax/2));break;
case 'OCC':py=eval(eval(ev.y+sy)-eval(ay/2));px=eval(eval(ev.x+sx)-eval(ax/2));break;
case 'PCC':py=eval(eval(by/2)-eval(ay/2))+sy;px=((bx/2)-eval(ax/2))+sx;break;
case 'PAI':py=sy;px=sx;break;
case 'PAD':py=sy;px=eval(bx-ax)+sx;break;
case 'PAC':py=sy;px=((bx/2)-eval(ax/2))+sx;break;
case 'PBI':py=eval(by-ay)+sy;px=sx;break;
case 'PBD':py=eval(by-ay)+sy;px=eval(bx-ax)+sx;break;
}
// maximo al pintar
if (iw){px=eval(px+eval(iw))} // incrementa px
if (ih){py=eval(py+eval(ih))} // incrementa py
if (eval(py+ay)>eval(by+sy)){py=eval(eval(by-ay)+sy);}
if (eval(px+ax)>eval(bx+sx)){px=eval(eval(bx-ax)+sx);}
if (px<sx){px=sx;}
if (py<sy){py=sy;}
ob.style.display="block";
ob.style.left=px;
ob.style.top=py;
return;}

function qflo(id){
var ob=document.getElementById(id);ob.style.display="none";
//document.getElementById(id).innerHTML="";
//ob.parentNode.removeChild(ob);
}
function mv(id,dir,inc,int){if (inc == null) {inc=2;}if (int == null) {int=20;}var obv=document.getElementById(id);var axv=obv.offsetWidth;var ayv=obv.offsetHeight;var ob=document.getElementById('i'+id);var ax=ob.offsetWidth;var ay=ob.offsetHeight;var px=ob.offsetLeft;var py=ob.offsetTop;nx=px;ny=py;switch (dir) {case 'i':nx=px-inc;break;case 'd':nx=px+inc;break;case 'a':ny=py-inc;break;case 'b':ny=py+inc;break;case 'ii':nx=0;break;case 'ia':ny=0;break;case 'fi':nx=axv-ax;break;case 'fa':ny=ayv-ay;break;case 'ini':nx=0;ny=0;break;case 'fin':nx=axv-ax;ny=ayv-ay;break;}if (eval(ax+nx) < axv-1){nx=px;}if (nx >0) {nx=px;}if (eval(ay+ny) < ayv-1){ny=py;}if (ny >0) {ny=py;}ob.style.left=nx;ob.style.top=ny;mvd=setTimeout("mv('" + id + "','" + dir + "',"+ inc + "," + int + ")",int)}
function stopmv(){if (window.mvd) clearTimeout(mvd)}
function ImprDiv(nombre){var ficha=document.getElementById(nombre);var ventimp=window.open(' ','Imprimir');ventimp.document.write(ficha.innerHTML);ventimp.document.write(ficha.innerHTML);ventimp.document.close();ventimp.print( );ventimp.close();} 

var Drag = {obj : null,init:function(o,oRoot,minX,maxX,minY,maxY,bSwapHorzRef,bSwapVertRef,fXMapper,fYMapper)
	{o.onmousedown	=Drag.start;o.hmode= bSwapHorzRef ? false : true ;o.vmode= bSwapVertRef ? false : true ;o.root = oRoot && oRoot != null ? oRoot : o ;
		if (o.hmode  && isNaN(parseInt(o.root.style.left  ))) o.root.style.left="0px";	if (o.vmode  && isNaN(parseInt(o.root.style.top   ))) o.root.style.top="0px";if (!o.hmode && isNaN(parseInt(o.root.style.right ))) o.root.style.right="0px";if (!o.vmode && isNaN(parseInt(o.root.style.bottom))) o.root.style.bottom="0px";
		o.minX= typeof minX != 'undefined' ? minX : null;o.minY=typeof minY != 'undefined' ? minY : null;o.maxX=typeof maxX != 'undefined' ? maxX : null;o.maxY= typeof maxY != 'undefined' ? maxY : null;o.xMapper = fXMapper ? fXMapper : null;o.yMapper = fYMapper ? fYMapper : null;o.root.onDragStart	= new Function();o.root.onDragEnd=new Function();o.root.onDrag		= new Function();
	},start : function(e){var o = Drag.obj = this;e = Drag.fixE(e);var y=parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);var x=parseInt(o.hmode ? o.root.style.left : o.root.style.right );o.root.onDragStart(x, y);o.lastMouseX= e.clientX;o.lastMouseY	= e.clientY;
		if (o.hmode) {if (o.minX != null) o.minMouseX= e.clientX - x + o.minX;
			if (o.maxX != null) o.maxMouseX= o.minMouseX + o.maxX - o.minX;}
			else {if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x;
			if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x;}
		if (o.vmode) {if (o.minY != null) o.minMouseY= e.clientY - y + o.minY;
			if (o.maxY != null) o.maxMouseY= o.minMouseY + o.maxY - o.minY;
		} else {if (o.minY != null) o.maxMouseY= -o.minY + e.clientY + y;
			if (o.maxY != null) o.minMouseY= -o.maxY + e.clientY + y;}
		document.onmousemove	=Drag.drag;document.onmouseup=Drag.end;return false;},drag : function(e){e=Drag.fixE(e);var o=Drag.obj;var ey=e.clientY;var ex=e.clientX;var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom);	var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );var nx, ny;
		if (o.minX != null) ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX);
		if (o.maxX != null) ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX);
		if (o.minY != null) ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY);
		if (o.maxY != null) ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY);
		nx=x+((ex - o.lastMouseX)*(o.hmode ? 1 : -1));ny=y+((ey - o.lastMouseY)*(o.vmode ? 1 : -1));
		if (o.xMapper) nx = o.xMapper(y)
		else if (o.yMapper)	ny = o.yMapper(x)
		Drag.obj.root.style[o.hmode ? "left" : "right"] = nx + "px";Drag.obj.root.style[o.vmode ? "top" : "bottom"]=ny + "px";Drag.obj.lastMouseX	= ex;	Drag.obj.lastMouseY	= ey;Drag.obj.root.onDrag(nx, ny);return false;
	},end : function(){document.onmousemove = null;document.onmouseup=null;Drag.obj.root.onDragEnd(parseInt(Drag.obj.root.style[Drag.obj.hmode ? "left" : "right"]),parseInt(Drag.obj.root.style[Drag.obj.vmode ? "top" : "bottom"]));	Drag.obj = null;
	},fixE : function(e){if (typeof e == 'undefined') e = window.event;
		if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;
		if (typeof e.layerY == 'undefined') e.layerY = e.offsetY;
		return e;}};