function _ajax_nuevo_pago(idioma) {
        var parametros = {
                "pago-concepto" : $("#cont1000 input[name=pago-concepto]").val(),
                "pago-importe": $("#cont1000 input[name=pago-importe]").val(),
		"idioma" : idioma
        };
        $.ajax({
                data:  parametros,
                url:   '/proceso/ajax/nuevo_pago.php',
                type:  'post',
                beforeSend: function () {
			
                },
                success:  function (response) {
			var patron = /teargral.exe/i; 
			if(response.search(patron)>0) {
				$("#cont1000").append(response);
				$("#cont1000 input[name=pago-importe]").css("border-color","#B4B4B4");
				$("#cont1000 input[name=pago-concepto]").css("border-color","#B4B4B4");
				document.form4b.submit();
			}
			else {
				eval(response);
			}
                }
        });	
}

function _ajax_loadVideos(y,pag,idioma) {
        var parametros = {
                "y" : y,
                "pag" : pag,
		"lang" : idioma
        };
        $.ajax({
                data:  parametros,
                url:   '/proceso/ajax/videos_paginaVideos.php',
                type:  'get',
                beforeSend: function () {
			$('#videos_group1').html('<div align="center" style="text-align:center;width:100%;"><br/><br/><br/><br/><br/><br/><br/><img src="/images/loading.gif"></div>');
			$('#videos_group1').css("width","90%");
			$('#videos div.pages').html('');
                },
                success:  function (response) {
			$('#videos_group1').html('');
			$('#videos_group1').css("width","100%");
			eval(response);
                }
        });	
}

function _ajax_loadCoPhotos(idco,pag) {
        var parametros = {
                "idco" : idco,
                "pag" : pag,
		"nr"  : nr
        };
        $.ajax({
                data:  parametros,
                url:   '/proceso/ajax/co_paginaCoPhotos.php',
                type:  'get',
                beforeSend: function () {
			$('#photo_list').html('<div align="center" style="text-align:center;width:100%;margin-top:80px;margin-bottom: 69px;"><br/><br/><br/><br/><br/><img src="/images/loading.gif"><br/><br/><br/><br/><br/><br/>');
			$('#content div.concurso div.vota div.fotos a.button').hide();
			$('#content div.concurso div.vota div.fotos div.pages').html('');
                },
                success:  function (response) {
			eval(response);
                }
        });	
}

function _ajax_loadNewsletter(y,idioma) {
        var parametros = {
                "y" : y,
		"lang" : idioma
        };
        $.ajax({
                data:  parametros,
                url:   '/proceso/ajax/newsletter_paginaNewsletter.php',
                type:  'get',
                beforeSend: function () {
			$('#newsletter-list-y').html('<div align="center"><br/><br/><br/><br/><img src="/images/loading.gif"></div>');
                },
                success:  function (response) {
			eval(response);
                }
        });	
}

function _ajax_newsletter_newCustomer(texto_condiciones,idioma) {
	if($('#newsletter_check:checked').size()>0) {

		var productos_interesados="";
		$("#_ajax_newsletter_newCustomer div.fieldgroup input:checked").each(function() {
			productos_interesados = productos_interesados + $(this).val() + "|";
		});

	        var parametros = {
	                "nombre" : $('#newsletter_nombre').val(),
	                "apellidos" : $('#newsletter_apellidos').val(),
	                "email" : $('#newsletter_email').val(),
	                "productos_interesados" : productos_interesados,
	                "tipo_suscriptor" : $('#_ajax_newsletter_newCustomer select[name=newsletter_tipo_suscriptor]').val(),
			"idioma" : idioma
	        };
	        $.ajax({
	                data:  parametros,
	                url:   '/proceso/ajax/newsletter_newCustomer.php',
	                type:  'post',
	                beforeSend: function () {
	                        
	                },
	                success:  function (response) {
	                        eval(response);
	                }
	        });	
	}
	else {
		alert(texto_condiciones);
	}
}

function _ajax_garantia_nueva(texto_condiciones,idioma) {
	if($('#garantia_check:checked').size()>0) {
	        var parametros = {
	                "nombre" : $('#garantia_nombre').val(),
	                "apellidos" : $('#garantia_apellidos').val(),
	                "email" : $('#garantia_email').val(),
	                "tienda" : $('#garantia_tienda').val(),
	                "direccion" : $('#garantia_direccion').val(),
	                "localidad" : $('#garantia_localidad').val(),
	                "codpost" : $('#garantia_codpost').val(),
	                "codigo" : $('#garantia_codigo').val(),
	                "provincia" : $('#garantia_provincia').val(),
	                "pais" : $('div.faqs select[name=pais]').val(),
			"idioma" : idioma
	        };
	        $.ajax({
	                data:  parametros,
	                url:   '/proceso/ajax/garantia_nueva.php',
	                type:  'post',
	                beforeSend: function () {
	                        
	                },
	                success:  function (response) {
	                        eval(response);
	                }
	        });	
	}
	else {
		alert(texto_condiciones);
	}
}

