
(function($){$.Ui_Helper={init:function(options){$('.js').removeClass('hide');$('.no-js').addClass('hide');$('.photo-arrow-left, .photo-arrow-right').click(function(e){var url=$(this).attr('href');e.preventDefault();$.Ui_Helper.changeGalleryImg(url);});$.Ui_Helper.checkDownloadCookie();if($('#promoribbons').length>0)
this.promoribbons.init();},changeGalleryImg:function(url){$.ajax({url:url+'&json=true',dataType:'JSON',context:document.body,success:function(request_result){var photo_caption=null;var photo_credit=null;var photo_placeholder=$('.photo-placeholder');if(request_result.image_caption!==null){photo_caption=request_result.image_caption[0];}
if(request_result.image_credit!==null){photo_credit='<p>'+request_result.image_credit+'</p>';}
$('.photo-caption .photo-caption-text').html(photo_caption+photo_credit);$('.photo-info .left').html(request_result.gallery_info);photo_placeholder.fadeOut('slow',function(){photo_placeholder.css("background-image","url("
+request_result.image_path+")");photo_placeholder.css("height",request_result.image_height);photo_placeholder.fadeIn('slow');$('.photo-arrow-left').attr('href',request_result.previous_image);$('.photo-arrow-right').attr('href',request_result.next_image);});}});},toggle_comments:function(lang){if($('#disqus_thread').css('display')=='none'){$('#disqus_control #control_link').html(lang.hide);$('#disqus_thread').show();}else{$('#disqus_thread').hide();$('#disqus_control #control_link').html(lang.show);}},checkDownloadCookie:function(){if(typeof $('.device_download')!='undefined'&&this.getCookie('hide_download')==1){$('.device_download').hide();}},setCookie:function(c_name,value,exdays){var exdate=new Date();exdate.setDate(exdate.getDate()+exdays);var c_value=escape(value)
+((exdays==null)?"":"; expires="
+exdate.toUTCString());document.cookie=c_name+"="+c_value;},getCookie:function(c_name){var i,x,y,ARRcookies=document.cookie.split(";");for(i=0;i<ARRcookies.length;i++){x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);x=x.replace(/^\s+|\s+$/g,"");if(x==c_name){return unescape(y);}}},promoribbons:{total_items:0,current_slide:0,number_of_items_per_slide:3,init:function(){this.total_items=$('#promoribbons-list').data('total');this.number_of_items_per_slide=$('#promoribbons-list').data('mode');$('#promoribbons #promoribbons-arrow-next a').click(function(){$.Ui_Helper.promoribbons.next();return false;});$('#promoribbons #promoribbons-arrow-previous a').click(function(){$.Ui_Helper.promoribbons.previous();return false;});},next:function(){this.hideItems();this.current_slide++;this.showItems();if((this.current_slide*this.number_of_items_per_slide)+4>this.total_items)
$('#promoribbons #promoribbons-arrow-next a').hide();$('#promoribbons #promoribbons-arrow-previous a').show();},previous:function(){this.hideItems();this.current_slide--;this.showItems();if(this.current_slide==0)
$('#promoribbons #promoribbons-arrow-previous a').hide();$('#promoribbons #promoribbons-arrow-next a').show();},showItems:function(){var start=this.current_slide*this.number_of_items_per_slide;$('#promoribbons .item'+(start)).show();$('#promoribbons .item'+(start+1)).show();if(this.number_of_items_per_slide==3)
$('#promoribbons .item'+(start+2)).show();},hideItems:function(){var start=this.current_slide*this.number_of_items_per_slide;$('#promoribbons .item'+(start)).hide();$('#promoribbons .item'+(start+1)).hide();if(this.number_of_items_per_slide==3)
$('#promoribbons .item'+(start+2)).hide();}}};})(jQuery);$(document).ready(function(){$.Ui_Helper.init();});
