function GF_abreVentanaGra(pag, largo, ancho, izquierda, arriba){
	if (!largo)
		largo = "550";
	if (!ancho)
		ancho = "650";
	if (!izquierda)
		izquierda = "150";
	if (!arriba)
		arriba = "20";
	window.open(pag,"","resizable=no,personalbar=no,location=no,toolbar=no,menubar=no,scrollbars=yes,width=" + ancho + ",height=" + largo + ", left=" + izquierda + ", top=" + arriba);
}


var GF_confBorrar=String.fromCharCode(191) + "Realmente desea realizar esta operacion?";
function GF_confirmar(){
	return (confirm(GF_confBorrar));
}

function GF_cerrarVentana(){
	window.close();
}

function GF_openForm(f,func,largo,ancho){
	GF_abreVentanaGra(f + "?" + _GF_var_funcionRetorno + "=" + func,largo,ancho);

}

function GF_recargarPag(){
	document.location.href=_GF_request_rawUrl;
}

function GF_bEsPopup(){
	return (!(GF_sGetFuncionRetorno()==''));
}

function GF_sGetFuncionRetorno(){
	var sFuncionRetorno;
	try{
		sFuncionRetorno = eval ("_" + _GF_var_funcionRetorno);
		return new String(sFuncionRetorno);
	}catch(e){
		return new String("");
	}
}

function GF_ejecutarFuncionRetorno(id,desc){
	eval("opener." + GF_sGetFuncionRetorno() + "(" +id+ ",'" +GF_sCodificaStringJS(desc)+ "');");
	GF_cerrarVentana();
}

function GF_ejecutarFuncionRetorno_calendario(dumb,fecha){
	eval("opener.document.all('" + GF_sGetFuncionRetorno() + "').value='" +fecha+ "';");
	GF_cerrarVentana();
}


function GF_sCodificaStringJS(s){
	var sRdo =  s.replace("'","*GF_apos_GF*");
	sRdo = sRdo.replace("\n", "*GF_enter_GF*");
	return sRdo;
}

function GF_sDecodificaStringJS(s){
	var sRdo =  s.replace(/\*GF_apos_GF\*/g,"'");
	sRdo = sRdo.replace(/\*GF_enter_GF\*/g,"\n");
	return sRdo
}

function GF_muestraCapa(capa){
	eval("document.all('" + capa + "').style.display='';");
}
function GF_ocultaCapa(capa){
	eval("document.all('" + capa + "').style.display='none';");
}

function GF_openForm_calendario(dFecha){
	GF_abreVentanaGra("calendario.aspx?" + _GF_var_funcionRetorno + "=" + dFecha,380,550);
}

function GF_setSelect(o,id,desc){
	desc = GF_sDecodificaStringJS(desc);
	var bEncontrado = false;
	for (i=0;((i<o.options.length) && (!(bEncontrado)));i++){
		if (o.options(i).value==id){
			bEncontrado=true;
		}
	}
	if (bEncontrado){
		o.selectedIndex = i-1;
		o.item(o.selectedIndex).text=desc;
	}else{
		o.options.add(new Option(desc,id),0);
		o.selectedIndex = 0;
	}
}

function GF_HistoryBack(){
	var n = eval(sVarPagsBack)
		history.go(n);
}
//Se usa cuando una página se llama a si misma, para no volver otra vez a ella.
function GF_HistoryBackMas(){
	var n = eval(sVarPagsBack)
		n=n-2;
		history.go(n);
}