/*********************************************************************** ************** DOCUMENT.READY ************** ***********************************************************************/ var flag=0; var cont=0; $(document).ready(function() { var ie=false; if(jQuery.browser.msie === true && jQuery.browser.version < 10) { switch(jQuery.browser.version) { case '9.0' : window.addEventListener('message',ricevimento); break; case '8.0' : try{ window.attachEvent('onmessage',ricevimento);} catch(e){/*console.log("è scaturito un'errore" +e);*/} break; /*case '7.0' : console.log(jQuery.browser.version);*/ } ie=true; } else {window.addEventListener("message", ricevimento, false);} var iframe = $('pubbPositionInterno')[0]; var player = $(player); var status = $('.status'); // NASCONDO FRECCE $("#btnPrevGalleryBig").css("display", "none"); $("#btnNextGalleryBig").css("display", "none"); //MOUSE OVER/MOUSE OUT CONTAINER IMMAGINE $(".fotoSfilateBig").hover(function() { //ON OVER $("#btnPrevGalleryBig").css("display", "block"); $("#btnNextGalleryBig").css("display", "block"); } , function() { //ON OUT $("#btnPrevGalleryBig").css("display", "none"); $("#btnNextGalleryBig").css("display", "none"); }); //SE CLICCO L'IMMAGINE DEL POPUP $('#caroselloPicBigOverlay li img').live("click",function() { clickNextPrevGallery("Next"); }); //modifica provvisoria dei credits foto per balenciaga if($("#boxGalleryOverlay .nStilista").text() == "Balenciaga"){ $("#boxGalleryOverlay .fotografo").text("Foto: Courtesy of press office"); } $("#cmbCollezioni").change(function () { var stagione = $("#cmbStagioni").val(); $.get("/moda/sfilate/getComboStagioni.action?ricerca.collezione=" + $("#cmbCollezioni").val(), function(data) { $("#cmbStagioni").html(data); $("#cmbStagioni").val(stagione); $.get("/moda/sfilate/getComboStilisti.action?ricerca.idStagione=" + $("#cmbStagioni").val() + "&ricerca.collezione=" + $("#cmbCollezioni").val(), function(data) { $("#cmbStilisti").html(data); }); $("#cmbDettagli").html(""); $("#cmbDettagli").attr("disabled",true); }); }); $("#cmbStagioni").change(function () { var stilista = $("#cmbStilisti").val(); $.get("/moda/sfilate/getComboStilisti.action?ricerca.idStagione=" + $("#cmbStagioni").val() + "&ricerca.collezione=" + $("#cmbCollezioni").val(), function(data) { var stilista = $("#cmbStilisti").val(); $("#cmbStilisti").html(data); $("#cmbStilisti").val(stilista); }); $("#cmbDettagli").html(""); $("#cmbDettagli").attr("disabled",true); }); $("#cmbStilisti").change(function () { $.get("/moda/sfilate/getComboDettagli.action?ricerca.idStagione=" + $("#cmbStagioni").val() + "&ricerca.idStilista=" + $("#cmbStilisti").val() + "&ricerca.collezione=" + $("#cmbCollezioni").val(), function(data) { $("#cmbDettagli").html(data); $("#cmbDettagli").attr("disabled", $("#cmbDettagli").children().size()==1); }); }); // carosello HP jQuery('#mycarouselSf').jcarousel(); function trigger(carousel, state){ jQuery("#listaSf .pagSfilate #currentPg").html(carousel.first); } baseName = s.pageName; function triggerFoto(cFoto){ // console.info("triggerFoto - Start"); $(".numSfBig #currentPgBig").html(cFoto); var numFotoScelta = jQuery(".numSfBig #currentPgBig").html(); $(".numSfBig #currentPg").html(numFotoScelta); var totFoto = pic_url.length; if(numFotoScelta <=1){ numFotoSceltaDef = numFotoScelta; max = 3; }else{ numFotoSceltaDef = numFotoScelta-1; max = parseInt(numFotoScelta)+1; } caricoImgAfterBefore(numFotoSceltaDef,max); //CONTROLLO FRECCIA NEXT E PREV /*if(numFotoScelta >= totFoto){ jQuery('#btnNextGalleryBig').addClass('btnNextGalleryBigGrigio'); jQuery('.btnNextGallery').removeClass(); jQuery('.numSfBig li:eq(2)').addClass('btnNextGalleryNoActive'); }else{ jQuery('#btnNextGalleryBig').removeClass('btnNextGalleryBigGrigio'); jQuery('.btnNextGalleryNoActive').removeClass(); jQuery('.numSfBig li:eq(2)').addClass('btnNextGallery'); } if(numFotoScelta <= 1){ jQuery('#btnPrevGalleryBig').addClass('btnPrevGalleryBigGrigio'); jQuery('.btnPrevGallery').removeClass(); jQuery('.numSfBig li:eq(0)').addClass('btnPrevGalleryNoActive'); }else{ jQuery('#btnPrevGalleryBig').removeClass('btnPrevGalleryBigGrigio'); jQuery('.btnPrevGalleryNoActive').removeClass(); jQuery('.numSfBig li:eq(0)').addClass('btnPrevGallery'); }*/ // CHIAMATA NIELSEN // console.info("triggerFoto - Niesen"); urlPage = window.location; urlPage = urlPage.href.split("http://")[1]; urlPage = escape(urlPage); // console.info("triggerFoto - Niesen" + urlPage); var numRandom = Math.round(99999999*Math.random()); var nielsenImg = ''; // console.info("triggerFoto - Niesen " + nielsenImg); jQuery('.picNielsen *').remove(); jQuery('.picNielsen').append(nielsenImg); // jQuery('.picNielsen').append(''); // jQuery('.picNielsen').append('test'); // CHIAMATA ANALITCS // _gaq.push(['_trackPageview', urlPage]); _gaq.push(['_trackPageview']); // CHIAMATA ADV // console.info("triggerFoto - ADV"); //inizio chiamata Omniture var idFoto = numFotoScelta; var pageName = baseName+"_"+idFoto; s.prop2 = "moda:sfilate-stilisti:db-sfilate"; trackAjaxFotoGallery(pageName); //fine chiamata Omniture } if(jQuery('#mycarouselSfStilista').length != 0){ //numTotPreload = jQuery('.preload').length; $('img.preload').each(function(){ jQuery(this).parent().append('
'); // PRENDO ISTANZA IMG var image = new Image(); image.src = $(this).attr('src'); if (image.complete){ jQuery(this).parent().find('.loadingImg').hide(); }else{ jQuery(this).parent().find('.loadingImg').hide(); //jQuery(this).parent().find('.loadingImg').html('errore'); } }); // CAROSELLO FOTO jQuery('#mycarouselSfStilista').jcarousel({ scroll: 1, itemLoadCallback: trigger }); jQuery('#AllTellers').jcarousel({ }); // NUMERAZIONE PAG TOT var numTotPg = jQuery('#mycarouselSfStilista li.pagSfStilista').size(); jQuery('.totNumPg').html(numTotPg); jQuery('#mycarouselSfStilista-next').bind('click', function() { //carousel.next(); // "3" is number of visible items //var currPage = ((carousel.first - 1) / 3) + 1; // makevisible('vedi'+ currPage) //return false; alert("AAA"); }); jQuery('img.preload').click(function() { // RIMUOVO CONTENUTO UL CAROSELLO BIG jQuery('.fotoSfilateBig *').remove(); jQuery('.fotoSfilateBig').append(''); //APPENDO TANTI LI QUANTE LE FOTO i = 0; var totFoto = pic_url.length; jQuery.each(pic_url, function(i) { i++; if(i <= totFoto){ $("#caroselloPicBigOverlay").append('
  • '); } }); jQuery('.numSfBig .totNumPg').html(totFoto); jQuery('.fotoSfilateBig').append('
    '); numFotoScelta = jQuery(this).attr('value'); numFotoScelta2 = numFotoScelta-1; var widthTot = totFoto*399; if(numFotoScelta2 == 0){ var leftPos = 0; }else{ var leftPos = numFotoScelta2*399; } var cFoto = parseInt(numFotoScelta2)+1; console.info(numFotoScelta); console.info(cFoto); //animation: 1, jQuery('#caroselloPicBigOverlay').jcarousel({ //wrap: 'circular', itemLoadCallback: { onBeforeAnimation: triggerFoto(cFoto) }, start: cFoto, scroll: 1, itemFallbackDimension: 300 }),jQuery('#caroselloPicBigOverlay').css({ width: widthTot, left: -leftPos }); // CLICK BTN SX GALLERY SU CAROSELLO jQuery('#btnPrevGalleryBig').click(function(){ jQuery('.btnPrevGallery').trigger('click'); }); jQuery('#btnNextGalleryBig').click(function(){ jQuery('.btnNextGallery').trigger('click'); //console.log('click'); }); $('.closeStep00').show(); //$('#pubbPositionInterno').load(function(){ // console.info("finito"); //if($("#pubbPosition1").find('iframe').andSelf('.pubbPositionModa').length>=1){ // $('.closeStep00').show(); // }; // }); }); // CLICK BTN SX GALLERY SU CAROSELLO jQuery('.btnPrevGallery').click(function(){ clickNextPrevGallery("Prev"); }); jQuery('.btnNextGallery').click(function(){ clickNextPrevGallery("Next"); }); function clickNextPrevGallery(ap){ var cFoto = jQuery(".numSfBig #currentPgBig").html(); var cFotoTot = jQuery(".numSfBig .totNumPg").html(); if(ap == "Next"){ var cFoto = parseInt(cFoto)+1; }else{ var cFoto = parseInt(cFoto)-1; } if (cFoto < 1){ var left = -parseInt($("#caroselloPicBigOverlay").css("width").replace("px",""))+400; $("#caroselloPicBigOverlay").css("left",left); triggerFoto(cFotoTot); /*var mLeft = 0; if(cFoto != 0){ $("#caroselloPicBigOverlay").animate({ left: ""+mLeft+"px" }, 150, function() { // Animation complete. triggerFoto(cFoto); }); }*/ }else if (cFoto > cFotoTot){ triggerFoto(1); $("#caroselloPicBigOverlay").css("left",0); /*if(cFoto <= cFotoTot){ var mLeft = $('#caroselloPicBigOverlay').css('width'); var mLeft = parseInt(mLeft)-399; $("#caroselloPicBigOverlay").animate({ left: "-"+mLeft+"px" }, 150, function() { // Animation complete. triggerFoto(cFoto); }); }*/ }else{ var mLeft = $('#caroselloPicBigOverlay').css('left'); var mLeft = mLeft.replace("-",""); var mLeft = mLeft.replace("px",""); if(ap == "Next"){ var mLeft = parseInt(mLeft)+399; }else{ var mLeft = parseInt(mLeft)-399; } $("#caroselloPicBigOverlay").animate({ left: "-"+mLeft+"px" }, 150, function() { // Animation complete. triggerFoto(cFoto); }); } } //jQuery('.fotoSfilateBig jcarousel-prev') function caricoImgAfterBefore(numFotoView,max){ i = numFotoView; if(numFotoView<=max){ var curr = $("#p"+i); var img = new Image(); $(img).load(function () { if(jQuery('#p'+numFotoView+'').children().size() >= 1) { //alert("si img"); caricoImgAfterBefore(numFotoView+1,max); }else{ //alert("no img"); $(curr).removeClass('loading').append(this); $(this).fadeIn(); caricoImgAfterBefore(numFotoView+1,max); } }).error(function () { // notifica di errore load }).attr('src', pic_url[i-1]); } return false; } // INSERISCO OVERLAY AL CLICK DELLE FOTO jQuery('.preload').click(function(){ scrollpx = $(window).scrollTop(); scrollpx = scrollpx+10; widthTot = $(window).width(); widthTot = (widthTot-960)/2; jQuery('.simple_overlay').css({ 'top': scrollpx+'px', 'left': widthTot+'px' }); jQuery('#boxGalleryOverlay').show(); jQuery('#advSfDx *').remove(); jQuery('#advSfDx').append(''); //setCliccaImg(); var pageName; trackAjaxFotoGallery(pageName); }); // CLICK CLOSESTEP jQuery('.closeStep00').click(function(e) { // CHIAMATA ADV jQuery('#pubbPosition1 *').remove(); //jQuery('#boxGalleryOverlay').hide(); jQuery('#boxGalleryOverlay').show(); var query = window.location.search.substr(1); var par = query.split('&'); var url = 'http://oas.rcsadv.it/RealMedia/ads/adstream_sx.ads/leiweb.it/speciali/sfilate/gallery/1' + (n = (Math.floor(Math.random()*999999999).toString())) + "000000000".substring(0,9-n.length) + '@Position1?'+par; var timeto = 20000; if(!ie){ try{$.ajax({ type:"GET", xhrFields:{withCredentials: true}, crossDomain: true, url:url, dataType:"text", cache: false, success: function(data) { var patt1=/ghos/gi; var ghost; try{ ghost = data.match(patt1).length; } catch(e){ ghost=0;} if(ghost == 0) { jQuery('#pubbPosition1').append(''); } else { closeAll(); }}, error: function(data){ closeAll();} });}catch(e){closeAll();} } else{ flag=0; jQuery('#pubbPosition1').append(''); cont==0?setTimeout('prova()',2000):setTimeout('prova()',500); cont++; } //jQuery('#pubbPosition1').append(''); jQuery('#pubbPosition1').attr('rel','aperto'); jQuery(this).hide(); jQuery('#pubbPosition1').show(); numFotoScelta = null; numFotoScelta2 = null; //setTimeout('closeAll()',20000); //setTimeout('closeAll()',1); }); jQuery('.closeStep01').click(function() { jQuery('#pubbPosition1').attr('rel','chiuso'); jQuery('#pubbPosition1').hide(); jQuery('#boxGalleryOverlay').hide(); jQuery('.closeStep00').hide(); }); return false; } function cliccaImg(){ //console.log('CLICCA IMG'); clickNextPrevGallery("Next"); } /*function setCliccaImg() { setTimeout(function () { cliccaImg(); }, 200); setCliccaImg(); }*/ }); // CHIUSURA document.ready function closeAll() { var statoPubb = jQuery('#pubbPosition1').attr('rel'); if( statoPubb != "chiuso"){ jQuery('#pubbPosition1').hide(); jQuery('a.closeStep01').trigger('click'); } } function ricevimento(event) {var data; /*console.log("sono dentroo al ricevimento"); console.log(event.origin); */ //console.log(event); if(event.origin == "http://oas.rcsadv.it") { //console.log(event.origin); data = JSON.parse(event.data); //console.log(data.type); switch(data.type) { case 'video' : flag = 1; if(data.ex == "terminato") { //console.log("sto per chiudere"); closeAll(); } break; case 'swf': case 'image' : flag = 2;if (typeof data.time != 'undefined'){ setTimeout('closeAll()',data.time*1000); } break; default : closeAll(); } //console.log(data.statusText); } //cont+=1; } //************************************************ function prova() { //console.log("flag in prova" + flag); switch (jQuery.browser.version) { case '9.0' : flag ==0?closeAll():flag=0; break; case '8.0' : case '7.0' : cont==0?setTimeout('closeAll()',20000-2000):setTimeout('closeAll()',20000-500); } } //************************************************ $(window).load(function(){ // ppagina elenco ABC if($('.listAlfa').length != 0){ $(".listAlfa li:odd").css("background-color", "#f5f5f5"); } });