$(document).ready(function() { $(".dropdown dt a").click(function() { $(".dropdown dd ul").toggle(); }); $(document).bind('click', function(e) { var $clicked = $(e.target); if (! $clicked.parents().hasClass("dropdown")) $(".dropdown dd ul").hide(); }); $("a#abrirOpciones1").click( function() { $("div#opcion1").show("fast"); $("div#opcion1c").hide(); $("div#opcion1a").show(); } ); $("a#cerrarOpciones1").click( function() { $("div#opcion1").hide("fast"); $("div#opcion1a").hide(); $("div#opcion1c").show(); } ); $('#layer1_form').ajaxForm({ /*target: '#content',*/ success: function() { actTarjeta(); } }); $("a#abrirOpciones2").click( function() { $("div#opcion2").show("fast"); $("div#opcion2c").hide(); $("div#opcion2a").show(); } ); $("a#cerrarOpciones2").click( function() { $("div#opcion2").hide("fast"); $("div#opcion2a").hide(); $("div#opcion2c").show(); } ); $('#layer2_form').ajaxForm({ /*target: '#content',*/ success: function() { actTarjeta(); } }); $("a#abrirOpciones3").click( function() { $("div#opcion3").show("fast"); $("div#opcion3c").hide(); $("div#opcion3a").show(); } ); $("a#cerrarOpciones3").click( function() { $("div#opcion3").hide("fast"); $("div#opcion3a").hide(); $("div#opcion3c").show(); } ); $('#layer3_form').ajaxForm({ /*target: '#content',*/ success: function() { actTarjeta(); } }); $("a#abrirOpciones4").click( function() { $("div#opcion4").show("fast"); $("div#opcion4c").hide(); $("div#opcion4a").show(); } ); $("a#cerrarOpciones4").click( function() { $("div#opcion4").hide("fast"); $("div#opcion4a").hide(); $("div#opcion4c").show(); } ); $('#layer4_form').ajaxForm({ /*target: '#content',*/ success: function() { actTarjeta(); } }); $("a#abrirOpciones1f").click( function() { $("div#opcion1f").show("fast"); $("div#opcion1fc").hide(); $("div#opcion1fa").show(); } ); $("a#cerrarOpciones1f").click( function() { $("div#opcion1f").hide("fast"); $("div#opcion1fa").hide(); $("div#opcion1fc").show(); } ); $('#layer1f_form').ajaxForm({ /*target: '#content',*/ success: function() { actTarjeta(); } }); $('#layer1f_formF').ajaxForm({ /*target: '#content',*/ success: function() { actF(); } }); }); jQuery(function($) { $("#contentArea").load("/plantillas/felicitaciones.php?no=1"); }); $().ajaxSend(function(r,s){ $("#contentLoading").show(); }); $().ajaxStop(function(r,s){ $("#contentLoading").fadeOut("fast"); }); function loadContentO(texto1,texto2,texto3,texto4,foto) { // Show the loading div $("#contentLoading").show(); // Hide the links // Stops the user clicking more than once and putting // excessive load on the server // Delete any pre-existingtable $("#contentArea").empty(); // Load the data valor=document.getElementById("estadoPortada").value; if (valor==1) { url="/plantillas/felicitaciones.php"; } else { url="/plantillas/felicitaciones.anverso.php"; } $.get(url, {texto1:texto1,texto2:texto2,texto3:texto3,texto4:texto4,foto:foto}, function(data) { // When the Ajax call finishes: // fade out the loading div $("#contentLoading").fadeOut("fast"); // bring back the links for the user to click on // append the table of data to the contentArea div $("#contentArea").append(data); // tie the table sorter functionality to the table }); } function loadContentMove(x,linea,y) { // Show the loading div $("#contentLoading").show(); // Hide the links // Stops the user clicking more than once and putting // excessive load on the server // Delete any pre-existingtable $("#contentArea").empty(); valor=document.getElementById("estadoPortada").value; if (valor==1) { url="/plantillas/felicitaciones.php"; } else { url="/plantillas/felicitaciones.anverso.php"; } if (y=="x") { // Load the data $.get(url, {x:x, linea:linea}, function(data) { // When the Ajax call finishes: // fade out the loading div $("#contentLoading").fadeOut("fast"); // bring back the links for the user to click on // append the table of data to the contentArea div $("#contentArea").append(data); // tie the table sorter functionality to the table }); } else { // Load the data $.get(url, {y:x, linea:linea}, function(data) { // When the Ajax call finishes: // fade out the loading div $("#contentLoading").fadeOut("fast"); // bring back the links for the user to click on // append the table of data to the contentArea div $("#contentArea").append(data); // tie the table sorter functionality to the table }); } } function loadContentMoveF(x,linea,y) { // Show the loading div $("#contentLoading").show(); // Hide the links // Stops the user clicking more than once and putting // excessive load on the server // Delete any pre-existingtable $("#contentArea").empty(); valor=document.getElementById("estadoPortada").value; if (y=="x") { // Load the data if (valor==1) { url="/plantillas/felicitaciones.php"; } else { url="/plantillas/felicitaciones.anverso.php"; } $.get(url, {x:x, linea:linea}, function(data) { // When the Ajax call finishes: // fade out the loading div $("#contentLoading").fadeOut("fast"); // bring back the links for the user to click on // append the table of data to the contentArea div $("#contentArea").append(data); // tie the table sorter functionality to the table }); } else { // Load the data if (valor==1) { url="/plantillas/felicitaciones.php"; } else { url="/plantillas/felicitaciones.anverso.php"; } $.get(url, {y:x, linea:linea}, function(data) { // When the Ajax call finishes: // fade out the loading div $("#contentLoading").fadeOut("fast"); // bring back the links for the user to click on // append the table of data to the contentArea div $("#contentArea").append(data); // tie the table sorter functionality to the table }); } } function loadContentF(texto1,texto2,texto3,texto4,foto) { // Show the loading div $("#contentLoading").show(); // Hide the links // Stops the user clicking more than once and putting // excessive load on the server // Delete any pre-existingtable $("#contentAreaF").empty(); valor=document.getElementById("estadoPortada").value; if (valor==1) { url="/plantillas/felicitaciones.php"; } else { url="/plantillas/felicitaciones.anverso.php"; } // Load the data $.get(url, {texto1:texto1,texto2:texto2,texto3:texto3,texto4:texto4, foto:foto}, function(data) { // When the Ajax call finishes: // fade out the loading div $("#contentLoading").fadeOut("fast"); // bring back the links for the user to click on // append the table of data to the contentArea div $("#contentAreaF").append(data); // tie the table sorter functionality to the table }); } function moverX(x,linea) { y="x"; loadContentMove(x,linea,y); } function moverY(x,linea) { y="y"; loadContentMove(x,linea,y); } function moverXF(x,linea) { y="x"; loadContentMoveF(x,linea,y); } function moverYF(x,linea) { y="y"; loadContentMoveF(x,linea,y); } function actTarjeta() { t1=document.getElementById('texto1').value;t2=document.getElementById('texto2').value;t3=document.getElementById('texto3').value;t4=document.getElementById('texto4').value; loadContentO(t1,t2,t3,t4,''); } function actFoto(foto) { t1=document.getElementById('texto1').value;t2=document.getElementById('texto2').value;t3=document.getElementById('texto3').value;t4=document.getElementById('texto4').value; loadContentO(t1,t2,t3,t4,foto); } function cambiarAnverso() { portada=document.getElementById("estadoPortada"); if (portada.value==1) { portada.value=0; actTarjeta(); } } function cambiarPortada() { portada=document.getElementById("estadoPortada"); if (portada.value==0) { portada.value=1; actTarjeta(); } } function actF() { t1=document.getElementById('texto1').value;t2=document.getElementById('texto2').value;t3=document.getElementById('texto3').value;t4=document.getElementById('texto4').value; loadContentF(t1,t2,t3,t4,''); } function actFotoF(foto) { t1=document.getElementById('texto1').value;t2=document.getElementById('texto2').value;t3=document.getElementById('texto3').value;t4=document.getElementById('texto4').value; loadContentF(t1,t2,t3,t4,foto); } function abrirV(url,w,h) { izquierda = (screen.width) ? (screen.width-w)/2 : 100 arriba = (screen.height) ? (screen.height-h)/2 : 100 opciones = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,width=' + w + ',height=' + h + ',left=' + izquierda + ',top=' + arriba + '' window.open(url, 'w', opciones) } function comprobarFormu(f) { if (f.nombre.value=="") { alert("El formulario no se puede enviar, el campo Nombre es obligatorio"); f.nombre.focus(); } if (f.apellidos.value=="") { alert("El formulario no se puede enviar, el campo Apellidos es obligatorio"); f.nombre.focus(); } if (f.direccion.value=="") { alert("El formulario no se puede enviar, el campo Direccion es obligatorio"); f.nombre.focus(); } } function cambiarGastos() { prov=document.getElementById("provincia"); provincia=prov.options[prov.selectedIndex].value;; imprenta="gastos"; $.get("/plantillas/precios.gastos.envio.php", {imprenta: imprenta, provincia:provincia}, function(data) { // bring back the links for the user to click on // append the table of data to the contentArea div document.getElementById("gastos").value=data; // tie the table sorter functionality to the table }); imprenta="total"; $.get("/plantillas/precios.gastos.envio.php", {imprenta: imprenta, provincia:provincia}, function(data) { // bring back the links for the user to click on // append the table of data to the contentArea div document.getElementById("total").value=data; // tie the table sorter functionality to the table }); }