function _ajax_contacto_newMsg(texto_condiciones,idioma) {
	if($('#contacto_check:checked').size()>0) {
	        var parametros = {
	                "nombre" : $('#contacto_nombre').val(),
	                "apellidos" : $('#contacto_apellidos').val(),
	                "email" : $('#contacto_email').val(),
	                "telefono" : $('#contacto_telefono').val(),
	                "direccion" : $('#contacto_direccion').val(),
	                "localidad" : $('#contacto_localidad').val(),
	                "codigo" : $('#contacto_codigo').val(),
	                "provincia" : $('#contacto_provincia').val(),
	                "texto-contacto" : $('#texto-contacto').val(),
	                "departamento" : $('#_ajax_contacto_newMsg select[name=departamento]').val(),
	                "pais" : $('#_ajax_contacto_newMsg select[name=pais]').val(),
			"idioma" : idioma
	        };
	        $.ajax({
	                data:  parametros,
	                url:   '/proceso/ajax/contacto_newMsg.php',
	                type:  'post',
	                beforeSend: function () {
	                        
	                },
	                success:  function (response) {
	                        eval(response);
	                }
	        });	
	}
	else {
		alert(texto_condiciones);
	}
}

function _ajax_producto_contacto_newMsg(texto_condiciones,idioma,iditem) {
	if($('#pcontacto_check:checked').size()>0) {
	        var parametros = {
	                "nombre" : $('#pcontacto_nombre').val(),
	                "apellidos" : $('#pcontacto_apellidos').val(),
	                "email" : $('#pcontacto_email').val(),
	                "telefono" : $('#pcontacto_telefono').val(),
	                "direccion" : $('#pcontacto_direccion').val(),
	                "localidad" : $('#pcontacto_localidad').val(),
	                "codigo" : $('#pcontacto_codigo').val(),
	                "provincia" : $('#pcontacto_provincia').val(),
	                "texto-contacto" : $('#texto-pcontacto').val(),
	                "departamento" : $('#_ajax_pcontacto_newMsg select[name=departamento]').val(),
	                "pais" : $('#_ajax_pcontacto_newMsg select[name=pais]').val(),
			"iditem" : iditem,
			"idioma" : idioma
	        };
	        $.ajax({
	                data:  parametros,
	                url:   '/proceso/ajax/contacto_newMsg.php',
	                type:  'post',
	                beforeSend: function () {
	                        
	                },
	                success:  function (response) {
	                        eval(response);
	                }
	        });	
	}
	else {
		alert(texto_condiciones);
	}
}

function _ajax_envia_amigo(idcapa,idnoticia,idioma) {
        var parametros = {
                "nombre" : $('div.popup #'+idcapa+' input[name=nombre]').val(),
                "email" : $('div.popup #'+idcapa+' input[name=email]').val(),
                "texto" : $('div.popup #'+idcapa+' textarea[name=texto]').val(),
		"idcapa" : idcapa,
		"idnoticia" : idnoticia,
		"idioma" : idioma
        };
        $.ajax({
                data:  parametros,
                url:   '/proceso/ajax/noticias_envia_amigo.php',
                type:  'post',
                beforeSend: function () {

                },
                success:  function (response) {
                        eval(response);
                }
        });	
}

function _ajax_noticia_nuevoComentario(idcapa,idnoticia,idioma) {
        var parametros = {
                "alias" : $('#newcomment input[name=alias]').val(),
                "email" : $('#newcomment input[name=email]').val(),
                "localidad" : $('#newcomment input[name=localidad]').val(),
                "email" : $('#newcomment input[name=email]').val(),
                "comentario" : $('#newcomment textarea[name=comentario]').val(),
                "pais" : $('#newcomment select[name=pais]').val(),
		"idnoticia" : idnoticia,
		"idcapa" : idcapa,
		"idioma" : idioma
        };
        $.ajax({
                data:  parametros,
                url:   '/proceso/ajax/noticias_nuevoComentario.php',
                type:  'post',
                beforeSend: function () {

                },
                success:  function (response) {
                        eval(response);
                }
        });	
}

function _ajax_encuentraTienda_provincia(idioma) {
        var parametros = {
                "p" : $('div.finder select[name=p]').val(),
		"lang" : idioma
        };
        $.ajax({
                data:  parametros,
                url:   '/proceso/ajax/tiendas_actualizaProvincias.php',
                type:  'get',
                beforeSend: function () {

                },
                success:  function (response) {
                        eval(response);
                }
        });	
}

function _ajax_encuentraTienda_basico(idioma) {
	$('#contacta a.close').click();
        var parametros = {
                "n" : $('div.finder input[name=n]').val(),
		"lang" : idioma
        };
        $.ajax({
                data:  parametros,
                url:   '/proceso/ajax/tiendas_buscaTiendas.php',
                type:  'get',
                beforeSend: function () {
			$("#gmap").empty().addClass("loading");
                },
                success:  function (response) {
			googlemaps(function () {
				var map = new Map($("#gmap"));
				map.center = true;
				map.levelZoom = 4;
				eval(response);
				$("#gmap").removeClass("loading");
			});
                }
        });	
}

