function showStructures(id){jQuery('.openclose-structure').hide();jQuery('#openclose_structure-'+id).show();jQuery('.all_structure').hide();jQuery('#sotto_structure_list-'+id).show();jQuery('#structures_'+id).css('top','0px');jQuery('ul.structure_left li').removeClass('active');jQuery('#structure_left_'+id).addClass('active');jQuery('#show_more').attr('href',jQuery('#structures_'+id+' a:first').attr('href'));jQuery('#info_structure img').attr('src',jQuery('#structures_'+id+' li:first img').attr('src'));jQuery('#abstract_structure').html(jQuery('#structures_'+id+' li:first span').html());}
function moveDown(id){$top=parseFloat(jQuery('#structures_'+id).css('top').replace('px',''));$height=(parseFloat(jQuery('#structures_'+id).css('height').replace('px',''))*-1)+230;if($top>$height){jQuery('#structures_'+id).animate({top:'-=29'},1);}}
function moveUp(id){$top=parseFloat(jQuery('#structures_'+id).css('top').replace('px',''));if($top<0){jQuery('#structures_'+id).animate({top:'+=29'},1);}}
function moveRight_doctor(){$left=parseFloat(jQuery('.scroll_doctors').css('left').replace('px',''));$width=(parseFloat(jQuery('.scroll_doctors').css('width').replace('px',''))*-1)+(parseFloat(jQuery('#content_doctors').css('width').replace('px',''))+3);if($left>$width){jQuery('.scroll_doctors').animate({left:'-=245'},1);}}
function moveLeft_doctor(){$left=parseFloat(jQuery('.scroll_doctors').css('left').replace('px',''));if($left<0){jQuery('.scroll_doctors').animate({left:'+=245'},1);}}
function redirectSelect(e){if(jQuery(this).attr('rel')!=''){document.location=jQuery(this).attr('rel');}}
function show_Forgot(){overlayerPos('overlayer');document.getElementById('overlayer').style.display='block';document.getElementById('vel_forgot').style.display='block';}
function hide_Forgot(){document.getElementById('overlayer').style.display='none';document.getElementById('vel_forgot').style.display='none';}
function show_info(){overlayerPos('info-box');document.getElementById('info-box').style.display='block';document.getElementById('info-vel').style.display='block';}
function hide_info(){document.getElementById('info-box').style.display='none';document.getElementById('info-vel').style.display='none';}
function handleImagesIntoContent(){var tpl_image_box;jQuery('.autoImages img').each(function(){if(jQuery(this).attr('title')!=''&&jQuery(this).attr('alt')!=''){cnt='<div class="title">'+jQuery(this).attr('title')+'</div>';cnt+='<div class="description">'+jQuery(this).attr('alt')+'</div>';tpl_image_box='<div class="box">%CNT%<div class="link"><p><a href="'+jQuery(this).attr('src')+'" class="ingrandisci overlayer">ingrandisci</a></p></div></div>';jQuery(this).wrap(jQuery('<div class="space"></div>'));jQuery(this).parent().append(tpl_image_box.replace('%CNT%',cnt));}});}
function showZoom(e){var img_obj=jQuery(e.target).closest('div.space').children('img');var img_src=img_obj.attr('src');var img_mw=img_obj.width();var img_w=img_obj.css("max-width","none").width();var img_h=img_obj.height();img_obj.css("max-width",img_mw);jQuery('#overlayer').html('<img src="'+img_src+'" width="'+img_w+'" height="'+img_h+'" />');jQuery('#overlayer').css('width',img_w);jQuery('#overlayer').css('height',img_h);show_Forgot();}
function overlayerPos(id){var overlayer=jQuery('#'+id);var overlayer_width=overlayer.outerWidth();var overlayer_height=overlayer.outerHeight();if(overlayer_width<=jQuery(window).width()&&overlayer_height<=jQuery(window).height())
overlayer.css('position','fixed');else
overlayer.css('position','absolute');if(overlayer_width<=jQuery(window).width())
overlayer.css('margin-left','-'+Math.floor(overlayer_width/2)+'px');else{overlayer.css('left','0');overlayer.css('margin-left','10px');}
if(overlayer_height<=jQuery(window).height())
overlayer.css('margin-top','-'+Math.floor(overlayer_height/2)+'px');else{overlayer.css('top','0');overlayer.css('margin-top','10px');}}
function changePage(page){jQuery('div.page').hide();jQuery('div.page.p'+(page-1)).show();}
function printWindow(){bV=parseInt(navigator.appVersion)
if(bV>=4)window.print()}
function setFontSize(size){var newFontSize;var currentFontSize=parseInt(jQuery('body').css('font-size'));if($.cookie('TEXT_SIZE_SR')){currentFontSize=parseInt($.cookie('TEXT_SIZE_SR'));}
if(size==1&&currentFontSize<15)
newFontSize=(currentFontSize+2)+"px";else if(size==0&&currentFontSize>11)
newFontSize=(currentFontSize-2)+"px";else
newFontSize=currentFontSize+"px";$.cookie('TEXT_SIZE_SR',parseFloat(newFontSize),{path:'/'});resizePageFont(newFontSize);}
function resizePageFont(newFontSize){if(!isNaN(parseFloat(newFontSize))){var currentFontSize=parseFloat(jQuery('body').css('font-size'));jQuery('*').filter(function(){var fs=parseFloat(jQuery(this).css("font-size"));mstatus=(fs<=currentFontSize);return mstatus;}).css('font-size',newFontSize);jQuery('#servicebarRight .facebook, #servicebarRight .langEn').each(function(){if(parseInt(jQuery(this).css('font-size'))>13)
jQuery(this).css('font-size','13px');});}}
function accordion_menu(){jQuery('#accordion_menu ul').hide();jQuery('#accordion_menu ul:first').show();jQuery("#accordion_menu li").has('ul').children('a').addClass('accordion_submenu_c');jQuery("#accordion_menu li").click(function(event){if(!(jQuery(this).closest('ul').closest('li').length)){jQuery(this).siblings().children("a").removeClass('selected');jQuery(this).has('ul').children("a").toggleClass('selected');jQuery(this).children("ul").css('background','none');}
else{jQuery(this).has('ul').children("a").toggleClass('accordion_submenu_o');jQuery(this).children("ul").css('background','transparent url(/images/tratteggio.gif) repeat-x 0 top');}
jQuery(this).siblings().find("ul:first").hide("fast").end().end().children("ul").slideToggle("fast");event.stopPropagation()});}
function menuInit(){jQuery('#accordion_menu').children('ul').children('li').hover(function(){jQuery(this).find('a:first').toggleClass('hover');jQuery(this).prev('li').find('a:first').toggleClass('noborder');});jQuery('#accordion_menu li ul').each(function(){jQuery(this).hide();});jQuery('#accordion_menu li.selected').children('ul').each(function(){jQuery(this).show();});jQuery('#accordion_menu li.selected').parents('li').each(function(){jQuery(this).addClass('selected');});}
function accordion_menu_hp(){jQuery('#accordion_menu_hp ul').hide();jQuery('#accordion_menu_hp ul:first').show();jQuery('#accordion_menu_hp ul:first li:last-child, #accordion_menu_hp ul li ul li:last-child a').addClass('last');jQuery('#accordion_menu_hp ul li').has('ul').children('a').addClass('accordion_submenu_c');jQuery("#accordion_menu_hp ul > li").click(function(event){if(jQuery(this).is(':first-child'))
jQuery(this).css('margin-top','1px');jQuery(this).siblings().find("ul:first").hide(400).end().has('ul').children('a').removeClass('selected').addClass('accordion_submenu_c').end().end().end().find("a:first").toggleClass("accordion_submenu_c selected").end().children("ul").slideToggle(400);event.stopPropagation()});jQuery("#accordion_menu_hp ul li:first").click();}
function autosuggest_healthcare(){jQuery.ajax({url:'autosuggest/assistenza',data:'query_treatment='+jQuery('input[name="query_treatment"]').val()+'&type='+jQuery('select[name="type"]').val(),type:'POST',success:function(data,textStatus,jqXHR){if(data!="")jQuery('#autosuggest_treatment_departments').html(data).show();}});jQuery('html').click(function(){if(jQuery('#autosuggest_treatment_departments:visible').length)
jQuery('#autosuggest_treatment_departments:visible').hide();});}
function refresh_datepicker_value(dateText,inst){var idname=inst.id.replace('_jquery_control','');var selDate=dateText.split('-');jQuery('#div_'+idname+'_year').find('span').text(selDate[0]);var selDateY=jQuery('#div_'+idname+'_year').find('select option:contains("'+selDate[0]+'")').val();jQuery('#div_'+idname+'_year').find('select').val(selDateY);jQuery('#div_'+idname+'_month').find('span').text(selDate[1]).end().find('select').val(Number(selDate[1]));jQuery('#div_'+idname+'_day').find('span').text(selDate[2]).end().find('select').val(Number(selDate[2]));}
function setupBanners(){var bannerURL="http://www.cinqueper1000.com/";jQuery('img[src*="/ricerca_migliora"], img[src*="minibanner"], img[src*="/education/banner"]').wrap('<a href="'+bannerURL+'" target="_blank" />');}
function bind_calendar_table(){jQuery('.calendar .cal_prev, .calendar .cal_next').click(function(e){e.preventDefault();jQuery.ajax({url:'/course/calendar/get',type:'POST',data:'date='+jQuery(this).attr('rel'),success:function(data,textStatus,jqXHR){jQuery('#calendar.widget').html(data);bind_calendar_table();}});});jQuery('.calendar td.cal_tagged').hover(function(){num=jQuery(this).find('div.cal_tooltip').length;jQuery(this).find('div.cal_tooltip_content p:first').text(num+' cors'+((num==1)?'o':'i')+':');var cal_tooltip=jQuery(this).find('div.cal_tooltip:first');cal_tooltip.toggle();if(cal_tooltip.find('.cal_tooltip_content ul:first').is(':visible')&&(cal_tooltip.find('div.jcarousel-skin-sr').length==0)){cal_tooltip.find('.cal_tooltip_content ul:first').jcarousel({scroll:1});}
cal_tooltip.css('margin-top','-'+cal_tooltip.outerHeight()+'px');cal_tooltip.css('margin-left','-'+(cal_tooltip.outerWidth()-26)+'px');cal_tooltip.css('background','transparent url(/images/ico_cal_tooltip_arrow.png) no-repeat '+(cal_tooltip.outerWidth()-16)+'px bottom');});jQuery('.cal_tooltip').hide();}
function toggleMapChilds(id){jQuery('#'+id).toggle();jQuery('#'+id).prev().toggleClass('highlighted');}
function switch_treatment_ssn(){if(jQuery('#sr_treatment_booking_treatment_id_select option:selected').attr('class')=='ssn'){jQuery('#ssn_box').removeClass('hidden');jQuery('div.customselect div.list ul li:last-child').addClass('last');jQuery('div.customselect div.text').each(function(){jQuery(this).width((jQuery(this).parent().outerWidth()-45));});jQuery('div.customselect div.list').each(function(){jQuery(this).width((jQuery(this).parent().outerWidth()-2));});}else{jQuery('#ssn_box').addClass('hidden');}}
jQuery(document).ready(function(){jQuery('select').each(function(){override_select(jQuery(this),'');});resizePageFont($.cookie('TEXT_SIZE_SR')+'px');handleImagesIntoContent();jQuery('#div_departments div.list a, #div_treatments div.list a').click(redirectSelect);if(jQuery('#accordion_menu_hp').length)
accordion_menu_hp();if(jQuery('.overlayer').length)
jQuery('.overlayer').fancybox({'autoScale':false,'transitionIn':'none','transitionOut':'none'});if(jQuery('#form_login, #signin_username, #signin_password').length){jQuery('#signin_username').attr('placeholder','nome utente');jQuery('#signin_password').attr('placeholder','password');}
if(jQuery('input[placeholder], textarea[placeholder]').length)
jQuery('input[placeholder], textarea[placeholder]').placeholder();if(jQuery('.infoutili').length)
jQuery('.side.right').hide();if(jQuery('#sr_treatment_booking_treatment_id_select').length>0){switch_treatment_ssn();jQuery('#sr_treatment_booking_treatment_id_select').change(function(){switch_treatment_ssn();});}
if(jQuery('.info_tooltip_container').length){jQuery('.ico_info_tooltip').hover(function(){jQuery(this).next('.info_tooltip').toggle();});}
jQuery('#list_health_structure').change(function(){document.location=jQuery(this).val();});if(jQuery('#accordion_menu').length)
menuInit();if(jQuery('#hpMenu').length){jQuery('#hpMenu').tabs({selected:-1,event:"mouseover",show:function(event,ui){jQuery('#hpMenu .ui-tabs-panel:visible').hide();if(!jQuery('#hpMenu').hasClass('opened')){jQuery('#hpMenu').addClass('opened');jQuery(ui.panel).show('blind').stop(true,true);jQuery(ui.panel).find('ul li:last').css('background','none');}}});jQuery('#hpMenu').mouseleave(function(){jQuery('#hpMenu .ui-tabs-panel:visible').hide('blind',function(){jQuery('#hpMenu').css('padding-bottom',0);}).stop(true,true);jQuery('#hpMenu').removeClass('opened');});jQuery('#hpMenu .ui-state-default a').mouseenter(function(){if(!jQuery(jQuery(this).attr('href')).is(':visible'))
{jQuery(jQuery(this).attr('href')).show().stop(true,true);}});jQuery('#hpMenu ul li a').click(function(){if(jQuery(this).attr('rel').length){location.href=jQuery(this).attr('rel');}});jQuery('#hpMenu, #hpMenu *').removeClass('ui-widget-content ui-corner-all ui-corner-top ui-corner-bottom ui-widget-header');}
jQuery("#tr_doctor_occupation_id").hide();if(jQuery("#div_sr_user_cdf_occupation_id.customselect div.text span").text()!='Medico'){jQuery("#tr_doctor_occupation_id").hide();jQuery("#div_sr_user_cdf_occupation_id .list a").click(function(){if(jQuery(this).text()=='Medico'){jQuery("#tr_doctor_occupation_id").fadeIn();}else{jQuery("#tr_doctor_occupation_id").fadeOut();jQuery("#div_sr_user_cdf_doctor_occupation_id.customselect div.text span").text('');}});}
setupBanners();jQuery('.question:last').addClass('noborder');jQuery('.question:first').removeClass('last_question');jQuery('.search_result:last').addClass('noborder');jQuery('.banner_comunication_scroll').parent().css('height','270px');jQuery('.sezione li:last').children().addClass('noborder');jQuery('#sr_treatment_booking_health_structure_id_select').change(function(){jQuery.ajax({url:'/recupera/prestazioni',data:'id='+jQuery(this).val(),type:'POST',success:function(data,textStatus,jqXHR){jQuery('#div_sr_treatment_booking_treatment_id_select div.list').html(data);update_bind_customselect('sr_treatment_booking_treatment_id_select');}});});});
