// JavaScript Document





$(document).ready( function(){						   


	$("#tip_cl_e").click( function(){
		if($("#tip_cl_e").is(':checked')){
		document.getElementById('mi_dni_lbl').style.display='block';
		document.getElementById('mi_dni_txt').style.display='block';
		document.getElementById('mi_empresa_lbl').style.display='block';
		document.frm_reg.empresa.style.display='block';
		}
	}); 	
	$("#tip_cl_p").click( function(){
		if($("#tip_cl_p").is(':checked'))  {
		document.getElementById('mi_dni_lbl').style.display='none';
		document.getElementById('mi_dni_txt').style.display='none';
		document.getElementById('mi_empresa_lbl').style.display='none';
		document.frm_reg.empresa.style.display='none';
		}
	}); 	
	
	/*$("#imagess a").click(function(){
		var title = "http://localhost/technonavi/aplication/utilities/img.php?imagen="+ $(this).attr("title")+ "&w=220&h=200";
		//alert(title);
		var len = title.length;
		var text = title.substr(0,39);
		//var newtitle = text + title.substr(39,len);
		var newtitlee = "aplication/webroot/imgs/catalogo/"+$(this).attr("title") ;
		//alert(newtitle);
		$("#imgp").hide();
		$("#imgp").attr("src",newtitlee).fadeIn('slow'); 
		$("#imgp").attr("alt",newtitlee); 
		
		//alert(newtitle);
		$("#grande").attr("href",newtitlee); 
	
	});	*/
/*	$("#categoriess div").each(function(id){
		var color = "";
		$(this).mouseover(function(){
			$("#c"+id).css("background","#E5E5E5");
		});
		$(this).mouseout(function(){
			if(id%2 ==0){
				color = "#F2F2F2";	
			}else{
				color = "#FFFFFF";
			}
			$("#c"+id).css("background",color);
		});
		
		
		
	});*/
	
	$("#imagess a").mouseover(function(){
		var title = "aplication/webroot/imgs/catalogo/thumb_"+ $(this).attr("title");
		//alert(title);
		var len = title.length;
		var text = title.substr(0,33);
		//var newtitle = text + title.substr(39,len);
		//alert(newtitle);
		var newtitle = "aplication/webroot/imgs/catalogo/"+ $(this).attr("title");
		$("#imgp").hide();
		$("#imgp").attr("src",title).fadeIn('slow'); 
		$("#imgp").attr("alt",title); 
		$("#grande").attr("href",newtitle); 
	
	});	
	
	
	$("#find").click( function(){
		var keyword = $("#buscar").val()					   	
		buscar('index.php',keyword)							
	});
	
	randomtip();
	randomtip2();
	randomtip3();
	

	
	
	
	
	$(".mas_email").bind("click", function(){
		y =  document.ahijados.elements["email[]"];	
		var x= y.length+1;
	
		 $(".mas_email_ah").append('<li class="inpt'+x+'"><label class="pu">E-mail '+x+': </label>'
                              + '<input type="text" name="email[]" id="email" value="" class="inp"><b> * </b><a class="menos_email" href=javascript:borrar_mail("inpt'+x+'")>-</a><br></li>');
	return false;
	
	});

});

function borrar_mail(obj){	
	$('.'+obj).remove()
	return false;

}

 
function valida_detalle(id, opcion){
	var f1 = eval("document.detalle");
	var total=0;
	
	f1.action="cesta.php?prod="+id+"&car="+opcion;
	f1.submit();
}
function busqueda(url,texto){
	
	document.fbuscar.action = url+'&q=' + texto.value;
	document.fbuscar.submit();
}



