// 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);

/*function recuperar_acceso(){
		location.replace('index.php?action=recuperar');
}
function eliminar_sesion(){
	location.replace('salir.php');
}

function mantenimiento_categoria(url,opcion,id1,id){
	
	if(opcion!="deletep" && opcion!="deletec"){ 
			location.replace(url+'?id='+id+'&action='+opcion+'&id1='+id1);
	}else if(opcion=="delete"){
		if(!confirm("Esta Seguro que desea Eliminar el Registro")){
			return false;	
		}else{
			location.replace(url+'?id='+id+'&action='+opcion+'&id1='+id1);			
		}		
	}
}*/
function validar(){
	if(document.f1.nombre.value==""){
		alert("ERROR: Por favor ingrese su Nombre");
		document.f1.nombre.focus();
		return false;
	}else if(document.f1.telefono.value==""){
		alert("ERROR: Por favor ingrese sus telefono");
		document.f1.telefono.focus();
		return false;
	}else if(document.f1.email.value==""){
		alert("ERROR: Por favor ingrese su Email");
		document.f1.email.focus();
		return false;
	}/*else{
		document.f1.action='enviar.php';
		document.f1.submit();
	}*/
	
	}

/*
function validas(){
	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.telefonos.value==""){
		alert("ERROR: Por favor ingrese sus telefonos");
		document.f1.telefonos.focus();
		return false;
	}else if(document.f1.deposito.value==""){
		alert("ERROR: Por favor ingrese sus deposito");
		document.f1.deposito.focus();
		return false;
	}else if(document.f1.efectivo.value==""){
		alert("ERROR: Por favor ingrese sus efectivo");
		document.f1.efectivo.focus();
		return false;
	}else if(document.f1.efectivo.value==""){
		alert("ERROR: Por favor ingrese sus efectivo");
		document.f1.efectivo.focus();
		return false;
	}else if(document.f1.descuento.value==""){
		alert("ERROR: Por favor ingrese su descuento");
		document.f1.descuento.focus();
		return false;
	}else{
		return true;	
	}
	
	}


*/


/*function mantenimiento(url,id,opcion){
	if(opcion!="delete"){ 
		location.replace(url+'?id='+id+'&action='+opcion);
	}else if(opcion=="delete"){
		if(!confirm("Esta Seguro que desea Eliminar el Registro")){
			return false;	
		}else{
			location.replace(url+'?id='+id+'&action='+opcion);			
		}		
	}
}*/

/*function validar_delete(url){	
	if(!confirm("Esta Seguro que desea Eliminar el Registro")){
		return false;	
	}
}*/
/*function validar_categorias(opcion, id1, id){
	var name=document.f1.elements['nombre[]']
	for(i=0; i < name.length; i++){
		if(name[i].value==""){
			alert(" ERROR: Por favor ingrese el nombre de Categoria ");
			name[i].focus();
			return false
		}
	}
	
	if(document.f1.imagen.value=="" && opcion == "addc"){
		alert(" ERROR: Por favor ingrese la imagen de categoria ");
		document.f1.imagen.focus();
		return false	
	}else{
		document.f1.action='productos.php?action='+opcion+'&id1='+id1+'&id='+id
		document.f1.submit();
	}
}

function validar_productos(opcion, id1, id){
	
	var name=document.f1.elements['nombre[]']	
	var desc=document.f1.elements['descripcion[]']	
	
	if(name.value==""){
		alert(" ERROR: Por favor ingrese el nombre del producto ");
		name.focus();
		return false
	}else if(desc.value==""){
		alert(" ERROR: Por favor ingrese la descripcion del producto ");
		desc.focus();
		return false
	}else if(document.f1.imagen.value=="" && opcion == "addp"){
		alert(" ERROR: Por favor ingrese la imagen del producto ");
		document.f1.imagen.focus();
		return false	
	
	}else{
		document.f1.action='productos.php?action='+opcion+'&id1='+id1+'&id='+id
		document.f1.submit();
	}
}
*/
/*function validar_delete(){
	if(!confirm("Esta Seguro que desea Eliminar el Registro")){
		return false;	
	}else{
		return true;	
	}	
}

function pasa_precio(Obj, receptor, oferta){
	if(Obj.value!=""){
		var indice= Obj.selectedIndex;
		var texto=Obj.options[indice].text;
		var precio=texto.split("€");
		receptor.value=precio[1];
		oferta.readOnly="";
		oferta.focus();
	}else{
		receptor.value="";
		oferta.readOnly="true";
	}
}
	
function compara_monto(precio, oferta){
	if(precio.value!=""){
		if(parseFloat(oferta.value)>=parseFloat(precio.value)){
			alert("El precio de la oferta tiene que ser menor al precio del producto: "+precio.value )		
		}	
	}		
}	
function mantenimiento_det(url, id1){	
			location.replace(url+'?id1='+id1);			
}

function buscar(url,texto){
	document.f2.action=url+'&q='+ texto.value;
	document.f2.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&iacute;nea de patron que se necesite y borrar el resto 
    //patron =/[A-Za-z]/; // Solo acepta letras 
    patron = /\d/; // Solo acepta n&uacute;meros
    //patron = /\w/; // Acepta n&uacute;meros y letras 
    //patron = /\D/; // No acepta n&uacute;meros 
    // patron = /[\d.-]/; numeros el punto y el signo -
    te = String.fromCharCode(tecla); 
    return patron.test(te);  
	// uso  onKeyPress="return validnum(event)"
}*/



function links(id){
	if(id == 1){
		$("#img1").attr("src","aplication/webroot/imgs/home1.jpg");	
	}
	if(id == 2){
		$("#img2").attr("src","aplication/webroot/imgs/nosotros1.jpg");	
	}	
	if(id == 3){
		$("#img3").attr("src","aplication/webroot/imgs/productos1.jpg");	
	}	
	
	if(id == 4){
		$("#img4").attr("src","aplication/webroot/imgs/contactenos1.jpg");	
	}	
	
	
}




