/* site/calendar.js */
var calEnlargeTimerId=null;var calReduceTimerId=null;$(function(){if($.browser.msie){$('#content').css("padding-right",0);}
var calendarWrapper=$('.calendar_wrapper');calendarWrapper.each(function(){makeSlider($(this),$(this).parent());});if(wegg){calendarEE();}});calenTimerId=null;var calenDirection=1;function calendarEE(){if(calenTimerId)
clearInterval(calenTimerId);calenTimerId=null;var afisha_calendar=$('.afisha_calendar:first');var calendar=$('.calendar_wrapper',afisha_calendar);var scroll_content=calendar.find('.scroll-content');var scrollbar=calendar.find('.ui-slider');calenTimerId=setInterval(function(){afisha_calendar.queue(function(){afisha_calendar.css('background-color','lime');calendar.css('background-color','magenta');scroll_content.css('background-color','yellow');if(calenDirection&&scrollbar.slider('value')>scrollbar.slider('option','max')-40){calenDirection=0;}
if(!calenDirection&&scrollbar.slider('value')<40){calenDirection=1;}
if(calenDirection){scrollbar.slider('value',scrollbar.slider('value')+30);}else{scrollbar.slider('value',scrollbar.slider('value')-30);}
$(this).dequeue();});afisha_calendar.animate({border:'16px red solid'},{duration:50});afisha_calendar.queue(function(){afisha_calendar.css('background-color','yellow');calendar.css('background-color','lime');scroll_content.css('background-color','magenta');if(calenDirection){scrollbar.slider('value',scrollbar.slider('value')+30);}else{scrollbar.slider('value',scrollbar.slider('value')-30);}
$(this).dequeue();});afisha_calendar.animate({border:'16px red solid'},{duration:50});afisha_calendar.queue(function(){afisha_calendar.css('background-color','magenta');calendar.css('background-color','yellow');scroll_content.css('background-color','lime');if(calenDirection){scrollbar.slider('value',scrollbar.slider('value')+30);}else{scrollbar.slider('value',scrollbar.slider('value')-30);}
$(this).dequeue();});afisha_calendar.animate({border:'16px red solid'},{duration:50});},1);}
$(window).resize(function(){$('.calendar_wrapper').each(function(){makeSlider($(this),$('#information'));});});
/* site/afisha.js */
var firstFilter=true;var urlTags=new Array();$(function(){var dates=new Array();var maxDate=new Date();$(document).ready(function(){if(document.location.pathname.indexOf("schedule")!=-1){synchDateAndTime();$("span.avaliable_date").each(function(){dates.push($(this).html());});if(dates.length>0){var dts=dates[dates.length-1].split('.');maxDate=daysBetween(new Date(),new Date(dts[2],parseInt(dts[1])-1,dts[0]));}}});$("#subscribe_dialog").dialog({autoOpen:false,width:370,modal:true,resizable:false,position:[document.body.clientWidth/3,250]});$("#event_subscribe_bk").live("click",function(){$("#subscribe_dialog").dialog('open');});$("#subscribe_date").datepicker({autoOpen:false,dateFormat:'dd.mm.yy',showOn:'button',buttonImage:'http://static.weburg.ru/img/css//jquery/calendar.gif',buttonImageOnly:true,altField:'#actualDate',showOn:'both',firstDay:1,monthNames:['Январь','Февраль','Март','Апрель','Май','Июнь','Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'],monthNamesShort:['Янв','Фев','Мар','Апр','Май','Июн','Июл','Авг','Сен','Окт','Ноя','Дек'],dayNames:['Воскресенье','Понедельник','Вторник','Среда','Четверг','Пятница','Суббота'],dayNamesMin:['Вс','Пн','Вт','Ср','Чт','Пт','Сб'],prevText:'Пред.',nextText:'След.',closeText:'Закрыть',currentText:'Сегодня',changeMonth:true,changeYear:true,minDate:'+0d',maxDate:'+'+maxDate+'d',beforeShow:pickFirst,beforeShowDay:leaveSomeDays,onSelect:synchDateAndTime});function pickFirst(input){var dts=dates[0].split('.');var dt=new Date(dts[2],parseInt(dts[1])-1,dts[0])
$(input).val((dt.getDate()<10?'0':'')+dt.getDate()+'.'
+((dt.getMonth()<10)?'0':'')+(dt.getMonth()+1)+'.'
+dt.getFullYear());}
function leaveSomeDays(date){var dt=date.getDate()+'.'+(parseInt(date.getMonth())+1)+'.'+date.getFullYear();if($.inArray(dt,dates)==-1){return[false,''];}
return[true,''];}
function synchDateAndTime(){var sval=$("input#subscribe_date").attr("value");var avail=new Array;$("#subscribe_time option.synch").each(function(){if($(this).attr("fordate")!=sval){$(this).hide();}
else{$(this).show();avail.push($(this));}});if(avail.length>0){avail[0].attr("selected","selected");}}
$("#subscribe_for").live("click",function(){if(parseInt($("#subscribe_before_val").val())!=$("#subscribe_before_val").val()){alertDialog(320,170,"Укажите кол-во "+$("select#subscribe_before_unit option:selected").html()+" числом");return;}
var stype=$(this).attr("stype");var object=$(this).attr("sobject");var ssection=$(this).attr("ssection");var ssubject=$(this).attr("ssubject");var wait=parseInt($("select#subscribe_before_unit option:selected").val())*parseInt($("#subscribe_before_val").val());var dts=$("#subscribe_date").val().split('.');var senddate=new Date(dts[2],parseInt(dts[1])-1,dts[0]);var sendtime=senddate.getTime()/1000+
parseInt($("select#subscribe_time option:selected").val())-
wait;$.ajax({url:'/ajax/subscribe-push/'+stype+'/'+ssection+'/'+object+'/'+sendtime+'/'+wait+'?name='+ssubject,success:function(){alertDialog(320,170,"Информация сохранена. Напоминание придет вовремя!");$("#subscribe_dialog").dialog('close');}});});var afishaContent=$('#afisha_content').get(0);if(!$('.schedule.schedule_main .event',afishaContent).length){$('.date.schedule_main',afishaContent).html('');$('.additional_info.schedule_main',afishaContent).html('');};if(!$('.schedule.schedule_other .event',afishaContent).length){$('.additional_info.schedule_other',afishaContent).html('');$('.date.schedule_other',afishaContent).hide();}else{$('.date.schedule_other',afishaContent).hide();}
$('.filtering .show_hidden_tags',afishaContent).toggle(function(){$('.filtering .filter_hidden_tags',afishaContent).show();$(this).children('.arrow').html('&#x25B2;');},function(){$('.filtering .filter_hidden_tags',afishaContent).hide();$(this).children('.arrow').html('&#x25BC;');});var defaultDateHtml=$('.date.schedule_main',afishaContent).html();$('.filtering .event_tag_label',afishaContent).click(function(){$('.filter_loader',afishaContent).show();var parent=$(this).parent();var checkbox=$(this).siblings('.event_tag_check');var tag=checkbox.val();var filterTags=$('.filtering .filter_tags',afishaContent);var filterHiddenTags=$('.filtering .filter_hidden_tags',afishaContent);if(tag=='tag_3d'){if(!parent.hasClass('checked_tag')){$('.schedule .event .event_schedule .timetable',afishaContent).css('color','#b6b6b6');}else{$('.schedule .event .event_schedule .timetable',afishaContent).css('color','');}}else{$('.schedule .event .event_schedule .timetable',afishaContent).css('color','');}
if(tag=='tag_afisha'){if(!parent.hasClass('checked_tag')){$('.filtering .event_tag',afishaContent).removeClass('checked_tag');parent.addClass('checked_tag');$('.date.schedule_main',afishaContent).html('Кинофильмы');$('.afisha_schedule').insertBefore($('.date.schedule_main',afishaContent));}else{parent.removeClass('checked_tag');$('.date.schedule_main',afishaContent).html(defaultDateHtml);$('.afisha_schedule').insertAfter($('.schedule.schedule_other',afishaContent));}
$('.filter_loader',afishaContent).hide();return true;}
$('.additional_info.schedule_main',afishaContent).html('');$('.additional_info.schedule_other',afishaContent).html('');if(!parent.hasClass('checked_tag')){$('.filtering .event_tag',afishaContent).removeClass('checked_tag');parent.addClass('checked_tag');$('#event_main_0',afishaContent).prependTo('.schedule.schedule_main',afishaContent);var num=1;var exists=$('#event_main_'+num,afishaContent).length;while(exists){$('#event_main_'+num,afishaContent).insertAfter('#event_main_'+(num-1),afishaContent);num++;var exists=$('#event_main_'+num,afishaContent).length;}
$('#event_other_0',afishaContent).prependTo('.schedule.schedule_other',afishaContent);var num=1;var exists=$('#event_other_'+num,afishaContent).length;while(exists){$('#event_other_'+num,afishaContent).insertAfter('#event_other_'+(num-1),afishaContent);num++;var exists=$('#event_other_'+num,afishaContent).length;}
$('.schedule .event:not(.event_not_filter)',afishaContent).each(function(){if($(this).hasClass(tag)){$(this).appendTo('.schedule.schedule_main',afishaContent);}else{$(this).appendTo('.schedule.schedule_other',afishaContent);}});$('.date.schedule_main',afishaContent).html($(this).html());if(!$('.schedule.schedule_other .event',afishaContent).length){$('.additional_info.schedule_other',afishaContent).html('');$('.date.schedule_other',afishaContent).hide();};$('.date.schedule_main',afishaContent).html($(this).html());if(!$('.schedule.schedule_other .event',afishaContent).length){$('.additional_info.schedule_other',afishaContent).html('');$('.date.schedule_other',afishaContent).hide();}else{$('.date.schedule_other',afishaContent).show();}
if(parent.parent().hasClass('filter_hidden_tags')){filterTags.children(':last').prependTo(filterHiddenTags);}
parent.prependTo(filterTags);}else{parent.removeClass('checked_tag');$('.date.schedule_main',afishaContent).html(defaultDateHtml);$('#event_main_0',afishaContent).prependTo('.schedule.schedule_main',afishaContent);var num=1;var exists=$('#event_main_'+num,afishaContent).length;while(exists){$('#event_main_'+num,afishaContent).insertAfter('#event_main_'+(num-1),afishaContent);num++;var exists=$('#event_main_'+num,afishaContent).length;}
$('#event_other_0',afishaContent).prependTo('.schedule.schedule_other',afishaContent);var num=1;var exists=$('#event_other_'+num,afishaContent).length;while(exists){$('#event_other_'+num,afishaContent).insertAfter('#event_other_'+(num-1),afishaContent);num++;var exists=$('#event_other_'+num,afishaContent).length;}
$('.date.schedule_other',afishaContent).hide();}
if(!$('.schedule.schedule_main .event',afishaContent).length){$('.date.schedule_main',afishaContent).html('');$('.additional_info.schedule_main',afishaContent).html('');};$('.filter_loader',afishaContent).hide();});if($('.filtering .checked_tag',afishaContent).length){$('.filter_loader',afishaContent).show();$('.additional_info.schedule_main',afishaContent).html('');$('.additional_info.schedule_other',afishaContent).html('');var parent=$('.filtering .checked_tag:first',afishaContent);var label=parent.children('.event_tag_label');var checkbox=parent.children('.event_tag_check');var tag=checkbox.val();$('.filtering .event_tag',afishaContent).removeClass('checked_tag');parent.addClass('checked_tag');$('.schedule .event',afishaContent).each(function(){if($(this).hasClass(tag)){$(this).appendTo('.schedule.schedule_main',afishaContent);}else{$(this).appendTo('.schedule.schedule_other',afishaContent);}});$('.date.schedule_main',afishaContent).html(label.html());$('.filter_loader',afishaContent).hide();}
$('.schedule span.event_tag',afishaContent).click(function(){var tag_id=$(this).attr('tag_id');$('.filtering .event_tag_label[for="filter_tag_'+tag_id+'"]',afishaContent).click();document.location.hash='afisha_content';});$('.object_info .toggle_description',afishaContent).click(function(){$('.object_info .review',afishaContent).toggle();$('.object_info .description',afishaContent).toggle();$(this).children('.arrow').toggleClass('arrow_down').toggleClass('arrow_up');if($(this).children('.arrow').hasClass('arrow_down')){$(this).children('.text').html('подробнее').attr('title','посмотреть подробную информацию');}else{$(this).children('.text').html('скрыть подробности').attr('title','скрыть подробную информацию');}});$('.place_info .toggle_description',afishaContent).one('click',function(){var place_id=$('.place_info',afishaContent).attr('id').match(/place_(\d+)/i)[1];if(place_id){$.ajax({url:'/places/'+place_id+'/get_way',success:function(data,textStatus){if(data!='error'&&data){$('.place_info .description',afishaContent).append(data);}}});}});$('.object_block .text_title',afishaContent).click(function(){$(this).closest('.object_block').toggleClass('object_block_hidden');});$('.object_block .trailers .show_trailer',afishaContent).click(function(){var trailer_player=$(this).closest('.trailers').find('#'+$(this).attr('id')+'_player');if(trailer_player.is(':visible')){$(this).html('Посмотреть &darr;');}else{$(this).html('Посмотреть &uarr;');}
trailer_player.toggle();});if($('#comments_block .comments_cnt').length){$('.comments_count .comments_count_link',afishaContent).html('Комментариев: '+$('#comments_block .comments_cnt').html());}else{$('.comments_count .comments_count_link',afishaContent).html('Комментариев: 0');}
$('.comments_count .comments_count_link',afishaContent).click(function(){$('#object_block_comments').removeClass('object_block_hidden');});$('.object_block .trailers .show_trailer:first',afishaContent).click();});
/* site/recomend.js */
var _formattedItem=function(row){return row['name'];}
$(function(){$("#nm_dialog").dialog({autoOpen:false,bgiframe:true,height:350,width:470,modal:true,resizable:true,zIndex:10000});function addMess(){if($("#content_message").attr("value")==""){alertDialog(320,170,"Сообщение не может быть пустым!");}
else{if($("#theme").attr("value").length<255){$.ajax({url:'/users/messages/new-message',type:"get",data:$("#nm_form").serialize(),beforeSend:function(){$("#nm_form").css("cursor","wait");$("#send_message").closest('td').append('<img src="http://static.weburg.ru/img/js//preload.gif" width="70" height="10" alt="идет отправка…" id="sending"/>');$("#send_message").hide();},success:function(data,textStatus){$("#sending").remove();$("#send_message").show();$("#nm_form").css("cursor","default");$("#nm_form").hide();$("#nm_done").html(data);$("#nm_done").show();setTimeout(function(){$("#nm_dialog").dialog('close');},5000);}});}
else{alertDialog(320,170,"Заголовок сообщения не должен превышать 250 символов");$("#theme").attr("value","");}}}
$("#send_message").live("click",function(){addMess();});$(".recomend_link").live("click",function(){$("#nm_done").hide();$("#user_group").hide();$("#user_name").val('');$("#nm_form").show();$("#nm_dialog").dialog('open');});$("#user_name").autocomplete('/ajax/autocomplete/messages/'+$("#user_name").attr("id"),{formatItem:_formattedItem,max:0,multiple:true,minChars:3,parse:function(data){var hash=json_parse(data);var parsed=new Array();for(key in hash){parsed.push({data:hash[key],value:hash[key]['name'],result:hash[key]['name']});}
return parsed;}}).result(function(event,data,formatted){$("#user_id").val($("#user_id").val()+data['id']+',');});$(".pick_from_ugroups").live("click",function(){$("#user_group").show();});});
/* site/socialization_panel.js */
$(function(){var width=620;var height=450;var left=(screen.width-width)/2;var top=(screen.height-height)/3;var url=this._base_domain+'share.php';var popupParams='scrollbars=1, resizable=1, menubar=0, left='+left+', top='+top+', width='+width+', height='+height+', toolbar=0, status=0';$(".socnet_url").click(function(){window.open($(this).attr('href'),'Weburg.ru | '+$(this).attr('title'),popupParams);return false;});});