function validar(){
	if(document.frm.nombre.value==""){
		alert("CUIDADO: Por favor introduzca su nombre");
		document.frm.nombre.focus();
		return false;
	}else if(document.frm.apellidos.value==""){
		alert("CUIDADO:Por favor introduzca su apellido");
		document.frm.apellidos.focus();
		return false;
	}/*else if(document.frm.telefono.value==""){
		alert("CUIDADO: Por favor escriba al menos un telefono");
		document.frm.telefono.focus();
		return false;
	}*/else if(document.frm.email.value==""){
		alert("CUIDADO: Por favor escriba su e-mail");
		document.frm.email.focus();
		return false;
	}else if(document.frm.mensaje.value==""){
		alert("CUIDADO: Por favor escriba el mensaje");
		document.frm.mensaje.focus();
		return false;
	}else{
		document.frm.submit();
		//return true;	
	}
}



function validar_acceso(url){
	if(document.f1.email.value==""){
		alert("ERROR: ingrese su email ");
		document.f1.email.focus();
		return false;
	}else if(checkemail(document.f1.email.value)== false){
		document.f1.email.value="";
		document.f1.email.focus();
		return false;
	}else if(document.f1.password.value==""){
		alert("ERROR: ingrese password ");
		document.f1.password.focus();
		return false;
	}else{
		document.f1.action = url + "?cuenta=acceso";
		document.f1.submit();
	}	
}

function valida_diselo(){
	if(document.f1.nombre.value==""){
		alert("ERROR: ingrese su nombre ");
		document.f1.nombre.focus()
		return false;
	}else if(document.f1.email.value==""){
		alert("ERROR: ingrese su email ");
		document.f1.email.focus()
		return false;
	}else if(document.f1.nombre_amigo.value==""){
		alert("ERROR: ingrese el nombre de su amigo ");
		document.f1.nombre_amigo.focus()
		return false;
	}else if(document.f1.email_amigo.value==""){
		alert("ERROR: ingrese el email de su amigo ");
		document.f1.email_amigo.focus()
		return false;
	}else if(document.f1.titulo.value==""){
		alert("ERROR: ingrese el titulo de mensaje ");
		document.f1.titulo.focus()
		return false;
	}else if(document.f1.mansaje.value==""){
		alert("ERROR: ingrese el mensaje ");
		document.f1.mansaje.focus()
		return false;
	}else {
		document.f1.action="recomienda.php";
		document.f1.submit();
	}	
}


function validpsw(e) { 
	tecla = (document.all) ? e.keyCode : e.which; 
	//alert(tecla)
    if (tecla==8 || tecla==46 || tecla==13) 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); 
    verifica= patron.test(te);
	if(verifica==false){
		alert("El caracter que esta tratando de ingresar no se permite");		
		return false;
	}else{
		return true
	}	
	// uso  onKeyPress="return validpsw(event)"
}

function validacaracter(e) { 
	tecla = (document.all) ? e.keyCode : e.which; 
	//alert(tecla)
    if (tecla==8 || tecla==46 || tecla==13 || tecla==32) 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 validacaracter(event)"
}

function actualiza_producto(){
	document.cesta.action="cesta.php?car=update";
	document.cesta.submit();	
}

function actualiza_producto2(){
	document.cesta.action="cesta.php?car=addv";
	document.cesta.submit();	
}

function actualiza_producto3(id){
	document.cesta.action="cesta.php?car=addv&id="+id;
	document.cesta.submit();	
}

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 addahijados(url){	
	

	var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;	
	var email = document.fpadrino.email;
    
        if(email.value==""){
            alert("ERROR: ingrese el email de su amigo ");
            email.focus();
            return false
        }
		if(!email.value.match(emailRegex)) {
			alert('ERROR: ha introducido un email no valido');
			email.focus();
			return false;
		}	    
	
	document.fpadrino.action=url;
	document.fpadrino.submit(); 	
	
}

function buscar(url,texto){
	document.f2.action=url+'?q='+ texto;
	document.f2.submit(); 
}

	var testresults
	function checkemail_(value){
		var str = value
		var filter=/^.+@.+\..{2,3}$/

		if (filter.test(str))
			testresults=true
		else{
			alert("Por favor ingrese un e-mail valido...");
			testresults=false
		}
		return (testresults)
	}	
	
	function clave(value){
		var str = value
		var filter=/^.+@.+\..{2,3}$/
			if (filter.test(str))
		testresults=true
			else{
			alert(" Do not accept specials caracters ")
			testresults=false
		}
		return (testresults)
	}

