/*
 * JSMin
 * Javascript Compressor
 * http://www.crockford.com/
 * http://www.smallsharptools.com/
*/

(function(){if(typeof jQuery!="undefined")
var _jQuery=jQuery;var jQuery=window.jQuery=function(a,c){if(window==this||!this.init)
return new jQuery(a,c);return this.init(a,c);};if(typeof $!="undefined")
var _$=$;window.$=jQuery;var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/;jQuery.fn=jQuery.prototype={init:function(a,c){a=a||document;if(typeof a=="string"){var m=quickExpr.exec(a);if(m&&(m[1]||!c)){if(m[1])
a=jQuery.clean([m[1]]);else{var tmp=document.getElementById(m[3]);if(tmp)
if(tmp.id!=m[3])
return jQuery().find(a);else{this[0]=tmp;this.length=1;return this;}
else
a=[];}}else
return new jQuery(c).find(a);}else if(jQuery.isFunction(a))
return new jQuery(document)[jQuery.fn.ready?"ready":"load"](a);return this.setArray(a.constructor==Array&&a||(a.jquery||a.length&&a!=window&&!a.nodeType&&a[0]!=undefined&&a[0].nodeType)&&jQuery.makeArray(a)||[a]);},jquery:"1.1.4",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(a){var ret=jQuery(a);ret.prevObject=this;return ret;},setArray:function(a){this.length=0;Array.prototype.push.apply(this,a);return this;},each:function(fn,args){return jQuery.each(this,fn,args);},index:function(obj){var pos=-1;this.each(function(i){if(this==obj)pos=i;});return pos;},attr:function(key,value,type){var obj=key;if(key.constructor==String)
if(value==undefined)
return this.length&&jQuery[type||"attr"](this[0],key)||undefined;else{obj={};obj[key]=value;}
return this.each(function(index){for(var prop in obj)
jQuery.attr(type?this.style:this,prop,jQuery.prop(this,obj[prop],type,index,prop));});},css:function(key,value){return this.attr(key,value,"curCSS");},text:function(e){if(typeof e!="object"&&e!=null)
return this.empty().append(document.createTextNode(e));var t="";jQuery.each(e||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)
t+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return t;},wrap:function(){var a,args=arguments;return this.each(function(){if(!a)
a=jQuery.clean(args,this.ownerDocument);var b=a[0].cloneNode(true);this.parentNode.insertBefore(b,this);while(b.firstChild)
b=b.firstChild;b.appendChild(this);});},append:function(){return this.domManip(arguments,true,1,function(a){this.appendChild(a);});},prepend:function(){return this.domManip(arguments,true,-1,function(a){this.insertBefore(a,this.firstChild);});},before:function(){return this.domManip(arguments,false,1,function(a){this.parentNode.insertBefore(a,this);});},after:function(){return this.domManip(arguments,false,-1,function(a){this.parentNode.insertBefore(a,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(t){var data=jQuery.map(this,function(a){return jQuery.find(t,a);});return this.pushStack(/[^+>] [^+>]/.test(t)||t.indexOf("..")>-1?jQuery.unique(data):data);},clone:function(deep){deep=deep!=undefined?deep:true;var $this=this.add(this.find("*"));if(jQuery.browser.msie){$this.each(function(){this._$events={};for(var type in this.$events)
this._$events[type]=jQuery.extend({},this.$events[type]);}).unbind();}
var r=this.pushStack(jQuery.map(this,function(a){return a.cloneNode(deep);}));if(jQuery.browser.msie){$this.each(function(){var events=this._$events;for(var type in events)
for(var handler in events[type])
jQuery.event.add(this,type,events[type][handler],events[type][handler].data);this._$events=null;});}
if(deep){var inputs=r.add(r.find('*')).filter('select,input[@type=checkbox]');$this.filter('select,input[@type=checkbox]').each(function(i){if(this.selectedIndex)
inputs[i].selectedIndex=this.selectedIndex;if(this.checked)
inputs[i].checked=true;});}
return r;},filter:function(t){return this.pushStack(jQuery.isFunction(t)&&jQuery.grep(this,function(el,index){return t.apply(el,[index]);})||jQuery.multiFilter(t,this));},not:function(t){return this.pushStack(t.constructor==String&&jQuery.multiFilter(t,this,true)||jQuery.grep(this,function(a){return(t.constructor==Array||t.jquery)?jQuery.inArray(a,t)<0:a!=t;}));},add:function(t){return this.pushStack(jQuery.merge(this.get(),t.constructor==String?jQuery(t).get():t.length!=undefined&&(!t.nodeName||t.nodeName=="FORM")?t:[t]));},is:function(expr){return expr?jQuery.multiFilter(expr,this).length>0:false;},val:function(val){return val==undefined?(this.length?this[0].value:null):this.attr("value",val);},html:function(val){return val==undefined?(this.length?this[0].innerHTML:null):this.empty().append(val);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},domManip:function(args,table,dir,fn){var clone=this.length>1,a;return this.each(function(){if(!a){a=jQuery.clean(args,this.ownerDocument);if(dir<0)
a.reverse();}
var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(a[0],"tr"))
obj=this.getElementsByTagName("tbody")[0]||this.appendChild(document.createElement("tbody"));jQuery.each(a,function(){if(jQuery.nodeName(this,"script")){if(this.src)
jQuery.ajax({url:this.src,async:false,dataType:"script"});else
jQuery.globalEval(this.text||this.textContent||this.innerHTML||"");}else
fn.apply(obj,[clone?this.cloneNode(true):this]);});});}};jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},a=1,al=arguments.length,deep=false;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};}
if(al==1){target=this;a=0;}
var prop;for(;a<al;a++)
if((prop=arguments[a])!=null)
for(var i in prop){if(target==prop[i])
continue;if(deep&&typeof prop[i]=='object'&&target[i])
jQuery.extend(target[i],prop[i]);else if(prop[i]!=undefined)
target[i]=prop[i];}
return target;};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&&/function/i.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){if(window.execScript)
window.execScript(data);else if(jQuery.browser.safari)
window.setTimeout(data,0);else
eval.call(window,data);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},each:function(obj,fn,args){if(args){if(obj.length==undefined)
for(var i in obj)
fn.apply(obj[i],args);else
for(var i=0,ol=obj.length;i<ol;i++)
if(fn.apply(obj[i],args)===false)break;}else{if(obj.length==undefined)
for(var i in obj)
fn.call(obj[i],i,obj[i]);else
for(var i=0,ol=obj.length,val=obj[0];i<ol&&fn.call(val,i,val)!==false;val=obj[++i]){}}
return obj;},prop:function(elem,value,type,index,prop){if(jQuery.isFunction(value))
value=value.call(elem,[index]);var exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i;return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(prop)?value+"px":value;},className:{add:function(elem,c){jQuery.each((c||"").split(/\s+/),function(i,cur){if(!jQuery.className.has(elem.className,cur))
elem.className+=(elem.className?" ":"")+cur;});},remove:function(elem,c){elem.className=c!=undefined?jQuery.grep(elem.className.split(/\s+/),function(cur){return!jQuery.className.has(c,cur);}).join(" "):"";},has:function(t,c){return jQuery.inArray(c,(t.className||t).toString().split(/\s+/))>-1;}},swap:function(e,o,f){for(var i in o){e.style["old"+i]=e.style[i];e.style[i]=o[i];}
f.apply(e,[]);for(var i in o)
e.style[i]=e.style["old"+i];},css:function(e,p){if(p=="height"||p=="width"){var old={},oHeight,oWidth,d=["Top","Bottom","Right","Left"];jQuery.each(d,function(){old["padding"+this]=0;old["border"+this+"Width"]=0;});jQuery.swap(e,old,function(){if(jQuery(e).is(':visible')){oHeight=e.offsetHeight;oWidth=e.offsetWidth;}else{e=jQuery(e.cloneNode(true)).find(":radio").removeAttr("checked").end().css({visibility:"hidden",position:"absolute",display:"block",right:"0",left:"0"}).appendTo(e.parentNode)[0];var parPos=jQuery.css(e.parentNode,"position")||"static";if(parPos=="static")
e.parentNode.style.position="relative";oHeight=e.clientHeight;oWidth=e.clientWidth;if(parPos=="static")
e.parentNode.style.position="static";e.parentNode.removeChild(e);}});return p=="height"?oHeight:oWidth;}
return jQuery.curCSS(e,p);},curCSS:function(elem,prop,force){var ret,stack=[],swap=[];function color(a){if(!jQuery.browser.safari)
return false;var ret=document.defaultView.getComputedStyle(a,null);return!ret||ret.getPropertyValue("color")=="";}
if(prop=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(elem.style,"opacity");return ret==""?"1":ret;}
if(prop.match(/float/i))
prop=styleFloat;if(!force&&elem.style[prop])
ret=elem.style[prop];else if(document.defaultView&&document.defaultView.getComputedStyle){if(prop.match(/float/i))
prop="float";prop=prop.replace(/([A-Z])/g,"-$1").toLowerCase();var cur=document.defaultView.getComputedStyle(elem,null);if(cur&&!color(elem))
ret=cur.getPropertyValue(prop);else{for(var a=elem;a&&color(a);a=a.parentNode)
stack.unshift(a);for(a=0;a<stack.length;a++)
if(color(stack[a])){swap[a]=stack[a].style.display;stack[a].style.display="block";}
ret=prop=="display"&&swap[stack.length-1]!=null?"none":document.defaultView.getComputedStyle(elem,null).getPropertyValue(prop)||"";for(a=0;a<swap.length;a++)
if(swap[a]!=null)
stack[a].style.display=swap[a];}
if(prop=="opacity"&&ret=="")
ret="1";}else if(elem.currentStyle){var newProp=prop.replace(/\-(\w)/g,function(m,c){return c.toUpperCase();});ret=elem.currentStyle[prop]||elem.currentStyle[newProp];}
return ret;},clean:function(a,doc){var r=[];doc=doc||document;jQuery.each(a,function(i,arg){if(!arg)return;if(arg.constructor==Number)
arg=arg.toString();if(typeof arg=="string"){var s=jQuery.trim(arg).toLowerCase(),div=doc.createElement("div"),tb=[];var wrap=!s.indexOf("<opt")&&[1,"<select>","</select>"]||!s.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||s.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!s.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!s.indexOf("<td")||!s.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!s.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+arg+wrap[2];while(wrap[0]--)
div=div.lastChild;if(jQuery.browser.msie){if(!s.indexOf("<table")&&s.indexOf("<tbody")<0)
tb=div.firstChild&&div.firstChild.childNodes;else if(wrap[1]=="<table>"&&s.indexOf("<tbody")<0)
tb=div.childNodes;for(var n=tb.length-1;n>=0;--n)
if(jQuery.nodeName(tb[n],"tbody")&&!tb[n].childNodes.length)
tb[n].parentNode.removeChild(tb[n]);if(/^\s/.test(arg))
div.insertBefore(doc.createTextNode(arg.match(/^\s*/)[0]),div.firstChild);}
arg=jQuery.makeArray(div.childNodes);}
if(0===arg.length&&(!jQuery.nodeName(arg,"form")&&!jQuery.nodeName(arg,"select")))
return;if(arg[0]==undefined||jQuery.nodeName(arg,"form")||arg.options)
r.push(arg);else
r=jQuery.merge(r,arg);});return r;},attr:function(elem,name,value){var fix=jQuery.isXMLDoc(elem)?{}:jQuery.props;if(name=="selected"&&jQuery.browser.safari)
elem.parentNode.selectedIndex;if(fix[name]){if(value!=undefined)elem[fix[name]]=value;return elem[fix[name]];}else if(jQuery.browser.msie&&name=="style")
return jQuery.attr(elem.style,"cssText",value);else if(value==undefined&&jQuery.browser.msie&&jQuery.nodeName(elem,"form")&&(name=="action"||name=="method"))
return elem.getAttributeNode(name).nodeValue;else if(elem.tagName){if(value!=undefined)elem.setAttribute(name,value);if(jQuery.browser.msie&&/href|src/.test(name)&&!jQuery.isXMLDoc(elem))
return elem.getAttribute(name,2);return elem.getAttribute(name);}else{if(name=="opacity"&&jQuery.browser.msie){if(value!=undefined){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+
(parseFloat(value).toString()=="NaN"?"":"alpha(opacity="+value*100+")");}
return elem.filter?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100).toString():"";}
name=name.replace(/-([a-z])/ig,function(z,b){return b.toUpperCase();});if(value!=undefined)elem[name]=value;return elem[name];}},trim:function(t){return(t||"").replace(/^\s+|\s+$/g,"");},makeArray:function(a){var r=[];if(typeof a!="array")
for(var i=0,al=a.length;i<al;i++)
r.push(a[i]);else
r=a.slice(0);return r;},inArray:function(b,a){for(var i=0,al=a.length;i<al;i++)
if(a[i]==b)
return i;return-1;},merge:function(first,second){if(jQuery.browser.msie){for(var i=0;second[i];i++)
if(second[i].nodeType!=8)
first.push(second[i]);}else
for(var i=0;second[i];i++)
first.push(second[i]);return first;},unique:function(first){var r=[],num=jQuery.mergeNum++;try{for(var i=0,fl=first.length;i<fl;i++)
if(num!=first[i].mergeNum){first[i].mergeNum=num;r.push(first[i]);}}catch(e){r=first;}
return r;},mergeNum:0,grep:function(elems,fn,inv){if(typeof fn=="string")
fn=eval("false||function(a,i){return "+fn+"}");var result=[];for(var i=0,el=elems.length;i<el;i++)
if(!inv&&fn(elems[i],i)||inv&&!fn(elems[i],i))
result.push(elems[i]);return result;},map:function(elems,fn){if(typeof fn=="string")
fn=eval("false||function(a){return "+fn+"}");var result=[];for(var i=0,el=elems.length;i<el;i++){var val=fn(elems[i],i);if(val!==null&&val!=undefined){if(val.constructor!=Array)val=[val];result=result.concat(val);}}
return result;}});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",styleFloat:jQuery.browser.msie?"styleFloat":"cssFloat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,innerHTML:"innerHTML",className:"className",value:"value",disabled:"disabled",checked:"checked",readonly:"readOnly",selected:"selected",maxlength:"maxLength"}});jQuery.each({parent:"a.parentNode",parents:"jQuery.parents(a)",next:"jQuery.nth(a,2,'nextSibling')",prev:"jQuery.nth(a,2,'previousSibling')",siblings:"jQuery.sibling(a.parentNode.firstChild,a)",children:"jQuery.sibling(a.firstChild)"},function(i,n){jQuery.fn[i]=function(a){var ret=jQuery.map(this,n);if(a&&typeof a=="string")
ret=jQuery.multiFilter(a,ret);return this.pushStack(jQuery.unique(ret));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after"},function(i,n){jQuery.fn[i]=function(){var a=arguments;return this.each(function(){for(var j=0,al=a.length;j<al;j++)
jQuery(a[j])[n](this);});};});jQuery.each({removeAttr:function(key){jQuery.attr(this,key,"");this.removeAttribute(key);},addClass:function(c){jQuery.className.add(this,c);},removeClass:function(c){jQuery.className.remove(this,c);},toggleClass:function(c){jQuery.className[jQuery.className.has(this,c)?"remove":"add"](this,c);},remove:function(a){if(!a||jQuery.filter(a,[this]).r.length)
this.parentNode.removeChild(this);},empty:function(){while(this.firstChild)
this.removeChild(this.firstChild);}},function(i,n){jQuery.fn[i]=function(){return this.each(n,arguments);};});jQuery.each(["eq","lt","gt","contains"],function(i,n){jQuery.fn[n]=function(num,fn){return this.filter(":"+n+"("+num+")",fn);};});jQuery.each(["height","width"],function(i,n){jQuery.fn[n]=function(h){return h==undefined?(this.length?jQuery.css(this[0],n):null):this.css(n,h.constructor==String?h:h+"px");};});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:{"":"m[2]=='*'||jQuery.nodeName(a,m[2])","#":"a.getAttribute('id')==m[2]",":":{lt:"i<m[3]-0",gt:"i>m[3]-0",nth:"m[3]-0==i",eq:"m[3]-0==i",first:"i==0",last:"i==r.length-1",even:"i%2==0",odd:"i%2","first-child":"a.parentNode.getElementsByTagName('*')[0]==a","last-child":"jQuery.nth(a.parentNode.lastChild,1,'previousSibling')==a","only-child":"!jQuery.nth(a.parentNode.lastChild,2,'previousSibling')",parent:"a.firstChild",empty:"!a.firstChild",contains:"(a.textContent||a.innerText||'').indexOf(m[3])>=0",visible:'"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden"',hidden:'"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden"',enabled:"!a.disabled",disabled:"a.disabled",checked:"a.checked",selected:"a.selected||jQuery.attr(a,'selected')",text:"'text'==a.type",radio:"'radio'==a.type",checkbox:"'checkbox'==a.type",file:"'file'==a.type",password:"'password'==a.type",submit:"'submit'==a.type",image:"'image'==a.type",reset:"'reset'==a.type",button:'"button"==a.type||jQuery.nodeName(a,"button")',input:"/input|select|textarea|button/i.test(a.nodeName)",has:"jQuery.find(m[3],a).length"},"[":"jQuery.find(m[2],a).length"},parse:[/^\[ *(@)([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(\[)\s*(.*?(\[.*?\])?[^[]*?)\s*\]/,/^(:)([\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)
context=null;context=context||document;if(!t.indexOf("//")){t=t.substr(2,t.length);}else if(!t.indexOf("/")&&!context.ownerDocument){context=context.documentElement;t=t.substr(1,t.length);if(t.indexOf("/")>=1)
t=t.substr(t.indexOf("/"),t.length);}
var ret=[context],done=[],last;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t).replace(/^\/\//,"");var foundToken=false;var re=quickChild;var m=re.exec(t);if(m){var 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.toUpperCase()))
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 nodeName=m[4],mergeNum=jQuery.mergeNum++;m=m[1];for(var j=0,rl=ret.length;j<rl;j++)
if(m.indexOf("..")<0){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling)
if(n.nodeType==1){if(m=="~"&&n.mergeNum==mergeNum)break;if(!nodeName||n.nodeName.toUpperCase()==nodeName.toUpperCase()){if(m=="~")n.mergeNum=mergeNum;r.push(n);}
if(m=="+")break;}}else
r.push(ret[j].parentNode);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[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=jQuery.filter(m[3],r,true).r;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 num=jQuery.mergeNum++,tmp=[],test=/(\d*)n\+?(\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"n+"+m[3]||m[3]),first=(test[1]||1)-0,last=test[2]-0;for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode;if(num!=parentNode.mergeNum){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling)
if(n.nodeType==1)
n.nodeIndex=c++;parentNode.mergeNum=num;}
var add=false;if(first==1){if(last==0||node.nodeIndex==last)
add=true;}else if((node.nodeIndex+last)%first==0)
add=true;if(add^not)
tmp.push(node);}
r=tmp;}else{var f=jQuery.expr[m[1]];if(typeof f!="string")
f=jQuery.expr[m[1]][m[2]];f=eval("false||function(a,i){return "+f+"}");r=jQuery.grep(r,f,not);}}
return{r:r,t:t};},parents:function(elem){var matched=[];var cur=elem.parentNode;while(cur&&cur!=document){matched.push(cur);cur=cur.parentNode;}
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&&(!elem||n!=elem))
r.push(n);}
return r;}});jQuery.event={add:function(element,type,handler,data){if(jQuery.browser.msie&&element.setInterval!=undefined)
element=window;if(!handler.guid)
handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=function(){return fn.apply(this,arguments);};handler.data=data;handler.guid=fn.guid;}
if(!element.$events)
element.$events={};if(!element.$handle)
element.$handle=function(){var val;if(typeof jQuery=="undefined"||jQuery.event.triggered)
return val;val=jQuery.event.handle.apply(element,arguments);return val;};var handlers=element.$events[type];if(!handlers){handlers=element.$events[type]={};if(element.addEventListener)
element.addEventListener(type,element.$handle,false);else
element.attachEvent("on"+type,element.$handle);}
handlers[handler.guid]=handler;this.global[type]=true;},guid:1,global:{},remove:function(element,type,handler){var events=element.$events,ret,index;if(events){if(type&&type.type){handler=type.handler;type=type.type;}
if(!type){for(type in events)
this.remove(element,type);}else if(events[type]){if(handler)
delete events[type][handler.guid];else
for(handler in element.$events[type])
delete events[type][handler];for(ret in events[type])break;if(!ret){if(element.removeEventListener)
element.removeEventListener(type,element.$handle,false);else
element.detachEvent("on"+type,element.$handle);ret=null;delete events[type];}}
for(ret in events)break;if(!ret)
element.$handle=element.$events=null;}},trigger:function(type,data,element){data=jQuery.makeArray(data||[]);if(!element){if(this.global[type])
jQuery("*").add([window,document]).trigger(type,data);}else{var val,ret,fn=jQuery.isFunction(element[type]||null);data.unshift(this.fix({type:type,target:element}));if(jQuery.isFunction(element.$handle))
val=element.$handle.apply(element,data);if(!fn&&element["on"+type]&&element["on"+type].apply(element,data)===false)
val=false;if(fn&&val!==false&&!(jQuery.nodeName(element,'a')&&type=="click")){this.triggered=true;element[type]();}
this.triggered=false;}},handle:function(event){var val;event=jQuery.event.fix(event||window.event||{});var c=this.$events&&this.$events[event.type],args=Array.prototype.slice.call(arguments,1);args.unshift(event);for(var j in c){if(!isNaN(j))
{args[0].handler=c[j];args[0].data=c[j].data;if(c[j].apply(this,args)===false){event.preventDefault();event.stopPropagation();val=false;}}}
if(jQuery.browser.msie)
event.target=event.preventDefault=event.stopPropagation=event.handler=event.data=null;return val;},fix:function(event){var originalEvent=event;event=jQuery.extend({},originalEvent);event.preventDefault=function(){if(originalEvent.preventDefault)
originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)
originalEvent.stopPropagation();originalEvent.cancelBubble=true;};if(!event.target&&event.srcElement)
event.target=event.srcElement;if(jQuery.browser.safari&&event.target.nodeType==3)
event.target=originalEvent.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 e=document.documentElement,b=document.body;event.pageX=event.clientX+(e&&e.scrollLeft||b.scrollLeft||0);event.pageY=event.clientY+(e&&e.scrollTop||b.scrollTop||0);}
if(!event.which&&(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;}};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){return this.each(function(){jQuery.event.add(this,type,function(event){jQuery(this).unbind(event);return(fn||data).apply(this,arguments);},fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data){return this.each(function(){jQuery.event.trigger(type,data,this);});},toggle:function(){var a=arguments;return this.click(function(e){this.lastToggle=0==this.lastToggle?1:0;e.preventDefault();return a[this.lastToggle].apply(this,[e])||false;});},hover:function(f,g){function handleHover(e){var p=e.relatedTarget;while(p&&p!=this)try{p=p.parentNode;}catch(e){p=this;};if(p==this)return false;return(e.type=="mouseover"?f:g).apply(this,[e]);}
return this.mouseover(handleHover).mouseout(handleHover);},ready:function(f){bindReady();if(jQuery.isReady)
f.apply(document,[jQuery]);else
jQuery.readyList.push(function(){return f.apply(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.apply(document);});jQuery.readyList=null;}
if(jQuery.browser.mozilla||jQuery.browser.opera)
document.removeEventListener("DOMContentLoaded",jQuery.ready,false);if(!window.frames.length)
jQuery(window).load(function(){jQuery("#__ie_init").remove();});}}});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,o){jQuery.fn[o]=function(f){return f?this.bind(o,f):this.trigger(o);};});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(jQuery.browser.mozilla||jQuery.browser.opera)
document.addEventListener("DOMContentLoaded",jQuery.ready,false);else if(jQuery.browser.msie){document.write("<scr"+"ipt id=__ie_init defer=true "+"src=//:><\/script>");var script=document.getElementById("__ie_init");if(script)
script.onreadystatechange=function(){if(document.readyState!="complete")return;jQuery.ready();};script=null;}else if(jQuery.browser.safari)
jQuery.safariTimer=setInterval(function(){if(document.readyState=="loaded"||document.readyState=="complete"){clearInterval(jQuery.safariTimer);jQuery.safariTimer=null;jQuery.ready();}},10);jQuery.event.add(window,"load",jQuery.ready);}
jQuery.fn.extend({loadIfModified:function(url,params,callback){this.load(url,params,callback,1);},load:function(url,params,callback,ifModified){if(jQuery.isFunction(url))
return this.bind("load",url);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,data:params,ifModified:ifModified,complete:function(res,status){if(status=="success"||!ifModified&&status=="notmodified")
self.html(res.responseText);setTimeout(function(){self.each(callback,[res.responseText,status,res]);},13);}});return this;},serialize:function(){return jQuery.param(this);},evalScripts:function(){}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});jQuery.extend({get:function(url,data,callback,type,ifModified){if(jQuery.isFunction(data)){callback=data;data=null;}
return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type,ifModified:ifModified});},getIfModified:function(url,data,callback,type){return jQuery.get(url,data,callback,type,1);},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});},ajaxTimeout:function(timeout){jQuery.ajaxSettings.timeout=timeout;},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null},lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));if(s.data){if(s.processData&&typeof s.data!="string")
s.data=jQuery.param(s.data);if(s.type.toLowerCase()=="get"){s.url+=(s.url.indexOf("?")>-1?"&":"?")+s.data;s.data=null;}}
if(s.global&&!jQuery.active++)
jQuery.event.trigger("ajaxStart");var requestDone=false;var xml=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();xml.open(s.type,s.url,s.async);if(s.data)
xml.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)
xml.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xml.setRequestHeader("X-Requested-With","XMLHttpRequest");if(s.beforeSend)
s.beforeSend(xml);if(s.global)
jQuery.event.trigger("ajaxSend",[xml,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xml&&(xml.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}
var status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xml)&&"error"||s.ifModified&&jQuery.httpNotModified(xml,s.url)&&"notmodified"||"success";if(status=="success"){try{var data=jQuery.httpData(xml,s.dataType);}catch(e){status="parsererror";}}
if(status=="success"){var modRes;try{modRes=xml.getResponseHeader("Last-Modified");}catch(e){}
if(s.ifModified&&modRes)
jQuery.lastModified[s.url]=modRes;if(s.success)
s.success(data,status);if(s.global)
jQuery.event.trigger("ajaxSuccess",[xml,s]);}else
jQuery.handleError(s,xml,status);if(s.global)
jQuery.event.trigger("ajaxComplete",[xml,s]);if(s.global&&!--jQuery.active)
jQuery.event.trigger("ajaxStop");if(s.complete)
s.complete(xml,status);if(s.async)
xml=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)
setTimeout(function(){if(xml){xml.abort();if(!requestDone)
onreadystatechange("timeout");}},s.timeout);}
try{xml.send(s.data);}catch(e){jQuery.handleError(s,xml,null,e);}
if(!s.async)
onreadystatechange();return xml;},handleError:function(s,xml,status,e){if(s.error)s.error(xml,status,e);if(s.global)
jQuery.event.trigger("ajaxError",[xml,s,e]);},active:0,httpSuccess:function(r){try{return!r.status&&location.protocol=="file:"||(r.status>=200&&r.status<300)||r.status==304||jQuery.browser.safari&&r.status==undefined;}catch(e){}
return false;},httpNotModified:function(xml,url){try{var xmlRes=xml.getResponseHeader("Last-Modified");return xml.status==304||xmlRes==jQuery.lastModified[url]||jQuery.browser.safari&&xml.status==undefined;}catch(e){}
return false;},httpData:function(r,type){var ct=r.getResponseHeader("content-type");var xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0;data=xml?r.responseXML:r.responseText;if(xml&&data.documentElement.tagName=="parsererror")
throw"parsererror";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(a[j]));return s.join("&");}});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?this.oldblock:"";if(jQuery.css(this,"display")=="none")
this.style.display="block";}).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");if(this.oldblock=="none")
this.oldblock="block";this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle(fn,fn2):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){return this.queue(function(){var hidden=jQuery(this).is(":hidden"),opt=jQuery.speed(speed,easing,callback),self=this;for(var p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)
return jQuery.isFunction(opt.complete)&&opt.complete.apply(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";this.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(val.constructor==Number)
e.custom(e.cur()||0,val);else
e[val=="toggle"?hidden?"show":"hide":val](prop);});return true;});},queue:function(type,fn){if(!fn){fn=type;type="fx";}
return this.each(function(){if(!this.queue)
this.queue={};if(!this.queue[type])
this.queue[type]=[];this.queue[type].push(fn);if(this.queue[type].length==1)
fn.apply(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:{slow:600,fast:200}[opt.duration])||400;opt.old=opt.complete;opt.complete=function(){jQuery.dequeue(this,"fx");if(jQuery.isFunction(opt.old))
opt.old.apply(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;}},queue:{},dequeue:function(elem,type){type=type||"fx";if(elem.queue&&elem.queue[type]){elem.queue[type].shift();var f=elem.queue[type][0];if(f)f.apply(elem);}},timers:[],fx:function(elem,options,prop){var z=this;var y=elem.style;z.a=function(){if(options.step)
options.step.apply(elem,[z.now]);if(prop=="opacity")
jQuery.attr(y,"opacity",z.now);else{y[prop]=parseInt(z.now)+"px";if(prop=="height"||prop=="width")
y.display="block";}};z.max=function(){return parseFloat(jQuery.css(elem,prop));};z.cur=function(){var r=parseFloat(jQuery.curCSS(elem,prop));return r&&r>-10000?r:z.max();};z.custom=function(from,to){z.startTime=(new Date()).getTime();z.now=from;z.a();jQuery.timers.push(function(){return z.step(from,to);});if(jQuery.timers.length==1){var timer=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(timer);},13);}};z.show=function(){if(!elem.orig)elem.orig={};elem.orig[prop]=jQuery.attr(elem.style,prop);options.show=true;z.custom(0,this.cur());if(prop!="opacity")
y[prop]="1px";jQuery(elem).show();};z.hide=function(){if(!elem.orig)elem.orig={};elem.orig[prop]=jQuery.attr(elem.style,prop);options.hide=true;z.custom(this.cur(),0);};z.step=function(firstNum,lastNum){var t=(new Date()).getTime();if(t>options.duration+z.startTime){z.now=lastNum;z.a();if(elem.curAnim)elem.curAnim[prop]=true;var done=true;for(var i in elem.curAnim)
if(elem.curAnim[i]!==true)
done=false;if(done){if(options.display!=null){y.overflow=options.overflow;y.display=options.display;if(jQuery.css(elem,"display")=="none")
y.display="block";}
if(options.hide)
y.display="none";if(options.hide||options.show)
for(var p in elem.curAnim)
jQuery.attr(y,p,elem.orig[p]);}
if(done&&jQuery.isFunction(options.complete))
options.complete.apply(elem);return false;}else{var n=t-this.startTime;var p=n/options.duration;z.now=jQuery.easing[options.easing||(jQuery.easing.swing?"swing":"linear")](p,n,firstNum,(lastNum-firstNum),options.duration);z.a();}
return true;};}});})();(function($){var height=$.fn.height,width=$.fn.width;$.fn.extend({height:function(){if(!this[0])error();if(this[0]==window)
if($.browser.opera||($.browser.safari&&parseInt($.browser.version)>520))
return self.innerHeight-(($(document).height()>self.innerHeight)?getScrollbarWidth():0);else if($.browser.safari)
return self.innerHeight;else
return $.boxModel&&document.documentElement.clientHeight||document.body.clientHeight;if(this[0]==document)
return Math.max(($.boxModel&&document.documentElement.scrollHeight||document.body.scrollHeight),document.body.offsetHeight);return height.apply(this,arguments);},width:function(){if(!this[0])error();if(this[0]==window)
if($.browser.opera||($.browser.safari&&parseInt($.browser.version)>520))
return self.innerWidth-(($(document).width()>self.innerWidth)?getScrollbarWidth():0);else if($.browser.safari)
return self.innerWidth;else
return $.boxModel&&document.documentElement.clientWidth||document.body.clientWidth;if(this[0]==document)
if($.browser.mozilla){var scrollLeft=self.pageXOffset;self.scrollTo(99999999,self.pageYOffset);var scrollWidth=self.pageXOffset;self.scrollTo(scrollLeft,self.pageYOffset);return document.body.offsetWidth+scrollWidth;}
else
return Math.max((($.boxModel&&!$.browser.safari)&&document.documentElement.scrollWidth||document.body.scrollWidth),document.body.offsetWidth);return width.apply(this,arguments);},innerHeight:function(){if(!this[0])error();return this[0]==window||this[0]==document?this.height():this.is(':visible')?this[0].offsetHeight-num(this,'borderTopWidth')-num(this,'borderBottomWidth'):this.height()+num(this,'paddingTop')+num(this,'paddingBottom');},innerWidth:function(){if(!this[0])error();return this[0]==window||this[0]==document?this.width():this.is(':visible')?this[0].offsetWidth-num(this,'borderLeftWidth')-num(this,'borderRightWidth'):this.width()+num(this,'paddingLeft')+num(this,'paddingRight');},outerHeight:function(options){if(!this[0])error();options=$.extend({margin:false},options||{});return this[0]==window||this[0]==document?this.height():this.is(':visible')?this[0].offsetHeight+(options.margin?(num(this,'marginTop')+num(this,'marginBottom')):0):this.height()
+num(this,'borderTopWidth')+num(this,'borderBottomWidth')
+num(this,'paddingTop')+num(this,'paddingBottom')
+(options.margin?(num(this,'marginTop')+num(this,'marginBottom')):0);},outerWidth:function(options){if(!this[0])error();options=$.extend({margin:false},options||{});return this[0]==window||this[0]==document?this.width():this.is(':visible')?this[0].offsetWidth+(options.margin?(num(this,'marginLeft')+num(this,'marginRight')):0):this.width()
+num(this,'borderLeftWidth')+num(this,'borderRightWidth')
+num(this,'paddingLeft')+num(this,'paddingRight')
+(options.margin?(num(this,'marginLeft')+num(this,'marginRight')):0);},scrollLeft:function(val){if(!this[0])error();if(val!=undefined)
return this.each(function(){if(this==window||this==document)
window.scrollTo(val,$(window).scrollTop());else
this.scrollLeft=val;});if(this[0]==window||this[0]==document)
return self.pageXOffset||$.boxModel&&document.documentElement.scrollLeft||document.body.scrollLeft;return this[0].scrollLeft;},scrollTop:function(val){if(!this[0])error();if(val!=undefined)
return this.each(function(){if(this==window||this==document)
window.scrollTo($(window).scrollLeft(),val);else
this.scrollTop=val;});if(this[0]==window||this[0]==document)
return self.pageYOffset||$.boxModel&&document.documentElement.scrollTop||document.body.scrollTop;return this[0].scrollTop;},position:function(returnObject){return this.offset({margin:false,scroll:false,relativeTo:this.offsetParent()},returnObject);},offset:function(options,returnObject){if(!this[0])error();var x=0,y=0,sl=0,st=0,elem=this[0],parent=this[0],op,parPos,elemPos=$.css(elem,'position'),mo=$.browser.mozilla,ie=$.browser.msie,oa=$.browser.opera,sf=$.browser.safari,sf3=$.browser.safari&&parseInt($.browser.version)>520,absparent=false,relparent=false,options=$.extend({margin:true,border:false,padding:false,scroll:true,lite:false,relativeTo:document.body},options||{});if(options.lite)return this.offsetLite(options,returnObject);if(options.relativeTo.jquery)options.relativeTo=options.relativeTo[0];if(elem.tagName=='BODY'){x=elem.offsetLeft;y=elem.offsetTop;if(mo){x+=num(elem,'marginLeft')+(num(elem,'borderLeftWidth')*2);y+=num(elem,'marginTop')+(num(elem,'borderTopWidth')*2);}else
if(oa){x+=num(elem,'marginLeft');y+=num(elem,'marginTop');}else
if((ie&&jQuery.boxModel)){x+=num(elem,'borderLeftWidth');y+=num(elem,'borderTopWidth');}else
if(sf3){x+=num(elem,'marginLeft')+num(elem,'borderLeftWidth');y+=num(elem,'marginTop')+num(elem,'borderTopWidth');}}else{do{parPos=$.css(parent,'position');x+=parent.offsetLeft;y+=parent.offsetTop;if((mo&&!parent.tagName.match(/^t[d|h]$/i))||ie||sf3){x+=num(parent,'borderLeftWidth');y+=num(parent,'borderTopWidth');if(mo&&parPos=='absolute')absparent=true;if(ie&&parPos=='relative')relparent=true;}
op=parent.offsetParent||document.body;if(options.scroll||mo){do{if(options.scroll){sl+=parent.scrollLeft;st+=parent.scrollTop;}
if(oa&&($.css(parent,'display')||'').match(/table-row|inline/)){sl=sl-((parent.scrollLeft==parent.offsetLeft)?parent.scrollLeft:0);st=st-((parent.scrollTop==parent.offsetTop)?parent.scrollTop:0);}
if(mo&&parent!=elem&&$.css(parent,'overflow')!='visible'){x+=num(parent,'borderLeftWidth');y+=num(parent,'borderTopWidth');}
parent=parent.parentNode;}while(parent!=op);}
parent=op;if(parent==options.relativeTo&&!(parent.tagName=='BODY'||parent.tagName=='HTML')){if(mo&&parent!=elem&&$.css(parent,'overflow')!='visible'){x+=num(parent,'borderLeftWidth');y+=num(parent,'borderTopWidth');}
if(((sf&&!sf3)||oa)&&parPos!='static'){x-=num(op,'borderLeftWidth');y-=num(op,'borderTopWidth');}
break;}
if(parent.tagName=='BODY'||parent.tagName=='HTML'){if(((sf&&!sf3)||(ie&&$.boxModel))&&elemPos!='absolute'&&elemPos!='fixed'){x+=num(parent,'marginLeft');y+=num(parent,'marginTop');}
if(sf3||(mo&&!absparent&&elemPos!='fixed')||(ie&&elemPos=='static'&&!relparent)){x+=num(parent,'borderLeftWidth');y+=num(parent,'borderTopWidth');}
break;}}while(parent);}
var returnValue=handleOffsetReturn(elem,options,x,y,sl,st);if(returnObject){$.extend(returnObject,returnValue);return this;}
else{return returnValue;}},offsetLite:function(options,returnObject){if(!this[0])error();var x=0,y=0,sl=0,st=0,parent=this[0],offsetParent,options=$.extend({margin:true,border:false,padding:false,scroll:true,relativeTo:document.body},options||{});if(options.relativeTo.jquery)options.relativeTo=options.relativeTo[0];do{x+=parent.offsetLeft;y+=parent.offsetTop;offsetParent=parent.offsetParent||document.body;if(options.scroll){do{sl+=parent.scrollLeft;st+=parent.scrollTop;parent=parent.parentNode;}while(parent!=offsetParent);}
parent=offsetParent;}while(parent&&parent.tagName!='BODY'&&parent.tagName!='HTML'&&parent!=options.relativeTo);var returnValue=handleOffsetReturn(this[0],options,x,y,sl,st);if(returnObject){$.extend(returnObject,returnValue);return this;}
else{return returnValue;}},offsetParent:function(){if(!this[0])error();var offsetParent=this[0].offsetParent;while(offsetParent&&(offsetParent.tagName!='BODY'&&$.css(offsetParent,'position')=='static'))
offsetParent=offsetParent.offsetParent;return $(offsetParent);}});var error=function(){this[0].toString();throw"Dimensions: jQuery collection is empty "+this[0];};var num=function(el,prop){return parseInt($.css(el.jquery?el[0]:el,prop))||0;};var handleOffsetReturn=function(elem,options,x,y,sl,st){if(!options.margin){x-=num(elem,'marginLeft');y-=num(elem,'marginTop');}
if(options.border&&(($.browser.safari&&parseInt($.browser.version)<520)||$.browser.opera)){x+=num(elem,'borderLeftWidth');y+=num(elem,'borderTopWidth');}else if(!options.border&&!(($.browser.safari&&parseInt($.browser.version)<520)||$.browser.opera)){x-=num(elem,'borderLeftWidth');y-=num(elem,'borderTopWidth');}
if(options.padding){x+=num(elem,'paddingLeft');y+=num(elem,'paddingTop');}
if(options.scroll&&(!$.browser.opera||elem.offsetLeft!=elem.scrollLeft&&elem.offsetTop!=elem.scrollLeft)){sl-=elem.scrollLeft;st-=elem.scrollTop;}
return options.scroll?{top:y-st,left:x-sl,scrollTop:st,scrollLeft:sl}:{top:y,left:x};};var scrollbarWidth=0;var getScrollbarWidth=function(){if(!scrollbarWidth){var testEl=$('<div>').css({width:100,height:100,overflow:'auto',position:'absolute',top:-1000,left:-1000}).appendTo('body');scrollbarWidth=100-testEl.append('<div>').find('div').css({width:'100%',height:200}).width();testEl.remove();}
return scrollbarWidth;};})(jQuery);(function($)
{var ie6=$.browser.msie&&$.browser.version=="6.0";var getHeightForOverlay=ie6?function(){return $(window).height();}:function(){return'100%';};$.fn.jqm=function(o)
{var _o={zIndex:3000,overlay:50,overlayClass:'jqmOverlay',closeClass:'jqmClose',trigger:'.jqModal',ajax:false,target:false,modal:false,toTop:false,onShow:false,onHide:false,onLoad:false};return this.each(function()
{if(this._jqm)
return;s++;this._jqm=s;H[s]={c:$.extend(_o,o),a:false,w:$(this).addClass('jqmID'+s),s:s};if(_o.trigger)
$(this).jqmAddTrigger(_o.trigger);});};$.fn.jqmAddClose=function(e)
{hs(this,e,'jqmHide');return this;};$.fn.jqmAddTrigger=function(e)
{hs(this,e,'jqmShow');return this;};$.fn.jqmShow=function(t)
{return this.each(function()
{if(!H[this._jqm].a)
$.jqm.open(this._jqm,t)});};$.fn.jqmHide=function(t)
{return this.each(function()
{if(H[this._jqm].a)
$.jqm.close(this._jqm,t)});};$.jqm={hash:{},open:function(s,t)
{var h=H[s],c=h.c,cc='.'+c.closeClass,z=(/^\d+$/.test(h.w.css('z-index')))?h.w.css('z-index'):c.zIndex,o=$('<div id="overlay"></div>').css({height:getHeightForOverlay(),width:'100%','z-index':z-1,opacity:0});h.t=t;h.a=true;h.w.css('z-index',z);if(c.modal)
{if(!A[0])F('bind');A.push(s);o.css('cursor','wait');}
else
if(c.overlay>0)
h.w.jqmAddClose(o);else
o=false;h.o=(o)?o.addClass(c.overlayClass).prependTo('body'):false;$('#overlay').animate({opacity:c.overlay/100},"fast");if(c.ajax)
{var r=c.target||h.w,u=c.ajax,r=(typeof r=='string')?$(r,h.w):$(r),u=(u.substr(0,1)=='@')?$(t).attr(u.substring(1)):u;r.load(u,function()
{if(c.onLoad)
c.onLoad.call(this,h);if(cc)
h.w.jqmAddClose($(cc,h.w));e(h);});}
else
if(cc)h.w.jqmAddClose($(cc,h.w));if(c.toTop&&h.o)
h.w.before('<span id="jqmP'+h.w[0]._jqm+'"></span>').insertAfter(h.o);(c.onShow)?c.onShow(h):h.w.show();e(h);return false;},close:function(s)
{var h=H[s];h.a=false;if(A[0])
{A.pop();if(!A[0])
F('unbind');}
if(h.c.toTop&&h.o)
$('#jqmP'+h.w[0]._jqm).after(h.w).remove();if(h.c.onHide)
h.c.onHide(h);else
{}
if(h.o)
{$('#overlay').hide();h.o.remove();}
return false;}};var s=0,H=$.jqm.hash,A=[],i=$('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0}),e=function(h){if(ie6)if(h.o)h.o.html('<p style="width:100%;height:100%"/>').prepend(i);else if(!$('iframe.jqm',h.w)[0])h.w.prepend(i);f(h);},f=function(h){try{$(':input:visible',h.w)[0].focus();}catch(e){}},F=function(t){$()[t]("mousedown",m);},m=function(e){var h=H[A[A.length-1]],r=(!$(e.target).parents('.jqmID'+h.s)[0]);if(r)f(h);return!r;},hs=function(w,e,y){var s=[];w.each(function(){s.push(this._jqm)});$(e).each(function(){if(this[y])$.extend(this[y],s);else{this[y]=s;$(this).click(function(){for(var i in{jqmShow:1,jqmHide:1})for(var s in this[i])if(H[this[i][s]])H[this[i][s]].w[i](this);return false;});}});};})(jQuery);function Iterator(next,newIterator)
{if(next==undefined)
throw new Error("next function must be defined for an iterator");if(newIterator==undefined)
throw new Error("newIterator function must be defined for an iterator");this.next=next;this.newIterator=newIterator;}
Iterator.prototype.each=function(fn)
{var i=undefined;var iterator=this.newIterator();while((i=iterator.next())!=undefined)
fn(i);}
Iterator.prototype.contains=function(fn)
{var iterator=this.newIterator();var result=false;var x=undefined;while((x=iterator.next())!=undefined)
{if(fn(x))
{result=true;break;}}
return result;}
Iterator.prototype.select=function(fn)
{var iterator=this;return new Iterator(function()
{var x=iterator.next();if(x!=undefined)
x=fn(x);return x;},function(){iterator=iterator.newIterator();return this;});}
Iterator.prototype.where=function(fn)
{var iterator=this;return new Iterator(function()
{var x=iterator.next();if(x!=undefined&&!fn(x))
x=this.next();return x;},function(){iterator=iterator.newIterator();return this;});}
Iterator.prototype.first=function(fn)
{var iterator=this.newIterator();var x=undefined;while((x=iterator.next())!=undefined)
{if(fn(x))
break;}
return x;}
Iterator.prototype.catenate=function(otherIterator)
{var iterator=this;return new Iterator(function()
{var x=iterator.next();if(x==undefined)
{iterator=otherIterator;x=iterator.next();}
return x;},function(){iterator=iterator.newIterator();otherIterator=otherIterator.newIterator();return this;});}
Iterator.prototype.toArray=function()
{var result=new Array();var i=undefined;var iterator=this.newIterator();while((i=iterator.next())!=undefined)
result.push(i);return result;}
for(var mt in Iterator.prototype)
{var exp="Array.prototype."+mt+" = function(  ) "+"{ return Iterator.prototype."+mt+".apply( this, arguments ); }";eval(exp);}
Array.prototype.next=function()
{var iterator=this.newIterator();this.next=function(){return iterator.next()};return iterator.next();}
Array.prototype.newIterator=function()
{var arry=this;var newIteratorFunc=function()
{var r=new Iterator(function()
{if(this.__iteratorIndex<arry.length)
return arry[this.__iteratorIndex++];else
return undefined;},function()
{return newIteratorFunc();});r.__iteratorIndex=0;return r;}
var result=newIteratorFunc();return result;}
var gsMonthNames=new Array('January','February','March','April','May','June','July','August','September','October','November','December');var gsDayNames=new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');function formatDate(d,f)
{return f.replace(/(yyyy|mmmm|mmm|mm|dddd|ddd|dd|hh|nn|ss|a\/p)/gi,function(a)
{switch(a.toLowerCase())
{case'yyyy':return d.getFullYear();case'mmmm':return gsMonthNames[d.getMonth()];case'mmm':return gsMonthNames[d.getMonth()].substr(0,3);case'mm':return(d.getMonth()+1);case'dddd':return gsDayNames[d.getDay()];case'ddd':return gsDayNames[d.getDay()].substr(0,3);case'dd':return d.getDate();case'hh':return((h=d.getHours()%12)?h:12).zf(2);case'nn':return d.getMinutes().zf(2);case'ss':return d.getSeconds().zf(2);case'a/p':return d.getHours()<12?'a':'p';}});}
function DefaultController()
{var inResize=false;this.repositionBody=function()
{var fullWidth=$("body").width();var bodyWidth=$(".body").width();var leftMargin=(fullWidth-bodyWidth)/2
leftMargin=(leftMargin<0)?0:leftMargin;$(".body").css("marginLeft",leftMargin);$(".section").css("visibility","visible");}
var self=this;this.onresize=function()
{try
{if(!inResize)
{var mainBodyStyles=$("#mainBody").attr("style");inResize=true;try
{self.repositionBody();var optionalRightLinksElement=$(".sectionRightQuickLinks");optionalRightLinksWidth=(optionalRightLinksElement.length==1?optionalRightLinksElement.outerWidth():0);var section=$("#mainBody").innerWidth();section=section*.9;var tenEms=$("#emConverter").width();var margin=tenEms*1;var maxWidth=tenEms*6;var minWidth=tenEms*2.5;var widthAvailable=$("#mainBody").innerWidth()-optionalRightLinksWidth;if(section>maxWidth)
section=maxWidth;if(section+margin>widthAvailable)
section=widthAvailable-margin;if(section>widthAvailable)
section=widthAvailable;if(section<minWidth)
section=minWidth;var sectionMargin=$(".section").outerWidth()-$(".section").width();$(".section").width(section-sectionMargin);section+=(optionalRightLinksWidth);var l=$("#mainBody").outerWidth()/2-section/2-2;if(l>5)
$(".sectionCenter").css("margin-left",l);else
$(".sectionCenter").css("margin-left","5px");$(".sectionRightQuickLinks").css("left",$(".section").offset().left+$(".section").outerWidth());}
finally
{$("#mainBody").attr("style",mainBodyStyles);inResize=false;}}}
catch(e)
{$("Body").prepend("<p>resizing error "+e.toString()+"</p>");}}}
$().ready(function()
{var mouseOver=function(){$("#bannerLogo").fadeOut(250);$("#bannerLogoHover").fadeIn(250);}
var mouseOut=function(){$("#bannerLogo").fadeIn(250);$("#bannerLogoHover").fadeOut(250);}
$("#bannerLogo").mouseover(mouseOver);$("#bannerLogoHover").mouseout(mouseOut);init();});function createMVC(name,templateScript)
{var url="Content/"+name+".htm";if(Request.params.data!=undefined)
url=Request.params.data;var htmlTemplate=new HtmlTemplate("#mainBody",templateScript);var model=new this[name+"Model"](url);var controller=new this[name+"Controller"](model,htmlTemplate);window.onresize=controller.onresize;return controller;}
var isIe6=$.browser.msie&&$.browser.version=="6.0";var isIe7=$.browser.msie&&$.browser.version=="7.0";var isSafari2=$.browser.safari;function EffectPanAnimator(element,range,x,y,xStep,yStep)
{var self=this;var isCompleted=false;var animatedTimed=0;this.isNearlyFinished=function()
{var result=!isCompleted&&self.isCrossedMark();if(result)
isCompleted=true;return result;}
var _duration;var timeInterval;var _period;var _onperiod;this.toCenter=function(duration,period,onperiod)
{element.css({marginLeft:-x,marginTop:-y});_duration=duration;_period=period;_onperiod=onperiod;timeInterval=duration/range;setTimeout(function(){animate()},timeInterval);}
var isAnimateFinished=function()
{return animatedTimed>=_duration}
var isPeriodFinished=function()
{return animatedTimed>=_period}
var step=function()
{x+=xStep;y+=yStep;}
var animate=function()
{animatedTimed+=timeInterval;if(!isAnimateFinished())
setTimeout(function(){animate()},timeInterval);step();element.css({marginLeft:-x,marginTop:-y});if(isPeriodFinished()&&_onperiod!=undefined)
{_onperiod()
_onperiod=undefined}}}
function EffectPan(portalWidth,portalHeight)
{var self=this;var yStep=1;var xStep=1;var range;var yMiddle;var imageWidth;var imageHeight;var setState=function(element)
{imageHeight=parseInt(element.css("height"));imageWidth=parseInt(element.css("width"));range=(imageWidth-portalWidth)/2
yMiddle=(imageHeight-portalHeight)/2;}
this.fromTopLeft=function(element)
{setState(element)
return new EffectPanAnimator(element,range,0,0,xStep,yStep)}
this.fromTopRight=function(element)
{setState(element)
var x=imageWidth-portalWidth;var y=yMiddle-range;if(y<0)
y=0;return new EffectPanAnimator(element,range,x,y,-xStep,yStep);}
this.fromBottomLeft=function(element)
{setState(element)
var x=0;var y=yMiddle+range;if(y>(imageHeight-portalHeight))
y=(imageHeight-portalHeight);return new EffectPanAnimator(element,range,x,y,xStep,-yStep);}
this.fromBottomRight=function(element)
{setState(element)
var x=imageWidth-portalWidth;var y=yMiddle+range;if(y>(imageHeight-portalHeight))
y=(imageHeight-portalHeight);return new EffectPanAnimator(element,range,x,y,-xStep,-yStep);}}
function GalleryTemplate()
{this.templateScript='          <div id="backAndForwardButtons" style="position:absolute; top: auto; width: 70px;z-index:400;" >'+'                    <img id="goBack" src="Content/assets/goBack.gif" style="position:absolute; width: 32px;height: 32px" />'+'                    <img id="goBackHover" src="Content/assets/goBackHover.gif" style="display:none; position:absolute; width: 32px;height: 32px" />'+'                    <img id="goForward" src="Content/assets/goForward.gif" style="position:absolute; left: 37px; width: 32px;height: 32px" />'+'                    <img id="goForwardHover" src="Content/assets/goForwardHover.gif" style="display:none; position:absolute; left: 37px; width: 32px;height: 32px" />'+'            </div>          '+'<div id="galleryBlurbBox" style="position:absolute; width:0px; height:0px;font-size:0;opacity:0" >'+'                    <div>##= activeGallery.blurb ##</div>'+'                </div>'+'              <div id="galleryReservedSpace" >'+'              </div>'+'                <div id="galleryViewerSelector"  style="min-width:##= (activeGallery.thumbImageDimensions.width + 8) * 3  + scrollWidth ##px;" >'+'              <div id="galleryTitle" style="height:32px">    '+'                    <img id="detailIconGreen" src="Content/assets/detail_icon_green.jpg" style="border-style:none; left:0px; position:absolute;"  />'+'                    <img id="detailIconPink" src="Content/assets/detail_icon_pink.jpg" style="border-style:none; left:0px; position:absolute;display:none" />'+'                    <div style="margin-left:42px;padding-top:8px;">##= activeGallery.title## ##= activeGallery.year##</div>'+'<div id="titleLineBreak" style="padding:0px; height: 1px; clear:both;display:block"></div>'+'                    </div>'+'                    ##each( activeGallery.images, { ##'+'                        <div style="##= index == 0 ? "clear:both;" : "" ## height: ##=activeGallery.thumbImageDimensions.height##px;" >'+'                            <a href="javascript:galleryController.showSlide(##=index+1##);">'+'                                <img alt="" id="thumbImg_##= index + 1 ##" src="##=activeGallery.images[index].thumb##" />'+'                            </a>'+'                        </div>'+'                    ## } ##'+'                </div>'+'                <div id="galleryViewerImage" style="width:##= activeGallery.portalImage.width ##px; " >'+'                    <img id="gallerySlideLoader" src="Content/assets/loader.gif" style="width: 48px;height: 48px;position:absolute;left:##= activeGallery.portalImage.width /2 - 24##px; top:##= activeGallery.portalImage.height /2 - 24##px" />'+'                    ##each( activeGallery.images, '+'                    {'+'                        var mainImg = activeGallery.images[index].main;##'+'                        <div id="slide_##= index + 1 ##" slideWidth="##= activeGallery.images[index].dimension.width ##" slideHeight="##= activeGallery.images[index].dimension.height ##" slideImageCount="##= activeGallery.images[index].dimension.imageCount ##" style="position:absolute;display:none;">'+'                            <div class="gallerySlideTitle" id="gallerySlideTitle_##= index + 1 ##">##= activeGallery.images[index].name ##</div>'+'                        ##'+'                            if( !(mainImg instanceof (Array)) )'+'                            {'+'                                ##<a href="##= mainImg.src ##" target="_new" >'+'                                    <img class="slideImage" id="image_##= index + 1 ##_1" alt="" tag="##=mainImg.src##" originalWidth="##= mainImg.width##" originalHeight="##= mainImg.height ##" />'+'                                </a>##'+'                            }'+'                            else'+'                            { '+'                                var dimensionIndex = 0;'+'                                for( var k = 0; k < mainImg.length; k++ )'+'                                {'+'                                    var innerImg = mainImg[k]; '+'                                    ##<a href="##= innerImg.src ##" target="_new" >    '+'                                        <img class="slideImage" style="margin-bottom:##= margin/2 ##px;" id="image_##= index + 1 ##_##= k+1##" alt="" tag="##=innerImg.src##" originalWidth="##= innerImg.width##" originalHeight="##= innerImg.height ##" />'+'                                    </a>##'+'                                    dimensionIndex++;                                        '+'                                 }  '+'                            }'+'                        ##</div>##                          '+'                    } ##'+'                </div>';}
function GalleryController(properties,galleryResizer,gallerySelectorTemplateScript,templateScript)
{var self=this;var titleId="#"+properties.name+"Title";var thumbImagesId="#"+properties.name+"ViewerSelector";var imagesContainerId="#"+properties.name+"ViewerImage";var imagesSelector=imagesContainerId+" > div";var reservedSpaceId="#"+properties.name+"ReservedSpace";var mainBodyId="#"+properties.name;var gallerySelectorId="#"+properties.name+"Container";var htmlTemplate=new HtmlTemplate(mainBodyId,templateScript);new HtmlTemplate(gallerySelectorId,gallerySelectorTemplateScript).apply(properties.model);this.jQuery=jQuery;var currentSlideIndex=0;var currentGalleryIndex=0;this.show=function(index)
{if(currentGalleryIndex==index)
return;currentGalleryIndex=index;currentSlideIndex=0;var model=properties.model;model.activeGallery=properties.model[index-1];model.margin=properties.margin;htmlTemplate.apply(model);properties.portalImageWidth=model.activeGallery.portalImage.width;properties.portalImageHeight=model.activeGallery.portalImage.height;this.showSlide(1);this.resize();wireBlubBoxEvents();startFlashingDetailIcon();nextBackButtons()}
var nextBackButtons=function()
{var backAndForwardButtons=$("#backAndForwardButtons");if(backAndForwardButtons.length==1&&backAndForwardButtons.get(0).isHoverAnimatedWired==undefined)
{var goBack=$("#goBack");var goBackHover=$("#goBackHover");var goForward=$("#goForward");var goForwardHover=$("#goForwardHover");backAndForwardButtons.get(0).isHoverAnimatedWired=true;goBack.mouseover(function(){goBackHover.fadeIn("fast")})
goBackHover.mouseout(function(){goBackHover.fadeOut("fast")})
goForward.mouseover(function(){goForwardHover.fadeIn("fast")})
goForwardHover.mouseout(function(){goForwardHover.fadeOut("fast")})
goForwardHover.click(function(){if(currentSlideIndex+1>properties.model.activeGallery.images.length)
{var nextGallery=parseInt(currentGalleryIndex)+1;if(nextGallery>properties.model.length)
nextGallery=1;self.show(nextGallery)
self.resize();}
else
{self.showSlide(currentSlideIndex+1)}})
goBackHover.click(function()
{if(currentSlideIndex==1)
{var prevGallery=parseInt(currentGalleryIndex)-1;if(prevGallery==0)
prevGallery=properties.model.length
self.show(prevGallery)
self.resize();self.showSlide(properties.model.activeGallery.images.length);}
else
self.showSlide(currentSlideIndex-1)})}}
var blurbBoxHeight;this.resize=function()
{if($(reservedSpaceId).length==0)
return;galleryResizer.portalImageDimensions=properties.model.activeGallery.portalImage;new DefaultController().repositionBody();var slideTitleHeight=$("#gallerySlideTitleCalc").outerHeight();var primaryTop=$(reservedSpaceId).offset().top+properties.margin;var primaryWidth=parseInt($(mainBodyId).outerWidth())+$(mainBodyId).offset().left;var primaryLeft=$(mainBodyId).offset().left;var heightLimit=galleryResizer.heightLimit(primaryTop,$(window).height());var slideHeight=galleryResizer.selectorHeight(slideTitleHeight,heightLimit);$(titleId).css("margin-left",galleryResizer.titleMarginLeft());$(reservedSpaceId).height(galleryResizer.reservedSpaceHeight(slideTitleHeight+properties.margin,heightLimit+properties.margin));$("#galleryBlurbBox").css("left",galleryResizer.blurbBoxLeft($("#detailIconGreen").offset().left,$("#detailIconGreen").width()));$("#galleryBlurbBox").css("top",galleryResizer.blurbBoxTop($("#detailIconGreen").offset().top,$("#detailIconGreen").height()));blurbBoxHeight=galleryResizer.blurbBoxHeight(slideHeight)
if($.browser.mozilla)
{$("#galleryBlurbBox").css({width:galleryResizer.getTenEms()*4.5,height:galleryResizer.getTenEms()*5,fontSize:galleryResizer.getTenEms()*.11});}
var thumbImagesLeft=galleryResizer.selectorLeft(primaryLeft);var thumbImagesWidth=galleryResizer.selectorWidth(primaryWidth,thumbImagesLeft,$(thumbImagesId).css("min-width"),slideHeight);$(thumbImagesId).css("left",thumbImagesLeft);$(thumbImagesId).css("top",galleryResizer.selectorTop(primaryTop));$(thumbImagesId).width(thumbImagesWidth);$(thumbImagesId).height(slideHeight);$("#titleLineBreak").width(thumbImagesWidth-properties.scrollWidth*2);var selectorRight=thumbImagesLeft+thumbImagesWidth;var imagesContainerIdLeft=galleryResizer.slideLeft(selectorRight);$(imagesContainerId).css("left",imagesContainerIdLeft);var slideWidth=galleryResizer.slideWidth(primaryWidth,imagesContainerIdLeft);$(imagesContainerId).css("top",galleryResizer.slideTop(primaryTop,slideTitleHeight));$(imagesContainerId).width(slideWidth);$("#backAndForwardButtons").css("left",primaryWidth-$("#backAndForwardButtons").width()-properties.margin)
$("#backAndForwardButtons").css("top",galleryResizer.selectorTop(primaryTop)-properties.margin/2)
var index=0;$(imagesContainerId+" > div").each(function()
{index++;var attr=this.attributes;var slideDimensions={width:attr.getNamedItem("slideWidth").value,height:attr.getNamedItem("slideHeight").value,imageCount:attr.getNamedItem("slideImageCount").value};$(this).find("img").each(function()
{var internalD=galleryResizer.internalSlideDimensions(slideTitleHeight,{width:slideWidth,height:slideHeight,imageCount:slideDimensions.imageCount});var adjustedWidth=galleryResizer.slideImageWidth(this.attributes.getNamedItem("originalWidth").value,internalD.width,internalD.height,slideDimensions);$(this).width(adjustedWidth);});});}
this.showImage=function(imageIndex)
{$(imagesSelector+":visible").fadeOut("slow");$("#slide_"+imageIndex).fadeIn("slow");}
var wireBlubBoxEvents=function()
{$("#galleryList > *").hover(function(){$(this).find(".boxcontent > div > div").animate({color:"#DE3379",textDecoration:"underline"},"fast")},function(){$(this).find(".boxcontent > div > div").animate({color:"#666666",textDecoration:"none"},"fast")});var isFullyOut=function(){return $("#galleryBlurbBox").css("opacity")==.98};var isFullyIn=function(){return $("#galleryBlurbBox").css("opacity")==0};var scrollOut=function(){if(isFullyOut())
return;$("#galleryBlurbBox").stop();if($.browser.mozilla)
{$("#galleryBlurbBox").animate({opacity:.98},"fast")}
else
$("#galleryBlurbBox").animate({width:galleryResizer.getTenEms()*4.5,height:galleryResizer.getTenEms()*5,fontSize:galleryResizer.getTenEms()*.11,opacity:.98},"slow")};var scrollIn=function(){if(isFullyIn())
return;$("#galleryBlurbBox").stop();if($.browser.mozilla)
{$("#galleryBlurbBox").animate({opacity:0},"fast",function(){$("#galleryBlurbBox").hide()})}
else
$("#galleryBlurbBox").animate({width:0,height:0,fontSize:0,opacity:0},"slow",function(){$("#galleryBlurbBox").hide();})}
var eventId;var mouseOverEvent=function()
{clearTimeout(eventId);eventId=setTimeout(scrollOut,10);}
var mouseOutEvent=function()
{clearTimeout(eventId);eventId=setTimeout(scrollIn,10);}
var galleryTitleImg=$("#galleryTitle img");galleryTitleImg.mouseover(mouseOverEvent);galleryTitleImg.mouseout(mouseOutEvent);var galleryBlurbBox=$("#galleryBlurbBox");galleryBlurbBox.mouseover(mouseOverEvent);galleryBlurbBox.mouseout(mouseOutEvent);var galleryBlurbBoxDiv=galleryBlurbBox.find("div");galleryBlurbBoxDiv.mouseover(mouseOverEvent);galleryBlurbBoxDiv.mouseout(mouseOutEvent);}
var startFlashingDetailIcon=function()
{var icon=$("#detailIconPink");var fadeToGreen=function()
{if(icon.length==1)
icon.fadeOut(500,function(){setTimeout(fadeToPink,1000)})}
var fadeToPink=function()
{if(icon.length==1)
icon.fadeIn(500,function(){setTimeout(fadeToGreen,500)})}
setTimeout(fadeToPink,1000)}
var slidedPreloaded=new Array();var swapSrcTag=function(domElement)
{var imgElement=self.jQuery("#"+this.attributes.getNamedItem("id").value);var src=imgElement.attr("tag");if(src!=undefined&&src!='')
{imgElement.attr("src",src);imgElement.attr("tag","");}}
this.showSlide=function(slideIndex)
{if(currentSlideIndex==slideIndex)
return;currentSlideIndex=slideIndex;var jQuery=this.jQuery;if(!slidedPreloaded.contains(function(f){return f.galleryTitle==properties.model.activeGallery.title&&f.name==slideIndex-1}))
{properties.galleryQueue.reporitiseSlide(properties.model.activeGallery.title,slideIndex-1);jQuery(imagesSelector+":visible").fadeOut("slow");jQuery("#gallerySlideLoader").fadeIn("slow");}
else
{jQuery("#gallerySlideLoader").hide();var name="#slide_"+slideIndex.toString();var ele=this.jQuery(name+" > a > img").each(swapSrcTag);jQuery(imagesSelector+":visible").fadeOut("slow");jQuery(name).fadeIn("slow",function(){jQuery(name).css("filter","")});}}
this.onSlidePreloaded=function(slideItem,nextFunc)
{slidedPreloaded.push(slideItem);var jQuery=this.jQuery;if(slideItem.name==(currentSlideIndex-1)&&slideItem.galleryTitle==properties.model.activeGallery.title)
{var name="#slide_"+currentSlideIndex.toString();var ele=jQuery(name+" > a > img").each(swapSrcTag);jQuery("#gallerySlideLoader").fadeOut("slow");jQuery("#slide_"+currentSlideIndex).fadeIn("slow",function(){jQuery("#slide_"+currentSlideIndex).css("filter","")});}}
this.scheduleImagePreload=function(item,nextFunc)
{var img=this.createImage(item.data.width,item.data.height);img.onload=function(){setTimeout(function(){img.onload=null;nextFunc();},0)};img.src=item.data.src;}
this.onSchedule=function(item,nextFunc)
{var onCompletion=nextFunc;var self=this;if(item.isSlideFinished)
onCompletion=function(){self.onSlidePreloaded(item);nextFunc();};this.scheduleImagePreload(item,onCompletion);}}
function GalleryResizer(margin,borderWidth,_portalImageDimensions)
{this.portalImageDimensions={};if(_portalImageDimensions!=undefined)
this.portalImageDimensions=_portalImageDimensions;var n=function(value)
{if(typeof(value)=="function")
value=value();return parseInt(value)};this.reservedSpaceHeight=function(slideTitleHeight,heightLimit)
{return this.selectorHeight(slideTitleHeight,heightLimit)+margin;}
this.titleMarginLeft=function()
{return margin;}
this.blurbBoxTop=this.blurbBoxLeft=function(iconPosition,iconSize)
{return n(iconPosition)+n(iconSize)/2;}
this.selectorTop=this.slideTitleTop=this.slideTop=function(primaryTop)
{return n(primaryTop);}
this.blurbBoxHeight=function(slideHeight)
{return n(slideHeight)*.9;}
this.selectorHeight=function(slideTitleHeight,heightLimit)
{var result=this.slideNormalDimension(slideTitleHeight).height;if(result>heightLimit)
result=heightLimit;return result;}
this.heightLimit=function(primaryTop,windowHeight)
{var result=windowHeight-primaryTop-margin*1;if(result<600)
result=600;return result;}
this.selectorLeft=this.slideLeft=this.slideTitleLeft=function(previousLeftObjectRightPosition)
{return n(previousLeftObjectRightPosition)+margin;}
this.selectorWidth=function(primaryWidth,selectorLeft,selectorMinWidth,slideHeight)
{var portalWidth=this.portalImageDimensions.width;if(slideHeight<this.portalImageDimensions.height)
{var p=slideHeight/this.portalImageDimensions.height;portalWidth=portalWidth*p;}
var result=n(primaryWidth)-margin-borderWidth-portalWidth-borderWidth-n(selectorLeft)-margin;var minWidth=n(selectorMinWidth);if(result<minWidth)
result=minWidth;return result;}
this.slideWidth=function(primaryWidth,slideLeft)
{return n(primaryWidth)-n(slideLeft)-(borderWidth*2);}
this.slideImageWidth=function(imageWidth,slideWidth,slideHeight,slideNormalDimension)
{var xPercentage=1.00;var yPercentage=1.00;if(slideNormalDimension.width>slideWidth)
xPercentage=slideWidth/slideNormalDimension.width;if(slideNormalDimension.height>slideHeight)
yPercentage=slideHeight/slideNormalDimension.height;if(xPercentage<yPercentage)
{imageWidth=imageWidth*xPercentage;}
else
{imageWidth=imageWidth*yPercentage;}
return imageWidth;}
this.slideNormalDimension=function(slideTitleHeight,slideDimension)
{if(slideDimension==undefined)
slideDimension=this.portalImageDimensions;var result={width:slideDimension.width+(borderWidth*2),height:slideDimension.height+(slideDimension.imageCount*borderWidth*2)+((slideDimension.imageCount-1)*margin/2)+slideTitleHeight};return result;}
this.internalSlideDimensions=function(slideTitleHeight,slideDimension)
{var result={width:slideDimension.width-(borderWidth*2),height:slideDimension.height-(slideDimension.imageCount*borderWidth*2)-((slideDimension.imageCount-1)*margin/2)-slideTitleHeight};return result;}
this.getTenEms=function()
{return $("#emConverter").width();}}
function GalleryPreviewAnimation(image,effectPan,galleryPreviewModel,jQuery,randomFunc)
{if(randomFunc==undefined)
randomFunc=Math.random;if(jQuery==undefined)
jQuery=$
var self=this;var panDirections=[effectPan.fromTopLeft,effectPan.fromTopRight,effectPan.fromBottomLeft,effectPan.fromBottomRight];this.start=function()
{image.onload=firstImagePreloaded;image.src=galleryPreviewModel[0].src;}
var firstImagePreloaded=function()
{image.onload=null;jQuery("#galleryPreview_0").show();galleryPreviewModel.preloadedCount=1;jQuery("#galleryPreview_0 img").attr("src",galleryPreviewModel[0].src);self.animate(0);if(galleryPreviewModel.preloadedCount<galleryPreviewModel.length)
{image.onload=galleryPreviewImageloaded
image.src=galleryPreviewModel[galleryPreviewModel.preloadedCount].src;}}
var galleryPreviewImageloaded=function()
{jQuery("#galleryPreview_"+galleryPreviewModel.preloadedCount+" img").attr("src",galleryPreviewModel[galleryPreviewModel.preloadedCount].src);image.onload=null;galleryPreviewModel.preloadedCount++
if(galleryPreviewModel.preloadedCount<galleryPreviewModel.length)
{image.onload=galleryPreviewImageloaded;image.src=galleryPreviewModel[galleryPreviewModel.preloadedCount].src}}
this.animate=function(index)
{var speed=1800;var completed=function()
{var nextIndex=index+1;if(nextIndex==galleryPreviewModel.preloadedCount)
nextIndex=0;if(galleryPreviewModel.preloadedCount==1)
{jQuery("#galleryPreview_"+index+"").fadeOut(speed,function(){self.animate(nextIndex);jQuery("#galleryPreview_"+nextIndex+"").fadeIn(speed);});}
else
{jQuery("#galleryPreview_"+index+"").fadeOut(speed);jQuery("#galleryPreview_"+nextIndex+"").fadeIn(speed);self.animate(nextIndex);}}
if(galleryPreviewModel[index].nextPan==undefined)
galleryPreviewModel[index].nextPan=index;else
galleryPreviewModel[index].nextPan++;galleryPreviewModel[index].nextPan=galleryPreviewModel[index].nextPan%4;var i=galleryPreviewModel[index].nextPan;panDirections[i](jQuery("#galleryPreview_"+index+" img")).toCenter(speed*3,speed*2,completed)}}
function GalleryPreviewModel(galleryUrl)
{var schema={src:galleryUrl,definition:{href:"html",includeOnPreview:"text"}};var l=new TableLoader();var galleryList=l.load(schema);var galleryIndex=0;var ahrefHtml=galleryList.first(function(k){galleryIndex++;return k.includeOnPreview&&k.includeOnPreview.toLowerCase()=="yes"}).href;$("body").append("<div style='display:none' id='galleryPreviewList'>"+ahrefHtml+"</div>");var previewGalleryUrl=$("#galleryPreviewList a").attr("href");$("#galleryPreviewList").remove();var galleryPreviewRawContent=jQuery.ajax({url:previewGalleryUrl,async:false,dataType:"html",global:false}).responseText;var imageList=new GalleryLoader().loadGallery(previewGalleryUrl,galleryPreviewRawContent).images
imageList=imageList.where(function(i){return!(i.main instanceof Array)}).select(function(i){return i.main}).toArray();imageList.galleryIndex=galleryIndex;return imageList;}
function GalleryQueue(galleries)
{var galleryData=new Array();for(var gal=0;gal<galleries.length;gal++)
{var slideData=new Array();var slideIndex=0;for(var sld=0;sld<galleries[gal].images.length;sld++)
{if(!(galleries[gal].images[sld].main instanceof Array))
{slideData.push({name:slideIndex++,data:galleries[gal].images[sld].main,galleryTitle:galleries[gal].title,isSlideFinished:true});}
else
{var imageData=new Array();var lastImg;for(var img=0;img<galleries[gal].images[sld].main.length;img++)
{if(galleries[gal].images[sld].main[img]!="")
{lastImg={name:slideIndex,data:galleries[gal].images[sld].main[img],galleryTitle:galleries[gal].title};lastImg.isSlideFinished=false;imageData.push(lastImg);}}
slideData.push({name:slideIndex++,data:new Queue(imageData)});lastImg.isSlideFinished=true;}}
galleryData.push({name:galleries[gal].title,data:new Queue(slideData)});}
var result=new Queue(galleryData);result.reporitiseGallery=result.reQueue;result.reporitiseSlide=function(galleryTitle,slideIndex)
{result.reporitiseGallery(galleryTitle);for(var i=0;i<galleryData.length;i++)
if(galleryData[i].name==galleryTitle)
galleryData[i].data.reQueue(slideIndex);}
result.inQueue=function(title,index)
{var x=galleryData.first(function(f){return f.name==title});return x.data._data.contains(function(f){return f.name==index});}
return result;}
function _Request(href)
{this.params={};var query=href.split('?')[1];if(query)
{var queryParams=query.split('&');var self=this;queryParams.each(function(prop)
{var firstKey=prop.split('=')[0];var firstValue=prop.split('=')[1]
eval("self.params."+firstKey+" = '"+unescape(firstValue)+"';");});}}
var Request=new _Request(location.href);function LinksController()
{var linkBlockSelector="h1";var linkSectionSelector=".linkSection";var firstLinkBlockSelector="h1:first-child";var defaultController=new DefaultController()
var self=this;var singleBlockWidth=$(firstLinkBlockSelector).outerWidth()+16
this.getColumnCount=function()
{var containedWidth=$(linkSectionSelector).width();var colCount=parseInt(containedWidth/singleBlockWidth);return colCount;}
this.positionBlocks=function()
{var currentCol=0;var currentV=self.getTopOffset();var startingV=currentV;var currentL=self.getLeftOffset();var index=0;var maxV=0;var columnCount=self.getColumnCount();var perColumnCount=parseInt($("h1").children().length/columnCount+.5)
var height=0;var colIndex=0;$(linkBlockSelector).each(function()
{$(this).css({position:"absolute",left:currentL,top:currentV,marginLeft:0,marginRight:0});currentV+=$(this).outerHeight()+16;$(this).next().css({position:"absolute",left:currentL,top:currentV});currentV+=$(this).next().outerHeight();height+=$(this).outerHeight()+16;height+=$(this).next().outerHeight();index++;if(index==perColumnCount)
{colIndex++
if(colIndex<columnCount)
{if(height>maxV)
maxV=height;height=0;index=0;currentV=startingV;currentL+=singleBlockWidth;}}});if(height>maxV)
maxV=height;$(linkSectionSelector).height(maxV);}
this.getLeftOffset=function()
{var containedWidth=$(linkSectionSelector).width();var requiredWidth=self.getColumnCount()*singleBlockWidth;return $(linkSectionSelector).offset().left+(containedWidth/2)-(requiredWidth/2)}
this.getTopOffset=function()
{return $(linkSectionSelector).offset().top;}
var inResize=false;this.onresize=function()
{if(inResize)
return;inResize=true;defaultController.repositionBody();self.positionBlocks();inResize=false;}}
function loadGalleries(requestUrl,lastFunc)
{var g=new GalleryLoader();g.loadGalleries(requestUrl,lastFunc);}
function GalleryLoader()
{var self=this;var tableLoader=new TableLoader();this.parseImage=tableLoader.parseImage;this.loadGalleries=function(requestUrl,lastFunc)
{var galleryList=jQuery.ajax({url:requestUrl,async:false,dataType:"html",global:false}).responseText;var path=Path.extractFrom(requestUrl);galleryList=galleryList.globalReplace('href="','href="'+path);$("body").append("<div id='rawGalleriesList' style='visibility:hidden; display:none;' ></div>");$("#rawGalleriesList").html(galleryList);var galleries=new Array();var galleryUrls=new Array();$("#rawGalleriesList a").each(function(i)
{galleryUrls[i]=this.attributes.getNamedItem("href").value;});$("#rawGalleriesList").remove();this.sheduleGalleryDownload(function(){return galleryUrls.shift();},function(){lastFunc(galleries);},function(g){galleries.push(g);});}
this.sheduleGalleryDownload=function(getNextUrlFunc,lastFunc,onLoad)
{var url=getNextUrlFunc();if(url!=undefined)
jQuery.ajax({url:url,async:true,dataType:"html",global:false,complete:function(response){var result=self.sheduleGalleryDownload(getNextUrlFunc,lastFunc,onLoad);onLoad(self.loadGallery(url,response.responseText));if(!result)
lastFunc();}});return url!=undefined;}
this.loadGallery=function(requestUrl,listTable)
{var ourPath=Path.extractFrom(location.href);var path=Path.extractFrom(requestUrl);path=Path.trim(ourPath,path);listTable=listTable.globalReplace('src="','tag="'+path);$("body").append("<div id='rawGallery' style='visibility:hidden; display:none;' ></div>");$("#rawGallery").html(listTable);var images=new Array();var maxThumb={width:0,height:0};var mainImgDimensions=new ImageSizeCalc();$("#rawGallery table:first++").find("tr").each(function(i)
{if(i!=0)
{i--;var firstTableCell=$(this).find("td:first");var secondTableCell=firstTableCell.next();var thumbImg=secondTableCell.find("img:first");images[i]={thumb:thumbImg.attr("tag"),name:firstTableCell.text(),main:self.parseImage(secondTableCell.next())};var imgs=images[i];if(imgs.main.length==undefined)
{imgs.dimension={width:imgs.main.width,height:imgs.main.height,imageCount:1};mainImgDimensions.addDimension(imgs.main.width,imgs.main.height);}
else
{imgs.main.each(function(img){mainImgDimensions.addDimension(img.width,img.height)});imgs.dimension={width:mainImgDimensions.currentDimension.width,height:mainImgDimensions.currentDimension.height,imageCount:mainImgDimensions.currentDimension.imageCount};}
mainImgDimensions.nextSlide();calcNewMaxDimension(thumbImg,maxThumb);}});var firstRow=$("#rawGallery table:first tr:first");var secondRow=firstRow.next();var thirdRow=secondRow.next();var fourthRow=thirdRow.next();var result={title:jQuery.trim(firstRow.find(":first-child+").text()),galleryImage:Path.trim(ourPath,secondRow.find("img:first").attr("tag")),blurb:thirdRow.find("td:first").html().globalReplace("tag=","src="),year:jQuery.trim(fourthRow.find("td:first").text()),portalImage:mainImgDimensions.dimension,thumbImageDimensions:maxThumb,images:images};$("#rawGallery").remove();return result;}}
function ImageSizeCalc()
{this.currentDimension={width:0,height:0,imageCount:0};this.dimension={width:0,height:0,imageCount:0};this.addDimension=function(w,h)
{if(w>this.currentDimension.width)
this.currentDimension.width=w;this.currentDimension.height+=h;this.currentDimension.imageCount++;}
this.nextSlide=function()
{if(this.currentDimension.imageCount>this.dimension.imageCount)
this.dimension.imageCount=this.currentDimension.imageCount;this.currentDimension.imageCount=0;if(this.currentDimension.width>this.dimension.width)
this.dimension.width=this.currentDimension.width;this.currentDimension.width=0;if(this.currentDimension.height>this.dimension.height)
this.dimension.height=this.currentDimension.height;this.currentDimension.height=0;}}
function calcNewMaxDimension(img,max)
{max.width=calcNewMax(img.css("width"),max.width);max.height=calcNewMax(img.css("height"),max.height);}
function calcNewMax(current,max)
{if(current.endsWith("px"))
{current=parseInt(current);if(current>max)
max=current;}
return max;}
function NewsModel(url)
{var tableLoader=new TableLoader();var model=tableLoader.loadList(url);return model;}
function AllNewsModel(href)
{var tableLoader=new TableLoader();var schema={src:href,definition:{date:"text",heading:"text",image:"image",description:"html",homePage:"text",hideInNews:"text"}};return tableLoader.load(schema)}
function NewsPageModel(href)
{return AllNewsModel(href).where(function(f){return!(f.hideInNews&&f.hideInNews.toLowerCase()=="yes")}).toArray()}
function NewsController(model,htmlTemplate)
{this.onresize=new DefaultController().onresize;this.showSection=function(index)
{var href;if(typeof(index)=="string")
href=model.first(function(f){return f.name==index}).href
else
href=model[index].href;model.activeItems=NewsPageModel(href);htmlTemplate.apply(model);this.onresize();this.onresize();}}
var Path={extractFrom:function(url)
{var p=url.lastIndexOf("/");return url.substr(0,p+1);},trim:function(path,pathFile)
{if(pathFile.substr(0,path.length)==path)
return pathFile.substr(path.length);else
return pathFile;}};function Queue(_data)
{var data=new Array();for(var i=0;i<_data.length;i++)
data[i]=_data[i];this.onFinish=function(){};this.dequeue=function(innerOnLastFunc)
{if(data.length>0)
{var result=data[0];if(result.data.hasOwnProperty("dequeue"))
{result=data[0].data.dequeue();if(result==undefined)
{data.shift();result=this.dequeue();}}
else
{data.shift();}}
return result;}
this.reQueue=function(itemToRequeue)
{data=[data.first(function(d){return d.name==itemToRequeue})].catenate(data.where(function(d){return d.name!=itemToRequeue})).toArray();}
this.inQueue=function(itemToTestFor)
{return data.contains(function(f){return f.name==itemToTestFor});}
this._data=data;}
function Scheduler(queue,handler)
{this.start=function()
{var self=this;var next=queue.dequeue();if(next!=undefined)
handler(next,function(){self.start();});};}
String.prototype.globalReplace=function(itemToFind,itemToReplace,exception)
{var str=this;var next=0;itemToReplace=itemToReplace.toString();while((next=str.indexOf(itemToFind,next))!=-1)
{if(exception==undefined||str.substr(next+itemToFind.length,exception.length)!=exception)
str=str.substr(0,next)+itemToReplace+str.substr(next+itemToFind.length);next+=itemToReplace.length;}
return str.toString();}
String.prototype.replaceProperties=function(outerValue,outerName)
{var html=this.toString();if(outerValue.length==undefined)
{for(var name in outerValue)
{var value=outerValue[name];var key=(outerName==undefined)?name:outerName+"."+name;html=html.globalReplace("!"+key+"!",value);html=html.globalReplace("%21"+key+"%21",value);html=html.replaceProperties(value,key);}}
return html.toString();}
String.prototype.endsWith=function(item)
{return this.substr(this.length-item.length)==item;}
function TableLoader()
{var self=this;this.load=function(schema)
{var content=jQuery.ajax({url:schema.src,async:false,dataType:"html",global:false}).responseText;var ourPath=Path.extractFrom(location.href);var path=Path.extractFrom(schema.src);path=Path.trim(ourPath,path);content=content.globalReplace('src="','tag="'+path,"http:");content=content.globalReplace('href="','href="'+path,"http:");$("body").append("<div id='rawTable' style='visibility:hidden; display:none;' ></div>");$("#rawTable").html(content);var result=new Array();$("#rawTable table:first").find("tr").each(function(i)
{if(i!=0)
{var item={};var tableCell=$(this).find("td:first");for(var fld in schema.definition)
{if(schema.definition[fld]=='image')
{var img=self.parseImage(tableCell);if(img!=undefined)
item[fld]=img;}
else
{var value=self.trim(tableCell[schema.definition[fld]]());if(schema.definition[fld]=="html")
value=value.globalReplace('tag="','src="');if(value!="")
item[fld]=value;}
tableCell=tableCell.next();}
result[i-1]=item;}});$("#rawTable").remove();return result;}
this.parseImage=function(tableCell)
{var result;var img=tableCell.find("img");if(img.length==1)
{result={src:img.attr("tag"),width:parseInt(img.css("width")),height:parseInt(img.css("height"))};}
else if(img.length>1)
{result=new Array();img.each(function(i,m)
{var jm=$(m);result[i]={src:m.attributes.getNamedItem("tag").value,width:parseInt(jm.css("width")),height:parseInt(jm.css("height"))}})}
return result;}
this.loadList=function(url)
{var list=jQuery.ajax({url:url,async:false,dataType:"html",global:false}).responseText;var path=Path.extractFrom(url);list=list.globalReplace('href="','href="'+path);$("body").append("<div id='rawList' style='visibility:hidden; display:none;' ></div>");$("#rawList").html(list);var result=new Array();var index=0;$("#rawList a").not("#contentUrl").each(function(i)
{result[i]={name:$(this).text(),href:this.attributes.getNamedItem("href").value};});$("#rawList").remove();return result;}
this.trim=function(s)
{s=$.trim(s);while(s.charCodeAt(0)==160)
s=s.substr(1);while(s.charCodeAt(s.length-1)==160)
s=s.substr(0,s.length-1);return s;}}
function Template(template)
{this.translateDsl=function(script)
{return this.translateEach(script);}
this.translateEach=function(script)
{var result=new StringBuffer();var i=script.indexOf("each(");var p=0;while(i!=-1)
{result.append(script.slice(p,i));result.append("for( var index = 0; index <");p=script.indexOf(",",i);result.append(script.slice(i+5,p));p+=1;result.append(".length; index++ )");i=script.indexOf("each(",i+1);}
result.append(script.substr(p));return result.toString();}
this.buildScript=function(template)
{var segments=template.split("##");var script=new StringBuffer();for(var i=0;i<segments.length;i+=2)
{script.append('append("');var s=segments[i].globalReplace('"','\\"')
s=s.globalReplace("\r","");s=s.globalReplace("\n","");script.append(s);script.append('");\r\n');if(i+1<segments.length)
{if(segments[i+1].charAt(0)=='=')
{script.append('append(');script.append(segments[i+1].substr(1));script.append(');\r\n');}
else
script.append(segments[i+1]+"\r\n");}}
return this.translateDsl(script.toString());}
var script=this.buildScript(template);this.apply=function(m)
{var context={buffer:[],append:function(string)
{this.buffer.push(string);},toString:function()
{return this.buffer.join("");},model:m};for(var p in m)
context[p]=m[p];with(context){eval(script)};return context.toString();}}
function HtmlTemplate(selector,templateScript)
{if($(selector).length==0)
throw"selector "+selector+" must have at least one instance.";if(templateScript==undefined)
templateScript=$(selector).html();var p=templateScript.indexOf("<!--Template");if(p!=-1)
{var endMarker=templateScript.indexOf("-->",p);templateScript=templateScript.slice(0,p)+templateScript.slice(p+12,endMarker)+templateScript.slice(endMarker+3);}
var template=new Template(templateScript);this.apply=function(model)
{var result=template.apply(model);$(selector).html(result);}}
function StringBuffer(){this.buffer=[];}
StringBuffer.prototype.append=function append(string){this.buffer.push(string);return this;};StringBuffer.prototype.toString=function toString(){return this.buffer.join("");};
