/*
    Javascript Library for Litaratura.org
    Copyright (c) 2009 by Aleksander Maksymiuk, http://setpro.net.pl/
*/
$(document).ready(function(){$('.colleft img.thumb').fadeTo(100,0.7);$('.colleft img.thumb').mouseover(function(){$(this).fadeTo(300,1.0)});$('.colleft img.thumb').mouseout(function(){$(this).fadeTo(200,0.7)});$('.colright img.thumb').fadeTo(100,0.5);$('.colright img.thumb').mouseover(function(){$(this).fadeTo(300,0.9)});$('.colright img.thumb').mouseout(function(){$(this).fadeTo(200,0.5)});var fnPrefix='[',fnPostfix=']',fnIndex=0;$('.footnote').each(function(){fnIndex++;$(this).before('<span class="fnref">'+fnPrefix+fnIndex+fnPostfix+'</span>');$(this).attr({id:'fntxt'+fnIndex})});$('#footnote').fadeOut(100);$('.fnref').mouseover(function(event){$('#footnote .content').html($('#fntxt'+$(this).html().replace(fnPrefix,'').replace(fnPostfix,'')).html());var fnwidth=$('#footnote').width();var fnheight=$('#footnote').height();if($('body').height()-event.pageY-10<fnheight){$('#footnote').css('left',event.pageX-80);$('#footnote').css('top',event.pageY-fnheight-10)}else{$('#footnote').css('left',event.pageX-80);$('#footnote').css('top',event.pageY+10)}$('#footnote').fadeIn(400)});$('.fnref').mouseout(function(){$('#footnote').fadeOut(300)});$('#printout').click(function(){$('#printport .txtstream').html($('#viewport .txtstream').html());var footnotes='';$('#printport .footnote').each(function(){var fntxt=$(this).html();$(this).html('');var fnid=$(this).attr('id');footnotes=footnotes+'<p>'+'['+fnid.replace('fntxt','')+'] '+fntxt+'</p>'});$('#printport .footnote').remove();$('#printport .txtstream').html($('#printport .txtstream').html()+(footnotes?'<div class="footnotes">'+footnotes+'</div>':''));var body=$('#printport').html();var title=$('#thistitle').text();var author=$('#thisauthor').text();var translator=$('#thistranslator').text();var handle=window.open('','');handle.document.open();handle.document.write('<html>'+'<head>'+'<title>'+title+' - для друку - Літаратура.org</title>'+'<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />'+'<meta name="author" content="'+(translator?translator:(author?author:'Літаратура.org'))+'" />'+'<meta name="copyright" content="'+(translator?translator+' - ':(author?author+' - ':''))+'Літаратура.org'+'" />'+'<link rel="stylesheet" type="text/css" href="/assets/css/reset.css" media="all" />'+'<link rel="stylesheet" type="text/css" href="/assets/css/print.css" media="all" />'+'</head>'+'<body>'+'<div id="mc">'+body+'</div>'+'</body>'+'</html>');handle.document.close()});$('#printout').mouseover(function(){$(this).addClass('hover')});$('#printout').mouseout(function(){$(this).removeClass('hover')});$('#addform').css('display','none');$('#addform input.submit').mouseover(function(){$(this).addClass('hover')});$('#addform input.submit').mouseout(function(){$(this).removeClass('hover')});$('#addcomment').click(function(){if($('#addform').css('display')=='none'){$('#addform').slideDown(400);$(this).attr('title','Схаваць кантактную форму...');$(this).after('<span id="rules"> — <a href="/nashy-pravily">Нашы правілы</a></span>');$('#addform').prepend('<input type="hidden" id="cfCaptcha" name="user_validate" value="Yes, I am a human" />');$("#addform input.author").focus()}else{$('#addform').slideUp(400);$(this).attr('title','Раскрыць кантактную форму...');$('#rules').remove();$('#cfCaptcha').remove()}});$('#addcomment').mouseover(function(){$(this).addClass('hover')});$('#addcomment').mouseout(function(){$(this).removeClass('hover')});$('a.media_photo_main').colorbox();$('a[rel="media_photo"]').colorbox();$('a[rel="media_photo_gallery"]').colorbox({slideshow:true});$('a[rel="media_sound"]').colorbox();$('a[rel="media_video"]').colorbox();$('a[rel="media_youtube"]').colorbox({iframe:true,width:603,height:510});$('a[rel="media_outsite"]').colorbox({iframe:true,width:'90%',height:'80%'});$('a.outsite').colorbox({iframe:true,width:'90%',height:'80%'});var txtStreamHeight=$('#viewport .txtstream').height();var txtStreamOffset=0;var advBy=432;var totalPages=Math.ceil(txtStreamHeight/advBy);var curPage=(txtStreamOffset/advBy)+1;$('#viewport .txtstream').css('top',txtStreamOffset);$('#curpage').text(curPage);$('#totalpages').text(totalPages);$('#first').click(function(){if(curPage>1){txtStreamOffset=0;curPage=(Math.abs(txtStreamOffset)/advBy)+1;$('#viewport .txtstream').hide(400);$('#viewport .txtstream').css('top',txtStreamOffset);$('#curpage').text(curPage);$('#viewport .txtstream').show(400)}});$('#first').mouseover(function(){$(this).addClass('hover')});$('#first').mouseout(function(){$(this).removeClass('hover')});$('#prev').click(function(){txtStreamOffset=txtStreamOffset+advBy;curPage=(Math.abs(txtStreamOffset)/advBy)+1;if(txtStreamOffset>0){txtStreamOffset=0;curPage=(Math.abs(txtStreamOffset)/advBy)+1}else{$('#viewport .txtstream').hide(400);$('#viewport .txtstream').css('top',txtStreamOffset);$('#curpage').text(curPage);$('#viewport .txtstream').show(400)}});$('#prev').mouseover(function(){$(this).addClass('hover')});$('#prev').mouseout(function(){$(this).removeClass('hover')});$('#next').click(function(){txtStreamOffset=txtStreamOffset-advBy;curPage=(Math.abs(txtStreamOffset)/advBy)+1;if((curPage-1)*advBy>=txtStreamHeight){txtStreamOffset=-(txtStreamHeight-txtStreamHeight%advBy-(txtStreamHeight%advBy?0:advBy));curPage=(Math.abs(txtStreamOffset)/advBy)+1}else{$('#viewport .txtstream').hide(400);$('#viewport .txtstream').css('top',txtStreamOffset);$('#curpage').text(curPage);$('#viewport .txtstream').show(400)}});$('#next').mouseover(function(){$(this).addClass('hover')});$('#next').mouseout(function(){$(this).removeClass('hover')});$('#last').click(function(){if(curPage<totalPages){txtStreamOffset=-(txtStreamHeight-txtStreamHeight%advBy-(txtStreamHeight%advBy?0:advBy));curPage=(Math.abs(txtStreamOffset)/advBy)+1;$('#viewport .txtstream').hide(400);$('#viewport .txtstream').css('top',txtStreamOffset);$('#curpage').text(curPage);$('#viewport .txtstream').show(400)}});$('#last').mouseover(function(){$(this).addClass('hover')});$('#last').mouseout(function(){$(this).removeClass('hover')});$('.defuscate').each(function(){$(this).attr('href',$(this).attr('href').replace('....','mailto:'));$(this).attr('href',$(this).attr('href').replace('...','@'));$(this).attr('href',$(this).attr('href').replace('/','.'));$(this).text($(this).text().replace('...','@'));$(this).text($(this).text().replace('/','.'))})});function makeLiActive(liObj){var re=/litaratura-menu-li-bg-active.png/;if(liObj.currentStyle&&!re.test(liObj.currentStyle.backgroundImage)){liObj.style.zIndex=13;liObj.style.background='url(\'/assets/images/design/litaratura-menu-li-bg-active.png\') no-repeat scroll left top'}};function killLiActive(liObj){if(liObj.currentStyle&&(liObj.style.zIndex==13)){liObj.style.zIndex=0;liObj.style.background='url(\'/assets/images/design/litaratura-menu-li-bg.png\') no-repeat scroll left top'}};
