function doResize()
{
setTimeout("location.reload()",10);
}

//Obtiene el ancho de la ventana - It gets window width
function maxWidth()
	{
	if(navigator.appName.indexOf("Explorer") != -1)
		return document.body.clientWidth
	else
		return innerWidth
	}

//Chequea los objetos presentes en el browser - It checks the present objects in browser
function checkObj()
	{
	this.dom = (document.getElementById)
	this.all = (document.all && !this.dom)
	this.lyr = (document.layers && !this.dom)
	}

bws = new checkObj()

//Constructor de objeto - Object constructor
function makeObj(id,nest)
	{
	nest = (!nest) ? "" : "document." + nest + "."
	this.css = (bws.dom) ? document.getElementById(id).style : (bws.all) ? document.all[id].style : (bws.lyr) ? eval(nest + "document." + id) : 0
	this.elm = (bws.dom) ? document.getElementById(id) : (bws.all) ? document.all[id] : (bws.lyr) ? this.css : 0
	this.left = (bws.lyr) ? this.css.left : this.elm.offsetLeft
	this.top = (bws.lyr) ? this.css.top : this.elm.offsetTop
	this.width = (bws.lyr) ? this.css.clip.width : this.elm.offsetWidth
	this.height = (bws.lyr) ? this.css.clip.height : this.elm.offsetHeight
	this.show = lyrShow
	this.hide = lyrHide
	this.moveTo = lyrMoveTo
	this.moveBy = lyrMoveBy
	}

//Muestra el objeto - It shows the object
function lyrShow()
	{
	this.css.visibility = (bws.lyr) ? "show" : "visible"
	}

//Oculta el objeto - It hides the object
function lyrHide()
	{
	this.css.visibility = (bws.lyr) ? "hide" : "hidden"
	}

//Mueve el objeto hasta una posicion específica - It moves the object to a especfic position
function lyrMoveTo(x,y)
	{
	if(x)
		{
		this.left = x
		this.css.left = this.left
		}
	if(y)
		{
		this.top = y
		this.css.top = this.top
		}
	}

//Mueve el objeto tantas unidades - It moves the object by certain units
function lyrMoveBy(x,y)
	{
	if(x)
		{
		this.left += x
		this.css.left = this.left
		}
	if(y)
		{
		this.top += y
		this.css.top = this.top
		}
	}


function get_mouse(e)
{
	var x = (nav) ? e.pageX : event.x+document.body.scrollLeft;
	var y = (nav) ? e.pageY : event.y+document.body.scrollTop;
	skn.left = x + 22;
	skn.top = y - 15;
}
							
function pop(msg,bak,border)
{
	var content = "<table align='center' cellpadding='2' cellspacing='0' border='1' cellpadding='0' cellspacing='0' bgcolor="+bak+" bordercolor="+border+"><tr><td class='descripcion' align='left'>"+msg+"</td></tr></table>";
	if (nav)
	{
		skn.document.write(content);
		skn.document.close();
		skn.visibility = "visible";
	}
	else if (iex)
	{
		document.onmousemove = get_mouse;
		document.all("topdeck").innerHTML = content;
		skn.visibility = "visible";
	}
}

function kill()
{
	if (iex)
	{
		document.onmousemove = "";
		skn.visibility = "hidden";
	}
}

function filtrar2()
{
	if (document.f2.precio.value != "" && document.f2.precio2.value == "")
	{
		alert ("Debe ingresar un monto en el Precio Hasta");
		return;
	}else if(document.f2.precio.value == "" && document.f2.precio2.value != "")
	{
		alert ("Debe ingresar un monto en el Precio Desde");
		return;
	}else if(document.f2.precio.value != "" && document.f2.precio2.value != "")
	{
		if(parseInt(document.f2.precio.value) > parseInt(document.f2.precio2.value))
		{
			alert("El Precio Desde no puede ser mayor al Precio Hasta");
			return;
		}
	}
	for(var i = 0; i < document.f2.elements.length; i++){
		if(document.f2.elements[i].name=="terminal"){	
			if(document.f2.elements[i].checked){
				document.f2.elements[i].checked = false;
			}
		}
	}
	var precio = document.f2.precioTmp.value;
	if (precio>1){
	 document.f2.precio.value=precio*1000;
  }	
	precio = document.f2.precio2Tmp.value;
  if (precio>1){
  	document.f2.precio2.value=precio*1000;
  }	

 	document.f2.submit();
}

function filtrar()
{
	document.f2.submit();
}

function decheckbox(atributo)
{
	alert(atributo);
	if (document.f2.atributo.checked = true)
	 {
		document.f2.filtrar_valor.disabled=1;
	}
}

function popup(URL)
{
	window.open(URL,"","toolbar=no,status=no,directories=no,menubar=no,top="+(screen.availHeight-548)/2+",left="+(screen.width-560)/2+",width=585,height=549");
} 

function ValidaEntrada(objeto)
{
	if(typeof(objeto)!='undefined')		
	{		 
		var number = objeto.value;
		if (event.keyCode >= 48 && event.keyCode<= 57) 
		{	}
		else
		{	
			event.returnValue=false;	
		}
	}
	else
	{
		if ((event.keyCode>= 48 && event.keyCode <= 57) || (event.keyCode == 46))
		{	 }
		else
		{	
			event.returnValue=false;	
		}
	}
}

function validar(parametro)
{
	var cont = 0;
    var chequeo = 0;
    var cantidad = document.f2.terminal.length;

    for(cont = 0; cont < cantidad ; cont++) 
	{
        if (document.f2.terminal[cont].checked) 
		{
        	chequeo++;
        }
    }

    if ((chequeo < 2) || (chequeo > parametro))
	{
        alert("Debe seleccionar entre 2 y "+parametro+" terminales");
        return;
    }
	document.f2.submit();
}

function Deshabilitar()
{ 
	for(i=0;i<document.f2.destacados.length;i++)
	{ 
		document.f2.destacados[i].disabled=1; 
	} 
} 
