$(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 photo;var photos;$("#image").bind('click',next_photo);$("#gallery-next").bind('click',next_photo);$("#gallery-previous").bind('click',previous_photo);$("input").keydown(function(e){if(e.keyCode==13){var sKeyword=$(this).val();if(sKeyword.length){$.ajax({url:'/galleries/keyword-search/',type:'POST',data:{sKeyword:sKeyword},dataType:'json',success:function(r){if(r==null){$('#description .search-results').html('Sorry, no photos were found with that criteria.');$('#photo, #gallery-next, #gallery-previous').hide();$('#description span').empty();}else{photos=r;var message=(photos.length==1)?'1 picture found. Click the arrows to browse through them.':photos.length+' pictures found. Click the arrows to browse through them.';$('#description .search-results').html(message);$('#gallery-next, #gallery-previous').show();$('#gallery-search-message').hide();load_photo(0);}}});}else{$('#description .search-results').html('Type a keyword in this field and press enter to search.');$('#photo, #gallery-next, #gallery-previous').hide();$('#gallery-search-message').show();$('#description span').empty();}
return false;}});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();$('.search-desc').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()}});});});