function IsNumericJava(strString)
//Funcion que verifica si un cadena es un numero o un punto
//Devuelve un valor true si es un numero, y false si no es un numero
{
   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;
  
   if (strString.length == 0) return false;
  
   for (i = 0; i < strString.length && blnResult == true; i++)
   {
		strChar = strString.charAt(i);
		if (strValidChars.indexOf(strChar) == -1)
		{
			blnResult = false;
		}
   }
   return blnResult;
}
   
function Validar() 
{
	var txt=FormBusc.txtSearch.value
	
	if ((txt.length<3)||(IsNumericJava(txt)))
	{
		alert('Ingrese un texto de busqueda con al menos tres caracteres no numericos')
		FormBusc.txtSearch.value='users';
		return;
	}
	FormBusc.submit();
}

function NoEnter() 
{
	var txt=FormBusc.txtSearch.value
	
	if (event.keyCode == 13)
	{
		Validar(); 
		return(1);
	}
	else return;
}


function popup(destino)
{
	var ventana = window.open(destino, "_blank", "left=10, top=10, width=300, height=300, toolbar=no, location=no, status=yes, menubar=no, resizable=yes, scrollbars=yes");
}

function popupFijo(destino)
{
	var ventana = window.open(destino, "_blank", "left=100, top=100, width=300, height=300, toolbar=no, location=no, status=no, menubar=no, resizable=no, scrollbars=no");
}


function QuitarDeLaCanasta(cual)
{
	var prod;
	prod = document.getElementById(cual);
	prod.value = 0;
	frm.submit();
}

function getHTTPObject() 
{
    var xmlhttp;
    /*@cc_on
    @if (@_jscript_version >= 5)
       try {
          xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
       } catch (e) {
          try {
             xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
          } catch (E) { xmlhttp = false; }
       }
    @else
    xmlhttp = false;
    @end @*/
    if (!xmlhttp && typeof XMLHttpRequest != 'undefined') 
    {
		try 
		{
			xmlhttp = new XMLHttpRequest();
		} 
		catch (e) 
		{ 
			xmlhttp = false; 
		}
    }
    return xmlhttp;
}	

$(document).ready(function() 
{
	$('#slide_colecc').cycle({
		fx: 'curtainX', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		timeout: 5000,
		before: function()
		{
			$('.slideshow img').css('display', 'block');
		}
	});
	$('#slide_libros1').cycle({
		fx: 'zoom', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		before: function() 
		{
			$('#caption_libros1').html(this.rel);
		}	
	});	
	$('#slide_libros2').cycle({
		fx: 'turnDown', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		before: function() 
		{
			$('#caption_libros2').html(this.rel);
		}	
	});			
});

// Validar de valores solo numericos
// Agregar class="solonum" a todos los inputs que se quieran validar
$(document).ready(function()
{
	$(".solonums").each(function()
	{
		$(this).keypress(function (e)
		{
			if( e.which!=8 && e.which!=0 && (e.which<48 || e.which>57))
			{
				return false;
			}
		})
	});
});