function validar_mis_datos(url){
	document.cuenta.action = "cuenta.php?cuenta="+ url;
	document.cuenta.submit();
}

function validar_mis_ahijados(url){	



	var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;	
	var email = document.ahijados.elements["email[]"];	
	var mensaje_personal = document.getElementById("mensaje_personal");
	
	
    for(i=0; i < email.length; i++){
        if(email[i].value==""){
            alert(" ERROR: ingrese el email de su amigo ");
            email[i].focus();
            return false
        }
		if(!email[i].value.match(emailRegex)) {
			alert('ERROR: ha introducido un email no valido');
			email[i].focus();
			return false;
		}		
		
    }	

	document.ahijados.action = "ahijados.php?action="+ url;
	document.ahijados.submit();

}

function validar_mi_publicidad(url){
		
	var nombre = document.getElementById("nombre");
	var descripcion = document.getElementById("descripcion");
	var contacto = document.getElementById("contacto");
	var imagen_logo = document.getElementById("image");
	
	if (nombre.value=="") {
		alert("Ingrese el nombre de la empresa");
		nombre.focus();		
		return false;
	}	
	
	if (descripcion.value=="") {				
		alert("Ingrese la descripción de su Empresa");
		descripcion.focus();		
		return false;
	}
	
	if (contacto.value=="") {				
		alert("Ingrese la informacion de contacto");
		contacto.focus();		
		return false;
	}
	
	if (url == 'add'){
		if (imagen_logo.value=="") {				
			alert("Ingrese una imagen o logo");
			imagen_logo.focus();		
			return false;
		}
	}
	
	document.publicidad.action = "publicidad.php?action="+ url;
	document.publicidad.submit();
}

function validar_mi_contrasenia(url){
		document.cuenta.action = "cuenta.php?cuenta="+ url;
		document.cuenta.submit();
}

//ingreso de clientes
function validar_clientes_olda(opcion){
	//alert(opcion);
	if(document.frm_reg.nombre.value==""){
		alert(" ERROR: Por favor ingrese el nombre ");
		document.frm_reg.nombre.focus();
		return false
	}else if(document.frm_reg.apellidos.value==""){
		alert(" ERROR: Por favor ingrese el apellido ");
		document.frm_reg.apellidos.focus();
		return false	
	}else if(document.frm_reg.dni.value==""){
		alert(" ERROR: Por favor ingrese el dni ");
		document.frm_reg.dni.focus();
		return false	
	}else if(document.frm_reg.email.value==""){
		alert(" ERROR: Por favor ingrese el email ");
		document.frm_reg.email.focus();
		return false	
	}else if(checkemail(document.frm_reg.email.value)== false){
		document.frm_reg.email.value="";
		document.frm_reg.email.focus();
		return false;
	}else if(document.frm_reg.password.value==""){
		alert(" ERROR: Por favor ingrese el Password ");
		document.frm_reg.password.focus();
		return false	
	}else if(document.frm_reg.password_confirma.value==""){
		alert(" ERROR: Por favor ingrese la Conf. de password ");
		document.frm_reg.password_confirma.focus();
		return false	
	}else if(document.frm_reg.password.value!=document.frm_reg.password_confirma.value){
		alert(" ERROR: Por favor ingrese la Conf. de password correcta");
		document.frm_reg.password_confirma.focus();
		return false	
	}else if(document.frm_reg.empresa.value==""){
		alert(" ERROR: Por favor ingrese la Empresa ");
		document.frm_reg.empresa.focus();
		return false	
	}else if(document.frm_reg.direccion.value==""){
		alert(" ERROR: Por favor ingrese la Direccion ");
		document.frm_reg.direccion.focus();
		return false	
	}/*else if(document.frm_reg.suburbio.value==""){
		alert(" ERROR: Por favor suburbio ");
		document.frm_reg.suburbio.focus();
		return false	
	}*/else if(document.frm_reg.cp.value==""){
		alert(" ERROR: Por favor ingrese el codigo postal ");
		document.frm_reg.cp.focus();
		return false	
	}else if(document.frm_reg.poblacion.value==""){
		alert(" ERROR: Por favor ingrese la poblacion ");
		document.frm_reg.poblacion.focus();
		return false	
	}else if(document.frm_reg.provincia.value==""){
		alert(" ERROR: Por favor ingrese la provincia ");
		document.frm_reg.provincia.focus();
		return false	
	}else if(document.frm_reg.pais.value==""){
		alert(" ERROR: Por favor seleccione el pais ");
		document.frm_reg.pais.focus();
		return false	
	}else if(document.frm_reg.telefono.value==""){
		alert(" ERROR: Por favor ingrese el telefono ");
		document.frm_reg.telefono.focus();
		return false	
	}else{
		document.frm_reg.action='cuenta.php?cuenta='+opcion;
		document.frm_reg.submit();
	}
	
}

