/*
File: jquery-1.2.6.min.js
File: global.js
File: jquery.dimensions.4841.js
File: jquery.accordion.5048.min.js
File: jquery.cluetip.0.9.9pre1.min.js
File: jquery.tooltip.min.js
File: Silverlight.js
File: seadragon-min.js
File: ui.mouse.js
File: ui.slider.js
File: jquery.thickbox.31.js
*/


/*
 * jQuery 1.2.6 - New Wave Javascript
 *
 * Copyright (c) 2008 John Resig (jquery.com)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $
 * $Rev: 5685 $
 */
(function(){var _jQuery=window.jQuery,_$=window.$;var jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context);};var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,isSimple=/^.[^:#\[\.]*$/,undefined;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem){if(elem.id!=match[3])return jQuery().find(selector);return jQuery(elem);}selector=[];}}else
return jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(jQuery.makeArray(selector));},jquery:"1.2.6",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this);},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value===undefined)return this[0]&&jQuery[type||"attr"](this[0],name);else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else
return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else
selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector=='string'?jQuery(selector):jQuery.makeArray(selector))));},is:function(selector){return!!selector&&jQuery.multiFilter(selector,this).length>0;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one)return value;values.push(value);}}return values;}else
return(this[0].value||"").replace(/\r/g,"");}return undefined;}if(value.constructor==Number)value+='';return this.each(function(){if(this.nodeType!=1)return;if(value.constructor==Array&&/radio|checkbox/.test(this.type))this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else
this.value=value;});},html:function(value){return value==undefined?(this[0]?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length)data=jQuery.data(this[0],key);return data===undefined&&parts[1]?this.data(parts[0]):data;}else
return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script"))scripts=scripts.add(elem);else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else
jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}function now(){return+new Date;}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==i){target=this;--i;}for(;i<length;i++)if((options=arguments[i])!=null)for(var name in options){var src=target[name],copy=options[name];if(target===copy)continue;if(deep&&copy&&typeof copy=="object"&&!copy.nodeType)target[name]=jQuery.extend(deep,src||(copy.length!=null?[]:{}),copy);else if(copy!==undefined)target[name]=copy;}return target;};var expando="jQuery"+now(),uuid=0,windowData={},exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{};jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)window.jQuery=_jQuery;return jQuery;},isFunction:function(fn){return!!fn&&typeof fn!="string"&&!fn.nodeName&&fn.constructor!=Array&&/^[\s[]?function/.test(fn+"");},isXMLDoc:function(elem){return elem.documentElement&&!elem.body||elem.tagName&&elem.ownerDocument&&!elem.ownerDocument.body;},globalEval:function(data){data=jQuery.trim(data);if(data){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie)script.text=data;else
script.appendChild(document.createTextNode(data));head.insertBefore(script,head.firstChild);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])jQuery.cache[id]={};if(data!==undefined)jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])break;if(!name)jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute)elem.removeAttribute(expando);}delete jQuery.cache[id];}},each:function(object,callback,args){var name,i=0,length=object.length;if(args){if(length==undefined){for(name in object)if(callback.apply(object[name],args)===false)break;}else
for(;i<length;)if(callback.apply(object[i++],args)===false)break;}else{if(length==undefined){for(name in object)if(callback.call(object[name],name,object[name])===false)break;}else
for(var value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))value=value.call(elem,i);return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else
jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=elem.style;function color(elem){if(!jQuery.browser.safari)return false;var ret=defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=style.outline;style.outline="0 solid black";style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&style&&style[name])ret=style[name];else if(defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle&&!color(elem))ret=computedStyle.getPropertyValue(name);else{var swap=[],stack=[],a=elem,i=0;for(;a&&color(a);a=a.parentNode)stack.unshift(a);for(;i<stack.length;i++)if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block";}ret=name=="display"&&swap[stack.length-1]!=null?"none":(computedStyle&&computedStyle.getPropertyValue(name))||"";for(i=0;i<swap.length;i++)if(swap[i]!=null)stack[i].style.display=swap[i];}if(name=="opacity"&&ret=="")ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var left=style.left,rsLeft=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;style.left=ret||0;ret=style.pixelLeft+"px";style.left=left;elem.runtimeStyle.left=rsLeft;}}return ret;},clean:function(elems,context){var ret=[];context=context||document;if(typeof context.createElement=='undefined')context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;jQuery.each(elems,function(i,elem){if(!elem)return;if(elem.constructor==Number)elem+='';if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else
ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined,msie=jQuery.browser.msie;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(name in elem&&notxml&&!special){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem[name]=value;}if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name))return elem.getAttributeNode(name).nodeValue;return elem[name];}if(msie&&notxml&&name=="style")return jQuery.attr(elem.style,"cssText",value);if(set)elem.setAttribute(name,""+value);var attr=msie&&notxml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr;}if(msie&&name=="opacity"){if(set){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(value)+''=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+'':"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(set)elem[name]=value;return elem[name];},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||array.split||array.setInterval||array.call)ret[0]=array;else
while(i)ret[--i]=array[i];}return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)if(array[i]===elem)return i;return-1;},merge:function(first,second){var i=0,elem,pos=first.length;if(jQuery.browser.msie){while(elem=second[i++])if(elem.nodeType!=8)first[pos++]=elem;}else
while(elem=second[i++])first[pos++]=elem;return first;},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;}return ret;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++)if(!inv!=!callback(elems[i],i))ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!=null)ret[ret.length]=value;}return ret.concat.apply([],ret);}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing"}});jQuery.each({parent:function(elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++)jQuery(args[i])[original](this);});};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)this.parentNode.removeChild(this);}},empty:function(){jQuery(">*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0;}var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return i<m[3]-0;},gt:function(a,i,m){return i>m[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false,re=quickChild,m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling)if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id])break;if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~")merge[id]=true;r.push(n);}if(m=="+")break;}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true;}}if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0])ret.shift();done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length);}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]];}else{re2=quickClass;m=re2.exec(t);}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2])oid=jQuery('[@id="'+m[2]+'"]',elem)[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[];}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object")tag="param";r=jQuery.merge(r,ret[i].getElementsByTagName(tag));}if(m[1]==".")r=jQuery.classFilter(r,m[2]);if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++)if(r[i].getAttribute("id")==m[2]){tmp=[r[i]];break;}r=tmp;}ret=r;}t=t.replace(re2,"");}}if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t);}}if(t)ret=[];if(ret&&context==ret[0])ret.shift();done=jQuery.merge(done,ret);return done;},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2]))z=jQuery.attr(a,m[2])||'';if((type==""&&!!z||type=="="&&z==m[5]||type=="!="&&z!=m[5]||type=="^="&&z&&!z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling)if(n.nodeType==1)n.nodeIndex=c++;merge[id]=true;}var add=false;if(first==0){if(node.nodeIndex==last)add=true;}else if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem)r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=this.proxy(fn,function(){return fn.apply(this,arguments);});handler.data=data;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){if(typeof jQuery!="undefined"&&!jQuery.event.triggered)return jQuery.event.handle.apply(arguments.callee.elem,arguments);});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else
for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event){data.unshift({type:type,target:elem,preventDefault:function(){},stopPropagation:function(){},timeStamp:now()});data[0][expando]=true;}data[0].type=type;if(exclusive)data[0].exclusive=true;var handle=jQuery.data(elem,"handle");if(handle)val=handle.apply(elem,data);if((!fn||(jQuery.nodeName(elem,'a')&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val,ret,namespace,all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);namespace=event.type.split(".");event.type=namespace[0];namespace=namespace[1];all=!namespace&&!event.exclusive;handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||handler.type==namespace){event.handler=handler;event.data=handler.data;ret=handler.apply(this,arguments);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}return val;},fix:function(event){if(event[expando]==true)return event;var originalEvent=event;event={originalEvent:originalEvent};var props="altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");for(var i=props.length;i;i--)event[props[i]]=originalEvent[props[i]];event[expando]=true;event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};event.timeStamp=event.timeStamp||now();if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=event.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},proxy:function(fn,proxy){proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);return(fn||data).apply(this,arguments);});return this.each(function(){jQuery.event.add(this,type,one,fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){return this[0]&&jQuery.event.trigger(type,data,this[0],false,fn);},toggle:function(fn){var args=arguments,i=1;while(i<args.length)jQuery.event.proxy(fn,args[i++]);return this.click(jQuery.event.proxy(fn,function(event){this.lastToggle=(this.lastToggle||0)%i;event.preventDefault();return args[this.lastToggle++].apply(this,arguments)||false;}));},hover:function(fnOver,fnOut){return this.bind('mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else
jQuery.readyList.push(function(){return fn.call(this,jQuery);});return this;}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.call(document);});jQuery.readyList=null;}jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&&!jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}jQuery.ready();})();if(jQuery.browser.opera)document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i<document.styleSheets.length;i++)if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}jQuery.ready();},false);if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(numStyles===undefined)numStyles=jQuery("style, link[rel=stylesheet]").length;if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return;}jQuery.ready();})();}jQuery.event.add(window,"load",jQuery.ready);}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,change,select,"+"submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem)try{parent=parent.parentNode;}catch(error){parent=elem;}return parent==elem;};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind();});jQuery.fn.extend({_load:jQuery.fn.load,load:function(url,params,callback){if(typeof url!='string')return this._load(url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{url:location.href,global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");var remote=/^(?:\w+:)?\/\/([^\/?#]+)/;if(s.dataType=="script"&&type=="GET"&&remote.test(s.url)&&remote.exec(s.url)[1]!=location.host){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xhr=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();if(s.username)xhr.open(type,s.url,s.async,s.username,s.password);else
xhr.open(type,s.url,s.async);try{if(s.data)xhr.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&jQuery.active--;xhr.abort();return false;}if(s.global)jQuery.event.trigger("ajaxSend",[xhr,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xhr)&&"error"||s.ifModified&&jQuery.httpNotModified(xhr,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s.dataFilter);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else
jQuery.handleError(s,xhr,status);complete();if(s.async)xhr=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xhr){xhr.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xhr.send(s.data);}catch(e){jQuery.handleError(s,xhr,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xhr,s]);}function complete(){if(s.complete)s.complete(xhr,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xhr,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xhr;},handleError:function(s,xhr,status,e){if(s.error)s.error(xhr,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xhr,s,e]);},active:0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url]||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpData:function(xhr,type,filter){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(filter)data=filter(data,type);if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else
for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else
s.push(encodeURIComponent(j)+"="+encodeURIComponent(jQuery.isFunction(a[j])?a[j]():a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall),p,hidden=jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return opt.complete.call(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else
e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.call(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(elem){type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",jQuery.makeArray(array));}return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].call(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:jQuery.fx.speeds[opt.duration])||jQuery.fx.speeds.def;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.call(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.call(this.elem,this.now,this);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)if(!timers[i]())timers.splice(i--,1);if(!timers.length){clearInterval(jQuery.timerId);jQuery.timerId=null;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(0,this.cur());if(this.prop=="width"||this.prop=="height")this.elem.style[this.prop]="1px";jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=now();if(gotoEnd||t>this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done)this.options.complete.call(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,def:400},step:{scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}}});jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),css=jQuery.curCSS,fixed=css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||css(offsetChild,"position")=="absolute"))||(mozilla&&css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l,10)||0;top+=parseInt(t,10)||0;}return results;};jQuery.fn.extend({position:function(){var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,'marginTop');offset.left-=num(this,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return jQuery(offsetParent);}});jQuery.each(['Left','Top'],function(i,name){var method='scroll'+name;jQuery.fn[method]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val;}):this[0]==window||this[0]==document?self[i?'pageYOffset':'pageXOffset']||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method];};});jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":"Bottom";jQuery.fn["inner"+name]=function(){return this[name.toLowerCase()]()+num(this,"padding"+tl)+num(this,"padding"+br);};jQuery.fn["outer"+name]=function(margin){return this["inner"+name]()+num(this,"border"+tl+"Width")+num(this,"border"+br+"Width")+(margin?num(this,"margin"+tl)+num(this,"margin"+br):0);};});})();


/*================================================================*/
/*	PageHandler */
/*================================================================*/

var JsPageHandler = new function() {
    this.initilized = false;
    this.onLoadFunctionStack = new Array();
    this.registerTime = true;

    this.init = function() {
        this.registerTime = false;
        for (var x = 0; x < this.onLoadFunctionStack.length; x++) {
            this.onLoadFunctionStack[x]();
        }
        this.initilized = true;
    };
    this.registerLoadScript = function(f) {
        if (this.registerTime) {
            this.onLoadFunctionStack[this.onLoadFunctionStack.length] = f;
        }
    };
    /* prepare field for onfocus and onblur logic */
    this.prepareFieldForDefaultText = function(field, text) {
        field.rel = text;
        field.value = text;
        jQuery(field).focus(function() { JsPageHandler.focusField(this); });
        jQuery(field).blur(function() { JsPageHandler.blurField(this); });
    }
    /* delete field text if it is the default text */ 
    this.focusField = function(field) { if (field.value == field.rel) { field.value = ""; } };
    /* fill field text with default text if it is empty */
    this.blurField = function(field) { if (field.value == "") { field.value = field.rel; } };
};


/*================================================================*/
/*	Print Reciept on Placed Page */
/*================================================================*/
JsPageHandler.registerLoadScript(function() { 
	// Reciept Popup on Confirm Page
	jQuery("#placed a.reciept").each(
		function() {
			$clearHandlers(this);
			$addHandler(this, "click", OpenReciept);
		}
	);

});

function OpenReciept() {
	window.open("/ShowConfirmEmail.aspx", "Reciept", "width=700,height=700,scrollbars=yes");
}


/*================================================================*/
/*	PopupHandler */
/*================================================================*/

var PopupHandler = new function() {
    this.width = 500;
    this.height = 600;
    this.win = null;

    this.init = function() {
        $("a").each(function() {
            var link = this;
            var href = link.href.toLowerCase()
            if (link.href && (href.indexOf("popup.aspx") >= 0)) {
                $(link).bind("click", function() { PopupHandler.openPopup(this); return false; });
            }
        });
    };
    this.openPopup = function(link) {
        this.win = window.open(link.href, "popup", "width=" + this.width + ",height=" + this.height + ",scrollbars=yes,status=no,location=no,menubar=no,toolbar=no,dependent=yes");
        if (this.win) {
            this.win.focus();
        }
    };
};
JsPageHandler.registerLoadScript(function() { PopupHandler.init(); });

/*================================================================*/
/*	ToolTipHandler */
/*================================================================*/

var tooltippHandler = new function() {
    this.closeTimeout = null;
    this.currentZIndex = 5000;
    this.tooltipCounter = 1;

    this.init = function() {
        jQuery(".tooltipp").each(function() {
            tooltippHandler.initTipp(this);
        });
    };
    this.initTipp = function(tipp) {
        if (tipp.id == "") {
            tipp.id = "tooltipp" + this.tooltipCounter++;
        }
        if (tipp.id == "slidercolorfilter" || tipp.id == "slidersizefilter") {
            jQuery(tipp).children(".tooltipp-body").insertBefore(jQuery(tipp).children(".tooltipp-header"));
        }
        if (tipp.id == "basketdisplay") {
            // add events in BasketHandler.init();
        } else {
            jQuery(tipp).bind("mouseover", function() { tooltippHandler.open(this); });
            jQuery("#" + tipp.id + " .tooltipp-content").bind("mouseover", function() { tooltippHandler.open(this.parentNode.parentNode); });
            jQuery(tipp).bind("mouseout", function() { tooltippHandler.closeTimeout = setTimeout("tooltippHandler.close('" + this.id + "')", 200); });
            jQuery(tipp).children(".tooltipp-header").css("cursor", "pointer");
        }
        jQuery(tipp).css("z-index", tooltippHandler.currentZIndex--);
        if (tipp.id == "") { tipp.id = "tooltipp" + tooltippHandler.currentZIndex; }
    }
    this.open = function(tipp) {
        if (this.closeTimeout && jQuery(tipp).is(".active-tipp")) {
            clearTimeout(this.closeTimeout);
            this.closeTimeout = null;
        }
        jQuery(tipp).addClass("active-tipp");
        this.setNegativeSpacing(tipp);
    }
    this.close = function(tippid) {
        jQuery("#" + tippid).css("margin-top", 0);
        jQuery("#" + tippid).css("margin-bottom", 0);
        jQuery("#" + tippid).removeClass("active-tipp");
    }
    this.setNegativeSpacing = function(tipp) {
        var h = jQuery(tipp).children(".tooltipp-body").height();
        if (tipp.id == "slidercolorfilter" || tipp.id == "slidersizefilter") {
            jQuery(tipp).css("margin-top", -h);
        } else {
            jQuery(tipp).css("margin-bottom", -h);
        }
    }
    JsPageHandler.registerLoadScript(this.init);
};


/*================================================================*/
/*	Basket Handler */
/*================================================================*/

var BasketHandler = new function() {
	this.closeTimeout = null;
	this.statusTimeout = null;
	this.filled = false;
	this.ean = "";
	this.html = null;
	this.backend = null;
	this.eventsAdded = false;
	this.comingsoon = false;
	this.initialized = false;

	this.init = function() {
		if (!this.initialized) {
			var basket = jQuery("#basketdisplay");
			var checkout = jQuery(".checkoutrows");
			this.filled = basket.is(".filledbasket");
			var coomingsoon = jQuery(".comingsoon");
			if (coomingsoon.is(".productview")) {
				this.comingsoon = true;
				jQuery(".sizes li a").each(function() {
					jQuery(this).css("cursor", "default");
				});
			}
			if (this.filled && checkout.length == 0) {
				this.activateOpenBasketButton();
				this.addEvents();
			}
			if (this.ean != "" && !this.comingsoon) {
				this.activateAddToBasketButton();
			}
			jQuery("#basketdisplay .tooltipp-body").hide();
			this.initialized = true;
		}
	};

	this.setEAN = function(ean) { this.ean = ean; };
	this.getEAN = function() { return this.ean; };
	this.setHtml = function(html) { this.html = html; };
	this.getHtml = function() { return this.html; };
	this.isFilled = function(status) { this.filled = status; };

	this.changeEAN = function(ean, link) {
		if (!this.comingsoon) {
			this.setEAN(ean);
			this.activateAddToBasketButton();
			jQuery(".sizes li").each(function() {
				if (this == link.parentNode) {
					jQuery(this).addClass("current");
				} else {
					jQuery(this).removeClass("current");
				}
			});
		}
		return false;
	};

	this.addToBasket = function(obj) {
		backend.AddToBasket(this.ean, function(status) { BasketHandler.addToBasketFinalizer(status) });
	}

	this.addToBasketFinalizer = function(status) {

		jQuery("#BasketStatusHeadline").html("<span></span>" + status.Headline);

		if (status.IsOk == 1) {
			jQuery("#BasketStatusBody").html(status.LasAdded);
			jQuery("#BasketContentBody").html(status.BasketHTML);
			jQuery("#basketdisplay").removeClass("emptybasket");
		} else {
			jQuery("#BasketStatusBody").html("<div class='errormessage'>" + status.Message + "</div>");
			jQuery("#basketdisplay").addClass("errorbasket");
		}
		if (status.VOG > 0) { this.isFilled = true; }
		jQuery("#basketdisplay").addClass("filledbasket");
		this.showTransactionResult();
		this.activateOpenBasketButton();
		this.addEvents();
	};
	this.activateAddToBasketButton = function() {
		if (!jQuery("#AddToBasket").is(".activebutton")) {
			jQuery("#AddToBasket").addClass("activebutton");
			jQuery("#AddToBasket").bind("click", this.getEAN(), function() { BasketHandler.addToBasket(backend); });
		}
	}
	this.activateOpenBasketButton = function() {
		jQuery("#ShowBasket").addClass("activebutton");
		jQuery("#ShowBasket").bind("click", function() { window.location.href = "/basket.aspx"; });
	}

	this.showTransactionResult = function() {
		if (this.statusTimeout) { clearTimeout(this.statusTimeout); this.statusTimeout = null; }
		jQuery("#BasketContentBody").css("display", "none");
		jQuery("#BasketStatusBody").css("display", "block");
		jQuery("#basketdisplay .tooltipp-body").slideDown(500, function() { BasketHandler.statusTimeout = setTimeout("BasketHandler.hideTransactionResult()", 2000); });
	}

	this.hideTransactionResult = function() {
		jQuery("#basketdisplay .tooltipp-body").slideUp(200);
	}

	this.addEvents = function() {
		if (!this.eventsAdded) {
			jQuery("#basketdisplay").bind("mouseover", function() { BasketHandler.open(this); });
			jQuery("#basketdisplay").bind("mouseout", function() { BasketHandler.closeTimeout = setTimeout("BasketHandler.close('" + this.id + "')", 200); });
			jQuery("#basketdisplay").children(".tooltipp-header").css("cursor", "pointer");
			this.eventsAdded = true;
		}
	}
	this.open = function(tipp) {
		if (this.closeTimeout && jQuery(tipp).is(".active-tipp")) {
			clearTimeout(this.closeTimeout);
			this.closeTimeout = null;
		}
		jQuery("#BasketStatusBody").css("display", "none");
		jQuery("#BasketContentBody").css("display", "block");
		tooltippHandler.open(tipp);
		jQuery("#basketdisplay .tooltipp-body").show();
	};

	this.close = function(tippid) {
		tooltippHandler.close(tippid);
		jQuery("#basketdisplay .tooltipp-body").hide();
	};
};
JsPageHandler.registerLoadScript(function() { BasketHandler.init(); });


/*================================================================*/
/*	 Product Gallery */
/*================================================================*/

var ProductGallery = new function() {
	this.isScrolling = false;
	this.scrollInterval = null;
	this.scrollSteps = 10;
	this.scrollDirection = -1;
	this.maxScrollPoint = -20;

	this.init = function() {
		var galleryHolder = jQuery('div.productgallery');
		jQuery('.slider', galleryHolder).parent().css("visibility", "visible");
		var gallery = jQuery('ul', galleryHolder);
		var slider = jQuery('.slider', galleryHolder);
		var handle = jQuery('.handle', galleryHolder);
		var entries = jQuery('li', gallery);

		var maxListWidth = entries.length * entries.outerWidth();

		gallery.css("width", maxListWidth);

		var itemsWidth = gallery.innerWidth() - galleryHolder.outerWidth();
		this.maxScrollPoint = itemsWidth * -1;

		var maxSliderDelta = slider.outerWidth() - handle.outerWidth();
		var sliderSteps = (maxSliderDelta / itemsWidth) * this.scrollSteps;
		this.sliderMultiplier = sliderSteps / this.scrollSteps;

		//alert(itemsWidth + "\n" + maxSliderDelta + "\n" + this.sliderMultiplier + "\n" + sliderSteps);
		//Sys.Debug.trace(itemsWidth + "\n" + maxSliderDelta + "\n" + this.sliderMultiplier + "\n" + sliderSteps);
		
		if (galleryHolder.outerWidth() < maxListWidth) {
			jQuery('.slider', galleryHolder).slider({
				minValue: 0,
				maxValue: itemsWidth,
				handle: '.handle',
				stop: function(event, ui) {
					gallery.animate({ 'left': ui.value * -1 }, 500);
				},
				slide: function(event, ui) {
					gallery.css('left', ui.value * -1);
				}
			});
		} else {
			jQuery('.slider', galleryHolder).parent().css("visibility", "hidden");
		}
		jQuery('.sliderwrapper .back', galleryHolder).bind("mousedown", function() { ProductGallery.initScrolling(1); });
		jQuery('.sliderwrapper .back', galleryHolder).bind("mouseup", function() { ProductGallery.finalizeScrolling(); });
		jQuery('.sliderwrapper .back', galleryHolder).bind("mouseout", function() { ProductGallery.finalizeScrolling(); });
		jQuery('.sliderwrapper .forward', galleryHolder).bind("mousedown", function() { ProductGallery.initScrolling(-1); });
		jQuery('.sliderwrapper .forward', galleryHolder).bind("mouseup", function() { ProductGallery.finalizeScrolling(); });
		jQuery('.sliderwrapper .forward', galleryHolder).bind("mouseout", function() { ProductGallery.finalizeScrolling(); });
	};
	/**
	* initialize scroll logic if side arrow of a slider bar has mousedown event
	**/
	this.initScrolling = function(direction) {
		if (!this.isScrolling) {
			this.scrollDirection = direction;
			this.scrollInterval = setInterval("ProductGallery.scrolling();", 50);
			this.isScrolling = true;
		}
	};
	/**
	* finalize scroll logic if side arrow of a slider bar has mouseup event
	**/
	this.finalizeScrolling = function() {
		if (this.isScrolling) {
			clearInterval(this.scrollInterval);
			this.scrollInterval = null;
			this.isScrolling = false;
		}
	};
	/**
	* scroll product gallery
	**/
	this.scrolling = function() {
		var left = jQuery(".productgallery .productlist ul").css("left");
		if (left.indexOf("px") > -1) {
			left = left.substring(0, left.indexOf("px")) * 1;
		} else if (left.indexOf("pt") > -1) {
			left = left.substring(0, left.indexOf("pt")) * 1;
		} else if (left.indexOf("auto") > -1) {
			left = 0;
		}
		var newleft = left + (this.scrollSteps * this.scrollDirection);
		if (newleft >= 0) {
			newleft = 0;
			this.finalizeScrolling();
		} else if (newleft < this.maxScrollPoint) {
			newleft = this.maxScrollPoint;
			this.finalizeScrolling();
		}
		jQuery(".productgallery .productlist ul").css("left", newleft);
		jQuery(".productgallery .handle").css("left", (newleft * -1) * this.sliderMultiplier);
	};
};


/*================================================================*/
/*	 Mood Rotator */
/*================================================================*/

var MoodsHandler = new function() {
    this.root = "/Pic/moods/";
    this.filenames = new Array("Home_01.jpg", "Home_02.jpg", "Home_03.jpg", "Home_04.jpg", "Home_05.jpg");
    this.wrapperIdent = ".moodwrapper";
    this.width = 900;
    this.height = 400;
    this.moodrange = this.filenames.length;
    this.firstImageInRange = 0;
    
    this.renderedMoods = {};
    /* possible viewmodes */
    this.RANDOM = "random";
    this.CONTINUOUS = "continuous";
    /* current viewmode */
    this.viewOrder = "random";
    
    this.currentPosition = -1;
    this.currentNode = null;
    this.nextNode = null;
    
    /*
     * initilize the moodhandler for a specific mood theme. Image
     * param root: specified the root path where to find the mood images.
     * param prefix = a string of the mood theme image filename prefix. for example = if filename "Home_01.jpg" than prefix is "Home_".
     * param suffix = a string of the mood theme image filename suffix. for example = if filename "Home_01.jpg" than prefix is ".jpg".
     * param suffix = an id string of the node that hold the mood animation.
     * param width = the width of the mood images.
     * param height = the height of the mood images.
     * param moodrange = the quantity of mood images.
     * param firstImageInRange = a number in which position the moodanimation should start. between 1 and moodrange.
     **/
    this.init = function(root, filenamearray, wrapperId, width, height, firstImageInRange) {
        this.root               = (root ? root : this.root);
        this.filenames          = (filenamearray ? filenamearray : this.filenames);
        this.wrapperIdent       = (wrapperId ? wrapperId : this.wrapperIdent);
        this.width              = (width ? width : this.width);
        this.height             = (height ? height : this.height);
        this.moodrange          = this.filenames.length;
        this.firstImageInRange  = (firstImageInRange ? firstImageInRange : this.firstImageInRange);
        jQuery(this.wrapperIdent).css("width", this.width);
        jQuery(this.wrapperIdent).css("height", this.height);
    }
    /*
     * start the animation with a specific speed
     * param speed: an int value for milliseconds between next image switch.
     **/
    this.startAnimation = function(speed, viewmode) {
        this.viewOrder = viewmode;
        this.nextNode = this.getNext();
        MoodsHandler.animate();
        this.aniInterval = setInterval("MoodsHandler.animate();", (speed ? speed : 4000));
    };
    /*
     * stop the animation
     **/
    this.stopAnimation = function() {
        if (this.aniInterval) {
            clearInterval(this.aniInterval);
        }
    };
    /*
     * define the type and effect logic for the mood animation. 
     **/
    this.animate = function() {
        jQuery("#" + this.nextNode).css("z-Index", 3);
        jQuery("#" + this.currentNode).css("z-Index", "1");
        jQuery("#" + this.nextNode).fadeIn(1000, function(){ MoodsHandler.finalizeAni(); });
    };
    this.finalizeAni = function() {
        if (!this.currentNode || this.currentNode != this.nextNode) {
            jQuery("#" + this.currentNode).css("display", "none");
            this.currentNode = "" + this.nextNode;
        }
        this.nextNode = this.getNext();
    };
    /*
     * return the next node depend on this.viewOrder value. 
     **/
    this.getNext = function() {
        var pos = this.currentPosition;
        if (this.currentPosition  == -1) {
            if (this.viewOrder == "random") {
                pos = Math.round(Math.random() * (this.moodrange-1));
            } else {
                pos = this.firstImageInRange;
            }
        } else {
            if (this.viewOrder == "random") {
                while (pos == this.currentPosition) {
                    pos = Math.round(Math.random() * (this.moodrange-1));
                }
            } else {
                pos = ((this.currentPosition < this.moodrange-1) ? this.currentPosition++ : 0);
            }
        }
        this.currentPosition = pos;
        return this.buildNewMoodEntry(pos);
    };
    /*
     * build the node for one mood image and return the node id
     * param pos: an int value which is in the initilized moodrange.
     **/
    this.buildNewMoodEntry = function(pos) {
        var moodid = this.buildId(pos);
        if (!this.renderedMoods[moodid]) {
            var node = "<div id='" + moodid + "' style='display:none;height:" + this.height + "px;'><img src='" + this.root + this.filenames[pos] + "' width='" + this.width + "' height='" + this.height + "' alt='Gaastra' ></div>";
            jQuery(this.wrapperIdent).append(node);
            this.renderedMoods[moodid] = "rendered";
        }
        return moodid;
    };
    /*
     * build the id string of a new node. return the id string
     * param pos: an int value of the new position.
     **/
    this.buildId = function(pos) {
        var name = this.filenames[pos];
        var id = name.substring(0, name.lastIndexOf("."));
        return id;
    };
};



/*================================================================*/
/*	Adds "missr" to ParentParent of Validator (Validator MUST have EnableClientScript=false!)			*/
/*================================================================*/
var ErrorRowChecker = new function() {
	this.interval = null;
	this.failed = [];

	this.init = function() {
		if ($(".missing").length > 0) {
			this.interval = window.setInterval("ErrorRowChecker.check();", 250);
		} else {
			jQuery(".errorrow").css("display", "none");
		}
	}


	this.check = function() {
	
		var missing = $(".missing");

		/* Clean all Rows */
		for(var x = 0; x < missing.length; x++) {
			jQuery(missing[x].parentNode.parentNode).removeClass("missr");
		}

		/*Find Validators */
		var Makered = new Array();
		for(var x = 0; x < missing.length; x++) {
			var id = jQuery(missing[x]).attr("id").replace(/2/g,"");
			if (jQuery(missing[x]).css("display") != "none") {
				if (!Array.contains(Makered,id)){
					jQuery(missing[x].parentNode.parentNode).addClass("missr");
					Array.add(Makered, id);
				}
			}
		}


		/* Disable Handler, if no Validator on this Page */
		if ($(".missing").length == 0) {
			clearInterval(this.interval);
			jQuery(".errorrow").css("display", "none");
		}
	};
		
}

JsPageHandler.registerLoadScript(function() { ErrorRowChecker.init(); });

/*================================================================*/
/* Silverlight Helper */
/*================================================================*/
function onSilverlightError(sender, args) {
	var appSource = "";
	if (sender != null && sender != 0) {
		appSource = sender.getHost().Source;
	}

	var errorType = args.ErrorType;
	var iErrorCode = args.ErrorCode;

	if (errorType == "ImageError" || errorType == "MediaError") {
		return;
	}

	var errMsg = "Unhandled Error in Silverlight Application " + appSource + "\n";

	errMsg += "Code: " + iErrorCode + "    \n";
	errMsg += "Category: " + errorType + "       \n";
	errMsg += "Message: " + args.ErrorMessage + "     \n";

	if (errorType == "ParserError") {
		errMsg += "File: " + args.xamlFile + "     \n";
		errMsg += "Line: " + args.lineNumber + "     \n";
		errMsg += "Position: " + args.charPosition + "     \n";
	}
	else if (errorType == "RuntimeError") {
		if (args.lineNumber != 0) {
			errMsg += "Line: " + args.lineNumber + "     \n";
			errMsg += "Position: " + args.charPosition + "     \n";
		}
		errMsg += "MethodName: " + args.methodName + "     \n";
	}

	throw new Error(errMsg);
}

/*================================================================*/


	
jQuery.fn.hoverClass = function(c) {
	return this.each(function(){
		jQuery(this).hover( 
			function() { jQuery(this).addClass(c);},
			function() { jQuery(this).removeClass(c); }
		);
	});
};



function OpenEFashionShow() {
	window.open("/static/eshow/Gaastra.html", "fashionshow", "width=740,height=602,top=10,resizable=no");
	return false;
}

JsPageHandler.registerLoadScript(function() {
	jQuery(".fwelcome .moodwrapper").click(function() {
		window.open("/static/eshow/Gaastra.html", "fashionshow", "width=740,height=602,top=10,resizable=no");
	});
});

JsPageHandler.registerLoadScript(function() {
	jQuery(".proline .moodwrapper").click(function() {
		location.href = "/container/" + MyLang + "/progear", "Progear", "width=740,height=602,top=10,resizable=no";
	});
});


/* Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * $LastChangedDate: 2008-02-28 11:49:55 +0100 (Do, 28 Feb 2008) $
 * $Rev: 4841 $
 *
 * Version: @VERSION
 *
 * Requires: jQuery 1.2+
 */

(function($){
	
$.dimensions = {
	version: '@VERSION'
};

// Create innerHeight, innerWidth, outerHeight and outerWidth methods
$.each( [ 'Height', 'Width' ], function(i, name){
	
	// innerHeight and innerWidth
	$.fn[ 'inner' + name ] = function() {
		if (!this[0]) return;
		
		var torl = name == 'Height' ? 'Top'    : 'Left',  // top or left
		    borr = name == 'Height' ? 'Bottom' : 'Right'; // bottom or right
		
		return this.css('display') != 'none' ? this[0]['client' + name] : num( this, name.toLowerCase() ) + num(this, 'padding' + torl) + num(this, 'padding' + borr);
	};
	
	// outerHeight and outerWidth
	$.fn[ 'outer' + name ] = function(options) {
		if (!this[0]) return;
		
		var torl = name == 'Height' ? 'Top'    : 'Left',  // top or left
		    borr = name == 'Height' ? 'Bottom' : 'Right'; // bottom or right
		
		options = $.extend({ margin: false }, options || {});
		
		var val = this.css('display') != 'none' ? 
				this[0]['offset' + name] : 
				num( this, name.toLowerCase() )
					+ num(this, 'border' + torl + 'Width') + num(this, 'border' + borr + 'Width')
					+ num(this, 'padding' + torl) + num(this, 'padding' + borr);
		
		return val + (options.margin ? (num(this, 'margin' + torl) + num(this, 'margin' + borr)) : 0);
	};
});

// Create scrollLeft and scrollTop methods
$.each( ['Left', 'Top'], function(i, name) {
	$.fn[ 'scroll' + name ] = function(val) {
		if (!this[0]) return;
		
		return val != undefined ?
		
			// Set the scroll offset
			this.each(function() {
				this == window || this == document ?
					window.scrollTo( 
						name == 'Left' ? val : $(window)[ 'scrollLeft' ](),
						name == 'Top'  ? val : $(window)[ 'scrollTop'  ]()
					) :
					this[ 'scroll' + name ] = val;
			}) :
			
			// Return the scroll offset
			this[0] == window || this[0] == document ?
				self[ (name == 'Left' ? 'pageXOffset' : 'pageYOffset') ] ||
					$.boxModel && document.documentElement[ 'scroll' + name ] ||
					document.body[ 'scroll' + name ] :
				this[0][ 'scroll' + name ];
	};
});

$.fn.extend({
	position: function() {
		var left = 0, top = 0, elem = this[0], offset, parentOffset, offsetParent, results;
		
		if (elem) {
			// Get *real* offsetParent
			offsetParent = this.offsetParent();
			
			// Get correct offsets
			offset       = this.offset();
			parentOffset = offsetParent.offset();
			
			// Subtract element margins
			offset.top  -= num(elem, 'marginTop');
			offset.left -= num(elem, 'marginLeft');
			
			// Add offsetParent borders
			parentOffset.top  += num(offsetParent, 'borderTopWidth');
			parentOffset.left += num(offsetParent, 'borderLeftWidth');
			
			// Subtract the two offsets
			results = {
				top:  offset.top  - parentOffset.top,
				left: offset.left - parentOffset.left
			};
		}
		
		return results;
	},
	
	offsetParent: function() {
		var offsetParent = this[0].offsetParent;
		while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && $.css(offsetParent, 'position') == 'static') )
			offsetParent = offsetParent.offsetParent;
		return $(offsetParent);
	}
});

function num(el, prop) {
	return parseInt($.curCSS(el.jquery?el[0]:el,prop,true))||0;
};

})(jQuery);

/*
 * jQuery UI Accordion
 * 
 * Copyright (c) 2007 Jörn Zaefferer
 *
 * http://docs.jquery.com/UI/Accordion
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * Revision: $Id: ui.accordion.js 5046 2008-03-17 09:18:08Z joern.zaefferer $
 *
 */;(function($){$.ui=$.ui||{};$.fn.extend({accordion:function(options,data){var args=Array.prototype.slice.call(arguments,1);return this.each(function(){if(typeof options=="string"){var accordion=$.data(this,"accordion");if(accordion)accordion[options].apply(accordion,args);}else if(!$(this).is(".ui-accordion"))$.data(this,"accordion",new $.ui.accordion(this,options));});},activate:function(index){return this.accordion("activate",index);}});$.ui.accordion=function(container,options){this.options=options=$.extend({},$.ui.accordion.defaults,options);this.element=container;$(container).addClass("ui-accordion");if(options.navigation){var current=$(container).find("a").filter(options.navigationFilter);if(current.length){if(current.filter(options.header).length){options.active=current;}else{options.active=current.parent().parent().prev();current.addClass("current");}}}options.headers=$(container).find(options.header);options.active=findActive(options.headers,options.active);if(options.fillSpace){var maxHeight=$(container).parent().height();options.headers.each(function(){maxHeight-=$(this).outerHeight();});var maxPadding=0;options.headers.next().each(function(){maxPadding=Math.max(maxPadding,$(this).innerHeight()-$(this).height());}).height(maxHeight-maxPadding);}else if(options.autoHeight){var maxHeight=0;options.headers.next().each(function(){maxHeight=Math.max(maxHeight,$(this).outerHeight());}).height(maxHeight);}options.headers.not(options.active||"").next().hide();options.active.parent().andSelf().addClass(options.selectedClass);if(options.event)$(container).bind((options.event)+".accordion",clickHandler);};$.ui.accordion.prototype={activate:function(index){clickHandler.call(this.element,{target:findActive(this.options.headers,index)[0]});},enable:function(){this.options.disabled=false;},disable:function(){this.options.disabled=true;},destroy:function(){this.options.headers.next().css("display","");if(this.options.fillSpace||this.options.autoHeight){this.options.headers.next().css("height","");}$.removeData(this.element,"accordion");$(this.element).removeClass("ui-accordion").unbind(".accordion");}};function scopeCallback(callback,scope){return function(){return callback.apply(scope,arguments);};};function completed(cancel){if(!$.data(this,"accordion"))return;var instance=$.data(this,"accordion");var options=instance.options;options.running=cancel?0:--options.running;if(options.running)return;if(options.clearStyle){options.toShow.add(options.toHide).css({height:"",overflow:""});}$(this).triggerHandler("accordionchange",[options.data],options.change);}function toggle(toShow,toHide,data,clickedActive,down){var options=$.data(this,"accordion").options;options.toShow=toShow;options.toHide=toHide;options.data=data;var complete=scopeCallback(completed,this);options.running=toHide.size()==0?toShow.size():toHide.size();if(options.animated){if(!options.alwaysOpen&&clickedActive){$.ui.accordion.animations[options.animated]({toShow:jQuery([]),toHide:toHide,complete:complete,down:down,autoHeight:options.autoHeight});}else{$.ui.accordion.animations[options.animated]({toShow:toShow,toHide:toHide,complete:complete,down:down,autoHeight:options.autoHeight});}}else{if(!options.alwaysOpen&&clickedActive){toShow.toggle();}else{toHide.hide();toShow.show();}complete(true);}}function clickHandler(event){var options=$.data(this,"accordion").options;if(options.disabled)return false;if(!event.target&&!options.alwaysOpen){options.active.parent().andSelf().toggleClass(options.selectedClass);var toHide=options.active.next(),data={instance:this,options:options,newHeader:jQuery([]),oldHeader:options.active,newContent:jQuery([]),oldContent:toHide},toShow=options.active=$([]);toggle.call(this,toShow,toHide,data);return false;}var clicked=$(event.target);if(clicked.parents(options.header).length)while(!clicked.is(options.header))clicked=clicked.parent();var clickedActive=clicked[0]==options.active[0];if(options.running||(options.alwaysOpen&&clickedActive))return false;if(!clicked.is(options.header))return;options.active.parent().andSelf().toggleClass(options.selectedClass);if(!clickedActive){clicked.parent().andSelf().addClass(options.selectedClass);}var toShow=clicked.next(),toHide=options.active.next(),data={instance:this,options:options,newHeader:clicked,oldHeader:options.active,newContent:toShow,oldContent:toHide},down=options.headers.index(options.active[0])>options.headers.index(clicked[0]);options.active=clickedActive?$([]):clicked;toggle.call(this,toShow,toHide,data,clickedActive,down);return false;};function findActive(headers,selector){return selector!=undefined?typeof selector=="number"?headers.filter(":eq("+selector+")"):headers.not(headers.not(selector)):selector===false?$([]):headers.filter(":eq(0)");}$.extend($.ui.accordion,{defaults:{selectedClass:"selected",alwaysOpen:true,animated:'slide',event:"click",header:"a",autoHeight:true,running:0,navigationFilter:function(){return this.href.toLowerCase()==location.href.toLowerCase();}},animations:{slide:function(options,additions){options=$.extend({easing:"swing",duration:300},options,additions);if(!options.toHide.size()){options.toShow.animate({height:"show"},options);return;}var hideHeight=options.toHide.height(),showHeight=options.toShow.height(),difference=showHeight/hideHeight;options.toShow.css({height:0,overflow:'hidden'}).show();options.toHide.filter(":hidden").each(options.complete).end().filter(":visible").animate({height:"hide"},{step:function(now){var current=(hideHeight-now)*difference;if($.browser.msie||$.browser.opera){current=Math.ceil(current);}options.toShow.height(current);},duration:options.duration,easing:options.easing,complete:function(){if(!options.autoHeight){options.toShow.css("height","auto");}options.complete();}});},bounceslide:function(options){this.slide(options,{easing:options.down?"bounceout":"swing",duration:options.down?1000:200});},easeslide:function(options){this.slide(options,{easing:"easeinout",duration:700});}}});})(jQuery);

(function(E){var I,H,G,D,F,J,C;E.fn.cluetip=function(L,K){if(typeof L=="object"){K=L;L=null}return this.each(function(k){var U=E(this);var f=E.extend(false,{},E.fn.cluetip.defaults,K||{},E.metadata?U.metadata():E.meta?U.data():{});var O=false;var Y=parseInt(f.cluezIndex,10)-1;var s=false,r=0;if(!E("#cluetip").length){H=E('<div id="cluetip-inner"></div>');D=E('<h3 id="cluetip-title"></h3>');G=E('<div id="cluetip-outer"></div>').append(H).prepend(D);I=E('<div id="cluetip"></div>').css({zIndex:f.cluezIndex}).append(G).append('<div id="cluetip-extra"></div>')[B](A).hide();E('<div id="cluetip-waitimage"></div>').css({position:"absolute",zIndex:Y-1}).insertBefore("#cluetip").hide();I.css({position:"absolute",zIndex:Y});G.css({position:"relative",zIndex:Y+1});F=E('<div id="cluetip-arrows" class="cluetip-arrows"></div>').css({zIndex:Y+1}).appendTo("#cluetip")}var j=f.dropShadow?+f.dropShadowSteps:0;if(!J){J=E([]);for(var v=0;v<j;v++){J=J.add(E("<div></div>").css({zIndex:Y-v-1,opacity:0.1,top:1+v,left:1+v}))}J.css({position:"absolute",backgroundColor:f.dropShadowColor}).prependTo(I)}var d=U.attr(f.attribute),R=f.cluetipClass;if(!d&&!f.splitTitle&&!L){return true}if(f.local&&f.localPrefix){d=f.localPrefix+d}if(f.local&&f.hideLocal){E(d+":first").hide()}var e=parseInt(f.topOffset,10),a=parseInt(f.leftOffset,10);var Z,t;var W=isNaN(parseInt(f.height,10))?"auto":(/\D/g).test(f.height)?f.height:f.height+"px";var M,S,l,y,n,u;var X=isNaN(parseInt(f.width,10))?275:parseInt(f.width,10);var w=X+(parseInt(I.css("paddingLeft"),10)||0)+(parseInt(I.css("paddingRight"),10)||0)+j;var b=this.offsetWidth;var T,m,z,o,N;var q;var g=(f.attribute!="title")?U.attr(f.titleAttribute):"";if(f.splitTitle){if(g==undefined){g=""}q=g.split(f.splitTitle);g=q.shift()}var Q,h=false;var V=function(AE){if(!f.onActivate(U)){return false}s=true;I.removeClass().css({width:X});if(d==U.attr("href")){U.css("cursor",f.cursor)}U.attr("title","");if(f.hoverClass){U.addClass(f.hoverClass)}S=l=U.offset().top;T=U.offset().left;o=AE.pageX;n=AE.pageY;if(U[0].tagName.toLowerCase()!="area"){M=E(document).scrollTop();N=E(window).width()}if(f.positionBy=="fixed"){m=b+T+a;I.css({left:m})}else{m=(b>T&&T>w)||T+b+w+a>N?T-w-a:b+T+a;if(U[0].tagName.toLowerCase()=="area"||f.positionBy=="mouse"||b+w>N){if(o+20+w>N){I.addClass(" cluetip-"+R);m=(o-w-a)>=0?o-w-a-parseInt(I.css("marginLeft"),10)+parseInt(H.css("marginRight"),10):o-(w/2)}else{m=o+a}}var AB=m<0?AE.pageY+e:AE.pageY;I.css({left:(m>0&&f.positionBy!="bottomTop")?m:(o+(w/2)>N)?N/2-w/2:Math.max(o-(w/2),0)})}t=E(window).height();if(L){H.html(L);p(AB)}else{if(q){var AC=q.length;for(var AD=0;AD<AC;AD++){if(AD===0){H.html(q[AD])}else{H.append('<div class="split-body">'+q[AD]+"</div>")}}p(AB)}else{if(!f.local&&d.indexOf("#")!==0){if(O&&f.ajaxCache){H.html(O);p(AB)}else{var AF=f.ajaxSettings;AF.url=d;AF.beforeSend=function(){G.children().empty();if(f.waitImage){E("#cluetip-waitimage").css({top:n+20,left:o+20}).show()}};AF.error=function(){if(s){H.html("<i>sorry, the contents could not be loaded</i>")}};AF.success=function(i){O=f.ajaxProcess(i);if(s){H.html(O)}};AF.complete=function(){C=E("#cluetip-inner img").length;if(C&&!E.browser.opera){E("#cluetip-inner img").load(function(){C--;if(C<1){E("#cluetip-waitimage").hide();if(s){p(AB)}}})}else{E("#cluetip-waitimage").hide();if(s){p(AB)}}};E.ajax(AF)}}else{if(f.local){var AG=E(d+":first");if(typeof E.fn.wrapInner!="undefined"){if(h===false){AG.wrapInner("<div></div>")}h=true;var AA=AG.children().clone(true);H.empty().append(AA)}else{H.html(AG.html())}p(AB)}}}}};var p=function(AB){I.addClass("cluetip-"+R);if(f.truncate&&(+f.truncate<H.text().length)){var AC=H.text().slice(0,f.truncate)+"...";H.html(AC)}function i(){}g?D.show().html(g):(f.showTitle)?D.show().html("&nbsp;"):D.hide();if(f.sticky){var AA=E('<div id="cluetip-close"><a href="#">'+f.closeText+"</a></div>");(f.closePosition=="bottom")?AA.appendTo(H):(f.closePosition=="title")?AA.prependTo(D):AA.prependTo(H);AA.click(function(){c();return false});if(f.mouseOutClose){if(E.fn.hoverIntent&&f.hoverIntent){I.hoverIntent({over:i,timeout:f.hoverIntent.timeout,out:function(){AA.trigger("click")}})}else{I.hover(i,function(){AA.trigger("click")})}}else{I.unbind("mouseout")}}var AD="";G.css({overflow:W=="auto"?"visible":"auto",height:W});Z=W=="auto"?Math.max(I.outerHeight(),I.height()):parseInt(W,10);y=l;u=M+t;if(f.positionBy=="fixed"){y=l-f.dropShadowSteps+e}else{if((m<o&&Math.max(m,0)+w>o)||f.positionBy=="bottomTop"){if(l+Z+e>u&&n-M>Z+e){y=n-Z-e;AD="top"}else{y=n+e;AD="bottom"}}else{if(l+Z+e>u){y=(Z>=t)?M:u-Z-e}else{if(U.css("display")=="block"||U[0].tagName.toLowerCase()=="area"||f.positionBy=="mouse"){y=AB-e}else{y=l-f.dropShadowSteps}}}}if(AD==""){m<T?AD="left":AD="right"}I.css({top:y+"px"}).removeClass().addClass("clue-"+AD+"-"+R).addClass(" cluetip-"+R);if(f.arrows){var AE=(l-y-f.dropShadowSteps);F.css({top:(/(left|right)/.test(AD)&&m>=0&&AE>0)?AE+"px":/(left|right)/.test(AD)?0:""}).show()}else{F.hide()}J.hide();I.hide()[f.fx.open](f.fx.open!="show"&&f.fx.openSpeed);if(f.dropShadow){J.css({height:Z,width:X}).show()}if(E.fn.bgiframe){I.bgiframe()}if(f.delayedClose>0){r=setTimeout(c,f.delayedClose)}f.onShow(I,H)};var x=function(){s=false;E("#cluetip-waitimage").hide();if(!f.sticky||(/click|toggle/).test(f.activation)){c();clearTimeout(r)}if(f.hoverClass){U.removeClass(f.hoverClass)}E(".cluetip-clicked").removeClass("cluetip-clicked")};var c=function(){G.parent().hide().removeClass();f.onHide(I,H);if(g){U.attr(f.titleAttribute,g)}U.css("cursor","");if(f.arrows){F.css({top:""})}};if((/click|toggle/).test(f.activation)){U.click(function(i){if(I.is(":hidden")||!U.is(".cluetip-clicked")){V(i);E(".cluetip-clicked").removeClass("cluetip-clicked");U.addClass("cluetip-clicked")}else{x(i)}this.blur();return false})}else{if(f.activation=="focus"){U.focus(function(i){V(i)});U.blur(function(i){x(i)})}else{U.click(function(){if(U.attr("href")&&U.attr("href")==d&&!f.clickThrough){return false}});var P=function(i){if(f.tracking==true){var AB=m-i.pageX;var AA=y?y-i.pageY:l-i.pageY;U.mousemove(function(AC){I.css({left:AC.pageX+AB,top:AC.pageY+AA})})}};if(E.fn.hoverIntent&&f.hoverIntent){U.mouseover(function(){U.attr("title","")}).hoverIntent({sensitivity:f.hoverIntent.sensitivity,interval:f.hoverIntent.interval,over:function(i){V(i);P(i)},timeout:f.hoverIntent.timeout,out:function(i){x(i);U.unbind("mousemove")}})}else{U.hover(function(i){V(i);P(i)},function(i){x(i);U.unbind("mousemove")})}}}})};E.fn.cluetip.defaults={width:275,height:"auto",cluezIndex:97,positionBy:"auto",topOffset:15,leftOffset:15,local:false,localPrefix:null,hideLocal:true,attribute:"rel",titleAttribute:"title",splitTitle:"",showTitle:true,cluetipClass:"default",hoverClass:"",waitImage:true,cursor:"help",arrows:false,dropShadow:true,dropShadowColor:"#000",dropShadowSteps:6,sticky:false,mouseOutClose:false,activation:"hover",clickThrough:false,tracking:false,delayedClose:0,closePosition:"top",closeText:"Close",truncate:0,fx:{open:"show",openSpeed:""},hoverIntent:{sensitivity:3,interval:50,timeout:0},onActivate:function(K){return true},onShow:function(K,L){},onHide:function(K,L){},ajaxCache:true,ajaxProcess:function(K){K=K.replace(/<s(cript|tyle)(.|\s)*?\/s(cript|tyle)>/g,"").replace(/<(link|title)(.|\s)*?\/(link|title)>/g,"");return K},ajaxSettings:{dataType:"html"},debug:false};var B="appendTo",A="body";E.cluetip={};E.cluetip.setup=function(K){if(K&&K.insertionType&&(K.insertionType).match(/appendTo|prependTo|insertBefore|insertAfter/)){B=K.insertionType}if(K&&K.insertionElement){A=K.insertionElement}}})(jQuery);

/*
 * jQuery Tooltip plugin 1.3
 *
 * http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/
 * http://docs.jquery.com/Plugins/Tooltip
 *
 * Copyright (c) 2006 - 2008 Jörn Zaefferer
 *
 * $Id: jquery.tooltip.js 5741 2008-06-21 15:22:16Z joern.zaefferer $
 * 
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */;(function($){var helper={},current,title,tID,IE=$.browser.msie&&/MSIE\s(5\.5|6\.)/.test(navigator.userAgent),track=false;$.tooltip={blocked:false,defaults:{delay:200,fade:false,showURL:true,extraClass:"",top:15,left:15,id:"tooltip"},block:function(){$.tooltip.blocked=!$.tooltip.blocked;}};$.fn.extend({tooltip:function(settings){settings=$.extend({},$.tooltip.defaults,settings);createHelper(settings);return this.each(function(){$.data(this,"tooltip",settings);this.tOpacity=helper.parent.css("opacity");this.tooltipText=this.title;$(this).removeAttr("title");this.alt="";}).mouseover(save).mouseout(hide).click(hide);},fixPNG:IE?function(){return this.each(function(){var image=$(this).css('backgroundImage');if(image.match(/^url\(["']?(.*\.png)["']?\)$/i)){image=RegExp.$1;$(this).css({'backgroundImage':'none','filter':"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='"+image+"')"}).each(function(){var position=$(this).css('position');if(position!='absolute'&&position!='relative')$(this).css('position','relative');});}});}:function(){return this;},unfixPNG:IE?function(){return this.each(function(){$(this).css({'filter':'',backgroundImage:''});});}:function(){return this;},hideWhenEmpty:function(){return this.each(function(){$(this)[$(this).html()?"show":"hide"]();});},url:function(){return this.attr('href')||this.attr('src');}});function createHelper(settings){if(helper.parent)return;helper.parent=$('<div id="'+settings.id+'"><h3></h3><div class="body"></div><div class="url"></div></div>').appendTo(document.body).hide();if($.fn.bgiframe)helper.parent.bgiframe();helper.title=$('h3',helper.parent);helper.body=$('div.body',helper.parent);helper.url=$('div.url',helper.parent);}function settings(element){return $.data(element,"tooltip");}function handle(event){if(settings(this).delay)tID=setTimeout(show,settings(this).delay);else
show();track=!!settings(this).track;$(document.body).bind('mousemove',update);update(event);}function save(){if($.tooltip.blocked||this==current||(!this.tooltipText&&!settings(this).bodyHandler))return;current=this;title=this.tooltipText;if(settings(this).bodyHandler){helper.title.hide();var bodyContent=settings(this).bodyHandler.call(this);if(bodyContent.nodeType||bodyContent.jquery){helper.body.empty().append(bodyContent)}else{helper.body.html(bodyContent);}helper.body.show();}else if(settings(this).showBody){var parts=title.split(settings(this).showBody);helper.title.html(parts.shift()).show();helper.body.empty();for(var i=0,part;(part=parts[i]);i++){if(i>0)helper.body.append("<br/>");helper.body.append(part);}helper.body.hideWhenEmpty();}else{helper.title.html(title).show();helper.body.hide();}if(settings(this).showURL&&$(this).url())helper.url.html($(this).url().replace('http://','')).show();else
helper.url.hide();helper.parent.addClass(settings(this).extraClass);if(settings(this).fixPNG)helper.parent.fixPNG();handle.apply(this,arguments);}function show(){tID=null;if((!IE||!$.fn.bgiframe)&&settings(current).fade){if(helper.parent.is(":animated"))helper.parent.stop().show().fadeTo(settings(current).fade,current.tOpacity);else
helper.parent.is(':visible')?helper.parent.fadeTo(settings(current).fade,current.tOpacity):helper.parent.fadeIn(settings(current).fade);}else{helper.parent.show();}update();}function update(event){if($.tooltip.blocked)return;if(event&&event.target.tagName=="OPTION"){return;}if(!track&&helper.parent.is(":visible")){$(document.body).unbind('mousemove',update)}if(current==null){$(document.body).unbind('mousemove',update);return;}helper.parent.removeClass("viewport-right").removeClass("viewport-bottom");var left=helper.parent[0].offsetLeft;var top=helper.parent[0].offsetTop;if(event){left=event.pageX+settings(current).left;top=event.pageY+settings(current).top;var right='auto';if(settings(current).positionLeft){right=$(window).width()-left;left='auto';}helper.parent.css({left:left,right:right,top:top});}var v=viewport(),h=helper.parent[0];if(v.x+v.cx<h.offsetLeft+h.offsetWidth){left-=h.offsetWidth+20+settings(current).left;helper.parent.css({left:left+'px'}).addClass("viewport-right");}if(v.y+v.cy<h.offsetTop+h.offsetHeight){top-=h.offsetHeight+20+settings(current).top;helper.parent.css({top:top+'px'}).addClass("viewport-bottom");}}function viewport(){return{x:$(window).scrollLeft(),y:$(window).scrollTop(),cx:$(window).width(),cy:$(window).height()};}function hide(event){if($.tooltip.blocked)return;if(tID)clearTimeout(tID);current=null;var tsettings=settings(this);function complete(){helper.parent.removeClass(tsettings.extraClass).hide().css("opacity","");}if((!IE||!$.fn.bgiframe)&&tsettings.fade){if(helper.parent.is(':animated'))helper.parent.stop().fadeTo(tsettings.fade,0,complete);else
helper.parent.stop().fadeOut(tsettings.fade,complete);}else
complete();if(settings(this).fixPNG)helper.parent.unfixPNG();}})(jQuery);

//v2.0.30511.0
if(!window.Silverlight)window.Silverlight={};Silverlight._silverlightCount=0;Silverlight.__onSilverlightInstalledCalled=false;Silverlight.fwlinkRoot="http://go2.microsoft.com/fwlink/?LinkID=";Silverlight.__installationEventFired=false;Silverlight.onGetSilverlight=null;Silverlight.onSilverlightInstalled=function(){window.location.reload(false)};Silverlight.isInstalled=function(b){if(b==undefined)b=null;var a=false,m=null;try{var i=null,j=false;if(window.ActiveXObject)try{i=new ActiveXObject("AgControl.AgControl");if(b===null)a=true;else if(i.IsVersionSupported(b))a=true;i=null}catch(l){j=true}else j=true;if(j){var k=navigator.plugins["Silverlight Plug-In"];if(k)if(b===null)a=true;else{var h=k.description;if(h==="1.0.30226.2")h="2.0.30226.2";var c=h.split(".");while(c.length>3)c.pop();while(c.length<4)c.push(0);var e=b.split(".");while(e.length>4)e.pop();var d,g,f=0;do{d=parseInt(e[f]);g=parseInt(c[f]);f++}while(f<e.length&&d===g);if(d<=g&&!isNaN(d))a=true}}}catch(l){a=false}return a};Silverlight.WaitForInstallCompletion=function(){if(!Silverlight.isBrowserRestartRequired&&Silverlight.onSilverlightInstalled){try{navigator.plugins.refresh()}catch(a){}if(Silverlight.isInstalled(null)&&!Silverlight.__onSilverlightInstalledCalled){Silverlight.onSilverlightInstalled();Silverlight.__onSilverlightInstalledCalled=true}else setTimeout(Silverlight.WaitForInstallCompletion,3e3)}};Silverlight.__startup=function(){navigator.plugins.refresh();Silverlight.isBrowserRestartRequired=Silverlight.isInstalled(null);if(!Silverlight.isBrowserRestartRequired){Silverlight.WaitForInstallCompletion();if(!Silverlight.__installationEventFired){Silverlight.onInstallRequired();Silverlight.__installationEventFired=true}}else if(window.navigator.mimeTypes){var b=navigator.mimeTypes["application/x-silverlight-2"],c=navigator.mimeTypes["application/x-silverlight-2-b2"],d=navigator.mimeTypes["application/x-silverlight-2-b1"],a=d;if(c)a=c;if(!b&&(d||c)){if(!Silverlight.__installationEventFired){Silverlight.onUpgradeRequired();Silverlight.__installationEventFired=true}}else if(b&&a)if(b.enabledPlugin&&a.enabledPlugin)if(b.enabledPlugin.description!=a.enabledPlugin.description)if(!Silverlight.__installationEventFired){Silverlight.onRestartRequired();Silverlight.__installationEventFired=true}}if(!Silverlight.disableAutoStartup)if(window.removeEventListener)window.removeEventListener("load",Silverlight.__startup,false);else window.detachEvent("onload",Silverlight.__startup)};if(!Silverlight.disableAutoStartup)if(window.addEventListener)window.addEventListener("load",Silverlight.__startup,false);else window.attachEvent("onload",Silverlight.__startup);Silverlight.createObject=function(m,f,e,k,l,h,j){var d={},a=k,c=l;d.version=a.version;a.source=m;d.alt=a.alt;if(h)a.initParams=h;if(a.isWindowless&&!a.windowless)a.windowless=a.isWindowless;if(a.framerate&&!a.maxFramerate)a.maxFramerate=a.framerate;if(e&&!a.id)a.id=e;delete a.ignoreBrowserVer;delete a.inplaceInstallPrompt;delete a.version;delete a.isWindowless;delete a.framerate;delete a.data;delete a.src;delete a.alt;if(Silverlight.isInstalled(d.version)){for(var b in c)if(c[b]){if(b=="onLoad"&&typeof c[b]=="function"&&c[b].length!=1){var i=c[b];c[b]=function(a){return i(document.getElementById(e),j,a)}}var g=Silverlight.__getHandlerName(c[b]);if(g!=null){a[b]=g;c[b]=null}else throw"typeof events."+b+" must be 'function' or 'string'";}slPluginHTML=Silverlight.buildHTML(a)}else slPluginHTML=Silverlight.buildPromptHTML(d);if(f)f.innerHTML=slPluginHTML;else return slPluginHTML};Silverlight.buildHTML=function(a){var b=[];b.push('<object type="application/x-silverlight" data="data:application/x-silverlight,"');if(a.id!=null)b.push(' id="'+Silverlight.HtmlAttributeEncode(a.id)+'"');if(a.width!=null)b.push(' width="'+a.width+'"');if(a.height!=null)b.push(' height="'+a.height+'"');b.push(" >");delete a.id;delete a.width;delete a.height;for(var c in a)if(a[c])b.push('<param name="'+Silverlight.HtmlAttributeEncode(c)+'" value="'+Silverlight.HtmlAttributeEncode(a[c])+'" />');b.push("</object>");return b.join("")};Silverlight.createObjectEx=function(b){var a=b,c=Silverlight.createObject(a.source,a.parentElement,a.id,a.properties,a.events,a.initParams,a.context);if(a.parentElement==null)return c};Silverlight.buildPromptHTML=function(b){var a="",d=Silverlight.fwlinkRoot,c=b.version;if(b.alt)a=b.alt;else{if(!c)c="";a="<a href='javascript:Silverlight.getSilverlight(\"{1}\");' style='text-decoration: none;'><img src='{2}' alt='Get Microsoft Silverlight' style='border-style: none'/></a>";a=a.replace("{1}",c);a=a.replace("{2}",d+"108181")}return a};Silverlight.getSilverlight=function(e){if(Silverlight.onGetSilverlight)Silverlight.onGetSilverlight();var b="",a=String(e).split(".");if(a.length>1){var c=parseInt(a[0]);if(isNaN(c)||c<2)b="1.0";else b=a[0]+"."+a[1]}var d="";if(b.match(/^\d+\056\d+$/))d="&v="+b;Silverlight.followFWLink("149156"+d)};Silverlight.followFWLink=function(a){top.location=Silverlight.fwlinkRoot+String(a)};Silverlight.HtmlAttributeEncode=function(c){var a,b="";if(c==null)return null;for(var d=0;d<c.length;d++){a=c.charCodeAt(d);if(a>96&&a<123||a>64&&a<91||a>43&&a<58&&a!=47||a==95)b=b+String.fromCharCode(a);else b=b+"&#"+a+";"}return b};Silverlight.default_error_handler=function(e,b){var d,c=b.ErrorType;d=b.ErrorCode;var a="\nSilverlight error message     \n";a+="ErrorCode: "+d+"\n";a+="ErrorType: "+c+"       \n";a+="Message: "+b.ErrorMessage+"     \n";if(c=="ParserError"){a+="XamlFile: "+b.xamlFile+"     \n";a+="Line: "+b.lineNumber+"     \n";a+="Position: "+b.charPosition+"     \n"}else if(c=="RuntimeError"){if(b.lineNumber!=0){a+="Line: "+b.lineNumber+"     \n";a+="Position: "+b.charPosition+"     \n"}a+="MethodName: "+b.methodName+"     \n"}alert(a)};Silverlight.__cleanup=function(){for(var a=Silverlight._silverlightCount-1;a>=0;a--)window["__slEvent"+a]=null;Silverlight._silverlightCount=0;if(window.removeEventListener)window.removeEventListener("unload",Silverlight.__cleanup,false);else window.detachEvent("onunload",Silverlight.__cleanup)};Silverlight.__getHandlerName=function(b){var a="";if(typeof b=="string")a=b;else if(typeof b=="function"){if(Silverlight._silverlightCount==0)if(window.addEventListener)window.addEventListener("onunload",Silverlight.__cleanup,false);else window.attachEvent("onunload",Silverlight.__cleanup);var c=Silverlight._silverlightCount++;a="__slEvent"+c;window[a]=b}else a=null;return a};Silverlight.onRequiredVersionAvailable=function(){};Silverlight.onRestartRequired=function(){};Silverlight.onUpgradeRequired=function(){};Silverlight.onInstallRequired=function(){};Silverlight.IsVersionAvailableOnError=function(d,a){var b=false;try{if(a.ErrorCode==8001&&!Silverlight.__installationEventFired){Silverlight.onUpgradeRequired();Silverlight.__installationEventFired=true}else if(a.ErrorCode==8002&&!Silverlight.__installationEventFired){Silverlight.onRestartRequired();Silverlight.__installationEventFired=true}else if(a.ErrorCode==5014||a.ErrorCode==2106){if(Silverlight.__verifySilverlight2UpgradeSuccess(a.getHost()))b=true}else b=true}catch(c){}return b};Silverlight.IsVersionAvailableOnLoad=function(b){var a=false;try{if(Silverlight.__verifySilverlight2UpgradeSuccess(b.getHost()))a=true}catch(c){}return a};Silverlight.__verifySilverlight2UpgradeSuccess=function(d){var c=false,b="2.0.31005",a=null;try{if(d.IsVersionSupported(b+".99")){a=Silverlight.onRequiredVersionAvailable;c=true}else if(d.IsVersionSupported(b+".0"))a=Silverlight.onRestartRequired;else a=Silverlight.onUpgradeRequired;if(a&&!Silverlight.__installationEventFired){a();Silverlight.__installationEventFired=true}}catch(e){}return c}

/**
 * Seadragon Ajax 0.8.4 (build 18035 on 2009-10-22)
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * For more information, visit: http://livelabs.com/seadragon-ajax/
 */
if(!window.Seadragon){window.Seadragon={};}
Seadragon.Config={debugMode:false,animationTime:1.5,blendTime:0.5,alwaysBlend:false,autoHideControls:true,immediateRender:false,wrapHorizontal:false,wrapVertical:false,wrapOverlays:false,minZoomDimension:null,minZoomImageRatio:0.8,maxZoomPixelRatio:2,visibilityRatio:0.5,springStiffness:5.0,imageLoaderLimit:2,clickTimeThreshold:200,clickDistThreshold:5,zoomPerClick:2.0,zoomPerScroll:1.2,zoomPerSecond:2.0,proxyUrl:null,imagePath:"img/"};(function(){if(Seadragon.Strings){return;}
Seadragon.Strings={Errors:{Failure:"Sorry, but Seadragon Ajax can't run on your browser!\n"+"Please try using IE 7 or Firefox 3.\n",Dzc:"Sorry, we don't support Deep Zoom Collections!",Dzi:"Hmm, this doesn't appear to be a valid Deep Zoom Image.",Xml:"Hmm, this doesn't appear to be a valid Deep Zoom Image.",Empty:"You asked us to open nothing, so we did just that.",ImageFormat:"Sorry, we don't support {0}-based Deep Zoom Images.",Security:"It looks like a security restriction stopped us from "+"loading this Deep Zoom Image.",Status:"This space unintentionally left blank ({0} {1}).",Unknown:"Whoops, something inexplicably went wrong. Sorry!"},Messages:{Loading:"Loading..."},Tooltips:{FullPage:"Toggle full page",Home:"Go home",ZoomIn:"Zoom in (you can also use your mouse's scroll wheel)",ZoomOut:"Zoom out (you can also use your mouse's scroll wheel)"}};Seadragon.Strings.getString=function(prop){var props=prop.split('.');var string=Seadragon.Strings;for(var i=0;i<props.length;i++){string=string[props[i]]||{};}
if(typeof(string)!="string"){string="";}
var args=arguments;return string.replace(/\{\d+\}/g,function(capture){var i=parseInt(capture.match(/\d+/))+1;return i<args.length?args[i]:"";});};Seadragon.Strings.setString=function(prop,value){var props=prop.split('.');var container=Seadragon.Strings;for(var i=0;i<props.length-1;i++){if(!container[props[i]]){container[props[i]]={};}
container=container[props[i]];}
container[props[i]]=value;};})();Seadragon.Debug=function(){this.log=function(msg,important){var console=window.console||{};var debug=Seadragon.Config.debugMode;if(debug&&console.log){console.log(msg);}else if(debug&&important){alert(msg);}};this.error=function(msg,e){var console=window.console||{};var debug=Seadragon.Config.debugMode;if(debug&&console.error){console.error(msg);}else if(debug){alert(msg);}
if(debug){throw e||new Error(msg);}};this.fail=function(msg){alert(Seadragon.Strings.getString("Errors.Failure"));throw new Error(msg);};};Seadragon.Debug=new Seadragon.Debug();Seadragon.Profiler=function(){var self=this;var midUpdate=false;var numUpdates=0;var lastBeginTime=null;var lastEndTime=null;var minUpdateTime=Infinity;var avgUpdateTime=0;var maxUpdateTime=0;var minIdleTime=Infinity;var avgIdleTime=0;var maxIdleTime=0;this.getAvgUpdateTime=function(){return avgUpdateTime;};this.getMinUpdateTime=function(){return minUpdateTime;};this.getMaxUpdateTime=function(){return maxUpdateTime;};this.getAvgIdleTime=function(){return avgIdleTime;};this.getMinIdleTime=function(){return minIdleTime;};this.getMaxIdleTime=function(){return maxIdleTime;};this.isMidUpdate=function(){return midUpdate;};this.getNumUpdates=function(){return numUpdates;};this.beginUpdate=function(){if(midUpdate){self.endUpdate();}
midUpdate=true;lastBeginTime=new Date().getTime();if(numUpdates<1){return;}
var time=lastBeginTime-lastEndTime;avgIdleTime=(avgIdleTime*(numUpdates-1)+time)/numUpdates;if(time<minIdleTime){minIdleTime=time;}
if(time>maxIdleTime){maxIdleTime=time;}};this.endUpdate=function(){if(!midUpdate){return;}
lastEndTime=new Date().getTime();midUpdate=false;var time=lastEndTime-lastBeginTime;numUpdates++;avgUpdateTime=(avgUpdateTime*(numUpdates-1)+time)/numUpdates;if(time<minUpdateTime){minUpdateTime=time;}
if(time>maxUpdateTime){maxUpdateTime=time;}};this.clearProfile=function(){midUpdate=false;numUpdates=0;lastBeginTime=null;lastEndTime=null;minUpdateTime=Infinity;avgUpdateTime=0;maxUpdateTime=0;minIdleTime=Infinity;avgIdleTime=0;maxIdleTime=0;};};Seadragon.Point=function(x,y){var self=this;this.x=typeof(x)=="number"?x:0;this.y=typeof(y)=="number"?y:0;this.plus=function(point){return new Seadragon.Point(self.x+point.x,self.y+point.y);};this.minus=function(point){return new Seadragon.Point(self.x-point.x,self.y-point.y);};this.times=function(factor){return new Seadragon.Point(self.x*factor,self.y*factor);};this.divide=function(factor){return new Seadragon.Point(self.x/factor,self.y/factor);};this.negate=function(){return new Seadragon.Point(-self.x,-self.y);};this.distanceTo=function(point){return Math.sqrt(Math.pow(self.x-point.x,2)+
Math.pow(self.y-point.y,2));};this.apply=function(func){return new Seadragon.Point(func(self.x),func(self.y));};this.equals=function(point){return(point instanceof Seadragon.Point)&&(self.x===point.x)&&(self.y===point.y);};this.toString=function(){return"("+self.x+","+self.y+")";};};Seadragon.Rect=function(x,y,width,height){var self=this;this.x=typeof(x)=="number"?x:0;this.y=typeof(y)=="number"?y:0;this.width=typeof(width)=="number"?width:0;this.height=typeof(height)=="number"?height:0;this.getAspectRatio=function(){return self.width/self.height;};this.getTopLeft=function(){return new Seadragon.Point(self.x,self.y);};this.getBottomRight=function(){return new Seadragon.Point(self.x+self.width,self.y+self.height);};this.getCenter=function(){return new Seadragon.Point(self.x+self.width/2.0,self.y+self.height/2.0);};this.getSize=function(){return new Seadragon.Point(self.width,self.height);};this.equals=function(other){return(other instanceof Seadragon.Rect)&&(self.x===other.x)&&(self.y===other.y)&&(self.width===other.width)&&(self.height===other.height);};this.toString=function(){return"["+self.x+","+self.y+","+self.width+"x"+
self.height+"]";};};Seadragon.Spring=function(initialValue){var currentValue=typeof(initialValue)=="number"?initialValue:0;var startValue=currentValue;var targetValue=currentValue;var currentTime=new Date().getTime();var startTime=currentTime;var targetTime=currentTime;function transform(x){var s=Seadragon.Config.springStiffness;return(1.0-Math.exp(-x*s))/(1.0-Math.exp(-s));}
this.getCurrent=function(){return currentValue;};this.getTarget=function(){return targetValue;};this.resetTo=function(target){targetValue=target;targetTime=currentTime;startValue=targetValue;startTime=targetTime;};this.springTo=function(target){startValue=currentValue;startTime=currentTime;targetValue=target;targetTime=startTime+1000*Seadragon.Config.animationTime;};this.shiftBy=function(delta){startValue+=delta;targetValue+=delta;};this.update=function(){currentTime=new Date().getTime();currentValue=(currentTime>=targetTime)?targetValue:startValue+(targetValue-startValue)*transform((currentTime-startTime)/(targetTime-startTime));};};Seadragon.Utils=function(){var Browser={UNKNOWN:0,IE:1,FIREFOX:2,SAFARI:3,CHROME:4,OPERA:5};Seadragon.Browser=Browser;var self=this;var arrActiveX=["Msxml2.XMLHTTP","Msxml3.XMLHTTP","Microsoft.XMLHTTP"];var fileFormats={"bmp":false,"jpeg":true,"jpg":true,"png":true,"tif":false,"wdp":false};var browser=Browser.UNKNOWN;var browserVersion=0;var badAlphaBrowser=false;var urlParams={};(function(){var app=navigator.appName;var ver=navigator.appVersion;var ua=navigator.userAgent;if(app=="Microsoft Internet Explorer"&&!!window.attachEvent&&!!window.ActiveXObject){var ieOffset=ua.indexOf("MSIE");browser=Browser.IE;browserVersion=parseFloat(ua.substring(ieOffset+5,ua.indexOf(";",ieOffset)));}else if(app=="Netscape"&&!!window.addEventListener){var ffOffset=ua.indexOf("Firefox");var saOffset=ua.indexOf("Safari");var chOffset=ua.indexOf("Chrome");if(ffOffset>=0){browser=Browser.FIREFOX;browserVersion=parseFloat(ua.substring(ffOffset+8));}else if(saOffset>=0){var slash=ua.substring(0,saOffset).lastIndexOf("/");browser=(chOffset>=0)?Browser.CHROME:Browser.SAFARI;browserVersion=parseFloat(ua.substring(slash+1,saOffset));}}else if(app=="Opera"&&!!window.opera&&!!window.attachEvent){browser=Browser.OPERA;browserVersion=parseFloat(ver);}
var query=window.location.search.substring(1);var parts=query.split('&');for(var i=0;i<parts.length;i++){var part=parts[i];var sep=part.indexOf('=');if(sep>0){urlParams[part.substring(0,sep)]=decodeURIComponent(part.substring(sep+1));}}
badAlphaBrowser=(browser==Browser.IE||(browser==Browser.CHROME&&browserVersion<2));})();function getOffsetParent(elmt,isFixed){if(isFixed&&elmt!=document.body){return document.body;}else{return elmt.offsetParent;}}
this.getBrowser=function(){return browser;};this.getBrowserVersion=function(){return browserVersion;};this.getElement=function(elmt){if(typeof(elmt)=="string"){elmt=document.getElementById(elmt);}
return elmt;};this.getElementPosition=function(elmt){var elmt=self.getElement(elmt);var result=new Seadragon.Point();var isFixed=self.getElementStyle(elmt).position=="fixed";var offsetParent=getOffsetParent(elmt,isFixed);while(offsetParent){result.x+=elmt.offsetLeft;result.y+=elmt.offsetTop;if(isFixed){result=result.plus(self.getPageScroll());}
elmt=offsetParent;isFixed=self.getElementStyle(elmt).position=="fixed";offsetParent=getOffsetParent(elmt,isFixed);}
return result;};this.getElementSize=function(elmt){var elmt=self.getElement(elmt);return new Seadragon.Point(elmt.clientWidth,elmt.clientHeight);};this.getElementStyle=function(elmt){var elmt=self.getElement(elmt);if(elmt.currentStyle){return elmt.currentStyle;}else if(window.getComputedStyle){return window.getComputedStyle(elmt,"");}else{Seadragon.Debug.fail("Unknown element style, no known technique.");}};this.getEvent=function(event){return event?event:window.event;};this.getMousePosition=function(event){var event=self.getEvent(event);var result=new Seadragon.Point();if(event.type=="DOMMouseScroll"&&browser==Browser.FIREFOX&&browserVersion<3){result.x=event.screenX;result.y=event.screenY;}else if(typeof(event.pageX)=="number"){result.x=event.pageX;result.y=event.pageY;}else if(typeof(event.clientX)=="number"){result.x=event.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;result.y=event.clientY+document.body.scrollTop+document.documentElement.scrollTop;}else{Seadragon.Debug.fail("Unknown event mouse position, no known technique.");}
return result;};this.getMouseScroll=function(event){var event=self.getEvent(event);var delta=0;if(typeof(event.wheelDelta)=="number"){delta=event.wheelDelta;}else if(typeof(event.detail)=="number"){delta=event.detail*-1;}else{Seadragon.Debug.fail("Unknown event mouse scroll, no known technique.");}
return delta?delta/Math.abs(delta):0;};this.getPageScroll=function(){var result=new Seadragon.Point();var docElmt=document.documentElement||{};var body=document.body||{};if(typeof(window.pageXOffset)=="number"){result.x=window.pageXOffset;result.y=window.pageYOffset;}else if(body.scrollLeft||body.scrollTop){result.x=body.scrollLeft;result.y=body.scrollTop;}else if(docElmt.scrollLeft||docElmt.scrollTop){result.x=docElmt.scrollLeft;result.y=docElmt.scrollTop;}
return result;};this.getWindowSize=function(){var result=new Seadragon.Point();var docElmt=document.documentElement||{};var body=document.body||{};if(typeof(window.innerWidth)=='number'){result.x=window.innerWidth;result.y=window.innerHeight;}else if(docElmt.clientWidth||docElmt.clientHeight){result.x=docElmt.clientWidth;result.y=docElmt.clientHeight;}else if(body.clientWidth||body.clientHeight){result.x=body.clientWidth;result.y=body.clientHeight;}else{Seadragon.Debug.fail("Unknown window size, no known technique.");}
return result;};this.imageFormatSupported=function(ext){var ext=ext?ext:"";return!!fileFormats[ext.toLowerCase()];};this.makeCenteredNode=function(elmt){var elmt=Seadragon.Utils.getElement(elmt);var div=self.makeNeutralElement("div");var html=[];html.push('<div style="display:table; height:100%; width:100%;');html.push('border:none; margin:0px; padding:0px;');html.push('#position:relative; overflow:hidden; text-align:left;">');html.push('<div style="#position:absolute; #top:50%; width:100%; ');html.push('border:none; margin:0px; padding:0px;');html.push('display:table-cell; vertical-align:middle;">');html.push('<div style="#position:relative; #top:-50%; width:100%; ');html.push('border:none; margin:0px; padding:0px;');html.push('text-align:center;"></div></div></div>');div.innerHTML=html.join('');div=div.firstChild;var innerDiv=div;var innerDivs=div.getElementsByTagName("div");while(innerDivs.length>0){innerDiv=innerDivs[0];innerDivs=innerDiv.getElementsByTagName("div");}
innerDiv.appendChild(elmt);return div;};this.makeNeutralElement=function(tagName){var elmt=document.createElement(tagName);var style=elmt.style;style.background="transparent none";style.border="none";style.margin="0px";style.padding="0px";style.position="static";return elmt;};this.makeTransparentImage=function(src){var img=self.makeNeutralElement("img");var elmt=null;if(browser==Browser.IE&&browserVersion<7){elmt=self.makeNeutralElement("span");elmt.style.display="inline-block";img.onload=function(){elmt.style.width=elmt.style.width||img.width+"px";elmt.style.height=elmt.style.height||img.height+"px";img.onload=null;img=null;};img.src=src;elmt.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+
src+"', sizingMethod='scale')";}else{elmt=img;elmt.src=src;}
return elmt;};this.setElementOpacity=function(elmt,opacity,usesAlpha){var elmt=self.getElement(elmt);if(usesAlpha&&badAlphaBrowser){opacity=Math.round(opacity);}
if(opacity<1){elmt.style.opacity=opacity;}else{elmt.style.opacity="";}
if(opacity==1){var prevFilter=elmt.style.filter||"";elmt.style.filter=prevFilter.replace(/alpha\(.*?\)/g,"");return;}
var ieOpacity=Math.round(100*opacity);var ieFilter=" alpha(opacity="+ieOpacity+") ";try{if(elmt.filters&&elmt.filters.alpha){elmt.filters.alpha.opacity=ieOpacity;}else{elmt.style.filter+=ieFilter;}}catch(e){elmt.style.filter+=ieFilter;}};this.addEvent=function(elmt,eventName,handler,useCapture){var elmt=self.getElement(elmt);if(elmt.addEventListener){if(eventName=="mousewheel"){elmt.addEventListener("DOMMouseScroll",handler,useCapture);}
elmt.addEventListener(eventName,handler,useCapture);}else if(elmt.attachEvent){elmt.attachEvent("on"+eventName,handler);if(useCapture&&elmt.setCapture){elmt.setCapture();}}else{Seadragon.Debug.fail("Unable to attach event handler, no known technique.");}};this.removeEvent=function(elmt,eventName,handler,useCapture){var elmt=self.getElement(elmt);if(elmt.removeEventListener){if(eventName=="mousewheel"){elmt.removeEventListener("DOMMouseScroll",handler,useCapture);}
elmt.removeEventListener(eventName,handler,useCapture);}else if(elmt.detachEvent){elmt.detachEvent("on"+eventName,handler);if(useCapture&&elmt.releaseCapture){elmt.releaseCapture();}}else{Seadragon.Debug.fail("Unable to detach event handler, no known technique.");}};this.cancelEvent=function(event){var event=self.getEvent(event);if(event.preventDefault){event.preventDefault();}
event.cancel=true;event.returnValue=false;};this.stopEvent=function(event){var event=self.getEvent(event);if(event.stopPropagation){event.stopPropagation();}
event.cancelBubble=true;};this.createCallback=function(object,method){var initialArgs=[];for(var i=2;i<arguments.length;i++){initialArgs.push(arguments[i]);}
return function(){var args=initialArgs.concat([]);for(var i=0;i<arguments.length;i++){args.push(arguments[i]);}
return method.apply(object,args);};};this.getUrlParameter=function(key){var value=urlParams[key];return value?value:null;};this.makeAjaxRequest=function(url,callback){var async=typeof(callback)=="function";var req=null;if(async){var actual=callback;var callback=function(){window.setTimeout(Seadragon.Utils.createCallback(null,actual,req),1);};}
if(window.ActiveXObject){for(var i=0;i<arrActiveX.length;i++){try{req=new ActiveXObject(arrActiveX[i]);break;}catch(e){continue;}}}else if(window.XMLHttpRequest){req=new XMLHttpRequest();}
if(!req){Seadragon.Debug.fail("Browser doesn't support XMLHttpRequest.");}
if(Seadragon.Config.proxyUrl){url=Seadragon.Config.proxyUrl+url;}
if(async){req.onreadystatechange=function(){if(req.readyState==4){req.onreadystatechange=new Function();callback();}};}
try{req.open("GET",url,async);req.send(null);}catch(e){Seadragon.Debug.log(e.name+" while making AJAX request: "+e.message);req.onreadystatechange=null;req=null;if(async){callback();}}
return async?null:req;};this.parseXml=function(string){var xmlDoc=null;if(window.ActiveXObject){try{xmlDoc=new ActiveXObject("Microsoft.XMLDOM");xmlDoc.async=false;xmlDoc.loadXML(string);}catch(e){Seadragon.Debug.log(e.name+" while parsing XML (ActiveX): "+e.message);}}else if(window.DOMParser){try{var parser=new DOMParser();xmlDoc=parser.parseFromString(string,"text/xml");}catch(e){Seadragon.Debug.log(e.name+" while parsing XML (DOMParser): "+e.message);}}else{Seadragon.Debug.fail("Browser doesn't support XML DOM.");}
return xmlDoc;};};Seadragon.Utils=new Seadragon.Utils();(function(){if(Seadragon.MouseTracker){return;}
var isIE=Seadragon.Utils.getBrowser()==Seadragon.Browser.IE;var buttonDownAny=false;var ieCapturingAny=false;var ieTrackersActive={};var ieTrackersCapturing=[];function getMouseAbsolute(event){return Seadragon.Utils.getMousePosition(event);}
function getMouseRelative(event,elmt){var mouse=Seadragon.Utils.getMousePosition(event);var offset=Seadragon.Utils.getElementPosition(elmt);return mouse.minus(offset);}
function isChild(elmtA,elmtB){var body=document.body;while(elmtB&&elmtA!=elmtB&&body!=elmtB){try{elmtB=elmtB.parentNode;}catch(e){return false;}}
return elmtA==elmtB;}
function onGlobalMouseDown(){buttonDownAny=true;}
function onGlobalMouseUp(){buttonDownAny=false;}
(function(){if(isIE){Seadragon.Utils.addEvent(document,"mousedown",onGlobalMouseDown,false);Seadragon.Utils.addEvent(document,"mouseup",onGlobalMouseUp,false);}else{Seadragon.Utils.addEvent(window,"mousedown",onGlobalMouseDown,true);Seadragon.Utils.addEvent(window,"mouseup",onGlobalMouseUp,true);}})();Seadragon.MouseTracker=function(elmt){var self=this;var ieSelf=null;var hash=Math.random();var elmt=Seadragon.Utils.getElement(elmt);var tracking=false;var capturing=false;var buttonDownElmt=false;var insideElmt=false;var lastPoint=null;var lastMouseDownTime=null;var lastMouseDownPoint=null;this.target=elmt;this.enterHandler=null;this.exitHandler=null;this.pressHandler=null;this.releaseHandler=null;this.clickHandler=null;this.dragHandler=null;this.scrollHandler=null;function startTracking(){if(!tracking){Seadragon.Utils.addEvent(elmt,"mouseover",onMouseOver,false);Seadragon.Utils.addEvent(elmt,"mouseout",onMouseOut,false);Seadragon.Utils.addEvent(elmt,"mousedown",onMouseDown,false);Seadragon.Utils.addEvent(elmt,"mouseup",onMouseUp,false);Seadragon.Utils.addEvent(elmt,"mousewheel",onMouseScroll,false);Seadragon.Utils.addEvent(elmt,"click",onMouseClick,false);tracking=true;ieTrackersActive[hash]=ieSelf;}}
function stopTracking(){if(tracking){Seadragon.Utils.removeEvent(elmt,"mouseover",onMouseOver,false);Seadragon.Utils.removeEvent(elmt,"mouseout",onMouseOut,false);Seadragon.Utils.removeEvent(elmt,"mousedown",onMouseDown,false);Seadragon.Utils.removeEvent(elmt,"mouseup",onMouseUp,false);Seadragon.Utils.removeEvent(elmt,"mousewheel",onMouseScroll,false);Seadragon.Utils.removeEvent(elmt,"click",onMouseClick,false);releaseMouse();tracking=false;delete ieTrackersActive[hash];}}
function captureMouse(){if(!capturing){if(isIE){Seadragon.Utils.removeEvent(elmt,"mouseup",onMouseUp,false);Seadragon.Utils.addEvent(elmt,"mouseup",onMouseUpIE,true);Seadragon.Utils.addEvent(elmt,"mousemove",onMouseMoveIE,true);}else{Seadragon.Utils.addEvent(window,"mouseup",onMouseUpWindow,true);Seadragon.Utils.addEvent(window,"mousemove",onMouseMove,true);}
capturing=true;}}
function releaseMouse(){if(capturing){if(isIE){Seadragon.Utils.removeEvent(elmt,"mousemove",onMouseMoveIE,true);Seadragon.Utils.removeEvent(elmt,"mouseup",onMouseUpIE,true);Seadragon.Utils.addEvent(elmt,"mouseup",onMouseUp,false);}else{Seadragon.Utils.removeEvent(window,"mousemove",onMouseMove,true);Seadragon.Utils.removeEvent(window,"mouseup",onMouseUpWindow,true);}
capturing=false;}}
function triggerOthers(eventName,event){var trackers=ieTrackersActive;for(var otherHash in trackers){if(trackers.hasOwnProperty(otherHash)&&hash!=otherHash){trackers[otherHash][eventName](event);}}}
function hasMouse(){return insideElmt;}
function onMouseOver(event){var event=Seadragon.Utils.getEvent(event);if(isIE&&capturing&&!isChild(event.srcElement,elmt)){triggerOthers("onMouseOver",event);}
var to=event.target?event.target:event.srcElement;var from=event.relatedTarget?event.relatedTarget:event.fromElement;if(!isChild(elmt,to)||isChild(elmt,from)){return;}
insideElmt=true;if(typeof(self.enterHandler)=="function"){try{self.enterHandler(self,getMouseRelative(event,elmt),buttonDownElmt,buttonDownAny);}catch(e){Seadragon.Debug.error(e.name+" while executing enter handler: "+e.message,e);}}}
function onMouseOut(event){var event=Seadragon.Utils.getEvent(event);if(isIE&&capturing&&!isChild(event.srcElement,elmt)){triggerOthers("onMouseOut",event);}
var from=event.target?event.target:event.srcElement;var to=event.relatedTarget?event.relatedTarget:event.toElement;if(!isChild(elmt,from)||isChild(elmt,to)){return;}
insideElmt=false;if(typeof(self.exitHandler)=="function"){try{self.exitHandler(self,getMouseRelative(event,elmt),buttonDownElmt,buttonDownAny);}catch(e){Seadragon.Debug.error(e.name+" while executing exit handler: "+e.message,e);}}}
function onMouseDown(event){var event=Seadragon.Utils.getEvent(event);if(event.button==2){return;}
buttonDownElmt=true;lastPoint=getMouseAbsolute(event);lastMouseDownPoint=lastPoint;lastMouseDownTime=new Date().getTime();if(typeof(self.pressHandler)=="function"){try{self.pressHandler(self,getMouseRelative(event,elmt));}catch(e){Seadragon.Debug.error(e.name+" while executing press handler: "+e.message,e);}}
if(self.pressHandler||self.dragHandler){Seadragon.Utils.cancelEvent(event);}
if(!isIE||!ieCapturingAny){captureMouse();ieCapturingAny=true;ieTrackersCapturing=[ieSelf];}else if(isIE){ieTrackersCapturing.push(ieSelf);}}
function onMouseUp(event){var event=Seadragon.Utils.getEvent(event);var insideElmtPress=buttonDownElmt;var insideElmtRelease=insideElmt;if(event.button==2){return;}
buttonDownElmt=false;if(typeof(self.releaseHandler)=="function"){try{self.releaseHandler(self,getMouseRelative(event,elmt),insideElmtPress,insideElmtRelease);}catch(e){Seadragon.Debug.error(e.name+" while executing release handler: "+e.message,e);}}
if(insideElmtPress&&insideElmtRelease){handleMouseClick(event);}}
function onMouseUpIE(event){var event=Seadragon.Utils.getEvent(event);if(event.button==2){return;}
for(var i=0;i<ieTrackersCapturing.length;i++){var tracker=ieTrackersCapturing[i];if(!tracker.hasMouse()){tracker.onMouseUp(event);}}
releaseMouse();ieCapturingAny=false;event.srcElement.fireEvent("on"+event.type,document.createEventObject(event));Seadragon.Utils.stopEvent(event);}
function onMouseUpWindow(event){if(!insideElmt){onMouseUp(event);}
releaseMouse();}
function onMouseClick(event){if(self.clickHandler){Seadragon.Utils.cancelEvent(event);}}
function handleMouseClick(event){var event=Seadragon.Utils.getEvent(event);if(event.button==2){return;}
var time=new Date().getTime()-lastMouseDownTime;var point=getMouseAbsolute(event);var distance=lastMouseDownPoint.distanceTo(point);var quick=time<=Seadragon.Config.clickTimeThreshold&&distance<=Seadragon.Config.clickDistThreshold;if(typeof(self.clickHandler)=="function"){try{self.clickHandler(self,getMouseRelative(event,elmt),quick,event.shiftKey);}catch(e){Seadragon.Debug.error(e.name+" while executing click handler: "+e.message,e);}}}
function onMouseMove(event){var event=Seadragon.Utils.getEvent(event);var point=getMouseAbsolute(event);var delta=point.minus(lastPoint);lastPoint=point;if(typeof(self.dragHandler)=="function"){try{self.dragHandler(self,getMouseRelative(event,elmt),delta,event.shiftKey);}catch(e){Seadragon.Debug.error(e.name+" while executing drag handler: "+e.message,e);}
Seadragon.Utils.cancelEvent(event);}}
function onMouseMoveIE(event){for(var i=0;i<ieTrackersCapturing.length;i++){ieTrackersCapturing[i].onMouseMove(event);}
Seadragon.Utils.stopEvent(event);}
function onMouseScroll(event){var event=Seadragon.Utils.getEvent(event);var delta=Seadragon.Utils.getMouseScroll(event);if(typeof(self.scrollHandler)=="function"){if(delta){try{self.scrollHandler(self,getMouseRelative(event,elmt),delta,event.shiftKey);}catch(e){Seadragon.Debug.error(e.name+" while executing scroll handler: "+e.message,e);}}
Seadragon.Utils.cancelEvent(event);}}
(function(){ieSelf={hasMouse:hasMouse,onMouseOver:onMouseOver,onMouseOut:onMouseOut,onMouseUp:onMouseUp,onMouseMove:onMouseMove};})();this.isTracking=function(){return tracking;};this.setTracking=function(track){if(track){startTracking();}else{stopTracking();}};};})();Seadragon.EventManager=function(){var listeners={};this.addListener=function(eventName,handler){if(typeof(handler)!="function"){return;}
if(!listeners[eventName]){listeners[eventName]=[];}
listeners[eventName].push(handler);};this.removeListener=function(eventName,handler){var handlers=listeners[eventName];if(typeof(handler)!="function"){return;}else if(!handlers){return;}
for(var i=0;i<handlers.length;i++){if(handler==handlers[i]){handlers.splice(i,1);return;}}};this.clearListeners=function(eventName){if(listeners[eventName]){delete listeners[eventName];}};this.trigger=function(eventName){var handlers=listeners[eventName];var args=[];if(!handlers){return;}
for(var i=1;i<arguments.length;i++){args.push(arguments[i]);}
for(var i=0;i<handlers.length;i++){try{handlers[i].apply(window,args);}catch(e){Seadragon.Debug.error(e.name+" while executing "+eventName+" handler: "+e.message,e);}}};};(function(){var TIMEOUT=5000;function Job(src,callback){var image=null;var timeout=null;function finish(success){image.onload=null;image.onabort=null;image.onerror=null;if(timeout){window.clearTimeout(timeout);}
window.setTimeout(function(){callback(src,success?image:null);},1);}
this.start=function(){image=new Image();var successFunc=function(){finish(true);};var failureFunc=function(){finish(false);};var timeoutFunc=function(){Seadragon.Debug.log("Image timed out: "+src);finish(false);};image.onload=successFunc;image.onabort=failureFunc;image.onerror=failureFunc;timeout=window.setTimeout(timeoutFunc,TIMEOUT);image.src=src;};}
Seadragon.ImageLoader=function(){var downloading=0;function onComplete(callback,src,image){downloading--;if(typeof(callback)=="function"){try{callback(image);}catch(e){Seadragon.Debug.error(e.name+" while executing "+src+" callback: "+e.message,e);}}}
this.loadImage=function(src,callback){if(downloading>=Seadragon.Config.imageLoaderLimit){return false;}
var func=Seadragon.Utils.createCallback(null,onComplete,callback);var job=new Job(src,func);downloading++;job.start();return true;};};})();(function(){var ButtonState={REST:0,GROUP:1,HOVER:2,DOWN:3};Seadragon.Button=function(tooltip,srcRest,srcGroup,srcHover,srcDown,onPress,onRelease,onClick,onEnter,onExit){var button=Seadragon.Utils.makeNeutralElement("span");var currentState=ButtonState.GROUP;var tracker=new Seadragon.MouseTracker(button);var imgRest=Seadragon.Utils.makeTransparentImage(srcRest);var imgGroup=Seadragon.Utils.makeTransparentImage(srcGroup);var imgHover=Seadragon.Utils.makeTransparentImage(srcHover);var imgDown=Seadragon.Utils.makeTransparentImage(srcDown);var onPress=typeof(onPress)=="function"?onPress:null;var onRelease=typeof(onRelease)=="function"?onRelease:null;var onClick=typeof(onClick)=="function"?onClick:null;var onEnter=typeof(onEnter)=="function"?onEnter:null;var onExit=typeof(onExit)=="function"?onExit:null;var fadeDelay=0;var fadeLength=2000;var fadeBeginTime=null;var shouldFade=false;this.elmt=button;function scheduleFade(){window.setTimeout(updateFade,20);}
function updateFade(){if(shouldFade){var currentTime=new Date().getTime();var deltaTime=currentTime-fadeBeginTime;var opacity=1.0-deltaTime/fadeLength;opacity=Math.min(1.0,opacity);opacity=Math.max(0.0,opacity);Seadragon.Utils.setElementOpacity(imgGroup,opacity,true);if(opacity>0){scheduleFade();}}}
function beginFading(){shouldFade=true;fadeBeginTime=new Date().getTime()+fadeDelay;window.setTimeout(scheduleFade,fadeDelay);}
function stopFading(){shouldFade=false;Seadragon.Utils.setElementOpacity(imgGroup,1.0,true);}
function inTo(newState){if(newState>=ButtonState.GROUP&&currentState==ButtonState.REST){stopFading();currentState=ButtonState.GROUP;}
if(newState>=ButtonState.HOVER&&currentState==ButtonState.GROUP){imgHover.style.visibility="";currentState=ButtonState.HOVER;}
if(newState>=ButtonState.DOWN&&currentState==ButtonState.HOVER){imgDown.style.visibility="";currentState=ButtonState.DOWN;}}
function outTo(newState){if(newState<=ButtonState.HOVER&&currentState==ButtonState.DOWN){imgDown.style.visibility="hidden";currentState=ButtonState.HOVER;}
if(newState<=ButtonState.GROUP&&currentState==ButtonState.HOVER){imgHover.style.visibility="hidden";currentState=ButtonState.GROUP;}
if(newState<=ButtonState.REST&&currentState==ButtonState.GROUP){beginFading();currentState=ButtonState.REST;}}
function enterHandler(tracker,position,buttonDownElmt,buttonDownAny){if(buttonDownElmt){inTo(ButtonState.DOWN);if(onEnter){onEnter();}}else if(!buttonDownAny){inTo(ButtonState.HOVER);}}
function exitHandler(tracker,position,buttonDownElmt,buttonDownAny){outTo(ButtonState.GROUP);if(buttonDownElmt&&onExit){onExit();}}
function pressHandler(tracker,position){inTo(ButtonState.DOWN);if(onPress){onPress();}}
function releaseHandler(tracker,position,insideElmtPress,insideElmtRelease){if(insideElmtPress&&insideElmtRelease){outTo(ButtonState.HOVER);if(onRelease){onRelease();}}else if(insideElmtPress){outTo(ButtonState.GROUP);}else{inTo(ButtonState.HOVER);}}
function clickHandler(tracker,position,quick,shift){if(onClick&&quick){onClick();}}
this.notifyGroupEnter=function(){inTo(ButtonState.GROUP);};this.notifyGroupExit=function(){outTo(ButtonState.REST);};(function(){button.style.display="inline-block";button.style.position="relative";button.title=tooltip;button.appendChild(imgRest);button.appendChild(imgGroup);button.appendChild(imgHover);button.appendChild(imgDown);var styleRest=imgRest.style;var styleGroup=imgGroup.style;var styleHover=imgHover.style;var styleDown=imgDown.style;styleGroup.position=styleHover.position=styleDown.position="absolute";styleGroup.top=styleHover.top=styleDown.top="0px";styleGroup.left=styleHover.left=styleDown.left="0px";styleHover.visibility=styleDown.visibility="hidden";if(Seadragon.Utils.getBrowser()==Seadragon.Browser.FIREFOX&&Seadragon.Utils.getBrowserVersion()<3){styleGroup.top=styleHover.top=styleDown.top="";}
tracker.enterHandler=enterHandler;tracker.exitHandler=exitHandler;tracker.pressHandler=pressHandler;tracker.releaseHandler=releaseHandler;tracker.clickHandler=clickHandler;tracker.setTracking(true);outTo(ButtonState.REST);})();};Seadragon.ButtonGroup=function(buttons){var group=Seadragon.Utils.makeNeutralElement("span");var buttons=buttons.concat([]);var tracker=new Seadragon.MouseTracker(group);this.elmt=group;function enterHandler(tracker,position,buttonDownElmt,buttonDownAny){for(var i=0;i<buttons.length;i++){buttons[i].notifyGroupEnter();}}
function exitHandler(tracker,position,buttonDownElmt,buttonDownAny){if(!buttonDownElmt){for(var i=0;i<buttons.length;i++){buttons[i].notifyGroupExit();}}}
function releaseHandler(tracker,position,insideElmtPress,insideElmtRelease){if(!insideElmtRelease){for(var i=0;i<buttons.length;i++){buttons[i].notifyGroupExit();}}}
this.emulateEnter=function(){enterHandler();};this.emulateExit=function(){exitHandler();};(function(){group.style.display="inline-block";for(var i=0;i<buttons.length;i++){group.appendChild(buttons[i].elmt);}
tracker.enterHandler=enterHandler;tracker.exitHandler=exitHandler;tracker.releaseHandler=releaseHandler;tracker.setTracking(true);})();};})();Seadragon.TileSource=function(width,height,tileSize,tileOverlap,minLevel,maxLevel){var self=this;var normHeight=height/width;this.aspectRatio=width/height;this.dimensions=new Seadragon.Point(width,height);this.minLevel=minLevel?minLevel:0;this.maxLevel=maxLevel?maxLevel:Math.ceil(Math.log(Math.max(width,height))/Math.log(2));this.tileSize=tileSize?tileSize:0;this.tileOverlap=tileOverlap?tileOverlap:0;this.getLevelScale=function(level){return 1/(1<<(self.maxLevel-level));};this.getNumTiles=function(level){var scale=self.getLevelScale(level);var x=Math.ceil(scale*self.dimensions.x/self.tileSize);var y=Math.ceil(scale*self.dimensions.y/self.tileSize);return new Seadragon.Point(x,y);};this.getPixelRatio=function(level){var imageSizeScaled=self.dimensions.times(self.getLevelScale(level));var rx=1.0/imageSizeScaled.x;var ry=1.0/imageSizeScaled.y;return new Seadragon.Point(rx,ry);};this.getTileAtPoint=function(level,point){var scaledSize=self.dimensions.times(self.getLevelScale(level));var pixel=point.times(scaledSize.x);var tx,ty;if(point.x>=0.0&&point.x<=1.0){tx=Math.floor(pixel.x/self.tileSize);}else{tx=Math.ceil(scaledSize.x/self.tileSize)*Math.floor(pixel.x/scaledSize.x)+
Math.floor(((scaledSize.x+(pixel.x%scaledSize.x))%scaledSize.x)/self.tileSize);}
if(point.y>=0.0&&point.y<=normHeight){ty=Math.floor(pixel.y/self.tileSize);}else{ty=Math.ceil(scaledSize.y/self.tileSize)*Math.floor(pixel.y/scaledSize.y)+
Math.floor(((scaledSize.y+(pixel.y%scaledSize.y))%scaledSize.y)/self.tileSize);}
return new Seadragon.Point(tx,ty);};this.getTileBounds=function(level,x,y){var dimensionsScaled=self.dimensions.times(self.getLevelScale(level));var px=(x===0)?0:self.tileSize*x-self.tileOverlap;var py=(y===0)?0:self.tileSize*y-self.tileOverlap;var sx=self.tileSize+(x===0?1:2)*self.tileOverlap;var sy=self.tileSize+(y===0?1:2)*self.tileOverlap;sx=Math.min(sx,dimensionsScaled.x-px);sy=Math.min(sy,dimensionsScaled.y-py);var scale=1.0/dimensionsScaled.x;return new Seadragon.Rect(px*scale,py*scale,sx*scale,sy*scale);};this.getTileUrl=function(level,x,y){throw new Error("Method not implemented.");};this.tileExists=function(level,x,y){var numTiles=self.getNumTiles(level);return level>=self.minLevel&&level<=self.maxLevel&&x>=0&&y>=0&&x<numTiles.x&&y<numTiles.y;};};Seadragon.DisplayRect=function(x,y,width,height,minLevel,maxLevel){Seadragon.Rect.apply(this,arguments);this.minLevel=minLevel;this.maxLevel=maxLevel;};Seadragon.DisplayRect.prototype=new Seadragon.Rect();Seadragon.DziTileSource=function(width,height,tileSize,tileOverlap,tilesUrl,fileFormat,displayRects){Seadragon.TileSource.apply(this,[width,height,tileSize,tileOverlap]);var self=this;var levelRects={};this.fileFormat=fileFormat;this.displayRects=displayRects;(function(){if(!displayRects){return;}
for(var i=displayRects.length-1;i>=0;i--){var rect=displayRects[i];for(var level=rect.minLevel;level<=rect.maxLevel;level++){if(!levelRects[level]){levelRects[level]=[];}
levelRects[level].push(rect);}}})();this.getTileUrl=function(level,x,y){return[tilesUrl,level,'/',x,'_',y,'.',fileFormat].join('');};this.tileExists=function(level,x,y){var rects=levelRects[level];if(!rects||!rects.length){return true;}
for(var i=rects.length-1;i>=0;i--){var rect=rects[i];if(level<rect.minLevel||level>rect.maxLevel){continue;}
var scale=self.getLevelScale(level);var xMin=rect.x*scale;var yMin=rect.y*scale;var xMax=xMin+rect.width*scale;var yMax=yMin+rect.height*scale;xMin=Math.floor(xMin/tileSize);yMin=Math.floor(yMin/tileSize);xMax=Math.ceil(xMax/tileSize);yMax=Math.ceil(yMax/tileSize);if(xMin<=x&&x<xMax&&yMin<=y&&y<yMax){return true;}}
return false;};};Seadragon.DziTileSource.prototype=new Seadragon.TileSource();(function(){function DziError(message){Error.apply(this,arguments);this.message=message;}
DziError.prototype=new Error();function getError(e){if(!(e instanceof DziError)){Seadragon.Debug.error(e.name+" while creating DZI from XML: "+e.message);e=new DziError(Seadragon.Strings.getString("Errors.Unknown"));}
return e;}
function processResponse(xhr,tilesUrl){if(!xhr){throw new DziError(Seadragon.Strings.getString("Errors.Security"));}else if(xhr.status!==200&&xhr.status!==0){var status=xhr.status;var statusText=(status==404)?"Not Found":xhr.statusText;throw new DziError(Seadragon.Strings.getString("Errors.Status",status,statusText));}
var doc=null;if(xhr.responseXML&&xhr.responseXML.documentElement){doc=xhr.responseXML;}else if(xhr.responseText){doc=Seadragon.Utils.parseXml(xhr.responseText);}
return processXml(doc,tilesUrl);}
function processXml(xmlDoc,tilesUrl){if(!xmlDoc||!xmlDoc.documentElement){throw new DziError(Seadragon.Strings.getString("Errors.Xml"));}
var root=xmlDoc.documentElement;var rootName=root.tagName;if(rootName=="Image"){try{return processDzi(root,tilesUrl);}catch(e){var defMsg=Seadragon.Strings.getString("Errors.Dzi");throw(e instanceof DziError)?e:new DziError(defMsg);}}else if(rootName=="Collection"){throw new DziError(Seadragon.Strings.getString("Errors.Dzc"));}else if(rootName=="Error"){return processError(root);}
throw new DziError(Seadragon.Strings.getString("Errors.Dzi"));}
function processDzi(imageNode,tilesUrl){var fileFormat=imageNode.getAttribute("Format");if(!Seadragon.Utils.imageFormatSupported(fileFormat)){throw new DziError(Seadragon.Strings.getString("Errors.ImageFormat",fileFormat.toUpperCase()));}
var sizeNode=imageNode.getElementsByTagName("Size")[0];var dispRectNodes=imageNode.getElementsByTagName("DisplayRect");var width=parseInt(sizeNode.getAttribute("Width"),10);var height=parseInt(sizeNode.getAttribute("Height"),10);var tileSize=parseInt(imageNode.getAttribute("TileSize"));var tileOverlap=parseInt(imageNode.getAttribute("Overlap"));var dispRects=[];for(var i=0;i<dispRectNodes.length;i++){var dispRectNode=dispRectNodes[i];var rectNode=dispRectNode.getElementsByTagName("Rect")[0];dispRects.push(new Seadragon.DisplayRect(parseInt(rectNode.getAttribute("X"),10),parseInt(rectNode.getAttribute("Y"),10),parseInt(rectNode.getAttribute("Width"),10),parseInt(rectNode.getAttribute("Height"),10),0,parseInt(dispRectNode.getAttribute("MaxLevel"),10)));}
return new Seadragon.DziTileSource(width,height,tileSize,tileOverlap,tilesUrl,fileFormat,dispRects);}
function processError(errorNode){var messageNode=errorNode.getElementsByTagName("Message")[0];var message=messageNode.firstChild.nodeValue;throw new DziError(message);}
Seadragon.DziTileSource.createFromXml=function(xmlUrl,xmlString,callback){var async=typeof(callback)=="function";var error=null;if(!xmlUrl){error=Seadragon.Strings.getString("Errors.Empty");if(async){window.setTimeout(function(){callback(null,error);},1);return null;}
throw new DziError(error);}
var urlParts=xmlUrl.split('/');var filename=urlParts[urlParts.length-1];var lastDot=filename.lastIndexOf('.');if(lastDot>-1){urlParts[urlParts.length-1]=filename.slice(0,lastDot);}
var tilesUrl=urlParts.join('/')+"_files/";function finish(func,obj){try{return func(obj,tilesUrl);}catch(e){if(async){error=getError(e).message;return null;}else{throw getError(e);}}}
if(async){if(xmlString){window.setTimeout(function(){var source=finish(processXml,Seadragon.Utils.parseXml(xmlString));callback(source,error);},1);}else{Seadragon.Utils.makeAjaxRequest(xmlUrl,function(xhr){var source=finish(processResponse,xhr);callback(source,error);});}
return null;}
if(xmlString){return finish(processXml,Seadragon.Utils.parseXml(xmlString));}else{return finish(processResponse,Seadragon.Utils.makeAjaxRequest(xmlUrl));}};})();Seadragon.Viewport=function(containerSize,contentSize){var self=this;var containerSize=new Seadragon.Point(containerSize.x,containerSize.y);var contentAspect=contentSize.x/contentSize.y;var contentHeight=contentSize.y/contentSize.x;var centerSpringX=new Seadragon.Spring(0);var centerSpringY=new Seadragon.Spring(0);var zoomSpring=new Seadragon.Spring(1);var zoomPoint=null;var homeBounds=new Seadragon.Rect(0,0,1,contentHeight);function init(){self.goHome(true);self.update();}
function getHomeZoom(){var aspectFactor=contentAspect/self.getAspectRatio();return(aspectFactor>=1)?1:aspectFactor;}
function getMinZoom(){var homeZoom=getHomeZoom();if(Seadragon.Config.minZoomDimension){var zoom=(contentSize.x<=contentSize.y)?Seadragon.Config.minZoomDimension/containerSize.x:Seadragon.Config.minZoomDimension/(containerSize.x*contentHeight);}else{var zoom=Seadragon.Config.minZoomImageRatio*homeZoom;}
return Math.min(zoom,homeZoom);}
function getMaxZoom(){var zoom=contentSize.x*Seadragon.Config.maxZoomPixelRatio/containerSize.x;return Math.max(zoom,getHomeZoom());}
this.getAspectRatio=function(){return containerSize.x/containerSize.y;};this.getContainerSize=function(){return new Seadragon.Point(containerSize.x,containerSize.y);};this.getBounds=function(current){var center=self.getCenter(current);var width=1.0/self.getZoom(current);var height=width/self.getAspectRatio();return new Seadragon.Rect(center.x-width/2.0,center.y-height/2.0,width,height);};this.getCenter=function(current){var centerCurrent=new Seadragon.Point(centerSpringX.getCurrent(),centerSpringY.getCurrent());var centerTarget=new Seadragon.Point(centerSpringX.getTarget(),centerSpringY.getTarget());if(current){return centerCurrent;}else if(!zoomPoint){return centerTarget;}
var oldZoomPixel=self.pixelFromPoint(zoomPoint,true);var zoom=self.getZoom();var width=1.0/zoom;var height=width/self.getAspectRatio();var bounds=new Seadragon.Rect(centerCurrent.x-width/2.0,centerCurrent.y-height/2.0,width,height);var newZoomPixel=zoomPoint.minus(bounds.getTopLeft()).times(containerSize.x/bounds.width);var deltaZoomPixels=newZoomPixel.minus(oldZoomPixel);var deltaZoomPoints=deltaZoomPixels.divide(containerSize.x*zoom);return centerTarget.plus(deltaZoomPoints);};this.getZoom=function(current){if(current){return zoomSpring.getCurrent();}else{return zoomSpring.getTarget();}};this.applyConstraints=function(immediately){var actualZoom=self.getZoom();var constrainedZoom=Math.max(Math.min(actualZoom,getMaxZoom()),getMinZoom());if(actualZoom!=constrainedZoom){self.zoomTo(constrainedZoom,zoomPoint,immediately);}
var bounds=self.getBounds();var visibilityRatio=Seadragon.Config.visibilityRatio;var horThres=visibilityRatio*bounds.width;var verThres=visibilityRatio*bounds.height;var left=bounds.x+bounds.width;var right=1-bounds.x;var top=bounds.y+bounds.height;var bottom=contentHeight-bounds.y;var dx=0;if(Seadragon.Config.wrapHorizontal){}else if(left<horThres){dx=horThres-left;}else if(right<horThres){dx=right-horThres;}
var dy=0;if(Seadragon.Config.wrapVertical){}else if(top<verThres){dy=verThres-top;}else if(bottom<verThres){dy=bottom-verThres;}
if(dx||dy){bounds.x+=dx;bounds.y+=dy;self.fitBounds(bounds,immediately);}};this.ensureVisible=function(immediately){self.applyConstraints(immediately);};this.fitBounds=function(bounds,immediately){var aspect=self.getAspectRatio();var center=bounds.getCenter();var newBounds=new Seadragon.Rect(bounds.x,bounds.y,bounds.width,bounds.height);if(newBounds.getAspectRatio()>=aspect){newBounds.height=bounds.width/aspect;newBounds.y=center.y-newBounds.height/2;}else{newBounds.width=bounds.height*aspect;newBounds.x=center.x-newBounds.width/2;}
self.panTo(self.getCenter(true),true);self.zoomTo(self.getZoom(true),null,true);var oldBounds=self.getBounds();var oldZoom=self.getZoom();var newZoom=1.0/newBounds.width;if(newZoom==oldZoom||newBounds.width==oldBounds.width){self.panTo(center,immediately);return;}
var refPoint=oldBounds.getTopLeft().times(containerSize.x/oldBounds.width).minus(newBounds.getTopLeft().times(containerSize.x/newBounds.width)).divide(containerSize.x/oldBounds.width-containerSize.x/newBounds.width);self.zoomTo(newZoom,refPoint,immediately);};this.goHome=function(immediately){var center=self.getCenter();if(Seadragon.Config.wrapHorizontal){center.x=(1+(center.x%1))%1;centerSpringX.resetTo(center.x);centerSpringX.update();}
if(Seadragon.Config.wrapVertical){center.y=(contentHeight+(center.y%contentHeight))%contentHeight;centerSpringY.resetTo(center.y);centerSpringY.update();}
self.fitBounds(homeBounds,immediately);};this.panBy=function(delta,immediately){var center=new Seadragon.Point(centerSpringX.getTarget(),centerSpringY.getTarget());self.panTo(center.plus(delta),immediately);};this.panTo=function(center,immediately){if(immediately){centerSpringX.resetTo(center.x);centerSpringY.resetTo(center.y);}else{centerSpringX.springTo(center.x);centerSpringY.springTo(center.y);}};this.zoomBy=function(factor,refPoint,immediately){self.zoomTo(zoomSpring.getTarget()*factor,refPoint,immediately);};this.zoomTo=function(zoom,refPoint,immediately){if(immediately){zoomSpring.resetTo(zoom);}else{zoomSpring.springTo(zoom);}
zoomPoint=refPoint instanceof Seadragon.Point?refPoint:null;};this.resize=function(newContainerSize,maintain){var oldBounds=self.getBounds();var newBounds=oldBounds;var widthDeltaFactor=newContainerSize.x/containerSize.x;containerSize=new Seadragon.Point(newContainerSize.x,newContainerSize.y);if(maintain){newBounds.width=oldBounds.width*widthDeltaFactor;newBounds.height=newBounds.width/self.getAspectRatio();}
self.fitBounds(newBounds,true);};this.update=function(){var oldCenterX=centerSpringX.getCurrent();var oldCenterY=centerSpringY.getCurrent();var oldZoom=zoomSpring.getCurrent();if(zoomPoint){var oldZoomPixel=self.pixelFromPoint(zoomPoint,true);}
zoomSpring.update();if(zoomPoint&&zoomSpring.getCurrent()!=oldZoom){var newZoomPixel=self.pixelFromPoint(zoomPoint,true);var deltaZoomPixels=newZoomPixel.minus(oldZoomPixel);var deltaZoomPoints=self.deltaPointsFromPixels(deltaZoomPixels,true);centerSpringX.shiftBy(deltaZoomPoints.x);centerSpringY.shiftBy(deltaZoomPoints.y);}else{zoomPoint=null;}
centerSpringX.update();centerSpringY.update();return centerSpringX.getCurrent()!=oldCenterX||centerSpringY.getCurrent()!=oldCenterY||zoomSpring.getCurrent()!=oldZoom;};this.deltaPixelsFromPoints=function(deltaPoints,current){return deltaPoints.times(containerSize.x*self.getZoom(current));};this.deltaPointsFromPixels=function(deltaPixels,current){return deltaPixels.divide(containerSize.x*self.getZoom(current));};this.pixelFromPoint=function(point,current){var bounds=self.getBounds(current);return point.minus(bounds.getTopLeft()).times(containerSize.x/bounds.width);};this.pointFromPixel=function(pixel,current){var bounds=self.getBounds(current);return pixel.divide(containerSize.x/bounds.width).plus(bounds.getTopLeft());};init();};(function(){var QUOTA=100;var MIN_PIXEL_RATIO=0.5;var browser=Seadragon.Utils.getBrowser();var browserVer=Seadragon.Utils.getBrowserVersion();var subpixelRenders=browser==Seadragon.Browser.FIREFOX||browser==Seadragon.Browser.OPERA||(browser==Seadragon.Browser.SAFARI&&browserVer>=4)||(browser==Seadragon.Browser.CHROME&&browserVer>=2);var useCanvas=typeof(document.createElement("canvas").getContext)=="function"&&subpixelRenders;var MS_INTERPOLATION_MODE=(typeof document.documentMode!=="undefined")?"bicubic":"nearest-neighbor";function Tile(level,x,y,bounds,exists,url){this.level=level;this.x=x;this.y=y;this.bounds=bounds;this.exists=exists;this.url=url;this.elmt=null;this.image=null;this.loaded=false;this.loading=false;this.style=null;this.position=null;this.size=null;this.blendStart=null;this.opacity=null;this.distance=null;this.visibility=null;this.beingDrawn=false;this.lastTouchTime=0;}
Tile.prototype.toString=function(){return this.level+"/"+this.x+"_"+this.y;};Tile.prototype.drawHTML=function(container){if(!this.loaded){Seadragon.Debug.error("Attempting to draw tile "+this.toString()+" when it's not yet loaded.");return;}
if(!this.elmt){this.elmt=Seadragon.Utils.makeNeutralElement("img");this.elmt.src=this.url;this.style=this.elmt.style;this.style.position="absolute";this.style.msInterpolationMode=MS_INTERPOLATION_MODE;}
var elmt=this.elmt;var style=this.style;var position=this.position.apply(Math.floor);var size=this.size.apply(Math.ceil);if(elmt.parentNode!=container){container.appendChild(elmt);}
style.left=position.x+"px";style.top=position.y+"px";style.width=size.x+"px";style.height=size.y+"px";Seadragon.Utils.setElementOpacity(elmt,this.opacity);};Tile.prototype.drawCanvas=function(context){if(!this.loaded){Seadragon.Debug.error("Attempting to draw tile "+this.toString()+" when it's not yet loaded.");return;}
var position=this.position;var size=this.size;context.globalAlpha=this.opacity;context.drawImage(this.image,position.x,position.y,size.x,size.y);};Tile.prototype.unload=function(){if(this.elmt&&this.elmt.parentNode){this.elmt.parentNode.removeChild(this.elmt);}
this.elmt=null;this.image=null;this.loaded=false;this.loading=false;}
var Placement={CENTER:0,TOP_LEFT:1,TOP:2,TOP_RIGHT:3,RIGHT:4,BOTTOM_RIGHT:5,BOTTOM:6,BOTTOM_LEFT:7,LEFT:8};Seadragon.OverlayPlacement=Placement;function createAdjustmentFunction(placement){switch(placement){case Placement.TOP_LEFT:return function(position,size){};case Placement.TOP:return function(position,size){position.x-=size.x/2;};case Placement.TOP_RIGHT:return function(position,size){position.x-=size.x;};case Placement.RIGHT:return function(position,size){position.x-=size.x;position.y-=size.y/2;};case Placement.BOTTOM_RIGHT:return function(position,size){position.x-=size.x;position.y-=size.y;};case Placement.BOTTOM:return function(position,size){position.x-=size.x/2;position.y-=size.y;};case Placement.BOTTOM_LEFT:return function(position,size){position.y-=size.y;};case Placement.LEFT:return function(position,size){position.y-=size.y/2;};case Placement.CENTER:default:return function(position,size){position.x-=size.x/2;position.y-=size.y/2;};}}
function Overlay(elmt,loc,placement){this.elmt=elmt;this.scales=(loc instanceof Seadragon.Rect);this.bounds=new Seadragon.Rect(loc.x,loc.y,loc.width,loc.height);this.adjust=createAdjustmentFunction(loc instanceof Seadragon.Point?placement:Placement.TOP_LEFT);this.position=new Seadragon.Point(loc.x,loc.y);this.size=new Seadragon.Point(loc.width,loc.height);this.style=elmt.style;}
Overlay.prototype.destroy=function(){var elmt=this.elmt;var style=this.style;if(elmt.parentNode){elmt.parentNode.removeChild(elmt);}
style.top="";style.left="";style.position="";if(this.scales){style.width="";style.height="";}};Overlay.prototype.drawHTML=function(container){var elmt=this.elmt;var style=this.style;var scales=this.scales;if(elmt.parentNode!=container){container.appendChild(elmt);}
if(!scales){this.size=Seadragon.Utils.getElementSize(elmt);}
var position=this.position;var size=this.size;this.adjust(position,size);position=position.apply(Math.floor);size=size.apply(Math.ceil);style.left=position.x+"px";style.top=position.y+"px";style.position="absolute";if(scales){style.width=size.x+"px";style.height=size.y+"px";}};Overlay.prototype.update=function(loc,placement){this.scales=(loc instanceof Seadragon.Rect);this.bounds=new Seadragon.Rect(loc.x,loc.y,loc.width,loc.height);this.adjust=createAdjustmentFunction(loc instanceof Seadragon.Point?placement:Placement.TOP_LEFT);};Seadragon.Drawer=function(source,viewport,elmt){var container=Seadragon.Utils.getElement(elmt);var canvas=Seadragon.Utils.makeNeutralElement(useCanvas?"canvas":"div");var context=useCanvas?canvas.getContext("2d"):null;var imageLoader=new Seadragon.ImageLoader();var profiler=new Seadragon.Profiler();var minLevel=source.minLevel;var maxLevel=source.maxLevel;var tileSize=source.tileSize;var tileOverlap=source.tileOverlap;var normHeight=source.dimensions.y/source.dimensions.x;var cacheNumTiles={};var cachePixelRatios={};var tilesMatrix={};var tilesLoaded=[];var coverage={};var overlays=[];var lastDrawn=[];var lastResetTime=0;var midUpdate=false;var updateAgain=true;this.elmt=container;this.profiler=profiler;(function(){canvas.style.width="100%";canvas.style.height="100%";canvas.style.position="absolute";container.style.textAlign="left";container.appendChild(canvas);})();function getNumTiles(level){if(!cacheNumTiles[level]){cacheNumTiles[level]=source.getNumTiles(level);}
return cacheNumTiles[level];}
function getPixelRatio(level){if(!cachePixelRatios[level]){cachePixelRatios[level]=source.getPixelRatio(level);}
return cachePixelRatios[level];}
function getTile(level,x,y,time,numTilesX,numTilesY){if(!tilesMatrix[level]){tilesMatrix[level]={};}
if(!tilesMatrix[level][x]){tilesMatrix[level][x]={};}
if(!tilesMatrix[level][x][y]){var xMod=(numTilesX+(x%numTilesX))%numTilesX;var yMod=(numTilesY+(y%numTilesY))%numTilesY;var bounds=source.getTileBounds(level,xMod,yMod);var exists=source.tileExists(level,xMod,yMod);var url=source.getTileUrl(level,xMod,yMod);bounds.x+=1.0*(x-xMod)/numTilesX;bounds.y+=normHeight*(y-yMod)/numTilesY;tilesMatrix[level][x][y]=new Tile(level,x,y,bounds,exists,url);}
var tile=tilesMatrix[level][x][y];tile.lastTouchTime=time;return tile;}
function loadTile(tile,time){tile.loading=imageLoader.loadImage(tile.url,Seadragon.Utils.createCallback(null,onTileLoad,tile,time));}
function onTileLoad(tile,time,image){tile.loading=false;if(midUpdate){Seadragon.Debug.error("Tile load callback in middle of drawing routine.");return;}else if(!image){Seadragon.Debug.log("Tile "+tile+" failed to load: "+tile.url);tile.exists=false;return;}else if(time<lastResetTime){Seadragon.Debug.log("Ignoring tile "+tile+" loaded before reset: "+tile.url);return;}
tile.loaded=true;tile.image=image;var insertionIndex=tilesLoaded.length;if(tilesLoaded.length>=QUOTA){var cutoff=Math.ceil(Math.log(tileSize)/Math.log(2));var worstTile=null;var worstTileIndex=-1;for(var i=tilesLoaded.length-1;i>=0;i--){var prevTile=tilesLoaded[i];if(prevTile.level<=cutoff||prevTile.beingDrawn){continue;}else if(!worstTile){worstTile=prevTile;worstTileIndex=i;continue;}
var prevTime=prevTile.lastTouchTime;var worstTime=worstTile.lastTouchTime;var prevLevel=prevTile.level;var worstLevel=worstTile.level;if(prevTime<worstTime||(prevTime==worstTime&&prevLevel>worstLevel)){worstTile=prevTile;worstTileIndex=i;}}
if(worstTile&&worstTileIndex>=0){worstTile.unload();insertionIndex=worstTileIndex;}}
tilesLoaded[insertionIndex]=tile;updateAgain=true;}
function clearTiles(){tilesMatrix={};tilesLoaded=[];}
function providesCoverage(level,x,y){if(!coverage[level]){return false;}
if(x===undefined||y===undefined){var rows=coverage[level];for(var i in rows){if(rows.hasOwnProperty(i)){var cols=rows[i];for(var j in cols){if(cols.hasOwnProperty(j)&&!cols[j]){return false;}}}}
return true;}
return(coverage[level][x]===undefined||coverage[level][x][y]===undefined||coverage[level][x][y]===true);}
function isCovered(level,x,y){if(x===undefined||y===undefined){return providesCoverage(level+1);}else{return(providesCoverage(level+1,2*x,2*y)&&providesCoverage(level+1,2*x,2*y+1)&&providesCoverage(level+1,2*x+1,2*y)&&providesCoverage(level+1,2*x+1,2*y+1));}}
function setCoverage(level,x,y,covers){if(!coverage[level]){Seadragon.Debug.error("Setting coverage for a tile before its "+"level's coverage has been reset: "+level);return;}
if(!coverage[level][x]){coverage[level][x]={};}
coverage[level][x][y]=covers;}
function resetCoverage(level){coverage[level]={};}
function compareTiles(prevBest,tile){if(!prevBest){return tile;}
if(tile.visibility>prevBest.visibility){return tile;}else if(tile.visibility==prevBest.visibility){if(tile.distance<prevBest.distance){return tile;}}
return prevBest;}
function getOverlayIndex(elmt){for(var i=overlays.length-1;i>=0;i--){if(overlays[i].elmt==elmt){return i;}}
return-1;}
function updateActual(){updateAgain=false;var _canvas=canvas;var _context=context;var _container=container;var _useCanvas=useCanvas;var _lastDrawn=lastDrawn;while(_lastDrawn.length>0){var tile=_lastDrawn.pop();tile.beingDrawn=false;}
var viewportSize=viewport.getContainerSize();var viewportWidth=viewportSize.x;var viewportHeight=viewportSize.y;_canvas.innerHTML="";if(_useCanvas){_canvas.width=viewportWidth;_canvas.height=viewportHeight;_context.clearRect(0,0,viewportWidth,viewportHeight);}
var viewportBounds=viewport.getBounds(true);var viewportTL=viewportBounds.getTopLeft();var viewportBR=viewportBounds.getBottomRight();if(!Seadragon.Config.wrapHorizontal&&(viewportBR.x<0||viewportTL.x>1)){return;}else if(!Seadragon.Config.wrapVertical&&(viewportBR.y<0||viewportTL.y>normHeight)){return;}
var _getNumTiles=getNumTiles;var _getPixelRatio=getPixelRatio;var _getTile=getTile;var _isCovered=isCovered;var _setCoverage=setCoverage;var _resetCoverage=resetCoverage;var _providesCoverage=providesCoverage;var _tileOverlap=tileOverlap;var _abs=Math.abs;var _ceil=Math.ceil;var _floor=Math.floor;var _log=Math.log;var _max=Math.max;var _min=Math.min;var _deltaPixelsFromPoints=viewport.deltaPixelsFromPoints;var _pixelFromPoint=viewport.pixelFromPoint;var _getTileAtPoint=source.getTileAtPoint;var alwaysBlend=Seadragon.Config.alwaysBlend;var blendTimeMillis=1000*Seadragon.Config.blendTime;var immediateRender=Seadragon.Config.immediateRender;var minDimension=Seadragon.Config.minZoomDimension;var minImageRatio=Seadragon.Config.minImageRatio;var wrapHorizontal=Seadragon.Config.wrapHorizontal;var wrapVertical=Seadragon.Config.wrapVertical;var wrapOverlays=Seadragon.Config.wrapOverlays;if(!wrapHorizontal){viewportTL.x=_max(viewportTL.x,0);viewportBR.x=_min(viewportBR.x,1);}
if(!wrapVertical){viewportTL.y=_max(viewportTL.y,0);viewportBR.y=_min(viewportBR.y,normHeight);}
var best=null;var haveDrawn=false;var currentTime=new Date().getTime();var viewportCenterPoint=viewport.getCenter();var viewportCenterPixel=_pixelFromPoint(viewportCenterPoint);var zeroRatioT=_deltaPixelsFromPoints(_getPixelRatio(0),false).x;var optimalPixelRatio=immediateRender?1:zeroRatioT;minDimension=minDimension||64;var lowestLevel=_max(minLevel,_floor(_log(minDimension)/_log(2)));var zeroRatioC=_deltaPixelsFromPoints(_getPixelRatio(0),true).x;var highestLevel=_min(maxLevel,_floor(_log(zeroRatioC/MIN_PIXEL_RATIO)/_log(2)));lowestLevel=_min(lowestLevel,highestLevel);for(var level=highestLevel;level>=lowestLevel;level--){var drawLevel=false;var renderPixelRatioC=_deltaPixelsFromPoints(_getPixelRatio(level),true).x;if((!haveDrawn&&renderPixelRatioC>=MIN_PIXEL_RATIO)||level==lowestLevel){drawLevel=true;haveDrawn=true;}else if(!haveDrawn){continue;}
_resetCoverage(level);var levelOpacity=_min(1,(renderPixelRatioC-0.5)/0.5);var renderPixelRatioT=_deltaPixelsFromPoints(_getPixelRatio(level),false).x;var levelVisibility=optimalPixelRatio/_abs(optimalPixelRatio-renderPixelRatioT);var tileTL=_getTileAtPoint(level,viewportTL);var tileBR=_getTileAtPoint(level,viewportBR);var numTiles=_getNumTiles(level);var numTilesX=numTiles.x;var numTilesY=numTiles.y;if(!wrapHorizontal){tileBR.x=_min(tileBR.x,numTilesX-1);}
if(!wrapVertical){tileBR.y=_min(tileBR.y,numTilesY-1);}
for(var x=tileTL.x;x<=tileBR.x;x++){for(var y=tileTL.y;y<=tileBR.y;y++){var tile=_getTile(level,x,y,currentTime,numTilesX,numTilesY);var drawTile=drawLevel;_setCoverage(level,x,y,false);if(!tile.exists){continue;}
if(haveDrawn&&!drawTile){if(_isCovered(level,x,y)){_setCoverage(level,x,y,true);}else{drawTile=true;}}
if(!drawTile){continue;}
var boundsTL=tile.bounds.getTopLeft();var boundsSize=tile.bounds.getSize();var positionC=_pixelFromPoint(boundsTL,true);var sizeC=_deltaPixelsFromPoints(boundsSize,true);if(!_tileOverlap){sizeC=sizeC.plus(new Seadragon.Point(1,1));}
var positionT=_pixelFromPoint(boundsTL,false);var sizeT=_deltaPixelsFromPoints(boundsSize,false);var tileCenter=positionT.plus(sizeT.divide(2));var tileDistance=viewportCenterPixel.distanceTo(tileCenter);tile.position=positionC;tile.size=sizeC;tile.distance=tileDistance;tile.visibility=levelVisibility;if(tile.loaded){if(!tile.blendStart){tile.blendStart=currentTime;}
var deltaTime=currentTime-tile.blendStart;var opacity=_min(1,deltaTime/blendTimeMillis);if(alwaysBlend){opacity*=levelOpacity;}
tile.opacity=opacity;_lastDrawn.push(tile);if(opacity==1){_setCoverage(level,x,y,true);}else if(deltaTime<blendTimeMillis){updateAgain=true;}}else if(tile.loading){}else{best=compareTiles(best,tile);}}}
if(_providesCoverage(level)){break;}}
for(var i=_lastDrawn.length-1;i>=0;i--){var tile=_lastDrawn[i];if(_useCanvas){tile.drawCanvas(_context);}else{tile.drawHTML(_canvas);}
tile.beingDrawn=true;}
var numOverlays=overlays.length;for(var i=0;i<numOverlays;i++){var overlay=overlays[i];var bounds=overlay.bounds;var overlayTL=bounds.getTopLeft();if(wrapOverlays&&wrapHorizontal){overlayTL.x+=_floor(viewportCenterPoint.x);}
if(wrapOverlays&&wrapVertical){}
overlay.position=_pixelFromPoint(overlayTL,true);overlay.size=_deltaPixelsFromPoints(bounds.getSize(),true);overlay.drawHTML(container);}
if(best){loadTile(best,currentTime);updateAgain=true;}}
this.addOverlay=function(elmt,loc,placement){var elmt=Seadragon.Utils.getElement(elmt);if(getOverlayIndex(elmt)>=0){return;}
overlays.push(new Overlay(elmt,loc,placement));updateAgain=true;};this.updateOverlay=function(elmt,loc,placement){var elmt=Seadragon.Utils.getElement(elmt);var i=getOverlayIndex(elmt);if(i>=0){overlays[i].update(loc,placement);updateAgain=true;}};this.removeOverlay=function(elmt){var elmt=Seadragon.Utils.getElement(elmt);var i=getOverlayIndex(elmt);if(i>=0){overlays[i].destroy();overlays.splice(i,1);updateAgain=true;}};this.clearOverlays=function(){while(overlays.length>0){overlays.pop().destroy();updateAgain=true;}};this.needsUpdate=function(){return updateAgain;};this.numTilesLoaded=function(){return tilesLoaded.length;};this.reset=function(){clearTiles();lastResetTime=new Date().getTime();updateAgain=true;};this.update=function(){profiler.beginUpdate();midUpdate=true;updateActual();midUpdate=false;profiler.endUpdate();};this.idle=function(){};};})();(function(){var SIGNAL="----seadragon----";var browser=Seadragon.Utils.getBrowser();var Anchor={NONE:0,TOP_LEFT:1,TOP_RIGHT:2,BOTTOM_RIGHT:3,BOTTOM_LEFT:4};Seadragon.ControlAnchor=Anchor;function addToAnchor(elmt,anchor,container){if(anchor==Anchor.TOP_RIGHT||anchor==Anchor.BOTTOM_RIGHT){container.insertBefore(elmt,container.firstChild);}else{container.appendChild(elmt);}}
function Control(elmt,anchor,container){var wrapper=Seadragon.Utils.makeNeutralElement("span");this.elmt=elmt;this.anchor=anchor;this.container=container;this.wrapper=wrapper;wrapper.style.display="inline-block";wrapper.appendChild(elmt);if(anchor==Anchor.NONE){wrapper.style.width=wrapper.style.height="100%";}
addToAnchor(wrapper,anchor,container);}
Control.prototype.destroy=function(){this.wrapper.removeChild(this.elmt);this.container.removeChild(this.wrapper);};Control.prototype.isVisible=function(){return this.wrapper.style.display!="none";};Control.prototype.setVisible=function(visible){this.wrapper.style.display=visible?"inline-block":"none";};Control.prototype.setOpacity=function(opacity){if(this.elmt[SIGNAL]&&browser==Seadragon.Browser.IE){Seadragon.Utils.setElementOpacity(this.elmt,opacity,true);}else{Seadragon.Utils.setElementOpacity(this.wrapper,opacity,true);}}
var FULL_PAGE="fullpage";var HOME="home";var ZOOM_IN="zoomin";var ZOOM_OUT="zoomout";var REST="_rest.png";var GROUP="_grouphover.png";var HOVER="_hover.png";var DOWN="_pressed.png";function makeNavControl(viewer){var group=null;var zooming=false;var zoomFactor=null;var lastZoomTime=null;function onHome(){if(viewer.viewport){viewer.viewport.goHome();}}
function onFullPage(){viewer.setFullPage(!viewer.isFullPage());group.emulateExit();if(viewer.viewport){viewer.viewport.applyConstraints();}}
function beginZoomingIn(){lastZoomTime=new Date().getTime();zoomFactor=Seadragon.Config.zoomPerSecond;zooming=true;scheduleZoom();}
function beginZoomingOut(){lastZoomTime=new Date().getTime();zoomFactor=1.0/Seadragon.Config.zoomPerSecond;zooming=true;scheduleZoom();}
function endZooming(){zooming=false;}
function scheduleZoom(){window.setTimeout(doZoom,10);}
function doZoom(){if(zooming&&viewer.viewport){var currentTime=new Date().getTime();var deltaTime=currentTime-lastZoomTime;var adjustedFactor=Math.pow(zoomFactor,deltaTime/1000);viewer.viewport.zoomBy(adjustedFactor);viewer.viewport.applyConstraints();lastZoomTime=currentTime;scheduleZoom();}}
function doSingleZoomIn(){if(viewer.viewport){zooming=false;viewer.viewport.zoomBy(Seadragon.Config.zoomPerClick/1.0);viewer.viewport.applyConstraints();}}
function doSingleZoomOut(){if(viewer.viewport){zooming=false;viewer.viewport.zoomBy(1.0/Seadragon.Config.zoomPerClick);viewer.viewport.applyConstraints();}}
function lightUp(){group.emulateEnter();group.emulateExit();}
function url(prefix,postfix){return Seadragon.Config.imagePath+prefix+postfix;}
var zoomIn=new Seadragon.Button(Seadragon.Strings.getString("Tooltips.ZoomIn"),url(ZOOM_IN,REST),url(ZOOM_IN,GROUP),url(ZOOM_IN,HOVER),url(ZOOM_IN,DOWN),beginZoomingIn,endZooming,doSingleZoomIn,beginZoomingIn,endZooming);var zoomOut=new Seadragon.Button(Seadragon.Strings.getString("Tooltips.ZoomOut"),url(ZOOM_OUT,REST),url(ZOOM_OUT,GROUP),url(ZOOM_OUT,HOVER),url(ZOOM_OUT,DOWN),beginZoomingOut,endZooming,doSingleZoomOut,beginZoomingOut,endZooming);var goHome=new Seadragon.Button(Seadragon.Strings.getString("Tooltips.Home"),url(HOME,REST),url(HOME,GROUP),url(HOME,HOVER),url(HOME,DOWN),null,onHome,null,null,null);var fullPage=new Seadragon.Button(Seadragon.Strings.getString("Tooltips.FullPage"),url(FULL_PAGE,REST),url(FULL_PAGE,GROUP),url(FULL_PAGE,HOVER),url(FULL_PAGE,DOWN),null,onFullPage,null,null,null);group=new Seadragon.ButtonGroup([zoomIn,zoomOut,goHome,fullPage]);group.elmt[SIGNAL]=true;viewer.addEventListener("open",lightUp);return group.elmt;}
Seadragon.Viewer=function(container){var self=this;var parent=Seadragon.Utils.getElement(container);var container=Seadragon.Utils.makeNeutralElement("div");var canvas=Seadragon.Utils.makeNeutralElement("div");var controlsTL=Seadragon.Utils.makeNeutralElement("div");var controlsTR=Seadragon.Utils.makeNeutralElement("div");var controlsBR=Seadragon.Utils.makeNeutralElement("div");var controlsBL=Seadragon.Utils.makeNeutralElement("div");var source=null;var drawer=null;var viewport=null;var profiler=null;var eventManager=new Seadragon.EventManager();var innerTracker=new Seadragon.MouseTracker(canvas);var outerTracker=new Seadragon.MouseTracker(container);var controls=[];var controlsShouldFade=true;var controlsFadeBeginTime=null;var navControl=null;var controlsFadeDelay=1000;var controlsFadeLength=2000;var controlsFadeBeginTime=null;var controlsShouldFade=false;var bodyWidth=document.body.style.width;var bodyHeight=document.body.style.height;var bodyOverflow=document.body.style.overflow;var docOverflow=document.documentElement.style.overflow;var fsBoundsDelta=new Seadragon.Point(1,1);var prevContainerSize=null;var lastOpenStartTime=0;var lastOpenEndTime=0;var animating=false;var forceRedraw=false;var mouseInside=false;this.elmt=container;this.source=null;this.drawer=null;this.viewport=null;this.profiler=null;function initialize(){var canvasStyle=canvas.style;var containerStyle=container.style;var controlsTLStyle=controlsTL.style;var controlsTRStyle=controlsTR.style;var controlsBRStyle=controlsBR.style;var controlsBLStyle=controlsBL.style;containerStyle.width="100%";containerStyle.height="100%";containerStyle.position="relative";containerStyle.left="0px";containerStyle.top="0px";containerStyle.textAlign="left";canvasStyle.width="100%";canvasStyle.height="100%";canvasStyle.overflow="hidden";canvasStyle.position="absolute";canvasStyle.top="0px";canvasStyle.left="0px";controlsTLStyle.position=controlsTRStyle.position=controlsBRStyle.position=controlsBLStyle.position="absolute";controlsTLStyle.top=controlsTRStyle.top="0px";controlsTLStyle.left=controlsBLStyle.left="0px";controlsTRStyle.right=controlsBRStyle.right="0px";controlsBLStyle.bottom=controlsBRStyle.bottom="0px";innerTracker.clickHandler=onCanvasClick;innerTracker.dragHandler=onCanvasDrag;innerTracker.releaseHandler=onCanvasRelease;innerTracker.scrollHandler=onCanvasScroll;innerTracker.setTracking(true);navControl=makeNavControl(self);navControl.style.marginRight="4px";navControl.style.marginBottom="4px";self.addControl(navControl,Anchor.BOTTOM_RIGHT);outerTracker.enterHandler=onContainerEnter;outerTracker.exitHandler=onContainerExit;outerTracker.releaseHandler=onContainerRelease;outerTracker.setTracking(true);window.setTimeout(beginControlsAutoHide,1);container.appendChild(canvas);container.appendChild(controlsTL);container.appendChild(controlsTR);container.appendChild(controlsBR);container.appendChild(controlsBL);parent.innerHTML="";parent.appendChild(container);}
function setMessage(message){var textNode=document.createTextNode(message);canvas.innerHTML="";canvas.appendChild(Seadragon.Utils.makeCenteredNode(textNode));var textStyle=textNode.parentNode.style;textStyle.color="white";textStyle.fontFamily="verdana";textStyle.fontSize="13px";textStyle.fontSizeAdjust="none";textStyle.fontStyle="normal";textStyle.fontStretch="normal";textStyle.fontVariant="normal";textStyle.fontWeight="normal";textStyle.lineHeight="1em";textStyle.textAlign="center";textStyle.textDecoration="none";}
function beforeOpen(){if(source){onClose();}
lastOpenStartTime=new Date().getTime();window.setTimeout(function(){if(lastOpenStartTime>lastOpenEndTime){setMessage(Seadragon.Strings.getString("Messages.Loading"));}},2000);return lastOpenStartTime;}
function onOpen(time,_source,error){lastOpenEndTime=new Date().getTime();if(time<lastOpenStartTime){Seadragon.Debug.log("Ignoring out-of-date open.");eventManager.trigger("ignore",self);return;}else if(!_source){setMessage(error);eventManager.trigger("error",self);return;}
canvas.innerHTML="";prevContainerSize=Seadragon.Utils.getElementSize(container);source=_source;viewport=new Seadragon.Viewport(prevContainerSize,source.dimensions);drawer=new Seadragon.Drawer(source,viewport,canvas);profiler=new Seadragon.Profiler();self.source=source;self.viewport=viewport;self.drawer=drawer;self.profiler=profiler;animating=false;forceRedraw=true;scheduleUpdate(updateMulti);eventManager.trigger("open",self);}
function onClose(){self.source=source=null;self.viewport=viewport=null;self.drawer=drawer=null;self.profiler=profiler=null;canvas.innerHTML="";}
function scheduleUpdate(updateFunc,prevUpdateTime){if(animating){return window.setTimeout(updateFunc,1);}
var currentTime=new Date().getTime();var prevUpdateTime=prevUpdateTime?prevUpdateTime:currentTime;var targetTime=prevUpdateTime+1000/60;var deltaTime=Math.max(1,targetTime-currentTime);return window.setTimeout(updateFunc,deltaTime);}
function updateOnce(){if(!source){return;}
profiler.beginUpdate();var containerSize=Seadragon.Utils.getElementSize(container);if(!containerSize.equals(prevContainerSize)){viewport.resize(containerSize,true);prevContainerSize=containerSize;eventManager.trigger("resize",self);}
var animated=viewport.update();if(!animating&&animated){eventManager.trigger("animationstart",self);abortControlsAutoHide();}
if(animated){drawer.update();eventManager.trigger("animation",self);}else if(forceRedraw||drawer.needsUpdate()){drawer.update();forceRedraw=false;}else{drawer.idle();}
if(animating&&!animated){eventManager.trigger("animationfinish",self);if(!mouseInside){beginControlsAutoHide();}}
animating=animated;profiler.endUpdate();}
function updateMulti(){if(!source){return;}
var beginTime=new Date().getTime();updateOnce();scheduleUpdate(arguments.callee,beginTime);}
function getControlIndex(elmt){for(var i=controls.length-1;i>=0;i--){if(controls[i].elmt==elmt){return i;}}
return-1;}
function scheduleControlsFade(){window.setTimeout(updateControlsFade,20);}
function updateControlsFade(){if(controlsShouldFade){var currentTime=new Date().getTime();var deltaTime=currentTime-controlsFadeBeginTime;var opacity=1.0-deltaTime/controlsFadeLength;opacity=Math.min(1.0,opacity);opacity=Math.max(0.0,opacity);for(var i=controls.length-1;i>=0;i--){controls[i].setOpacity(opacity);}
if(opacity>0){scheduleControlsFade();}}}
function abortControlsAutoHide(){controlsShouldFade=false;for(var i=controls.length-1;i>=0;i--){controls[i].setOpacity(1.0);}}
function beginControlsAutoHide(){if(!Seadragon.Config.autoHideControls){return;}
controlsShouldFade=true;controlsFadeBeginTime=new Date().getTime()+controlsFadeDelay;window.setTimeout(scheduleControlsFade,controlsFadeDelay);}
function onContainerEnter(tracker,position,buttonDownElmt,buttonDownAny){mouseInside=true;abortControlsAutoHide();}
function onContainerExit(tracker,position,buttonDownElmt,buttonDownAny){if(!buttonDownElmt){mouseInside=false;if(!animating){beginControlsAutoHide();}}}
function onContainerRelease(tracker,position,insideElmtPress,insideElmtRelease){if(!insideElmtRelease){mouseInside=false;if(!animating){beginControlsAutoHide();}}}
function onCanvasClick(tracker,position,quick,shift){if(viewport&&quick){var zoomPerClick=Seadragon.Config.zoomPerClick;var factor=shift?1.0/zoomPerClick:zoomPerClick;viewport.zoomBy(factor,viewport.pointFromPixel(position,true));viewport.applyConstraints();}}
function onCanvasDrag(tracker,position,delta,shift){if(viewport){viewport.panBy(viewport.deltaPointsFromPixels(delta.negate()));}}
function onCanvasRelease(tracker,position,insideElmtPress,insideElmtRelease){if(insideElmtPress&&viewport){viewport.applyConstraints();}}
function onCanvasScroll(tracker,position,delta,shift){if(viewport){var factor=Math.pow(Seadragon.Config.zoomPerScroll,delta);viewport.zoomBy(factor,viewport.pointFromPixel(position,true));viewport.applyConstraints();}}
this.isOpen=function(){return!!source;};this.openDzi=function(xmlUrl,xmlString){var currentTime=beforeOpen();Seadragon.DziTileSource.createFromXml(xmlUrl,xmlString,Seadragon.Utils.createCallback(null,onOpen,currentTime));};this.openTileSource=function(tileSource){var currentTime=beforeOpen();window.setTimeout(function(){onOpen(currentTime,tileSource);},1);};this.close=function(){if(!source){return;}
onClose();};this.addControl=function(elmt,anchor){var elmt=Seadragon.Utils.getElement(elmt);if(getControlIndex(elmt)>=0){return;}
var div=null;switch(anchor){case Anchor.TOP_RIGHT:div=controlsTR;elmt.style.position="relative";break;case Anchor.BOTTOM_RIGHT:div=controlsBR;elmt.style.position="relative";break;case Anchor.BOTTOM_LEFT:div=controlsBL;elmt.style.position="relative";break;case Anchor.TOP_LEFT:div=controlsTL;elmt.style.position="relative";break;case Anchor.NONE:default:div=container;elmt.style.position="absolute";break;}
controls.push(new Control(elmt,anchor,div));};this.removeControl=function(elmt){var elmt=Seadragon.Utils.getElement(elmt);var i=getControlIndex(elmt);if(i>=0){controls[i].destroy();controls.splice(i,1);}};this.clearControls=function(){while(controls.length>0){controls.pop().destroy();}};this.getNavControl=function(){return navControl;};this.isDashboardEnabled=function(){for(var i=controls.length-1;i>=0;i--){if(controls[i].isVisible()){return true;}}
return false;};this.isFullPage=function(){return container.parentNode==document.body;};this.isMouseNavEnabled=function(){return innerTracker.isTracking();};this.isVisible=function(){return container.style.visibility!="hidden";};this.setDashboardEnabled=function(enabled){for(var i=controls.length-1;i>=0;i--){controls[i].setVisible(enabled);}};this.setFullPage=function(fullPage){if(fullPage==self.isFullPage()){return;}
var body=document.body;var bodyStyle=body.style;var docStyle=document.documentElement.style;var containerStyle=container.style;var canvasStyle=canvas.style;if(fullPage){bodyOverflow=bodyStyle.overflow;docOverflow=docStyle.overflow;bodyStyle.overflow="hidden";docStyle.overflow="hidden";bodyWidth=bodyStyle.width;bodyHeight=bodyStyle.height;bodyStyle.width="100%";bodyStyle.height="100%";canvasStyle.backgroundColor="black";canvasStyle.color="white";containerStyle.position="fixed";containerStyle.zIndex="99999999";body.appendChild(container);prevContainerSize=Seadragon.Utils.getWindowSize();onContainerEnter();}else{bodyStyle.overflow=bodyOverflow;docStyle.overflow=docOverflow;bodyStyle.width=bodyWidth;bodyStyle.height=bodyHeight;canvasStyle.backgroundColor="";canvasStyle.color="";containerStyle.position="relative";containerStyle.zIndex="";parent.appendChild(container);prevContainerSize=Seadragon.Utils.getElementSize(parent);onContainerExit();}
if(viewport){var oldBounds=viewport.getBounds();viewport.resize(prevContainerSize);var newBounds=viewport.getBounds();if(fullPage){fsBoundsDelta=new Seadragon.Point(newBounds.width/oldBounds.width,newBounds.height/oldBounds.height);}else{viewport.update();viewport.zoomBy(Math.max(fsBoundsDelta.x,fsBoundsDelta.y),null,true);}
forceRedraw=true;eventManager.trigger("resize",self);updateOnce();}};this.setMouseNavEnabled=function(enabled){innerTracker.setTracking(enabled);};this.setVisible=function(visible){container.style.visibility=visible?"":"hidden";};this.addEventListener=function(eventName,handler){eventManager.addListener(eventName,handler);};this.removeEventListener=function(eventName,handler){eventManager.removeListener(eventName,handler);};initialize();};})();Seadragon.Config.imagePath="http://seadragon.com/ajax/0.8/img/";

(function($) {
	
	//If the UI scope is not available, add it
	$.ui = $.ui || {};
	
	//Add methods that are vital for all mouse interaction stuff (plugin registering)
	$.extend($.ui, {
		plugin: {
			add: function(module, option, set) {
				var proto = $.ui[module].prototype;
				for(var i in set) {
					proto.plugins[i] = proto.plugins[i] || [];
					proto.plugins[i].push([option, set[i]]);
				}
			},
			call: function(instance, name, arguments) {
				var set = instance.plugins[name]; if(!set) return;
				for (var i = 0; i < set.length; i++) {
					if (instance.options[set[i][0]]) set[i][1].apply(instance.element, arguments);
				}
			}	
		},
		cssCache: {},
		css: function(name) {
			if ($.ui.cssCache[name]) return $.ui.cssCache[name];
			
			var tmp = $("<div class='ui-resizable-gen'>").addClass(name).css(
				{position:'absolute', top:'-5000px', left:'-5000px', display:'block'}
			).appendTo('body');
			
			//Opera and Safari set width and height to 0px instead of auto
			//Safari returns rgba(0,0,0,0) when bgcolor is not set
			$.ui.cssCache[name] = !!(
				(/^[1-9]/.test(tmp.css('height')) || /^[1-9]/.test(tmp.css('width')) || 
				!/none/.test(tmp.css('backgroundImage')) || !/transparent|rgba\(0, 0, 0, 0\)/.test(tmp.css('backgroundColor')))
			);
			try { $('body').get(0).removeChild(tmp.get(0));	} catch(e){}
			return $.ui.cssCache[name];
		},
		disableSelection: function(e) {
			if (!e) return;
			e.unselectable = "on";
			e.onselectstart = function() {	return false; };
			if (e.style) e.style.MozUserSelect = "none";
		},
		enableSelection: function(e) {
			if (!e) return;
			e.unselectable = "off";
			e.onselectstart = function() { return true; };
			if (e.style) e.style.MozUserSelect = "";
		}
	});
	
	/********************************************************************************************************/

	$.fn.extend({
		mouseInteraction: function(o) {
			return this.each(function() {
				new $.ui.mouseInteraction(this, o);
			});
		},
		removeMouseInteraction: function(o) {
			return this.each(function() {
				if($.data(this, "ui-mouse"))
					$.data(this, "ui-mouse").destroy();
			});
		}
	});
	
	/********************************************************************************************************/
	
	$.ui.mouseInteraction = function(element, options) {
	
		var self = this;
		this.element = element;
		$.data(this.element, "ui-mouse", this);
		this.options = $.extend({}, options);
		
		$(element).bind('mousedown.draggable', function() { return self.click.apply(self, arguments); });
		if($.browser.msie) $(element).attr('unselectable', 'on'); //Prevent text selection in IE
		
	};
	
	$.extend($.ui.mouseInteraction.prototype, {
		
		destroy: function() { $(this.element).unbind('mousedown.draggable'); },
		trigger: function() { return this.click.apply(this, arguments); },
		click: function(e) {
			
			if(
				   e.which != 1 //only left click starts dragging
				|| $.inArray(e.target.nodeName.toLowerCase(), this.options.dragPrevention) != -1 // Prevent execution on defined elements
				|| (this.options.condition && !this.options.condition.apply(this.options.executor || this, [e, this.element])) //Prevent execution on condition
			) return true;
			
			var self = this;
			var initialize = function() {
				self._MP = { left: e.pageX, top: e.pageY }; // Store the click mouse position
				$(document).bind('mouseup.draggable', function() { return self.stop.apply(self, arguments); });
				$(document).bind('mousemove.draggable', function() { return self.drag.apply(self, arguments); });
			};

			if(this.options.delay) {
				if(this.timer) clearInterval(this.timer);
				this.timer = setTimeout(initialize, this.options.delay);
			} else {
				initialize();
			}
			
			return false;
			
		},
		stop: function(e) {			
			
			var o = this.options;
			if(!this.initialized) return $(document).unbind('mouseup.draggable').unbind('mousemove.draggable');

			if(this.options.stop) this.options.stop.call(this.options.executor || this, e, this.element);
			$(document).unbind('mouseup.draggable').unbind('mousemove.draggable');
			this.initialized = false;
			return false;
			
		},
		drag: function(e) {

			var o = this.options;
			if ($.browser.msie && !e.button) return this.stop.apply(this, [e]); // IE mouseup check
			
			if(!this.initialized && (Math.abs(this._MP.left-e.pageX) >= o.distance || Math.abs(this._MP.top-e.pageY) >= o.distance)) {
				if(this.options.start) this.options.start.call(this.options.executor || this, e, this.element);
				this.initialized = true;
			} else {
				if(!this.initialized) return false;
			}

			if(o.drag) o.drag.call(this.options.executor || this, e, this.element);
			return false;
			
		}
	});

 })(jQuery);

(function($) {

	$.fn.extend({
		slider: function(options) {
			var args = Array.prototype.slice.call(arguments, 1);
			
			if ( options == "value" )
				return $.data(this[0], "ui-slider").value(arguments[1]);
			
			return this.each(function() {
				if (typeof options == "string") {
					var slider = $.data(this, "ui-slider");
					slider[options].apply(slider, args);

				} else if(!$.data(this, "ui-slider"))
					new $.ui.slider(this, options);
			});
		}
	});
	
	$.ui.slider = function(element, options) {

		//Initialize needed constants
		var self = this;
		this.element = $(element);
		$.data(element, "ui-slider", this);
		this.element.addClass("ui-slider");
		
		//Prepare the passed options
		this.options = $.extend({}, options);
		var o = this.options;
		$.extend(o, {
			axis: o.axis || (element.offsetWidth < element.offsetHeight ? 'vertical' : 'horizontal'),
			maxValue: !isNaN(parseInt(o.maxValue)) ? parseInt(o.maxValue) :  100,
			minValue: parseInt(o.minValue) || 0,
			startValue: parseInt(o.startValue) || 'none'		
		});
		
		//Prepare the real maxValue
		o.realMaxValue = o.maxValue - o.minValue;
		
		//Calculate stepping based on steps
		o.stepping = parseInt(o.stepping) || (o.steps ? o.realMaxValue/o.steps : 0);
		
		$(element).bind("setData.slider", function(event, key, value){
			self.options[key] = value;
		}).bind("getData.slider", function(event, key){
			return self.options[key];
		});

		//Initialize mouse and key events for interaction
		this.handle = o.handle ? $(o.handle, element) : $('> *', element);
		$(this.handle)
			.mouseInteraction({
				executor: this,
				delay: o.delay,
				distance: o.distance || 0,
				dragPrevention: o.prevention ? o.prevention.toLowerCase().split(',') : ['input','textarea','button','select','option'],
				start: this.start,
				stop: this.stop,
				drag: this.drag,
				condition: function(e, handle) {
					if(!this.disabled) {
						if(this.currentHandle) this.blur(this.currentHandle);
						this.focus(handle,1);
						return !this.disabled;
					}
				}
			})
			.wrap('<a href="javascript:void(0)"></a>')
			.parent()
				.bind('focus', function(e) { self.focus(this.firstChild); })
				.bind('blur', function(e) { self.blur(this.firstChild); })
				.bind('keydown', function(e) {
					if(/(37|39)/.test(e.keyCode))
						self.moveTo((e.keyCode == 37 ? '-' : '+')+'='+(self.options.stepping ? self.options.stepping : (self.options.realMaxValue / self.size)*5),this.firstChild);
				})
		;
		
		//Position the node
		if(o.helper == 'original' && (this.element.css('position') == 'static' || this.element.css('position') == '')) this.element.css('position', 'relative');
		
		//Prepare dynamic properties for later use
		if(o.axis == 'horizontal') {
			this.size = this.element.outerWidth();
			this.properties = ['left', 'width'];
		} else {
			this.size = this.element.outerHeight();
			this.properties = ['top', 'height'];
		}
		
		//Bind the click to the slider itself
		this.element.bind('click', function(e) { self.click.apply(self, [e]); });
		
		//Move the first handle to the startValue
		if(!isNaN(o.startValue)) this.moveTo(o.startValue, 0);
		
		//If we only have one handle, set the previous handle to this one to allow clicking before selecting the handle
		if(this.handle.length == 1) this.previousHandle = this.handle;
		
		
		if(this.handle.length == 2 && o.range) this.createRange();
	
	};
	
	$.extend($.ui.slider.prototype, {
		plugins: {},
		createRange: function() {
			this.rangeElement = $('<div></div>')
				.addClass('ui-slider-range')
				.css({ position: 'absolute' })
				.css(this.properties[0], parseInt($(this.handle[0]).css(this.properties[0])) + this.handleSize(0)/2)
				.css(this.properties[1], parseInt($(this.handle[1]).css(this.properties[0])) - parseInt($(this.handle[0]).css(this.properties[0])))
				.appendTo(this.element);
		},
		updateRange: function() {
				this.rangeElement.css(this.properties[0], parseInt($(this.handle[0]).css(this.properties[0])) + this.handleSize(0)/2);
				this.rangeElement.css(this.properties[1], parseInt($(this.handle[1]).css(this.properties[0])) - parseInt($(this.handle[0]).css(this.properties[0])));
		},
		getRange: function() {
			return this.rangeElement ? this.convertValue(parseInt(this.rangeElement.css(this.properties[1]))) : null;
		},
		ui: function(e) {
			return {
				instance: this,
				options: this.options,
				handle: this.currentHandle,
				value: this.value(),
				range: this.getRange()
			};
		},
		propagate: function(n,e) {
			$.ui.plugin.call(this, n, [e, this.ui()]);
			this.element.triggerHandler(n == "slide" ? n : "slide"+n, [e, this.ui()], this.options[n]);
		},
		destroy: function() {
			this.element
				.removeClass("ui-slider ui-slider-disabled")
				.removeData("ul-slider")
				.unbind(".slider");
			this.handles.removeMouseInteraction();
		},
		enable: function() {
			this.element.removeClass("ui-slider-disabled");
			this.disabled = false;
		},
		disable: function() {
			this.element.addClass("ui-slider-disabled");
			this.disabled = true;
		},
		focus: function(handle,hard) {
			this.currentHandle = $(handle).addClass('ui-slider-handle-active');
			if(hard) this.currentHandle.parent()[0].focus();
		},
		blur: function(handle) {
			$(handle).removeClass('ui-slider-handle-active');
			if(this.currentHandle && this.currentHandle[0] == handle) { this.previousHandle = this.currentHandle; this.currentHandle = null; };
		},
		value: function(handle) {
			if(this.handle.length == 1) this.currentHandle = this.handle;
			return ((parseInt($(handle != undefined ? this.handle[handle] || handle : this.currentHandle).css(this.properties[0])) / (this.size - this.handleSize())) * this.options.realMaxValue) + this.options.minValue;
		},
		convertValue: function(value) {
			return (value / (this.size - this.handleSize())) * this.options.realMaxValue;
		},
		translateValue: function(value) {
			return ((value - this.options.minValue) / this.options.realMaxValue) * (this.size - this.handleSize());
		},
		handleSize: function(handle) {
			return $(handle != undefined ? this.handle[handle] : this.currentHandle)['outer'+this.properties[1].substr(0,1).toUpperCase()+this.properties[1].substr(1)]();	
		},
		click: function(e) {
		
			// This method is only used if:
			// - The user didn't click a handle
			// - The Slider is not disabled
			// - There is a current, or previous selected handle (otherwise we wouldn't know which one to move)
			var pointer = [e.pageX,e.pageY];
			var clickedHandle = false; this.handle.each(function() { if(this == e.target) clickedHandle = true;  });
			if(clickedHandle || this.disabled || !(this.currentHandle || this.previousHandle)) return;

			//If a previous handle was focussed, focus it again
			if(this.previousHandle) this.focus(this.previousHandle, 1);
			
			//Move focussed handle to the clicked position
			this.offset = this.element.offset();
			this.moveTo(this.convertValue(e[this.properties[0] == 'top' ? 'pageY' : 'pageX'] - this.offset[this.properties[0]] - this.handleSize()/2));
			
		},
		start: function(e, handle) {
			
			var o = this.options;
			
			this.offset = this.element.offset();
			this.handleOffset = this.currentHandle.offset();
			this.clickOffset = { top: e.pageY - this.handleOffset.top, left: e.pageX - this.handleOffset.left };
			this.firstValue = this.value();
			
			this.propagate('start', e);
			return false;
						
		},
		stop: function(e) {
			this.propagate('stop', e);
			if(this.firstValue != this.value()) this.propagate('change', e);
			return false;
		},
		drag: function(e, handle) {

			var o = this.options;
			var position = { top: e.pageY - this.offset.top - this.clickOffset.top, left: e.pageX - this.offset.left - this.clickOffset.left};

			var modifier = position[this.properties[0]];			
			if(modifier >= this.size - this.handleSize()) modifier = this.size - this.handleSize();
			if(modifier <= 0) modifier = 0;
			
			if(o.stepping) {
				var value = this.convertValue(modifier);
				value = Math.round(value / o.stepping) * o.stepping;
				modifier = this.translateValue(value);	
			}

			if(this.rangeElement) {
				if(this.currentHandle[0] == this.handle[0] && modifier >= this.translateValue(this.value(1))) modifier = this.translateValue(this.value(1));
				if(this.currentHandle[0] == this.handle[1] && modifier <= this.translateValue(this.value(0))) modifier = this.translateValue(this.value(0));
			}	
			
			this.currentHandle.css(this.properties[0], modifier);
			if(this.rangeElement) this.updateRange();
			this.propagate('slide', e);
			return false;
			
		},
		moveTo: function(value, handle) {

			var o = this.options;
			if(handle == undefined && !this.currentHandle && this.handle.length != 1) return false; //If no handle has been passed, no current handle is available and we have multiple handles, return false
			if(handle == undefined && !this.currentHandle) handle = 0; //If only one handle is available, use it
			if(handle != undefined) this.currentHandle = this.previousHandle = $(this.handle[handle] || handle);

			if(value.constructor == String) value = /\-\=/.test(value) ? this.value() - parseInt(value.replace('-=', '')) : this.value() + parseInt(value.replace('+=', ''));
			if(o.stepping) value = Math.round(value / o.stepping) * o.stepping;
			value = this.translateValue(value);

			if(value >= this.size - this.handleSize()) value = this.size - this.handleSize();
			if(value <= 0) value = 0;
			if(this.rangeElement) {
				if(this.currentHandle[0] == this.handle[0] && value >= this.translateValue(this.value(1))) value = this.translateValue(this.value(1));
				if(this.currentHandle[0] == this.handle[1] && value <= this.translateValue(this.value(0))) value = this.translateValue(this.value(0));
			}
			
			this.currentHandle.css(this.properties[0], value);
			if(this.rangeElement) this.updateRange();
			
			this.propagate('start', null);
			this.propagate('stop', null);
			this.propagate('change', null);

		}
	});

})(jQuery);

/// <reference path="jquery-1.2.3.intellisense.js" />  

/*
 * Thickbox 3.1 - One Box To Rule Them All.
 * By Cody Lindley (http://www.codylindley.com)
 * Copyright (c) 2007 cody lindley
 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
*/
		  
var tb_pathToImage = "/images/loadingAnimation.gif";

/*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/

//on page load call tb_init
$(document).ready(function(){   
	tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox
	imgLoader = new Image();// preload image
	imgLoader.src = tb_pathToImage;
});

//add thickbox to href & area elements that have a class of .thickbox
function tb_init(domChunk){
	$(domChunk).click(function(){
	var t = this.title || this.name || null;
	var a = this.href || this.alt;
	var g = this.rel || false;
	tb_show(t,a,g);
	this.blur();
	return false;
	});
}

function tb_show(caption, url, imageGroup) {//function called when the user clicks on a thickbox link

	try {
		if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
			$("body","html").css({height: "100%", width: "100%"});
			$("html").css("overflow","hidden");
			if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6
				$("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
				$("#TB_overlay").click(tb_remove);
			}
		}else{//all others
			if(document.getElementById("TB_overlay") === null){
				$("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");
				$("#TB_overlay").click(tb_remove);
			}
		}
		
		if(tb_detectMacXFF()){
			$("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash
		}else{
			$("#TB_overlay").addClass("TB_overlayBG");//use background and opacity
		}
		
		if(caption===null){caption="";}
		$("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' /></div>");//add loader to the page
		$('#TB_load').show();//show loader
		
		var baseURL;
	   if(url.indexOf("?")!==-1){ //ff there is a query string involved
			baseURL = url.substr(0, url.indexOf("?"));
	   }else{ 
	   		baseURL = url;
	   }
	   
	   var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/;
	   var urlType = baseURL.toLowerCase().match(urlString);

		if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images
				
			TB_PrevCaption = "";
			TB_PrevURL = "";
			TB_PrevHTML = "";
			TB_NextCaption = "";
			TB_NextURL = "";
			TB_NextHTML = "";
			TB_imageCount = "";
			TB_FoundURL = false;
			if(imageGroup){
				TB_TempArray = $("a[@rel="+imageGroup+"]").get();
				for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) {
					var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString);
						if (!(TB_TempArray[TB_Counter].href == url)) {						
							if (TB_FoundURL) {
								TB_NextCaption = TB_TempArray[TB_Counter].title;
								TB_NextURL = TB_TempArray[TB_Counter].href;
								TB_NextHTML = "<span id='TB_next'>&nbsp;&nbsp;<a href='#'>Next &gt;</a></span>";
							} else {
								TB_PrevCaption = TB_TempArray[TB_Counter].title;
								TB_PrevURL = TB_TempArray[TB_Counter].href;
								TB_PrevHTML = "<span id='TB_prev'>&nbsp;&nbsp;<a href='#'>&lt; Prev</a></span>";
							}
						} else {
							TB_FoundURL = true;
							TB_imageCount = "Image " + (TB_Counter + 1) +" of "+ (TB_TempArray.length);											
						}
				}
			}

			imgPreloader = new Image();
			imgPreloader.onload = function(){		
			imgPreloader.onload = null;
				
			// Resizing large images - orginal by Christian Montoya edited by me.
			var pagesize = tb_getPageSize();
			var x = pagesize[0] - 150;
			var y = pagesize[1] - 150;
			var imageWidth = imgPreloader.width;
			var imageHeight = imgPreloader.height;
			if (imageWidth > x) {
				imageHeight = imageHeight * (x / imageWidth); 
				imageWidth = x; 
				if (imageHeight > y) { 
					imageWidth = imageWidth * (y / imageHeight); 
					imageHeight = y; 
				}
			} else if (imageHeight > y) { 
				imageWidth = imageWidth * (y / imageHeight); 
				imageHeight = y; 
				if (imageWidth > x) { 
					imageHeight = imageHeight * (x / imageWidth); 
					imageWidth = x;
				}
			}
			// End Resizing
			
			TB_WIDTH = imageWidth + 30;
			TB_HEIGHT = imageHeight + 30;
			//$("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>" + "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a> or Esc Key</div>"); 		
			
			$("#TB_closeWindowButton").click(tb_remove);
			
			if (!(TB_PrevHTML === "")) {
				function goPrev(){
					if($(document).unbind("click",goPrev)){$(document).unbind("click",goPrev);}
					$("#TB_window").remove();
					$("body").append("<div id='TB_window'></div>");
					tb_show(TB_PrevCaption, TB_PrevURL, imageGroup);
					return false;	
				}
				$("#TB_prev").click(goPrev);
			}
			
			if (!(TB_NextHTML === "")) {		
				function goNext(){
					$("#TB_window").remove();
					$("body").append("<div id='TB_window'></div>");
					tb_show(TB_NextCaption, TB_NextURL, imageGroup);				
					return false;	
				}
				$("#TB_next").click(goNext);
				
			}

			document.onkeydown = function(e){ 	
				if (e == null) { // ie
					keycode = event.keyCode;
				} else { // mozilla
					keycode = e.which;
				}
				if(keycode == 27){ // close
					tb_remove();
				} else if(keycode == 190){ // display previous image
					if(!(TB_NextHTML == "")){
						document.onkeydown = "";
						goNext();
					}
				} else if(keycode == 188){ // display next image
					if(!(TB_PrevHTML == "")){
						document.onkeydown = "";
						goPrev();
					}
				}	
			};
			
			tb_position();
			$("#TB_load").remove();
			$("#TB_ImageOff").click(tb_remove);
			$("#TB_window").css({display:"block"}); //for safari using css instead of show
			};
			
			imgPreloader.src = url;
		}else{//code to show html
			
			var queryString = url.replace(/^[^\?]+\??/,'');
			var params = tb_parseQuery( queryString );

			TB_WIDTH = (params['width']*1) + 30 || 630; //defaults to 630 if no paramaters were added to URL
			TB_HEIGHT = (params['height']*1) + 40 || 440; //defaults to 440 if no paramaters were added to URL
			ajaxContentW = TB_WIDTH - 30;
			ajaxContentH = TB_HEIGHT - 45;
			
			if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window		
					urlNoQuery = url.split('TB_');
					$("#TB_iframeContent").remove();
					if(params['modal'] != "true"){//iframe no modal
						$("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a> or Esc Key</div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' > </iframe>");
					}else{//iframe modal
					$("#TB_overlay").unbind();
						$("#TB_window").append("<iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;'> </iframe>");
					}
			}else{// not an iframe, ajax
					if($("#TB_window").css("display") != "block"){
						if(params['modal'] != "true"){//ajax no modal
						$("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>close</a> or Esc Key</div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div>");
						}else{//ajax modal
						$("#TB_overlay").unbind();
						$("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>");	
						}
					}else{//this means the window is already up, we are just loading new content via ajax
						$("#TB_ajaxContent")[0].style.width = ajaxContentW +"px";
						$("#TB_ajaxContent")[0].style.height = ajaxContentH +"px";
						$("#TB_ajaxContent")[0].scrollTop = 0;
						$("#TB_ajaxWindowTitle").html(caption);
					}
			}
					
			$("#TB_closeWindowButton").click(tb_remove);
			
				if(url.indexOf('TB_inline') != -1){	
					$("#TB_ajaxContent").append($('#' + params['inlineId']).children());
					$("#TB_window").unload(function () {
						$('#' + params['inlineId']).append( $("#TB_ajaxContent").children() ); // move elements back when you're finished
					});
					tb_position();
					$("#TB_load").remove();
					$("#TB_window").css({display:"block"}); 
				}else if(url.indexOf('TB_iframe') != -1){
					tb_position();
					if($.browser.safari){//safari needs help because it will not fire iframe onload
						$("#TB_load").remove();
						$("#TB_window").css({display:"block"});
					}
				}else{
					$("#TB_ajaxContent").load(url += "&random=" + (new Date().getTime()),function(){//to do a post change this load method
						tb_position();
						$("#TB_load").remove();
						tb_init("#TB_ajaxContent a.thickbox");
						$("#TB_window").css({display:"block"});
					});
				}
			
		}

		if(!params['modal']){
			document.onkeyup = function(e){ 	
				if (e == null) { // ie
					keycode = event.keyCode;
				} else { // mozilla
					keycode = e.which;
				}
				if(keycode == 27){ // close
					tb_remove();
				}	
			};
		}
		
	} catch(e) {
		//nothing here
	}
}

//helper functions below
function tb_showIframe(){
	$("#TB_load").remove();
	$("#TB_window").css({display:"block"});
}

function tb_remove() {
 	$("#TB_imageOff").unbind("click");
	$("#TB_closeWindowButton").unbind("click");
	
	$("#TB_window").hide(1,function(){
		$('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();
	});
	
	$("#TB_load").remove();
	if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
		$("body","html").css({height: "auto", width: "auto"});
		$("html").css("overflow","");
	}
	document.onkeydown = "";
	document.onkeyup = "";
	return false;
}

function tb_position() {
$("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'});
	if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6
		$("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
	}
}

function tb_parseQuery ( query ) {
   var Params = {};
   if ( ! query ) {return Params;}// return empty object
   var Pairs = query.split(/[;&]/);
   for ( var i = 0; i < Pairs.length; i++ ) {
      var KeyVal = Pairs[i].split('=');
      if ( ! KeyVal || KeyVal.length != 2 ) {continue;}
      var key = unescape( KeyVal[0] );
      var val = unescape( KeyVal[1] );
      val = val.replace(/\+/g, ' ');
      Params[key] = val;
   }
   return Params;
}

function tb_getPageSize(){
	var de = document.documentElement;
	var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
	var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
	arrayPageSize = [w,h];
	return arrayPageSize;
}

function tb_detectMacXFF() {
  var userAgent = navigator.userAgent.toLowerCase();
  if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
    return true;
  }
}




