//***************************************************
//  Desarrollado por: Daniel Castro
//  Compaņia: Enfoque Sol. Inf.
//  Version: 2.0
//  Fecha version: 08/02/2006
//***************************************************

ampliacion=null;

function ampliarImagen(img,w,h){popup("ampliacion.php?img="+img,w,h); }

function popupImg(src,w,h) {
	var loaded=false;
	var img = new Image();
	img.onload=function(){loaded=true;}
	img.src = src;
	checkLoad();
	function checkLoad() {
		if (loaded) { popup(src,img.width,img.height);
		} else {setTimeout(checkLoad,50);}
	}
}

function popup(src,w,h) {
	var ie = document.all != undefined;
	if (ie){
		w=w+37;
		h=h+35;
	}
	if (w>screen.width || h>screen.height) {
		if (w>screen.width) {w=screen.width;}
		if (h>screen.height) {h=screen.height;}
		prop="scrollbars=yes, resizable=yes,";
	} else { prop="scrollbars=yes, resizable=no,";}
	l=Math.floor((screen.width-w)/2);
	t=Math.floor((screen.height-h)/2);
	prop=prop+"width="+w+",height="+h+",top="+t+",left="+l+',status=no,menubar=no,toolbar=no,location=no,directories=no,titlebar=no,border=0';
	if (ampliacion !=null){
		ampliacion.close();
		//setTimeout("ampliacion.focus();",500);
	}
	ampliacion=open(src,null,prop);
}

function ajax() {
        try { ajax = new ActiveXObject("Msxml2.XMLHTTP");}
        catch (e) {
                try {ajax= new ActiveXObject("Microsoft.XMLHTTP");}
                catch (E) { objetus= false;}
        }
        if (!ajax && typeof XMLHttpRequest!='undefined') {ajax = new XMLHttpRequest();}
        return ajax;
}

function ajaxLoadCb(cb,idx,val1){
	miAjax=ajax();
	miAjax.open("GET","/rita/ajaxCombos.php?idx="+idx+"&val1="+1,false); //+val1,true);
	miAjax.onreadystatechange=function() { 
		if (miAjax.readyState==4) {
			if(miAjax.status==200) {
				//arr=miAjax.responseText;arr=arr.split('#');
				//arrTxt=arr[0].split(',');
				//arrVal=arr[1].split(',');
				//cb=document.getElementById(cb);
				//for (i=0;i<cb.length;i) {cb.remove(i);}
				//for (i=0;i<arrTxt.length;i++) {cb[i]=new Option(arrTxt[i], arrVal[i], false);}
				alert(miAjax.responseText);
			}
		}
	}
	miAjax.send(null);
}