    
function ltrim(s){   
    return s.replace(/^\s+/, "");
}

function rtrim(s){   
    return s.replace(/\s+$/, "");
}

function trim(s){   
    return rtrim(ltrim(s));
}

function GetControl(ctl_id) {
    return window.ASPxClientControl.GetControlCollection().Get(ctl_id);
}

function showPopup(pop_id, ctl_id) {
    var pop = GetControl(pop_id);
    var window = pop.GetWindowByName(pop_id);

    pop.ShowWindowAtElementByID(window,ctl_id); 
}

function hidePopup(pop_id){
    var popupControl = GetControl(pop_id);
    popupControl.Hide();
}

function validar_decimal(value){
    return !isNaN(value.replace(',','.'));
}

function doHourGlass()
{
	//Poner el cursor como reloj de arena, con la version 7 de IE parece no funcionar, con Firefox si
	document.body.style.cursor = 'wait';
}

function doTimeOut() {
    for (i = 1; i < 2000000; i++) {
    }
    document.body.style.cursor = "default";
}

/*-------------------------------------------*/

var result;
var ventana;
 
function screenHeight() {return screen.availHeight;}
function screenWidth()  {return screen.availWidth; }
 
function abrirInterficie(location)
{
    var winprops = 'directories=no, toolbar=no,menubar=no, scrollbars=no,status=no,resizable=0, height='+screenHeight()-10+',width='+screenWidth()-10+',top='+0+',left='+0+'w';
    var f = window.open(location, "ACSE", winprops);
}	
 
function abrirVentana(location,w,h,scroll,resizable,menus)
{
	var l=0;
	var t=0;
	
	if (w!=0) l = (screen.availWidth - w) / 2;
	else w=screen.availWidth;
	
	if (h!=0) t = (screen.availHeight - h) / 2;
	else h=screen.availHeight;
	
	if (scroll==null){scroll="yes";}
	if (resizable==null){resizable="no";}
	if (menus==null){menus="no";}
	var winprops = 'directories=no, toolbar=no,menubar=' + menus+ ', scrollbars='+ scroll+',status=no,resizable=' + resizable +', height='+h+',width='+w+',top='+t+',left='+l+'w';
	var f = window.open(location,"_blank", winprops);
	return f;
 }

function evaluarPostBack(result){
	if (result)	{ 
		realizarPostBack();
	}
}
function establecerValor(result){
	if(document.getElementById('hdRetornoDialogo')!=null){	
		if (result) 
			document.getElementById('hdRetornoDialogo').value=result;
		else
			document.getElementById('hdRetornoDialogo').value="";
	}
}

function establecerResultado(r){
	result=r;

}

function establecerFoco(e) {
	var dialog = ventana;
	if ( dialog != null && !dialog.closed ) {
		dialog.focus();
		if ( window.event ) {
			window.event.cancelBubble = true;
		}
		if ( e && e.stopPropagation ) {
			e.stopPropagation();
		}
		if ( typeof ( dialog.establecerFoco ) != "undefined" ) {
			dialog.establecerFoco(e);
		}
		return false;
	}
	return true;
}

function getValorRetornoDlg(){
	var r;
	r="";
	if(document.getElementById('hdRetornoDialogo')!=null)
	{
		if (document.getElementById('hdRetornoDialogo').value!="")
		{
			r=document.getElementById('hdRetornoDialogo').value;
		}
	}
	return r;
}

 function nada(){}

 function cambiarTitulo(nuevoTitulo){
	if(document.title)
		document.title=nuevoTitulo;
 }
 
 function cambiarTituloDialogo(nuevoTitulo){ 
	window.top.document.title=nuevoTitulo;
 }
 
 function resize(w,h){
 		var ileft,itop;
		ileft=Math.round((window.screen.availWidth-w)/2);
  		if (ileft<0) ileft=0;
		itop=Math.round((window.screen.availHeight-h)/2);
 		if (itop<0) itop=0;
		top.window.moveTo(ileft,itop);
		top.window.resizeTo(w,h);	
 }
 
 function ocuparMaximo(){
	try
	{	
		top.window.moveTo(0,0);
		top.window.resizeTo(screenWidth(),screenHeight());
	}
	catch(e)
	{}
 }	
 
 //--------------------------------------------------
//	Función para identificar el navegador que está
//	utilizando el cliente
//--------------------------------------------------
function NavegadorIE() {
	if (navigator.appName.indexOf("Microsoft") != -1) {
		return true;
	} else {
		return false;
	}
}