// JavaScript Document

function PNG_loader() { 
   for(var i=0; i<document.images.length; i++) { 
      var img = document.images[i]; 
      var imgName = img.src.toUpperCase(); 
      if (imgName.substring(imgName.length-3, imgName.length) == "PNG") { 
         var imgID = (img.id) ? "id='" + img.id + "' " : ""; 
         var imgClass = (img.className) ? "class='" + img.className + "' " : ""; 
         var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "; 
         var imgStyle = "display:inline-block;" + img.style.cssText; 
         if (img.align == "left") imgStyle += "float:left;"; 
         if (img.align == "right") imgStyle += "float:right;"; 
         if (img.parentElement.href) imgStyle += "cursor:hand;"; 
         var strNewHTML = "<span " + imgID + imgClass + imgTitle 
            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" 
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" 
            + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"; 
         img.outerHTML = strNewHTML; 
         i--; 
      } 
   } 
} 
window.attachEvent("onload", PNG_loader);
/*$(document).ready(function(){
	$("#imagess a").click(function(){
		var title = "aplication/webroot/imgs/catalogo/"+ $(this).attr("title");
		var len = title.length;
		var text = title.substr(0,33);
		var newtitle = text + title.substr(39,len);
		$("#imgp").hide();
		$("#imgp").attr("src",title).fadeIn('slow'); 
		$("#imgp").attr("alt",title); 
		$("#grande").attr("href",newtitle); 
	
	});		
	
	$('#menus li').each(function(index){ 
		$(this).click(function(){			                
			$("#subcat"+index).toggle("fast"); 			   
		}); 	  
	});	
});
function busqueda(url,texto){
	
	document.fbuscar.action = url+'&q=' + texto.value;
	document.fbuscar.submit();
}

function checkTheKey(keyCode){
	if(event.keyCode==13){	
		valida();
		return true ;
	}
	return false ;
}
function validnum(e) { 
	tecla = (document.all) ? e.keyCode : e.which; 
	//alert(tecla)
    if (tecla==8 || tecla==46) return true; //Tecla de retroceso (para poder borrar) 
    // dejar la línea de patron que se necesite y borrar el resto 
    //patron =/[A-Za-z]/; // Solo acepta letras 
    patron = /\d/; // Solo acepta números
    //patron = /\w/; // Acepta números y letras 
    //patron = /\D/; // No acepta números 
    // patron = /[\d.-]/; numeros el punto y el signo -
    te = String.fromCharCode(tecla); 
    return patron.test(te);  
	// uso  onKeyPress="return validnum(event)"
}


function ver_compromiso(){
  $('#nosotros').hide('slow');
  $('#compromiso').show('slow');
}
function ver_nosotros(){
  $('#compromiso').hide('slow');
  $('#nosotros').show('slow');
}*/

/*$(document).ready( function(){						   
	$('#menu li').each(function(index){ 
		$(this).click(function(){			                
			$("#subcat"+index).toggle("fast"); 			   
		}); 	  
	});					   

	$("#imagenes a").click( function(){
		var title = $(this).attr("title");
		$("#imgp").hide();
		$("#imgp").attr("src",title).fadeIn('slow'); 
	});	 	
});*/

/*
function validar(){
	if(document.f1.nombre.value==""){
		alert("ERROR: Por favor ingrese su Nombre");
		document.f1.nombre.focus();
		return false;
	}else if(document.f1.apellidos.value==""){
		alert("ERROR: Por favor ingrese sus Apellidos");
		document.f1.apellidos.focus();
		return false;
	}else if(document.f1.email.value==""){
		alert("ERROR: Por favor ingrese su Email");
		document.f1.email.focus();
		return false;
	}else if(document.f1.telefono.value==""){
		alert("ERROR: Por favor ingrese su Telefono");
		document.f1.telefono.focus();
		return false;
	}else if(document.f1.mensaje.value==""){
		alert("ERROR: Por favor dejenos su comentario");
		document.f1.mensaje.focus();
		return false;
	}else{
		document.f1.action="enviar.php";
		document.f1.submit();
		
	}
	
}

function estado_paginador(k){
	
	$("#p"+k).css({background: "#E4E4E4",color: "#333"});
}*/

	

