$(document).ready(function(){ $('.rounded').corner('top'); $('.full-rounded').corner(); $('.bottone_news_approfondimenti').click(function(){ var id_bottone = $(this).attr("id"); var sPath = window.location.pathname; var sPage = sPath.substring(sPath.lastIndexOf('/') + 1); //se non sono in homepage allora devo fare redirect if ( (sPage!='') && (sPage!='index.php') ) { switch (id_bottone) { case 'bottone_news': location.href = "news.php"; break; case 'bottone_approfondimenti': location.href = "approfondimenti.php"; break; } } $('.bottone_news_approfondimenti').removeClass("bottone_selezionato"); $(this).addClass('bottone_selezionato'); $("#ultime_news_approfondimenti").html('Caricamento in corso...'); switch (id_bottone) { case 'bottone_news': $.ajax({ type: "POST", url: "news/ultime-news.php", data: "", cache: false, success: function(html) { $("#ultime_news_approfondimenti").html(html); } }); break; case 'bottone_approfondimenti': $.ajax({ type: "POST", url: "approfondimenti/ultimi-approfondimenti.php", data: "", cache: false, success: function(html) { $("#ultime_news_approfondimenti").html(html); } }); break; } }); /*$.ajax({ type: "POST", url: "news/ultime-news.php", data: "", cache: false, success: function(html) { $("#ultime_news_approfondimenti").html(html); } });*/ $('li.headlink').hover( function() { $('ul', this).css('display', 'block'); }, function() { $('ul', this).css('display', 'none'); } ); $('textarea[maxlength]').keyup(function(){ var max = parseInt($(this).attr('maxlength')); if($(this).val().length > max){ $(this).val($(this).val().substr(0, $(this).attr('maxlength'))); } $(this).parent().find('.charsRemaining').html('Puoi inserire ancora ' + (max - $(this).val().length) + ' caratteri'); }); $("#pre_disclaimer_blog").next().hide(); $("#mostra_disclaimer_blog").click(function(){ $("#pre_disclaimer_blog").next().slideToggle(); }); //allineo alla stessa altezza i tre div in home #home_colonna_sx #area_centrale_home #home_colonna_dx var altezza_home_colonna_sx = $("#home_colonna_sx").height(); var altezza_area_centrale_home = $("#area_centrale_home").height(); var altezza_home_colonna_dx = $("#home_colonna_dx").height(); if (altezza_home_colonna_sx>altezza_area_centrale_home) { if (altezza_home_colonna_sx>altezza_home_colonna_dx) { //altezza_home_colonna_sx $("#area_centrale_home").css("min-height",altezza_home_colonna_sx); $("#area_centrale_home").css("height",altezza_home_colonna_sx); $("#home_colonna_dx").css("min-height",altezza_home_colonna_sx); $("#home_colonna_dx").css("height",altezza_home_colonna_sx); } else { //altezza_home_colonna_dx $("#home_colonna_sx").css("min-height",altezza_home_colonna_dx); $("#home_colonna_sx").css("height",altezza_home_colonna_dx); $("#area_centrale_home").css("min-height",altezza_home_colonna_dx); $("#area_centrale_home").css("height",altezza_home_colonna_dx); } } else { if (altezza_area_centrale_home>altezza_home_colonna_dx) { //altezza_area_centrale_home $("#home_colonna_sx").css("min-height",altezza_area_centrale_home); $("#home_colonna_sx").css("height",altezza_area_centrale_home); $("#home_colonna_dx").css("min-height",altezza_area_centrale_home); $("#home_colonna_dx").css("height",altezza_area_centrale_home); } else { //altezza_home_colonna_dx $("#home_colonna_sx").css("min-height",altezza_home_colonna_dx); $("#home_colonna_sx").css("height",altezza_home_colonna_dx); $("#area_centrale_home").css("min-height",altezza_home_colonna_dx); $("#area_centrale_home").css("height",altezza_home_colonna_dx); } } }); function cambia_sostenitori_in_home() { $.ajax({ type: "POST", url: "home-area-centrale-sostenitori.php", data: "", cache: false, success: function(html, textStatus, XMLHttpRequest) { if ($.browser.msie) { $(XMLHttpRequest).ready(function(){ $("#area_home_sostenitori_random").hide().html(html).fadeIn("slow"); }); } else { $(XMLHttpRequest).load(function(){ $("#area_home_sostenitori_random").hide().html(html).fadeIn("slow"); }); } //$("#area_home_sostenitori_random").html(html); //$("#area_home_sostenitori_random").delay(500).hide().html(html).fadeIn("slow"); /*$.ajax({ url: "js/form_login.js", dataType: "script" });*/ } }); } function ricarica_pagina() { window.location.reload(); }