/* site/movies.js */
var timerId=null;$(function(){$("#mt_movies_cont").show();if($('#delete_unit').length){$('#delete_unit').onclick=function(event){confirmDialog(320,170,'Вы действительно хотите удалить видеоединицу?',function(){return true;});event.preventDefault();}}
$('.do_search_in_web').click(function(e){var clicked=$(this);$('.search_in_web_container').after('<img title="Идет поиск… Пожалуйста подождите." alt="Идет поиск… Пожалуйста подождите." src="http://static.weburg.ru/img/js//preload.gif" class="preload" />');$.ajax({cache:true,data:{hash:$(this).attr('hash'),obj_id:$(this).attr('obj_id')},dataType:"html",url:'/ajax/download/movie',success:function(data,textStatus){$('.preload').remove();clicked.parent().hide().next('.search_in_web_results').html(data).slideDown("slow");$('.show_full_info').click(function(){$(this).hide().next().slideDown('slow');});$('.hide_attention').hide();handleShowInfo();}});});$('.do_search_in_google').click(function(){var clicked=$(this);$('.search_in_web_container').after('<img title="Идет поиск… Пожалуйста подождите." alt="Идет поиск… Пожалуйста подождите." src="http://static.weburg.ru/img/js//preload.gif" class="preload" />');$.getJSON("http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q="+$.trim(escape($('#google_search_query').text()))+"&rsz=large&hl=ru&key=ABQIAAAA6YI50wh8-xzgKD4N35qPYxThIwQbqtkc5rhudQQjJYW_JcIdnRRGmKo8nbcusM-YVepIhdC1pDGlTQ&callback=GoogleCallback&context=?",function(data){$('.preload').remove();var li='';$.each(data.results,function(i,val){li+='<li><a href="/redirect/?url='+val.url.replace('http://','')+'" title="'+val.url+'" target="_blank">'+val.title+"</a> - "+val.content+'</li>';});var ul='<h3>Результаты поиска:</h3><ul class="google_results_list">'+li+'</ul>';ul+='<p>Посмотреть все результаты поиска на <a href="http://www.google.ru/search?hl=ru&q='+$.trim($('#google_search_query').text())+'" target="_blank">Google.ru</a></p>';clicked.parent().hide().next('.search_in_web_results').html(ul).slideDown("slow");});});$('#movies_content dl.top dd.trailers .show_trailer').click(function(){var trailer_player=$('#movies_content dl.top dd.trailers #'+$(this).attr('id')+'_player');if(trailer_player.is(':visible')){$(this).html('Посмотреть &darr;');}else{$(this).html('Посмотреть &uarr;');}
trailer_player.toggle();});});function handleShowInfo(){var elements=$('.movie_item');var info_block=null;elements.each(function(){var el=$(this);var params_toggler=el.find('.movie_params_toggler');var info_block=el.find('.movie-params');var movie_id=parseInt(params_toggler.attr('obj_id'));params_toggler.bind('mouseenter',function(event){if(!info_block.length){info_block=$('<div class="popup movie-params"></div>');var div=$('<div></div>');var top=$('<div class="top"></div>');var bottom=$('<div class="bottom"></div>');var content=$('<div class="popup-content"></div>');var offset=$(this).after(info_block).position();info_block.css('left',offset.left+'px').css('top',offset.top+15+'px').append(top).append(content).append(bottom);top.append(div.clone());bottom.append(div.clone());var imgPreload=$('<img src="http://static.weburg.ru/img/js//preload.gif" alt="Загрузка… Пожалуйста подождите." title="Загрузка… Пожалуйста подождите." />');content.append(imgPreload);$.getJSON('/movies/mediainfo/'+movie_id,function(json){var jsonHash=json;var aData=new Array();if(jsonHash.error){aData.push('<b>В данный момент информация о файле недоступна</b>');}
else{if(jsonHash.video.file_type!=2){if($.defined(jsonHash.video.video_format)&&jsonHash.video.video_format){aData.push('<b>Контейнер:</b> '+jsonHash.video.video_format);}
if($.defined(jsonHash.video.length)&&jsonHash.video.length!='N/A'){aData.push('<b>Продолжительность:</b> '+jsonHash.video.length);}
if($.defined(jsonHash.video.size)){aData.push('<b>Объем файла:</b> '+jsonHash.video.size);}
if($.defined(jsonHash.video.video_width)&&$.defined(jsonHash.video.video_height)&&jsonHash.video.video_width&&jsonHash.video.video_height&&(jsonHash.video.video_width!=0)&&(jsonHash.video.video_height!=0)){aData.push('<b>Видео:</b> '+
(($.defined(jsonHash.video.video_codec)&&jsonHash.video.video_codec)?jsonHash.video.video_codec+', ':'')+
(($.defined(jsonHash.video.codec_name)&&jsonHash.video.codec_name)?jsonHash.video.codec_name+', ':'')+
(($.defined(jsonHash.video.codec_profile)&&jsonHash.video.codec_profile)?jsonHash.video.codec_profile+
((!$.defined(jsonHash.video.codec_parameters)||jsonHash.video.codec_parameters=="")?', ':''):'')+
($.defined(jsonHash.video.codec_parameters)?' ('+jsonHash.video.codec_parameters+') ':'')+' '+
jsonHash.video.video_width+'&times;'+jsonHash.video.video_height+' '+
(($.defined(jsonHash.video.dar)&&(jsonHash.video.dar!=0.000))?(' ('+jsonHash.video.dar+':1), '):'')+' '+
(($.defined(jsonHash.video.video_bitrate)&&(jsonHash.video.video_bitrate!=0))?('~'+jsonHash.video.video_bitrate):'')+' kbps '+
(($.defined(jsonHash.video.quality_factor)&&(jsonHash.video.quality_factor!=0.000))?('('+jsonHash.video.quality_factor+' bpp)'):'')+' '+
(($.defined(jsonHash.video.video_fps)&&(jsonHash.video.video_fps!=0.000))?(jsonHash.video.video_fps+' fps'):''));}
var aTrack=Array();if(jsonHash.audio!=null){for(var i=0;i<jsonHash.audio.length;i++){aTrack=jsonHash.audio[i];aData.push('<b>Аудио №'+aTrack.track_number+':</b> '+
(($.defined(aTrack.language)&&aTrack.language!="")?aTrack.language+', ':'')+
($.defined(aTrack.codec)?aTrack.codec+', ':'')+
(($.defined(aTrack.bitrate)&&aTrack.bitrate!=0)?aTrack.bitrate:'')+
(($.defined(aTrack.bitrate_mode)&&aTrack.bitrate_mode!="")?' '+aTrack.bitrate_mode:'')+
(($.defined(aTrack.bitrate)||$.defined(aTrack.bitrate_mode))&&(aTrack.bitrate!=0)?', ':'')+
($.defined(aTrack.rate)?aTrack.rate+' kHz, ':'')+
($.defined(aTrack.channel_number)?aTrack.channel_number+' ch ':''));}}
var aTrack=Array();if(jsonHash.subtitle!=null){for(var i=0;i<jsonHash.subtitle.length;i++){aTrack=jsonHash.subtitle[i];aData.push('<b>Субтитры:</b> '+
(($.defined(aTrack.language)&&aTrack.language!="")?aTrack.language+', ':'')+
($.defined(aTrack.type)?aTrack.type:''));}}}
else{if($.defined(jsonHash.video.size)){aData.push('<b>Объем файла:</b> '+jsonHash.video.size);}}}
content.html(aData.join('<br />'));});}
info_block.show();});params_toggler.bind('mouseleave',function(e){if(info_block!=null){info_block.hide();}});});}
/* 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/awards.js */
$(function(){$(document).ready(function(){if($('.reflect').length>0){$('.reflect').reflect({height:0.1,opacity:0.5});}});var awards_content=$('#awards_content');var awards_info=$('#awards_info');if($('.nominations_voting',awards_content).length){$('.nominee .voting',awards_content).click(function(){var nominee=$(this).closest('.nominee');var nomination=nominee.closest('.nomination');var nomination_name=nomination.find('.header .nomination_name').html().match(/^(.*)/)[1].toLowerCase();if(nominee.hasClass('nominee_already_vote')){awards_info.html('Вы уже проголосовали сегодня за данного номинанта. <br/><a href="/awards/about/">Подробнее</a> об условиях рейтинга.');awards_info.dialog('open');return;}
if(!nominee.hasClass('nominee_vote')&&(nomination.find('.nominee.nominee_vote').length>=$('#'+nomination.attr('id')+'_votes_left').val())){awards_info.html('Вы можете проголовать только за 3 '+nomination_name+'а в день.<br/><a href="/awards/about/">Подробнее</a> об условиях рейтинга.');awards_info.dialog('open');return;}
nominee.toggleClass('nominee_vote');if(nomination.find('.nominee.nominee_vote').length){nomination.find('.add_vote').css({opacity:1,cursor:'pointer'});}else{nomination.find('.add_vote').css({opacity:0.3,cursor:'default'});}});$('.nomination .add_vote',awards_content).click(function(){var nomination=$(this).closest('.nomination');var nomination_id=nomination.attr('id').match(/nomination_(\d+)/i)[1];var nominees=nomination.find('.nominee.nominee_vote');var votes_left=$('#'+nomination.attr('id')+'_votes_left');var vote_button=$(this);if(!nominees.length){awards_info.html('Выберите номинантов и нажмите на кнопку "Голосовать".');awards_info.dialog('open');return;}
if(nominees.length>votes_left.val()){awards_info.html('Вы можете проголовать только за 3 '+nomination_name+'а в день.<br/><a href="/awards/about/">Подробнее</a> об условиях рейтинга.');awards_info.dialog('open');return;}
var award_url=$('#award_url').attr('url');if(!nomination_id||!award_url){awards_info.html('Не выбрана номинация или конкурс');awards_info.dialog('open');return;}
var nomineesIds='';nominees.each(function(){nomineesIds+=$(this).attr('id').match(/nominee_(\d+)/i)[1]+',';});$.ajax({data:{nomineesIds:nomineesIds},url:'/awards/'+award_url+'/nomination/'+nomination_id+'/vote',beforeSend:function(){vote_button.before('<div style="text-align: center; margin-top: -15px; " id="voting_loader"><img src="http://static.weburg.ru/img/js//thickbox/thickbox-ico-loading.gif" /></div>');vote_button.hide();},success:function(data,textStatus){$('#voting_loader',nomination).remove();vote_button.show();if(data=='no_nominees'){awards_info.html('Выберите номинантов и нажмите на кнопку "Голосовать".');}else if(data=='no_nomination'){awards_info.html('Выберите, пожалуйста, номинацию.');}else if(data=='no_votes'){awards_info.html('Вы можете проголовать только за 3 '+nomination_name+'а в день.<br/><a href="/awards/about/">Подробнее</a> об условиях рейтинга.');}else if(data=='no_user'){awards_info.html('Пожалуйста, <a href="/auth/login/">авторизуйтесь на сайте</a> для участия в голосовании');}else if(data=='voted_nominee'){awards_info.html('Вы уже сегодня проголосовали за данного номинанта');}else if(data=='wrong_stage'){awards_info.html('Голосование разрешено только в течение соответствующего этапа. Пожалуйста, ознакомьтесь с <a href="/awards/about/">правилами рейтинга</a>.');}else if(!data){awards_info.html('Внимание! Произошла ошибка, попробуйте проголосовать еще раз.');}else if(data.match(/^(\d+)\s+/i)){$('.votes_left',nomination).html(data);nominees.removeClass('nominee_vote').addClass('nominee_already_vote');awards_info.html('Ваши голоса приняты');votes_left.val(data.match(/^(\d+)\s+/i)[1]);nomination.find('.votes .vote_star:lt('+nominees.length+')').remove();}else{awards_info.html('Внимание! Произошла ошибка, попробуйте проголосовать еще раз.');}
awards_info.dialog('open');},error:function(){vote_button.show();$('#voting_loader',nomination).remove();awards_info.html('Внимание! Произошла ошибка, попробуйте проголосовать еще раз.');awards_info.dialog('open');}});});}
$('.nomination .nominee .voting_wide',awards_content).click(function(){var nomination=$(this).closest('.nomination');var nomination_id=nomination.attr('id').match(/nomination_(\d+)/i)[1];var nominee=$(this).closest('.nominee');if(!nominee.length){awards_info.html('Вы уже голосовали за данного номинанта');awards_info.dialog('open');return false;}
var vote_button=$(this);var nomineeId=nominee.attr('id').match(/nominee_(\d+)/i)[1];var award_url=$('#award_url').attr('url');if(!nomination_id||!nomineeId){awards_info.html('Не выбран номинант или конкурс');awards_info.dialog('open');return;}
$.ajax({url:'/awards/'+award_url+'/nominee/'+nomineeId+'/vote',success:function(data,textStatus){$('#voting_loader',nomination).remove();vote_button.show();if(data=='no_nominees'){awards_info.html('Выберите номинантов и нажмите на кнопку "Голосовать".');}else if(data=='no_nomination'){awards_info.html('Выберите, пожалуйста, номинацию.');}else if(data=='no_votes'){awards_info.html('Вы исчерпали свои голоса на сегодня.<br/><a href="/awards/about/">Подробнее</a> об условиях рейтинга.');}else if(data=='no_user'){awards_info.html('Пожалуйста, <a href="/auth/login/">авторизуйтесь на сайте</a> для участия в голосовании');}else if(data=='voted_nominee'){awards_info.html('Вы уже сегодня проголосовали данного номинанта.');}else if(data=='wrong_stage'){awards_info.html('Голосование разрешено только в течение соответсвующего этапа.');}else if(!data){awards_info.html('Внимание! Произошла ошибка, попробуйте проголосовать еще раз.');}else if(data=='ok'){nominee.removeClass('nominee_vote').addClass('nominee_already_vote');vote_button.removeClass('voting_wide').removeClass('rating_plus');vote_button.addClass('unactive');vote_button.siblings('.rating_count').html(parseInt(vote_button.siblings('.rating_count').html())+1);return;}else{awards_info.html('Внимание! Произошла ошибка, попробуйте проголосовать еще раз.');}
awards_info.dialog('open');},error:function(){vote_button.show();$('#voting_loader',nomination).remove();awards_info.html('Внимание! Произошла ошибка, попробуйте проголосовать еще раз.');awards_info.dialog('open');}});});$(".datepicker").datepicker({dateFormat:'yy-mm-dd 00:00:00',showButtonPanel:true,showOn:'button',buttonImage:'http://static.weburg.ru/img/css//jquery/calendar.gif',buttonImageOnly:true,changeMonth:true,changeYear:true,firstDay:1,monthNames:['Январь','Февраль','Март','Апрель','Май','Июнь','Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'],monthNamesShort:['Янв','Фев','Мар','Апр','Май','Июн','Июл','Авг','Сен','Окт','Ноя','Дек'],dayNames:['Воскресенье','Понедельник','Вторник','Среда','Четверг','Пятница','Суббота'],dayNamesMin:['Вс','Пн','Вт','Ср','Чт','Пт','Сб'],prevText:'Пред.',nextText:'След.',closeText:'Закрыть',currentText:'Сегодня'});$('.nomination .questions .question .show_wrong_answers',awards_content).click(function(){$(this).children('.arrow').toggleClass('arrow_down').toggleClass('arrow_up');$(this).closest('.question').find('.wrong_answers').toggle();})
$('.not_authorized_participant',awards_content).click(function(e){e.preventDefault();$('.not_authorized_link',awards_content).show();});if($('.awards_notificator',awards_content).length){$('.awards_notificator',awards_content).each(function(){var notificatorText=$(this).html();var styleName=$(this).attr('qtip_style')?$(this).attr('qtip_style'):'blue';$(this).html('');$(this).show();$(this).qtip({content:{prerender:true,text:notificatorText},style:{tip:false,width:{min:400,max:800},name:styleName,border:{radius:5}},position:{corner:{tooltip:'bottomMiddle',target:'topMiddle'},adjust:{y:-10}}});$(this).qtip('show');});}
if($('.awards_notificator_click',awards_content).length){$('.awards_notificator_click',awards_content).each(function(){var notificatorInfoObject=$(this).siblings('.awards_notificator_onclick');var notificatorText=notificatorInfoObject.html();var styleName=notificatorInfoObject.attr('qtip_style')?notificatorInfoObject.attr('qtip_style'):'blue';notificatorInfoObject.html('');var notificatorObject=$(this);$(this).qtip({content:{text:notificatorText},style:{tip:true,width:{min:100,max:200},name:styleName,border:{radius:5}},position:{corner:{tooltip:'bottomLeft',target:'topRight'}},show:{when:{target:notificatorObject,event:'click'}},hide:{when:{event:'unfocus'}}});});}
$('#comment_form.add_nominee_form').submit(function(){var form=$(this);var name=$(this).find('#add_nominee_name').val();var countWords=name.split(' ');if(!name||countWords<2){$(this).find('.awards_no_name').click();return false;}else if(!$(this).find('#add_nominee_phone').val()){$(this).find('.awards_no_phone').click();return false;}});$('#question_form').submit(function(){var form=$(this);var name=$(this).find('#awards_user_name').val();var countWords=name.split(' ');if(!name||countWords<2){$(this).find('.awards_no_name').click();return false;}else if(!$(this).find('#awards_user_phone').val()){$(this).find('.awards_no_phone').click();return false;}});});
/* site/swfupload.js */
var SWFUpload;if(SWFUpload==undefined){SWFUpload=function(settings){this.initSWFUpload(settings);};}
SWFUpload.prototype.initSWFUpload=function(settings){try{this.customSettings={};this.settings=settings;this.eventQueue=[];this.movieName="SWFUpload_"+SWFUpload.movieCount++;this.movieElement=null;SWFUpload.instances[this.movieName]=this;this.initSettings();this.loadFlash();this.displayDebugInfo();}catch(ex){delete SWFUpload.instances[this.movieName];throw ex;}};SWFUpload.instances={};SWFUpload.movieCount=0;SWFUpload.version="2.2.0 2009-03-25";SWFUpload.QUEUE_ERROR={QUEUE_LIMIT_EXCEEDED:-100,FILE_EXCEEDS_SIZE_LIMIT:-110,ZERO_BYTE_FILE:-120,INVALID_FILETYPE:-130};SWFUpload.UPLOAD_ERROR={HTTP_ERROR:-200,MISSING_UPLOAD_URL:-210,IO_ERROR:-220,SECURITY_ERROR:-230,UPLOAD_LIMIT_EXCEEDED:-240,UPLOAD_FAILED:-250,SPECIFIED_FILE_ID_NOT_FOUND:-260,FILE_VALIDATION_FAILED:-270,FILE_CANCELLED:-280,UPLOAD_STOPPED:-290};SWFUpload.FILE_STATUS={QUEUED:-1,IN_PROGRESS:-2,ERROR:-3,COMPLETE:-4,CANCELLED:-5};SWFUpload.BUTTON_ACTION={SELECT_FILE:-100,SELECT_FILES:-110,START_UPLOAD:-120};SWFUpload.CURSOR={ARROW:-1,HAND:-2};SWFUpload.WINDOW_MODE={WINDOW:"window",TRANSPARENT:"transparent",OPAQUE:"opaque"};SWFUpload.completeURL=function(url){if(typeof(url)!=="string"||url.match(/^https?:\/\//i)||url.match(/^\//)){return url;}
var currentURL=window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:"");var indexSlash=window.location.pathname.lastIndexOf("/");if(indexSlash<=0){path="/";}else{path=window.location.pathname.substr(0,indexSlash)+"/";}
return path+url;};SWFUpload.prototype.initSettings=function(){this.ensureDefault=function(settingName,defaultValue){this.settings[settingName]=(this.settings[settingName]==undefined)?defaultValue:this.settings[settingName];};this.ensureDefault("upload_url","");this.ensureDefault("preserve_relative_urls",false);this.ensureDefault("file_post_name","Filedata");this.ensureDefault("post_params",{});this.ensureDefault("use_query_string",false);this.ensureDefault("requeue_on_error",false);this.ensureDefault("http_success",[]);this.ensureDefault("assume_success_timeout",0);this.ensureDefault("file_types","*.*");this.ensureDefault("file_types_description","All Files");this.ensureDefault("file_size_limit",0);this.ensureDefault("file_upload_limit",0);this.ensureDefault("file_queue_limit",0);this.ensureDefault("flash_url","swfupload.swf");this.ensureDefault("prevent_swf_caching",true);this.ensureDefault("button_image_url","");this.ensureDefault("button_width",1);this.ensureDefault("button_height",1);this.ensureDefault("button_text","");this.ensureDefault("button_text_style","color: #000000; font-size: 16pt;");this.ensureDefault("button_text_top_padding",0);this.ensureDefault("button_text_left_padding",0);this.ensureDefault("button_action",SWFUpload.BUTTON_ACTION.SELECT_FILES);this.ensureDefault("button_disabled",false);this.ensureDefault("button_placeholder_id","");this.ensureDefault("button_placeholder",null);this.ensureDefault("button_cursor",SWFUpload.CURSOR.ARROW);this.ensureDefault("button_window_mode",SWFUpload.WINDOW_MODE.WINDOW);this.ensureDefault("debug",false);this.settings.debug_enabled=this.settings.debug;this.settings.return_upload_start_handler=this.returnUploadStart;this.ensureDefault("swfupload_loaded_handler",null);this.ensureDefault("file_dialog_start_handler",null);this.ensureDefault("file_queued_handler",null);this.ensureDefault("file_queue_error_handler",null);this.ensureDefault("file_dialog_complete_handler",null);this.ensureDefault("upload_start_handler",null);this.ensureDefault("upload_progress_handler",null);this.ensureDefault("upload_error_handler",null);this.ensureDefault("upload_success_handler",null);this.ensureDefault("upload_complete_handler",null);this.ensureDefault("debug_handler",this.debugMessage);this.ensureDefault("custom_settings",{});this.customSettings=this.settings.custom_settings;if(!!this.settings.prevent_swf_caching){this.settings.flash_url=this.settings.flash_url+(this.settings.flash_url.indexOf("?")<0?"?":"&")+"preventswfcaching="+new Date().getTime();}
if(!this.settings.preserve_relative_urls){this.settings.upload_url=SWFUpload.completeURL(this.settings.upload_url);this.settings.button_image_url=SWFUpload.completeURL(this.settings.button_image_url);}
delete this.ensureDefault;};SWFUpload.prototype.loadFlash=function(){var targetElement,tempParent;if(document.getElementById(this.movieName)!==null){throw"ID "+this.movieName+" is already in use. The Flash Object could not be added";}
targetElement=document.getElementById(this.settings.button_placeholder_id)||this.settings.button_placeholder;if(targetElement==undefined){throw"Could not find the placeholder element: "+this.settings.button_placeholder_id;}
tempParent=document.createElement("div");tempParent.innerHTML=this.getFlashHTML();targetElement.parentNode.replaceChild(tempParent.firstChild,targetElement);if(window[this.movieName]==undefined){window[this.movieName]=this.getMovieElement();}};SWFUpload.prototype.getFlashHTML=function(){return['<object id="',this.movieName,'" type="application/x-shockwave-flash" data="',this.settings.flash_url,'" width="',this.settings.button_width,'" height="',this.settings.button_height,'" class="swfupload">','<param name="wmode" value="',this.settings.button_window_mode,'" />','<param name="movie" value="',this.settings.flash_url,'" />','<param name="quality" value="high" />','<param name="menu" value="false" />','<param name="allowScriptAccess" value="always" />','<param name="flashvars" value="'+this.getFlashVars()+'" />','</object>'].join("");};SWFUpload.prototype.getFlashVars=function(){var paramString=this.buildParamString();var httpSuccessString=this.settings.http_success.join(",");return["movieName=",encodeURIComponent(this.movieName),"&amp;uploadURL=",encodeURIComponent(this.settings.upload_url),"&amp;useQueryString=",encodeURIComponent(this.settings.use_query_string),"&amp;requeueOnError=",encodeURIComponent(this.settings.requeue_on_error),"&amp;httpSuccess=",encodeURIComponent(httpSuccessString),"&amp;assumeSuccessTimeout=",encodeURIComponent(this.settings.assume_success_timeout),"&amp;params=",encodeURIComponent(paramString),"&amp;filePostName=",encodeURIComponent(this.settings.file_post_name),"&amp;fileTypes=",encodeURIComponent(this.settings.file_types),"&amp;fileTypesDescription=",encodeURIComponent(this.settings.file_types_description),"&amp;fileSizeLimit=",encodeURIComponent(this.settings.file_size_limit),"&amp;fileUploadLimit=",encodeURIComponent(this.settings.file_upload_limit),"&amp;fileQueueLimit=",encodeURIComponent(this.settings.file_queue_limit),"&amp;debugEnabled=",encodeURIComponent(this.settings.debug_enabled),"&amp;buttonImageURL=",encodeURIComponent(this.settings.button_image_url),"&amp;buttonWidth=",encodeURIComponent(this.settings.button_width),"&amp;buttonHeight=",encodeURIComponent(this.settings.button_height),"&amp;buttonText=",encodeURIComponent(this.settings.button_text),"&amp;buttonTextTopPadding=",encodeURIComponent(this.settings.button_text_top_padding),"&amp;buttonTextLeftPadding=",encodeURIComponent(this.settings.button_text_left_padding),"&amp;buttonTextStyle=",encodeURIComponent(this.settings.button_text_style),"&amp;buttonAction=",encodeURIComponent(this.settings.button_action),"&amp;buttonDisabled=",encodeURIComponent(this.settings.button_disabled),"&amp;buttonCursor=",encodeURIComponent(this.settings.button_cursor)].join("");};SWFUpload.prototype.getMovieElement=function(){if(this.movieElement==undefined){this.movieElement=document.getElementById(this.movieName);}
if(this.movieElement===null){throw"Could not find Flash element";}
return this.movieElement;};SWFUpload.prototype.buildParamString=function(){var postParams=this.settings.post_params;var paramStringPairs=[];if(typeof(postParams)==="object"){for(var name in postParams){if(postParams.hasOwnProperty(name)){paramStringPairs.push(encodeURIComponent(name.toString())+"="+encodeURIComponent(postParams[name].toString()));}}}
return paramStringPairs.join("&amp;");};SWFUpload.prototype.destroy=function(){try{this.cancelUpload(null,false);var movieElement=null;movieElement=this.getMovieElement();if(movieElement&&typeof(movieElement.CallFunction)==="unknown"){for(var i in movieElement){try{if(typeof(movieElement[i])==="function"){movieElement[i]=null;}}catch(ex1){}}
try{movieElement.parentNode.removeChild(movieElement);}catch(ex){}}
window[this.movieName]=null;SWFUpload.instances[this.movieName]=null;delete SWFUpload.instances[this.movieName];this.movieElement=null;this.settings=null;this.customSettings=null;this.eventQueue=null;this.movieName=null;return true;}catch(ex2){return false;}};SWFUpload.prototype.displayDebugInfo=function(){this.debug(["---SWFUpload Instance Info---\n","Version: ",SWFUpload.version,"\n","Movie Name: ",this.movieName,"\n","Settings:\n","\t","upload_url:               ",this.settings.upload_url,"\n","\t","flash_url:                ",this.settings.flash_url,"\n","\t","use_query_string:         ",this.settings.use_query_string.toString(),"\n","\t","requeue_on_error:         ",this.settings.requeue_on_error.toString(),"\n","\t","http_success:             ",this.settings.http_success.join(", "),"\n","\t","assume_success_timeout:   ",this.settings.assume_success_timeout,"\n","\t","file_post_name:           ",this.settings.file_post_name,"\n","\t","post_params:              ",this.settings.post_params.toString(),"\n","\t","file_types:               ",this.settings.file_types,"\n","\t","file_types_description:   ",this.settings.file_types_description,"\n","\t","file_size_limit:          ",this.settings.file_size_limit,"\n","\t","file_upload_limit:        ",this.settings.file_upload_limit,"\n","\t","file_queue_limit:         ",this.settings.file_queue_limit,"\n","\t","debug:                    ",this.settings.debug.toString(),"\n","\t","prevent_swf_caching:      ",this.settings.prevent_swf_caching.toString(),"\n","\t","button_placeholder_id:    ",this.settings.button_placeholder_id.toString(),"\n","\t","button_placeholder:       ",(this.settings.button_placeholder?"Set":"Not Set"),"\n","\t","button_image_url:         ",this.settings.button_image_url.toString(),"\n","\t","button_width:             ",this.settings.button_width.toString(),"\n","\t","button_height:            ",this.settings.button_height.toString(),"\n","\t","button_text:              ",this.settings.button_text.toString(),"\n","\t","button_text_style:        ",this.settings.button_text_style.toString(),"\n","\t","button_text_top_padding:  ",this.settings.button_text_top_padding.toString(),"\n","\t","button_text_left_padding: ",this.settings.button_text_left_padding.toString(),"\n","\t","button_action:            ",this.settings.button_action.toString(),"\n","\t","button_disabled:          ",this.settings.button_disabled.toString(),"\n","\t","custom_settings:          ",this.settings.custom_settings.toString(),"\n","Event Handlers:\n","\t","swfupload_loaded_handler assigned:  ",(typeof this.settings.swfupload_loaded_handler==="function").toString(),"\n","\t","file_dialog_start_handler assigned: ",(typeof this.settings.file_dialog_start_handler==="function").toString(),"\n","\t","file_queued_handler assigned:       ",(typeof this.settings.file_queued_handler==="function").toString(),"\n","\t","file_queue_error_handler assigned:  ",(typeof this.settings.file_queue_error_handler==="function").toString(),"\n","\t","upload_start_handler assigned:      ",(typeof this.settings.upload_start_handler==="function").toString(),"\n","\t","upload_progress_handler assigned:   ",(typeof this.settings.upload_progress_handler==="function").toString(),"\n","\t","upload_error_handler assigned:      ",(typeof this.settings.upload_error_handler==="function").toString(),"\n","\t","upload_success_handler assigned:    ",(typeof this.settings.upload_success_handler==="function").toString(),"\n","\t","upload_complete_handler assigned:   ",(typeof this.settings.upload_complete_handler==="function").toString(),"\n","\t","debug_handler assigned:             ",(typeof this.settings.debug_handler==="function").toString(),"\n"].join(""));};SWFUpload.prototype.addSetting=function(name,value,default_value){if(value==undefined){return(this.settings[name]=default_value);}else{return(this.settings[name]=value);}};SWFUpload.prototype.getSetting=function(name){if(this.settings[name]!=undefined){return this.settings[name];}
return"";};SWFUpload.prototype.callFlash=function(functionName,argumentArray){argumentArray=argumentArray||[];var movieElement=this.getMovieElement();var returnValue,returnString;try{returnString=movieElement.CallFunction('<invoke name="'+functionName+'" returntype="javascript">'+__flash__argumentsToXML(argumentArray,0)+'</invoke>');returnValue=eval(returnString);}catch(ex){throw"Call to "+functionName+" failed";}
if(returnValue!=undefined&&typeof returnValue.post==="object"){returnValue=this.unescapeFilePostParams(returnValue);}
return returnValue;};SWFUpload.prototype.selectFile=function(){this.callFlash("SelectFile");};SWFUpload.prototype.selectFiles=function(){this.callFlash("SelectFiles");};SWFUpload.prototype.startUpload=function(fileID){this.callFlash("StartUpload",[fileID]);};SWFUpload.prototype.cancelUpload=function(fileID,triggerErrorEvent){if(triggerErrorEvent!==false){triggerErrorEvent=true;}
this.callFlash("CancelUpload",[fileID,triggerErrorEvent]);};SWFUpload.prototype.stopUpload=function(){this.callFlash("StopUpload");};SWFUpload.prototype.getStats=function(){return this.callFlash("GetStats");};SWFUpload.prototype.setStats=function(statsObject){this.callFlash("SetStats",[statsObject]);};SWFUpload.prototype.getFile=function(fileID){if(typeof(fileID)==="number"){return this.callFlash("GetFileByIndex",[fileID]);}else{return this.callFlash("GetFile",[fileID]);}};SWFUpload.prototype.addFileParam=function(fileID,name,value){return this.callFlash("AddFileParam",[fileID,name,value]);};SWFUpload.prototype.removeFileParam=function(fileID,name){this.callFlash("RemoveFileParam",[fileID,name]);};SWFUpload.prototype.setUploadURL=function(url){this.settings.upload_url=url.toString();this.callFlash("SetUploadURL",[url]);};SWFUpload.prototype.setPostParams=function(paramsObject){this.settings.post_params=paramsObject;this.callFlash("SetPostParams",[paramsObject]);};SWFUpload.prototype.addPostParam=function(name,value){this.settings.post_params[name]=value;this.callFlash("SetPostParams",[this.settings.post_params]);};SWFUpload.prototype.removePostParam=function(name){delete this.settings.post_params[name];this.callFlash("SetPostParams",[this.settings.post_params]);};SWFUpload.prototype.setFileTypes=function(types,description){this.settings.file_types=types;this.settings.file_types_description=description;this.callFlash("SetFileTypes",[types,description]);};SWFUpload.prototype.setFileSizeLimit=function(fileSizeLimit){this.settings.file_size_limit=fileSizeLimit;this.callFlash("SetFileSizeLimit",[fileSizeLimit]);};SWFUpload.prototype.setFileUploadLimit=function(fileUploadLimit){this.settings.file_upload_limit=fileUploadLimit;this.callFlash("SetFileUploadLimit",[fileUploadLimit]);};SWFUpload.prototype.setFileQueueLimit=function(fileQueueLimit){this.settings.file_queue_limit=fileQueueLimit;this.callFlash("SetFileQueueLimit",[fileQueueLimit]);};SWFUpload.prototype.setFilePostName=function(filePostName){this.settings.file_post_name=filePostName;this.callFlash("SetFilePostName",[filePostName]);};SWFUpload.prototype.setUseQueryString=function(useQueryString){this.settings.use_query_string=useQueryString;this.callFlash("SetUseQueryString",[useQueryString]);};SWFUpload.prototype.setRequeueOnError=function(requeueOnError){this.settings.requeue_on_error=requeueOnError;this.callFlash("SetRequeueOnError",[requeueOnError]);};SWFUpload.prototype.setHTTPSuccess=function(http_status_codes){if(typeof http_status_codes==="string"){http_status_codes=http_status_codes.replace(" ","").split(",");}
this.settings.http_success=http_status_codes;this.callFlash("SetHTTPSuccess",[http_status_codes]);};SWFUpload.prototype.setAssumeSuccessTimeout=function(timeout_seconds){this.settings.assume_success_timeout=timeout_seconds;this.callFlash("SetAssumeSuccessTimeout",[timeout_seconds]);};SWFUpload.prototype.setDebugEnabled=function(debugEnabled){this.settings.debug_enabled=debugEnabled;this.callFlash("SetDebugEnabled",[debugEnabled]);};SWFUpload.prototype.setButtonImageURL=function(buttonImageURL){if(buttonImageURL==undefined){buttonImageURL="";}
this.settings.button_image_url=buttonImageURL;this.callFlash("SetButtonImageURL",[buttonImageURL]);};SWFUpload.prototype.setButtonDimensions=function(width,height){this.settings.button_width=width;this.settings.button_height=height;var movie=this.getMovieElement();if(movie!=undefined){movie.style.width=width+"px";movie.style.height=height+"px";}
this.callFlash("SetButtonDimensions",[width,height]);};SWFUpload.prototype.setButtonText=function(html){this.settings.button_text=html;this.callFlash("SetButtonText",[html]);};SWFUpload.prototype.setButtonTextPadding=function(left,top){this.settings.button_text_top_padding=top;this.settings.button_text_left_padding=left;this.callFlash("SetButtonTextPadding",[left,top]);};SWFUpload.prototype.setButtonTextStyle=function(css){this.settings.button_text_style=css;this.callFlash("SetButtonTextStyle",[css]);};SWFUpload.prototype.setButtonDisabled=function(isDisabled){this.settings.button_disabled=isDisabled;this.callFlash("SetButtonDisabled",[isDisabled]);};SWFUpload.prototype.setButtonAction=function(buttonAction){this.settings.button_action=buttonAction;this.callFlash("SetButtonAction",[buttonAction]);};SWFUpload.prototype.setButtonCursor=function(cursor){this.settings.button_cursor=cursor;this.callFlash("SetButtonCursor",[cursor]);};SWFUpload.prototype.queueEvent=function(handlerName,argumentArray){if(argumentArray==undefined){argumentArray=[];}else if(!(argumentArray instanceof Array)){argumentArray=[argumentArray];}
var self=this;if(typeof this.settings[handlerName]==="function"){this.eventQueue.push(function(){this.settings[handlerName].apply(this,argumentArray);});setTimeout(function(){self.executeNextEvent();},0);}else if(this.settings[handlerName]!==null){throw"Event handler "+handlerName+" is unknown or is not a function";}};SWFUpload.prototype.executeNextEvent=function(){var f=this.eventQueue?this.eventQueue.shift():null;if(typeof(f)==="function"){f.apply(this);}};SWFUpload.prototype.unescapeFilePostParams=function(file){var reg=/[$]([0-9a-f]{4})/i;var unescapedPost={};var uk;if(file!=undefined){for(var k in file.post){if(file.post.hasOwnProperty(k)){uk=k;var match;while((match=reg.exec(uk))!==null){uk=uk.replace(match[0],String.fromCharCode(parseInt("0x"+match[1],16)));}
unescapedPost[uk]=file.post[k];}}
file.post=unescapedPost;}
return file;};SWFUpload.prototype.testExternalInterface=function(){try{return this.callFlash("TestExternalInterface");}catch(ex){return false;}};SWFUpload.prototype.flashReady=function(){var movieElement=this.getMovieElement();if(!movieElement){this.debug("Flash called back ready but the flash movie can't be found.");return;}
this.cleanUp(movieElement);this.queueEvent("swfupload_loaded_handler");};SWFUpload.prototype.cleanUp=function(movieElement){try{if(this.movieElement&&typeof(movieElement.CallFunction)==="unknown"){this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");for(var key in movieElement){try{if(typeof(movieElement[key])==="function"){movieElement[key]=null;}}catch(ex){}}}}catch(ex1){}
window["__flash__removeCallback"]=function(instance,name){try{if(instance){instance[name]=null;}}catch(flashEx){}};};SWFUpload.prototype.fileDialogStart=function(){this.queueEvent("file_dialog_start_handler");};SWFUpload.prototype.fileQueued=function(file){file=this.unescapeFilePostParams(file);this.queueEvent("file_queued_handler",file);};SWFUpload.prototype.fileQueueError=function(file,errorCode,message){file=this.unescapeFilePostParams(file);this.queueEvent("file_queue_error_handler",[file,errorCode,message]);};SWFUpload.prototype.fileDialogComplete=function(numFilesSelected,numFilesQueued,numFilesInQueue){this.queueEvent("file_dialog_complete_handler",[numFilesSelected,numFilesQueued,numFilesInQueue]);};SWFUpload.prototype.uploadStart=function(file){file=this.unescapeFilePostParams(file);this.queueEvent("return_upload_start_handler",file);};SWFUpload.prototype.returnUploadStart=function(file){var returnValue;if(typeof this.settings.upload_start_handler==="function"){file=this.unescapeFilePostParams(file);returnValue=this.settings.upload_start_handler.call(this,file);}else if(this.settings.upload_start_handler!=undefined){throw"upload_start_handler must be a function";}
if(returnValue===undefined){returnValue=true;}
returnValue=!!returnValue;this.callFlash("ReturnUploadStart",[returnValue]);};SWFUpload.prototype.uploadProgress=function(file,bytesComplete,bytesTotal){file=this.unescapeFilePostParams(file);this.queueEvent("upload_progress_handler",[file,bytesComplete,bytesTotal]);};SWFUpload.prototype.uploadError=function(file,errorCode,message){file=this.unescapeFilePostParams(file);this.queueEvent("upload_error_handler",[file,errorCode,message]);};SWFUpload.prototype.uploadSuccess=function(file,serverData,responseReceived){file=this.unescapeFilePostParams(file);this.queueEvent("upload_success_handler",[file,serverData,responseReceived]);};SWFUpload.prototype.uploadComplete=function(file){file=this.unescapeFilePostParams(file);this.queueEvent("upload_complete_handler",file);};SWFUpload.prototype.debug=function(message){this.queueEvent("debug_handler",message);};SWFUpload.prototype.debugMessage=function(message){if(this.settings.debug){var exceptionMessage,exceptionValues=[];if(typeof message==="object"&&typeof message.name==="string"&&typeof message.message==="string"){for(var key in message){if(message.hasOwnProperty(key)){exceptionValues.push(key+": "+message[key]);}}
exceptionMessage=exceptionValues.join("\n")||"";exceptionValues=exceptionMessage.split("\n");exceptionMessage="EXCEPTION: "+exceptionValues.join("\nEXCEPTION: ");SWFUpload.Console.writeLine(exceptionMessage);}else{SWFUpload.Console.writeLine(message);}}};SWFUpload.Console={};SWFUpload.Console.writeLine=function(message){var console,documentForm;try{console=document.getElementById("SWFUpload_Console");if(!console){documentForm=document.createElement("form");document.getElementsByTagName("body")[0].appendChild(documentForm);console=document.createElement("textarea");console.id="SWFUpload_Console";console.style.fontFamily="monospace";console.setAttribute("wrap","off");console.wrap="off";console.style.overflow="auto";console.style.width="700px";console.style.height="350px";console.style.margin="5px";documentForm.appendChild(console);}
console.value+=message+"\n";console.scrollTop=console.scrollHeight-console.clientHeight;}catch(ex){alert("Exception: "+ex.name+" Message: "+ex.message);}};
/* site/swfupload.queue.js */
var SWFUpload;if(typeof(SWFUpload)==="function"){SWFUpload.queue={};SWFUpload.prototype.initSettings=(function(oldInitSettings){return function(){if(typeof(oldInitSettings)==="function"){oldInitSettings.call(this);}
this.queueSettings={};this.queueSettings.queue_cancelled_flag=false;this.queueSettings.queue_upload_count=0;this.queueSettings.user_upload_complete_handler=this.settings.upload_complete_handler;this.queueSettings.user_upload_start_handler=this.settings.upload_start_handler;this.settings.upload_complete_handler=SWFUpload.queue.uploadCompleteHandler;this.settings.upload_start_handler=SWFUpload.queue.uploadStartHandler;this.settings.queue_complete_handler=this.settings.queue_complete_handler||null;};})(SWFUpload.prototype.initSettings);SWFUpload.prototype.startUpload=function(fileID){this.queueSettings.queue_cancelled_flag=false;this.callFlash("StartUpload",[fileID]);};SWFUpload.prototype.cancelQueue=function(){this.queueSettings.queue_cancelled_flag=true;this.stopUpload();var stats=this.getStats();while(stats.files_queued>0){this.cancelUpload();stats=this.getStats();}};SWFUpload.queue.uploadStartHandler=function(file){var returnValue;if(typeof(this.queueSettings.user_upload_start_handler)==="function"){returnValue=this.queueSettings.user_upload_start_handler.call(this,file);}
returnValue=(returnValue===false)?false:true;this.queueSettings.queue_cancelled_flag=!returnValue;return returnValue;};SWFUpload.queue.uploadCompleteHandler=function(file){var user_upload_complete_handler=this.queueSettings.user_upload_complete_handler;var continueUpload;if(file.filestatus===SWFUpload.FILE_STATUS.COMPLETE){this.queueSettings.queue_upload_count++;}
if(typeof(user_upload_complete_handler)==="function"){continueUpload=(user_upload_complete_handler.call(this,file)===false)?false:true;}else if(file.filestatus===SWFUpload.FILE_STATUS.QUEUED){continueUpload=false;}else{continueUpload=true;}
if(continueUpload){var stats=this.getStats();if(stats.files_queued>0&&this.queueSettings.queue_cancelled_flag===false){this.startUpload();}else if(this.queueSettings.queue_cancelled_flag===false){this.queueEvent("queue_complete_handler",[this.queueSettings.queue_upload_count]);this.queueSettings.queue_upload_count=0;}else{this.queueSettings.queue_cancelled_flag=false;this.queueSettings.queue_upload_count=0;}}};}
/* site/swfupload.swfobject.js */
var SWFUpload;if(typeof(SWFUpload)==="function"){SWFUpload.onload=function(){};swfobject.addDomLoadEvent(function(){if(typeof(SWFUpload.onload)==="function"){SWFUpload.onload.call(window);}});SWFUpload.prototype.initSettings=(function(oldInitSettings){return function(){if(typeof(oldInitSettings)==="function"){oldInitSettings.call(this);}
this.ensureDefault=function(settingName,defaultValue){this.settings[settingName]=(this.settings[settingName]==undefined)?defaultValue:this.settings[settingName];};this.ensureDefault("minimum_flash_version","9.0.28");this.ensureDefault("swfupload_pre_load_handler",null);this.ensureDefault("swfupload_load_failed_handler",null);delete this.ensureDefault;};})(SWFUpload.prototype.initSettings);SWFUpload.prototype.loadFlash=function(oldLoadFlash){return function(){var hasFlash=swfobject.hasFlashPlayerVersion(this.settings.minimum_flash_version);if(hasFlash){this.queueEvent("swfupload_pre_load_handler");if(typeof(oldLoadFlash)==="function"){oldLoadFlash.call(this);}}else{this.queueEvent("swfupload_load_failed_handler");}};}(SWFUpload.prototype.loadFlash);SWFUpload.prototype.displayDebugInfo=function(oldDisplayDebugInfo){return function(){if(typeof(oldDisplayDebugInfo)==="function"){oldDisplayDebugInfo.call(this);}
this.debug(["SWFUpload.SWFObject Plugin settings:","\n","\t","minimum_flash_version:                      ",this.settings.minimum_flash_version,"\n","\t","swfupload_pre_load_handler assigned:     ",(typeof(this.settings.swfupload_pre_load_handler)==="function").toString(),"\n","\t","swfupload_load_failed_handler assigned:     ",(typeof(this.settings.swfupload_load_failed_handler)==="function").toString(),"\n",].join(""));};}(SWFUpload.prototype.displayDebugInfo);}
/* site/swfupload.handler.js */
var swfu;SWFUpload.onload=function(){var settings={flash_url:"/swfupload.swf",upload_url:"/gallerymanager/upload",file_post_name:"filedata",post_params:{"NETBRANCH":getCookie("NETBRANCH")},file_size_limit:"5 MB",file_types:"*.jpg;",file_types_description:"Изображения",file_upload_limit:100,file_queue_limit:0,custom_settings:{},debug:false,button_image_url:"http://static.weburg.ru/img/css/design/buttons/upload_button.png",button_placeholder_id:"spanButtonPlaceholder",button_width:61,button_height:22,swfupload_loaded_handler:swfUploadLoaded,file_queued_handler:fileQueued,file_queue_error_handler:fileQueueError,file_dialog_complete_handler:fileDialogComplete,upload_start_handler:uploadStart,upload_progress_handler:uploadProgress,upload_error_handler:uploadError,upload_success_handler:uploadSuccess,upload_complete_handler:uploadComplete,debug_handler:debug,queue_complete_handler:queueComplete,minimum_flash_version:"9.0.28",swfupload_pre_load_handler:swfUploadPreLoad,swfupload_load_failed_handler:swfUploadLoadFailed};if($('#spanButtonPlaceholder').length){swfu=new SWFUpload(settings);}}
var totalQueueFileSize=0;var totalQueueFileCount=0;var uploadedQueueFileSize=0;function swfUploadPreLoad(){var self=this;var loading=function(){$("#divLoadingContent").show();var longLoad=function(){$("#divLoadingContent").hide();$("divLongLoading").show();};this.customSettings.loadingTimeout=setTimeout(function(){longLoad.call(self)},15*1000);};this.customSettings.loadingTimeout=setTimeout(function(){loading.call(self);},1*1000);}
function swfUploadLoaded(){var self=this;clearTimeout(this.customSettings.loadingTimeout)
$("#divLoadingContent").hide();$("#divLongLoading").hide();$("#divAlternateContent").hide();$("#btnStart").click(function(){$(this).attr('disabled',true);self.addPostParam('parent_type',$('#parentType').val());self.addPostParam('parent_id',$('#parentId').val());self.startUpload();});$("#uploadManager tr[id^='SWFUpload'] td.remove .ui-icon-trash").live('click',function(){self.cancelUpload($(this).closest('tr').attr('id'));});$("#uploadQueueStats .progressbar").progressbar();}
function swfUploadLoadFailed(){clearTimeout(this.customSettings.loadingTimeout);$("divLoadingContent").hide();$("divLongLoading").hide();$("divAlternateContent").show();}
function fileQueued(file){$('#fileList').append('<tr id="'+file.id+'"><td class="name">'+file.name+'</td><td class="size">'+file.size+'</td><td class="status"><span title="Файл добавлен в очередь для загрузки" class="ui-icon ui-icon-plus"/></td><td class="remove"><span title="Удалить файл" class="ui-icon ui-icon-trash"/></td></tr>');totalQueueFileSize+=file.size;totalQueueFileCount++;}
function fileQueueError(file,errorCode,message){if(errorCode===SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED){alert("You have attempted to queue too many files.\n"+(message===0?"You have reached the upload limit.":"You may select "+(message>1?"up to "+message+" files.":"one file.")));return;}
var status;switch(errorCode){case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:status="File is too big.";break;case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:status="Cannot upload Zero Byte files.";break;case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:status="Invalid File Type.";break;default:if(file!==null){status="Unhandled Error";}
break;}
$('#'+file.id+' .status').html('<span title="'+status+'" class="ui-icon ui-icon-alert"/>');}
function fileDialogComplete(numFilesSelected,numFilesQueued,totalFilesQueued){if(numFilesSelected>0){$('#btnStart').attr('disabled',false);}
$('#uploadQueueStats .stats').html('К загрузке: '+totalQueueFileCount+plural(totalQueueFileCount,' файл',' файла',' файлов')+'. Всего: '+Math.round((totalQueueFileSize/1024/1024)*100)/100+' мб.')
$('#uploadManager').show();}
function uploadStart(file){$('#'+file.id+' .status').html('<span title="Файл загружется.." class="ui-icon ui-icon-play"/>');}
function uploadProgress(file,bytesLoaded,bytesTotal){var percent=Math.ceil(((uploadedQueueFileSize+bytesLoaded)/totalQueueFileSize)*100);$("#uploadQueueStats .progressbar").progressbar('value',percent);}
function uploadSuccess(file,serverData,receivedResponse){$('#'+file.id+' .status').html('<span title="Файл успешно загружен" class="ui-icon ui-icon-check"/>');uploadedQueueFileSize+=file.size;$('#debug').append('<pre>'+serverData+'</pre>');}
function uploadError(file,errorCode,message){var status;switch(errorCode){case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:status="Upload Error: "+message;break;case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:status="Upload Failed.";break;case SWFUpload.UPLOAD_ERROR.IO_ERROR:status="Server (IO) Error";break;case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:status="Security Error";break;case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:status="Upload limit exceeded.";break;case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:status="Failed Validation.  Upload skipped.";break;case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:if(this.getStats().files_queued===0){$('#btnStart').attr('disabled',true);}
totalQueueFileSize-=file.size;totalQueueFileCount--;$('#uploadQueueStats .stats').html('К загрузке: '+totalQueueFileCount+plural(totalQueueFileCount,' файл',' файла',' файлов')+'. Всего: '+Math.round((totalQueueFileSize/1024/1024)*100)/100+' мб.')
$('#'+file.id).remove();status="Cancelled";break;case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:status="Stopped";break;default:status="Unhandled Error: "+errorCode;break;}
$('#'+file.id+' .status').html('<span title="'+status+'" class="ui-icon ui-icon-alert"/>');}
function uploadComplete(file){if(this.getStats().files_queued===0){$('#btnStart').attr('disabled',true);}}
function queueComplete(numFilesUploaded){$('#uploadQueueStats .stats').html(numFilesUploaded+plural(numFilesUploaded,' файл',' файла',' файлов')+' загружено');totalQueueFileSize=0;totalQueueFileCount=0;uploadedQueueFileSize=0;if(numFilesUploaded&&this.settings.post_params.parent_id&&!this.settings.debug){window.location.reload(true);}}
function debug(msg){if(this.settings.debug){$('#debug').append('<pre>'+msg+'</pre>');}}
/* site/gallery_new.js */
$(function(){$('.images-operations-chk').change(function(e){$('.image-chk').attr('checked',$(this).attr('checked'));});$('.images-delete').click(function(e){e.preventDefault();$('#images-form').attr('action','/gallerymanager/delete');if($('.image-chk:checked').length==0){alert('Выберите изображения для удаления');}else{if(confirm('Вы действительно хотите удалить '+$('.image-chk:checked').length+plural($('.image-chk:checked').length,' изображение',' изображения',' изображений'))){$('#images-form').submit();}}});$('.images-change-type').click(function(e){e.preventDefault();$('#images-form').attr('action','/gallerymanager/change-type');$('#images-type').val($(this).parent().find('.images-change-type-select').val());if($('.image-chk:checked').length==0){alert('Выберите изображения для смены типа');}else{$('#images-form').submit();}});});
/* site/jquery/jquery.maskedinput-1.1.4.js */
(function($){$.fn.caret=function(begin,end){if(this.length==0)return;if(typeof begin=='number'){end=(typeof end=='number')?end:begin;return this.each(function(){if(this.setSelectionRange){this.focus();this.setSelectionRange(begin,end);}else if(this.createTextRange){var range=this.createTextRange();range.collapse(true);range.moveEnd('character',end);range.moveStart('character',begin);range.select();}});}else{if(this[0].setSelectionRange){begin=this[0].selectionStart;end=this[0].selectionEnd;}else if(document.selection&&document.selection.createRange){var range=document.selection.createRange();begin=0-range.duplicate().moveStart('character',-100000);end=begin+range.text.length;}
return{begin:begin,end:end};}};var charMap={'9':"[0-9]",'a':"[A-Za-z]",'*':"[A-Za-z0-9]"};$.mask={addPlaceholder:function(c,r){charMap[c]=r;}};$.fn.unmask=function(){return this.trigger("unmask");};$.fn.mask=function(mask,settings){settings=$.extend({placeholder:"_",completed:null},settings);var re=new RegExp("^"+
$.map(mask.split(""),function(c,i){return charMap[c]||((/[A-Za-z0-9]/.test(c)?"":"\\")+c);}).join('')+"$");return this.each(function(){var input=$(this);var buffer=new Array(mask.length);var locked=new Array(mask.length);var valid=false;var ignore=false;var firstNonMaskPos=null;$.each(mask.split(""),function(i,c){locked[i]=(charMap[c]==null);buffer[i]=locked[i]?c:settings.placeholder;if(!locked[i]&&firstNonMaskPos==null)
firstNonMaskPos=i;});function focusEvent(){checkVal();writeBuffer();setTimeout(function(){$(input[0]).caret(valid?mask.length:firstNonMaskPos);},0);};function keydownEvent(e){var pos=$(this).caret();var k=e.keyCode;ignore=(k<16||(k>16&&k<32)||(k>32&&k<41));if((pos.begin-pos.end)!=0&&(!ignore||k==8||k==46)){clearBuffer(pos.begin,pos.end);}
if(k==8){while(pos.begin-->=0){if(!locked[pos.begin]){buffer[pos.begin]=settings.placeholder;if($.browser.opera){s=writeBuffer();input.val(s.substring(0,pos.begin)+" "+s.substring(pos.begin));$(this).caret(pos.begin+1);}else{writeBuffer();$(this).caret(Math.max(firstNonMaskPos,pos.begin));}
return false;}}}else if(k==46){clearBuffer(pos.begin,pos.begin+1);writeBuffer();$(this).caret(Math.max(firstNonMaskPos,pos.begin));return false;}else if(k==27){clearBuffer(0,mask.length);writeBuffer();$(this).caret(firstNonMaskPos);return false;}};function keypressEvent(e){if(ignore){ignore=false;return(e.keyCode==8)?false:null;}
e=e||window.event;var k=e.charCode||e.keyCode||e.which;var pos=$(this).caret();if(e.ctrlKey||e.altKey){return true;}else if((k>=41&&k<=122)||k==32||k>186){var p=seekNext(pos.begin-1);if(p<mask.length){if(new RegExp(charMap[mask.charAt(p)]).test(String.fromCharCode(k))){buffer[p]=String.fromCharCode(k);writeBuffer();var next=seekNext(p);$(this).caret(next);if(settings.completed&&next==mask.length)
settings.completed.call(input);}}}
return false;};function clearBuffer(start,end){for(var i=start;i<end&&i<mask.length;i++){if(!locked[i])
buffer[i]=settings.placeholder;}};function writeBuffer(){return input.val(buffer.join('')).val();};function checkVal(){var test=input.val();var pos=firstNonMaskPos;for(var i=0;i<mask.length;i++){if(!locked[i]){buffer[i]=settings.placeholder;while(pos++<test.length){var reChar=new RegExp(charMap[mask.charAt(i)]);if(test.charAt(pos-1).match(reChar)){buffer[i]=test.charAt(pos-1);break;}}}}
var s=writeBuffer();if(!s.match(re)){input.val("");clearBuffer(0,mask.length);valid=false;}else
valid=true;};function seekNext(pos){while(++pos<mask.length){if(!locked[pos])
return pos;}
return mask.length;};input.one("unmask",function(){input.unbind("focus",focusEvent);input.unbind("blur",checkVal);input.unbind("keydown",keydownEvent);input.unbind("keypress",keypressEvent);if($.browser.msie)
this.onpaste=null;else if($.browser.mozilla)
this.removeEventListener('input',checkVal,false);});input.bind("focus",focusEvent);input.bind("blur",checkVal);input.bind("keydown",keydownEvent);input.bind("keypress",keypressEvent);if($.browser.msie)
this.onpaste=function(){setTimeout(checkVal,0);};else if($.browser.mozilla)
this.addEventListener('input',checkVal,false);checkVal();});};})(jQuery);
/* site/jquery/jquery.form.js */
;(function($){$.fn.ajaxSubmit=function(options){if(!this.length){log('ajaxSubmit: skipping submit process - no element selected');return this;}
if(typeof options=='function')
options={success:options};var url=$.trim(this.attr('action'));if(url){url=(url.match(/^([^#]+)/)||[])[1];}
url=url||window.location.href||''
options=$.extend({url:url,type:this.attr('method')||'GET'},options||{});var veto={};this.trigger('form-pre-serialize',[this,options,veto]);if(veto.veto){log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');return this;}
if(options.beforeSerialize&&options.beforeSerialize(this,options)===false){log('ajaxSubmit: submit aborted via beforeSerialize callback');return this;}
var a=this.formToArray(options.semantic);if(options.data){options.extraData=options.data;for(var n in options.data){if(options.data[n]instanceof Array){for(var k in options.data[n])
a.push({name:n,value:options.data[n][k]});}
else
a.push({name:n,value:options.data[n]});}}
if(options.beforeSubmit&&options.beforeSubmit(a,this,options)===false){log('ajaxSubmit: submit aborted via beforeSubmit callback');return this;}
this.trigger('form-submit-validate',[a,this,options,veto]);if(veto.veto){log('ajaxSubmit: submit vetoed via form-submit-validate trigger');return this;}
var q=$.param(a);if(options.type.toUpperCase()=='GET'){options.url+=(options.url.indexOf('?')>=0?'&':'?')+q;options.data=null;}
else
options.data=q;var $form=this,callbacks=[];if(options.resetForm)callbacks.push(function(){$form.resetForm();});if(options.clearForm)callbacks.push(function(){$form.clearForm();});if(!options.dataType&&options.target){var oldSuccess=options.success||function(){};callbacks.push(function(data){$(options.target).html(data).each(oldSuccess,arguments);});}
else if(options.success)
callbacks.push(options.success);options.success=function(data,status){for(var i=0,max=callbacks.length;i<max;i++)
callbacks[i].apply(options,[data,status,$form]);};var files=$('input:file',this).fieldValue();var found=false;for(var j=0;j<files.length;j++)
if(files[j])
found=true;var multipart=false;if(options.iframe||found||multipart){if(options.closeKeepAlive)
$.get(options.closeKeepAlive,fileUpload);else
fileUpload();}
else
$.ajax(options);this.trigger('form-submit-notify',[this,options]);return this;function fileUpload(){var form=$form[0];if($(':input[name=submit]',form).length){alert('Error: Form elements must not be named "submit".');return;}
var opts=$.extend({},$.ajaxSettings,options);var s=$.extend(true,{},$.extend(true,{},$.ajaxSettings),opts);var id='jqFormIO'+(new Date().getTime());var $io=$('<iframe id="'+id+'" name="'+id+'" src="about:blank" />');var io=$io[0];$io.css({position:'absolute',top:'-1000px',left:'-1000px'});var xhr={aborted:0,responseText:null,responseXML:null,status:0,statusText:'n/a',getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(){this.aborted=1;$io.attr('src','about:blank');}};var g=opts.global;if(g&&!$.active++)$.event.trigger("ajaxStart");if(g)$.event.trigger("ajaxSend",[xhr,opts]);if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&$.active--;return;}
if(xhr.aborted)
return;var cbInvoked=0;var timedOut=0;var sub=form.clk;if(sub){var n=sub.name;if(n&&!sub.disabled){options.extraData=options.extraData||{};options.extraData[n]=sub.value;if(sub.type=="image"){options.extraData[name+'.x']=form.clk_x;options.extraData[name+'.y']=form.clk_y;}}}
setTimeout(function(){var t=$form.attr('target'),a=$form.attr('action');form.setAttribute('target',id);if(form.getAttribute('method')!='POST')
form.setAttribute('method','POST');if(form.getAttribute('action')!=opts.url)
form.setAttribute('action',opts.url);if(!options.skipEncodingOverride){$form.attr({encoding:'multipart/form-data',enctype:'multipart/form-data'});}
if(opts.timeout)
setTimeout(function(){timedOut=true;cb();},opts.timeout);var extraInputs=[];try{if(options.extraData)
for(var n in options.extraData)
extraInputs.push($('<input type="hidden" name="'+n+'" value="'+options.extraData[n]+'" />').appendTo(form)[0]);$io.appendTo('body');io.attachEvent?io.attachEvent('onload',cb):io.addEventListener('load',cb,false);form.submit();}
finally{form.setAttribute('action',a);t?form.setAttribute('target',t):$form.removeAttr('target');$(extraInputs).remove();}},10);var nullCheckFlag=0;function cb(){if(cbInvoked++)return;io.detachEvent?io.detachEvent('onload',cb):io.removeEventListener('load',cb,false);var ok=true;try{if(timedOut)throw'timeout';var data,doc;doc=io.contentWindow?io.contentWindow.document:io.contentDocument?io.contentDocument:io.document;if((doc.body==null||doc.body.innerHTML=='')&&!nullCheckFlag){nullCheckFlag=1;cbInvoked--;setTimeout(cb,100);return;}
xhr.responseText=doc.body?doc.body.innerHTML:null;xhr.responseXML=doc.XMLDocument?doc.XMLDocument:doc;xhr.getResponseHeader=function(header){var headers={'content-type':opts.dataType};return headers[header];};if(opts.dataType=='json'||opts.dataType=='script'){var ta=doc.getElementsByTagName('textarea')[0];xhr.responseText=ta?ta.value:xhr.responseText;}
else if(opts.dataType=='xml'&&!xhr.responseXML&&xhr.responseText!=null){xhr.responseXML=toXml(xhr.responseText);}
data=$.httpData(xhr,opts.dataType);}
catch(e){ok=false;$.handleError(opts,xhr,'error',e);}
if(ok){opts.success(data,'success');if(g)$.event.trigger("ajaxSuccess",[xhr,opts]);}
if(g)$.event.trigger("ajaxComplete",[xhr,opts]);if(g&&!--$.active)$.event.trigger("ajaxStop");if(opts.complete)opts.complete(xhr,ok?'success':'error');setTimeout(function(){$io.remove();xhr.responseXML=null;},100);};function toXml(s,doc){if(window.ActiveXObject){doc=new ActiveXObject('Microsoft.XMLDOM');doc.async='false';doc.loadXML(s);}
else
doc=(new DOMParser()).parseFromString(s,'text/xml');return(doc&&doc.documentElement&&doc.documentElement.tagName!='parsererror')?doc:null;};};};$.fn.ajaxForm=function(options){return this.ajaxFormUnbind().bind('submit.form-plugin',function(){$(this).ajaxSubmit(options);return false;}).each(function(){$(":submit,input:image",this).bind('click.form-plugin',function(e){var form=this.form;form.clk=this;if(this.type=='image'){if(e.offsetX!=undefined){form.clk_x=e.offsetX;form.clk_y=e.offsetY;}else if(typeof $.fn.offset=='function'){var offset=$(this).offset();form.clk_x=e.pageX-offset.left;form.clk_y=e.pageY-offset.top;}else{form.clk_x=e.pageX-this.offsetLeft;form.clk_y=e.pageY-this.offsetTop;}}
setTimeout(function(){form.clk=form.clk_x=form.clk_y=null;},10);});});};$.fn.ajaxFormUnbind=function(){this.unbind('submit.form-plugin');return this.each(function(){$(":submit,input:image",this).unbind('click.form-plugin');});};$.fn.formToArray=function(semantic){var a=[];if(this.length==0)return a;var form=this[0];var els=semantic?form.getElementsByTagName('*'):form.elements;if(!els)return a;for(var i=0,max=els.length;i<max;i++){var el=els[i];var n=el.name;if(!n)continue;if(semantic&&form.clk&&el.type=="image"){if(!el.disabled&&form.clk==el){a.push({name:n,value:$(el).val()});a.push({name:n+'.x',value:form.clk_x},{name:n+'.y',value:form.clk_y});}
continue;}
var v=$.fieldValue(el,true);if(v&&v.constructor==Array){for(var j=0,jmax=v.length;j<jmax;j++)
a.push({name:n,value:v[j]});}
else if(v!==null&&typeof v!='undefined')
a.push({name:n,value:v});}
if(!semantic&&form.clk){var $input=$(form.clk),input=$input[0],n=input.name;if(n&&!input.disabled&&input.type=='image'){a.push({name:n,value:$input.val()});a.push({name:n+'.x',value:form.clk_x},{name:n+'.y',value:form.clk_y});}}
return a;};$.fn.formSerialize=function(semantic){return $.param(this.formToArray(semantic));};$.fn.fieldSerialize=function(successful){var a=[];this.each(function(){var n=this.name;if(!n)return;var v=$.fieldValue(this,successful);if(v&&v.constructor==Array){for(var i=0,max=v.length;i<max;i++)
a.push({name:n,value:v[i]});}
else if(v!==null&&typeof v!='undefined')
a.push({name:this.name,value:v});});return $.param(a);};$.fn.fieldValue=function(successful){for(var val=[],i=0,max=this.length;i<max;i++){var el=this[i];var v=$.fieldValue(el,successful);if(v===null||typeof v=='undefined'||(v.constructor==Array&&!v.length))
continue;v.constructor==Array?$.merge(val,v):val.push(v);}
return val;};$.fieldValue=function(el,successful){var n=el.name,t=el.type,tag=el.tagName.toLowerCase();if(typeof successful=='undefined')successful=true;if(successful&&(!n||el.disabled||t=='reset'||t=='button'||(t=='checkbox'||t=='radio')&&!el.checked||(t=='submit'||t=='image')&&el.form&&el.form.clk!=el||tag=='select'&&el.selectedIndex==-1))
return null;if(tag=='select'){var index=el.selectedIndex;if(index<0)return null;var a=[],ops=el.options;var one=(t=='select-one');var max=(one?index+1:ops.length);for(var i=(one?index:0);i<max;i++){var op=ops[i];if(op.selected){var v=op.value;if(!v)
v=(op.attributes&&op.attributes['value']&&!(op.attributes['value'].specified))?op.text:op.value;if(one)return v;a.push(v);}}
return a;}
return el.value;};$.fn.clearForm=function(){return this.each(function(){$('input,select,textarea',this).clearFields();});};$.fn.clearFields=$.fn.clearInputs=function(){return this.each(function(){var t=this.type,tag=this.tagName.toLowerCase();if(t=='text'||t=='password'||tag=='textarea')
this.value='';else if(t=='checkbox'||t=='radio')
this.checked=false;else if(tag=='select')
this.selectedIndex=-1;});};$.fn.resetForm=function(){return this.each(function(){if(typeof this.reset=='function'||(typeof this.reset=='object'&&!this.reset.nodeType))
this.reset();});};$.fn.enable=function(b){if(b==undefined)b=true;return this.each(function(){this.disabled=!b;});};$.fn.selected=function(select){if(select==undefined)select=true;return this.each(function(){var t=this.type;if(t=='checkbox'||t=='radio')
this.checked=select;else if(this.tagName.toLowerCase()=='option'){var $sel=$(this).parent('select');if(select&&$sel[0]&&$sel[0].type=='select-one'){$sel.find('option').selected(false);}
this.selected=select;}});};function log(){if($.fn.ajaxSubmit.debug&&window.console&&window.console.log)
window.console.log('[jquery.form] '+Array.prototype.join.call(arguments,''));};})(jQuery);
/* site/offers.js */
$(function(){$("#offer_form input[type=submit]").click(function(){var cur=$(this);cur.after('<img style="margin: 15px 0" src="http://static.weburg.ru/img/js//preload.gif" width="70" height="10" alt="идет загрузка…" id="sending"/>');cur.hide();$("#offer_form").submit();});if($("#offer_form #attention").length>0){$("#offer_form #attention").qtip({content:{prerender:true,text:' Администрация портала оставляет за собой право удалять без уведомления информацию, содержащую порнографию, расовую межнациональную или религиозную рознь и экстремизм.<br>Обращаем ваше внимание, что некоторые произведения могут являться объектами авторского права. Администрация портала оставляет за собой право удалить информацию о фильме в случае обращения правообладателей'},hide:false,style:{tip:false,width:600,name:'green',border:{radius:5}},position:{corner:{tooltip:'bottomRight',target:'topRight'},adjust:{y:110}}});$("#offer_form #attention").qtip('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;});});