function validar_acceso_left_1(){
	if(document.frm_reg_1.email.value==""){
		alert("ERROR: ingrese su email ");
		document.frm_reg_1.email.focus();
		return false;
	}else if(checkemail(document.frm_reg_1.email.value)== false){
		document.frm_reg_1.email.value="";
		document.frm_reg_1.email.focus();
		return false;
	}else if(document.frm_reg_1.password.value==""){
		alert("ERROR: ingrese password ");
		document.frm_reg_1.password.focus();
		return false;
	}else{
		//document.frm_reg.action = url + "?cuenta=acceso";
		//document.frm_reg.submit();
	}	
}


function busca_old(){
	url='index.php';
	texto=document.getElementById("q").value;
	if(texto=="" || texto==" Search"){
		alert("Ingrese un criterio para la busqueda");	
		document.getElementById("q").focus();
		return false;
	}else{
		location.href=url+'?q='+ texto;
		//document.frm_search.submit();
	}
}

function img_inicio(){
	document.getElementById("ini").style.backgroundImage='url(aplication/webroot/imgs/img_inicio_blank.jpg)';	
}
function img_inicio_out(){
	document.getElementById("ini").style.backgroundImage='';	
}

function img_cuenta(){
	document.getElementById("cue").style.backgroundImage='url(aplication/webroot/imgs/img_cuenta_blank.jpg)';	
}
function img_cuenta_out(){
	document.getElementById("cue").style.backgroundImage='';	
}

/**/
function img_pedido(){
	document.getElementById("ped").style.backgroundImage='url(aplication/webroot/imgs/img_pedido_blank.jpg)';	
}
function img_pedido_out(){
	document.getElementById("ped").style.backgroundImage='';	
}
/**/

function img_servicio(){
	document.getElementById("sera").style.backgroundImage='url(aplication/webroot/imgs/img_servicios_blank.jpg)';	
}
function img_servicio_out(){
	document.getElementById("sera").style.backgroundImage='';	
}

/**/

function img_contactenos(){
	document.getElementById("cont").style.backgroundImage='url(aplication/webroot/imgs/img_contactenos_blank.jpg)';	
}
function img_contactenos_out(){
	document.getElementById("cont").style.backgroundImage='';	
}
function btn_menos(){
	valor = document.getElementById("cantidad").value;
	if(valor>1){
		valor = valor - 1;
		document.getElementById("cantidad").value = parseInt(valor)
	}
}
function btn_mas(){
	valor = document.getElementById("cantidad").value;
	valor = parseInt(valor) + 1;
	document.getElementById("cantidad").value = parseInt(valor)
}

function ver_sgte(x,y){
	archivo="page_novedades.php?x="+ x + "&y="+y;
	$("#prod_nov").hide();
	$("#prod_nov").load(archivo).fadeIn('slow');
}

