function fade(b,d,c,j,a){e=document.getElementById(b);if(!(e==null||j==0||d>=c)){e.fade_min=d;e.fade_max=c;e.fade_step=Math.ceil((c-d)*fader.delay/j);e.hide=a;if(e.fade_value==null)e.fade_value=j>0?d:c;if(e.fade_value<d)e.fade_value=d;if(e.fade_value>c)e.fade_value=c;if(!(b in fader.list)){fader.list[b]=e;fader.list.length++;fader.list.length==1&&fader_step()}}}
function fader_step(){for(i in fader.list){e=document.getElementById(i);if(e!=null&&e.fade_value!=null){e.fade_value+=e.fade_step;if(e.fade_step>0){if(e.fade_value>e.fade_max){e.fade_value=e.fade_max;delete fader.list[i];fader.list.length--}}else if(e.fade_value<e.fade_min){e.fade_value=e.fade_min;delete fader.list[i];fader.list.length--}if(e.style.opacity!=null)e.style.opacity=e.fade_value/1E3;if(e.style.filter!=null)e.style.filter=e.fade_value==1E3?null:"alpha(opacity="+e.fade_value/10+")";if(e.hide)e.style.visibility=
e.fade_value>0?"visible":"hidden";else if(e.fade_value>0)e.style.visibility="visible"}}fader.list.length>0&&self.setTimeout("fader_step()",fader.delay)}function Fader(){this.list={};this.list.length=0;this.delay=50}var fader=new Fader;function humansonly(b,d,c){element=document.getElementById(b);if(element!=undefined){if(d!=null){t="";for(i in d)t+=String.fromCharCode(193-d[i]);element.innerHTML=t}if(c!=null&&element.href){l="";for(i in c)l+=String.fromCharCode(193-c[i]);element.href=l}}}function focusfield(b){document.getElementById(b).focus()}
function maxlen(b,d){text_id=document.getElementById(b);if(text_id!=undefined){curlength=document.getElementById(b).value.length;if(curlength!=undefined){hint_id=document.getElementById(b+"_hint");if(hint_id!=undefined)if(curlength<=d){hint_id.innerHTML="Maximum "+d+" characters; "+(d-curlength)+" left";hint_id.className="hint_ok"}else{hint_id.innerHTML="Maximum "+d+" characters; "+(curlength-d)+" will be truncated";hint_id.className="hint_truncate"}}}}function debug(){}
function Prefetch(b){this._fetched=function(){debug("_fetched_ok");this.fetched=true;this.parent._fetch()};this._fetch=function(){setTimeout("__Prefetch_this_object.__fetch();",0)};this.__fetch=function(){for(var c=0;c<this.imagelist.length&&this.imagelist[c].fetched;)c++;if(c<this.imagelist.length&&!this.imagelist[c].fetched)this.imagelist[c].src=this.imagelist[c].imageurl;debug("done _fetch")};this.imagelist=[];for(i in b){var d=new Image;d.index=Number(i)+1;d.parent=this;d.imageurl=b[i];d.fetched=
false;d.error=false;d.onload=this._fetched;d.onerror=this._fetched;this.imagelist.push(d)}__Prefetch_this_object=this;this._fetch();debug("done init")}function toggle_workdetail(){e=document.getElementById("workdetail");"fade_value"in e&&e.fade_value>0?fade("workdetail",0,1E3,-300,true):fade("workdetail",0,1E3,300,true)};function debug(b){var d=document.getElementById("debug");if(d){if(typeof debug_starttime=="undefined"){debug_starttime=new Date;d.value=""}var c="["+(new Date-debug_starttime)/1E3+"] ";if(typeof photos!="undefined"){c+=photos.playing?"playing":"paused";c+=" : ";c+=photos.sliding?"sliding":"no-effect";c+=" : ";c+=photos.nexttimer?photos.nexttimer:"no-nexttimer";c+=" : ";c+=photos.delay?photos.delay:"no-delay";c+=" : "+b+"\n";for(i in photos.framelist){img=photos.framelist[i];c+=i+" ["+img.index+"] ";
c+=img.fetched?"F":"-";c+=img.error?"E":"-";c+=" ";c+=photos.fetching==img.index?"F":"-";c+=photos.requested==img.index?"R":"-";c+=photos.ondisplay==img.index?"D":"-";c+=" "+img.imageurl+"\n"}}d.value=c}}set_opacity=function(b,d){if(b.style.opacity!=null)b.style.opacity=d/1E3;if(b.style.filter!=null)b.style.filter=b.fade_value==1E3?null:"alpha(opacity="+d/10+")";b.style.visibility="visible"};
function QPhotosFadeover(b,d,c){this.display=function(a){this._userinterrupt();this._paint(a)};this.next=function(){this._userinterrupt();if(this.sliding){this.sliding=false;this._paint(this.ondisplay+1)}else this.requested==undefined?this._paint(1):this._paint(this.requested+1)};this.prev=function(){this._userinterrupt();if(this.sliding){this.sliding=false;this._paint(this.ondisplay)}else this.requested==undefined?this._paint(1):this._paint(this.requested-1)};this.playstart=function(a){this._userinterrupt();
this.nexttimer=setTimeout("__qphotos_this_object.play("+a+");",a)};this.play=function(a){this._userinterrupt();this.delay=typeof a=="undefined"&&!this.delay?4E3:a;if(this.sliding){this.sliding=false;this._next()}this.playing=true;this._playnext()};this.pause=function(){this._userinterrupt();this.sliding=this.playing=false;this._paint(this.requested)};this.set_linear=function(a,g){this.fps=a;this.linear_step=g;this.effect="linear"};this._userinterrupt=function(){this.waitingtoslide=this.playing=false;
this.nexttimer&&clearTimeout(this.nexttimer);this.nexttimer=undefined;this.effecttimer&&clearInterval(this.effecttimer);this.effecttimer=undefined};this._next=function(){this.requested==undefined?this._paint(1):this._paint(this.requested+1)};this._playnext=function(){this._paint();this.effecttimer=setTimeout("__qphotos_this_object._slide();",1)};this._paintdiv=function(a,g){frame=this.framelist[g-1];var h='<table id="'+this.divid+'_table"><tr>';h+='<td id="'+this.divid+"_td_"+g+'"';if(frame.cssclass)h+=
' class="'+frame.cssclass+'"';h+=">";if(frame.fetched)if(frame.imageurl)if(frame.error)h+="image&nbsp;"+g+"&nbsp;not&nbsp;available: "+this.framelist[g-1].imageurl;else{h+="<img ";if(frame.width)h+='width="'+frame.width+'px"';if(frame.height)h+='height="'+frame.height+'px"';h+='src="'+frame.src+'"></td>'}else h+="<div>"+frame.html+"</div>";else h+="..........";h+="</td></tr>";if(this.shownumbers||this.showdescriptions){h+="<tr><td";h+=frame.cssclass?' class="'+frame.cssclass+'_label"':' class="label"';
h+=">";if(this.shownumbers)h+=g+" / "+this.framelist.length;if(this.shownumbers&&frame.description)h+="<br>";if(frame.description)h+=frame.description;h+="</td></tr>"}h+="</table>";a.innerHTML=h};this._paint=function(a){if(!this.sliding){if(a==undefined)a=this.ondisplay?this.ondisplay:1;if(a>this.framelist.length)a=1;if(a<1)a=this.framelist.length;this.requested=a;set_opacity(this.bottomdiv,1E3);this._paintdiv(this.bottomdiv,a);this._paintdiv(this.topdiv,a);set_opacity(this.topdiv,1E3);this.ondisplay=
a;if(this.waitingtoslide)this.effecttimer=setTimeout("__qphotos_this_object._slide();",1)}debug("done _paint")};this._slide=function(){this.waitingtoslide=false;if(!this.sliding){this.nexttimer&&clearTimeout(this.nexttimer);this.nexttimer=undefined;if(this.ondisplay){var a=this.ondisplay;a||(a=1);var g=a+1;if(g>this.framelist.length)g=1;if(this.framelist[a-1].fetched&&this.framelist[g-1].fetched){if(!this.waitingtoslide)if(this.effect==undefined)this._paint(g);else{this._paintdiv(this.topdiv,a);set_opacity(this.topdiv,
1E3);set_opacity(this.bottomdiv,0);this._paintdiv(this.bottomdiv,g);this.slideposlist=[];for(j=0;j<=1E3;j+=this.linear_step)this.slideposlist.push(j);this.sliding=true;this.effecttimer=setInterval("__qphotos_this_object._slidestep();",1E3/this.fps)}}else{this.requested=g;this.waitingtoslide=true}}else{this.requested=1;this.waitingtoslide=true}}};this._slidestep=function(){if(this.sliding)if(this.slideposlist.length>0){opacity=this.slideposlist.shift();set_opacity(this.bottomdiv,opacity);set_opacity(this.topdiv,
1E3-opacity)}else{this.sliding=false;clearInterval(this.effecttimer);this.effecttimer=undefined;this._paint(this.ondisplay+1);clearTimeout(this.nexttimer);this.nexttimer=undefined;if(this.playing)this.nexttimer=setTimeout("__qphotos_this_object._playnext();",this.delay);debug("finished effect")}};this._fetch=function(){setTimeout("__qphotos_this_object.__fetch();",0)};this.__fetch=function(){var a,g;if(typeof this.fetchcount=="undefined")this.fetchcount=1;else this.fetchcount++;if(!(this.fetching!=
undefined&&!this.framelist[this.fetching-1].fetched)){this.fetching=undefined;g=this.ondisplay==undefined?1:this.ondisplay;if(!this.framelist[g-1].fetched)this.fetching=g;if(this.requested!=undefined&&!this.framelist[this.requested-1].fetched)this.fetching=this.requested;if(this.fetching==undefined){a=g+1;if(a>=this.framelist.length)a=1;if(!this.framelist[a-1].fetched)this.fetching=a}if(this.fetching==undefined){a=g+1;if(a>this.framelist.length)a=1;for(;this.fetching==undefined&&a!=g;){if(!this.framelist[a-
1].fetched)this.fetching=a;a++;if(a>this.framelist.length)a=1}}if(this.fetching!=undefined)this.framelist[this.fetching-1].src=this.framelist[this.fetching-1].imageurl;debug("done _fetch")}};this._fetched_ok=function(){debug("_fetched_ok");this.fetched=true;this.error=false;this.parent._paint();this.parent._fetch()};this._fetched_error=function(){debug("_fetched_error");this.error=this.fetched=true;this.parent._paint();this.parent._fetch()};var j;if(this.topdiv=document.getElementById(b)){this.divid=
b;this.bottomdiv=document.createElement("div");this.bottomdiv.className=this.topdiv.className;this.bottomdiv.innerHTML=this.topdiv.innerHTML;this.topdiv.className+="top";this.topdiv.parentNode.appendChild(this.bottomdiv);this.shownumbers=d;this.showdescriptions=false;if(c.length<1)alert("QPhotos: the framespecs list is empty");else{this.framelist=[];for(f in c){frame=c[f];b=new Image;b.index=Number(f)+1;b.cssclass=frame[1];if(frame.length>3){this.showdescriptions=true;b.description=frame[3]}else b.description=
undefined;b.parent=this;if(frame[0]=="img"){b.imageurl=frame[2];b.description=frame.length>3?frame[3]:"";b.html=undefined;b.fetched=false;b.error=false;b.onload=this._fetched_ok;b.onerror=this._fetched_error}else if(frame[0]=="html"){b.imageurl=undefined;b.html=frame[2];b.fetched=true}this.framelist.push(b)}this.effecttimer=this.nexttimer=this.requested=this.fetching=this.ondisplay=undefined;this.waitingtoslide=this.sliding=this.showloading=this.playing=false;__qphotos_this_object=this;this.effect=
undefined;this._fetch();debug("done init")}}else alert("QPhotos: there is no element with id "+b)};

