
function nuevoAjax()
{
	var xmlhttp=false;
	try
	{
		xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(E) { xmlhttp=false; }
	}
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp=new XMLHttpRequest(); }
	return xmlhttp;
}

function abreventana(url, name, w, h, perc, scrolli)
{
	var winX = (screen.availWidth - w)*perc*0.1;
	var winY = (screen.availHeight - h)*perc*0.1;
	if(w==0)
		{
		w=	screen.availWidth;
		}
	if(h==0)
		{
		h=screen.availHeight	;
		}
	var popupWin = window.open(url, name,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars='+scrolli+',resizable=0,width=' + w + ',height=' + h + ',left=' + winX + ',top=' + winY);
	return popupWin;
}


function controlForm(obj,texto)
{
	if(obj.value==texto)
	obj.value='';
}




function resizeWindow(w,h)
{
	if (document.all || document.getElementById)
	{
		window.resizeTo(w,h);
	}
	else if (document.layers||document.getElementById)
		{
			if (window.outerHeight<screen.availHeight|| window.outerWidth<screen.availWidth)
			{
				window.innerHeight =h;
				window.innerWidth = w;
			}
		}
	}

	function getURLParam(strParamName){
		var strReturn = "";
		var strHref = window.location.href;
		if(strHref.indexOf("?")>-1){
			var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
			var aQueryString = strQueryString.split("&");
			for (var i=0;i<aQueryString.length;i++){
				if (aQueryString[i].indexOf(strParamName + "=")>-1){
					var aParam = aQueryString[i].split("=");
					strReturn = aParam[1];
					break;
				}
			}
		}
		return strReturn;
	}

function validar_permisos(obj)
{
	var valor;
	valor=obj.value;
	if (valor==-1)
	{
		window.alert("Sección restringida por permisos");
		obj.selectedIndex=0;
	}
}
function handleEnter (event) 
{
	var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
	if (keyCode == 13) {
		document.getElementById('func').value=1;document.getElementById('f1').submit();
	} 
	else
	return true;
}    