function validar_envio_mym(valor,obj,id){
	document.getElementById("tipo_envio").value=id;
	document.getElementById("MontoEnvio").value=valor.toFixed(2);
	$("#gatos_envio li a").css("background-color","transparent");
	$("#envio_select").html('<span class="precio">'+valor.toFixed(2)+'€</span>&nbsp;&nbsp;( Opcion : '+id+' )');
	obj.style.backgroundColor='#CCC';
}

function validar_envio_logo(valor){	
	document.getElementById("tipo_envio").value=valor;
	if(valor==2){
		document.getElementById("paquete").style.display='';
		document.getElementById("nombre_envio").value="Usted ha elegido PAQUETE AZUL";
	}else{
		document.getElementById("paquete").style.display='';
		document.getElementById("nombre_envio").value="Usted ha elegido ENVIO EXPRESS";
	}
}

function validar_pago_logo(valor){
	//alert(valor)
	document.getElementById("tipo_pago").value=valor;
	if(valor==1){
		document.getElementById("paquete").style.display='';
		document.getElementById("nombre_pago").value="Usted ha elegido PAYPAL";
	}else if(valor==2){
		document.getElementById("paquete").style.display='';
		document.getElementById("nombre_pago").value="Usted ha elegido Transferencia Bancaria";
	}else if(valor==3){
		document.getElementById("paquete").style.display='';
		document.getElementById("nombre_pago").value="Usted ha elegido CONTRA REEMBOLSO";
	}
}

function validar_sendcontrasenia(opcion){
	if(document.cuenta.email.value==""){
		alert(" ERROR: Por favor ingrese su email ");
		document.cuenta.email.focus();
		return false
	}else if(checkemail(document.cuenta.email.value)== false){
		document.cuenta.email.value="";
		document.cuenta.email.focus();
		return false;
	}else{
		document.cuenta.action='cuenta.php?cuenta='+opcion;
		document.cuenta.submit();
	}
}

function validar_send_mailings(opcion){
	if(document.frmemail.email.value==""){
		alert(" ERROR: Por favor ingrese su email ");
		document.frmemail.email.focus();
		return false
	}else if(checkemail(document.frmemail.email.value)== false){
		document.frmemail.email.value="";
		document.frmemail.email.focus();
		return false;
	}else{
		document.frmemail.action='cuenta.php?cuenta='+opcion;
		document.frmemail.submit();
	}
}


function regresar_rp(){
	location.href='cuenta.php?cuenta=recuperar_contrasenia';	
}

function calcular(valor){
	subtotal=0;
	var cod=document.cesta.elements["id[]"];
	tot=document.getElementById("totpro").value;
	for(var g=0;g<tot;g++){
		cantidad = document.getElementById('canti'+g).value;
		if(cantidad>0){
			flag = document.getElementById('canti'+g).value*document.getElementById('txtprecio'+g).value;
			document.getElementById('txttot'+g).value = flag.toFixed(2);
			subtotal = subtotal + parseInt(document.getElementById('txttot'+g).value);
			//actualiza_cesta("update" , cod , cantidad);
			document.cesta.action = 'cesta.php?car=update';
			document.cesta.submit();
		}else if(cantidad==0 || cantidad==""){
			alert("Debe ingresar una cantidad valida");	
			subtotal = subtotal + parseInt(document.getElementById('txttot'+g).value);
			document.getElementById('canti'+g).value = document.getElementById('cantih'+g).value;
			document.getElementById("subtot").value=subtotal.toFixed(2);
			return false;
		}
	}
	document.getElementById("subtot").value=subtotal.toFixed(2);
}


function actualiza_cesta(opcion , id , cantidad){
	//alert("das");
	archivo="update_cesta.php?car="+opcion+'&id='+id+'&cantidad='+cantidad;
	$("#capa_cesta").load(archivo);
}

width = 0;
function load_componenst(ancho){
	width += ancho;	
	$("#detalle_producto .ir_centro_centro").css("width",width);
}
x=0;
function mover(){
	//$("#detalle_producto .ir_centro_centro").css("width",width);	
	//mover_left();
	x += 40;
	$("#detalle_producto .ir_centro_centro").css("padding-left",x);
	window.setTimeout("mover()",100);
	
}

