var THUMB_opacity=0.2;var THUMB_height=33;var THUMB_HOVER_fadeInSpeed='fast';var THUMB_HOVER_fadeOutSpeed='fast';var THUMB_SELECT_fadeInSpeed=600;var THUMB_SELECT_fadeOutSpeed=300;var FULL_fadeInSpeed=1000;var PAGE_speed=600;var CATEGORY_SELECT_fadeInSpeed='slow';var SLIDESHOW_delay=10000;var SLIDESHOW_enabled=true;var SLIDESHOW_random=true;var keyUp;var onPhotoPage=true;var ONLOAD_random=false;var IMAGES=new Array();function loadXml()
{$.ajax({type:"GET",url:"images.xml",dataType:"xml",success:parseXml});}
function parseXml(xml)
{$(xml).find("image").each(function()
{IMAGES.push($(this).find("id").text()+"\t"+
$(this).find("title").text()+"\t"+
$(this).find("description").text()+"\t"+
$(this).parent().attr("name"));});buildThumbs();}
function css()
{if($.browser.mozilla==true)
{}
$("div#thumbs").attr("style","height: "+THUMB_height+";");$("#music-link").fadeTo(0,0.1);}
function buildThumbs()
{for(var i=0;i<IMAGES.length;i++)
{var image=IMAGES[i].split("\t");var id=encodeURI(image[0]);var title=image[1];var description=image[2];var category=image[3];var categoryId=image[3].replace(/ /g,"");var categoryExists=false;var imgSrc="img/f/"+id+".jpg";var spanId=categoryId+'-'+id;var imgId='img_'+categoryId+'-'+id;if(id.split("http://").length==2)
imgSrc=id;$("div#menu").children().each(function()
{if(categoryId==$(this).attr("id"))
{categoryExists=true;return false;}});if(!categoryExists)
{$("div#menu").append('<div id="'+categoryId+'" class="category">'+category+'</div>');$("div#thumbs").append('<div id="thumbs_'+categoryId+'" style="display: none"></div>');}
$("div#thumbs_"+categoryId).append('<span id="'+spanId+'" class="thumb"><img src="" height="'
+THUMB_height+'" class="thumb" id="'+imgId+'"></span>');preload(imgId,imgSrc);}
if(ONLOAD_random)
selectRandomImage();else
selectCategory(IMAGES[0].split("\t")[3].replace(/ /g,""));}
function selectCategory(category,selectedImg)
{var curCategory=$("div#thumbs").find(".selected").attr("id");if(curCategory==("thumbs_"+category))
return;$("div#thumbs").children("div").each(function()
{$(this).fadeOut(0);$(this).removeClass("selected");var cat=$(this).attr("id").split("_")[1];$("div#"+cat).removeClass("selected");$("div#"+cat).animate({marginTop:'0',marginBottom:'0'},50,function(){});});$("div#thumbs_"+category).fadeIn(CATEGORY_SELECT_fadeInSpeed);$("div#thumbs_"+category).addClass("selected");$("div#"+category).addClass("selected");$("div#"+category).animate({marginTop:'1em',marginBottom:'1em'},150,function(){});if(selectedImg==null)
selectedImg=$("div#thumbs_"+category+" span:first-child").attr("id");selectImage(selectedImg,true);}
function selectImage(id,bypassStop)
{if($("span#"+id).hasClass("selected"))
return;$("div#thumbs").children().children("span").each(function()
{$(this).fadeTo(THUMB_SELECT_fadeOutSpeed,THUMB_opacity);$(this).removeClass("selected");});if(bypassStop)
$("span#"+id).hide().fadeTo(THUMB_SELECT_fadeInSpeed,1);else
$("span#"+id).stop().fadeTo(THUMB_SELECT_fadeInSpeed,1);$("span#"+id).addClass("selected");showFull(id.split("-")[1]);}
function showFull(id)
{var imgSrc="img/f/"+id+".jpg";var title;var description;if(id.split("http://").length==2)
imgSrc=id;preload('full',imgSrc,FULL_fadeInSpeed);for(var i=0;i<IMAGES.length;i++)
{var image=IMAGES[i].split("\t");if(image[0]==id)
{break;}}
title=IMAGES[i].split("\t")[1];description=IMAGES[i].split("\t")[2];description=description.replace(/f\//g,'<span class="aperture">f</span>/');description=description.replace(/\n/g,"<br>");$("div#info").slideUp('fast',function()
{$("div#title").text(title);$("div#description").html(description);$("div#info").slideDown('fast');});}
function crossFade()
{}
function slideShow()
{if(!SLIDESHOW_enabled)
return;if(SLIDESHOW_random)
{var rand=Math.floor(Math.random()*IMAGES.length);var category=IMAGES[rand].split("\t")[3].replace(/ /g,"");var id=IMAGES[rand].split("\t")[0];while($('span#'+category+"-"+id).hasClass("selected"))
{rand=Math.floor(Math.random()*IMAGES.length);category=IMAGES[rand].split("\t")[3].replace(/ /g,"");id=IMAGES[rand].split("\t")[0];}
selectCategory(category,category+"-"+id);}
else
{}}
function preload(img,src,fadeInSpeed)
{if(fadeInSpeed=="")
fadeInSpeed="slow";$('img#'+img).hide().attr("src",src).one("load",function()
{$(this).fadeIn(fadeInSpeed);setTimeout(function()
{},100)}).each(function()
{if(this.complete)
{$(this).trigger("load");}});}
function selectPrevImage()
{var i=0;$('div#thumbs').find("div").children("span").each(function()
{if($(this).hasClass("selected"))
return false;else
i++;});if(i==0)
i=IMAGES.length;var category=IMAGES[i-1].split("\t")[3].replace(/ /g,"");var id=category+"-"+IMAGES[i-1].split("\t")[0];var curCategory=$("div#thumbs").find(".selected").attr("id").split("_")[1];if(curCategory!=category)
selectCategory(category,id);else
selectImage(id);}
function selectNextImage()
{var i=0;$('div#thumbs').find("div").children("span").each(function()
{if($(this).hasClass("selected"))
return false;else
i++;});if(i==IMAGES.length-1)
i=-1;var category=IMAGES[i+1].split("\t")[3].replace(/ /g,"");;var id=category+"-"+IMAGES[i+1].split("\t")[0];var curCategory=$("div#thumbs").find(".selected").attr("id").split("_")[1];if(curCategory!=category)
selectCategory(category,id);else
selectImage(id);}
eval(function(p,a,c,k,e,r){e=function(c){return c.toString(a)};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('6 7(){1(f.g==2){4 5}}6 8(e){1(0.9||0.a&&!0.b){1(e.c==2||e.c==3){4 5}}}1(0.9){0.h(i.j);0.d=8}k 1(0.b&&!0.a){0.d=7}0.l=m n("4 5")',24,24,'document|if|||return|false|function|clickIE4|clickNS4|layers|getElementById|all|which|onmousedown||event|button|captureEvents|Event|MOUSEDOWN|else|oncontextmenu|new|Function'.split('|'),0,{}));
function selectPrevGallery()
{$('div#thumbs').find("div").each(function()
{if($(this).hasClass("selected"))
{var category=$(this).prev().attr("id").split("_")[1];selectCategory(category);return false;}});}
function selectNextGallery()
{$('div#thumbs').find("div").each(function()
{if($(this).hasClass("selected"))
{var category=$(this).next().attr("id").split("_")[1];selectCategory(category);return false;}});}
function selectRandomImage()
{var rand=Math.floor(Math.random()*IMAGES.length);var category=IMAGES[rand].split("\t")[3].replace(/ /g,"");var id=IMAGES[rand].split("\t")[0];while($('span#'+category+"-"+id).hasClass("selected"))
{rand=Math.floor(Math.random()*IMAGES.length);category=IMAGES[rand].split("\t")[3].replace(/ /g,"");id=IMAGES[rand].split("\t")[0];}
selectCategory(category,category+"-"+id);}
function centerPage()
{}
jQuery.fn.center=function(){this.css("position","absolute");this.css("top",(($(window).height()-this.outerHeight())/2)+$(window).scrollTop()+"px");this.css("left",(($(window).width()-this.outerWidth())/2)+$(window).scrollLeft()+"px");return this;}
function selectLink(link)
{$("div#links").children().each(function()
{$(this).removeClass("selected");if($(this).attr("href")=="#"+link)
{$(this).addClass("selected");document.title=$(this).attr("name");var ml='1.5em';if($(this).index()==0)
ml=0;$(this).animate({marginLeft:ml,marginRight:'1.5em'},150,function(){});}
else
{var ml='.5em';if($(this).index()==0)
ml=0;$(this).animate({marginLeft:ml,marginRight:'.5em'},150,function(){});}});if(link=="photos"||link=="")
{$('tr.content').fadeOut(PAGE_speed);$('tr.photos').delay(PAGE_speed+25).fadeIn(PAGE_speed);onPhotoPage=true;}
else
{$('div#content').hide().html("");$('div#content').load('pages/'+link+'.html',function()
{$("div#content").children("h2").each(function(){$(this).attr("style","margin-top: 2em;");});$("div#content").children("h2:first").attr("style","margin-top: 0px;");$('tr.photos').fadeOut(PAGE_speed);$('tr.content').show();$(this).delay(PAGE_speed+25).slideDown(PAGE_speed);});onPhotoPage=false;}}
$(document).ready(function()
{$('#body').fadeIn(1500);loadXml();if(!window.location.hash)
selectLink("photos");else
selectLink(window.location.hash.replace("#",""));setInterval(slideShow,SLIDESHOW_delay);crossFade();css();fdsaj(document.body);$('a').live('click',function()
{var id=this.hash.replace('#','');selectLink(id);});$(window).unload(function()
{});$(window).hashchange(function()
{var hash=window.location.hash;if(hash=="")
window.location="#photos";});$('div.category').live('click',function()
{SLIDESHOW_enabled=false;selectCategory($(this).attr("id"));});$('span.thumb').live('click',function()
{SLIDESHOW_enabled=false;selectImage($(this).attr("id"));});$("span.thumb").live('mouseenter',function()
{if(!$(this).hasClass("selected"))
$(this).stop().fadeTo(THUMB_HOVER_fadeInSpeed,1);});$("span.thumb").live('mouseleave',function()
{if(!$(this).hasClass("selected"))
$(this).stop().fadeTo(THUMB_HOVER_fadeOutSpeed,THUMB_opacity);});$(document).keyup(function(e)
{if(onPhotoPage)
{keyUp=true;}});$(document).keydown(function(e)
{if(onPhotoPage)
{if(keyUp==false)
return false;keyUp=false;if(e.keyCode==37)
{SLIDESHOW_enabled=false;selectPrevImage();return false;}
else if(e.keyCode==39)
{SLIDESHOW_enabled=false;selectNextImage();return false;}
else if(e.keyCode==38)
{SLIDESHOW_enabled=false;selectPrevGallery();return false;}
else if(e.keyCode==40)
{SLIDESHOW_enabled=false;selectNextGallery();return false;}
else if(e.keyCode==13)
{SLIDESHOW_enabled=false;selectRandomImage();return false;}
else
{}}});$('a.link').click(function()
{var selectedLink=$(this).attr("href").replace("#","");selectLink(selectedLink);});$("#music-link").live('mouseenter',function()
{$(this).stop().fadeTo(THUMB_HOVER_fadeInSpeed,1);});$("#music-link").live('mouseleave',function()
{$(this).stop().fadeTo(THUMB_HOVER_fadeOutSpeed,0.1);});});function fdsaj(target){if(typeof target.onselectstart!="undefined")
target.onselectstart=function(){return false}
else if(typeof target.style.MozUserSelect!="undefined")
target.style.MozUserSelect="none"
else
target.onmousedown=function(){return false}
target.style.cursor="default"}
