var pathWeb='';var pathWebImg='';$(document).ready(function(){$(window).keydown(function(event){switch(event.keyCode){case 37:$('#videoViewPrevImage').click();break;case 39:$('#videoViewNextImage').click();break;default:break;}
return true;});regexp=new RegExp("^#video(\\d+)$");if(regexp.test(document.location.hash)){videoId=document.location.hash.replace(regexp,"$1");var url=(pathWeb+'instituteCardVideoView/video/'+videoId);liteWindow(url,{title:'',width:'600px',onLoad:onLoadViewVideo,onClose:function(){document.location.hash='#c'}},videoViewDecorator);}});function viewVideo(link)
{var url=$(link).attr('href'),hashRegexp=new RegExp("^.*(#[^#]*)$"),regexp=new RegExp("#video(\\d+)$");url=url.replace(hashRegexp,'$1');if(regexp.test(url)){videoId=url.replace(regexp,"$1");var url=(pathWeb+'instituteCardVideoView/video/'+videoId);liteWindow(url,{title:'',width:'600px',onLoad:onLoadViewVideo,onClose:function(){document.location.hash='#c'}},videoViewDecorator);}
return false;}
function switchVideo(link)
{if(win.isDisabled()==false){win.disable();link=$(link);var imgId=link.attr('imgId');var url=(pathWeb+'instituteCardVideoView/video/'+imgId);$('#moveVideoLink').val('instituteVideoLi'+imgId);$('#moveVideoLink').click();$('#viewVideoForm').attr('action',url);if($.browser.msie){$('#window-container').hide();win.loadData({url:url,data:null,type:'GET'});}else{$('#window-container').fadeOut(500,function(){win.loadData({url:url,data:null,type:'GET'});})}}
return false;}
function doVideoVote(link)
{link=$(link);url=link.attr('href');var container=$('#instituteCardVideoContainer');container.load(url+' #instituteCardVideoContainer > *',null,function(){onLoadViewVideo();});return false;}
function onLoadViewVideo()
{$('#window-container').width('');$('#window-container').css('top','5%');var voteWidth=$('#window-container .current').css('width');var curId=$('#window-container ._currentVideo').val();updateAnchorByVideo(curId);$('._videoLink').val(document.location);$('#instituteVideoLi'+curId+' .current').animate({width:voteWidth},1000);$('#window-container ._videosCount').text($('#instituteVideosBlock ._videosCount').text());curLi=$('#instituteVideoLi'+curId);if(curLi.prev().length==0){$('#videoViewPrevImage').addClass('disabled');}
if(curLi.next().length==0){$('#videoViewNextImage').addClass('disabled');}
var prev=curLi,num=1;while((prev=prev.prev())&&prev.length>0){num++;}
$('#window-container ._videoPosition').text(num);if($.browser.msie){$('#window-container').show();}else{$('#window-container').fadeIn(500);}}
function updateAnchorByVideo(videoId)
{document.location.hash='#video'+videoId;return;}
function switchPrevVideo(current)
{var current=$('#'+current);var prevLi=current.parents('li').prev();var prevLink=prevLi.children('div').children('div').children('._videoLink');if(prevLink.length==0)
return false;return switchVideo(prevLink);}
function switchNextVideo(current)
{var current=$('#'+current);var nextLi=current.parents('li').next();var nextLink=nextLi.children('div').children('div').children('._videoLink');if(nextLink.length==0)
return false;return switchVideo(nextLink);}
function videoViewDecorator(){var html='<table class="videoplayer" cellpadding="0" cellspacing="0">'+'<tr>'+'<td class="top"><div class="left_top"><div class="right_top"><a href="#" class="modalCloseX modalClose"><img src="'+pathWebImg+'window/close_cross.gif" alt="Закрыть" /></a></div></div></td>'+'</tr>'+'<tr>'+'<td class="window-content">'+'<div class="window-message">'+this.errorMessage+'</div>'+'<div class="window-body">'+this.body+'</div>'+'</td>'+'</tr>'+'</table>';return html;}