var http_request=false;function macheRequest(url){http_request=false;if(window.XMLHttpRequest){http_request=new XMLHttpRequest();}else if(window.ActiveXObject){try{http_request=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{http_request=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}}
if(!http_request){alert('Ende :( Kann keine XMLHTTP-Instanz erzeugen');return false;}
http_request.open('GET',url,true);http_request.onreadystatechange=alertInhalt;http_request.send(null);}
function alertInhalt(){if(http_request.readyState==4){var answer=http_request.responseText;if(document.getElementById("time")){if(document.getElementById("time").innerHTML!=answer){document.getElementById("time").innerHTML=answer;}
else{document.getElementById("time").innerHTML="";}}}}
function startTimer(){setInterval("macheRequest('time.php')",1000);}
function setTitle(){for(var i=1;i<=10;i++){if(document.getElementById('content_'+i+'_vscrollerbaseend')){var elem=document.getElementById('content_'+i+'_vscrollerbaseend');elem.setAttribute('title','nach oben');elem.setAttribute('class','vscrollerbaseend scrollgeneric scrollbartitle');}else{}}
$$(".scrollbartitle").each(function(input){new Tooltip(input,{backgroundColor:"#fcfbdc",borderColor:"#a6937c",textColor:"#a6937c",textShadowColor:"#dcdbb7"});});}
function fadeAll(){page=1;if(page!=1){if($('menu_1_active')){Effect.Fade('menu_1_active',{duration:0.0});}}
if(page!=2){if($('menu_2_active')){Effect.Fade('menu_2_active',{duration:0.0});}}
if(page!=3){if($('menu_3_active')){Effect.Fade('menu_3_active',{duration:0.0});}}
if(page!=4){if($('menu_4_active')){Effect.Fade('menu_4_active',{duration:0.0});}}
if(page!=5){if($('menu_5_active')){Effect.Fade('menu_5_active',{duration:0.0});}}
if(page!=6){if($('menu_6_active')){Effect.Fade('menu_6_active',{duration:0.0});}}
if(page!=7){if($('menu_7_active')){Effect.Fade('menu_7_active',{duration:0.0});}}
if(page!=1){if($('content_1')){Effect.Fade('content_1',{duration:0.0});}}
if(page!=2){if($('content_2')){Effect.Fade('content_2',{duration:0.0});}}
if(page!=7){if($('content_7')){Effect.Fade('content_7',{duration:0.0});}}
if(page!=3){if($('content_3')){Effect.Fade('content_3',{duration:0.0});}}
if(page!=4){if($('content_4')){Effect.Fade('content_4',{duration:0.0});}}
if(page!=5){if($('content_5')){Effect.Fade('content_5',{duration:0.0});}}
if(page!=6){if($('content_6')){Effect.Fade('content_6',{duration:0.0});}}
if(page==1){document.getElementById('breadcrumb').innerHTML='work';}
if(page==2){document.getElementById('breadcrumb').innerHTML='about me';}
if(page==3){document.getElementById('breadcrumb').innerHTML='delicious';}
if(page==4){document.getElementById('breadcrumb').innerHTML='twitter';}
if(page==5){document.getElementById('breadcrumb').innerHTML='last.fm';}
if(page==6){document.getElementById('breadcrumb').innerHTML='imprint';}
if(page==7){document.getElementById('breadcrumb').innerHTML='contact';}}
function quitLoading(){new Lightbox();if($('loading_1')){Effect.Fade('loading_1',{duration:0.2,afterFinish:function(){start_flash_detection();}});}
if($('loading_2')){Effect.Fade('loading_2',{duration:0.2,afterFinish:function(){start_flash_detection();}});}
if($('loading_3')){Effect.Fade('loading_3',{duration:0.2,afterFinish:function(){start_flash_detection();}});}
if($('loading_4')){Effect.Fade('loading_4',{duration:0.2,afterFinish:function(){start_flash_detection();}});}
if($('loading_5')){Effect.Fade('loading_5',{duration:0.2,afterFinish:function(){start_flash_detection();}});}
if($('loading_6')){Effect.Fade('loading_6',{duration:0.2,afterFinish:function(){start_flash_detection();}});}}
function flash_detection(required,max)
{var required_version=required;var max_version=max;var available_version=0;if(typeof(navigator.plugins["Shockwave Flash"])=="object")
{var description=navigator.plugins["Shockwave Flash"].description;available_version=description.substr(16,(description.indexOf(".",16)-16));}
else if(typeof(ActiveXObject)=="function")
{for(var i=2;i<(max_version+1);i++)
{try
{if(typeof(new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i))=="object")
{available_version=i;}}
catch(error)
{}}}
return[available_version,required_version];}
function start_flash_detection(){var result=flash_detection(7,99);if(!result[0])
{document.getElementById('logo').innerHTML='<a style="cursor:pointer;" onclick="showContent(2);"><img src="media/logo_noflash.png" id="logo_noflash" style="display:none;" alt="logo" /></a>';Effect.Appear('logo_noflash',{duration:1.0});}
else if(result[0]<result[1])
{document.getElementById('logo').innerHTML='<a style="cursor:pointer;" onclick="showContent(2);"><img src="media/logo_noflash.png" id="logo_noflash" style="display:none;" alt="logo" /></a>';Effect.Appear('logo_noflash',{duration:1.0});}
else
{document.getElementById('logo').innerHTML='<object width="200" height="200" data="media/logo.swf" menu="false" type="application/x-shockwave-flash"><param name="movie" value="media/logo.swf" /><param name="wmode" value="transparent" /></object>';}}
function filenameStrip(){var deliciousPosts=document.getElementsByClassName('delicious-link');for(var i=15;i<deliciousPosts.length;i++){if(deliciousPosts[i].innerHTML.length>38){deliciousPosts[i].innerHTML=deliciousPosts[i].innerHTML.substr(0,38)+'...';}}
var lastfmPosts=document.getElementsByClassName('active_inactive');for(var i=0;i<lastfmPosts.length;i++){if(lastfmPosts[i].innerHTML.length>45){lastfmPosts[i].innerHTML=lastfmPosts[i].innerHTML.substr(0,45)+'...';}}
var countBookmarks=document.getElementsByClassName('delicious-network-itemcount');countBookmark=countBookmarks[0].innerHTML.replace('I have <strong>','');countBookmark=countBookmark.replace('</strong> <a href="http://delicious.com/vielhuber">bookmarks</a>',' bookmarks in total');countBookmarks[0].innerHTML=countBookmark;}
function showContent(x){if(x!=1&&document.getElementById('breadcrumb').innerHTML=='work'){Effect.Fade('menu_1_active',{duration:0.2});Effect.Fade('breadcrumb',{duration:0.2});Effect.Fade('separation_line',{duration:0.2});window.setTimeout(function(){Effect.Appear('separation_line',{duration:0.2});},250);}
if(x!=2&&document.getElementById('breadcrumb').innerHTML=='about me'){Effect.Fade('menu_2_active',{duration:0.2});Effect.Fade('breadcrumb',{duration:0.2});Effect.Fade('separation_line',{duration:0.2});window.setTimeout(function(){Effect.Appear('separation_line',{duration:0.2});},250);}
if(x!=3&&document.getElementById('breadcrumb').innerHTML=='delicious'){Effect.Fade('menu_3_active',{duration:0.2});Effect.Fade('breadcrumb',{duration:0.2});Effect.Fade('separation_line',{duration:0.2});window.setTimeout(function(){Effect.Appear('separation_line',{duration:0.2});},250);}
if(x!=4&&document.getElementById('breadcrumb').innerHTML=='twitter'){Effect.Fade('menu_4_active',{duration:0.2});Effect.Fade('breadcrumb',{duration:0.2});Effect.Fade('separation_line',{duration:0.2});window.setTimeout(function(){Effect.Appear('separation_line',{duration:0.2});},250);}
if(x!=5&&document.getElementById('breadcrumb').innerHTML=='last.fm'){Effect.Fade('menu_5_active',{duration:0.2});Effect.Fade('breadcrumb',{duration:0.2});Effect.Fade('separation_line',{duration:0.2});window.setTimeout(function(){Effect.Appear('separation_line',{duration:0.2});},250);}
if(x!=7&&document.getElementById('breadcrumb').innerHTML=='contact'){Effect.Fade('menu_7_active',{duration:0.2});Effect.Fade('breadcrumb',{duration:0.2});Effect.Fade('separation_line',{duration:0.2});window.setTimeout(function(){Effect.Appear('separation_line',{duration:0.2});},250);}
if(x!=6&&document.getElementById('breadcrumb').innerHTML=='imprint'){Effect.Fade('menu_6_active',{duration:0.2});Effect.Fade('breadcrumb',{duration:0.2});Effect.Fade('separation_line',{duration:0.2});window.setTimeout(function(){Effect.Appear('separation_line',{duration:0.2});},250);}
window.setTimeout(function(){if(x==1){document.getElementById('breadcrumb').innerHTML='work';}
if(x==2){document.getElementById('breadcrumb').innerHTML='about me';}
if(x==3){document.getElementById('breadcrumb').innerHTML='delicious';}
if(x==4){document.getElementById('breadcrumb').innerHTML='twitter';}
if(x==5){document.getElementById('breadcrumb').innerHTML='last.fm';}
if(x==6){document.getElementById('breadcrumb').innerHTML='imprint';}
if(x==7){document.getElementById('breadcrumb').innerHTML='contact';}
Effect.Appear('breadcrumb',{duration:0.2});},250);window.setTimeout(function(){if(document.getElementById('breadcrumb').innerHTML=='work'){Effect.Appear('menu_1_active',{duration:0.2});}
if(document.getElementById('breadcrumb').innerHTML=='about me'){Effect.Appear('menu_2_active',{duration:0.2});}
if(document.getElementById('breadcrumb').innerHTML=='delicious'){Effect.Appear('menu_3_active',{duration:0.2});}
if(document.getElementById('breadcrumb').innerHTML=='twitter'){Effect.Appear('menu_4_active',{duration:0.2});}
if(document.getElementById('breadcrumb').innerHTML=='last.fm'){Effect.Appear('menu_5_active',{duration:0.2});}
if(document.getElementById('breadcrumb').innerHTML=='imprint'){Effect.Appear('menu_6_active',{duration:0.2});}
if(document.getElementById('breadcrumb').innerHTML=='contact'){Effect.Appear('menu_7_active',{duration:0.2});}
document.dummy.input.focus();},255);if($('content_'+(x+1))){new Effect.Fade('content_'+(x+1),{duration:0.2});}
if($('content_'+(x+2))){new Effect.Fade('content_'+(x+2),{duration:0.2});}
if($('content_'+(x+3))){new Effect.Fade('content_'+(x+3),{duration:0.2});}
if($('content_'+(x+4))){new Effect.Fade('content_'+(x+4),{duration:0.2});}
if($('content_'+(x+5))){new Effect.Fade('content_'+(x+5),{duration:0.2});}
if($('content_'+(x+6))){new Effect.Fade('content_'+(x+6),{duration:0.2});}
if($('content_'+(x+7))){new Effect.Fade('content_'+(x+7),{duration:0.2});}
if($('content_'+(x+8))){new Effect.Fade('content_'+(x+8),{duration:0.2});}
if($('content_'+(x+9))){new Effect.Fade('content_'+(x+9),{duration:0.2});}
if($('content_'+(x-1))){new Effect.Fade('content_'+(x-1),{duration:0.2});}
if($('content_'+(x-2))){new Effect.Fade('content_'+(x-2),{duration:0.2});}
if($('content_'+(x-3))){new Effect.Fade('content_'+(x-3),{duration:0.2});}
if($('content_'+(x-4))){new Effect.Fade('content_'+(x-4),{duration:0.2});}
if($('content_'+(x-5))){new Effect.Fade('content_'+(x-5),{duration:0.2});}
if($('content_'+(x-6))){new Effect.Fade('content_'+(x-6),{duration:0.2});}
if($('content_'+(x-7))){new Effect.Fade('content_'+(x-7),{duration:0.2});}
if($('content_'+(x-8))){new Effect.Fade('content_'+(x-8),{duration:0.2});}
if($('content_'+(x-9))){new Effect.Fade('content_'+(x-9),{duration:0.2});}
window.setTimeout(function(){if($('content_'+x)){new Effect.Appear('content_'+(x),{duration:0.2});}},300);}
var ownurlpatt=/debugvielhuber\.de/;function addEvent(obj,evType,fn){if(obj.addEventListener){obj.addEventListener(evType,fn,false);return true;}else if(obj.attachEvent){var r=obj.attachEvent("on"+evType,fn);return r;}else{return false;}}
function getEventTarget(e){return(e.target)?e.target:e.srcElement}
blankclick=function(e){stopRadio();var tg=getEventTarget(e);if(tg.tagName.toLowerCase()=='a'){tg.target='_blank';}else if(tg.parentNode.tagName.toLowerCase()=='a'){tg.parentNode.target='_blank';}
return true;}
addBlank=function(){var doclinks=document.getElementsByTagName("a");for(var i=0;i<doclinks.length;i++){if(doclinks[i].rel=='noblank'||doclinks[i].rel=='lightbox'||doclinks[i].getAttribute('onclick')){}
else if(!doclinks[i].href.match(ownurlpatt)&&!doclinks[i].href.match(/^(mailto|javascript):/)){addEvent(doclinks[i],"click",blankclick);}}}
function startfirstRadio(){var artist=document.getElementById('loved_artist').innerHTML;var track=document.getElementById('loved_track').innerHTML;current_artist="";current_track="";var active_inactive=document.getElementsByClassName("active_inactive");var T=active_inactive;var x=0;var n=0;var j=0;for(x=0;x<(T.length-1);x++){n=x+1;for(j=n;j<T.length;j++){if(T[x].innerHTML==T[j].innerHTML){T[j].parentNode.setAttribute('style','display:none;');}}}
for(var i=0;i<active_inactive.length;i++){if((artist+" - "+track).length>45){if(active_inactive[i].innerHTML==(artist+" - "+track).substr(0,45)+'...'){active_inactive[i].setAttribute('class','active_inactive active');}}
else{if(active_inactive[i].innerHTML==artist+" - "+track){active_inactive[i].setAttribute('class','active_inactive active');}}}}
function switchRadio(artist,track,image,url){var pos=artist.indexOf("é");if(pos!=-1){var artist_url=artist.substring(0,pos)+'e'+artist.substring(pos+1);}
else{var artist_url=artist;}
new Effect.Fade('lastfm_top',{duration:0.5,from:1,to:0.0,afterFinish:function(){if(artist!=current_artist&&track!=current_track){document.getElementById('startradio_link').setAttribute('style','display:block;');document.getElementById('startradio_link').setAttribute('onclick','startRadio(\''+artist_url+'\',\''+track+'\',\''+image+'\',\''+url+'\');');document.getElementById('stopradio_link').setAttribute('style','display:none;');document.getElementById('currentalbum').setAttribute('src',image);document.getElementById('lasttopimg').setAttribute('href',url);document.getElementById('lasttopimg').removeAttribute('class');}
else{document.getElementById('startradio_link').setAttribute('style','display:none;');document.getElementById('stopradio_link').setAttribute('style','display:block;');document.getElementById('currentalbum').setAttribute('src',image);document.getElementById('lasttopimg').setAttribute('href',url);document.getElementById('lasttopimg').setAttribute('class','highlighted');}
var active_inactive=document.getElementsByClassName("active_inactive");for(var i=0;i<active_inactive.length;i++){if(active_inactive[i].getAttribute('class')=='active_inactive active'){active_inactive[i].setAttribute('class','active_inactive');}
if((artist+" - "+track).length>45){if(active_inactive[i].innerHTML==(artist+" - "+track).substr(0,45)+'...'){active_inactive[i].setAttribute('class','active_inactive active');}}
else{if(active_inactive[i].innerHTML==artist+" - "+track){active_inactive[i].setAttribute('class','active_inactive active');}}}
new Effect.Appear('lastfm_top',{duration:0.5});}});}
function startRadio(artist,track,image,url){current_artist=artist;current_track=track;var radio_url="radio.php?artist="+artist+"&track="+track;new Effect.Fade('lastfm_top',{duration:0.5,from:1,to:0.0,afterFinish:function(){document.getElementById('startradio_link').setAttribute('style','display:none;');document.getElementById('stopradio_link').setAttribute('style','display:block;');document.getElementById('lasttopimg').setAttribute('class','highlighted');new Effect.Appear('lastfm_top',{duration:0.5});window.setTimeout(function(){parent.music.location.href=radio_url;},1000);}});}
function stopRadio(){current_artist="";current_track="";new Effect.Fade('lastfm_top',{duration:0.5,from:1,to:0.0,afterFinish:function(){document.getElementById('startradio_link').setAttribute('style','display:block;');document.getElementById('stopradio_link').setAttribute('style','display:none;');document.getElementById('lasttopimg').removeAttribute('class');new Effect.Appear('lastfm_top',{duration:0.5});window.setTimeout(function(){parent.music.location.href="time.php";},1000);}});}
function getLength(){$all=document.getElementById('project_status').getAttribute('title');var status=document.getElementsByClassName("project_status_top");for(var i=0;i<status.length;i++){status[i].innerHTML=$all;}}
$counter=0;$actual=1;function nextProject(){if($actual<$all){Effect.BlindUp($('project_'+$actual),{duration:0.15});Effect.BlindDown($('project_'+($actual+1)),{duration:0.15});$actual++;setLinks();}}
function previousProject(){if($actual>1){Effect.BlindUp($('project_'+$actual),{duration:0.15});Effect.BlindDown($('project_'+($actual-1)),{duration:0.15});$actual=$actual-1;setLinks();}}
function setLinks(){if($actual==$all){$('next').addClassName('inactive');new Effect.Fade('next',{duration:0.4,from:0.6,to:0});}
if($actual!=$all){$('next').removeClassName('inactive');if(document.getElementById('next').getAttribute('style')){if(document.getElementById('next').getAttribute('style').search(/non.+/)==-1){}else{new Effect.Appear('next',{duration:0.4,from:0,to:0.6});}}}
if($actual==1){$('previous').addClassName('inactive');new Effect.Fade('previous',{duration:0.4,from:0.6,to:0});}
if($actual!=1){$('previous').removeClassName('inactive');if(document.getElementById('previous').getAttribute('style')){if(document.getElementById('previous').getAttribute('style').search(/non.+/)==-1){}else{new Effect.Appear('previous',{duration:0.4,from:0,to:0.6});}}}}
function startFading(){window.setTimeout(function(){var project_status=document.getElementById('project_status').getAttribute('title');for(var i=1;i<=project_status;i++){eval("var project_"+i+" = [ 'media/projects/project_"+i+"1.jpg', 'media/projects/project_"+i+"2.jpg', 'media/projects/project_"+i+"3.jpg' ];")}
for(var i=1;i<=project_status;i++){eval("new Widget.Fader('picture_"+i+"', project_"+i+", { fadeInDuration: 0.5, fadeOutDuration: 0.5, displayDuration: 5.5 });")}},13000);}
function keyboardControl(){j=1;document.onkeydown=keyListener;}
function settoOne(){if(j==0){window.setTimeout(function(){j=1;},500);}}
function keyListener(e){if(!e){e=window.event;}
if(e.keyCode==40&&j==1){j=0;settoOne();for(var i=1;i<=11;i++){if(document.getElementById('content_'+i)){var att=document.getElementById('content_'+i).getAttribute('style');if(att.search(/non.+/)==-1){if(i!=7){showContent(i+1);}
if(i==7){showContent(1);}}
if(att.search(/non.+/)!=-1){}}}}
if(e.keyCode==38&&j==1){j=0;settoOne();for(var i=1;i<=11;i++){if(document.getElementById('content_'+i)){var att=document.getElementById('content_'+i).getAttribute('style');if(att.search(/non.+/)==-1){if(i!=1){showContent(i-1);}
if(i==1){showContent(7);}}
if(att.search(/non.+/)!=-1){}}}}
if(e.keyCode==39&&j==1){j=0;settoOne();nextProject();}
if(e.keyCode==37&&j==1){j=0;settoOne();previousProject();}}
function textCounter(field,countfield,maxlimit){if(field.value.length>maxlimit)
field.value=field.value.substring(0,maxlimit);else
countfield.value=maxlimit-field.value.length;}
function stopRKey(evt){var evt=(evt)?evt:((event)?event:null);var node=(evt.target)?evt.target:((evt.srcElement)?evt.srcElement:null);if((evt.keyCode==13)){return false;}}
document.onkeypress=stopRKey;LightboxOptions=Object.extend({fileLoadingImage:'media/lightbox/loading.gif',fileBottomNavCloseImage:'media/lightbox/closelabel.gif',overlayOpacity:0.7,animate:true,resizeSpeed:6,borderSize:10,labelImage:"Image",labelOf:"of"},window.LightboxOptions||{});var Lightbox=Class.create();Lightbox.prototype={imageArray:[],activeImage:undefined,initialize:function(){this.updateImageList();this.keyboardAction=this.keyboardAction.bindAsEventListener(this);if(LightboxOptions.resizeSpeed>10)LightboxOptions.resizeSpeed=10;if(LightboxOptions.resizeSpeed<1)LightboxOptions.resizeSpeed=1;this.resizeDuration=LightboxOptions.animate?((11-LightboxOptions.resizeSpeed)*0.15):0;this.overlayDuration=LightboxOptions.animate?0.5:0;var size=(LightboxOptions.animate?250:1)+'px';var objBody=$$('body')[0];objBody.appendChild(Builder.node('div',{id:'overlay'}));objBody.appendChild(Builder.node('div',{id:'lightbox'},[Builder.node('div',{id:'outerImageContainer'},Builder.node('div',{id:'imageContainer'},[Builder.node('img',{id:'lightboxImage'}),Builder.node('div',{id:'hoverNav'},[Builder.node('a',{id:'prevLink',href:'#'}),Builder.node('a',{id:'nextLink',href:'#'})]),Builder.node('div',{id:'loading'},Builder.node('a',{id:'loadingLink',href:'#'},Builder.node('img',{src:LightboxOptions.fileLoadingImage})))])),Builder.node('div',{id:'imageDataContainer'},Builder.node('div',{id:'imageData'},[Builder.node('div',{id:'imageDetails'},[Builder.node('span',{id:'caption'}),Builder.node('span',{id:'numberDisplay'})]),Builder.node('div',{id:'bottomNav'},Builder.node('a',{id:'bottomNavClose',href:'#'},Builder.node('img',{src:LightboxOptions.fileBottomNavCloseImage})))]))]));$('overlay').hide().observe('click',(function(){this.end();}).bind(this));$('lightbox').hide().observe('click',(function(event){if(event.element().id=='lightbox')this.end();}).bind(this));$('outerImageContainer').setStyle({width:size,height:size});$('prevLink').observe('click',(function(event){event.stop();this.changeImage(this.activeImage-1);}).bindAsEventListener(this));$('nextLink').observe('click',(function(event){event.stop();this.changeImage(this.activeImage+1);}).bindAsEventListener(this));$('loadingLink').observe('click',(function(event){event.stop();this.end();}).bind(this));$('bottomNavClose').observe('click',(function(event){event.stop();this.end();}).bind(this));var th=this;(function(){var ids='overlay lightbox outerImageContainer imageContainer lightboxImage hoverNav prevLink nextLink loading loadingLink '+'imageDataContainer imageData imageDetails caption numberDisplay bottomNav bottomNavClose';$w(ids).each(function(id){th[id]=$(id);});}).defer();},updateImageList:function(){this.updateImageList=Prototype.emptyFunction;document.observe('click',(function(event){var target=event.findElement('a[rel^=lightbox]')||event.findElement('area[rel^=lightbox]');if(target){event.stop();this.start(target);}}).bind(this));},start:function(imageLink){$$('select','object','embed').each(function(node){node.style.visibility='hidden'});var arrayPageSize=this.getPageSize();$('overlay').setStyle({width:arrayPageSize[0]+'px',height:arrayPageSize[1]+'px'});new Effect.Appear(this.overlay,{duration:this.overlayDuration,from:0.0,to:LightboxOptions.overlayOpacity});this.imageArray=[];var imageNum=0;if((imageLink.rel=='lightbox')){this.imageArray.push([imageLink.href,imageLink.title]);}else{this.imageArray=$$(imageLink.tagName+'[href][rel="'+imageLink.rel+'"]').collect(function(anchor){return[anchor.href,anchor.title];}).uniq();while(this.imageArray[imageNum][0]!=imageLink.href){imageNum++;}}
var arrayPageScroll=document.viewport.getScrollOffsets();if(imageLink.href.indexOf("_big")==-1){var lightboxTop=((document.viewport.getHeight()-285)/2);}
else{var lightboxTop=((document.viewport.getHeight()-595)/2);}
var lightboxLeft=arrayPageScroll[0];this.lightbox.setStyle({top:lightboxTop+'px',left:lightboxLeft+'px'}).show();this.changeImage(imageNum);},changeImage:function(imageNum){this.activeImage=imageNum;if(LightboxOptions.animate)this.loading.show();this.lightboxImage.hide();this.hoverNav.hide();this.prevLink.hide();this.nextLink.hide();this.imageDataContainer.setStyle({opacity:.0001});this.numberDisplay.hide();var imgPreloader=new Image();imgPreloader.onload=(function(){this.lightboxImage.src=this.imageArray[this.activeImage][0];this.resizeImageContainer(imgPreloader.width,imgPreloader.height);}).bind(this);imgPreloader.src=this.imageArray[this.activeImage][0];},resizeImageContainer:function(imgWidth,imgHeight){var widthCurrent=this.outerImageContainer.getWidth();var heightCurrent=this.outerImageContainer.getHeight();var widthNew=(imgWidth+LightboxOptions.borderSize*2);var heightNew=(imgHeight+LightboxOptions.borderSize*2);var xScale=(widthNew/widthCurrent)*100;var yScale=(heightNew/heightCurrent)*100;var wDiff=widthCurrent-widthNew;var hDiff=heightCurrent-heightNew;if(hDiff!=0)new Effect.Scale(this.outerImageContainer,yScale,{scaleX:false,duration:this.resizeDuration,queue:'front'});if(wDiff!=0)new Effect.Scale(this.outerImageContainer,xScale,{scaleY:false,duration:this.resizeDuration,delay:this.resizeDuration});var timeout=0;if((hDiff==0)&&(wDiff==0)){timeout=100;if(Prototype.Browser.IE)timeout=250;}
(function(){this.prevLink.setStyle({height:imgHeight+'px'});this.nextLink.setStyle({height:imgHeight+'px'});this.imageDataContainer.setStyle({width:widthNew+'px'});this.showImage();}).bind(this).delay(timeout/1000);},showImage:function(){this.loading.hide();new Effect.Appear(this.lightboxImage,{duration:this.resizeDuration,queue:'end',afterFinish:(function(){this.updateDetails();}).bind(this)});this.preloadNeighborImages();},updateDetails:function(){if(this.imageArray[this.activeImage][1]!=""){this.caption.update(this.imageArray[this.activeImage][1]).show();}
if(this.imageArray.length>1){this.numberDisplay.update(LightboxOptions.labelImage+' '+(this.activeImage+1)+' '+LightboxOptions.labelOf+'  '+this.imageArray.length).show();}
new Effect.Parallel([new Effect.SlideDown(this.imageDataContainer,{sync:true,duration:this.resizeDuration,from:0.0,to:1.0}),new Effect.Appear(this.imageDataContainer,{sync:true,duration:this.resizeDuration})],{duration:this.resizeDuration,afterFinish:(function(){var arrayPageSize=this.getPageSize();this.overlay.setStyle({height:arrayPageSize[1]+'px'});this.updateNav();}).bind(this)});},updateNav:function(){this.hoverNav.show();if(this.activeImage>0)this.prevLink.show();if(this.activeImage<(this.imageArray.length-1))this.nextLink.show();this.enableKeyboardNav();},enableKeyboardNav:function(){document.observe('keydown',this.keyboardAction);},disableKeyboardNav:function(){document.stopObserving('keydown',this.keyboardAction);},keyboardAction:function(event){var keycode=event.keyCode;var escapeKey;if(event.DOM_VK_ESCAPE){escapeKey=event.DOM_VK_ESCAPE;}else{escapeKey=27;}
var key=String.fromCharCode(keycode).toLowerCase();if(key.match(/x|o|c/)||(keycode==escapeKey)){this.end();}else if((key=='p')||(keycode==37)){if(this.activeImage!=0){this.disableKeyboardNav();this.changeImage(this.activeImage-1);}}else if((key=='n')||(keycode==39)){if(this.activeImage!=(this.imageArray.length-1)){this.disableKeyboardNav();this.changeImage(this.activeImage+1);}}},preloadNeighborImages:function(){var preloadNextImage,preloadPrevImage;if(this.imageArray.length>this.activeImage+1){preloadNextImage=new Image();preloadNextImage.src=this.imageArray[this.activeImage+1][0];}
if(this.activeImage>0){preloadPrevImage=new Image();preloadPrevImage.src=this.imageArray[this.activeImage-1][0];}},end:function(){this.disableKeyboardNav();this.lightbox.hide();new Effect.Fade(this.overlay,{duration:this.overlayDuration});$$('select','object','embed').each(function(node){node.style.visibility='visible'});},getPageSize:function(){var xScroll,yScroll;if(window.innerHeight&&window.scrollMaxY){xScroll=window.innerWidth+window.scrollMaxX;yScroll=window.innerHeight+window.scrollMaxY;}else if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight;}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight;}
var windowWidth,windowHeight;if(self.innerHeight){if(document.documentElement.clientWidth){windowWidth=document.documentElement.clientWidth;}else{windowWidth=self.innerWidth;}
windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;}
if(yScroll<windowHeight){pageHeight=windowHeight;}else{pageHeight=yScroll;}
if(xScroll<windowWidth){pageWidth=xScroll;}else{pageWidth=windowWidth;}
return[pageWidth,pageHeight];}}