// JavaScript Document // JavaScript Document var fotosbg = Array( "ella.jpg","ella_equipo.jpg","ella_filosofia.jpg","ella_marcas01.jpg","ella_news.jpg","ella_opina.jpg","ella_productos.jpg","ella_salon_cc.jpg","ella_salones.jpg","ella_servicios.jpg","ella_tratamientos.jpg"); var fotoactual; var fotocolectpointer = 0; var activeitem = ""; var mainactiveitem = ""; var pointerbg = 0; var canviabg; var backgroundfile = "ella.jpg"; $(document).ready(function() { $("#triquibackimg2").hide(); $("#triquibackimg").hide(); $("#menu").hide(); //$("#primermenu").hide().delay(500).fadeIn("slow"); $("#aladreta").click(function() { $("#primermenu").fadeOut(function() { $("#menu").fadeIn(); }); }); $('#efeonze').hide(); $('#ampliar').mouseover(function() { $('#efeonze').fadeIn('fast'); }); $('#ampliar').mouseout(function() { $('#efeonze').fadeOut('fast'); }); canviabg = window.setInterval(nextbg, 4000); $(window).resize(function() { resize_bg(""); resize_bg("2"); }) $("#triquibackimg").attr("src", "imatges/ella.jpg").load(function() { $("#triquibackimg").show(); resize_bg(""); }); $("#nav-one li").hover(function() { $("ul", this).fadeIn("fast"); }, function() {}); if (document.all) { $("#nav-one li").hoverClass("sfHover"); } $("#capafosca").hide(); resize_bg(); resize_bg("2"); }); $.fn.hoverClass = function(c) { return this.each(function() { $(this).hover(function() { $(this).addClass(c); }, function() { $(this).removeClass(c); }); }); }; function resize_bg(num) { $("#triquibackimg" + num).css("left", "0"); var doc_width = $(window).width(); var doc_height = $(window).height(); var image_width = 2492; var image_height = 1652; var image_ratio = image_width / image_height; var new_width = doc_width; var new_height = Math.round(new_width / image_ratio); if (new_height < doc_height) { new_height = doc_height; new_width = Math.round(new_height * image_ratio); var width_offset = Math.round((new_width - doc_width) / 2); $("#triquibackimg" + num).css("left", "-" + width_offset + "px"); } $("#triquibackimg" + num).width(new_width); $("#triquibackimg" + num).height(new_height); $("#capafosca").width(new_width); $("#capafosca").height(new_height); } function initmenu() { $("#menu a").each(function(index) { if ($(this).attr("id") != "itemhome" && $(this).attr("id") != "itemopina") { $(this).click(function() { if ($(activeitem).attr("id") == "itemopina") $("#itemopina").css("background-image", "url(/imatges/menu-ultim.png)"); if ($(activeitem).attr("id") != "itemopina") $(activeitem).css("background", ""); if ($(activeitem).attr("id") != "itemopina") $(activeitem).css("background-color", ""); $(this).css("background", "none"); $(this).css("background-color", "#666"); activeitem = $(this); }); } if ($(this).attr("id") == "itemopina") { $(this).click(function() { $(activeitem).css("background", ""); $(activeitem).css("background-color", ""); $(this).css("background-image", "url(/imatges/menu-ultim-up2.png)"); activeitem = $(this); }); } }); $("#ampliar").click(function() { self.moveTo(0, 0); self.resizeTo(screen.availWidth, screen.availHeight); /*windows keybd_event(VK_F11,MapVirtualKey(VK_F11,0),0,0); keybd_event(VK_F11,MapVirtualKey(VK_F11,0),KEYEVENTF_KEYUP,0); */ }); } function cargador(elemento) { //alert("cargador"+elemento); $(elemento).each(function() { var link = $(this); var href = link.attr("href"); link.click(function() { $('#form1').validationEngine('hideAll'); $("#form1").validationEngine('detach'); //$('#container').each().unbind(); $('#container').html(""); clearInterval(canviabg); $('#container').hide().load(href + " #container", function() { cargador("#container a"); initload(href); setTimeout("realcanviabackground()",1000); }).fadeIn("slow"); //alert(href); return false; }); }); $(".fora").unbind(); } function marcamainsection(elitem) { $(mainactiveitem).css("background-image", "url(/imatges/bg.png)"); $(mainactiveitem).css("background-color", ""); if (mainactiveitem == "#itemopina") { $(mainactiveitem).css("background-image", "url(/imatges/menu-ultim.png)"); } if (elitem == "#itemopina") { $(elitem).css("background-image", "url(imatges/menu-ultim2.png)"); } else { if (mainactiveitem != "#itemopina") {$(mainactiveitem).mouseenter(function() { $(this).css("background-color", "#fff"); }); $(mainactiveitem).mouseleave(function() { $(this).css("background-color", ""); }); }else{ $(mainactiveitem).mouseenter(function() { $(this).css("background-image", "url(/imatges/menu-ultim_up.png)"); }); $(mainactiveitem).mouseleave(function() { $(this).css("background-image", "url(/imatges/menu-ultim.png)"); }); } $(elitem).css("background", "none"); $(elitem).css("background-color", "#333"); } $(elitem).unbind('mouseenter mouseleave'); mainactiveitem = elitem; } function initload(referencia) { //alert("hola"+referencia); var strictreferencia; if (referencia.lastIndexOf("?") < 0) strictreferencia = referencia; else strictreferencia = referencia.substring(0, referencia.lastIndexOf("?")); var categoria = referencia.substring(0, referencia.lastIndexOf("/") + 1); switch (strictreferencia) { case "/colecciones/index_vid01.php": marcamainsection("#itemcolecciones"); canviabackground("ella_servicios.jpg"); break; case "/colecciones/index_vid02.php": marcamainsection("#itemcolecciones"); canviabackground("ella_servicios.jpg"); break; case "/filosofia/index.php": scrollvert('#scrollcontent', 55, ""); scrollvert('#scrollcontent2', 110, "2"); canviabackground("ella_news.jpg"); marcamainsection("#itemfilosofia"); break; case "/filosofia/01.php": scrollvert('#scrollcontent', 55, ""); scrollvert('#scrollcontent2', 110, "2"); canviabackground("ella_opina.jpg"); marcamainsection("#itemfilosofia"); break; case "/filosofia/02.php": scrollvert('#scrollcontent', 55, ""); scrollvert('#scrollcontent2', 110, "2"); canviabackground("ella_marcas01.jpg"); marcamainsection("#itemfilosofia"); break; case "/salones/salon-01.php": canviabackground("ella_salon_cc.jpg"); scrollhorz(437, 6); scrollvert('#scrollcontent', 55, ""); marcamainsection("#itemsalones"); break; case "/salones/salon-02.php": canviabackground("ella_news.jpg"); scrollhorz(437, 7); scrollvert('#scrollcontent', 55, ""); marcamainsection("#itemsalones"); break; case "/news/eventos.php": scrollhorz(299, 4); scrollvert('#scrollcontent', 55, ""); canviabackground("ella.jpg"); marcamainsection("#itemnews"); break; case "/marcas/producto-01.php": canviabackground("ella_marcas01.jpg"); scrollhorz(437, 9); scrollvert('#scrollcontent', 55, ""); marcamainsection("#itemproductos"); break; case "/marcas/producto-02.php": canviabackground("ella_news.jpg"); scrollhorz(437, 8); scrollvert('#scrollcontent', 55, ""); marcamainsection("#itemproductos"); break; case "/marcas/producto-03.php": canviabackground("ella_opina.jpg"); scrollhorz(437, 8); scrollvert('#scrollcontent', 55, ""); marcamainsection("#itemproductos"); break; case "/marcas/producto-04.php": canviabackground("ella_productos.jpg"); scrollhorz(437, 7); scrollvert('#scrollcontent', 55, ""); marcamainsection("#itemproductos"); break; case "/marcas/producto-05.php": canviabackground("ella_salon_cc.jpg"); scrollhorz(437, 7); scrollvert('#scrollcontent', 55, ""); marcamainsection("#itemproductos"); break; case "/marcas/producto-06.php": canviabackground("ella_salones.jpg"); scrollhorz(437, 9); scrollvert('#scrollcontent', 55, ""); marcamainsection("#itemproductos"); break; case "/marcas/producto-07.php": canviabackground("ella_servicios.jpg"); scrollhorz(437, 8); scrollvert('#scrollcontent', 55, ""); marcamainsection("#itemproductos"); break; case "/marcas/producto-08.php": canviabackground("ella_tratamientos.jpg"); scrollhorz(437, 4); scrollvert('#scrollcontent', 55, ""); marcamainsection("#itemproductos"); break; case "/marcas/producto-09.php": canviabackground("ella.jpg"); scrollhorz(437, 6); scrollvert('#scrollcontent', 55, ""); marcamainsection("#itemproductos"); break; case "/marcas/producto-10.php": canviabackground("ella_equipo.jpg"); scrollhorz(437, 6); scrollvert('#scrollcontent', 55, ""); marcamainsection("#itemproductos"); break; case "/marcas/producto-11.php": canviabackground("ella_filosofia.jpg"); scrollhorz(437, 9); scrollvert('#scrollcontent', 55, ""); marcamainsection("#itemproductos"); break; case "/marcas/producto-12.php": canviabackground("ella_productos.jpg"); scrollhorz(437, 7); scrollvert('#scrollcontent', 55, ""); marcamainsection("#itemproductos"); break; case "/equipo/equipo-01.php": canviabackground("ella_equipo.jpg"); scrollvert('#scrollcontent', 55, ""); scrollvert('#scrollcontent2', 110, "2"); scrollhorz(182, 8); marcamainsection("#itemequipo"); break; case "/equipo/equipo-02.php": canviabackground("ella_equipo.jpg"); scrollvert('#scrollcontent', 55, ""); scrollvert('#scrollcontent2', 110, "2"); scrollhorz(182, 7); marcamainsection("#itemequipo"); break; case "/prensa/editmoda.php": canviabackground("ella.jpg"); scrollvert('#scrollcontent', 55, ""); scrollhorz(179, 8); marcamainsection("#itemprensa"); break; case "/prensa/ultimas.php": canviabackground("ella_salones.jpg"); scrollvert('#scrollcontent', 55, ""); scrollhorz(179, 18); marcamainsection("#itemprensa"); break; case "/prensa/index.php": canviabackground("ella_equipo.jpg"); scrollvert('#scrollcontent', 55, ""); scrollhorz(179, 37); marcamainsection("#itemprensa"); break; case "/prensa/prensagallery.php": $('#galleryclosedesc').hide(); fotocolectpointer = 0; canviabackground("ella_opina.jpg"); $('#fletxagesquerra').hide(); $('#foto').hide(); $('#fletxagdreta').click(function() { fotocolectpointer++; $('#foto').removeAttr('width'); $('#foto').removeAttr('height'); if (fotocolectpointer > fotos.length - 2) { $('#fletxagdreta').hide(); } $('#foto').hide(); $('#foto').attr("src", fotos[fotocolectpointer]); $('#foto').load(function() { $('#foto').fadeIn(); }); $('#fletxagesquerra').show(); }); $('#fletxagesquerra').click(function() { fotocolectpointer--; $('#foto').removeAttr('width'); $('#foto').removeAttr('height'); if (fotocolectpointer < 1) $('#fletxagesquerra').hide(); $('#foto').hide(); $('#foto').attr("src", fotos[fotocolectpointer]); $('#foto').load(function() { $('#foto').fadeIn(); }); $('#fletxagdreta').show(); }); marcamainsection("#itemprensa"); $.getScript("/js/prensatoarray.js.php?colecid=" + url_query("colecid", referencia), function() { $('#foto').attr("src", fotos[0]); $('#foto').load(function() { $('#foto').fadeIn(); }); if (fotos.length < 2) $('#fletxagdreta').hide(); }); $('#gallerydescription').load("/imatges/prensa/bestof/0" + url_query("colecid", referencia) + "/desc.html"); $('#galleryclose').mouseover(function() { $('#galleryclosedesc').fadeIn('fast'); }); $('#galleryclose').mouseout(function() { $('#galleryclosedesc').fadeOut('fast'); }); break; case "/prensa/prensagalleryeditmoda.php": $('#galleryclosedesc').hide(); fotocolectpointer = 0; canviabackground("ella_servicios.jpg"); $('#fletxagesquerra').hide(); $('#foto').hide(); $('#fletxagdreta').click(function() { fotocolectpointer++; $('#foto').removeAttr('width'); $('#foto').removeAttr('height'); if (fotocolectpointer > fotos.length - 2) { $('#fletxagdreta').hide(); } $('#foto').hide(); $('#foto').attr("src", fotos[fotocolectpointer]); $('#foto').load(function() { $('#foto').fadeIn(); }); $('#fletxagesquerra').show(); }); $('#fletxagesquerra').click(function() { fotocolectpointer--; $('#foto').removeAttr('width'); $('#foto').removeAttr('height'); if (fotocolectpointer < 1) $('#fletxagesquerra').hide(); $('#foto').hide(); $('#foto').attr("src", fotos[fotocolectpointer]); $('#foto').load(function() { $('#foto').fadeIn(); }); $('#fletxagdreta').show(); }); marcamainsection("#itemprensa"); $.getScript("/js/prensaeditmodatoarray.js.php?colecid=" + url_query("colecid", referencia), function() { $('#foto').attr("src", fotos[0]); $('#foto').load(function() { $('#foto').fadeIn(); }); if (fotos.length < 2) $('#fletxagdreta').hide(); }); $('#gallerydescription').load("/imatges/prensa/editoriales/0" + url_query("colecid", referencia) + "/desc.html"); $('#galleryclose').mouseover(function() { $('#galleryclosedesc').fadeIn('fast'); }); $('#galleryclose').mouseout(function() { $('#galleryclosedesc').fadeOut('fast'); }); break; case "/prensa/prensagalleryultimas.php": $('#galleryclosedesc').hide(); fotocolectpointer = 0; canviabackground("ella_salon_cc.jpg"); $('#fletxagesquerra').hide(); $('#foto').hide(); $('#fletxagdreta').click(function() { fotocolectpointer++; $('#foto').removeAttr('width'); $('#foto').removeAttr('height'); if (fotocolectpointer > fotos.length - 2) { $('#fletxagdreta').hide(); } $('#foto').hide(); $('#foto').attr("src", fotos[fotocolectpointer]); $('#foto').load(function() { $('#foto').fadeIn(); }); $('#fletxagesquerra').show(); }); $('#fletxagesquerra').click(function() { fotocolectpointer--; $('#foto').removeAttr('width'); $('#foto').removeAttr('height'); if (fotocolectpointer < 1) $('#fletxagesquerra').hide(); $('#foto').hide(); $('#foto').attr("src", fotos[fotocolectpointer]); $('#foto').load(function() { $('#foto').fadeIn(); }); $('#fletxagdreta').show(); }); marcamainsection("#itemprensa"); $.getScript("/js/prensaultimastoarray.js.php?colecid=" + url_query("colecid", referencia), function() { $('#foto').attr("src", fotos[0]); $('#foto').load(function() { $('#foto').fadeIn(); }); if (fotos.length < 2) $('#fletxagdreta').hide(); }); $('#gallerydescription').load("/imatges/prensa/ultimas/0" + url_query("colecid", referencia) + "/desc.html"); $('#galleryclose').mouseover(function() { $('#galleryclosedesc').fadeIn('fast'); }); $('#galleryclose').mouseout(function() { $('#galleryclosedesc').fadeOut('fast'); }); break; case "/news/ultima.php": scrollvert('#scrollcontent', 55, ""); scrollvert('#scrollcontent2', 110, "2"); marcamainsection("#itemnews"); canviabackground("ella_salon_cc.jpg"); break; case "/news/ultima01.php": scrollvert('#scrollcontent', 55, ""); scrollvert('#scrollcontent2', 110, "2"); marcamainsection("#itemnews"); canviabackground("ella_salon_cc.jpg"); break; case "/news/ultima02.php": scrollvert('#scrollcontent', 55, ""); scrollvert('#scrollcontent2', 110, "2"); marcamainsection("#itemnews"); canviabackground("ella_salon_cc.jpg"); break; case "/news/ultima03.php": scrollvert('#scrollcontent', 55, ""); scrollvert('#scrollcontent2', 110, "2"); marcamainsection("#itemnews"); canviabackground("ella_salon_cc.jpg"); break; case "/news/ultima04.php": scrollvert('#scrollcontent', 55, ""); scrollvert('#scrollcontent2', 110, "2"); marcamainsection("#itemnews"); canviabackground("ella_salon_cc.jpg"); break; case "/news/ultima05.php": scrollvert('#scrollcontent', 55, ""); scrollvert('#scrollcontent2', 110, "2"); marcamainsection("#itemnews"); canviabackground("ella_salon_cc.jpg"); break; case "/news/newsgallery.php": $('#galleryclosedesc').hide(); fotocolectpointer = 0; canviabackground("ella_news.jpg"); $('#fletxagesquerra').hide(); $('#foto').hide(); $('#fletxagdreta').click(function() { fotocolectpointer++; $('#foto').removeAttr('width'); $('#foto').removeAttr('height'); if (fotocolectpointer > fotos.length - 2) { $('#fletxagdreta').hide(); } $('#foto').hide(); $('#foto').attr("src", fotos[fotocolectpointer]); $('#foto').load(function() { $('#foto').fadeIn(); }); $('#fletxagesquerra').show(); }); $('#fletxagesquerra').click(function() { fotocolectpointer--; $('#foto').removeAttr('width'); $('#foto').removeAttr('height'); if (fotocolectpointer < 1) $('#fletxagesquerra').hide(); $('#foto').hide(); $('#foto').attr("src", fotos[fotocolectpointer]); $('#foto').load(function() { $('#foto').fadeIn(); }); $('#fletxagdreta').show(); }); marcamainsection("#itemnews"); $.getScript("/js/newstoarray.js.php?colecid=" + url_query("colecid", referencia), function() { $('#foto').attr("src", fotos[0]); $('#foto').load(function() { $('#foto').fadeIn(); }); if (fotos.length < 2) $('#fletxagdreta').hide(); }); $('#galleryclose').mouseover(function() { $('#galleryclosedesc').fadeIn('fast'); }); $('#galleryclose').mouseout(function() { $('#galleryclosedesc').fadeOut('fast'); }); break; default: var categoria = referencia.substring(0, referencia.lastIndexOf("/") + 1); switch (categoria) { case "/filosofia/": scrollvert('#scrollcontent', 55, ""); scrollvert('#scrollcontent2', 110, "2"); canviabackground("ella.jpg"); marcamainsection("#itemfilosofia"); break; case "/servicios/": canviabackground("ella_opina.jpg"); scrollvert('#scrollcontent', 55, ""); scrollvert('#scrollcontent2', 110, "2"); marcamainsection("#itemservicios"); break; case "/belleza/": canviabackground("ella_servicios.jpg"); scrollvert('#scrollcontent', 55, ""); scrollvert('#scrollcontent2', 110, "2"); marcamainsection("#itembelleza"); break; case "/equipo/": canviabackground("ella_servicios.jpg"); scrollvert('#scrollcontent', 55, ""); scrollvert('#scrollcontent2', 110, "2"); scrollhorz(182, 9); marcamainsection("#itemequipo"); break; case "/prensa/": canviabackground("ella_opina.jpg"); scrollvert('#scrollcontent', 55, ""); scrollhorz(910, 4); marcamainsection("#itemprensa"); break; case "/tratamientos/": canviabackground("ella_tratamientos.jpg"); scrollvert('#scrollcontent', 55, ""); scrollvert('#scrollcontent2', 110, "2"); scrollvert('#scrollcontent3', 110, "3"); scrollvert('#scrollcontent4', 110, "4"); scrollvert('#scrollcontent5', 110, "5"); scrollvert('#scrollcontent6', 110, "6"); scrollvert('#scrollcontent7', 110, "7"); scrollvert('#scrollcontent8', 110, "8"); scrollvert('#scrollcontent9', 110, "9"); scrollvert('#scrollcontent10', 110, "10"); scrollvert('#scrollcontent11', 110, "11"); scrollhorz(299, 10); inittratamientos(referencia, 12); marcamainsection("#itemtratamientos"); break; case "/marcas/": canviabackground("ella_salon_pg.jpg"); scrollhorz(435, 4); scrollvert('#scrollcontent', 55, ""); marcamainsection("#itemproductos"); break; case "/colecciones/": fotocolectpointer = 0; canviabackground("ella_servicios.jpg"); $('#fletxagesquerra').hide(); $('#foto').hide(); $('#fletxagdreta').click(function() { fotocolectpointer++; $('#foto').removeAttr('width'); $('#foto').removeAttr('height'); if (fotocolectpointer > fotos.length - 2) { $('#fletxagdreta').hide(); } $('#foto').hide(); $('#foto').attr("src", fotos[fotocolectpointer]); $('#foto').load(function() { $('#foto').fadeIn(); }); $('#fletxagesquerra').show(); }); $('#fletxagesquerra').click(function() { fotocolectpointer--; $('#foto').removeAttr('width'); $('#foto').removeAttr('height'); if (fotocolectpointer < 1) $('#fletxagesquerra').hide(); $('#foto').hide(); $('#foto').attr("src", fotos[fotocolectpointer]); $('#foto').load(function() { $('#foto').fadeIn(); }); $('#fletxagdreta').show(); }); marcamainsection("#itemcolecciones"); $.getScript("/js/collectiontoarray.js.php?colecid=" + url_query("colecid", referencia), function() { $('#foto').attr("src", fotos[0]); $('#foto').load(function() { $('#foto').fadeIn(); }); }); break; case "/opina/": $("#gracis").hide(); canviabackground("ella_opina.jpg"); scrollvert('#scrollcontent', 55, ""); scrollvert('#scrollopinions', 110, "2"); marcamainsection("#itemopina"); $("#borrar").click(function() { $('#form1').validationEngine('hideAll'); $("#nombre").val(""); $("#email").val(""); $("#poblacion").val(""); $("#comentarios").val(""); }); $("#aceptar").click(function() { if ($("#form1").validationEngine('validate')) { $.post("/engines/addopina.php", { nombre: $("#nombre").val(), email: $("#email").val(), poblacion: $("#poblacion").val(), comentarios: $("#comentarios").val() }, function(data) { $("#opina").hide(); $("#gracis").show(); }) } }); $("#okopina").click(function() { $("#opina").show(); $("#gracis").hide(); $('#form1').validationEngine('hideAll'); $("#nombre").val(""); $("#email").val(""); $("#poblacion").val(""); $("#comentarios").val(""); }); jQuery("#form1").validationEngine('attach'); break; } break; case "/": marcamainsection("#itemhomefake"); canviabg = window.setInterval(nextbg, 4000); $('#capafosca').hide(); break; } /* COMUNS */ if (categoria != "/tratamientos/") { preloader(".salones img"); preloader(".passaequipo img"); preloader(".fotos img"); preloader(".passaprensa img"); preloader(".passafotos img"); } $("#cerrar").click(function() { $('#container').fadeOut(); $('#capafosca').hide(); }); $('#genclosedesc').hide(); $('#cerrar').mouseover(function() { $('#genclosedesc').fadeIn('fast'); }); $('#cerrar').mouseout(function() { $('#genclosedesc').fadeOut('fast'); }); if (referencia != "/") $('#capafosca').show(); else $('#capafosca').hide(); $('#fletxaesq').mouseover(function() { $('#fletxaesq').attr("src", "/imatges/pasfotoesq-up.png"); }); $('#fletxadreta').mouseover(function() { $('#fletxadreta').attr("src", "/imatges/pasfotodr-up.png"); }); $('#fletxaesq').mouseout(function() { $('#fletxaesq').attr("src", "/imatges/pasfotoesq.png"); }); $('#fletxadreta').mouseout(function() { $('#fletxadreta').attr("src", "/imatges/pasfotodr.png"); }); $('#fletxagesquerra').mouseover(function() { $('#fletxagesquerra').attr("src", "/imatges/pasfotoesq-up.png"); }); $('#fletxagdreta').mouseover(function() { $('#fletxagdreta').attr("src", "/imatges/pasfotodr-up.png"); }); $('#fletxagesquerra').mouseout(function() { $('#fletxagesquerra').attr("src", "/imatges/pasfotoesq.png"); }); $('#fletxagdreta').mouseout(function() { $('#fletxagdreta').attr("src", "/imatges/pasfotodr.png"); }); $('.detallfltxdret').mouseover(function() { $(this).attr("src", "/imatges/passa_pag_dr-up.png"); }); $('.detallfltxdret').mouseout(function() { $(this).attr("src", "/imatges/passa_pag_dr.png"); }); $('.detallfltxesq').mouseover(function() { $(this).attr("src", "/imatges/passa_pag_esq-up.png"); }); $('.detallfltxesq').mouseout(function() { $(this).attr("src", "/imatges/passa_pag_esq.png"); }); } function scrollhorz(desp, numfotos) { var numtotalfotos = numfotos; fotoactual = 1; $('#fletxaesq').hide(); $('#fletxadreta').click(function() { if (fotoactual + 2 < numtotalfotos) { $('#xurro').animate({ left: '-=' + desp }); fotoactual++; if (fotoactual + 2 < numtotalfotos) { $('#fletxadreta').show(); } else $('#fletxadreta').hide(); if (fotoactual > 1) { $('#fletxaesq').show(); } else $('#fletxaesq').hide(); } }); $('#fletxaesq').click(function() { if (fotoactual > 1) { $('#xurro').animate({ left: '+=' + desp }); fotoactual--; if (fotoactual + 2 < numtotalfotos) { $('#fletxadreta').show(); } else $('#fletxadreta').hide(); if (fotoactual > 1) { $('#fletxaesq').show(); } else $('#fletxaesq').hide(); } }); } function scrollvert(dest, desp, fletxnum) { desp = desp - 30; var pagactual = 1; var numtotalpags = Math.ceil($(dest).height() / desp); $('#fletxaup' + fletxnum).click(function() { if (pagactual > 1) { $(dest).animate({ top: '+=' + desp }, 700); pagactual--; } }); $('#fletxadown' + fletxnum).click(function() { if (pagactual < numtotalpags) { $(dest).animate({ top: '-=' + desp }, 700); pagactual++; } }); } function canviabackground(fitxer) { backgorundfile = fitxer; } function realcanviabackground() { fitxer = backgorundfile; $("#triquibackimg2").hide(); $("#triquibackimg2").attr("src", "/imatges/fons/" + fitxer).load(function() { resize_bg("2"); //$("#triquibackimg2").show(); $("#triquibackimg2").fadeIn("slow", function() { $("#triquibackimg2").unbind(); $("#triquibackimg").attr("src", "/imatges/fons/" + fitxer).load(function() { resize_bg(""); $("#triquibackimg2").hide(); $("#triquibackimg").unbind(); }); }); }); } function inittratamientos(referencia, maxnumtrat) { var tratnum = parseInt(url_query('t', referencia)) - 1; fotoactual = tratnum + 1; if (fotoactual > 1) $('#fletxaesq').show(); else $('#fletxaesq').hide(); if ((fotoactual + 3) >= maxnumtrat) $('#fletxadreta').hide(); else $('#fletxadreta').show(); $('#xurro').animate({ left: '-=' + (299 * tratnum) }); } // Parse URL Queries Method function url_query(query, url) { query = query.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); var expr = "[\\?&]" + query + "=([^&#]*)"; var regex = new RegExp(expr); var results = regex.exec(url); if (results !== null) { return results[1]; return decodeURIComponent(results[1].replace(/\+/g, " ")); } else { return false; } } function showequipo(num) { $('#containertapa' + num).css("visibility", "visible"); $('#containertapa' + num + " #tancaaixo").unbind(); $('#containertapa' + num + " #tancaaixo").click(function() { $('#containertapa' + num).css("visibility", "hidden"); }); $('#containertapa' + num + " #contfletxdreta").click(function() { $('#containertapa' + num).css("visibility", "hidden"); showequipo(num + 1) }); $('#containertapa' + num + " #contfletxesq").click(function() { $('#containertapa' + num).css("visibility", "hidden"); showequipo(num - 1) }); } function preloader(obj) { $(obj).createLoader({ effect: "fadeIn", effectSpeed: "slow", backgroundColor: "transparent", useLoadingImage: true, backgroundImage: "/imatges/loading.gif", backgroundPosition: "center center", textLoading: "" }); } function nextbg() { //alert("hola"+pointerbg); pointerbg++; if (pointerbg >= fotosbg.length) pointerbg = 0; backgorundfile = fotosbg[pointerbg]; realcanviabackground(); }