$(function(){var t3;$("#header_title .login_with a").hover(function(){t=clearTimeout(t3);if($(this).hasClass("login_with_facebook")){$("#header_title .login_with_facebook").css({"background-position":"0 -23px"});}else{$("#header_title .login_with_facebook").css({"background-position":"0 0"});}},function(){t3=setTimeout(function(){$("#header_title .login_with_facebook").css({"background-position":"0 -23px"});},3000);});$("#carousel").jCarouselLite({btnNext:".next",btnPrev:".prev",mouseWheel:true,circular:false});$("#datepicker").datepicker({showOn:"button",buttonImage:"/public_files/images/calendar_icon.png",buttonImageOnly:true,buttonText:'Поиск новости по дате',maxDate:"0",onSelect:function(dateText,inst){if(dateText!=""){var dateArr=[];dateArr=dateText.split('.');var href='/search/date/day/'+dateArr[0]+'/month/'+dateArr[1]+'/year/'+dateArr[2];window.open(href,"_top");}}});$("#datepicker").datepicker($.datepicker.regional["ru"]);$("#ui-datepicker-div").css("z-index","10");$("#tabs").tabs({cookie:{expires:1}});var t;$('#newspaper_blocks .block_briefly').click(function(){t=clearTimeout(t);$curDiv=$(this).next('.block_full');$curH3=$(this);$otherBlocks=$('#newspaper_blocks .block_full').not($curDiv);$otherBlocks.hide();$('#newspaper_blocks .block_briefly').show();$curH3.hide();$curDiv.removeClass('hidden');$curDiv.show();$curDiv.find('.rubric').show();$curDiv.find('.name').show();});$('#newspaper_blocks').mouseleave(function(){t=clearTimeout(t);t=setTimeout(function(){$otherBlocks=$('#newspaper_blocks .block_full');$otherBlocks.hide();$otherBlocks.find('.rubric').hide();$otherBlocks.find('.name').hide();$('#newspaper_blocks .block_briefly').show();},5000);});$('#newspaper_blocks').mouseenter(function(){t=clearTimeout(t);});$(".brief_information_inner").mouseenter(function(){$(".tooltip_wrapper").fadeIn();});$(".brief_information_inner").mouseleave(function(){$(".tooltip_wrapper").delay(1000).fadeOut();});$(".login_with a").mouseenter(function(e){var pos=$(this).position();$(".tooltip").text($(this).attr("alt")).css({"left":pos.left+16,"top":pos.top+22});$(".tooltip").show();});$(".login_with a").mouseleave(function(){$(".tooltip").hide();});$(".title_wrap .inf td,.title_wrap .name td").click(function(){var href=$(this).attr("data-href");window.open(href,"_top");});$(".tv_saratov .preview").mouseenter(function(){if($(this).hasClass("act")){$(this).attr("title","кликните, чтобы перейти к сюжету");}else{$(this).attr("title","кликните для предпросмотра");}});$(".tv_saratov .preview").click(function(){if($(this).hasClass("act")){return true;}else{$(".tv_saratov .preview").removeClass("act");$(this).addClass("act");currentId=$(this).attr("data-current-id");$(".tv-rubric_container").hide();$("#tv-rubric_container_"+currentId).show();$(".tv_saratov .to-parent").show();return false;}});$(".tv_saratov .to-parent").click(function(){parentId=$(this).attr("data-parent-id");$(".tv-rubric_container").hide();$("#tv-rubric_container_"+parentId).show();$(this).hide();});$(".tab").click(showSocialBlock);});function changeTitleNewsPic(pos){$("#pictures a").css("display","none");$("#title_pic_"+pos).css("display","block");$("#pictures").css("background-position","0 -"+pos*97+"px");}
function changeColor(e){var col=$(e).find("div").css("background-color");var id=$(e).find("div").attr("id");$(".container").removeClass('act_container');$(e).addClass('act_container');console.log(id);switch(id){case"col1":var css='';break;case"col2":var css='<link type="text/css" rel="stylesheet" href="/library/minify_2.1.3/f=public_files/styles/color_scheme_pink.css" class="color_scheme" id="color_scheme_pink" />';break;}
$('.color_scheme').remove();$.cookie("color_scheme",id,{expires:1000,path:"/"});$('body').prepend(css);}
function rubricOver(parentId,currentId){$("#rubric_container_"+parentId).hide();$("#rubric_container_"+currentId).show();}
function rubricOut(parentId,currentId){$("#rubric_container_"+currentId).hide();$("#rubric_container_"+parentId).show();}
function blogClick(e){href=$(e).attr("href");window.location.href=href;}
function fulltime(countdownId,direction,deadline){var time=new Date();var newYear=new Date(deadline+",00:00:00");if(direction==1){var totalRemains=newYear.getTime()-time.getTime();}else{var totalRemains=time.getTime()-newYear.getTime();}
if(totalRemains>1){var RemainsSec=(parseInt(totalRemains/1000));var RemainsFullDays=(parseInt(RemainsSec/(24*60*60)));var secInLastDay=RemainsSec-RemainsFullDays*24*3600;var RemainsFullHours=(parseInt(secInLastDay/3600));if(RemainsFullHours<10){RemainsFullHours="0"+RemainsFullHours;};var secInLastHour=secInLastDay-RemainsFullHours*3600;var RemainsMinutes=(parseInt(secInLastHour/60));if(RemainsMinutes<10){RemainsMinutes="0"+RemainsMinutes;};var lastSec=secInLastHour-RemainsMinutes*60;if(lastSec<10){lastSec="0"+lastSec;};document.getElementById("RemainsFullDays"+countdownId).innerHTML=RemainsFullDays;document.getElementById("RemainsFullHours"+countdownId).innerHTML=RemainsFullHours;document.getElementById("RemainsMinutes"+countdownId).innerHTML=RemainsMinutes;document.getElementById("lastSec"+countdownId).innerHTML=lastSec;setTimeout('fulltime('+countdownId+','+direction+',"'+deadline+'")',10);}
else{document.getElementById("clock").innerHTML="{HEADER}";}}
function showSocialBlock(){if(!($(this).hasClass('act'))){var n=$(this).attr("data-n");$('.tab').not(this).removeClass('act');$(this).addClass('act');$('.tab').unbind();$(".social_block").not(":eq("+n+")").fadeOut(function(){$(".social_block").eq(n).delay(200).fadeIn(function(){$('.tab').bind("click",showSocialBlock);});});}}
$(function(){$(window).resize(setDimensions);$(".close-x").live("click",function(){$(this).closest(".window-body").remove();$(".window-wrapper").remove();});function getBodyScrollTop(){return self.pageYOffset||(document.documentElement&&document.documentElement.scrollTop)||(document.body&&document.body.scrollTop);}
function openWindow(mistake){var width=$("body").outerWidth();var height=$("body").outerHeight();$("body").append('<div class="window-wrapper" style="width:'+width+'px;height:'+height+'px;"></div>');var winWidth=500;var winHeight=300;var winTop=(($(window).height()-winHeight)/2)+getBodyScrollTop();var winLeft=(width-winWidth)/2;$.post('http://'+window.location.host+'/mistake/select/',{"mistake":mistake,"url":window.location.href},function(data){$("body").append('<div class="window-body" style="top:'+winTop+'px;left:'+winLeft+'px;width:'+winWidth+'px;height:'+winHeight+'px;"><div class="close-x" title="Закрыть"></div><div class="content">'+data+'</div></div>');});}
$(".submit-mistake-but").live("click",function(){var form=$(this).closest("form").serialize();$.post('http://nversia.ru/mistake/select/',form+"&type=send",function(data){$(".window-body .content").html(data);});})
function getText(e){if(!e)e=window.event;if((e.ctrlKey)&&((e.keyCode==10)||(e.keyCode==13))){if(navigator.appName=='Microsoft Internet Explorer'){if(document.selection.createRange()){var range=document.selection.createRange();mis=range.text;openWindow(mis);}}else{if(window.getSelection()){mis=window.getSelection().toString();openWindow(mis);}else if(document.getSelection()){mis=document.getSelection().toString();openWindow(mis);}}}}
function setDimensions(){var width=$("body").outerWidth();var height=$("body").outerHeight();$(".window-wrapper").width(width).height(height);}
document.onkeypress=getText;});
