$(function(){if(swfobject.hasFlashPlayerVersion("6.0.0")){$('#gallery-loading').addClass('flash').html('<div id="gallery-loading-flash"></div>');swfobject.embedSWF("/assets/flash/gallery-loading.swf","gallery-loading-flash","40","40","9.0.0",null,{},{wmode:"transparent"});}else{$('#gallery-loading').addClass('noflash');}
var array=location.pathname.split('/');var idGallery=array[2];var photo;var photos;$.ajax({url:'/galleries/photos/',type:'POST',data:{idGallery:idGallery},dataType:'json',success:function(r){photos=r;$('#gallery-next, #gallery-previous').show();load_photo(0);}});$("#image").bind('click',next_photo);$("#gallery-next").bind('click',next_photo);$("#gallery-previous").bind('click',previous_photo);function next_photo(){if((photo+1)==photos.length){load_photo(0);}else{load_photo(photo+1);}}
function previous_photo(){if((photo-1)==-1){load_photo(photos.length-1);}else{load_photo(photo-1);}}
function load_photo(n){$('#gallery-loading').show();photo=n;var record=photos[n];$('#image img').attr('src',record.photo.url).load(function(){$('#image').css({width:record.photo.width+'px',height:record.photo.height+'px',backgroundImage:'url('+record.photo.url+')'});$('#photo').css({width:(record.photo.width+14)+'px',marginLeft:'-'+((record.photo.width+14)/2)+'px',display:'inline'}).show();$('#description').html(record.sDescription);$('#gallery-loading').hide();});}});;$(function(){var t;var menu=$('#submenu .container');var scrollPosition=menu.attr('scrollPosition');menu.scrollTop(scrollPosition);$("#gallery-down").hover(function(){t=setInterval(function(){menu.scrollTop(menu.scrollTop()+3)},20);$(this).addClass('hover');},function(){clearInterval(t);$(this).removeClass('hover');$.ajax({url:'/galleries/save-scroll/',type:'POST',data:{scrollPosition:menu.scrollTop()}});});$("#gallery-up").hover(function(){t=setInterval(function(){menu.scrollTop(menu.scrollTop()-3)},20);$(this).addClass('hover');},function(){clearInterval(t);$(this).removeClass('hover');$.ajax({url:'/galleries/save-scroll/',type:'POST',data:{scrollPosition:menu.scrollTop()}});});});