function translate(key){
  var result=null;
  if(document.texts){
    result = document.texts[key];}
  if(!result) alert("Translation missing for:\""+key+"\".");
  if(!result) result = key;
  return result;
  }
  
function reloadMenu(){
  window.top.frames[3].reloadMenu();
  }

function reloadHeader(){
  window.top.frames[8].reloadHeaderInt();
  }

function print_page(){
	window.parent.frames['content'].focus();
	window.parent.frames['content'].print();
	}

function abrir_ventana_Centrada(lapagina,elnombre,ancho,alto,scroll,saving_changes){
	if(saving_changes){
		if(unsavedChanges()) confirmDataNotSaved();    
		if (!unsavedChanges()) {
			var win = null;
			LeftPosition = (screen.width) ? (screen.width-ancho)/2 : 0;
			TopPosition = (screen.height) ? (screen.height-alto)/2 : 0;
			settings ='status=0, height='+alto+',width='+ancho+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable';
			win = window.open(lapagina,elnombre,settings);
			win.focus();
			}
		}
	else{
		var win = null;
		LeftPosition = (screen.width) ? (screen.width-ancho)/2 : 0;
		TopPosition = (screen.height) ? (screen.height-alto)/2 : 0;
		settings =
		'status=0, height='+alto+',width='+ancho+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
		win = window.open(lapagina,elnombre,settings);
		win.focus();
		}
  }

function registerChanges(){
  window.top.document.unsavedChanges = true;
  }

function clearChanges(){
  window.top.document.unsavedChanges = false;
  }

function unsavedChanges(){
  return (window.top.document.unsavedChanges == true);
  }

function openPageInFrame(url, frameName){
  if(unsavedChanges()) confirmDataNotSaved();    
  if (!unsavedChanges()) window.top.frames[frameName].location.href = url;
  }
  
function openPage(url){
  if(unsavedChanges()) confirmDataNotSaved();    
  if (!unsavedChanges()) window.top.location.href = url;
  }
  
function openPageInNewWindow(url, name){
  if(unsavedChanges()) confirmDataNotSaved();    
  if (!unsavedChanges()) window.open(url,name);
  }
  
function openPrintPage(url){
  if(unsavedChanges()) alert(translate("save_before_print"));
  else abrir_ventana_Centrada(url,'Print',800,600,'yes',true);
  }
  
function openHeaderPage(pageUrl, headerUrl){
  if(unsavedChanges()) confirmDataNotSaved();    
  if (!unsavedChanges()) {
    openPageInFrame(pageUrl, "content");
    openPageInFrame(headerUrl, "header");
    }
  }
  
function confirmDataNotSaved(){
  var result = confirm(translate("discard_changes")+"\n\n("+translate("eRegistry_name")+")");
  if (result) clearChanges();
  return result;
  }

function pingGf(){
  alert("ping: global_funtions.js");
  }
  
function pingGfFc(){
  alert("pingGfFc");
  pingFc();
  }
  
function msg(message){
  if(window.top.document.debug){
    if(window.top.document.debugWindow==null)alert(message);
    else window.top.document.debugWindow.debugMsg(message);
    }
  }