this.randomtip3 = function(){

	var pause = 6500; // define the pause for each tip (in milliseconds) 
	var length = $(".rotate2 li").length;  
	//alert(length)
	var length = 4;  
	var temp = -1;		
    
	this.getRan = function(){
		// get the random number
		var ran = Math.floor(Math.random()*length)+1;
		
		return ran;
		
	};
	
	this.show = function(){
		var ran = getRan();
		// to avoid repeating
		while (ran == temp){
			ran = getRan();
		}; 
		temp = ran;
		$(".rotate2 li").hide();	
		//alert(ran)
		$(".rotate2 li:nth-child(" + ran + ")").fadeIn("fast");		
	};
	
	show(); setInterval(show,pause);
	
};


this.randomtip = function(){

	var pause = 5000; // define the pause for each tip (in milliseconds) 
	var length = $(".rotate li").length;  
	//alert(length)
	var length = 4;  
	var temp = -1;		
    
	this.getRan = function(){
		// get the random number
		var ran = Math.floor(Math.random()*length);
		
		return ran;
		
	};
	
	this.show = function(){
		var ran = getRan();
		// to avoid repeating
		while (ran == temp){
			ran = getRan();
		}; 
		temp = ran;
		$(".rotate li").hide();	
		//alert(ran)
		$(".rotate li:nth-child(" + ran + ")").fadeIn("fast");		
	};
	
	show(); setInterval(show,pause);
	
};


this.randomtip2 = function(){

	var pause2 = 5500; // define the pause for each tip (in milliseconds) 
	var length2 = $(".ofertas li").length; 
	//var length2 = 4;
	var temp2 = -1;		

	this.getRan2 = function(){
		// get the random number
		var ran2 = Math.floor(Math.random()*length2) + 1;
		return ran2;
	};
	this.show2 = function(){
		var ran2 = getRan2();
		// to avoid repeating
		while (ran2 == temp2){
			ran2 = getRan2();
		}; 
		temp2 = ran2;
		$(".ofertas li").hide();	
		$(".ofertas li:nth-child(" + ran2 + ")").fadeIn("fast");		
	};
	
	show2(); setInterval(show2,pause2);
	
};

function monstarPagina(pag,div,id_cliente,email_asociado){	 
	  $.ajax({
	  type: 'post',
	  data : {id:id_cliente , mail:email_asociado},
	  url: pag,
	  success: function(data) {               
			    $('#'+div).html(data);
				$('.num_cheq').html(data);				
	  },  	 
	  beforeSend: function(objeto){	
		  $('#'+div).text("cargando");		  
	  },
	  complete: function(){		
		 $('#'+div).hide();	
	  }
  });
}


function activa_descuento(obj,id_tblbody,id_cliente){	
	if (confirm("¿ Agregar 5 € de regalo a su cuenta ?")) {
		monstarPagina('activa_cheque.php',id_tblbody,id_cliente,obj.value);
//		alert(obj.value);
	}
}

function valida_descuento(credito,obj){	
	if (obj.value>credito){ 
	  alert("No tienes suficientes creditos\r\n Tu credito es : "+credito.toFixed(2)+" €");
		obj.value=""; 
	}else{
		
	}	
}

function off(obj){	
    if (obj.value=="")
	obj.value='0.00';
	else
	obj.value= parseInt(obj.value).toFixed(2);
	
}


function show_all(){
	$('.datas').fadeIn('fast');
}

function show_compatibles(){
	$('.datas').each(function(index, element) {
        $('.datas').eq(index).show();
		name = $('.datas .d1 a').eq(index).text().replace(/\s/g,"").substring(0,2);	
		if (name != "M-") $('.datas').eq(index).fadeOut("fast");		
    });
}

function show_originales(){
	$('.datas').each(function(index, element) {
		$('.datas').eq(index).show();
        name = $('.datas .d1 a').eq(index).text().replace(/\s/g,"").substring(0,2);	
		if (name == "M-") $('.datas').eq(index).fadeOut("fast");		
    });
}