function _ajax_encuentraTienda_avanzado(idioma) {
	$('#contacta a.close').click();
        var parametros = {
                "n" : $('div.finder input[name=n]').val(),
                "l" : $('div.finder input[name=l]').val(),
                "c" : $('div.finder input[name=c]').val(),
                "p" : $('div.finder select[name=p]').val(),
                "pr" : $('div.finder select[name=pr]').val(),
		"lang" : idioma
        };
        $.ajax({
                data:  parametros,
                url:   '/proceso/ajax/tiendas_buscaTiendas.php',
                type:  'get',
                beforeSend: function () {
			$("#gmap").empty().addClass("loading");
                },
                success:  function (response) {
			googlemaps(function () {
				var map = new Map($("#gmap"));
				map.center = true;
				map.levelZoom = 4;
				eval(response);
				$("#gmap").removeClass("loading");
			});
                }
        });	
}

function _ajax_encuentraTienda_contacto(texto_condiciones,idioma) {
	if($('#tienda-condiciones:checked').size()>0) {
	        var parametros = {
	                "nombre" : $('#_ajax_tcontacto_newMsg input[name=tcontacto_nombre]').val(),
	                "apellidos" : $('#_ajax_tcontacto_newMsg input[name=tcontacto_apellidos]').val(),
	                "email" : $('#_ajax_tcontacto_newMsg input[name=tcontacto_email]').val(),
	                "telefono" : $('#_ajax_tcontacto_newMsg input[name=tcontacto_telefono]').val(),
	                "provincia" : $('#_ajax_tcontacto_newMsg input[name=tcontacto_provincia]').val(),
	                "texto-contacto" : $('#_ajax_tcontacto_newMsg textarea[name=tcontacto_comentario]').val(),
	                "idtienda" : $('#content div.finder div.infodir input[name=idtienda]').val(),
			"idioma" : idioma
	        };
	        $.ajax({
	                data:  parametros,
	                url:   '/proceso/ajax/contacto_newMsg.php',
	                type:  'post',
	                beforeSend: function () {
	                        
	                },
	                success:  function (response) {
	                        eval(response);
	                }
	        });	
	}
	else {
		alert(texto_condiciones);
	}
}

function _ajax_productos_paginaFotos(iditem,pag,idioma) {
        var parametros = {
                "iditem" : iditem,
                "pag" : pag,
		"lang" : idioma
        };
        $.ajax({
                data:  parametros,
                url:   '/proceso/ajax/productos_paginaFotos.php',
                type:  'get',
                beforeSend: function () {
			$('#product_fotos div.fotos div.list').html('<div align="center"><br/><br/><br/><br/><br/><br/><br/><br/><br/><img src="/images/loading.gif"></div>');
			$('#product_fotos div.fotos div.buttons a.button').hide();
			$('#product_fotos div.fotos div.buttons div.pages').html('');
                },
                success:  function (response) {
			eval(response);
			$('#product_fotos div.fotos div.buttons a.button').fadeIn();
                }
        });	
}

function _ajax_productos_bajaArchivo(jobj,mod,idioma) {
	var ids = "";
	$(jobj).find("input[type=checkbox]:checked").each(function() {
		ids = ids + "|" + $(this).val() + "|";
	});
	if(ids.length==0) {
		return false;
	}
        var parametros = {
                "ids" : ids,
                "mod" : mod,
		"idioma" : idioma
        };
        $.ajax({
                data:  parametros,
                url:   '/proceso/ajax/productos_download.php',
                type:  'post',
                beforeSend: function () {
			
                },
                success:  function (response) {
			eval(response);
			$('#product_fotos div.fotos div.buttons a.button').fadeIn();
                }
        });	
}

function _ajax_faqs_vota(idfaq,voto,idioma) {
        var parametros = {
                "idfaq" : idfaq,
                "voto" : voto,
		"lang" : idioma
        };
        $.ajax({
                data:  parametros,
                url:   '/proceso/ajax/faqs_vota.php',
                type:  'get',
                beforeSend: function () {
			
                },
                success:  function (response) {
			eval(response);
                }
        });	
}

function _ajax_tienda_pagos(y,pag,idioma) {
        var parametros = {
                "y" : y,
                "pag" : pag,
		"idioma" : idioma
        };
        $.ajax({
                data:  parametros,
                url:   '/proceso/ajax/tiendas_pagos.php',
                type:  'post',
                beforeSend: function () {
			$("#pay-history-1").html("<br/><br/><br/><div align='center'><img src='/images/loading.gif' alt='Loading...'></div><br/><br/><br/>");
                },
                success:  function (response) {
			eval(response);
                }
        });	
}

function _ajax_tienda_nuevoPago(capa,idioma) {
	alert("NO VACIO");
        var parametros = {
                "y" : y,
		"idioma" : idioma
        };
        $.ajax({
                data:  parametros,
                url:   '/proceso/ajax/tiendas_pagos.php',
                type:  'post',
                beforeSend: function () {

                },
                success:  function (response) {
			eval(response);
                }
        });	
}

