String.prototype.parseColor=function(){var color='#';if(this.slice(0,4)=='rgb('){var cols=this.slice(4,this.length-1).split(',');var i=0;do{color+=parseInt(cols[i]).toColorPart()}while(++i<3);}else{if(this.slice(0,1)=='#'){if(this.length==4)for(var i=1;i<4;i++)color+=(this.charAt(i)+this.charAt(i)).toLowerCase();if(this.length==7)color=this.toLowerCase();}}
return(color.length==7?color:(arguments[0]||this));}
Element.collectTextNodes=function(element){return $A($(element).childNodes).collect(function(node){return(node.nodeType==3?node.nodeValue:(node.hasChildNodes()?Element.collectTextNodes(node):''));}).flatten().join('');}
Element.collectTextNodesIgnoreClass=function(element,className){return $A($(element).childNodes).collect(function(node){return(node.nodeType==3?node.nodeValue:((node.hasChildNodes()&&!Element.hasClassName(node,className))?Element.collectTextNodesIgnoreClass(node,className):''));}).flatten().join('');}
Element.setContentZoom=function(element,percent){element=$(element);Element.setStyle(element,{fontSize:(percent/100)+'em'});if(navigator.appVersion.indexOf('AppleWebKit')>0)window.scrollBy(0,0);}
Element.getOpacity=function(element){var opacity;if(opacity=Element.getStyle(element,'opacity'))
return parseFloat(opacity);if(opacity=(Element.getStyle(element,'filter')||'').match(/alpha\(opacity=(.*)\)/))
if(opacity[1])return parseFloat(opacity[1])/100;return 1.0;}
Element.setOpacity=function(element,value){element=$(element);if(value==1){Element.setStyle(element,{opacity:(/Gecko/.test(navigator.userAgent)&&!/Konqueror|Safari|KHTML/.test(navigator.userAgent))?0.999999:null});if(/MSIE/.test(navigator.userAgent))
Element.setStyle(element,{filter:Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'')});}else{if(value<0.00001)value=0;Element.setStyle(element,{opacity:value});if(/MSIE/.test(navigator.userAgent))
Element.setStyle(element,{filter:Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'')+
'alpha(opacity='+value*100+')'});}}
Element.getInlineOpacity=function(element){return $(element).style.opacity||'';}
Element.childrenWithClassName=function(element,className,findFirst){var classNameRegExp=new RegExp("(^|\\s)"+className+"(\\s|$)");var results=$A($(element).getElementsByTagName('*'))[findFirst?'detect':'select'](function(c){return(c.className&&c.className.match(classNameRegExp));});if(!results)results=[];return results;}
Element.forceRerendering=function(element){try{element=$(element);var n=document.createTextNode(' ');element.appendChild(n);element.removeChild(n);}catch(e){}};Array.prototype.call=function(){var args=arguments;this.each(function(f){f.apply(this,args)});}
var Effect={tagifyText:function(element){var tagifyStyle='position:relative';if(/MSIE/.test(navigator.userAgent))tagifyStyle+=';zoom:1';element=$(element);$A(element.childNodes).each(function(child){if(child.nodeType==3){child.nodeValue.toArray().each(function(character){element.insertBefore(Builder.node('span',{style:tagifyStyle},character==' '?String.fromCharCode(160):character),child);});Element.remove(child);}});},multiple:function(element,effect){var elements;if(((typeof element=='object')||(typeof element=='function'))&&(element.length))
elements=element;else
elements=$(element).childNodes;var options=Object.extend({speed:0.1,delay:0.0},arguments[2]||{});var masterDelay=options.delay;$A(elements).each(function(element,index){new effect(element,Object.extend(options,{delay:index*options.speed+masterDelay}));});},PAIRS:{'slide':['SlideDown','SlideUp'],'blind':['BlindDown','BlindUp'],'appear':['Appear','Fade']},toggle:function(element,effect){element=$(element);effect=(effect||'appear').toLowerCase();var options=Object.extend({queue:{position:'end',scope:(element.id||'global'),limit:1}},arguments[2]||{});Effect[element.visible()?Effect.PAIRS[effect][1]:Effect.PAIRS[effect][0]](element,options);}};var Effect2=Effect;Effect.Transitions={}
Effect.Transitions.linear=function(pos){return pos;}
Effect.Transitions.sinoidal=function(pos){return(-Math.cos(pos*Math.PI)/2)+0.5;}
Effect.Transitions.reverse=function(pos){return 1-pos;}
Effect.Transitions.flicker=function(pos){return((-Math.cos(pos*Math.PI)/4)+0.75)+Math.random()/4;}
Effect.Transitions.wobble=function(pos){return(-Math.cos(pos*Math.PI*(9*pos))/2)+0.5;}
Effect.Transitions.pulse=function(pos){return(Math.floor(pos*10)%2==0?(pos*10-Math.floor(pos*10)):1-(pos*10-Math.floor(pos*10)));}
Effect.Transitions.none=function(pos){return 0;}
Effect.Transitions.full=function(pos){return 1;}
Effect.ScopedQueue=Class.create();Object.extend(Object.extend(Effect.ScopedQueue.prototype,Enumerable),{initialize:function(){this.effects=[];this.interval=null;},_each:function(iterator){this.effects._each(iterator);},add:function(effect){var timestamp=new Date().getTime();var position=(typeof effect.options.queue=='string')?effect.options.queue:effect.options.queue.position;switch(position){case'front':this.effects.findAll(function(e){return e.state=='idle'}).each(function(e){e.startOn+=effect.finishOn;e.almostFinishOn+=effect.finishOn;e.finishOn+=effect.finishOn;});break;case'end':timestamp=this.effects.pluck('finishOn').max()||timestamp;break;}
effect.startOn+=timestamp;effect.almostFinishOn+=timestamp;effect.finishOn+=timestamp;if(!effect.options.queue.limit||(this.effects.length<effect.options.queue.limit))
this.effects.push(effect);if(!this.interval)
this.interval=setInterval(this.loop.bind(this),40);},remove:function(effect){this.effects=this.effects.reject(function(e){return e==effect});if(this.effects.length==0){clearInterval(this.interval);this.interval=null;}},loop:function(){var timePos=new Date().getTime();this.effects.invoke('loop',timePos);}});Effect.Queues={instances:$H(),get:function(queueName){if(typeof queueName!='string')return queueName;if(!this.instances[queueName])
this.instances[queueName]=new Effect.ScopedQueue();return this.instances[queueName];}}
Effect.Queue=Effect.Queues.get('global');Effect.DefaultOptions={transition:Effect.Transitions.sinoidal,duration:1.0,fps:25.0,sync:false,from:0.0,to:1.0,delay:0.0,queue:'parallel'}
Effect.Base=function(){};Effect.Base.prototype={position:null,start:function(options){this.options=Object.extend(Object.extend({},Effect.DefaultOptions),options||{});this.currentFrame=0;this.state='idle';this.startOn=this.options.delay*1000;this.almostFinishOn=this.startOn+(this.options.duration*850);this.finishOn=this.startOn+(this.options.duration*1000);if(!this.options.sync)
Effect.Queues.get(typeof this.options.queue=='string'?'global':this.options.queue.scope).add(this);},loop:function(timePos){if(timePos>=this.startOn){if(timePos>=this.finishOn){this.render(1.0);this.cancel();this.event('beforeFinish');if(this.finish)this.finish();this.event('afterFinish');return;}
var pos=Math.min((timePos-this.startOn)/(this.almostFinishOn-this.startOn),1.0);var frame=Math.round(pos*this.options.fps*(this.almostFinishOn-this.startOn));if(frame>this.currentFrame){this.render(pos);this.currentFrame=frame;}}},render:function(pos){if(this.state=='idle'){this.event('beforeStart');this.state='running';this.event('beforeSetup');if(this.setup)this.setup();this.event('afterSetup');}
if(this.state=='running'){if(this.options.transition)pos=this.options.transition(pos);pos*=(this.options.to-this.options.from);pos+=this.options.from;this.position=pos;this.event('beforeUpdate');if(this.update)this.update(pos);this.event('afterUpdate');}},cancel:function(){if(!this.options.sync)
Effect.Queues.get(typeof this.options.queue=='string'?'global':this.options.queue.scope).remove(this);this.state='finished';},event:function(eventName){if(this.options[eventName+'Internal'])this.options[eventName+'Internal'](this);if(this.options[eventName])this.options[eventName](this);},inspect:function(){return'#<Effect:'+$H(this).inspect()+',options:'+$H(this.options).inspect()+'>';}}
Effect.Parallel=Class.create();Object.extend(Object.extend(Effect.Parallel.prototype,Effect.Base.prototype),{initialize:function(effects){this.effects=effects||[];this.start(arguments[1]);},update:function(position){this.effects.invoke('render',position);},finish:function(position){this.effects.each(function(effect){effect.render(1.0);effect.cancel();effect.event('beforeFinish');if(effect.finish)effect.finish(position);effect.event('afterFinish');});}});Effect.Opacity=Class.create();Object.extend(Object.extend(Effect.Opacity.prototype,Effect.Base.prototype),{initialize:function(element){this.element=$(element);if(/MSIE/.test(navigator.userAgent)&&(!this.element.hasLayout))
this.element.setStyle({zoom:1});var options=Object.extend({from:this.element.getOpacity()||0.0,to:1.0},arguments[1]||{});this.start(options);},update:function(position){this.element.setOpacity(position);}});Effect.Move=Class.create();Object.extend(Object.extend(Effect.Move.prototype,Effect.Base.prototype),{initialize:function(element){this.element=$(element);var options=Object.extend({x:0,y:0,mode:'relative'},arguments[1]||{});this.start(options);},setup:function(){this.element.makePositioned();this.originalLeft=parseFloat(this.element.getStyle('left')||'0');this.originalTop=parseFloat(this.element.getStyle('top')||'0');if(this.options.mode=='absolute'){this.options.x=this.options.x-this.originalLeft;this.options.y=this.options.y-this.originalTop;}},update:function(position){this.element.setStyle({left:this.options.x*position+this.originalLeft+'px',top:this.options.y*position+this.originalTop+'px'});}});Effect.MoveBy=function(element,toTop,toLeft){return new Effect.Move(element,Object.extend({x:toLeft,y:toTop},arguments[3]||{}));};Effect.Scale=Class.create();Object.extend(Object.extend(Effect.Scale.prototype,Effect.Base.prototype),{initialize:function(element,percent){this.element=$(element)
var options=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:'box',scaleFrom:100.0,scaleTo:percent},arguments[2]||{});this.start(options);},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;this.elementPositioning=this.element.getStyle('position');this.originalStyle={};['top','left','width','height','fontSize'].each(function(k){this.originalStyle[k]=this.element.style[k];}.bind(this));this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;var fontSize=this.element.getStyle('font-size')||'100%';['em','px','%'].each(function(fontSizeType){if(fontSize.indexOf(fontSizeType)>0){this.fontSize=parseFloat(fontSize);this.fontSizeType=fontSizeType;}}.bind(this));this.factor=(this.options.scaleTo-this.options.scaleFrom)/100;this.dims=null;if(this.options.scaleMode=='box')
this.dims=[this.element.offsetHeight,this.element.offsetWidth];if(/^content/.test(this.options.scaleMode))
this.dims=[this.element.scrollHeight,this.element.scrollWidth];if(!this.dims)
this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth];},update:function(position){var currentScale=(this.options.scaleFrom/100.0)+(this.factor*position);if(this.options.scaleContent&&this.fontSize)
this.element.setStyle({fontSize:this.fontSize*currentScale+this.fontSizeType});this.setDimensions(this.dims[0]*currentScale,this.dims[1]*currentScale);},finish:function(position){if(this.restoreAfterFinish)this.element.setStyle(this.originalStyle);},setDimensions:function(height,width){var d={};if(this.options.scaleX)d.width=width+'px';if(this.options.scaleY)d.height=height+'px';if(this.options.scaleFromCenter){var topd=(height-this.dims[0])/2;var leftd=(width-this.dims[1])/2;if(this.elementPositioning=='absolute'){if(this.options.scaleY)d.top=this.originalTop-topd+'px';if(this.options.scaleX)d.left=this.originalLeft-leftd+'px';}else{if(this.options.scaleY)d.top=-topd+'px';if(this.options.scaleX)d.left=-leftd+'px';}}
this.element.setStyle(d);}});Effect.Highlight=Class.create();Object.extend(Object.extend(Effect.Highlight.prototype,Effect.Base.prototype),{initialize:function(element){this.element=$(element);var options=Object.extend({startcolor:'#ffff99'},arguments[1]||{});this.start(options);},setup:function(){if(this.element.getStyle('display')=='none'){this.cancel();return;}
this.oldStyle={backgroundImage:this.element.getStyle('background-image')};this.element.setStyle({backgroundImage:'none'});if(!this.options.endcolor)
this.options.endcolor=this.element.getStyle('background-color').parseColor('#ffffff');if(!this.options.restorecolor)
this.options.restorecolor=this.element.getStyle('background-color');this._base=$R(0,2).map(function(i){return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16)}.bind(this));this._delta=$R(0,2).map(function(i){return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i]}.bind(this));},update:function(position){this.element.setStyle({backgroundColor:$R(0,2).inject('#',function(m,v,i){return m+(Math.round(this._base[i]+(this._delta[i]*position)).toColorPart());}.bind(this))});},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}));}});Effect.ScrollTo=Class.create();Object.extend(Object.extend(Effect.ScrollTo.prototype,Effect.Base.prototype),{initialize:function(element){this.element=$(element);this.start(arguments[1]||{});},setup:function(){Position.prepare();var offsets=Position.cumulativeOffset(this.element);if(this.options.offset)offsets[1]+=this.options.offset;var max=window.innerHeight?window.height-window.innerHeight:document.body.scrollHeight-
(document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight);this.scrollStart=Position.deltaY;this.delta=(offsets[1]>max?max:offsets[1])-this.scrollStart;},update:function(position){Position.prepare();window.scrollTo(Position.deltaX,this.scrollStart+(position*this.delta));}});Effect.Fade=function(element){element=$(element);var oldOpacity=element.getInlineOpacity();var options=Object.extend({from:element.getOpacity()||1.0,to:0.0,afterFinishInternal:function(effect){if(effect.options.to!=0)return;effect.element.hide();effect.element.setStyle({opacity:oldOpacity});}},arguments[1]||{});return new Effect.Opacity(element,options);}
Effect.Appear=function(element){element=$(element);var options=Object.extend({from:(element.getStyle('display')=='none'?0.0:element.getOpacity()||0.0),to:1.0,afterFinishInternal:function(effect){effect.element.forceRerendering();},beforeSetup:function(effect){effect.element.setOpacity(effect.options.from);effect.element.show();}},arguments[1]||{});return new Effect.Opacity(element,options);}
Effect.Puff=function(element){element=$(element);var oldStyle={opacity:element.getInlineOpacity(),position:element.getStyle('position')};return new Effect.Parallel([new Effect.Scale(element,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(element,{sync:true,to:0.0})],Object.extend({duration:1.0,beforeSetupInternal:function(effect){effect.effects[0].element.setStyle({position:'absolute'});},afterFinishInternal:function(effect){effect.effects[0].element.hide();effect.effects[0].element.setStyle(oldStyle);}},arguments[1]||{}));}
Effect.BlindUp=function(element){element=$(element);element.makeClipping();return new Effect.Scale(element,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(effect){effect.element.hide();effect.element.undoClipping();}},arguments[1]||{}));}
Effect.BlindDown=function(element){element=$(element);var elementDimensions=element.getDimensions();return new Effect.Scale(element,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup:function(effect){effect.element.makeClipping();effect.element.setStyle({height:'0px'});effect.element.show();},afterFinishInternal:function(effect){effect.element.undoClipping();}},arguments[1]||{}));}
Effect.SwitchOff=function(element){element=$(element);var oldOpacity=element.getInlineOpacity();return new Effect.Appear(element,{duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(effect){new Effect.Scale(effect.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(effect){effect.element.makePositioned();effect.element.makeClipping();},afterFinishInternal:function(effect){effect.element.hide();effect.element.undoClipping();effect.element.undoPositioned();effect.element.setStyle({opacity:oldOpacity});}})}});}
Effect.DropOut=function(element){element=$(element);var oldStyle={top:element.getStyle('top'),left:element.getStyle('left'),opacity:element.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(element,{x:0,y:100,sync:true}),new Effect.Opacity(element,{sync:true,to:0.0})],Object.extend({duration:0.5,beforeSetup:function(effect){effect.effects[0].element.makePositioned();},afterFinishInternal:function(effect){effect.effects[0].element.hide();effect.effects[0].element.undoPositioned();effect.effects[0].element.setStyle(oldStyle);}},arguments[1]||{}));}
Effect.Shake=function(element){element=$(element);var oldStyle={top:element.getStyle('top'),left:element.getStyle('left')};return new Effect.Move(element,{x:20,y:0,duration:0.05,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-40,y:0,duration:0.1,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:40,y:0,duration:0.1,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-40,y:0,duration:0.1,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:40,y:0,duration:0.1,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-20,y:0,duration:0.05,afterFinishInternal:function(effect){effect.element.undoPositioned();effect.element.setStyle(oldStyle);}})}})}})}})}})}});}
Effect.SlideDown=function(element){element=$(element);element.cleanWhitespace();var oldInnerBottom;var elementDimensions=element.getDimensions();return new Effect.Scale(element,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup:function(effect){effect.element.makePositioned();effect.element.firstChild.makePositioned();if(window.opera)effect.element.setStyle({top:''});effect.element.makeClipping();effect.element.setStyle({height:'0px'});effect.element.show();},afterUpdateInternal:function(effect){effect.element.firstChild.setStyle({bottom:(effect.dims[0]-effect.element.clientHeight)+'px'});},beforeStartInternal:function(effect){effect.oldInnerBottom=$(effect.element.firstChild).getStyle('bottom');},afterFinishInternal:function(effect){effect.element.undoClipping();if(/MSIE/.test(navigator.userAgent)){effect.element.undoPositioned();effect.element.firstChild.undoPositioned();}else{effect.element.firstChild.undoPositioned();effect.element.undoPositioned();}
effect.element.firstChild.setStyle({bottom:effect.oldInnerBottom});}},arguments[1]||{}));}
Effect.SlideUp=function(element){element=$(element);element.cleanWhitespace();var oldInnerBottom;return new Effect.Scale(element,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:'box',scaleFrom:100,restoreAfterFinish:true,beforeStartInternal:function(effect){effect.oldInnerBottom=$(effect.element.firstChild).getStyle('bottom');effect.element.makePositioned();effect.element.firstChild.makePositioned();if(window.opera)effect.element.setStyle({top:''});effect.element.makeClipping();effect.element.show();},afterUpdateInternal:function(effect){effect.element.firstChild.setStyle({bottom:(effect.dims[0]-effect.element.clientHeight)+'px'});},afterFinishInternal:function(effect){effect.element.hide();effect.element.undoClipping();effect.element.firstChild.undoPositioned();effect.element.undoPositioned();effect.element.setStyle({bottom:effect.oldInnerBottom});}},arguments[1]||{}));}
Effect.Squish=function(element){return new Effect.Scale(element,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(effect){effect.element.makeClipping(effect.element);},afterFinishInternal:function(effect){effect.element.hide(effect.element);effect.element.undoClipping(effect.element);}});}
Effect.Grow=function(element){element=$(element);var options=Object.extend({direction:'center',moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});var oldStyle={top:element.style.top,left:element.style.left,height:element.style.height,width:element.style.width,opacity:element.getInlineOpacity()};var dims=element.getDimensions();var initialMoveX,initialMoveY;var moveX,moveY;switch(options.direction){case'top-left':initialMoveX=initialMoveY=moveX=moveY=0;break;case'top-right':initialMoveX=dims.width;initialMoveY=moveY=0;moveX=-dims.width;break;case'bottom-left':initialMoveX=moveX=0;initialMoveY=dims.height;moveY=-dims.height;break;case'bottom-right':initialMoveX=dims.width;initialMoveY=dims.height;moveX=-dims.width;moveY=-dims.height;break;case'center':initialMoveX=dims.width/2;initialMoveY=dims.height/2;moveX=-dims.width/2;moveY=-dims.height/2;break;}
return new Effect.Move(element,{x:initialMoveX,y:initialMoveY,duration:0.01,beforeSetup:function(effect){effect.element.hide();effect.element.makeClipping();effect.element.makePositioned();},afterFinishInternal:function(effect){new Effect.Parallel([new Effect.Opacity(effect.element,{sync:true,to:1.0,from:0.0,transition:options.opacityTransition}),new Effect.Move(effect.element,{x:moveX,y:moveY,sync:true,transition:options.moveTransition}),new Effect.Scale(effect.element,100,{scaleMode:{originalHeight:dims.height,originalWidth:dims.width},sync:true,scaleFrom:window.opera?1:0,transition:options.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(effect){effect.effects[0].element.setStyle({height:'0px'});effect.effects[0].element.show();},afterFinishInternal:function(effect){effect.effects[0].element.undoClipping();effect.effects[0].element.undoPositioned();effect.effects[0].element.setStyle(oldStyle);}},options))}});}
Effect.Shrink=function(element){element=$(element);var options=Object.extend({direction:'center',moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});var oldStyle={top:element.style.top,left:element.style.left,height:element.style.height,width:element.style.width,opacity:element.getInlineOpacity()};var dims=element.getDimensions();var moveX,moveY;switch(options.direction){case'top-left':moveX=moveY=0;break;case'top-right':moveX=dims.width;moveY=0;break;case'bottom-left':moveX=0;moveY=dims.height;break;case'bottom-right':moveX=dims.width;moveY=dims.height;break;case'center':moveX=dims.width/2;moveY=dims.height/2;break;}
return new Effect.Parallel([new Effect.Opacity(element,{sync:true,to:0.0,from:1.0,transition:options.opacityTransition}),new Effect.Scale(element,window.opera?1:0,{sync:true,transition:options.scaleTransition,restoreAfterFinish:true}),new Effect.Move(element,{x:moveX,y:moveY,sync:true,transition:options.moveTransition})],Object.extend({beforeStartInternal:function(effect){effect.effects[0].element.makePositioned();effect.effects[0].element.makeClipping();},afterFinishInternal:function(effect){effect.effects[0].element.hide();effect.effects[0].element.undoClipping();effect.effects[0].element.undoPositioned();effect.effects[0].element.setStyle(oldStyle);}},options));}
Effect.Pulsate=function(element){element=$(element);var options=arguments[1]||{};var oldOpacity=element.getInlineOpacity();var transition=options.transition||Effect.Transitions.sinoidal;var reverser=function(pos){return transition(1-Effect.Transitions.pulse(pos))};reverser.bind(transition);return new Effect.Opacity(element,Object.extend(Object.extend({duration:3.0,from:0,afterFinishInternal:function(effect){effect.element.setStyle({opacity:oldOpacity});}},options),{transition:reverser}));}
Effect.Fold=function(element){element=$(element);var oldStyle={top:element.style.top,left:element.style.left,width:element.style.width,height:element.style.height};Element.makeClipping(element);return new Effect.Scale(element,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(effect){new Effect.Scale(element,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(effect){effect.element.hide();effect.element.undoClipping();effect.element.setStyle(oldStyle);}});}},arguments[1]||{}));};['setOpacity','getOpacity','getInlineOpacity','forceRerendering','setContentZoom','collectTextNodes','collectTextNodesIgnoreClass','childrenWithClassName'].each(function(f){Element.Methods[f]=Element[f];});Element.Methods.visualEffect=function(element,effect,options){s=effect.gsub(/_/,'-').camelize();effect_class=s.charAt(0).toUpperCase()+s.substring(1);new Effect[effect_class](element,options);return $(element);};Element.addMethods();var Behaviour={list:new Array,register:function(sheet){Behaviour.list.push(sheet);},start:function(){Behaviour.addLoadEvent(function(){Behaviour.apply();});},apply:function(){for(h=0;sheet=Behaviour.list[h];h++){for(selector in sheet){list=document.getElementsBySelector(selector);if(!list){continue;}
for(i=0;element=list[i];i++){sheet[selector](element);}}}},addLoadEvent:function(func){var oldonload=window.onload;if(typeof window.onload!='function'){window.onload=func;}else{window.onload=function(){oldonload();func();}}}}
Behaviour.start();function getAllChildren(e){return e.all?e.all:e.getElementsByTagName('*');}
document.getElementsBySelector=function(selector){if(!document.getElementsByTagName){return new Array();}
var tokens=selector.split(' ');var currentContext=new Array(document);for(var i=0;i<tokens.length;i++){token=tokens[i].replace(/^\s+/,'').replace(/\s+$/,'');;if(token.indexOf('#')>-1){var bits=token.split('#');var tagName=bits[0];var id=bits[1];var element=document.getElementById(id);if(tagName&&element.nodeName.toLowerCase()!=tagName){return new Array();}
currentContext=new Array(element);continue;}
if(token.indexOf('.')>-1){var bits=token.split('.');var tagName=bits[0];var className=bits[1];if(!tagName){tagName='*';}
var found=new Array;var foundCount=0;for(var h=0;h<currentContext.length;h++){var elements;if(tagName=='*'){elements=getAllChildren(currentContext[h]);}else{elements=currentContext[h].getElementsByTagName(tagName);}
for(var j=0;j<elements.length;j++){found[foundCount++]=elements[j];}}
currentContext=new Array;var currentContextIndex=0;for(var k=0;k<found.length;k++){if(found[k].className&&found[k].className.match(new RegExp('\\b'+className+'\\b'))){currentContext[currentContextIndex++]=found[k];}}
continue;}
if(token.match(/^(\w*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/)){var tagName=RegExp.$1;var attrName=RegExp.$2;var attrOperator=RegExp.$3;var attrValue=RegExp.$4;if(!tagName){tagName='*';}
var found=new Array;var foundCount=0;for(var h=0;h<currentContext.length;h++){var elements;if(tagName=='*'){elements=getAllChildren(currentContext[h]);}else{elements=currentContext[h].getElementsByTagName(tagName);}
for(var j=0;j<elements.length;j++){found[foundCount++]=elements[j];}}
currentContext=new Array;var currentContextIndex=0;var checkFunction;switch(attrOperator){case'=':checkFunction=function(e){return(e.getAttribute(attrName)==attrValue);};break;case'~':checkFunction=function(e){return(e.getAttribute(attrName).match(new RegExp('\\b'+attrValue+'\\b')));};break;case'|':checkFunction=function(e){return(e.getAttribute(attrName).match(new RegExp('^'+attrValue+'-?')));};break;case'^':checkFunction=function(e){return(e.getAttribute(attrName).indexOf(attrValue)==0);};break;case'$':checkFunction=function(e){return(e.getAttribute(attrName).lastIndexOf(attrValue)==e.getAttribute(attrName).length-attrValue.length);};break;case'*':checkFunction=function(e){return(e.getAttribute(attrName).indexOf(attrValue)>-1);};break;default:checkFunction=function(e){return e.getAttribute(attrName);};}
currentContext=new Array;var currentContextIndex=0;for(var k=0;k<found.length;k++){if(checkFunction(found[k])){currentContext[currentContextIndex++]=found[k];}}
continue;}
if(!currentContext[0]){return;}
tagName=token;var found=new Array;var foundCount=0;for(var h=0;h<currentContext.length;h++){var elements=currentContext[h].getElementsByTagName(tagName);for(var j=0;j<elements.length;j++){found[foundCount++]=elements[j];}}
currentContext=found;}
return currentContext;}
AlbumMenuManager=Class.create();var AlbumMenuManager_instance=null;AlbumMenuManager.prototype={initialize:function(nodePageMenuContainerIn,year,albumId,sectionId,username,styleId,styleVersion,allowOrderPrints,allowDownloadOriginal,isLoggedIn,showStartSlideshow,searchBoxElementId,albumIn,allowRss,allowEmailUpdates)
{this.album=albumIn;this.album_id=albumId;this.section_id=sectionId;this.username=username;this.style_id=styleId;this.style_version=styleVersion;this.nodePageMenuContainer=nodePageMenuContainerIn;this.nodePageMenu=Common_GetChildById(this.nodePageMenuContainer,"menu");this.nodePageMenuItemOrderPrints=Common_GetChildById(this.nodePageMenu,"albumMenuItemOrderPrints");this.nodePageMenuItemDownloadSlideshow=Common_GetChildById(this.nodePageMenu,"albumMenuItemDownloadSlideshow");this.nodeContextStartSlideShow=Common_GetChildById(this.nodePageMenu,"albumMenuStartSlideShow");this.nodePageMenuItemBulkDownload=Common_GetChildById(this.nodePageMenu,"albumMenuItemBulkDownload");this.nodePageMenuItemOrderPrints.onclick=this.onOrderPrintsNewClick.bindAsEventListener(this);this.nodePageMenuItemDownloadSlideshow.onclick=this.onDownloadSlideshowClick.bindAsEventListener(this);this.nodePageMenuItemBulkDownload.onclick=this.onBulkDownloadClick.bindAsEventListener(this);Common_SetVisibility(this.nodePageMenuItemBulkDownload,allowDownloadOriginal);Common_SetVisibility(this.nodePageMenuItemDownloadSlideshow,allowDownloadOriginal);Common_SetVisibility(this.nodePageMenuItemOrderPrints,Common_AllowOrderPrints);this.setupBulkDownloadPanel();this.setupDownloadSlideshowPanel();if(this.nodeContextStartSlideShow)
{this.nodeContextStartSlideShow.onclick=this.onStartSlideshowClick.bindAsEventListener(this);Common_SetVisibility(this.nodeContextStartSlideShow,true);}
this.clickEvent=new YAHOO.util.CustomEvent("albumMenuClick",this,true,YAHOO.util.CustomEvent.LIST);AlbumMenuManager_instance=this;this.javaScriptId="AlbumMenuManager_instance";},setupBulkDownloadPanel:function()
{Common_GetChildById(this.nodePageMenu,"downloadAlbumButton").onclick=this.doBulkDownload.bindAsEventListener(this);var containsVideo=false;for(var i=0;i<this.album.images.length;i++)
{if(this.album.images[i].isVideo)
{containsVideo=true;break;}}
Common_SetVisibility(Common_GetChildById(this.nodePageMenu,"imageMenuFormDownloadAlbumCheckboxIncludeVideoWrapper"),containsVideo);Common_SetVisibility(Common_GetChildById(this.nodePageMenu,"imageMenuFormDownloadAlbumCheckboxAllSectionsWrapper"),this.album.num_sections>1);},setupDownloadSlideshowPanel:function()
{Common_GetChildById(this.nodePageMenu,"downloadSlideshowButton").onclick=this.doDownloadSlideshow.bindAsEventListener(this);var containsVideo=false;for(var i=0;i<this.album.images.length;i++)
{if(this.album.images[i].isVideo)
{containsVideo=true;break;}}
Common_SetVisibility(Common_GetChildById(this.nodePageMenu,"imageMenuFormDownloadSlideshowCheckboxIncludeVideoWrapper"),containsVideo&&this.album.slideshow_include_video);if(Common_isMac)
Common_GetChildById(this.nodePageMenu,"downloadSlideshowPlatform_MAC_OSX").checked=true;else
Common_GetChildById(this.nodePageMenu,"downloadSlideshowPlatform_WIN32").checked=true;},onBulkDownloadClick:function()
{if(Element.visible('albumMenuPanelBulkDownloadOuterDiv'))
this.hideDownloadAlbumPanel();else
this.showDownloadAlbumPanel();},doBulkDownload:function()
{var includeVideo=$('checkboxIncludeVideo').checked;var rendition=$('checkboxFullSize').checked?"Full":"Web";var allSections=$('checkboxAllSections').checked;Element.hide('downloadAlbumButton');Element.show('imageMenuBulkDownloadWaitMsg');setTimeout(this.javaScriptId+".hideDownloadAlbumPanel()",2000);if(Common_PageType=='Site'){document.location=Common_String_Format("http://{5}/bulk_download.aspx?s=0&a_id={0}{4}&username={1}&rend={2}&video={3}",this.album.album_id,Common_Username,rendition,includeVideo?"video":"still",!allSections?"&s_id="+this.album.section_id:"",Common_AffinityHost);}else if(Common_PageType=='SiteCName'){document.location=Common_String_Format("http://{5}/bulk_download.aspx?s=0&a_id={0}{4}&cname={1}&rend={2}&video={3}&ss={6}",this.album.album_id,Common_CName,rendition,includeVideo?"video":"still",!allSections?"&s_id="+this.album.section_id:"",Common_AffinityHost,Common_Session);}else if(Common_PageType=='IsolatedLink'){document.location=Common_String_Format("http://{5}/bulk_download.aspx?i=1&a_id={0}{4}&db={1}&pw={6}&rend={2}&video={3}",this.album.album_id,Common_DbId,rendition,includeVideo?"video":"still",!allSections?"&s_id="+this.album.section_id:"",Common_AffinityHost,Common_SysPass);}},showDownloadAlbumPanel:function()
{this.resetDownloadAlbumPanel();Effect.BlindDown('albumMenuPanelBulkDownloadOuterDiv',{queue:{position:'end',scope:'bulkdownload'}});},hideDownloadAlbumPanel:function(noEffects)
{if($('albumMenuPanelBulkDownloadOuterDiv')!=null)
{if(noEffects)
Element.hide('albumMenuPanelBulkDownloadOuterDiv');else
Effect.BlindUp('albumMenuPanelBulkDownloadOuterDiv',{queue:{position:'end',scope:'bulkdownload'}});}},showDownloadSlideshowPanel:function()
{this.resetDownloadSlideshowPanel();Effect.BlindDown('albumMenuPanelDownloadSlideshowOuterDiv',{queue:{position:'end',scope:'downloadslideshow'}});},hideDownloadSlideshowPanel:function(noEffects)
{if($('albumMenuPanelDownloadSlideshowOuterDiv')!=null)
{if(noEffects)
Element.hide('albumMenuPanelDownloadSlideshowOuterDiv');else
Effect.BlindUp('albumMenuPanelDownloadSlideshowOuterDiv',{queue:{position:'end',scope:'downloadslideshow'}});}},resetDownloadAlbumPanel:function()
{Element.show('downloadAlbumButton');Element.hide('imageMenuBulkDownloadWaitMsg');},resetDownloadSlideshowPanel:function()
{Element.show('downloadSlideshowButton');Element.hide('imageMenuDownloadSlideshowWaitMsg');},onDownloadSlideshowClick:function()
{if(Element.visible('albumMenuPanelDownloadSlideshowOuterDiv'))
this.hideDownloadSlideshowPanel();else
this.showDownloadSlideshowPanel();},doDownloadSlideshow:function()
{var includeVideo=$('checkboxDownloadSlideshowIncludeVideo').checked;var platform=$('downloadSlideshowPlatform_MAC_OSX').checked?"macosx":"win32";if(Common_PageType=='Site'){document.location=Common_String_Format("http://{4}/download_slideshow.aspx?s=0&a_id={0}&username={1}&platform={2}&include_videos={3}",this.album_id,Common_Username,platform,includeVideo?"1":"0",Common_AffinityHost);}else if(Common_PageType=='SiteCName'){document.location=Common_String_Format("http://{4}/download_slideshow.aspx?s=0&a_id={0}&cname={1}&platform={2}&include_videos={3}&ss={5}",this.album_id,Common_CName,platform,includeVideo?"1":"0",Common_AffinityHost,Common_Session);}else if(Common_PageType=='IsolatedLink'){document.location=Common_String_Format("http://{5}/download_slideshow.aspx?i=1&a_id={0}&pw={1}&db={2}&platform={3}&include_videos={4}",this.album_id,Common_SysPass,Common_DbId,platform,includeVideo?"1":"0",Common_AffinityHost);}
this.clickEvent.fire();},onReturnToTOCClick:function()
{document.location=Common_String_Format("/{0}",this.year);this.clickEvent.fire();},onOrderPrintsNewClick:function()
{document.location=Common_String_Format("http://{0}/shop/?uid={1}&a_id={2}&s_id={3}&username={4}&cname={5}&type={6}&siteId={7}{8}",Common_HostName,Common_TargetUid,this.album_id,this.section_id,Common_Username,Common_CName,Common_PageType,Common_SiteID,Common_PageType=='SiteCName'?'&cc='+Common_Session:'');this.clickEvent.fire();},onViewCommentsClick:function()
{var xy=YAHOO.util.Dom.getXY('commentDiv');window.scrollTo(xy[0],xy[1]);this.clickEvent.fire();},onStartSlideshowClick:function()
{this.clickEvent.fire();var url=null;if(Common_PageType=='Site'){url=Common_String_Format("/slideshow.aspx?s=0&username={0}&a_id={1}",Common_Username,this.album_id);}else if(Common_PageType=='SiteCName'){url=Common_String_Format("/slideshow.aspx?s=0&cname={0}&a_id={1}",Common_CName,this.album_id);}else if(Common_PageType=='IsolatedLink'){url=Common_String_Format("/slideshow.aspx?i=1&pw={0}&db={1}&a_id={2}",Common_SysPass,Common_DbId,this.album_id);}
if(this.section_id>0)
url+="&s_id="+this.section_id;document.location=url;}}
var InlineImage_PHANFARE_FLV_MIN_WIDTH=220;var InlineImage_PHANFARE_FLV_CONTROLLER_HEIGHT=54;var InlineImage_QT_CONTROLLER_HEIGHT=16;var InlineImage_WMP_CONTROLLER_HEIGHT=45;var InlineImage_UNKNOWN_CONTROLLER_HEIGHT=32;var InlineImage_WMP_CLSID="22D6F312-B0F6-11D0-94AB-0080C74C7E95";var InlineImage_QT_CLSID="02BF25D5-8C17-4B23-BC80-D3488ABDDC6B";var InlineImage_FLASH_CLSID="d27cdb6e-ae6d-11cf-96b8-444553540000";var InlineImage_PreviewMissingImageWidth=320;var InlineImage_PreviewMissingImageHeight=240;var InlineImage_PreviewMissingSrc="/psimages/video_preview_not_available.gif";var InlineImage_CaptionMaxLength=99999;var InlineImage_cpuRateBandwidths=[{cpuRate:700,maximumBitrate:750}];var InlineImage_presetVideoBandwidthsOldFLV=[250,400,700,1000,9999999];var InlineImage_presetVideoBandwidthsFLV=[256,736,9999999];var InlineImage_presetVideoBandwidthsH264=[512,896,1328,9999999];var InlineImage_FullScreenAllowedScaleDown=0.3;var InlineImage_FullScreenAllowedScaleUp=0.2;var InlineImage_InlineImageAllowedScaleDown=0.0
var InlineImage_InlineImageAllowedScaleUp=0.0;var InlineImage_FlashAvailable=true;var InlineImage_FullScreenMargins=25;var InlineImage_initialFullScreenID=-1;InlineImageManager=Class.create();InlineImageManager.prototype={javaScriptId:null,pageManager:null,album:null,inlineImageDisplayProperties:null,currentPosition:0,currentDisplayedPosition:null,videoPlayPendingTest:false,imageCache:null,nodeContextMenuContainer:null,nodeContextMenu:null,nodeContextDownloadHiRes:null,nodeContextDownloadRaw:null,nodeContextDownloadVideo:null,nodeContextDownloadVideoStill:null,nodeContextViewFullScreen:null,nodeContextViewEXIF:null,nodeContextLinkToImage:null,nodeContextStartSlideShow:null,nodeContextAddToPrintOrder:null,nodeContextPlayVideo:null,nodeContextViewFullScreen:null,nodeImageWidthConstraint:null,nodeVideoPlayOverlay:null,nodeLoadingIndicator:null,_isLoading:false,nodeImageParent:null,nodeCaptionWrapper:null,nodeEXIFWrapper:null,nodeNavPrev:null,nodeNavNext:null,nodeCurrentImageWrapper:null,nodeCurrentImageWrapperInnerDiv:null,nodeFullScreenOutterWrapper:null,nodeFullScreenInnerDiv:null,nodeFullScreenImageWrapper:null,nodeFullScreenLoadingIndicator:null,iOwnContextMenu:false,suppressContextMenu:false,unspupressContextMenuTimeout:null,initialized:false,videoPlaying:false,initialize:function(javaScriptIdIn,inlineImageDisplayPropertiesIn,imageParentId,imageWidthConstraintId,captionWrapperId,EXIFWrapperId,prevArrowId,nextArrowId,loadingIndicatorId,menuContainerId,fullScreenOutterWrapperId,albumIn,pageManagerIn,googleMap)
{this.setPageManager(pageManagerIn);this.service=new YAHOO.phanfare.service.Service();this.googleMap=googleMap;this.imageCache=imageCache;this.inlineImageDisplayProperties=inlineImageDisplayPropertiesIn;this.javaScriptId=javaScriptIdIn;this.album=albumIn;this.nodeImageParent=$(imageParentId);this.nodeImageWidthConstraint=$(imageWidthConstraintId);this.nodeCaptionWrapper=$(captionWrapperId);this.nodeFullScreenOutterWrapper=$(fullScreenOutterWrapperId);this.nodeFullScreenInnerDiv=Common_GetChildById(this.nodeFullScreenOutterWrapper,"fullScreenImageInnerDiv");this.nodeFullScreenImageWrapper=Common_GetChildById(this.nodeFullScreenOutterWrapper,"fullScreenImageWrapper");this.nodeFullScreenLoadingIndicator=Common_GetChildById(this.nodeFullScreenOutterWrapper,"fullScreenLoadingIndicator");this.nodeEXIFWrapper=$(EXIFWrapperId);this.nodeEXIFTable=Common_GetChildById(this.nodeEXIFWrapper,"inlineImageExifLayerContentDiv");this.initializeNavArrows(prevArrowId,nextArrowId);this.initializeContextMenu(menuContainerId,Common_HideAlbumMenu);this.nodeLoadingIndicator=$(loadingIndicatorId);this.nodeVideoPlayOverlay=$('inlineImageVideoPlayOverlay');Common_DetachNode(this.nodeVideoPlayOverlay);Common_SetVisibility(this.nodeVideoPlayOverlay,true);this.detachNodesToSave();if(this.iOwnContextMenu)
{this.nodeContextMenuContainer.onmouseout=this.onMouseLeaveContextMenu.bindAsEventListener(this);}
Common_SetDisplayN('hybridAlbumInlineImageCaptionBorderTable',true);InlineImage_FlashAvailable=Common_DetectFlashVer(7,0,0);InlineImage_DownloadFlashNode=Common_SetupDownloadFlashNode("hybridAlbumInlineImage");this.initialized=true;this.startTestBandwidth(10);this.videoMask=null;this.keyPressEnabled=true;this.keyPressedEvent=new YAHOO.util.CustomEvent("keyPressed");this.keyPressedEvent.subscribe(this.keyPressed,this,true);},initializeContextMenu:function(menuContainerId,inlineImageOwnsMenu)
{this.nodeContextMenuContainer=$(menuContainerId);this.nodeContextMenu=Common_GetChildById(this.nodeContextMenuContainer,"menu");this.nodeContextDownloadHiRes=Common_GetChildById(this.nodeContextMenu,"imageMenuItemDownloadHiRes");this.nodeContextDownloadRAW=Common_GetChildById(this.nodeContextMenu,"imageMenuItemDownloadRAW");this.nodeContextDownloadVideo=Common_GetChildById(this.nodeContextMenu,"imageMenuItemDownloadVideo");this.nodeContextViewEXIF=Common_GetChildById(this.nodeContextMenu,"imageMenuItemViewEXIF");this.nodeContextAddToPrintOrder=Common_GetChildById(this.nodeContextMenu,"itemAddToPrintOrder");this.nodeContextPlayVideo=Common_GetChildById(this.nodeContextMenu,"imageMenuItemPlayVideo");this.nodeContextViewFullScreen=Common_GetChildById(this.nodeContextMenu,"imageMenuItemViewFullScreen");if(this.album!=null&&this.album.images.length==0)
{Common_SetVisibility(this.nodeContextDownloadHiRes,false);Common_SetVisibility(this.nodeContextDownloadRAW,false);Common_SetVisibility(this.nodeContextDownloadVideo,false);Common_SetVisibility(this.nodeContextViewEXIF,false);Common_SetVisibility(this.nodeContextPlayVideo,false);Common_SetVisibility(this.nodeContextViewFullScreen,false);var imageHeader=Common_GetChildById(this.nodeContextMenu,"menuImageHeader");Common_SetVisibility(imageHeader,false);}
this.nodeContextDownloadHiRes.onclick=this.onDownloadHiResClick.bindAsEventListener(this);this.nodeContextDownloadRAW.onclick=this.onDownloadRAWClick.bindAsEventListener(this);this.nodeContextDownloadVideo.onclick=this.onDownloadHiResClick.bindAsEventListener(this);this.nodeContextViewEXIF.onclick=this.onViewEXIFClick.bindAsEventListener(this);this.nodeContextPlayVideo.onclick=this.playVideoAtCurrentPosition.bindAsEventListener(this);this.nodeContextViewFullScreen.onclick=this.showCurrentPositionFullScreen.bindAsEventListener(this);this.iOwnContextMenu=inlineImageOwnsMenu;},setPageManager:function(pageManagerIn)
{this.pageManager=pageManagerIn;},getCurrentPosition:function()
{return this.currentPosition;},initializeNavArrows:function(prevArrowId,nextArrowId)
{this.nodeNavPrev=$(prevArrowId);this.nodeNavNext=$(nextArrowId);this.nodeViewMap=$('hybridAlbumInlineImageViewMapLink');this.nodeNavPrev.onclick=this.movePrevious.bindAsEventListener(this);this.nodeNavNext.onclick=this.moveNext.bindAsEventListener(this);this.nodeViewMap.onclick=this.showMap.bindAsEventListener(this);},showMap:function()
{var position=this.currentPosition;var iid=this.pageManager.album.images[position].image_id;this.googleMap.showMap(iid);},setWidth:function(width)
{this.nodeImageWidthConstraint.width=width;Common_SetStyleAttribute(this.nodeImageWidthConstraint,'width',width+'px');},detachNodesToSave:function()
{Common_DetachNode(this.nodeLoadingIndicator);Common_DetachNode(this.nodeEXIFWrapper);if(this.iOwnContextMenu)
Common_DetachNode(this.nodeContextMenuContainer);},numImages:function()
{return this.album.images.length;},setDisplayLoading:function(show)
{this._isLoading=show;Common_SetVisibility(this.nodeLoadingIndicator,show);},onResize:function()
{if(!this.initialized)
return;if(!this.isVideoPlaying())
{this.moveTo(this.currentPosition,this);}else{this.centerVideo(this.nodeCurrentImageWrapper);}
if(this.isFullScreenShowing())
{this.fullScreenRedraw();}},redraw:function()
{this.draw(this.currentPosition,false);},isVideoPlaying:function()
{return this.videoPlaying;},draw:function(position,drawVideo)
{this.videoPlaying=false;this.detachNodesToSave();this.setDisplayLoading(false);this.updateContextMenu(position);this.hideEXIF();this.clearEXIF()
this.updateNavArrows(position);this.updateCaption(position,false);if(drawVideo)
{var requiredWidth=this.updateVideo(position,true);if(requiredWidth>this.getAvailableWidth())
{this.pageManager.setInlineImageMinWidth(requiredWidth);}}
else
{this.pageManager.setInlineImageMinWidth(null);this.updateStillImage(position);}
this.currentDisplayedPosition=position;},isLoading:function()
{return this._isLoading;},imageLoadedCallback:function(e,timeout)
{var waitingForACallback=this.isLoading();if(!waitingForACallback)
{return;}
else
{if(this.imageIsDisplayable(this.currentPosition,null,false))
{this.redraw();if(typeof BOOMR!=="undefined"){BOOMR.imageLoaded=true;if(BOOMR.imageLoaded&&BOOMR.thumbnailsLoading==0){BOOMR.page_ready();}}}
else
{if(timeout==null)
{newTimeout=50;}
else
{newTimeout=Math.max(timeout*2,1000);}
window.setTimeout(this.javaScriptId+".imageLoadedCallback(null, "+newTimeout+")",newTimeout);}}},showCurrentPositionFullScreen:function()
{this.hideContextMenu();YAHOO.util.History.navigate("imageID",'-'+this.album.images[this.currentPosition].image_id);},hideFullScreen:function(imageId)
{var wasShowing=this.isFullScreenShowing();Common_SetVisibility(this.nodeFullScreenOutterWrapper,false);Common_SetVisibility(Common_GetChildById(document.body,"hybridAlbumIEBody"),true);if(wasShowing==true)
{hybridAlbumManager.lastWindowWidth=0
hybridAlbumManager.lastWindowHeight=0
hybridAlbumManager.onWindowSizeChanged();}
if(imageId!=null)
{imageId=Math.abs(imageId);for(var i=0;i<this.album.images.length;i++)
{if(this.album.images[i].image_id==imageId)
{this.pageManager.moveTo(i,this);return;}}}},isFullScreenShowing:function()
{return Element.visible(this.nodeFullScreenOutterWrapper);},startShowFullScreen:function(position)
{this.hideContextMenu();this.hideEXIF();Common_SetScrollTop(0);Common_RemoveChildren(this.nodeFullScreenImageWrapper);Common_SetVisibility(this.nodeFullScreenLoadingIndicator,false);Common_SetVisibility(this.nodeFullScreenOutterWrapper,true);Common_SetVisibility(Common_GetChildById(document.body,"hybridAlbumIEBody"),false);if(InlineImage_FlashAvailable)
{this.fullScreenDraw(position,false);return;}
position=Common_Mod(position,this.album.images.length);var image=this.album.images[position];var renditionToLoad=this.getBestRendition(position,true);if(this.imageIsDisplayable(position,renditionToLoad))
{this.fullScreenDraw(position,false);}
else
{var imageURL=Common_GetRenditionURL(image,renditionToLoad);var callbackDelegate=null;callbackDelegate=this.fullScreenImageLoadedCallback.bindAsEventListener(this);this.imageCache.loadImage(imageURL,callbackDelegate);}},fullScreenImageLoadedCallback:function(e,timeout)
{if(this.imageIsDisplayable(this.currentPosition,null,true))
{this.fullScreenRedraw();}
else
{if(timeout==null)
{newTimeout=50;}
else
{newTimeout=Math.max(timeout*2,1000);}
window.setTimeout(this.javaScriptId+".endShowFullScreen(null, "+newTimeout+")",newTimeout);}},fullScreenRedraw:function()
{this.fullScreenDraw(this.currentPosition,false);},fullScreenDraw:function(position)
{if(!InlineImage_FlashAvailable)
{this.fullScreenDrawIMG(position);}
else
{this.fullScreenDrawFlash(position);}},fullScreenDrawIMG:function(position)
{var IMG=document.createElement("img");var image=this.album.images[position];var rendition=this.getBestRendition(position,true);IMG.src=Common_GetRenditionURL(image,rendition);var me=this;IMG.onclick=function(){me.hideFullScreen(image.image_id);};var renditionInfo=Common_GetRenditionInfo(rendition);var windowHeight=Common_GetWindowHeight();var anticipatedDimensions=Common_GetAnticipatedDimensions(image.aspect_ratio,renditionInfo.maxWidth,renditionInfo.maxHeight);var topMargin=parseInt((windowHeight-anticipatedDimensions.height)/2);Common_SetStyleAttribute(this.nodeFullScreenInnerDiv,'margin-top',topMargin+"px");Common_RemoveChildren(this.nodeFullScreenImageWrapper);this.nodeFullScreenImageWrapper.appendChild(IMG);},fullScreenDrawFlash:function(position)
{var image=this.album.images[position];var rendition=this.getBestRendition(position,true,InlineImage_FullScreenAllowedScaleDown,InlineImage_FullScreenAllowedScaleUp);var url=Common_GetRenditionURL(image,rendition);var renditionInfo=Common_GetRenditionInfo(rendition);var anticipatedDimensions=Common_GetAnticipatedDimensions(image.aspect_ratio,renditionInfo.maxWidth,renditionInfo.maxHeight)
var windowHeight=Common_GetWindowHeight();var windowWidth=Common_GetWindowWidth();var availableHeight=windowHeight-2*InlineImage_FullScreenMargins-20;var availableWidth=windowWidth-2*InlineImage_FullScreenMargins-20;var displayWidth=availableWidth;var displayHeight=availableHeight;var topMargin=parseInt((windowHeight-displayHeight)/2)-16;Common_SetStyleAttribute(this.nodeFullScreenInnerDiv,'margin-top',topMargin+"px");var quitFunction=Common_String_Format("{0}.hideFullScreen",this.javaScriptId);var onImageLoadedUrl="javascript:void(0)";var initialUrl=Common_GetRenditionURL(image,rendition);var flashVars=null;if(Common_PageType=='Site'){flashVars={albumId:image.album_id,sectionId:image.section_id,initialImageId:image.image_id,initialImageVersion:image.image_version,initialImageAspectRatio:image.aspect_ratio,mode:"MODE_FULLSCREEN_DISPLAY",quitFunction:escape(quitFunction),onImageLoadedUrl:escape(onImageLoadedUrl),targetUid:Common_TargetUid,showEffects:this.album.slideshow_effects_enabled?"1":"0",loop:"1",delay:this.album.slideshow_perimage_time,affinity_node:Common_AffinityHost,initialRendition:rendition,initialUrl:initialUrl,host:Common_HostName,albumhost:Common_AlbumHostName,username:Common_Username};}else if(Common_PageType=='SiteCName'){flashVars={albumId:image.album_id,sectionId:image.section_id,initialImageId:image.image_id,initialImageVersion:image.image_version,initialImageAspectRatio:image.aspect_ratio,mode:"MODE_FULLSCREEN_DISPLAY",quitFunction:escape(quitFunction),onImageLoadedUrl:escape(onImageLoadedUrl),targetUid:Common_TargetUid,showEffects:this.album.slideshow_effects_enabled?"1":"0",loop:"1",delay:this.album.slideshow_perimage_time,affinity_node:Common_AffinityHost,initialRendition:rendition,initialUrl:initialUrl,host:Common_HostName,albumhost:Common_AlbumHostName,cname:Common_CName};}else if(Common_PageType=='IsolatedLink'){flashVars={i:"1",albumId:image.album_id,sectionId:image.section_id,initialImageId:image.image_id,initialImageVersion:image.image_version,initialImageAspectRatio:image.aspect_ratio,mode:"MODE_FULLSCREEN_DISPLAY",quitFunction:escape(quitFunction),onImageLoadedUrl:escape(onImageLoadedUrl),targetUid:Common_TargetUid,showEffects:this.album.slideshow_effects_enabled?"1":"0",loop:"1",delay:this.album.slideshow_perimage_time,affinity_node:Common_AffinityHost,initialRendition:rendition,initialUrl:initialUrl,host:Common_HostName,albumhost:Common_AlbumHostName,db:Common_DbId,pw:Common_SysPass};}
this.nodeFullScreenImageWrapper.innerHTML='<div id="fullscreenFlashObject"></div>';window.Slideshow_Loaded=function(){var flashObj=$('fullscreenFlashObject');if(flashObj!=null){flashObj.tabIndex=1;flashObj.focus();}}
var params={Quality:"High",allowScriptAccess:"always",allowFullScreen:"true"};swfobject.embedSWF("/psflash/FlashBrowser.swf?v=4.0.0","fullscreenFlashObject",displayWidth,displayHeight,"9.0.115","/psflash/expressInstall.swf",flashVars,params);if(ph_pageTitle!=null)
{Common_ieTitleHack_Stop_Condition=!this.isFullScreenShowing();Common_ieTitleHack_Page_Title=ph_pageTitle;Common_ieTitleHack();}},fullScreenResize:function()
{var windowHeight=Common_GetWindowHeight();var windowWidth=Common_GetWindowWidth();var availableHeight=windowHeight-2*InlineImage_FullScreenMargins-20;var availableWidth=windowWidth-2*InlineImage_FullScreenMargins-20;var displayWidth=availableWidth;var displayHeight=availableHeight;var topMargin=parseInt((windowHeight-displayHeight)/2)-16;Common_SetStyleAttribute(this.nodeFullScreenInnerDiv,'margin-top',topMargin+"px");var flashObj=$('fullscreenFlashObject');var flashEmbed=$('fullscreenFlashEmbed');Common_SetStyleAttribute(flashObj,'height',displayHeight+"px");Common_SetStyleAttribute(flashEmbed,'height',displayHeight+"px");Common_SetStyleAttribute(flashObj,'width',displayWidth+"px");Common_SetStyleAttribute(flashEmbed,'width',displayWidth+"px");},setFullScreenLoading:function(show)
{Common_SetVisibility(this.nodeFullScreenLoadingIndicator,show);},isFullScreenLoading:function()
{return Element.visible(this.nodeFullScreenLoadingIndicator);},moveTo:function(position)
{if(position>=this.album.images.length)
return;this.videoPlayPendingTest=false;this.hideContextMenu();this.hideEXIF();this.currentPosition=position=Common_Mod(position,this.album.images.length);var image=this.album.images[position];var renditionToLoad=this.getBestRendition(position,false);if(this.imageIsDisplayable(position,renditionToLoad,false))
{this.draw(position,false);}
else
{this.setDisplayLoading(true);var imageURL=Common_GetRenditionURL(image,renditionToLoad);if(imageURL==null){imageURL=image.isVideo==false?"/mediaservice/stockimages/ImageNotAvailable.WebSmall.jpg":"/mediaservice/stockimages/VideoComingSoon.WebSmall.jpg";}
var callbackDelegate=null;callbackDelegate=this.imageLoadedCallback.bindAsEventListener(this);this.imageCache.loadImage(imageURL,callbackDelegate);}},moveDelta:function(delta)
{this.moveTo(this.currentPosition+delta);this.preloadPosition(this.currentPosition+delta+(delta>0?1:-1));this.pageManager.moveTo(this.currentPosition,this);},moveNext:function()
{if(this.currentPosision>=this.album.images.length-1)
return false;this.moveDelta(1);return false;},movePrevious:function()
{if(this.currentPosition<=0)
return false;this.moveDelta(-1);return false;},preloadPosition:function(position)
{position=Common_Mod(position,this.album.images.length);var renditionToLoad=this.getBestRendition(position,false);if(!this.imageIsDisplayable(position,renditionToLoad,false))
{var image=this.album.images[position];var imageURL=Common_GetRenditionURL(image,renditionToLoad);this.imageCache.loadImage(imageURL,null);}},restartVideo:function(position)
{this.onVideoPlay();},playVideo:function(position)
{this.draw(position,true);},playVideoAtCurrentPosition:function()
{this.onVideoPlay(this.currentPosition);},showContextMenu:function()
{return;if(!this.iOwnContextMenu)
return;if(this.suppressContextMenu)
return;if(this.exifIsShowing())
return;Common_SetHilightedStatus(this.nodeContextMenu,false,true);this.setContextMenuVisibility(true);},hideContextMenu:function(suppressReshowUntilMoveOut)
{return;this.unhilightContextMenu();if(!this.iOwnContextMenu)
return;this.pageManager.albumMenuManager.hideDownloadAlbumPanel(true);this.pageManager.albumMenuManager.hideDownloadSlideshowPanel(true);this.pageManager.albumMenuManager.hideEmailSubscribePanel(true);this.setContextMenuVisibility(false);if(suppressReshowUntilMoveOut)
{this.doSuppressContextMenu();}},unhilightContextMenu:function()
{Common_SetHilightedStatus(this.nodeContextMenu,false,true);},setContextMenuVisibility:function(show)
{Common_SetVisibility(this.nodeContextMenu,show);},displayExternal:function()
{this.nodeEXIFTable.innerHTML=Common_HtmlDecode(window.frames['EXIFIframe'].document.body.innerHTML);},showEXIF:function()
{this.hideContextMenu();this.updateEXIF(this.currentPosition);this.setEXIFVisibility(true);},hideEXIF:function()
{this.setEXIFVisibility(false);this.clearEXIF();},setEXIFVisibility:function(show)
{Common_SetVisibility(this.nodeEXIFWrapper,show);},exifIsShowing:function()
{return Element.visible(this.nodeEXIFWrapper);},updateContextMenu:function(position)
{var image=this.album.images[position];this.hideContextMenu();Common_SetVisibility(this.nodeContextDownloadHiRes,Common_AllowDownloadOriginal&&image.fullSizeUploaded&&!image.isVideo);Common_SetVisibility(this.nodeContextDownloadRAW,Common_AllowDownloadRaw&&image.has_raw);Common_SetVisibility(this.nodeContextDownloadVideo,Common_AllowDownloadOriginal&&image.fullSizeUploaded&&image.isVideo);Common_SetVisibility(this.nodeContextViewEXIF,this.album.allow_view_EXIF&&!this.isVideoPlaying());Common_SetVisibility(this.nodeContextPlayVideo,this.album.images[position].isVideo&&this.album.images[position].fullSizeUploaded);Common_SetVisibility(this.nodeContextViewFullScreen,!image.isVideo&&InlineImage_FlashAvailable);},updateNavArrows:function(position)
{Common_SetVisibility2(this.nodeNavPrev,position>0);Common_SetVisibility2(this.nodeNavNext,position<(this.numImages()-1));if(Common_AllowGPS)
{Common_SetVisibility2(this.nodeViewMap,this.pageManager.album.images[position].has_gps);}},updateCaption:function(position,truncate)
{Common_RemoveChildren(this.nodeCaptionWrapper);var captionText=this.album.images[position].caption_text;var captionTextTruncated;if(truncate&&captionText.length>InlineImage_CaptionMaxLength)
{captionTextTruncated=captionText.substring(0,InlineImage_CaptionMaxLength)+"&hellip; <span class=\"inlineImageCaptionContinuesIndicator\">more</span>";var span=document.createElement("span");span.innerHTML=captionTextTruncated;this.nodeCaptionWrapper.appendChild(span);}
else
{this.nodeCaptionWrapper.innerHTML=captionText;}
if(captionText.length>0)
{Element.show('hybridAlbumInlineImageCaptionWrapperDiv');}
else
{Element.hide('hybridAlbumInlineImageCaptionWrapperDiv');}},updateStillImage:function(position)
{var image=this.album.images[position];var availableHeight=this.getAvailableHeight();var availableWidth=this.getAvailableWidth();var renditionToLoad=this.getBestRendition(position,false,null,null);var web_rendition=null;for(var i=0;i<image.image_renditions.length;i++)
{if(image.image_renditions[i].rendition_type==renditionToLoad)
{web_rendition=image.image_renditions[i];break;}}
var imageWidth;var imageHeight;var imageURL;if(web_rendition==null){for(var i=0;i<image.image_renditions.length;i++)
{if(image.image_renditions[i].rendition_type=="Thumbnail")
{web_rendition=image.image_renditions[i];break;}}
if(web_rendition==null){imageWidth=575;imageHeight=575;imageURL=image.isVideo==false?"/mediaservice/stockimages/ImageNotAvailable.WebSmall.jpg":"/mediaservice/stockimages/VideoComingSoon.WebSmall.jpg";}
else{imageWidth=web_rendition.width;imageHeight=web_rendition.height;imageURL=Common_GetRenditionURL(image,"Thumbnail");}}
else{imageWidth=web_rendition.width;imageHeight=web_rendition.height;imageURL=Common_GetRenditionURL(image,renditionToLoad);}
var imageNode=this.imageCache.getImage(imageURL);var linkTargetPair=this.makeLinkTarget(position);var imageBarParameters=this.makeImageBarParameters(position);if(image.isVideo==true&&image.aspect_ratio!=0&&image.orientation%360==0&&web_rendition!=null)
{imageWidth=image.aspect_ratio*imageHeight;if(imageWidth*imageHeight>640*480)
{imageHeight=Math.sqrt((640*480)/image.aspect_ratio);imageWidth=(640*480)/imageHeight;}}
var id="inlineImage";var altText=linkTargetPair.altText;if(Common_isIE)
altText=null;var overlay=this.nodeVideoPlayOverlay.cloneNode(true);overlay.onclick=this.playVideoAtCurrentPosition.bindAsEventListener(this);var imageSrc=null;if(imageNode==null)
{imageSrc=imageURL;}
var newNodeCurrentImageWrapper=Common_MakeCroppableIMG2(imageNode,imageSrc,this.inlineImageDisplayProperties.imageCssClassName,false,Common_AllowDownloadOriginal?false:true,false,linkTargetPair.linkURL,linkTargetPair.onClickParameters,imageHeight,imageWidth,imageHeight,imageWidth,imageBarParameters.showBar,imageBarParameters.barIconURL,imageBarParameters.barIconIEURL,imageBarParameters.barIconLinkURL,imageBarParameters.barText,imageBarParameters.barLinkURL,altText,true,null,id,null,null,new Array(this.nodeLoadingIndicator,this.iOwnContextMenu?this.nodeContextMenuContainer:null,this.nodeEXIFWrapper),image.isVideo&&image.fullSizeUploaded?Array(overlay):null);this.hideContextMenu();this.nodeImageParent.appendChild(newNodeCurrentImageWrapper);this.nodeImageParent.style.height="";if(this.nodeCurrentImageWrapper!=null)
{if(Common_isIPad==false){var player=flowplayer('player');if(player){player.close();player.unload();this.videoPlaying=false;}}else{this.videoPlaying=false;}
Common_DetachNode(this.nodeCurrentImageWrapper);}
this.nodeCurrentImageWrapper=newNodeCurrentImageWrapper;this.nodeCurrentImageWrapperInnerDiv=Common_GetChildById(this.nodeCurrentImageWrapper,id+"InnerDiv");if(this.iOwnContextMenu)
this.nodeCurrentImageWrapperInnerDiv.onmouseover=function(){if(!this.isLoading()){this.showContextMenu()}}.bindAsEventListener(this);this.nodeCurrentImageWrapperInnerDiv.onmouseout=this.onMouseLeaveImage.bindAsEventListener(this);},updateVideo:function(position,autoplay)
{this.videoPlaying=true;this.updateContextMenu(position);this.detachNodesToSave();var image=this.album.images[position];Common_RemoveChildren(this.nodeImageParent);var lqRendition=null;var mqRendition=null;var hqRendition=null;var hdRendition=null;var anchor=document.getElementById("player");var hasH264=false;for(var i=0;i<image.image_renditions.length;i++){var rendition=image.image_renditions[i];if(rendition.media_type=="video/mp4"&&rendition.rendition_type=="FullFlv"&&rendition.height<720){hasH264=true;break;}}
var prefs=this.getVideoPrefs();var renditionsToShow=new Array();var noMeta=false;for(var i=0;i<image.image_renditions.length;i++){var rendition=image.image_renditions[i];if(rendition.media_type=="video/mp4"){if(rendition.rendition_type=="FullFlv"){if(rendition.height<720&&rendition.width<1280){renditionsToShow.push(rendition);}else{hdRendition=rendition;hdRendition.bufferLength=prefs==null?3:this.calculateBufferTime(image.video_duration,hdRendition.quality,prefs.bandwidth);}}}else if(rendition.media_type=="video/x-flv"&&hasH264==false&&rendition.rendition_type=="FullFlv"){renditionsToShow.push(rendition);noMeta=true;}}
renditionsToShow.sort(function(a,b){if(a.width==b.width){return a.quality-b.quality;}else{return a.width-b.width;}});if(renditionsToShow.length==0){this.updateVideoNoFlash(position,autoplay);return;}else if(renditionsToShow.length==1){mqRendition=renditionsToShow[0];mqRendition.bufferLength=prefs==null?3:this.calculateBufferTime(image.video_duration,mqRendition.quality,prefs.bandwidth);}else if(renditionsToShow.length==2){mqRendition=renditionsToShow[0];mqRendition.bufferLength=prefs==null?3:this.calculateBufferTime(image.video_duration,mqRendition.quality,prefs.bandwidth);hqRendition=renditionsToShow[1];hqRendition.bufferLength=prefs==null?3:this.calculateBufferTime(image.video_duration,hqRendition.quality,prefs.bandwidth);}else if(renditionsToShow.length>=3){lqRendition=renditionsToShow[renditionsToShow.length-3];lqRendition.bufferLength=prefs==null?3:this.calculateBufferTime(image.video_duration,lqRendition.quality,prefs.bandwidth);mqRendition=renditionsToShow[renditionsToShow.length-2];mqRendition.bufferLength=prefs==null?3:this.calculateBufferTime(image.video_duration,mqRendition.quality,prefs.bandwidth);hqRendition=renditionsToShow[renditionsToShow.length-1];hqRendition.bufferLength=prefs==null?3:this.calculateBufferTime(image.video_duration,hqRendition.quality,prefs.bandwidth);}
var screenWidth=null;var screenHeight=null;if(mqRendition.width>mqRendition.height){screenWidth=Math.min(640,Math.max(this.getAvailableWidth(),575));screenHeight=Math.round(screenWidth/mqRendition.aspect_ratio);}else{screenHeight=Math.min(640,Math.max(this.getAvailableHeight(),575));screenWidth=Math.round(screenHeight*mqRendition.aspect_ratio);}
if(image.aspect_ratio>0&&Math.round(image.aspect_ratio*100)/100!=Math.round(mqRendition.aspect_ratio*100)/100){screenHeight=screenWidth/image.aspect_ratio;if(lqRendition!=null){lqRendition.width=Math.round(lqRendition.height*image.aspect_ratio);}
if(mqRendition!=null){mqRendition.width=Math.round(mqRendition.height*image.aspect_ratio);}
if(lqRendition!=null){hqRendition.width=Math.round(hqRendition.height*image.aspect_ratio);}
if(hdRendition!=null){hdRendition.width=Math.round(hdRendition.height*image.aspect_ratio);}}
var div=document.createElement("div");div.style.display="block";div.id="player";div.style.textAlign="center";div.style.position="absolute";var playerWidth;var playerHeight;if(image.orientation==0||image.orientation==180){playerWidth=screenWidth;playerHeight=screenHeight;}else{playerWidth=screenHeight;playerHeight=screenWidth;}
div.style.width=playerWidth+"px";div.style.height=playerHeight+"px";this.nodeCurrentImageWrapper=div;this.nodeImageParent.appendChild(div);this.nodeImageParent.style.height=(playerHeight+56)+"px";var qualityPref=Common_GetPref("vqs");var startRendition=mqRendition;startRendition.qName="MQ";if(qualityPref=="LQ"&&lqRendition!=null){startRendition=lqRendition;startRendition.qName="LQ";}else if(qualityPref=="HQ"&&hqRendition!=null){startRendition=hqRendition;startRendition.qName="HQ";}
this.isHD=false;var me=this;YAHOO.util.Event.addListener(window,"resize",function(){if(me.isHD==false){return;}
if(hdRendition){me.videoFillScreen(me.playerScreen,image.orientation,hdRendition,div);}});this.onFullscreenExitFunc=function(){me.isHD=false;me.videoBackToNormal(this.getScreen(),div,image.orientation,screenWidth,screenHeight,playerWidth,playerHeight);me.removeMask();};if(Common_isIPad==false){flowplayer("player","http://"+Common_AlbumHostName+"/flowplayer/flowplayer.commercial.swf?v=4.0.0",{key:'#$24e7870aaa57cf91dc0',version:[9,115],expressInstall:'http://albums.phanfare.com/expressInstall.swf',plugins:{controls:{backgroundGradient:'none',backgroundColor:'transparent',autoHide:'always',hideDelay:2000,bottom:5,fullscreen:image.orientation==0},quality:{defaultQuality:startRendition.qName,duration:image.video_duration,rotation:image.orientation,noMeta:noMeta,lqUrl:{url:lqRendition==null?null:lqRendition.priv_url,originalWidth:lqRendition!=null?lqRendition.width:0,originalHeight:lqRendition!=null?lqRendition.height:0,bufferLength:lqRendition!=null?lqRendition.bufferLength:3},mqUrl:{url:mqRendition==null?null:mqRendition.priv_url,originalWidth:mqRendition!=null?mqRendition.width:0,originalHeight:mqRendition!=null?mqRendition.height:0,bufferLength:mqRendition!=null?mqRendition.bufferLength:3},hqUrl:{url:hqRendition==null?null:hqRendition.priv_url,originalWidth:hqRendition!=null?hqRendition.width:0,originalHeight:hqRendition!=null?hqRendition.height:0,bufferLength:hqRendition!=null?hqRendition.bufferLength:3},hdUrl:{url:hdRendition==null?null:hdRendition.priv_url,originalWidth:hdRendition!=null?hdRendition.width:0,originalHeight:hdRendition!=null?hdRendition.height:0,bufferLength:hdRendition!=null?hdRendition.bufferLength:3},onQualityChange:function(val){if(val=="LQ"||val=="MQ"||val=="HQ"){Common_SetPref("vqs",val);if(me.isHD==false){return;}
me.isHD=false;me.videoBackToNormal(me.playerScreen,div,image.orientation,screenWidth,screenHeight,playerWidth,playerHeight);me.removeMask();}else if(val=="HD"){if(me.isHD==true){return;}
me.videoFillScreen(me.playerScreen,image.orientation,hdRendition,div);me.addMask();me.isHD=true;}
this.getPlayer().getControls().css('bottom','8px')}}},canvas:{backgroundColor:'#000000',backgroundGradient:'none'},onFullscreenExit:me.onFullscreenExitFunc,onLoad:function(){me.playerScreen=this.getScreen();if(image.orientation!=0){this.getScreen().css('width',screenWidth);this.getScreen().css('height',screenHeight);}}});flowplayer('player').play();}else{var video=document.createElement("video");video.id="html5player";video.src=startRendition.priv_url;video.width=playerWidth;video.height=playerHeight;video.autoplay=true;video.controls=true;div.appendChild(video);}
this.centerVideo(div);return screenWidth;},videoFillScreen:function(screen,orientation,hdRendition,div){var videoWidth=hdRendition.width;var videoHeight=hdRendition.height;var aspectRatio=hdRendition.width/hdRendition.height;var maxWidth=YAHOO.util.Dom.getViewportWidth()-70;var maxHeight=YAHOO.util.Dom.getViewportHeight()-20;if(orientation==90||orientation==270){var temp=videoWidth;videoWidth=videoHeight;videoHeight=temp;aspectRatio=videoWidth/videoHeight;}
if(videoWidth>maxWidth||videoHeight>maxHeight)
{if(videoWidth>maxWidth){videoWidth=maxWidth;videoHeight=Math.round(videoWidth/aspectRatio);}
if(videoHeight>maxHeight){videoHeight=maxHeight;videoWidth=Math.round(videoHeight*aspectRatio);}}
var screenWidth=videoWidth;var screenHeight=videoHeight;if(orientation==90||orientation==270){screenWidth=videoHeight;screenHeight=videoWidth;}
div.style.width=videoWidth+"px";div.style.height=videoHeight+"px";div.style.zIndex=1000;div.style.left=((YAHOO.util.Dom.getViewportWidth()/2)-(videoWidth/2))+"px";div.style.top=((YAHOO.util.Dom.getViewportHeight()/2)-(videoHeight/2))+"px";div.style.border="6px solid #FFFFFF";if(this.closeB==null){this.closeB=document.createElement("div");YAHOO.util.Dom.addClass(this.closeB,"videoHDClose");div.appendChild(this.closeB);var me=this;YAHOO.util.Event.addListener(this.closeB,"click",me.onFullscreenExitFunc,flowplayer("player"),true);}
if(orientation!=0){screen.css('width',screenWidth);screen.css('height',screenHeight);}},videoBackToNormal:function(screen,div,orientation,screenWidth,screenHeight,playerWidth,playerHeight){if(this.closeB!=null){div.removeChild(this.closeB);this.closeB=null;}
div.style.width=playerWidth+"px";div.style.height=playerHeight+"px";this.centerVideo(div);div.style.top="";div.style.zIndex=1;div.style.border="none";if(orientation!=0){screen.css('width',screenWidth);screen.css('height',screenHeight);}},centerVideo:function(div){if(this.videoPlaying==false||this.isHD==true){return;}
var out=YAHOO.util.Region.getRegion(this.nodeImageWidthConstraint);var inner=YAHOO.util.Region.getRegion(div);var leftOffset=out.left+((out.width/2)-(inner.width/2));if(out.width<inner.width){leftOffset=out.left;}
this.nodeCurrentImageWrapper.style.left=leftOffset+"px";},addMask:function(){if(this.videoMask){return;}
this.videoMask=document.createElement("div");YAHOO.util.Dom.addClass(this.videoMask,"videoMask");document.body.appendChild(this.videoMask);},removeMask:function(){if(this.videoMask==null){return;}
document.body.removeChild(this.videoMask);this.videoMask=null;},calculateBufferTime:function(flvLength,flvBitrate,bandwidth){if(bandwidth<=100){return 3;}
var bufferTime;if(flvBitrate>bandwidth){bufferTime=Math.ceil(flvLength-flvLength/(flvBitrate/bandwidth));}else{bufferTime=0;}
bufferTime+=3;return Math.min(flvLength,bufferTime);},updateVideoNoFlash:function(position,autoplay)
{this.videoPlaying=true;this.updateContextMenu(position);var videoWrapper=this.makeVideoEmbedHTML(position,autoplay);if(videoWrapper==null)
return 0;var wrapper;var useIframe=videoWrapper.useIframe;if(useIframe)
{wrapper=document.createElement("iframe");wrapper.height=videoWrapper.height;wrapper.width=videoWrapper.width;wrapper.frameBorder=0;wrapper.marginwidth=0;wrapper.marginheight=0;wrapper.leftmargin=0;wrapper.topmargin=0;wrapper.scrolling="no";}
else
{wrapper=document.createElement("div");wrapper.innerHTML=videoWrapper.HTML;}
wrapper.name=wrapper.id="InlineImage_VideoPlayerParent";this.nodeCurrentImageWrapper=Common_MakeCroppableIMG(wrapper,null,videoWrapper.videoSizeUnknown?"none":this.inlineImageDisplayProperties.videoCssClassName,false,false,false,null,null,videoWrapper.height,videoWrapper.width,videoWrapper.height,videoWrapper.width,false,null,null,null,null,null,!videoWrapper.videoSizeUnknown,null,'fubarbazTODOGiveMeABetterId',null,null,null);this.detachNodesToSave();Common_RemoveChildren(this.nodeImageParent);this.nodeImageParent.appendChild(this.nodeCurrentImageWrapper);this.nodeImageParent.style.height="";if(useIframe)
{InlineImage_VideoPlayerParent.document.write(Common_String_Format("<html><head></head><body marginwidth=0 marginheight=0 topmargin=0 leftmargin=0>{0}</body></html>",videoWrapper.HTML));}
return videoWrapper.width;},onMouseLeaveImage:function(evt)
{var hideIt=Common_CheckMouseLeave(this.nodeCurrentImageWrapperInnerDiv,evt,new Array(this.nodeContextMenuContainer));if(hideIt)
{this.hideContextMenu();}
this.unSuppressContextMenu();},doSuppressContextMenu:function()
{this.suppressContextMenu=true;if(this.unSuppressContextMenuTimeOut!=null)
clearTimeout(this.unSuppressContextMenuTimeout);this.unSuppressContextMenuTimeout=setTimeout(this.javaScriptId+".unSuppressContextMenu()",1000);},unSuppressContextMenu:function()
{this.suppressContextMenu=false;if(this.unSuppressContextMenuTimeOut!=null)
clearTimeout(this.unSuppressContextMenuTimeout)},onMouseLeaveContextMenu:function(evt)
{var hideContextMenuOnly=Common_CheckMouseLeave(this.nodeContextMenuContainer,evt,null);if(hideContextMenuOnly)
{this.hideContextMenu();}},onMouseLeaveContextMenuWrapper:function(evt)
{},onDownloadHiResClick:function(evt)
{this.hideContextMenu();var image=this.album.images[this.currentPosition];if(!image.fullSizeUploaded)
{alert("The high-resolution version of this image is not available because it has not yet been uploaded.");return;}
else
{document.location=Common_GetRenditionURLWithDisposition(image,"Full");}},onDownloadRAWClick:function(evt)
{this.hideContextMenu();var image=this.album.images[this.currentPosition];if(!image.has_raw)
{alert("There is no RAW file associated with this image.");return;}
else
{document.location=Common_String_Format("/webclient/Service.asmx/GetRawLink?session_cookie={0}&target_uid={1}&album_id={2}&image_id={3}",Common_GetCookie("phanfare2"),Common_TargetUid,image.album_id,image.image_id);}},onDownloadVideoStill:function(evt)
{var rendition=this.getBestRendition(this.currentPosition,false,0,0);if(rendition==null){document.location="/mediaservice/stockimages/VideoComingSoon.WebSmall.jpg";}
else{document.location=Common_GetRenditionURLWithDisposition(this.album.images[this.currentPosition],rendition);}},onViewEXIFClick:function(evt)
{if(!this.exifIsShowing())
this.showEXIF();else
this.hideEXIF();},onLinkToImageClick:function(evt)
{var image=this.album.images[this.currentPosition];var url=Common_String_Format("/show/external/{0}/{1}/{2}/file.jpg",image.album_id,image.section_id,image.image_id);document.location=url;},getBestRendition:function(position,fullScreen,allowedScaleDown,allowedScaleUp)
{if(allowedScaleDown==null)
allowedScaleDown=0;if(allowedScaleUp==null)
allowedScaleUp=0;var image=this.album.images[position];var w;var h;if(!fullScreen)
{w=this.getAvailableWidth();h=this.getAvailableHeight();}
else
{w=Common_GetWindowWidth();h=Common_GetWindowHeight();}
var rendition=Common_BestImageRendition(image.aspect_ratio,w,h,allowedScaleDown,allowedScaleUp);if(image.image_renditions==null){return null;}
var r=Common_GetRenditionInfo(rendition);var startWidth=r.maxWidth;var currentWidth=0;var currentRendition=null;for(var i=0;i<image.image_renditions.length;i++)
{if(image.image_renditions[i].rendition_type==rendition)
{return rendition;}
else if((image.image_renditions[i].width>currentWidth)&&(image.image_renditions[i].width<=startWidth)){if((image.image_renditions[i].rendition_type=='Full')||(image.image_renditions[i].rendition_type=='Original')||(image.image_renditions[i].rendition_type=='FullFlv')||(image.image_renditions[i].rendition_type=='Thumbnail')||(image.image_renditions[i].rendition_type=='ThumbnailSmall'))continue;currentWidth=image.image_renditions[i].width;currentRendition=image.image_renditions[i].rendition_type;}}
return currentRendition;},imageIsDisplayable:function(position,rendition,fullScreen,allowedScaleDown,allowedScaleUp)
{if(rendition==null)
{rendition=this.getBestRendition(position,fullScreen,allowedScaleDown,allowedScaleUp);}
return this.imageIsCached(position,rendition)},imageIsCached:function(position,rendition)
{var image=this.album.images[position];var imageURL=Common_GetRenditionURL(image,rendition);if(imageURL==null){imageURL=image.isVideo==false?"/mediaservice/stockimages/ImageNotAvailable.WebSmall.jpg":"/mediaservice/stockimages/VideoComingSoon.WebSmall.jpg";}
return this.imageCache.imageIsCached(imageURL);},makeLinkTarget:function(position)
{var linkURL=null;var altText=null;var onClickParameters=null;var image=this.album.images[position];if(!image.isVideo)
{if(this.inlineImageDisplayProperties.linkTargetType=="ImageDetail")
{linkURL=Common_String_Format("/{0}/{1}_{2}#imageID={3}",Common_TargetUid,Common_AlbumID,Common_SectionIDs[ImagePosition],Common_ImageIDs[ImagePosition]);altText="Click to view larger image";}
else if(this.inlineImageDisplayProperties.linkTargetType=="Album")
{linkURL=Common_String_Format("/{0}/{1}_0#imageID={2}",Common_TargetUid,Common_AlbumID,Common_ImageIDs[ImagePosition]);altText="Click to return to album";}
else if(this.inlineImageDisplayProperties.linkTargetType=="None")
{linkUrl=null;altText=null}
else if(this.inlineImageDisplayProperties.linkTargetType=="FullScreen")
{linkUrl=null;onClickParameters={onClickHandler:this.showCurrentPositionFullScreen.bindAsEventListener(this)};altText="Click to view full-screen image";}
else if(this.inlineImageDisplayProperties.linkTargetType=="Next")
{if(position<this.numImages()-1)
{linkURL=null;onClickParameters={onClickHandler:this.moveNext.bindAsEventListener(this)};altText="Click to move to next image";}}}
else
{if(image.fullSizeUploaded)
{linkURL=Common_String_Format("javascript: {0}.onVideoPlay({1})",this.javaScriptId,position);;altText="Click to Play Video";}
else
{}}
var rv={linkURL:linkURL,altText:altText,onClickParameters:onClickParameters};return rv;},clearEXIF:function()
{Common_RemoveChildren(this.nodeEXIFTable);},updateEXIF:function(position)
{Common_RemoveChildren(this.nodeEXIFTable);var url=null;if(Common_PageType=='Site'){url="/get_exif.aspx?s=0&username="+Common_Username+"&a_id="+Common_AlbumID+"&s_id="+Common_SectionID+"&i_id="+this.album.images[position].image_id;}else if(Common_PageType=='SiteCName'){url="/get_exif.aspx?s=0&cname="+Common_CName+"&a_id="+Common_AlbumID+"&s_id="+Common_SectionID+"&i_id="+this.album.images[position].image_id;}else if(Common_PageType=='IsolatedLink'){url="/get_exif.aspx?i=1&db="+Common_DbId+"&pw="+Common_SysPass+"&a_id="+Common_AlbumID+"&s_id="+Common_SectionID+"&i_id="+this.album.images[position].image_id;}
if(window.frames['EXIFIframe']){this.nodeEXIFTable.innerHTML='<table class="inlineImageExifLayerContentTable" id="inlineImageExifLayerContentTable"><tbody><tr><td>Loading EXIF...</td></tr></tbody></table>';window.frames['EXIFIframe'].location=url;}
},onVideoPlay:function(position){this.updateVideo(position);},makeImageBarParameters:function(position)
{var showBar=false;var barText=null;var barIconURL=null;var barIconIEURL=null;var barLinkURL=null;var barIconLinkURL=null;var image=this.album.images[position];if(image.isVideo)
{showBar=true;barIconURL=Common_VideoIconURL;barIconIEURL=Common_VideoIconIEURL;if(this.imageHasFLVFull(image))
{barText=altText="Click to Play Video";barLinkURL=barIconLinkURL=Common_String_Format("javascript: {0}.onVideoPlay({1})",this.javaScriptId,position);}
else if(image.errors==Common_ImageErrorFlags_FLV_CONVERSION_NOT_APPROPRIATE)
{barText=altText="Click to Play Video";barLinkURL=barIconLinkURL=Common_String_Format("javascript: {0}.onVideoPlay({1})",this.javaScriptId,position);}
else if((image.errors&Common_ImageErrorFlags_DURATION_TOO_LONG)>0)
{barText="This video was too long and has been removed.";}
else if((image.errors&Common_ImageErrorFlags_UNREADABLE)>0)
{barText="This video was unreadable and has been removed.";}
else if((image.errors&Common_ImageErrorFlags_FLV_CONVERSION_FAILED)>0)
{var playVideoUrl=barIconLinkURL=Common_String_Format("javascript: {0}.playVideo({1})",this.javaScriptId,position);var helpUrl=Common_String_Format("http://help.phanfare.com/index.php/Video_Conversion");barText=Common_String_Format("<a href=\"{0}\" class=\"{1}ImageBarText\">Click to Play Video.</a> <a href=\"{2}\" class=\"{1}ImageBarText\">This video failed to convert to Flash format. [Help]</a>",playVideoUrl,this.inlineImageDisplayProperties.imageCssClassName,helpUrl);}
else if(!image.fullSizeUploaded)
{barText="This video has not yet been uploaded.";}
else
{barLinkURL=null;var playVideoUrl=barIconLinkURL=Common_String_Format("javascript: {0}.playVideo({1})",this.javaScriptId,position);var helpUrl=Common_String_Format("http://help.phanfare.com/index.php/Video_Conversion");barText=Common_String_Format("<a href=\"{0}\" class=\"{1}ImageBarText\">Click to Play Video.</a> <a href=\"{2}\" class=\"{1}ImageBarText\">This video has not yet been converted to Flash format. [Help]</a>",playVideoUrl,this.inlineImageDisplayProperties.imageCssClassName,helpUrl);}}
var rv={showBar:showBar,barText:barText,barIconURL:barIconURL,barIconIEURL:barIconIEURL,barLinkURL:barLinkURL,barIconLinkURL:barIconLinkURL};return rv;},getAvailableWidth:function()
{var dimensions=Element.getDimensions(this.nodeImageWidthConstraint);return dimensions.width;},getAvailableHeight:function()
{var windowHeight=Common_GetWindowHeight();var positionOfWrapper=Common_FindPosition(this.nodeImageParent);var availableHeight=windowHeight-positionOfWrapper[1];return availableHeight;},makeVideoEmbedHTML:function(position,autoplay)
{var useIframe=Common_isIE||Common_isSafari;var o="";var image=this.album.images[position];var videoType=image.full_media_type;for(var i=0;i<image.image_renditions.length;i++)
{if(image.image_renditions[i].rendition_type=="Full")
{videoType=image.image_renditions[i].media_type;break;}}
var vidWidth;var vidHeight;var FlashVars;if(this.imageHasFLVFull(image))
{var videoPrefs=this.getVideoPrefs(false);if(this.isTestInProgress())
{videoPrefs={automatic:true,cpuRate:750,bandwidth:770,date:0};}
var flvRendition=this.getBestFLVRendition(image,videoPrefs.bandwidth,0,0,videoPrefs.cpuRate,videoPrefs.automatic);videoType="video/x-flv";var doBWTest;var hasH264=Common_DetectFlashVer(9,0,115);if(hasH264){doBWTest=(this.countFlvFullRenditions(image,"video/mp4")>1);}
else{doBWTest=(this.countFlvFullRenditions(image,"video/x-flv")>1);}
var testing=(videoPrefs.automatic&&videoPrefs.bandwidth<=0&&doBWTest);if(testing==true)
{vidWidth=350;vidHeight=300;}
else
{vidWidth=flvRendition.width;vidHeight=flvRendition.height;}
if(image.aspect_ratio!=0)
{vidWidth=image.aspect_ratio*vidHeight;if(vidWidth*vidHeight>640*480)
{vidHeight=Math.sqrt((640*480)/image.aspect_ratio);vidWidth=(640*480)/vidHeight;}}
var bandwidthsString="";var last=0;var renditionsSorted=image.image_renditions.sort(this.imageRenditionKbpsComparer);var useNewFLV=false;for(var i=0;i<renditionsSorted.length;i++)
{var rendition=renditionsSorted[i];if(rendition.rendition_type!="FullFlv")
continue;if(rendition.media_type=="video/mp4"){useNewFLV=true;break;}}
for(var i=0;i<renditionsSorted.length;i++)
{var rendition=renditionsSorted[i];if(rendition.rendition_type!="FullFlv")
continue;if(hasH264&&useNewFLV&&rendition.media_type!="video/mp4")
continue;if(!hasH264&&rendition.media_type!="video/x-flv")
continue;var rounded=this.roundVideoBandwidth(rendition.quality,rendition.media_type,useNewFLV);if(rounded==last)
continue;if(last>0)
bandwidthsString+=",";bandwidthsString+=rounded;last=rounded;}
var orientation=testing?0:image.orientation;var FLVFullUrl=flvRendition.priv_url;FlashVars=Common_String_Format("video_url={0}&video_width={1}&video_height={2}&video_duration={3}&auto_play={4}&player_width={5}&inlineImage_Object_Id={6}&video_bandwidth_autodetected={7}&video_bandwidth={8}&cpu_rate={9}&available_bandwidths={10}&chosen_bandwidth={11}&video_orientation={12}",escape(FLVFullUrl),vidWidth,vidHeight,image.video_duration,(autoplay?"1":"0"),Math.max(vidWidth,InlineImage_PHANFARE_FLV_MIN_WIDTH),this.javaScriptId,videoPrefs.automatic?"1":"0",videoPrefs.bandwidth,videoPrefs.cpuRate,bandwidthsString,flvRendition.quality,orientation);if((testing==false)&&(image.orientation%360==90||image.orientation%360==270))
{var swap=0;swap=vidWidth;vidWidth=vidHeight;vidHeight=swap;}}
else
{vidWidth=image.full_width;if(image.aspect_ratio>0){vidHeight=image.full_width/image.aspect_ratio;}else{vidHeight=0;}}
var fullUrl=Common_GetRenditionURL(image,"Full");var videoSizeUnknown=false;if(vidWidth==0)
{videoSizeUnknown=true;playerWidth=640;}
else
playerWidth=vidWidth;if(vidHeight==0)
{videoSizeUnknown=true;playerHeight=480;}
else
playerHeight=vidHeight;var objPlayerHeight=playerHeight;var objPlayerWidth=playerWidth;var embedPlayerHeight=playerHeight;var embedPlayerWidth=playerWidth;var vpEmbed="VideoPlayer.UNKNOWN";var vpObject="VideoPlayer.QUICKTIME";var objectAttributes=new Array();var objectParameters=new Array();var embedAttributes=new Array();var embedType=null;var useObjectDimensions=true;var hasRequiredFlashPlayer;switch(videoType)
{case"video/x-flv":useIframe=false;vpEmbed="VideoPlayer.PHANFARE_FLV";vpObject="VideoPlayer.PHANFARE_FLV";useObjectDimensions=true;hasRequiredFlashPlayer=Common_DetectFlashVer(9,0,115);if(!hasRequiredFlashPlayer)
{this.html=InlineImage_DownloadFlashNode.innerHTML;this.videoSizeUnknown=false;this.width=320;this.height=200;this.useIframe=false;return{useIframe:this.useIframe,HTML:this.html,width:this.width,height:this.height,videoSizeUnknown:false};}
break;case"video/quicktime":case"video/mp4":case"video/3gpp":case"video/3gpp2":vpEmbed="VideoPlayer.QUICKTIME";vpObject="VideoPlayer.QUICKTIME";embedType="video/quicktime";useObjectDimensions=true;break;case"video/x-msvideo":vpEmbed="VideoPlayer.WINDOWS_MEDIA_PLAYER";vpObject="VideoPlayer.WINDOWS_MEDIA_PLAYER";embedType="application/x-mplayer2";break;case"video/x-ms-wmv":vpEmbed="VideoPlayer.WINDOWS_MEDIA_PLAYER";vpObject="VideoPlayer.WINDOWS_MEDIA_PLAYER";embedType="video/x-ms-wmv";break;case"video/mpeg":vpObject="VideoPlayer.WINDOWS_MEDIA_PLAYER";vpEmbed="VideoPlayer.QUICKTIME";embedType="application/x-mpeg";break;default:break;}
if(Common_isSafari||(!Common_isIE&&vpEmbed=="VideoPlayer.WINDOWS_MEDIA_PLAYER"))
{fullUrl+="&ck="+Common_GetCookie("phanfare2");}
var typeSet=false;switch(vpEmbed)
{case"VideoPlayer.PHANFARE_FLV":embedPlayerWidth=Math.max(embedPlayerWidth,InlineImage_PHANFARE_FLV_MIN_WIDTH);embedPlayerHeight+=InlineImage_PHANFARE_FLV_CONTROLLER_HEIGHT;embedAttributes[embedAttributes.length]="type=\"application/x-shockwave-flash\"";typeSet=true;embedAttributes[embedAttributes.length]="src=\"http://"+Common_AffinityHost+"/psflash/flv_player.swf?v=4.0.0\"";embedAttributes[embedAttributes.length]="quality=\"high\"";embedAttributes[embedAttributes.length]="name=\"InlineImage_0_EMBED_FLV_PLAYER\"";embedAttributes[embedAttributes.length]="align=\"middle\"";embedAttributes[embedAttributes.length]="allowScriptAccess=\"always\"";embedAttributes[embedAttributes.length]="pluginspage=\"http://www.macromedia.com/go/getflashplayer\"";embedAttributes[embedAttributes.length]="bgcolor=\""+Common_bgColor+"\"";embedAttributes[embedAttributes.length]="FlashVars=\""+FlashVars+"\"";break;case"VideoPlayer.QUICKTIME":embedPlayerHeight+=InlineImage_QT_CONTROLLER_HEIGHT;embedAttributes[embedAttributes.length]="name=\"InlineImage_0_EMBED_QT_Player\"";embedAttributes[embedAttributes.length]="pluginspage=\"http://www.apple.com/quicktime/download/\"";embedAttributes[embedAttributes.length]="src=\""+fullUrl+"\"";embedAttributes[embedAttributes.length]="controller=\"true\"";embedAttributes[embedAttributes.length]="autostart=\""+(autoplay?"true":"false")+"\"";embedAttributes[embedAttributes.length]="cache=\"true\"";break;case"VideoPlayer.WINDOWS_MEDIA_PLAYER":embedPlayerHeight+=InlineImage_WMP_CONTROLLER_HEIGHT;embedAttributes[embedAttributes.length]="name=\"InlineImage_0_EMBED_WMP_Player\"";embedAttributes[embedAttributes.length]="plugsinspage=\"http://www.microsoft.com/Windows/Downloads/Contents/MediaPlayer/\"";embedAttributes[embedAttributes.length]="src=\""+fullUrl+"\"";embedAttributes[embedAttributes.length]="controller=\"true\"";embedAttributes[embedAttributes.length]="autostart=\"false\"";embedAttributes[embedAttributes.length]="cache=\"true\"";break;case"VideoPlayer.UNKNOWN":embedAttributes[embedAttributes.length]="type=\"video/"+videoType+"\"";typeSet=true;embedAttributes[embedAttributes.length]="controller=\"true\"";embedAttributes[embedAttributes.length]="autostart=\"false\"";embedAttributes[embedAttributes.length]="cache=\"true\"";break;}
embedAttributes[embedAttributes.length]="height=\""+embedPlayerHeight+"\"";embedAttributes[embedAttributes.length]="width=\""+embedPlayerWidth+"\"";if(!typeSet)
embedAttributes[embedAttributes.length]="type=\""+embedType+"\"";switch(vpObject)
{case"VideoPlayer.PHANFARE_FLV":objPlayerWidth=Math.max(objPlayerWidth,InlineImage_PHANFARE_FLV_MIN_WIDTH);objPlayerHeight+=InlineImage_PHANFARE_FLV_CONTROLLER_HEIGHT;objectAttributes[objectAttributes.length]="classid=\"clsid:"+InlineImage_FLASH_CLSID+"\"";objectAttributes[objectAttributes.length]="codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\"";objectAttributes[objectAttributes.length]="id=\"InlineImage_0_OBJECT_FLV_Player\"";objectAttributes[objectAttributes.length]="name=\"InlineImage_0_OBJECT_FLV_Player\"";objectAttributes[objectAttributes.length]="align=\"middle\"";objectParameters[objectParameters.length]="name=\"movie\" value=\"http://"+Common_AffinityHost+"/psflash/flv_player.swf?v=4.0.0\"";objectParameters[objectParameters.length]="name=\"quality\" value=\"high\"";objectParameters[objectParameters.length]="name=\"FlashVars\" value=\""+FlashVars+"\"";objectParameters[objectParameters.length]="name=\"bgcolor\" value=\""+Common_bgColor+"\"";objectParameters[objectParameters.length]="name=\"allowScriptAccess\" value=\"always\"";break;case"VideoPlayer.QUICKTIME":objPlayerHeight+=InlineImage_QT_CONTROLLER_HEIGHT;objectAttributes[objectAttributes.length]="classid=\"clsid:"+InlineImage_QT_CLSID+"\"";objectAttributes[objectAttributes.length]="id=\"InlineImage_0_OBJECT_QT_Player\"";objectAttributes[objectAttributes.length]="name=\"InlineImage_0_OBJECT_QT_Player\"";objectAttributes[objectAttributes.length]="codebase=\"http://www.apple.com/qtactivex/qtplugin.cab\"";objectParameters[objectParameters.length]="name=\"src\" value=\""+fullUrl+"\"";objectParameters[objectParameters.length]="name=\"autoplay\" value=\""+(autoplay?"true":"false")+"\"";objectParameters[objectParameters.length]="name=\"controller\" value=\"true\"";objectParameters[objectParameters.length]="name=\"bgcolor\" value=\""+Common_bgColor+"\"";break;case"VideoPlayer.WINDOWS_MEDIA_PLAYER":objPlayerHeight+=InlineImage_WMP_CONTROLLER_HEIGHT;objectAttributes[objectAttributes.length]="classid=\"clsid:"+InlineImage_WMP_CLSID+"\"";objectAttributes[objectAttributes.length]="id=\"InlineImage_0_OBJECT_WMP_Player\"";objectAttributes[objectAttributes.length]="name=\"InlineImage_0_OBJECT_WMP_Player\"";objectParameters[objectParameters.length]="name=\"src\" value=\""+fullUrl+"\"";objectParameters[objectParameters.length]="name=\"autoplay\" value=\""+(autoplay?"true":"false")+"\"";objectParameters[objectParameters.length]="name=\"controller\" value=\"true\"";objectParameters[objectParameters.length]="name=\"bgcolor\" value=\""+Common_bgColor+"\"";break;case"VideoPlayer.UNKNOWN":objPlayerHeight+=InlineImage_UNKNOWN_CONTROLLER_HEIGHT;}
if(useObjectDimensions)
{objectAttributes[objectAttributes.length]="height=\""+objPlayerHeight+"\"";objectAttributes[objectAttributes.length]="width=\""+objPlayerWidth+"\"";}
var objectTag;var embedTag;objectTag="<object ";for(var i=0;i<objectAttributes.length;i++)
{objectTag+=" "+objectAttributes[i]+" ";}
objectTag+=">";embedTag="<embed ";for(var i=0;i<embedAttributes.length;i++)
{embedTag+=" "+embedAttributes[i]+" ";}
embedTag+="></embed>";o+=objectTag;for(var i=0;i<objectParameters.length;i++)
{var param="<param "+objectParameters[i]+">";o+=param;}
o+=embedTag;o+="</object>";var rv={useIframe:useIframe,HTML:o,width:Math.max(objPlayerWidth,embedPlayerWidth),height:Math.max(objPlayerHeight,embedPlayerHeight),videoSizeUnknown:videoSizeUnknown};return rv;},MaxAutoDetectAge:(60*15),getVideoPrefs:function(returnDefaultsIfTooOld)
{var automatic=true;var bandwidth=0;var cpuRate=0;var dateObj=new Date();var currentDate=Math.floor(dateObj.getTime()/1000);var setDate=currentDate;var tooOld=false;var vbrPref=Common_GetPref("vbr");if(vbrPref!=null)
{var vbrComponents=vbrPref.split(":");if(vbrComponents.length==4)
{var automatic2=vbrComponents[0]=="A";var bandwidth2=vbrComponents[1];var cpuRate2=vbrComponents[2];var setDate2=vbrComponents[3];tooOld=automatic&&this.videoPrefsOutOfDate(setDate2);if(!tooOld||!returnDefaultsIfTooOld)
{automatic=automatic2;bandwidth=bandwidth2;cpuRate=cpuRate2;setDate=setDate2;}}}
var rv={automatic:automatic,bandwidth:bandwidth,date:setDate,cpuRate:cpuRate};return rv;},videoPrefsOutOfDate:function(setDate,maxAgeScaleFactor)
{if(maxAgeScaleFactor==null)
maxAgeScaleFactor=1.0;var dateObj=new Date();var currentDate=Math.floor(dateObj.getTime()/1000);return(currentDate-setDate)>(this.MaxAutoDetectAge*maxAgeScaleFactor);},setVideoPrefs:function(automatic,bandwidth,cpuRate)
{var date=new Date();var time=Math.floor(date.getTime()/1000);var prefString=Common_String_Format("{0}:{1}:{2}:{3}",automatic?"A":"U",Math.floor(bandwidth),Math.floor(cpuRate),time);Common_SetPref("vbr",prefString);},onVideoBandwidthChanged:function(automatic,kbps,cpuRate,restartVideo)
{this.setVideoPrefs(automatic,kbps,cpuRate);},startTestBandwidth:function(inSeconds)
{setTimeout(Common_String_Format("{0}.testBandwidthInBackground();",this.javaScriptId),Math.floor(inSeconds*1000));},countFlvFullRenditions:function(image,media_type)
{var count=0;if(image.image_renditions!=null)
{for(var i=0;i<image.image_renditions.length;i++)
{if(image.image_renditions[i].rendition_type=="FullFlv"&&image.image_renditions[i].media_type==media_type)
{count++;}}}
return count;},testBandwidthInBackground:function()
{var doBWTest=false;var hasH264=Common_DetectFlashVer(9,0,115);for(var i=0;i<this.album.images.length;i++)
{var image=this.album.images[i];if(image.isVideo)
{if(hasH264){doBWTest=(this.countFlvFullRenditions(image,"video/mp4")>1);}
else{doBWTest=(this.countFlvFullRenditions(image,"video/x-flv")>1);}
if(doBWTest)
{break;}}}
if(!doBWTest)
{return;}
var videoPrefs=this.getVideoPrefs(false);if(InlineImage_FlashAvailable)
{if(!this.isTestInProgress()&&(this.videoPrefsOutOfDate(videoPrefs.date,0.90)||videoPrefs.bandwidth<=100))
{this.setTestInProgress(true);var existingTester=$("phanfareBandwidthTester");if(existingTester!=null)
{Common_DetachNode(existingTester);existingTester=null;}
var div=document.createElement("div");div.innerHTML='<div id="phanfareBandwidthTester"></div>';div.style.position="absolute";div.style.left="1px";div.style.top="1px";document.body.appendChild(div);var flashvars={javaScriptId:this.javaScriptId};var params={wmode:"transparent",quality:"high",bgcolor:"#000000",allowScriptAccess:"always"};swfobject.embedSWF("/psflash/BandwidthMeasurer.swf?v=4.0.0","phanfareBandwidthTester","1","1","8.0.0",false,flashvars,params);}}},getHighestAllowedBitrate:function(targetCPURate)
{for(var i=0;i<InlineImage_cpuRateBandwidths.length;i++)
{if(targetCPURate<=InlineImage_cpuRateBandwidths[i].cpuRate)
{return InlineImage_cpuRateBandwidths[i].maximumBitrate;}}
return Infinity;},roundVideoBandwidth:function(kbps,media_type,useNewFLV)
{var roundedRate=0;var presetList;if(media_type=="video/mp4"){presetList=InlineImage_presetVideoBandwidthsH264;}
else{if(useNewFLV){presetList=InlineImage_presetVideoBandwidthsFLV;}
else{presetList=InlineImage_presetVideoBandwidthsOldFLV;}}
for(var i=0;i<presetList.length;i++)
{if(kbps<=presetList[i]*1.10){roundedRate=presetList[i];break;}}
if(roundedRate==0||roundedRate==presetList[presetList.length-1])
roundedRate=presetList[presetList.length-2];return roundedRate;},getBestFLVRendition:function(image,targetBandwidthKbps,targetHeight,targetWidth,targetCPURate,automatic)
{var renditionsSorted=image.image_renditions.sort(this.imageRenditionKbpsComparer);if(automatic)
targetBandwidthKbps=Math.min(this.getHighestAllowedBitrate(targetCPURate),targetBandwidthKbps);var bestRenditionKbps=null;var bestRenditionDimensions=null;var hasH264=Common_DetectFlashVer(9,0,115);var useNewFLV=false;for(var i=0;i<renditionsSorted.length;i++)
{var rendition=renditionsSorted[i];if(rendition.rendition_type!="FullFlv")
continue;if(rendition.media_type=="video/mp4"){useNewFLV=true;break;}}
for(var i=0;i<renditionsSorted.length;i++)
{var rendition=renditionsSorted[i];if(rendition.rendition_type!="FullFlv")
continue;if(hasH264&&useNewFLV&&rendition.media_type!="video/mp4")
continue;if(!hasH264&&rendition.media_type!="video/x-flv")
continue;if(bestRenditionKbps==null)
bestRenditionKbps=rendition;else
{var effectiveQuality=automatic?rendition.quality:this.roundVideoBandwidth(rendition.quality,rendition.media_type,useNewFLV);if(effectiveQuality<=targetBandwidthKbps)
bestRenditionKbps=rendition;}
if(targetHeight>0&&targetWidth>0)
{if(bestRenditionDimensions==null)
bestRenditionDimensions=rendition;else
{if(rendition.height<=targetHeight*1.10&&rendition.width<=targetWidth*1.10)
bestRenditionDimensions=rendition;}}}
var rv=null;if(targetHeight>0&&targetWidth>0)
{if(bestRenditionDimensions.quality<bestRenditionKbps.quality)
rv=bestRenditionDimensions;else
rv=bestRenditionKbps;}
else
rv=bestRenditionKbps;return rv;},imageRenditionKbpsComparer:function(a,b)
{return a.quality-b.quality;},imageHasFLVFull:function(image)
{if(image.image_renditions!=null)
{for(var i=0;i<image.image_renditions.length;i++)
{if(image.image_renditions[i].rendition_type=="FullFlv")
return true;}}
return false;},testInProgress:0,setTestInProgress:function(inProgress)
{if(inProgress)
{this.testInProgress++;setTimeout(this.javaScriptId+".setTestInProgress(false)",20000);}
else
{this.testInProgress--;this.testInProgress=Math.max(this.testInProgress,0);}},isTestInProgress:function()
{return this.testInProgress>0;},bandwidthTestComplete:function(isBackgroundTest)
{this.setTestInProgress(false);},keyPressed:function(type,args){var e=args[0];var c=YAHOO.util.Event.getCharCode(e);switch(c){case 37:case 63234:this.movePrevious();YAHOO.util.Event.preventDefault(e);break;case 39:case 63235:this.moveNext();YAHOO.util.Event.preventDefault(e);break;}},setKeyPressEnabled:function(val){this.keyPressEnabled=val;},isKeyPressEnabled:function()
{return this.keyPressEnabled;}}
var ThumbGrid_MinColumns=2;var ThumbGrid_MinRows=4;var ThumbGrid_ThumbnailWidth=85;var ThumbGrid_ThumbnailHeight=85;var ThumbGrid_ThumbnailMaxDimension=119;var ThumbGrid_VerticalAdjustment=10;ThumbGridManager=Class.create();ThumbGridManager.prototype={javaScriptId:null,thumbGridProperties:null,album:null,nodeParent:null,nodeThumbGridTable:null,nodeThumbGridTableWrapper:null,nodeThumbnailViewWrapper:null,nodeSpanFirstVisible:null,nodeSpanLastVisible:null,nodeNextPageLink:null,nodePreviousPageLink:null,nodeFirstPageLink:null,nodeLastPageLink:null,nodePagingControlsContainer:null,columns:0,rows:0,currentPosition:0,currentPageOverride:-1,pageManager:null,positionToEntry:null,initialize:function(myJavaScriptId,thumbGridPropertiesIn,albumIn,containerId,thumbGridPrefix)
{this.positionToEntry=new Array();this.javaScriptId=myJavaScriptId;this.thumbGridProperties=thumbGridPropertiesIn;this.album=albumIn;this.imageCache=imageCache;this.nodeParent=$(containerId);this.nodeThumbnailViewWrapper=$('hybridAlbumMainContentTableLeftBorderTableWrapper');this.nodeThumbGridTableWrapper=$('hybridAlbumThumbnailViewGridWrapper');this.nodeSpanFirstVisible=$(Common_String_Format("{0}GridFirstVisible",thumbGridPrefix));this.nodeSpanLastVisible=$(Common_String_Format("{0}GridLastVisible",thumbGridPrefix));this.nodePreviousPageLink=$(Common_String_Format("{0}PreviousPageLink",thumbGridPrefix));this.nodeNextPageLink=$(Common_String_Format("{0}NextPageLink",thumbGridPrefix));this.nodeFirstPageLink=$(Common_String_Format("{0}FirstPageLink",thumbGridPrefix));this.nodeLastPageLink=$(Common_String_Format("{0}LastPageLink",thumbGridPrefix));this.nodePagingControlsContainer=$(Common_String_Format("{0}PagingControlsContainer",thumbGridPrefix));this.nodePreviousPageLink.onclick=this.showPreviousPage.bindAsEventListener(this);this.nodeNextPageLink.onclick=this.showNextPage.bindAsEventListener(this);this.nodeFirstPageLink.onclick=this.showFirstPage.bindAsEventListener(this);this.nodeLastPageLink.onclick=this.showLastPage.bindAsEventListener(this);this.nodePreviousPageLink.href="#";this.nodeNextPageLink.href="#";this.nodeFirstPageLink.href="#";this.nodeLastPageLink.href="#";},setPageManager:function(pageManagerIn)
{this.pageManager=pageManagerIn;},moveTo:function(position)
{var redrawNecessary=this.currentPage()!=this.pageOf(position);var previousPosition=this.currentPosition;this.currentPosition=position;this.currentPageOverride=-1;if(redrawNecessary)
{this.redraw();}
else
{this.unHilightThumbnail(previousPosition);}
this.hilightThumbnail(position);},onResize:function()
{if(this.updateSlotCount()||Common_isIE6)
this.redraw();},updateSlotCount:function()
{var availableWidth=this.availableWidth();var availableHeight=this.availableHeight();var oldSlotCount=this.numSlots();var oldColumnCount=this.columns;this.columns=Math.floor((availableWidth)/ThumbGrid_ThumbnailWidth);this.rows=Math.max(Math.floor(availableHeight/ThumbGrid_ThumbnailHeight),ThumbGrid_MinRows);return this.numSlots()!=oldSlotCount||this.columns!=oldColumnCount;},preferredWidthUpTo:function(maxWidth)
{var numThumbs=Math.floor(maxWidth/ThumbGrid_ThumbnailWidth);var rv=numThumbs*ThumbGrid_ThumbnailWidth;return rv;},numSlots:function()
{var numSlots=this.columns*this.rows;return numSlots;},numImages:function()
{return this.album.images.length;},pageOf:function(position)
{return Math.floor(position/this.numSlots());},startOfPage:function(page)
{return page*this.numSlots();},currentPage:function()
{if(this.currentPageOverride>-1)
return this.currentPageOverride;else
return this.pageOf(this.currentPosition);},numPages:function()
{return this.pageOf(this.numImages()-1)+1;},lastPage:function()
{return this.numPages()-1;},onThumbnailClick:function()
{var parameterObject=this.onClickParameters;var position=parameterObject.position;var thumbGridManager=parameterObject.thumbGridManager;thumbGridManager.pageManager.moveTo(position,thumbGridManager);},clearThumbs:function()
{this.positionToEntry=new Array();Common_RemoveChildren(this.nodeThumbGridTableWrapper);},redraw:function()
{var page=this.pageOf(this.currentPosition);this.drawPage(page);},showNextPage:function()
{this.currentPageOverride=this.currentPage()+1;this.drawPage(this.currentPage());return false;},showPreviousPage:function()
{this.currentPageOverride=this.currentPage()-1;this.drawPage(this.currentPage());return false;},showFirstPage:function()
{this.currentPageOverride=0;this.drawPage(this.currentPage());return false;},showLastPage:function()
{this.currentPageOverride=this.lastPage();this.drawPage(this.currentPage());return false;},drawPage:function(page)
{if(page<0||page>this.lastPage())
return;this.clearThumbs();this.nodeThumbGridTable=Common_BuildTable(this.rows,this.columns,"hybridAlbumThumbGridTable","thumbGridTable");this.nodeThumbGridTableWrapper.appendChild(this.nodeThumbGridTable);var row=0;var column=0;var position=this.startOfPage(page);for(var i=0;i<Math.min(this.numSlots(),this.numImages()-position);i++)
{this.addEntry(position+i,row,column);if(++column==this.columns)
{column=0;if(++row==this.rows)
{break;}}}
this.hilightThumbnail(this.currentPosition);this.updatePagingText(page);var showLeftArrow=page>0;var showRightArrow=page<this.pageOf(this.numImages()-1);var moreThan2Pages=this.numPages()>2;Common_SetVisibility2(this.nodeNextPageLink,showRightArrow);Common_SetVisibility2(this.nodePreviousPageLink,showLeftArrow);Common_SetVisibility2(this.nodeLastPageLink,showRightArrow&&moreThan2Pages);Common_SetVisibility2(this.nodeFirstPageLink,showLeftArrow&&moreThan2Pages);Common_SetVisibility(this.nodeLastPageLink,moreThan2Pages);Common_SetVisibility(this.nodeFirstPageLink,moreThan2Pages);Common_SetVisibility2(this.nodePagingControlsContainer,showLeftArrow||showRightArrow);},updatePagingText:function(page)
{var first=this.startOfPage(page);var last=Math.min(first+this.numSlots(),this.numImages());this.nodeSpanFirstVisible.innerHTML=(first+1);this.nodeSpanLastVisible.innerHTML=(last);},addEntry:function(position,atRow,atColumn)
{var entry=this.buildEntry(position);var cell=Common_GetTableCell(this.nodeThumbGridTable,atRow,atColumn);Common_RemoveChildren(cell);cell.appendChild(entry);this.positionToEntry[position]=entry;},buildEntry:function(position)
{var thumbnail=this.buildThumbnail(position);var div=document.createElement("div");div.className="thumbnailViewEntry";if(thumbnail!=null)div.appendChild(thumbnail);return div;},buildThumbnail:function(position)
{var image=this.album.images[position];var imageSrc=Common_GetRenditionURL(image,"Thumbnail");var barIcon=null;var barIconIE=null;var barText=null;var altText=image.caption_text_nohtml;if(image.isVideo)
{barIcon=Common_VideoIconURL;barIconIE=Common_VideoIconIEURL;if(!image.fullSizeUploaded||(image.errors&Common_ImageErrorFlags_DURATION_TOO_LONG)>0||(image.errors&Common_ImageErrorFlags_TOO_LARGE)>0||(image.errors&Common_ImageErrorFlags_UNREADABLE)>0)
barText="Unavailable";else
{var mins=parseInt(image.video_duration/60);var secs=parseInt(image.video_duration%60);if(secs<10)
{secs="0"+secs;}
barText=Common_String_Format("{0}:{1}",mins,secs);}}
var thumb_rendition=null;for(var i=0;i<image.image_renditions.length;i++)
{var thumb_rendition=image.image_renditions[i];if(thumb_rendition.rendition_type=="Thumbnail")
{break;}}
var thumbDimensions;if(thumb_rendition==null||imageSrc==null){imageSrc=image.isVideo==false?"/psimages/2_img_not_avail_79.gif":"/psimages/2_vid_not_avail_79.jpg";thumbDimensions=Common_DimensionsFromAspectRatio(1.0,ThumbGrid_ThumbnailMaxDimension);thumbDimensions.height=79;thumbDimensions.width=79;}
else{thumbDimensions=Common_DimensionsFromAspectRatio(thumb_rendition.aspect_ratio,ThumbGrid_ThumbnailMaxDimension);}
var onClickParameters={onClickHandler:this.onThumbnailClick,thumbGridManager:this,position:position}
var thumbnail=Common_MakeCroppableIMG2(null,imageSrc,"sqt79",false,Common_AllowDownloadOriginal?false:true,false,null,null,79,79,thumbDimensions.height,thumbDimensions.width,image.isVideo,barIcon,barIconIE,null,barText,null,altText,false,null,null,null,null,null);thumbnail.onClickParameters=onClickParameters;thumbnail.onclick=onClickParameters.onClickHandler.bindAsEventListener(thumbnail);return thumbnail;},hilightThumbnail:function(position)
{this.setThumbnailHilightStatus(position,true)},unHilightThumbnail:function(position)
{this.setThumbnailHilightStatus(position,false);},setThumbnailHilightStatus:function(position,hilight)
{var entry=this.getEntryForPosition(position);if(entry!=null)
Common_SetHilightedStatus(entry,hilight,true,new Array("thumbnailViewEntry"));},getEntryForPosition:function(position)
{return this.positionToEntry[position];},imageIsCached:function(position)
{var image=this.album.images[position];var imageURL=Common_GetRenditionURL(image,"Thumbnail");return this.imageCache.imageIsCached(imageURL);},availableWidth:function()
{var dimensions=Element.getDimensions(this.nodeThumbnailViewWrapper);return dimensions.width;},availableHeight:function()
{var windowHeight=Common_GetWindowHeight();var positionOfWrapper=Common_FindPosition(this.nodeThumbGridTableWrapper);var availableHeightWindow=windowHeight-positionOfWrapper[1];var widestAR=0;for(var i=0;i<this.album.images.length;i++)
{widestAR=Math.max(widestAR,this.album.images[i].aspect_ratio);}
var currentRenditionType=this.pageManager.currentRenditionType;var availableHeightWidestImage=Common_GetAnticipatedDimensions(widestAR,currentRenditionType.maxWidth,currentRenditionType.maxHeight).height;var availableHeight=Math.max(availableHeightWindow,availableHeightWidestImage);availableHeight-=ThumbGrid_VerticalAdjustment;return availableHeight;},preloadImage:function(position)
{if(position<0||position>=this.album.images.length)
return;var image=this.album.images[position];var imageURL=Common_GetRenditionURL(image,"Thumbnail");this.imageCache.loadImage(imageURL,null);},preloadRange:function(position,count)
{for(var i=0;i<count;i++)
{this.preloadImage(position+i);}},preloadPage:function(page)
{this.preloadRange(this.startOfPage(page),this.numSlots());},firstShown:function()
{return this.currentPosition;},lastShown:function()
{return this.currentPosition+(this.numSlots()-1);}}
var HybridAlbum_SideMargin=25;var HybridAlbum_MaxInlineImageWidthFactor=1.15;var HybridAlbum_AssumedAspectRatio=1.5;var ThumbGrid_LeftPadding=36;var ThumbGrid_HorizontalPadding=8;HybridAlbumManager=Class.create();HybridAlbumManager.prototype={javaScriptId:null,inlineImageManager:null,thumbGridManager:null,album:null,nodeMainContentTable:null,nodeMainContentLeft:null,nodeMainContentLeftContentConstrainer:null,nodeMainContentRight:null,nodeMainContentMenu:null,nodeDescription:null,menuShownOnPage:false,nodePageMenuContainer:null,nodePageMenu:null,nodePageMenuItemOrderPrints:null,nodePageMenuItemOrderPrintsNew:null,nodePageMenuItemViewComments:null,nodePageMenuItemSignOut:null,nodePageMenuViewProfile:null,nodePageMenuItemHelp:null,nodePageMenuItemBulkDownload:null,nodePageMenuItemDownloadSlideshow:null,nodePageMenuItemShowThumbnails:null,nodeInlineImageWrapper:null,lastWindowWidth:null,lastWindowHeight:null,resizeTimer:null,unhideThumbsOnNextMove:false,currentRenditionType:null,inlineImageMinWidth:null,thumbPanelMinWidth:ThumbGrid_MinColumns*ThumbGrid_ThumbnailWidth+ThumbGrid_LeftPadding,nodeCommentDiv:null,nodeMiniTocDiv:null,historyInitCalled:false,historyInitState:null,initialize:function(album,start_position)
{if(album.images.length!=0){var imageIdBookmark=YAHOO.util.History.getBookmarkedState("imageID");var imageIdInitial=imageIdBookmark||album.images[start_position].image_id+'';YAHOO.util.History.register("imageID",imageIdInitial,this.historyChanged.bindAsEventListener(this));YAHOO.util.History.onLoadEvent.subscribe(this.historyInit.bindAsEventListener(this));}},_initialize:function(myJavaScriptId,albumIn,inlineImageManagerIn,thumbGridManagerIn,mainContentTableId,mainContentLeftId,mainContentRightId,nodePageMenuContainerIn)
{this.javaScriptId=myJavaScriptId;this.album=albumIn;this.inlineImageManager=inlineImageManagerIn;this.thumbGridManager=thumbGridManagerIn;this.menuShownOnPage=!Common_HideAlbumMenu;this.cachedComments=null;this.nodeMainContentTable=$(mainContentTableId);if(mainContentLeftId!=null)
this.nodeMainContentLeft=$(mainContentLeftId);this.nodeMainContentLeftContentConstrainer=$('hybridAlbumMainContentTableLeftBorderTableWrapper');this.nodeMainContentRight=$(mainContentRightId);this.nodeMainContentMenu=$('hybridAlbumMainContentTableMenu');this.nodeDescription=$('hybridAlbumAlbumDescriptionBorderTable');this.nodeInlineImageWrapper=$('hybridAlbumInlineImageWrapper');var nodeSearchInHeaderWrapper=$('hybridAlbumHeaderSearchIconWrapper');Common_SetVisibility(nodeSearchInHeaderWrapper,Common_NavigationAllowed);this.nodePageMenuContainer=nodePageMenuContainerIn;if(!this.album.section_id)
{this.album.section_id=-1;}
this.albumMenuManager=new AlbumMenuManager(nodePageMenuContainerIn,this.album.album_year,this.album.album_id,this.album.section_id,Common_Username,Common_StyleID,Common_StyleVersion,Common_AllowOrderPrints,Common_AllowDownloadOriginal,Common_IsLoggedIn(),true,'hybridAlbumHeaderSearchBoxWrapper',this.album,Common_AllowRss,Common_AllowEmailNotifications);this.albumMenuManager.clickEvent.subscribe(this.onAlbumMenuClicked,null,this);if(this.menuShownOnPage)
{this.nodePageMenu=Common_GetChildById(this.nodePageMenuContainer,"menu");Common_SetVisibility(this.nodePageMenu,true);}
else
{Common_DetachNode(this.nodeMainContentMenu);}
window.onresize=this.onWindowSizeChanged.bindAsEventListener(this);this.service=new YAHOO.phanfare.service.Service();var showComments=Common_AllowComments&&Common_NavigationAllowed&&this.album.images.length>0;this.nodeCommentDiv=$('commentDiv');if(showComments)
{this.drawCommentHeader(this.nodeCommentDiv);}
this.nodeMiniTOCDiv=$('hybridAlbumMiniTocWrapper3');var mtUrl=null;if(Common_PageType=='Site'){mtUrl="/minitoc.aspx?s=0&username="+Common_Username;}else if(Common_PageType=='SiteCName'){mtUrl="/minitoc.aspx?s=0&cname="+Common_CName;}else if(Common_PageType=='IsolatedLink'){mtUrl="";}
if(window.frames['miniTOCIFrame']){if(Common_isIE6)Common_SetVisibility($('miniTOCIFrame'),false);if(Common_NavigationAllowed)window.frames['miniTOCIFrame'].location=mtUrl;}
if(this.historyInitCalled){inlineImageManager.hideFullScreen(null);this.moveTo(this.imageIdToPosition(this.history_image_id),"init");this.historyInitCalled=false;}},historyInit:function()
{this.historyInitCalled=true;var state=YAHOO.util.History.getCurrentState("imageID");this.history_image_id=parseInt(state);if(inlineImageManager==null){return;}
if(this.history_image_id<0)
{this.history_image_id=-this.history_image_id;}
if(inlineImageManager!=null)inlineImageManager.hideFullScreen(null);this.moveTo(this.imageIdToPosition(this.history_image_id),"init");this.refreshComments();},historyChanged:function(state)
{var image_id=parseInt(state);if(state>0)
{if(inlineImageManager.exifIsShowing())return;inlineImageManager.hideFullScreen(null);this.moveTo(this.imageIdToPosition(image_id),"hc");this.refreshComments();}
else
{image_id=-image_id;inlineImageManager.startShowFullScreen(this.imageIdToPosition(image_id));}},onAlbumMenuClicked:function()
{this.hidePageMenu(true);},unhilightPageMenu:function()
{Common_SetHilightedStatus(this.nodePageMenu,false,true);},hidePageMenu:function(suppressReshow)
{this.unhilightPageMenu();this.inlineImageManager.hideContextMenu(suppressReshow);},showPageMenu:function()
{Element.show(this.nodePageMenu);},start:function(startPosition)
{this.doLayout();},moveTo:function(position,source)
{if(this.unhideThumbsOnNextMove)
{this.showThumbGrid();this.unhideThumbsOnNextMove=false;}
if(!Common_isIE&&(source!=this.thumbGridManager)&&(source!=this.inlineImageManager)){var hashIndex=window.location.href.lastIndexOf('#');if(window.location.href.substr(hashIndex,2)=="#c")return;}
if(this.inlineImageManager!=null){if(inlineImageManager.getCurrentPosition()!=position)
this.inlineImageManager.moveTo(position);}
if(this.thumbGridManager)
this.thumbGridManager.moveTo(position);try{if(source!="init"&&source!="hc")
{YAHOO.util.History.navigate("imageID",this.album.images[position].image_id+'');}}
catch(err){}},onWindowSizeChanged:function()
{if(this.resizeTimer!=null)
clearTimeout(this.resizeTimer);if(Common_GetWindowWidth(true)==this.lastWindowWidth&&Common_GetWindowHeight(true)==this.lastWindowHeight)
{return;}
this.resizeTimer=setTimeout(this.javaScriptId+".finishOnWindowSizeChanged()",500);},finishOnWindowSizeChanged:function()
{this.doLayout();},setInlineImageMinWidth:function(inlineImageMinWidth)
{if(inlineImageMinWidth!=this.inlineImageMinWidth)
{this.inlineImageMinWidth=inlineImageMinWidth;var availableWidth=this.getAvailableWidth();if(false&&availableWidth-(ThumbGrid_MinColumns*ThumbGrid_ThumbnailWidth+ThumbGrid_LeftPadding)<inlineImageMinWidth&&this.thumbsShowing())
{this.hideThumbGrid();this.unhideThumbsOnNextMove=true;}
else
{this.doLayout();}}},thumbsShowing:function()
{var showing=this.nodeMainContentLeft!=null&&Element.visible(this.nodeMainContentLeft);return showing;},doLayout:function()
{this.lastWindowWidth=Common_GetWindowWidth(true);this.lastWindowHeight=Common_GetWindowHeight(true);var inlineImageWidth=0;var thumbPanelWidth=0;var availableWidth=this.getAvailableWidth();var availableHeight=this.getAvailableHeight()-10;var maxAspectRatio=0;for(var i=0;i<this.album.images.length;i++)
{maxAspectRatio=Math.max(maxAspectRatio,this.album.images[i].aspect_ratio);}
if(maxAspectRatio==0)
maxAspectRatio=HybridAlbum_AssumedAspectRatio;if(true||this.thumbsShowing())
{for(var i=0;i<Common_NonThumbRenditionTypes.length;i++)
{var r=Common_NonThumbRenditionTypes[i];var actualAvailableWidth=availableWidth-((ThumbGrid_MinColumns*ThumbGrid_ThumbnailWidth)+2*ThumbGrid_HorizontalPadding);var assumedHeight=Math.min(r.maxWidth/maxAspectRatio,r.maxHeight);if(i==Common_NonThumbRenditionTypes.length-1||(r.maxWidth<=actualAvailableWidth&&assumedHeight<=availableHeight))
{inlineImageWidth=r.maxWidth;this.currentRenditionType=r;break;}}
inlineImageWidth+=22;}
else
{inlineImageWidth=availableWidth;thumbPanelWidth=0;}
if(this.inlineImageMinWidth!=null)
{inlineImageWidth=Math.max(inlineImageWidth,this.inlineImageMinWidth);}
thumbPanelWidth=availableWidth-inlineImageWidth;if(this.thumbPanelMinWidth!=null)
thumbPanelWidth=Math.max(thumbPanelWidth,this.thumbPanelMinWidth);if(this.thumbsShowing())
{var preferredWidth=this.thumbGridManager.preferredWidthUpTo(thumbPanelWidth-(ThumbGrid_HorizontalPadding*2));var preferredWidthWithPadding=preferredWidth+(ThumbGrid_HorizontalPadding*2);if(Common_isIE6)
{this.thumbGridManager.clearThumbs();}
Common_SetStyleAttribute(this.nodeMainContentLeftContentConstrainer,'width',preferredWidth+"px");Common_SetStyleAttribute(this.nodeMainContentLeft,'width',preferredWidthWithPadding+"px");this.thumbGridManager.onResize();}
Common_SetStyleAttribute(this.nodeMainContentRight,'width',inlineImageWidth+"px");this.inlineImageManager.setWidth(inlineImageWidth);inlineImageManager.onResize();this.lastWindowWidth=Common_GetWindowWidth(true);this.lastWindowHeight=Common_GetWindowHeight(true);},getAvailableWidth:function()
{var menuDimensions=Element.getDimensions(this.nodePageMenuContainer);return Common_GetWindowWidth()-(2*HybridAlbum_SideMargin)-20-(this.menuShownOnPage?menuDimensions.width:0);},getAvailableHeight:function()
{var windowHeight=Common_GetWindowHeight();var positionOfMainContent=Common_FindPosition(this.nodeInlineImageWrapper);var availableHeight=windowHeight-positionOfMainContent[1];return availableHeight;},displayComments:function()
{Common_RemoveChildren(this.nodeCommentDiv);this.nodeCommentDiv.innerHTML=window.frames['commentIFrame'].document.body.innerHTML;},displayMiniTOC:function(numYears,currentYearIndex)
{Common_RemoveChildren(this.nodeMiniTOCDiv);this.nodeMiniTOCDiv.innerHTML=Common_SelectAlbumInMiniTOC(window.frames['miniTOCIFrame'].document.body.innerHTML);AlbumListing_hybridalbumMiniToc_NumYears=numYears;AlbumListing_hybridAlbumMiniToc_CurrentYearIndex=Common_GetSelectedYearIndex(this.nodeMiniTOCDiv.innerHTML,numYears);MiniToc_Setup('hybridAlbum');MiniToc_YearRedraw('hybridAlbumMiniToc');},imageIdToPosition:function(imageId)
{for(var i=0;i<this.album.images.length;i++)
{if(this.album.images[i].image_id==imageId){return i;}}
if(imageId==0&&!this.defaultToFirstImage){return hybridAlbumInlineImage_Properties.startPosition;}
return 0;},getCommentsCallback:function(state,result)
{this.cachedComments=result;this.refreshComments();},refreshComments:function()
{if(this.cachedComments==null)
{return;}
this.commentListWrapper.innerHTML="";var position=this.inlineImageManager.currentPosition;var iid=this.album.images[position].image_id;var commentTable=document.createElement("table");var commentTableBody=document.createElement("tbody");commentTable.className="commentTable";commentTable.cellSpacing="0";commentTable.cellPadding="0";var j=0;for(var i=0;i<this.cachedComments.comments.length;i++)
{if(this.cachedComments.comments[i].image_id==iid)
{j++;var tr=document.createElement("tr");var td=document.createElement("td");this.drawCommentRow(td,j,this.cachedComments.comments[i]);tr.appendChild(td);commentTableBody.appendChild(tr);}}
commentTable.appendChild(commentTableBody);this.commentListWrapper.appendChild(commentTable);},drawCommentRow:function(outerTable,index,comment)
{var table=document.createElement("table");var tableBody=document.createElement("tbody");table.className="commentEntryTable";table.cellSpacing="0";table.cellPadding="5";var tr=document.createElement("tr");var td=document.createElement("td");td.className="commentEntry";td.appendChild(document.createTextNode(index+". "));var nameLink=null;if(comment.customName!=null&&comment.customName!="")
{nameLink=document.createElement("a");nameLink.className="commentEntryLink";nameLink.href="http://"+comment.customName+"."+Common_DomainName;}else{nameLink=document.createElement("span");nameLink.className="commentEntryLink";}
if(Common_IsOwner==true&&comment.email_address!=null&&comment.email_address!="")
{nameLink.appendChild(document.createTextNode(comment.name+" ("+comment.email_address+")"));}else{nameLink.appendChild(document.createTextNode(comment.name));}
td.appendChild(nameLink);var date=convertDate(comment.comment_date,false);td.appendChild(document.createTextNode(" wrote about this image on "+date.format("dddd, mmmm d, yyyy")+"\u00a0\u00a0"));if(Common_IsOwner==true)
{var me=this;var delLink=document.createElement("a");delLink.innerHTML="delete";delLink.className="commentEntryLink";delLink.com=comment;delLink.style.cursor="pointer";delLink.onclick=function(ev){me.deleteComment(getTarget(ev).com);};td.appendChild(delLink);}
tr.appendChild(td);tableBody.appendChild(tr);tr=document.createElement("tr");td=document.createElement("td");td.className="commentEntry";td.innerHTML="&nbsp;&nbsp;&nbsp;"+comment.comment;tr.appendChild(td);tableBody.appendChild(tr);table.appendChild(tableBody);outerTable.appendChild(table);},getCommentsFailed:function(state,result)
{this.commentListWrapper.innerHTML+="";},showAddComment:function()
{this.addCommentWrapper.style.display="block";this.commentButton.style.display="none";this.commentLabelPipe.style.display="none";this.inlineImageManager.setKeyPressEnabled(false);this.captchaHash=this.randomString();this.captchaImage.src="/webclient/Service.asmx/GetCommentCaptcha?session_cookie="+Common_GetCookie("phanfare2")+"&hash="+this.captchaHash;},randomString:function(){var chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";var string_length=8;var randomstring='';for(var i=0;i<string_length;i++){var rnum=Math.floor(Math.random()*chars.length);randomstring+=chars.substring(rnum,rnum+1);}
return randomstring;},hideAddComment:function()
{this.addCommentWrapper.style.display="none";this.commentButton.style.display="inline";this.commentLabelPipe.style.display="inline";this.inlineImageManager.setKeyPressEnabled(true);},submitComment:function()
{if(this.addCommentText.value.length==0)
{this.addErrorDiv.style.display="inline";this.addErrorDiv.innerHTML="A comment is required";return;}
if(Common_CallingUid==0)
{if(this.commentNameText.value.length<2||this.commentEmailAddressText.value.length==0||this.verifyEmail(this.commentEmailAddressText.value)==false)
{this.addErrorDiv.style.display="inline";this.addErrorDiv.innerHTML="A valid name and email address is required";return;}}
if(this.captchaText.value.length!=5)
{this.addErrorDiv.style.display="inline";this.addErrorDiv.innerHTML="The 5 characters in the image above must be entered correctly to submit a comment.";return;}else if(this.addCommentText.value!=null&&this.addCommentText.value.length>1024){this.addErrorDiv.style.display="inline";this.addErrorDiv.innerHTML="Comments are limited to 1024 characters.";return;}
this.addErrorDiv.style.display="none";var callbacks={scope:this,success:this.submitCallback,failure:this.submitCallback,state:"!"};var position=this.inlineImageManager.currentPosition;var iid=this.album.images[position].image_id;this.service.LeaveComment(Common_GetCookie("phanfare2"),Common_TargetUid,Common_AlbumID,iid,this.addCommentText.value,this.commentNameText.value,this.commentEmailAddressText.value,this.captchaHash,this.captchaText.value,callbacks)
this.submitCommentButton.disabled=true;},verifyEmail:function(email){var emailRegex=/^[a-zA-Z0-9._%'+-]+@([a-zA-Z0-9.-]+)\.[a-zA-Z]{2,4}$/;return emailRegex.test(email)?true:false;},deleteComment:function(comment)
{var callbacks={scope:this,success:this.submitCallback,failure:this.submitCallback,state:"!"};var position=this.inlineImageManager.currentPosition;var iid=this.album.images[position].image_id;this.service.DeleteComment(Common_GetCookie("phanfare2"),Common_TargetUid,Common_AlbumID,iid,comment.comment_id,callbacks)
this.hideAddComment();this.addCommentText.value="";this.commentNameText.value="";this.commentEmailAddressText.value="";},submitCallback:function(state,result)
{this.submitCommentButton.disabled=false;this.captchaText.value="";if(result.return_code==0)
{this.hideAddComment();this.addCommentText.value="";this.commentEmailAddressText.value="";this.commentNameText.value="";}else if(result.return_code==12)
{this.addErrorDiv.style.display="inline";this.addErrorDiv.innerHTML="The characters you entered do not match the image above.";this.showAddComment();return;}else{this.addErrorDiv.style.display="inline";this.addErrorDiv.innerHTML="An error occured trying to save your comment. Please try again.";this.showAddComment();return;}
var callbacks={scope:this,success:this.getCommentsCallback,failure:this.getCommentsFailed,state:"!"};this.commentListWrapper.innerHTML="Loading...";this.service.GetComments(Common_GetCookie("phanfare2"),Common_TargetUid,Common_AlbumID,callbacks);},drawCommentHeader:function(el)
{var me=this;var commentTitleWrapper=document.createElement("div");commentTitleWrapper.style.display="block";commentTitleWrapper.style.marginBottom="5px";var commentBindingDiv=document.createElement("div");commentBindingDiv.className="commentTitle";var commentLabel=document.createElement("div");commentLabel.innerHTML="Comments on this image&nbsp;&nbsp;";commentLabel.className="commentLabel";this.commentLabelPipe=document.createElement("div");this.commentLabelPipe.innerHTML="|";this.commentLabelPipe.className="commentLabel";var commentLabelButton=document.createElement("div");commentLabelButton.className="commentButton";this.commentButton=document.createElement("input");this.commentButton.type="button";this.commentButton.className="addComment";this.commentButton.value="Add Comment";this.commentButton.onclick=function(){me.showAddComment();return false;};commentLabelButton.appendChild(this.commentButton);commentBindingDiv.appendChild(commentLabel);commentBindingDiv.appendChild(this.commentLabelPipe);commentBindingDiv.appendChild(commentLabelButton);commentTitleWrapper.appendChild(commentBindingDiv);this.addCommentWrapper=document.createElement("div");this.addCommentWrapper.className="addCommentWrapper";this.commentNameText=document.createElement("input");this.commentEmailAddressText=document.createElement("input");if(Common_CallingUid==0)
{this.addCommentWrapper.appendChild(document.createTextNode("Name:"));this.addCommentWrapper.appendChild(document.createElement("br"));this.addCommentWrapper.appendChild(this.commentNameText);this.addCommentWrapper.appendChild(document.createElement("br"));this.addCommentWrapper.appendChild(document.createTextNode("Email Address:"));this.addCommentWrapper.appendChild(document.createElement("br"));this.addCommentWrapper.appendChild(this.commentEmailAddressText);this.addCommentWrapper.appendChild(document.createElement("br"));this.addCommentWrapper.appendChild(document.createElement("br"));}
this.addCommentWrapper.appendChild(document.createTextNode("Comment:"));this.addCommentWrapper.appendChild(document.createElement("br"));this.addCommentText=document.createElement("textarea");this.addCommentText.className="addCommentText";this.addCommentText.style.height="100px";this.addCommentText.style.width="400px";this.addCommentWrapper.appendChild(this.addCommentText);this.addCommentWrapper.appendChild(document.createElement("br"));this.addCommentWrapper.appendChild(document.createElement("br"));this.captchaImage=document.createElement("img");this.addCommentWrapper.appendChild(this.captchaImage);this.addCommentWrapper.appendChild(document.createElement("br"));this.addCommentWrapper.appendChild(document.createTextNode("Enter the characters that appear above."));this.addCommentWrapper.appendChild(document.createElement("br"));this.captchaText=document.createElement("input");this.addCommentWrapper.appendChild(this.captchaText);this.addCommentWrapper.appendChild(document.createElement("br"));this.addCommentWrapper.appendChild(document.createElement("br"));this.submitCommentButton=document.createElement("input");this.submitCommentButton.type="button";this.submitCommentButton.className="submitComment";this.submitCommentButton.value="Add Comment";this.submitCommentButton.onclick=function(){me.submitComment()};this.addCommentWrapper.appendChild(this.submitCommentButton);var cancelComment=document.createElement("input");cancelComment.type="button";cancelComment.className="cancelComment";cancelComment.value="Cancel";cancelComment.onclick=function(){me.hideAddComment()};this.addCommentWrapper.appendChild(cancelComment);this.addCommentWrapper.appendChild(document.createElement("br"));this.addErrorDiv=document.createElement("div");this.addErrorDiv.style.display="none";this.addCommentWrapper.appendChild(this.addErrorDiv);this.addCommentWrapper.appendChild(document.createElement("br"));commentTitleWrapper.appendChild(this.addCommentWrapper);this.hideAddComment();el.appendChild(commentTitleWrapper);this.commentListWrapper=document.createElement("div");this.commentListWrapper.className="commentListWrapper";this.commentListWrapper.innerHTML="Loading...";el.appendChild(this.commentListWrapper);var callbacks={scope:this,success:this.getCommentsCallback,failure:this.getCommentsFailed,state:"!"};this.service.GetComments(Common_GetCookie("phanfare2"),Common_TargetUid,Common_AlbumID,callbacks);}}
var MiniToc_miniTocState='up';var MiniToc_miniSectionsTocState='up';var MiniToc_miniTocWrapper=null;var MiniToc_miniToc=null;var MiniToc_miniSectionsTocWrapper=null;var miniToc_miniSectionsToc=null;var MiniToc_hintWrapper=null;var MiniToc_albumBreadCrumb=null;var MiniToc_sectionBradCrumb=null;var MiniToc_currentPageBase=null;var MiniToc_currentWhichHeader=null;function MiniToc_Attach(pageBase,whichHeader)
{MiniToc_currentPageBase=pageBase;MiniToc_currentWhichHeader=whichHeader;MiniToc_albumBreadCrumb=$(pageBase+whichHeader+'BreadCrumbs_AlbumNameSpan');MiniToc_sectionBreadCrumb=$(pageBase+whichHeader+'BreadCrumbs_AlbumSectionNameSpan');if(MiniToc_miniTocWrapper!=null&&MiniToc_albumBreadCrumb!=null)
{Common_DetachNode(MiniToc_miniTocWrapper);MiniToc_albumBreadCrumb.insertBefore(MiniToc_miniTocWrapper,MiniToc_albumBreadCrumb.firstChild);}
if(MiniToc_miniSectionsTocWrapper!=null&&MiniToc_sectionBreadCrumb!=null)
{Common_DetachNode(MiniToc_miniSectionsTocWrapper);MiniToc_sectionBreadCrumb.insertBefore(MiniToc_miniSectionsTocWrapper,MiniToc_sectionBreadCrumb.firstChild);}
var sheet={};if(MiniToc_albumBreadCrumb!=null&&MiniToc_miniToc!=null)
{sheet["#"+MiniToc_albumBreadCrumb.id]=function(el){var f1=function(event){if(MiniToc_GetFinalPosition('miniToc')=='up'&&MiniToc_CancelIdleEffects('miniToc',true)&&Common_TargetNotIn(event,new Array($(pageBase+'MiniTocWrapper'))))Effect.SlideDown(pageBase+'MiniTocWrapper3',{duration:0.50,queue:{position:'end',scope:'miniToc',limit:5},afterFinish:function(effect){Common_SetHilightedStatus($(pageBase+'MiniToc'),false,true);MiniToc_miniTocState=effect.options.endPosition;},endPosition:'down'});};el.onmouseover=f1.bindAsEventListener(el);var f2=function(event){if(MiniToc_GetFinalPosition('miniToc')=='down'&&MiniToc_CancelIdleEffects('miniToc',false)&&Common_CheckMouseLeave(this,event,new Array($(pageBase+'MiniTocWrapper')))){Effect.SlideUp($(pageBase+'MiniTocWrapper3'),{delay:0.25,duration:0.50,queue:{position:'end',scope:'miniToc',limit:5},afterFinish:function(effect){MiniToc_miniTocState=effect.options.endPosition;},endPosition:'up'})}};el.onmouseout=f2.bindAsEventListener(el);};}
if(MiniToc_sectionBreadCrumb!=null&&MiniToc_miniSectionsToc!=null)
{sheet["#"+MiniToc_sectionBreadCrumb.id]=function(el){var f1=function(event){if(MiniToc_GetFinalPosition('miniSectionsToc')=='up'&&MiniToc_CancelIdleEffects('miniSectionsToc',true)&&Common_TargetNotIn(event,new Array($(pageBase+'MiniSectionsTocWrapper')))){Effect.SlideDown(pageBase+'MiniSectionsTocWrapper3',{duration:.50,queue:{position:'end',scope:'miniSectionsToc',limit:5},afterFinish:function(effect){MiniToc_miniSectionsTocState=effect.options.endPosition;},endPosition:'down'});}};el.onmouseover=f1.bindAsEventListener(el);var f2=function(event){if(MiniToc_GetFinalPosition('miniSectionsToc')=='down'&&MiniToc_CancelIdleEffects('miniSectionsToc',false)&&Common_CheckMouseLeave(this,event,new Array($(pageBase+'MiniSectionsTocWrapper')))){Effect.SlideUp(pageBase+'MiniSectionsTocWrapper3',{delay:0.25,duration:0.50,queue:{position:'end',scope:'miniSectionsToc',limit:5},afterFinish:function(effect){Common_SetHilightedStatus($(pageBase+'MiniSectionsToc'),false,true);MiniToc_miniSectionsTocState=effect.options.endPosition;},endPosition:'up'});}};el.onmouseout=f2.bindAsEventListener(el);};}
Behaviour.register(sheet);Behaviour.apply();}
function MiniToc_Setup(pageBase)
{Effect.DefaultOptions.fps=15;MiniToc_miniTocWrapper=$(pageBase+'MiniTocWrapper');MiniToc_miniToc=$(pageBase+'MiniToc');MiniToc_miniSectionsTocWrapper=$(pageBase+'MiniSectionsTocWrapper');MiniToc_miniSectionsToc=$(pageBase+'MiniSectionsToc');hintWrapper=$(pageBase+'MiniTocHintWrapper');MiniToc_Attach(pageBase,'Header');var showHint=false;if(hintWrapper!=null)
{var hint=$(pageBase+'MiniTocHint');if($(pageBase+'MiniToc')!=null&&MiniToc_albumBreadCrumb!=null)
{hint.innerHTML='Mouse over here to see other albums.'
Common_DetachNode(hintWrapper);MiniToc_albumBreadCrumb.parentNode.insertBefore(hintWrapper,MiniToc_albumBreadCrumb);showHint=true;}
else if($(pageBase+'MiniSectionsToc')!=null&&MiniToc_sectionBreadCrumb!=null)
{hint.innerHTML='Mouse over here to see other album sections.'
Common_DetachNode(hintWrapper);MiniToc_sectionBreadCrumb.parentNode.insertBefore(hintWrapper,MiniToc_sectionBreadCrumb);showHint=true;}}
showHint=false;if(showHint)
{var times=Common_GetPref('MTHC');if(times!=null)
{var count=parseInt(times);if(count>=0)
{showHint=false;}
else
{count++;Common_SetPref('MTHC',count+'');}}
else
{Common_SetPref('MTHC','1');}}
var sheet={};if(MiniToc_miniToc!=null&&MiniToc_albumBreadCrumb!=null)
{sheet["#"+MiniToc_miniToc.id]=function(el){var f1=function(event){if(MiniToc_GetFinalPosition('miniToc')=='down'&&MiniToc_CancelIdleEffects('miniToc',false)&&Common_CheckMouseLeave(this,event,new Array(MiniToc_albumBreadCrumb))){Effect.SlideUp(pageBase+'MiniTocWrapper3',{duration:0.50,queue:{position:'end',scope:'miniToc',limit:5},afterFinish:function(effect){MiniToc_miniTocState=effect.options.endPosition;},endPosition:'up'});}};el.onmouseout=f1.bindAsEventListener(el);var f2=function(event){MiniToc_CancelIdleEffects('miniToc',1);}
el.onmouseover=f2.bindAsEventListener(el);};}
if(MiniToc_miniSectionsToc!=null&&MiniToc_sectionBreadCrumb!=null)
{sheet["#"+pageBase+"MiniSectionsToc"]=function(el){var f1=function(event){if(MiniToc_GetFinalPosition('miniSectionsToc')=='down'&&MiniToc_CancelIdleEffects('minSectionsiToc',false)&&Common_CheckMouseLeave(this,event,new Array(MiniToc_sectionBreadCrumb))){Effect.SlideUp(pageBase+'MiniSectionsTocWrapper3',{duration:0.50,queue:{position:'end',scope:'miniSectionsToc',limit:5},afterFinish:function(effect){MiniToc_miniSectionsTocState=effect.options.endPosition;},endPosition:'up'});}};el.onmouseout=f1.bindAsEventListener(el);var f2=function(event){MiniToc_CancelIdleEffects('miniSectionsToc',1);}
el.onmouseover=f2.bindAsEventListener(el);};sheet["#"+pageBase+"MiniSectionsToc li.miniSectionsToc_SectionEntry_Unselected"]=function(el){var onEnter=function(event){if(!Common_isSafari||Effect.Queues.get('miniSectionsToc').effects.length==0)Common_SetHilightedStatus(this,true,false);};el.onmouseover=onEnter.bindAsEventListener(el);var onExit=function(event){if(Common_CheckMouseLeave(this,event)){Common_SetHilightedStatus(this,false,false);}};el.onmouseout=onExit.bindAsEventListener(el);var onClick=function(event){var href=this.getAttribute('href');if(href!=null){MiniToc_CloseMenu('miniSectionsToc');document.location.href=href;}};el.onclick=onClick.bindAsEventListener(el);};}
if($(pageBase+"TocListing")!=null)
{var functionSetupHoverAndClick=function(el){var onEnter=function(event){Common_SetHilightedStatus(this.firstChild,true,false);};el.onmouseover=onEnter.bindAsEventListener(el);var onExit=function(event){if(Common_CheckMouseLeave(this,event)){Common_SetHilightedStatus(this.firstChild,false,false);}};el.onmouseout=onExit.bindAsEventListener(el);var onClick=function(event){var href=this.getAttribute('href');if(href!=null){document.location.href=href;}};el.onclick=onClick.bindAsEventListener(el);};sheet["#"+pageBase+"TocListing li.albumSectionTocListing_SectionEntry_Selected"]=functionSetupHoverAndClick;sheet["#"+pageBase+"TocListing li.albumSectionTocListing_SectionEntry_Unselected"]=functionSetupHoverAndClick;var functionSetupReturnFalseOnClick=function(el)
{el.onclick=function(event){return false;};}
sheet["#"+pageBase+"TocListing li.albumSectionTocListing_SectionEntry_Selected A"]=functionSetupReturnFalseOnClick;sheet["#"+pageBase+"TocListing li.albumSectionTocListing_SectionEntry_Unselected A"]=functionSetupReturnFalseOnClick;}
if(showHint)
{sheet['#'+pageBase+'MiniTocHintWrapper']=function(el){var hideIt=function(event){MiniToc_HideHint(this.id,0.2);};el.onmouseover=hideIt.bindAsEventListener(el);};}
Behaviour.register(sheet);Behaviour.apply();if(showHint)
{Element.show(hintWrapper.id);setTimeout('MiniToc_HideHint("'+hintWrapper.id+'", 1)',4000);}}
function MiniToc_HideHint(hintId,duration)
{var hint=$(hintId);if(hint!=null&&Element.visible(hint)&&hint.effect==null)
{hint.effect=Effect.Fade(hint,{duration:duration});}}
function MiniToc_YearMoveDelta(miniTocId,delta)
{var miniToc=$(miniTocId+"_YearListing");if(miniToc==null)
return;var numElements=miniToc.childNodes.length;var albumListingCurrentYearIndexVar="AlbumListing_"+miniTocId+"_CurrentYearIndex";var currentYearIndex=eval(albumListingCurrentYearIndexVar);currentYearIndex=Common_Mod(currentYearIndex+delta,numElements);MiniToc_YearMoveTo(miniTocId,currentYearIndex);}
function MiniToc_YearMoveTo(miniTocId,position)
{var albumListingCurrentYearIndexVar="AlbumListing_"+miniTocId+"_CurrentYearIndex";eval(albumListingCurrentYearIndexVar+" = "+position);MiniToc_YearRedraw(miniTocId);}
function MiniToc_YearRedraw(miniTocId)
{var miniToc=$(miniTocId+"_YearListing");if(miniToc==null)
return;var albumListingCurrentYearIndexVar="AlbumListing_"+miniTocId+"_CurrentYearIndex";var currentYearIndex=eval(albumListingCurrentYearIndexVar);for(var i=0;i<miniToc.childNodes.length;i++)
{if(i==currentYearIndex)
Element.show(miniToc.childNodes[i]);else
Element.hide(miniToc.childNodes[i]);}}
function MiniToc_GetFinalPosition(queueId)
{var q=Effect.Queues.get(queueId);if(q.effects.length>0)
{var effect=q.effects[q.effects.length-1];return effect.options.endPosition;}
else
{switch(queueId)
{case'miniToc':return MiniToc_miniTocState;break;case'miniSectionsToc':return MiniToc_miniSectionsTocState;break;default:return'up';break;}}}
function MiniToc_CancelIdleEffects(queueId,useDown)
{var q=Effect.Queues.get(queueId);var upDown=useDown?'down':'up'
var qLen=q.effects.length;var keepLastEffect=false;var lastEffectStartOn=0;var firstEffectStartOn=0;var firstEffectIsDesired=0;if(qLen>0)
{var firstEffect=q.effects[0];var lastEffect=q.effects[qLen-1];firstEffectStartOn=firstEffect.startOn;lastEffectStartOn=lastEffect.startOn;keepLastEffect=!(firstEffect.state=='running'&&firstEffect.options.endPosition==upDown)&&lastEffect.options.endPosition==upDown;firstEffectIsDesired=firstEffect.options.endPosition==upDown;}
var idle=q.effects.findAll(function(e){return e.state=='idle';})
idle.each(function(e){if((!keepLastEffect||e.startOn<lastEffectStartOn)&&e.startOn!=firstEffectStartOn)e.cancel();});return!keepLastEffect&&!firstEffectIsDesired;}
function MiniToc_MiniTocEntry_OnMouseOver(event){if(!Common_isSafari||Effect.Queues.get('miniToc').effects.length==0){Common_SetHilightedStatus(this,true,false);}};function MiniToc_MiniTocEntry_OnMouseOut(event){if(Common_CheckMouseLeave(this,event)){Common_SetHilightedStatus(this,false,false);}};function MiniToc_MiniTocEntry_OnClick(event){var href=this.getAttribute('href');if(href!=null){MiniToc_CloseMenu('miniToc');document.location=href;}};mtemi=MiniToc_MiniTocEntry_OnMouseOver;mtemo=MiniToc_MiniTocEntry_OnMouseOut;mtec=MiniToc_MiniTocEntry_OnClick;function MiniToc_CloseMenu(which)
{switch(which)
{case'miniToc':MiniToc_miniToc.parentNode.style.display='none';MiniToc_miniTocState='up';break;case'miniSectionsToc':MiniToc_miniSectionsToc.parentNode.style.display='none';MiniToc_miniSectionsTocState='up';break;}}
(function(){var Dom=YAHOO.util.Dom;var Event=YAHOO.util.Event;GoogleMap=function(){this.loading=new YAHOO.widget.Panel("wait",{width:"500px",fixedcenter:true,underlay:"none",close:false,draggable:false,modal:true,visible:false,zIndex:999});this.loading.setHeader("");this.loading.setBody("<div id=\"map\" style=\"width: 500px; height: 300px\"></div>");this.loading.render(document.body);var cDiv=document.createElement("div");cDiv.style.cursor="pointer";cDiv.className="c";cDiv.innerHTML="";var me=this;this.loading.header.onclick=function(){me.hideMap();};this.loading.header.innerHTML="";this.loading.header.appendChild(cDiv);this.loading.header.style.cursor="pointer";this.loading.cfg.setProperty('zIndex',999);this.googleMap=null;this.service=new YAHOO.phanfare.service.Service();};GoogleMap.prototype={showMap:function(imageId)
{var callbacks={scope:this,success:this.imageGpsLoaded,failure:this.imageGpsFailed,state:imageId};this.loading.setBody("<div id=\"map\" style=\"width: 500px; height: 300px\"></div>");this.loading.show();this.loading.cfg.setProperty('zIndex',999);this.service.GetImageGps(Common_GetCookie("phanfare2"),Common_TargetUid,Common_AlbumID,imageId,callbacks);return;},hideMap:function()
{this.loading.hide();},imageGpsLoaded:function(state,result)
{this.displayMap(result.gps.street_address,result.gps.city,result.gps.state);this.loading.setBody("<iframe src='http://"+Common_AlbumHostName+"/googlemap.aspx?lat="+result.gps.latitude+"&lon="+result.gps.longitude+"&ss="+Common_Session+"' width='500px' height='300px' scrolling='no' style=\"border:none;\"/>");},imageGpsFailed:function()
{this.hideMap();alert("Sorry, GPS information could not be loaded at this time");},displayMap:function(address,city,state)
{var title="";if(address!=null){title+=address;}
if(city!=null&&state!=null){if(address!=null){title+=", ";}
title+=city+", "+state;}
if(title=="")
{title="Map to Photo";}
this.loading.setHeader(title);}};})();
AlbumSectionManager=Class.create();AlbumSectionManager.prototype={nodeMiniTocDiv:null,initialize:function()
{},_initialize:function()
{this.nodeMiniTOCDiv=$('albumSectionMiniTocWrapper3');var mtUrl=null;if(Common_PageType=='Site'){mtUrl="/minitoc.aspx?s=0&username="+Common_Username;}else if(Common_PageType=='SiteCName'){mtUrl="/minitoc.aspx?s=0&cname="+Common_CName;}
if(window.frames['miniTOCIFrame']){if(Common_isIE6)Common_SetVisibility($('miniTOCIFrame'),false);if(Common_NavigationAllowed)window.frames['miniTOCIFrame'].location=mtUrl;}},displayMiniTOC:function(numYears,currentYearIndex)
{Common_RemoveChildren(this.nodeMiniTOCDiv);this.nodeMiniTOCDiv.innerHTML=Common_SelectAlbumInMiniTOC(window.frames['miniTOCIFrame'].document.body.innerHTML);AlbumListing_hybridalbumMiniToc_NumYears=numYears;AlbumListing_hybridAlbumMiniToc_CurrentYearIndex=Common_GetSelectedYearIndex(this.nodeMiniTOCDiv.innerHTML,numYears);MiniToc_Setup('hybridAlbum');MiniToc_YearRedraw('hybridAlbumMiniToc');}}
