
//Solo número en una caja de texto
function soloNUM(caja){
	if (event.keyCode < 48 || event.keyCode > 57 ){
		event.returnValue = false;
		return (false);
	}
	
	return(true);
}


//abrir ventana
function abrirVentana(pagina,ancho,alto) {

	ancho_ventana = screen.Width;
	alto_ventana = screen.Height;
	posY_inicial = Math.round((alto_ventana/2)-(alto/2));
	posX_inicial = Math.round((ancho_ventana/2)-(ancho/2));

	string='"fullscreen=0,resizable=0,scrollbars=1,height='+alto+',width='+ancho+',top='+posY_inicial+',left='+posX_inicial+'"';
	window.open(pagina,"_blank",string,true);
}

//Funcion similar al Left de asp
function Left(str, n)
/***
        IN: str - the string we are LEFTing
            n - the number of characters we want to return

        RETVAL: n characters from the left side of the string
***/
{
        if (n <= 0)     // Invalid bound, return blank string
                return "";
        else if (n > String(str).length)   // Invalid bound, return
                return str;                // entire string
        else // Valid bound, return appropriate substring
                return String(str).substring(0,n);
}

//Funcion javascript que elimina los tags html de un texto
function DelHTML(HTMLWord)
{
a = HTMLWord.indexOf("<");
b = HTMLWord.indexOf(">");

HTMLlen = HTMLWord.length;

c = HTMLWord.substring(0, a);

if(b == -1)
b = a;

d = HTMLWord.substring((b + 1), HTMLlen);

Word = c + d;

tmp = Word.indexOf("<");

if(tmp != -1)
Word = DelHTML(Word);

return Word;
} 

// Nos dice si el contenido de un elemento es nulo
function es_vacio(elem)
{

	if (elem.value.length==0) {
	 return 1;
	}
	else {
		for (k=0;k<elem.value.length;k++)
		{
		  if (elem.value.charAt(k) ==" ")  return 1;
		  else {
				return 0;	
			   }        
		}
	 return 0;
	 }
}

function es_numero(elem)
{
	if (isNaN(elem.value)) 
	{
	 return 1;
	}
	else 
	 return 0;
}

function incrementar(elem,cuanto){
	a=1;
	if(isNaN(elem.value) || parseInt(elem.value) < 1){
		elem.value=1;
	}
	else{
		elem.value = parseInt(elem.value) + cuanto;
	}
	if(elem.value == 0){
		elem.value = 1;
	}
	if(elem.value == 100){
		elem.value = 1;
	}
}


// PAGINA DE INICIO 

versionNav = navigator.appVersion;
placeMSIE5 = versionNav.indexOf("MSIE 5");
function AfficheHomePage()
	{
	if (placeMSIE5 > -1)
		{
		document.write('<A HREF="#" onClick="HomePage(this);return(false);">Haz de <b><font color="#358384"><%=denominacion%></font></b> tu pagina de inicio</A><BR>');
		}
	}
function HomePage(obj, pathabsoluto)
	{
	obj.style.behavior='url(#default#homepage)';
	obj.setHomePage(pathabsoluto);
	}

function openPicture(imageName,imageWidth,imageHeight,alt,posLeft,posTop) {

	newWindow = window.open("","newWindow","width="+imageWidth+",height="+imageHeight+",left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">'); 
	newWindow.document.write('<img src='+imageName+' width='+imageWidth+' height='+imageHeight+' alt="'+alt+'">'); 
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}
//

