// Layer
function error(message) { var error=window.parent.document.getElementById('error');  error.style.display='block';  error.innerHTML=message; setTimeout(errorClose, 5000); } function errorClose() { var error=window.parent.document.getElementById('error'); error.style.display='none'; error.innerHTML=''; }
function bg() {
var bg=window.parent.document.getElementById('bg'); 
bg.style.width=document.body.clientWidth+'px'; 
bg.style.height=document.body.clientHeight+'px'; 
bg.style.display='block';
   
   if(!!window.parent.document.getElementById('flashbanner')) { window.parent.document.getElementById('flashbanner').style.display='none'; }
    }
	
function bgClose() { 
var bg=window.parent.document.getElementById('bg'); 
bg.style.display='none'; 
if(!!window.parent.document.getElementById('flashbanner')) { window.parent.document.getElementById('flashbanner').style.display='block'; }
}

function bar(message) { var bar=window.parent.document.getElementById('bar');  if (message==null) { bar.innerHTML='<div class="bar_status">Загрузка...</div>'; } else  { bar.innerHTML='<div class="bar_status">'+message+'</div>'; bar.style.display='block'; } }
function barClose( ) { var bar=window.parent.document.getElementById('bar'); bar.innerHTML=''; bar.style.display='none';}
function popup (){var popup=window.parent.document.getElementById('popup'); var scrollTop=self.pageYOffset || (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop); var top=scrollTop-100+(screen.height-300)/2; popup.style.top =top+'px'; popup.style.display='block';}
function popupClose (){ var popup=window.parent.document.getElementById('popup'); popup.style.display='none'; popup.innerHTML=''; }
function closePopup() { popupClose(); bgClose(); }

window.onscroll = function () { var scrollTop=self.pageYOffset || (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop);
var button=window.parent.document.getElementById('button'); if (scrollTop>2000) { button.style.display='block'; } else { button.style.display='none'; }
}

function treiler(id) { 
 window.history.pushState(null, null, 'http://tlt.izjum.ru/trailer'+id);
 counter();
bg(); popup(); window.parent.document.getElementById('popup').innerHTML='<div class="z"><p align="right"><a onclick="trailerClose(\''+id+'\')">Закрыть</a></p><object  type="application/x-shockwave-flash" data="/player/uflvplayer_500x375.swf" height="338" width="600"><param name="bgcolor" value="#000000" /><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="movie" value="/player/uflvplayer_500x375.swf" /><param name="FlashVars" value="way=http://tlt.izjum.ru/video/'+id+'.flv&amp;swf=/player/uflvplayer_500x375.swf&amp;w=600&amp;h=338&amp;autoplay=1&amp;tools=2&amp;skin=none&amp;volume=70&amp;q=1&amp;" /></object><p><a onclick="z_comment()">Комментарии</a></p></div><br /><div  class="z_comment" id="z_comment"><div class="comment" id="vk_comments"></div></div>'; vk_comments(); }

function trailerClose(id) {
closePopup();
 window.history.pushState(null, null, 'http://tlt.izjum.ru/film'+id);
}


function z_comment() {
var display=window.parent.document.getElementById('z_comment').style.display
if (display=="none") { window.parent.document.getElementById('z_comment').style.display='inline-block'; }
else { window.parent.document.getElementById('z_comment').style.display='none'; }
}




function showPhoto(id) { 
bg(); 
bar('Загрузка фотографии');
var loader = getXmlHttp()  
loader.open('POST', 'http://tlt.izjum.ru/class/class_photo.php?id='+id, true);
loader.onreadystatechange = function() {
if (loader.readyState == 4) {
if (loader.status == 200) {
var ph=loader.responseText.split('-');
numberPhoto=ph[0]; numberPhoto=numberPhoto-0;
ArrayPhoto = ph[1].split(',');
allPhoto=ArrayPhoto.length; allPhoto=allPhoto-1;
urlAlbum=window.location.href;
window.history.pushState(null, null, 'http://tlt.izjum.ru/photo'+id);
counter();

var popup=window.parent.document.getElementById('popup'); 
var scrollTop=self.pageYOffset || (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop); 
var scrollTop=scrollTop+20;
popup.style.top =scrollTop+'px'; popup.style.display='block';


 window.parent.document.getElementById('popup').innerHTML='<div class="z_photo"><p align="left"><a style="float: right;" onclick="photoClose(\''+id+'\')">Закрыть</a><span id="summary">Фотография '+numberPhoto+' из '+allPhoto+'</span></p><p align="center"><a style="float: left; padding: 260px 0px 260px 0px;" onclick="return backPhoto();"><img src="/images/left.gif" width="32" height="32" /></a><a onclick="return nextPhoto();"><img  id="gt" onload="barClose();"src="/images/photo/'+id+'.jpg" /></a></p><p><a onclick="z_comment()">Комментарии</a></p></div><br /><div  class="z_comment2" id="z_comment"><div  class="comment" id="vk_like2"></div><div class="comment" id="vk_comments"></div></div>'; vk_comments();   vk_like2(window.document.title);





}}}																	
loader.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); loader.setRequestHeader("x-requested-with", "XMLHttpRequest");				
loader.send(null);





  return false;
}

function photoClose(id) {
barClose();
closePopup();
if (urlAlbum==window.location.href)  { urlAlbum='http://tlt.izjum.ru/event'+id.match(/[0-9]+/i)[0];  }
window.history.pushState(null, null, urlAlbum); 
counter();
}


function nextPhoto() {
if(!!window.parent.document.getElementById('vk_comments')) { window.parent.document.getElementById('vk_comments').innerHTML=''; }
if(!!window.parent.document.getElementById('vk_like2')) { window.parent.document.getElementById('vk_like2').innerHTML=''; }
bar('Загрузка следующей фотографии');
numberPhoto=numberPhoto+1;
if (numberPhoto>allPhoto) {numberPhoto=1; }

var photo=ArrayPhoto[numberPhoto];
window.parent.document.getElementById('gt').src='/images/photo/'+photo+'.jpg';

window.parent.document.getElementById('summary').innerHTML='Фотография '+numberPhoto+' из '+allPhoto;

window.history.pushState(null, null, 'http://tlt.izjum.ru/photo'+photo);
counter();
vk_comments();
vk_like2(window.document.title);
return false;
}

function backPhoto() {
if(!!window.parent.document.getElementById('vk_comments')) { window.parent.document.getElementById('vk_comments').innerHTML=''; }
if(!!window.parent.document.getElementById('vk_like2')) { window.parent.document.getElementById('vk_like2').innerHTML=''; }

bar('Загрузка предыдущей фотографии');
numberPhoto=numberPhoto-1;
if (numberPhoto<1) {numberPhoto=allPhoto; }

var photo=ArrayPhoto[numberPhoto];
window.parent.document.getElementById('gt').src='/images/photo/'+photo+'.jpg';

window.parent.document.getElementById('summary').innerHTML='Фотография '+numberPhoto+' из '+allPhoto;

window.history.pushState(null, null, 'http://tlt.izjum.ru/photo'+photo);
counter();
vk_comments();
vk_like2(window.document.title);
return false;
}



