﻿function CerrarVentana(){
	window.close();
}
//Para asignar el foco a un control en los controles de usuario
function AsignaFocoControlUC(pstrControlUsuario){
	if (document.getElementById(pstrControlUsuario).value != ""){
		objCampo = document.getElementById(document.getElementById(pstrControlUsuario).value);
		objCampo.focus();
		document.getElementById(pstrControlUsuario).value = "";
	}
}

function CentrarVentana(win,winW,winH){
	var Xpos = (screen.width / 2) - (winW / 2);
	var Ypos = (screen.height / 2) - (winH / 2);
	win.moveTo(Xpos,Ypos);
}

function MuestraCabecera(visible){
	if (visible){
		document.getElementById("trLogo").style.display = '';
	}else{
		document.getElementById("trLogo").style.display = 'none';
	}
}
function AbrePopUp(url,parameters){
	var oWin = window.open(url,'GenPopUp',parameters);
	if (!oWin){
		var result = confirm('Tiene habilitado un bloqueador de ventanas emergentes,\npara intentar de nuevo acepte dejando presionado la tecla CTRL');
		if (result){
			AbrePopUp(url,parameters);
		}
		//else{
			// //return false;
		// }
	}else{
		oWin.focus();
		//return true;
	}
	//return false;
}
function NoBack(){
	window.history.forward(1);
}

/* Agregadas por Rigo para el buscador */
function ValidaFormularioBuscadorInterno()
{
	if (document.getElementById("txtSearch").value == "")
	{
		document.getElementById("txtSearch").focus();
		alert("Debe de escribir un criterio de búsqueda");
		return false;
	}
	else
	{
			Busqueda();
			return true;
	}
}
function Busqueda()
{
	if (document.getElementById("txtSearch").value != "")
	{
		if (document.getElementById("waitingSearch").style.display != 'block')
			document.getElementById("waitingSearch").style.display = 'block';
				
		if (document.getElementById("searchResult").style.display != 'none')
			document.getElementById("searchResult").style.display = 'none';
	}
}
/*  Edn Funciones de Buscador  */
function click(elEvento)
{
	var evento = elEvento || window.event;
	if(evento.button==2)
	{
		alert('No esta permitida esta Accion')
	}
}

function checaTeclado()
{
	//alert(window.event.keyCode)
	if (window.event)
		if(window.event.ctrlKey)
		{
			return false;
		}
	if (window.event)
	{
		if(window.event.keyCode == 115)
		{
			window.event.keyCode = 505;
			window.event.returnValue = false;
		}
	}
	if (window.event.keyCode && (window.event.keyCode == 112 || window.event.keyCode ==115 || window.event.keyCode == 116 || window.event.keyCode == 122 || window.event.keyCode == 8 || window.event.keyCode == 18))
	{
		window.event.keyCode = 505; 
	}
	if(window.event && window.event.keyCode == 505)
	{ 
		return false; 
	}
}
function DisableWindowElemets(){
	alert('Entra');
	window.locationbar.visible= false;
}
var _isHiddenSlect;
if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //para MSIE x.x;
     var ieversion=new Number(RegExp.$1) // captura version x.x 
     if (ieversion<=6) _isHiddenSlect=true;
}
//accion : inline o none
//contenedor:  nombre completo o parte del nombre del control que contiene los combos
function OcultaApareceControlSelect(accion,contenedor){
if (_isHiddenSlect)
    {
        var arrLitadoSelect = window.document.all.tags("SELECT");
        for(intCont = 0; intCont < arrLitadoSelect.length; intCont++){
            arrLitadoSelect[intCont].style.display=accion;
        } 
    }
}