/*
 * jQuery 1.2.3 - New Wave Javascript
 *
 * Copyright (c) 2008 John Resig (jquery.com)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * $Date: 2008-02-06 00:21:25 -0500 (Wed, 06 Feb 2008) $
 * $Rev: 4663 $
 */
(function(){if(window.jQuery)var _jQuery=window.jQuery;var jQuery=window.jQuery=function(selector,context){return new jQuery.prototype.init(selector,context);};if(window.$)var _$=window.$;window.$=jQuery;var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/;var isSimple=/^.[^:#\[\.]*$/;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}else if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem)if(elem.id!=match[3])return jQuery().find(selector);else{this[0]=elem;this.length=1;return this;}else
selector=[];}}else
return new jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return new jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(selector.constructor==Array&&selector||(selector.jquery||selector.length&&selector!=window&&!selector.nodeType&&selector[0]!=undefined&&selector[0].nodeType)&&jQuery.makeArray(selector)||[selector]);},jquery:"1.2.3",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;this.each(function(i){if(this==elem)ret=i;});return ret;},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value==undefined)return this.length&&jQuery[type||"attr"](this[0],name)||undefined;else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else
return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else
selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return!selector?this:this.pushStack(jQuery.merge(this.get(),selector.constructor==String?jQuery(selector).get():selector.length!=undefined&&(!selector.nodeName||jQuery.nodeName(selector,"form"))?selector:[selector]));},is:function(selector){return selector?jQuery.multiFilter(selector,this).length>0:false;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one)return value;values.push(value);}}return values;}else
return(this[0].value||"").replace(/\r/g,"");}return undefined;}return this.each(function(){if(this.nodeType!=1)return;if(value.constructor==Array&&/radio|checkbox/.test(this.type))this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=value.constructor==Array?value:[value];jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else
this.value=value;});},html:function(value){return value==undefined?(this.length?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value==null){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data==undefined&&this.length)data=jQuery.data(this[0],key);return data==null&&parts[1]?this.data(parts[0]):data;}else
return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script")){scripts=scripts.add(elem);}else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.prototype.init.prototype=jQuery.prototype;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else
jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==1){target=this;i=0;}for(;i<length;i++)if((options=arguments[i])!=null)for(var name in options){if(target===options[name])continue;if(deep&&options[name]&&typeof options[name]=="object"&&target[name]&&!options[name].nodeType)target[name]=jQuery.extend(target[name],options[name]);else if(options[name]!=undefined)target[name]=options[name];}return target;};var expando="jQuery"+(new Date()).getTime(),uuid=0,windowData={};var exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i;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){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie)script.text=data;else
script.appendChild(document.createTextNode(data));head.appendChild(script);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])jQuery.cache[id]={};if(data!=undefined)jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])break;if(!name)jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute)elem.removeAttribute(expando);}delete jQuery.cache[id];}},each:function(object,callback,args){if(args){if(object.length==undefined){for(var name in object)if(callback.apply(object[name],args)===false)break;}else
for(var i=0,length=object.length;i<length;i++)if(callback.apply(object[i],args)===false)break;}else{if(object.length==undefined){for(var name in object)if(callback.call(object[name],name,object[name])===false)break;}else
for(var i=0,length=object.length,value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))value=value.call(elem,i);return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else
jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret;function color(elem){if(!jQuery.browser.safari)return false;var ret=document.defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(elem.style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=elem.style.outline;elem.style.outline="0 solid black";elem.style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&elem.style&&elem.style[name])ret=elem.style[name];else if(document.defaultView&&document.defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var getComputedStyle=document.defaultView.getComputedStyle(elem,null);if(getComputedStyle&&!color(elem))ret=getComputedStyle.getPropertyValue(name);else{var swap=[],stack=[];for(var a=elem;a&&color(a);a=a.parentNode)stack.unshift(a);for(var i=0;i<stack.length;i++)if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block";}ret=name=="display"&&swap[stack.length-1]!=null?"none":(getComputedStyle&&getComputedStyle.getPropertyValue(name))||"";for(var i=0;i<swap.length;i++)if(swap[i]!=null)stack[i].style.display=swap[i];}if(name=="opacity"&&ret=="")ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var style=elem.style.left,runtimeStyle=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;elem.style.left=ret||0;ret=elem.style.pixelLeft+"px";elem.style.left=style;elem.runtimeStyle.left=runtimeStyle;}}return ret;},clean:function(elems,context){var ret=[];context=context||document;if(typeof context.createElement=='undefined')context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;jQuery.each(elems,function(i,elem){if(!elem)return;if(elem.constructor==Number)elem=elem.toString();if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else
ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var 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){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";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&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100).toString():"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(value!=undefined)elem[name]=value;return elem[name];}},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(typeof array!="array")for(var i=0,length=array.length;i<length;i++)ret.push(array[i]);else
ret=array.slice(0);return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)if(array[i]==elem)return i;return-1;},merge:function(first,second){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(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;}return ret;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++)if(!inv&&callback(elems[i],i)||inv&&!callback(elems[i],i))ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!==null&&value!=undefined){if(value.constructor!=Array)value=[value];ret=ret.concat(value);}}return ret;}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,innerHTML:"innerHTML",className:"className",value:"value",disabled:"disabled",checked:"checked",readonly:"readOnly",selected:"selected",maxlength:"maxLength",selectedIndex:"selectedIndex",defaultValue:"defaultValue",tagName:"tagName",nodeName:"nodeName"}});jQuery.each({parent:function(elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++)jQuery(args[i])[original](this);});};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)this.parentNode.removeChild(this);}},empty:function(){jQuery(">*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return i<m[3]-0;},gt:function(a,i,m){return i>m[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false;var re=quickChild;var m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling)if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id])break;if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~")merge[id]=true;r.push(n);}if(m=="+")break;}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true;}}if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0])ret.shift();done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length);}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]];}else{re2=quickClass;m=re2.exec(t);}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2])oid=jQuery('[@id="'+m[2]+'"]',elem)[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[];}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object")tag="param";r=jQuery.merge(r,ret[i].getElementsByTagName(tag));}if(m[1]==".")r=jQuery.classFilter(r,m[2]);if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++)if(r[i].getAttribute("id")==m[2]){tmp=[r[i]];break;}r=tmp;}ret=r;}t=t.replace(re2,"");}}if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t);}}if(t)ret=[];if(ret&&context==ret[0])ret.shift();done=jQuery.merge(done,ret);return done;},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2]))z=jQuery.attr(a,m[2])||'';if((type==""&&!!z||type=="="&&z==m[5]||type=="!="&&z!=m[5]||type=="^="&&z&&!z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling)if(n.nodeType==1)n.nodeIndex=c++;merge[id]=true;}var add=false;if(first==0){if(node.nodeIndex==last)add=true;}else if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[];var cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&(!elem||n!=elem))r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval!=undefined)elem=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;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){var val;if(typeof jQuery=="undefined"||jQuery.event.triggered)return val;val=jQuery.event.handle.apply(arguments.callee.elem,arguments);return val;});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else
for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data||[]);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event)data.unshift(this.fix({type:type,target:elem}));data[0].type=type;if(exclusive)data[0].exclusive=true;if(jQuery.isFunction(jQuery.data(elem,"handle")))val=jQuery.data(elem,"handle").apply(elem,data);if(!fn&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val;event=jQuery.event.fix(event||window.event||{});var parts=event.type.split(".");event.type=parts[0];var handlers=jQuery.data(this,"events")&&jQuery.data(this,"events")[event.type],args=Array.prototype.slice.call(arguments,1);args.unshift(event);for(var j in handlers){var handler=handlers[j];args[0].handler=handler;args[0].data=handler.data;if(!parts[1]&&!event.exclusive||handler.type==parts[1]){var ret=handler.apply(this,args);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}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.target=event.srcElement||document;if(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 doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;arguments[0].type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;arguments[0].type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){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,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){if(this[0])return jQuery.event.trigger(type,data,this[0],false,fn);return undefined;},toggle:function(){var args=arguments;return this.click(function(event){this.lastToggle=0==this.lastToggle?1:0;event.preventDefault();return args[this.lastToggle].apply(this,arguments)||false;});},hover:function(fnOver,fnOut){return this.bind('mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else
jQuery.readyList.push(function(){return fn.call(this,jQuery);});return this;}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.apply(document);});jQuery.readyList=null;}jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&&!jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}jQuery.ready();})();if(jQuery.browser.opera)document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i<document.styleSheets.length;i++)if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}jQuery.ready();},false);if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(numStyles===undefined)numStyles=jQuery("style, link[rel=stylesheet]").length;if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return;}jQuery.ready();})();}jQuery.event.add(window,"load",jQuery.ready);}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,change,select,"+"submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem)try{parent=parent.parentNode;}catch(error){parent=elem;}return parent==elem;};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind();});jQuery.fn.extend({load:function(url,params,callback){if(jQuery.isFunction(url))return this.bind("load",url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=(new Date).getTime();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){var jsonp,jsre=/=\?(&|$)/g,status,data;s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(s.type.toLowerCase()=="get"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&s.type.toLowerCase()=="get"){var ts=(new Date()).getTime();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&s.type.toLowerCase()=="get"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");if((!s.url.indexOf("http")||!s.url.indexOf("//"))&&s.dataType=="script"&&s.type.toLowerCase()=="get"){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xml=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();xml.open(s.type,s.url,s.async,s.username,s.password);try{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");xml.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}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;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xml)&&"error"||s.ifModified&&jQuery.httpNotModified(xml,s.url)&&"notmodified"||"success";if(status=="success"){try{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(!jsonp)success();}else
jQuery.handleError(s,xml,status);complete();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();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xml,s]);}function complete(){if(s.complete)s.complete(xml,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xml,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}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||r.status==1223||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;var 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("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle(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){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall);var hidden=jQuery(this).is(":hidden"),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";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else
e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.apply(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(!elem)return undefined;type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",array?jQuery.makeArray(array):[]);return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].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(){if(opt.queue!==false)jQuery(this).dequeue();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;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.apply(this.elem,[this.now,this]);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=(new Date()).getTime();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)if(!timers[i]())timers.splice(i--,1);if(!timers.length){clearInterval(jQuery.timerId);jQuery.timerId=null;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(0,this.cur());if(this.prop=="width"||this.prop=="height")this.elem.style[this.prop]="1px";jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=(new Date()).getTime();if(gotoEnd||t>this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done&&jQuery.isFunction(this.options.complete))this.options.complete.apply(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.fx.step={scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}};jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),fixed=jQuery.css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&jQuery.css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(jQuery.css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&jQuery.css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||jQuery.css(offsetChild,"position")=="absolute"))||(mozilla&&jQuery.css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l)||0;top+=parseInt(t)||0;}return results;};})();
/*

xmlrpc.js beta version 1
Tool for creating XML-RPC formatted requests in JavaScript

Copyright 2001 Scott Andrew LePera
scott@scottandrew.com
http://www.scottandrew.com/xml-rpc

License:
You are granted the right to use and/or redistribute this
code only if this license and the copyright notice are included
and you accept that no warranty of any kind is made or implied
by the author.

*/

function XMLRPCMessage(methodname){
  this.method = methodname||"system.listMethods";
  this.params = [];
  return this;
}

XMLRPCMessage.prototype.setMethod = function(methodName){
  if (!methodName) return;
  this.method = methodName;
}

XMLRPCMessage.prototype.addParameter = function(data){
  if (arguments.length==0) return;
  this.params[this.params.length] = data;
}

XMLRPCMessage.prototype.xml = function(){

  var method = this.method;

  // assemble the XML message header
  var xml = "";

  xml += "<?xml version=\"1.0\"?>\n";
  xml += "<methodCall>\n";
  xml += "<methodName>" + method+ "</methodName>\n";
  xml += "<params>\n";

  // do individual parameters
  for (var i = 0; i < this.params.length; i++){
	 var data = this.params[i];
	 xml += "<param>\n";

	 xml += "<value>" + XMLRPCMessage.getParamXML(XMLRPCMessage.dataTypeOf(data),data) + "</value>\n";

	 xml += "</param>\n";
  }

  xml += "</params>\n";
  xml += "</methodCall>";

  return xml; // for now
}

XMLRPCMessage.dataTypeOf = function (o){
  // identifies the data type
  var type = typeof(o);
  type = type.toLowerCase();
  switch(type){
	 case "number":
		if (Math.round(o) == o) type = "i4";
		else type = "double";
		break;
	 case "object":
		var con = o.constructor;
		if (con == Date) type = "date";
		else if (con == Array) type = "array";
		else type = "struct";
		break;
  }
  return type;
}

XMLRPCMessage.doValueXML = function(type,data){
  var xml = "<" + type + ">" + data + "</" + type + ">";
  return xml;
}

XMLRPCMessage.doBooleanXML = function(data){
  var value = (data==true)?1:0;
  var xml = "<boolean>" + value + "</boolean>";
  return xml;
}

XMLRPCMessage.doDateXML = function(data){
  var xml = "<dateTime.iso8601>";
  xml += dateToISO8601(data);
  xml += "</dateTime.iso8601>";
  return xml;
}

XMLRPCMessage.doArrayXML = function(data){
  var xml = "<array><data>\n";
  for (var i = 0; i < data.length; i++){
	 xml += "<value>" + XMLRPCMessage.getParamXML(XMLRPCMessage.dataTypeOf(data[i]),data[i]) + "</value>\n";
  }
  xml += "</data></array>\n";
  return xml;
}

XMLRPCMessage.doStructXML = function(data){
  var xml = "<struct>\n";
  for (var i in data){
	 xml += "<member>\n";
	 xml += "<name>" + i + "</name>\n";
	 xml += "<value>" + XMLRPCMessage.getParamXML(XMLRPCMessage.dataTypeOf(data[i]),data[i]) + "</value>\n";
	 xml += "</member>\n";
  }
  xml += "</struct>\n";
  return xml;
}

XMLRPCMessage.getParamXML = function(type,data){
  var xml;
  switch (type){
	 case "date":
		xml = XMLRPCMessage.doDateXML(data);
		break;
	 case "array":
		xml = XMLRPCMessage.doArrayXML(data);
		break;
	 case "struct":
		xml = XMLRPCMessage.doStructXML(data);
		break;
	  case "boolean":
		xml = XMLRPCMessage.doBooleanXML(data);
		break;
	 default:
		xml = XMLRPCMessage.doValueXML(type,data);
		break;
  }
  return xml;
}

function dateToISO8601(date){
  // wow I hate working with the Date object
  var year = new String(date.getYear());
  var month = leadingZero(new String(date.getMonth()));
  var day = leadingZero(new String(date.getDate()));
  var time = leadingZero(new String(date.getHours())) + ":" + leadingZero(new String(date.getMinutes())) + ":" + leadingZero(new String(date.getSeconds()));

  var converted = year+month+day+"T"+time;
  return converted;
}

function leadingZero(n){
  // pads a single number with a leading zero. Heh.
  if (n.length==1) n = "0" + n;
  return n;
}

// fire off an xmlrpc call
jQuery.xmlrpc = function(url,method,params,callback,async) {
	// asynchonous by default
	if (typeof(async) == 'undefined') async = true;

	var msg = new XMLRPCMessage(method);
	for(i=0; i<params.length; i++) msg.addParameter(params[i]);

	$.ajax({
		type: "POST",
		url: url,
		data: msg.xml(),
		dataType: 'xml',
		contentType: 'text/xml',
		processData: false,
		complete: callback,
		async: async
	});
}

// fire off a xmlrpc call that is notify, e.g no return value checked
jQuery.xmlrpcNotify = function(url,method,params) {
	var msg = new XMLRPCMessage(method);
	for(i=0; i<params.length; i++) msg.addParameter(params[i]);

	// var http = new XMLHttpRequest(); - no.
	// Do this instead (copied from jQuery source):
	// Create the request object; Microsoft failed to properly
	// implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available
	var http = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();

	var xml = msg.xml();
	http.open('POST', url, true);
	http.setRequestHeader("Content-type","text/xml");
	http.setRequestHeader("Content-length",xml.length);
	http.setRequestHeader("Connection", "close");
	http.send(xml);
}

/**
 * Gazette.Rpc - Remote procedure call interface
 *
 * This interface should be used for all RPCs in Gazette.
 * Currently uses JQuery XMLRPC plugin.
 *
 * @see xmlrpc.js
 * @todo Implement JSON alternative
 * @author Andrew Markham <andrew.markham@sitepoint.com>
 */
var Gazette = Gazette || {};
Gazette.Rpc = Gazette.Rpc || {};
/**
 * Call a remote method and execute 'callback' on completion.
 * @param string    url 		url of RPC endpoint
 * @param string    method 		RPC method
 * @param array     params 		RPC params
 * @param function  callback 	function to execute on completion
 * @param async     boolean 	execute asynchronously (true) or synchronously (false)
 */
Gazette.Rpc.call = function(url, method, params, callback, async)
{
	$.xmlrpc(url, method, params, callback, async || true);
};	
/**
 * Parses the RPC response into a Javascript object
 * @param XMLHttpResponse response;
 * @return object
 */
Gazette.Rpc.parseResponse = function(response)
{
	var o = new Object;
	$(response.responseXML).find('member').each(function(){
		name    = $(this).find('name').text();
		o[name] = $(this).find('value').text();
	});
	return o;
};
/**
 * Call a remote method but don't wait for a response.
 * @param string url    url of RPC server
 * @param string method RPC method
 * @param array  params RPC params
 */
Gazette.Rpc.notify = function(url, method, params)
{
	$.xmlrpcNotify(url, method, params);
};

// requires jQuery
$(document).ready(function(){
	$('a[@rel="external"]').each(function(){
		this.target = "_blank";
	});
});

/*
 * Interface elements for jQuery - http://interface.eyecon.ro
 *
 * Copyright (c) 2006 Stefan Petre
 * Dual licensed under the MIT (MIT-LICENSE.txt) 
 * and GPL (GPL-LICENSE.txt) licenses.
 */
 eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('6.T={2y:C(e){u x=0;u y=0;u 3f=D;u U=e.S;8(6(e).I(\'X\')==\'Z\'){2O=U.1Y;4o=U.11;U.1Y=\'2s\';U.X=\'2L\';U.11=\'2j\';3f=Q}u B=e;45(B){x+=B.4N+(B.3l&&!6.1P.46?K(B.3l.4S)||0:0);y+=B.4T+(B.3l&&!6.1P.46?K(B.3l.5g)||0:0);B=B.66}B=e;45(B&&B.6e&&B.6e.4L()!=\'1l\'){x-=B.3b||0;y-=B.2o||0;B=B.2a}8(3f){U.X=\'Z\';U.11=4o;U.1Y=2O}G{x:x,y:y}},7k:C(B){u x=0,y=0;45(B){x+=B.4N||0;y+=B.4T||0;B=B.66}G{x:x,y:y}},21:C(e){u w=6.I(e,\'3d\');u h=6.I(e,\'3p\');u 1n=0;u 1i=0;u U=e.S;8(6(e).I(\'X\')!=\'Z\'){1n=e.4Y;1i=e.4X}L{2O=U.1Y;4o=U.11;U.1Y=\'2s\';U.X=\'2L\';U.11=\'2j\';1n=e.4Y;1i=e.4X;U.X=\'Z\';U.11=4o;U.1Y=2O}G{w:w,h:h,1n:1n,1i:1i}},5j:C(B){G{1n:B.4Y||0,1i:B.4X||0}},5J:C(e){u h,w,35;8(e){w=e.3R;h=e.3G}L{35=R.1H;w=2w.5c||40.5c||(35&&35.3R)||R.1l.3R;h=2w.4W||40.4W||(35&&35.3G)||R.1l.3G}G{w:w,h:h}},6t:C(e){u t,l,w,h,30,2N;8(e&&e.4B.4L()!=\'1l\'){t=e.2o;l=e.3b;w=e.51;h=e.4P;30=0;2N=0}L{8(R.1H&&R.1H.2o){t=R.1H.2o;l=R.1H.3b;w=R.1H.51;h=R.1H.4P}L 8(R.1l){t=R.1l.2o;l=R.1l.3b;w=R.1l.51;h=R.1l.4P}30=40.5c||R.1H.3R||R.1l.3R||0;2N=40.4W||R.1H.3G||R.1l.3G||0}G{t:t,l:l,w:w,h:h,30:30,2N:2N}},6V:C(e,37){u B=6(e);u t=B.I(\'2K\')||\'\';u r=B.I(\'2G\')||\'\';u b=B.I(\'2H\')||\'\';u l=B.I(\'2A\')||\'\';8(37)G{t:K(t)||0,r:K(r)||0,b:K(b)||0,l:K(l)};L G{t:t,r:r,b:b,l:l}},7S:C(e,37){u B=6(e);u t=B.I(\'6i\')||\'\';u r=B.I(\'6m\')||\'\';u b=B.I(\'6s\')||\'\';u l=B.I(\'6n\')||\'\';8(37)G{t:K(t)||0,r:K(r)||0,b:K(b)||0,l:K(l)};L G{t:t,r:r,b:b,l:l}},48:C(e,37){u B=6(e);u t=B.I(\'5g\')||\'\';u r=B.I(\'6p\')||\'\';u b=B.I(\'6g\')||\'\';u l=B.I(\'4S\')||\'\';8(37)G{t:K(t)||0,r:K(r)||0,b:K(b)||0,l:K(l)||0};L G{t:t,r:r,b:b,l:l}},3O:C(3I){u x=3I.8p||(3I.7x+(R.1H.3b||R.1l.3b))||0;u y=3I.7t||(3I.8l+(R.1H.2o||R.1l.2o))||0;G{x:x,y:y}},5o:C(1U,4K){4K(1U);1U=1U.3N;45(1U){6.T.5o(1U,4K);1U=1U.74}},8d:C(1U){6.T.5o(1U,C(B){1j(u 1p 1F B){8(3P B[1p]===\'C\'){B[1p]=10}}})},8j:C(B,1g){u 1Z=$.T.6t();u 5v=$.T.21(B);8(!1g||1g==\'3q\')$(B).I({14:1Z.t+((1t.3U(1Z.h,1Z.2N)-1Z.t-5v.1i)/2)+\'1a\'});8(!1g||1g==\'3r\')$(B).I({12:1Z.l+((1t.3U(1Z.w,1Z.30)-1Z.l-5v.1n)/2)+\'1a\'})},7c:C(B,64){u 65=$(\'5T[@4x*="4E"]\',B||R),4E;65.1W(C(){4E=A.4x;A.4x=64;A.S.5x="8q:8m.7Q.7R(4x=\'"+4E+"\')"})}};[].71||(5s.7Y.71=C(v,n){n=(n==10)?0:n;u m=A.1I;1j(u i=n;i<m;i++)8(A[i]==v)G i;G-1});6.6Z=C(e){8(/^86$|^8k$|^8e$|^8f$|^8r$|^7j$|^7B$|^7K$|^7N$|^1l$|^79$|^7A$|^7q$|^7h$|^7d$|^7f$|^87$/i.2S(e.4B))G D;L G Q};6.M.7I=C(e,2l){u c=e.3N;u 2m=c.S;2m.11=2l.11;2m.2K=2l.29.t;2m.2A=2l.29.l;2m.2H=2l.29.b;2m.2G=2l.29.r;2m.14=2l.14+\'1a\';2m.12=2l.12+\'1a\';e.2a.5W(c,e);e.2a.8n(e)};6.M.84=C(e){8(!6.6Z(e))G D;u t=6(e);u U=e.S;u 3f=D;u 1c={};1c.11=t.I(\'11\');8(t.I(\'X\')==\'Z\'){2O=t.I(\'1Y\');U.1Y=\'2s\';U.X=\'\';3f=Q}1c.4Z=6.T.21(e);1c.29=6.T.6V(e);u 57=e.3l?e.3l.5I:t.I(\'7V\');1c.14=K(t.I(\'14\'))||0;1c.12=K(t.I(\'12\'))||0;u 5G=\'7W\'+K(1t.6L()*5a);u 2E=R.8h(/^5T$|^7Z$|^80$|^83$|^4y$|^82$|^56$|^81$|^7U$|^7T$|^7M$|^7L$|^7J$|^7O$/i.2S(e.4B)?\'24\':e.4B);6.1p(2E,\'1C\',5G);2E.1S=\'7P\';u 1s=2E.S;u 14=0;u 12=0;8(1c.11==\'3y\'||1c.11==\'2j\'){14=1c.14;12=1c.12}1s.X=\'Z\';1s.14=14+\'1a\';1s.12=12+\'1a\';1s.11=1c.11!=\'3y\'&&1c.11!=\'2j\'?\'3y\':1c.11;1s.3A=\'2s\';1s.3p=1c.4Z.1i+\'1a\';1s.3d=1c.4Z.1n+\'1a\';1s.2K=1c.29.t;1s.2G=1c.29.r;1s.2H=1c.29.b;1s.2A=1c.29.l;8(6.1P.2P){1s.5I=57}L{1s.8i=57}e.2a.5W(2E,e);U.2K=\'1G\';U.2G=\'1G\';U.2H=\'1G\';U.2A=\'1G\';U.11=\'2j\';U.5Z=\'Z\';U.14=\'1G\';U.12=\'1G\';8(3f){U.X=\'Z\';U.1Y=2O}2E.8o(e);1s.X=\'2L\';G{1c:1c,8g:6(2E)}};6.M.3x={8a:[0,W,W],89:[6b,W,W],88:[6o,6o,8b],8c:[0,0,0],7g:[0,0,W],7b:[62,42,42],7i:[0,W,W],7l:[0,0,2X],76:[0,2X,2X],78:[4O,4O,4O],7m:[0,5n,0],7z:[7D,7G,63],7F:[2X,0,2X],7E:[85,63,47],7w:[W,6a,0],7p:[7o,50,7n],7u:[2X,0,0],7v:[7s,7r,7C],7y:[7H,0,4t],7a:[W,0,W],77:[W,7e,0],7X:[0,2F,0],8G:[75,0,9H],9G:[6b,6c,6a],9F:[9D,9E,6c],9I:[68,W,W],9J:[6d,9O,6d],9N:[4t,4t,4t],9M:[W,9K,9L],9C:[W,W,68],9B:[0,W,0],9t:[W,0,W],9s:[2F,0,0],9r:[0,0,2F],9p:[2F,2F,0],9q:[W,62,0],9u:[W,4v,9Q],9v:[2F,0,2F],9A:[W,0,0],9z:[4v,4v,4v],9y:[W,W,W],9w:[W,W,0]};6.M.2C=C(1O,6f){8(6.M.3x[1O])G{r:6.M.3x[1O][0],g:6.M.3x[1O][1],b:6.M.3x[1O][2]};L 8(1k=/^38\\(\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3})\\s*\\)$/.4s(1O))G{r:K(1k[1]),g:K(1k[2]),b:K(1k[3])};L 8(1k=/38\\(\\s*([0-9]+(?:\\.[0-9]+)?)\\%\\s*,\\s*([0-9]+(?:\\.[0-9]+)?)\\%\\s*,\\s*([0-9]+(?:\\.[0-9]+)?)\\%\\s*\\)$/.4s(1O))G{r:1D(1k[1])*2.55,g:1D(1k[2])*2.55,b:1D(1k[3])*2.55};L 8(1k=/^#([a-2T-33-9])([a-2T-33-9])([a-2T-33-9])$/.4s(1O))G{r:K("2M"+1k[1]+1k[1]),g:K("2M"+1k[2]+1k[2]),b:K("2M"+1k[3]+1k[3])};L 8(1k=/^#([a-2T-33-9]{2})([a-2T-33-9]{2})([a-2T-33-9]{2})$/.4s(1O))G{r:K("2M"+1k[1]),g:K("2M"+1k[2]),b:K("2M"+1k[3])};L G 6f==Q?D:{r:W,g:W,b:W}};6.M.5E={6g:1,4S:1,6p:1,5g:1,2I:1,9x:1,3p:1,12:1,9P:1,a2:1,2H:1,2A:1,2G:1,2K:1,ab:1,aa:1,a5:1,a3:1,1m:1,9T:1,9W:1,6s:1,6n:1,6m:1,6i:1,2R:1,a1:1,14:1,3d:1,1L:1};6.M.5N={a0:1,9Y:1,9Z:1,9X:1,9S:1,1O:1,9R:1};6.M.3t=[\'9U\',\'a4\',\'9V\',\'a8\'];6.M.5d={\'4Q\':[\'3v\',\'5U\'],\'4e\':[\'3v\',\'4U\'],\'4A\':[\'4A\',\'\'],\'4C\':[\'4C\',\'\']};6.4u.1M({6G:C(2f,3i,1q,4p){G A.3w(C(){u 4q=6.3i(3i,1q,4p);u e=2v 6.5C(A,4q,2f)})},53:C(3i,4p){G A.3w(C(){u 4q=6.3i(3i,4p);u e=2v 6.53(A,4q)})},a9:C(1V){G A.1W(C(){8(A.2b)6.58(A,1V)})},a7:C(1V){G A.1W(C(){8(A.2b)6.58(A,1V);8(A.3w&&A.3w[\'M\'])A.3w.M=[]})}});6.1M({53:C(V,N){u z=A,6u;z.1V=C(){8(6.6A(N.3S))N.3S.1B(V)};z.3u=6y(C(){z.1V()},N.1N);V.2b=z},1q:{5D:C(p,n,5A,5B,1N){G((-1t.a6(p*1t.9n)/2)+0.5)*5B+5A}},5C:C(V,N,2f){u z=A,6u;u y=V.S;u 6E=6.I(V,"3A");u 3g=6.I(V,"X");u Y={};z.4g=(2v 6R()).6B();N.1q=N.1q&&6.1q[N.1q]?N.1q:\'5D\';z.41=C(19,1A){8(6.M.5E[19]){8(1A==\'2n\'||1A==\'1X\'||1A==\'5M\'){8(!V.2x)V.2x={};u r=1D(6.2B(V,19));V.2x[19]=r&&r>-5a?r:(1D(6.I(V,19))||0);1A=1A==\'5M\'?(3g==\'Z\'?\'2n\':\'1X\'):1A;N[1A]=Q;Y[19]=1A==\'2n\'?[0,V.2x[19]]:[V.2x[19],0];8(19!=\'1m\')y[19]=Y[19][0]+(19!=\'1L\'&&19!=\'5h\'?\'1a\':\'\');L 6.1p(y,"1m",Y[19][0])}L{Y[19]=[1D(6.2B(V,19)),1D(1A)||0]}}L 8(6.M.5N[19])Y[19]=[6.M.2C(6.2B(V,19)),6.M.2C(1A)];L 8(/^4A$|4C$|3v$|4e$|4Q$/i.2S(19)){u m=1A.2k(/\\s+/g,\' \').2k(/38\\s*\\(\\s*/g,\'38(\').2k(/\\s*,\\s*/g,\',\').2k(/\\s*\\)/g,\')\').8M(/([^\\s]+)/g);6Y(19){23\'4A\':23\'4C\':23\'4Q\':23\'4e\':m[3]=m[3]||m[1]||m[0];m[2]=m[2]||m[0];m[1]=m[1]||m[0];1j(u i=0;i<6.M.3t.1I;i++){u 2g=6.M.5d[19][0]+6.M.3t[i]+6.M.5d[19][1];Y[2g]=19==\'4e\'?[6.M.2C(6.2B(V,2g)),6.M.2C(m[i])]:[1D(6.2B(V,2g)),1D(m[i])]}2z;23\'3v\':1j(u i=0;i<m.1I;i++){u 52=1D(m[i]);u 3Y=!8L(52)?\'5U\':(!/8K|Z|2s|8I|8J|8N|8O|8T|8S|8R|8P/i.2S(m[i])?\'4U\':D);8(3Y){1j(u j=0;j<6.M.3t.1I;j++){2g=\'3v\'+6.M.3t[j]+3Y;Y[2g]=3Y==\'4U\'?[6.M.2C(6.2B(V,2g)),6.M.2C(m[i])]:[1D(6.2B(V,2g)),52]}}L{y[\'8Q\']=m[i]}}2z}}L{y[19]=1A}G D};1j(p 1F 2f){8(p==\'S\'){u 28=6.4G(2f[p]);1j(3n 1F 28){A.41(3n,28[3n])}}L 8(p==\'1S\'){8(R.3W)1j(u i=0;i<R.3W.1I;i++){u 3o=R.3W[i].3o||R.3W[i].8H||10;8(3o){1j(u j=0;j<3o.1I;j++){8(3o[j].9o==\'.\'+2f[p]){u 3a=2v 8x(\'\\.\'+2f[p]+\' {\');u 2d=3o[j].S.8y;u 28=6.4G(2d.2k(3a,\'\').2k(/}/g,\'\'));1j(3n 1F 28){A.41(3n,28[3n])}}}}}}L{A.41(p,2f[p])}}y.X=3g==\'Z\'?\'2L\':3g;y.3A=\'2s\';z.1V=C(){u t=(2v 6R()).6B();8(t>N.1N+z.4g){6M(z.3u);z.3u=10;1j(p 1F Y){8(p=="1m")6.1p(y,"1m",Y[p][1]);L 8(3P Y[p][1]==\'56\')y[p]=\'38(\'+Y[p][1].r+\',\'+Y[p][1].g+\',\'+Y[p][1].b+\')\';L y[p]=Y[p][1]+(p!=\'1L\'&&p!=\'5h\'?\'1a\':\'\')}8(N.1X||N.2n)1j(u p 1F V.2x)8(p=="1m")6.1p(y,p,V.2x[p]);L y[p]="";y.X=N.1X?\'Z\':(3g!=\'Z\'?3g:\'2L\');y.3A=6E;V.2b=10;8(6.6A(N.3S))N.3S.1B(V)}L{u n=t-A.4g;u 3s=n/N.1N;1j(p 1F Y){8(3P Y[p][1]==\'56\'){y[p]=\'38(\'+K(6.1q[N.1q](3s,n,Y[p][0].r,(Y[p][1].r-Y[p][0].r),N.1N))+\',\'+K(6.1q[N.1q](3s,n,Y[p][0].g,(Y[p][1].g-Y[p][0].g),N.1N))+\',\'+K(6.1q[N.1q](3s,n,Y[p][0].b,(Y[p][1].b-Y[p][0].b),N.1N))+\')\'}L{u 5e=6.1q[N.1q](3s,n,Y[p][0],(Y[p][1]-Y[p][0]),N.1N);8(p=="1m")6.1p(y,"1m",5e);L y[p]=5e+(p!=\'1L\'&&p!=\'5h\'?\'1a\':\'\')}}}};z.3u=6y(C(){z.1V()},13);V.2b=z},58:C(V,1V){8(1V)V.2b.4g-=8w;L{2w.6M(V.2b.3u);V.2b=10;6.8v(V,"M")}}});6.4G=C(2d){u 28={};8(3P 2d==\'8t\'){2d=2d.4L().6x(\';\');1j(u i=0;i<2d.1I;i++){3a=2d[i].6x(\':\');8(3a.1I==2){28[6.6O(3a[0].2k(/\\-(\\w)/g,C(m,c){G c.8u()}))]=6.6O(3a[1])}}}G 28};6.E={O:10,k:10,4k:C(){G A.1W(C(){8(A.4r){A.7.1R.31(\'67\',6.E.5w);A.7=10;A.4r=D;8(6.1P.2P){A.5k="8z"}L{A.S.8s=\'\';A.S.5F=\'\';A.S.5V=\'\'}}})},5w:C(e){8(6.E.k!=10){6.E.4i(e);G D}u q=A.4n;6(R).2c(\'2D\',6.E.5m).2c(\'6J\',6.E.4i);q.7.1b=6.T.3O(e);q.7.1E=q.7.1b;q.7.43=D;q.7.8A=A!=A.4n;6.E.k=q;8(q.7.2q&&A!=A.4n){4M=6.T.2y(q.2a);4J=6.T.21(q);4H={x:K(6.I(q,\'12\'))||0,y:K(6.I(q,\'14\'))||0};16=q.7.1E.x-4M.x-4J.1n/2-4H.x;17=q.7.1E.y-4M.y-4J.1i/2-4H.y;6.5l.8F(q,[16,17])}G 6.8E||D},6W:C(e){u q=6.E.k;q.7.43=Q;u 4h=q.S;q.7.2Q=6.I(q,\'X\');q.7.3C=6.I(q,\'11\');8(!q.7.6U)q.7.6U=q.7.3C;q.7.1e={x:K(6.I(q,\'12\'))||0,y:K(6.I(q,\'14\'))||0};q.7.3Z=0;q.7.3X=0;8(6.1P.2P){u 4F=6.T.48(q,Q);q.7.3Z=4F.l||0;q.7.3X=4F.t||0}q.7.P=6.1M(6.T.2y(q),6.T.21(q));8(q.7.3C!=\'3y\'&&q.7.3C!=\'2j\'){4h.11=\'3y\'}6.E.O.72();u 27=q.8D(Q);6(27).I({X:\'2L\',12:\'1G\',14:\'1G\'});27.S.2K=\'0\';27.S.2G=\'0\';27.S.2H=\'0\';27.S.2A=\'0\';6.E.O.3K(27);u 1v=6.E.O.1h(0).S;8(q.7.5t){1v.3d=\'60\';1v.3p=\'60\'}L{1v.3p=q.7.P.1i+\'1a\';1v.3d=q.7.P.1n+\'1a\'}1v.X=\'2L\';1v.2K=\'1G\';1v.2G=\'1G\';1v.2H=\'1G\';1v.2A=\'1G\';6.1M(q.7.P,6.T.21(27));8(q.7.1r){8(q.7.1r.12){q.7.1e.x+=q.7.1b.x-q.7.P.x-q.7.1r.12;q.7.P.x=q.7.1b.x-q.7.1r.12}8(q.7.1r.14){q.7.1e.y+=q.7.1b.y-q.7.P.y-q.7.1r.14;q.7.P.y=q.7.1b.y-q.7.1r.14}8(q.7.1r.2R){q.7.1e.x+=q.7.1b.x-q.7.P.x-q.7.P.1i+q.7.1r.2R;q.7.P.x=q.7.1b.x-q.7.P.1n+q.7.1r.2R}8(q.7.1r.2I){q.7.1e.y+=q.7.1b.y-q.7.P.y-q.7.P.1i+q.7.1r.2I;q.7.P.y=q.7.1b.y-q.7.P.1i+q.7.1r.2I}}q.7.1x=q.7.1e.x;q.7.1y=q.7.1e.y;8(q.7.3E||q.7.1f==\'44\'){3z=6.T.48(q.2a,Q);q.7.P.x=q.4N+(6.1P.2P?0:6.1P.46?-3z.l:3z.l);q.7.P.y=q.4T+(6.1P.2P?0:6.1P.46?-3z.t:3z.t);6(q.2a).3K(6.E.O.1h(0))}8(q.7.1f){6.E.5Y(q);q.7.25.1f=6.E.6v}8(q.7.2q){6.5l.8B(q)}1v.12=q.7.P.x-q.7.3Z+\'1a\';1v.14=q.7.P.y-q.7.3X+\'1a\';1v.3d=q.7.P.1n+\'1a\';1v.3p=q.7.P.1i+\'1a\';6.E.k.7.3V=D;8(q.7.3c){q.7.25.2i=6.E.6S}8(q.7.1L!=D){6.E.O.I(\'1L\',q.7.1L)}8(q.7.1m){6.E.O.I(\'1m\',q.7.1m);8(2w.4D){6.E.O.I(\'5x\',\'73(1m=\'+q.7.1m*5n+\')\')}}8(q.7.36){6.E.O.4z(q.7.36);6.E.O.1h(0).3N.S.X=\'Z\'}8(q.7.2W)q.7.2W.1B(q,[27,q.7.1e.x,q.7.1e.y]);8(6.J&&6.J.3L>0){6.J.6q(q)}8(q.7.34==D){4h.X=\'Z\'}G D},5Y:C(q){8(q.7.1f.1z==69){8(q.7.1f==\'44\'){q.7.1o=6.1M({x:0,y:0},6.T.21(q.2a));u 3D=6.T.48(q.2a,Q);q.7.1o.w=q.7.1o.1n-3D.l-3D.r;q.7.1o.h=q.7.1o.1i-3D.t-3D.b}L 8(q.7.1f==\'R\'){u 5z=6.T.5J();q.7.1o={x:0,y:0,w:5z.w,h:5z.h}}}L 8(q.7.1f.1z==5s){q.7.1o={x:K(q.7.1f[0])||0,y:K(q.7.1f[1])||0,w:K(q.7.1f[2])||0,h:K(q.7.1f[3])||0}}q.7.1o.16=q.7.1o.x-q.7.P.x;q.7.1o.17=q.7.1o.y-q.7.P.y},4f:C(k){8(k.7.3E||k.7.1f==\'44\'){6(\'1l\',R).3K(6.E.O.1h(0))}6.E.O.72().1X().I(\'1m\',1);8(2w.4D){6.E.O.I(\'5x\',\'73(1m=5n)\')}},4i:C(e){6(R).31(\'2D\',6.E.5m).31(\'6J\',6.E.4i);8(6.E.k==10){G}u k=6.E.k;6.E.k=10;8(k.7.43==D){G D}8(k.7.1T==Q){6(k).I(\'11\',k.7.3C)}u 4h=k.S;8(k.2q){6.E.O.I(\'5O\',\'5P\')}8(k.7.36){6.E.O.4l(k.7.36)}8(k.7.5p==D){8(k.7.M>0){8(!k.7.1g||k.7.1g==\'3r\'){u x=2v 6.M(k,{1N:k.7.M},\'12\');x.6N(k.7.1e.x,k.7.3B)}8(!k.7.1g||k.7.1g==\'3q\'){u y=2v 6.M(k,{1N:k.7.M},\'14\');y.6N(k.7.1e.y,k.7.3F)}}L{8(!k.7.1g||k.7.1g==\'3r\')k.S.12=k.7.3B+\'1a\';8(!k.7.1g||k.7.1g==\'3q\')k.S.14=k.7.3F+\'1a\'}6.E.4f(k);8(k.7.34==D){6(k).I(\'X\',k.7.2Q)}}L 8(k.7.M>0){k.7.3V=Q;u 39=D;8(6.J&&6.1d&&k.7.1T){39=6.T.2y(6.1d.O.1h(0))}6.E.O.6G({12:39?39.x:k.7.P.x,14:39?39.y:k.7.P.y},k.7.M,C(){k.7.3V=D;8(k.7.34==D){k.S.X=k.7.2Q}6.E.4f(k)})}L{6.E.4f(k);8(k.7.34==D){6(k).I(\'X\',k.7.2Q)}}8(6.J&&6.J.3L>0){6.J.5R(k)}8(6.1d&&k.7.1T){6.1d.8C(k)}8(k.7.1Q&&(k.7.3B!=k.7.1e.x||k.7.3F!=k.7.1e.y)){k.7.1Q.1B(k,k.7.8U||[0,0,k.7.3B,k.7.3F])}8(k.7.3m)k.7.3m.1B(k);G D},6S:C(x,y,16,17){8(16!=0)16=K((16+(A.7.3c*16/1t.6w(16))/2)/A.7.3c)*A.7.3c;8(17!=0)17=K((17+(A.7.3H*17/1t.6w(17))/2)/A.7.3H)*A.7.3H;G{16:16,17:17,x:0,y:0}},6v:C(x,y,16,17){16=1t.6z(1t.3U(16,A.7.1o.16),A.7.1o.w+A.7.1o.16-A.7.P.1n);17=1t.6z(1t.3U(17,A.7.1o.17),A.7.1o.h+A.7.1o.17-A.7.P.1i);G{16:16,17:17,x:0,y:0}},5m:C(e){8(6.E.k==10||6.E.k.7.3V==Q){G}u k=6.E.k;k.7.1E=6.T.3O(e);8(k.7.43==D){6X=1t.8V(1t.70(k.7.1b.x-k.7.1E.x,2)+1t.70(k.7.1b.y-k.7.1E.y,2));8(6X<k.7.4w){G}L{6.E.6W(e)}}u 16=k.7.1E.x-k.7.1b.x;u 17=k.7.1E.y-k.7.1b.y;1j(u i 1F k.7.25){u 2t=k.7.25[i].1B(k,[k.7.1e.x+16,k.7.1e.y+17,16,17]);8(2t&&2t.1z==9f){16=i!=\'3k\'?2t.16:(2t.x-k.7.1e.x);17=i!=\'3k\'?2t.17:(2t.y-k.7.1e.y)}}k.7.1x=k.7.P.x+16-k.7.3Z;k.7.1y=k.7.P.y+17-k.7.3X;8(k.7.2q&&(k.7.3h||k.7.1Q)){6.5l.3h(k,k.7.1x,k.7.1y)}8(k.7.2V)k.7.2V.1B(k,[k.7.1e.x+16,k.7.1e.y+17]);8(!k.7.1g||k.7.1g==\'3r\'){k.7.3B=k.7.1e.x+16;6.E.O.1h(0).S.12=k.7.1x+\'1a\'}8(!k.7.1g||k.7.1g==\'3q\'){k.7.3F=k.7.1e.y+17;6.E.O.1h(0).S.14=k.7.1y+\'1a\'}8(6.J&&6.J.3L>0){6.J.5i(k)}G D},3e:C(o){8(!6.E.O){6(\'1l\',R).3K(\'<24 1C="5Q"></24>\');6.E.O=6(\'#5Q\');u B=6.E.O.1h(0);u 20=B.S;20.11=\'2j\';20.X=\'Z\';20.5O=\'5P\';20.5Z=\'Z\';20.3A=\'2s\';8(2w.4D){B.5k="5H"}L{20.9e=\'Z\';20.5V=\'Z\';20.5F=\'Z\'}}8(!o){o={}}G A.1W(C(){8(A.4r||!6.T)G;8(2w.4D){A.9d=C(){G D};A.9b=C(){G D}}u B=A;u 1R=o.5L?6(A).9c(o.5L):6(A);8(6.1P.2P){1R.1W(C(){A.5k="5H"})}L{1R.I(\'-9g-3k-4y\',\'Z\');1R.I(\'3k-4y\',\'Z\');1R.I(\'-9h-3k-4y\',\'Z\')}A.7={1R:1R,5p:o.5p?Q:D,34:o.34?Q:D,1T:o.1T?o.1T:D,2q:o.2q?o.2q:D,3E:o.3E?o.3E:D,1L:o.1L?K(o.1L)||0:D,1m:o.1m?1D(o.1m):D,M:K(o.M)||10,5u:o.5u?o.5u:D,25:{},1b:{},2W:o.2W&&o.2W.1z==2e?o.2W:D,3m:o.3m&&o.3m.1z==2e?o.3m:D,1Q:o.1Q&&o.1Q.1z==2e?o.1Q:D,1g:/3q|3r/.2S(o.1g)?o.1g:D,4w:o.4w?K(o.4w)||0:0,1r:o.1r?o.1r:D,5t:o.5t?Q:D,36:o.36||D};8(o.25&&o.25.1z==2e)A.7.25.3k=o.25;8(o.2V&&o.2V.1z==2e)A.7.2V=o.2V;8(o.1f&&((o.1f.1z==69&&(o.1f==\'44\'||o.1f==\'R\'))||(o.1f.1z==5s&&o.1f.1I==4))){A.7.1f=o.1f}8(o.5r){A.7.5r=o.5r}8(o.2i){8(3P o.2i==\'9m\'){A.7.3c=K(o.2i)||1;A.7.3H=K(o.2i)||1}L 8(o.2i.1I==2){A.7.3c=K(o.2i[0])||1;A.7.3H=K(o.2i[1])||1}}8(o.3h&&o.3h.1z==2e){A.7.3h=o.3h}A.4r=Q;1R.1W(C(){A.4n=B});1R.2c(\'67\',6.E.5w)})}};6.4u.1M({6C:6.E.4k,9l:6.E.3e});6.J={6h:C(26,22,2Z,32){G 26<=6.E.k.7.1x&&(26+2Z)>=(6.E.k.7.1x+6.E.k.7.P.w)&&22<=6.E.k.7.1y&&(22+32)>=(6.E.k.7.1y+6.E.k.7.P.h)?Q:D},6k:C(26,22,2Z,32){G!(26>(6.E.k.7.1x+6.E.k.7.P.w)||(26+2Z)<6.E.k.7.1x||22>(6.E.k.7.1y+6.E.k.7.P.h)||(22+32)<6.E.k.7.1y)?Q:D},1b:C(26,22,2Z,32){G 26<6.E.k.7.1E.x&&(26+2Z)>6.E.k.7.1E.x&&22<6.E.k.7.1E.y&&(22+32)>6.E.k.7.1E.y?Q:D},2p:D,1u:{},3L:0,1w:{},6q:C(q){8(6.E.k==10){G}u i;6.J.1u={};u 5q=D;1j(i 1F 6.J.1w){8(6.J.1w[i]!=10){u F=6.J.1w[i].1h(0);8(6(6.E.k).6j(\'.\'+F.H.a)){8(F.H.m==D){F.H.p=6.1M(6.T.2y(F),6.T.5j(F));F.H.m=Q}8(F.H.2u){6.J.1w[i].4z(F.H.2u)}6.J.1u[i]=6.J.1w[i];8(6.1d&&F.H.s&&6.E.k.7.1T){F.H.B=6(\'.\'+F.H.a,F);q.S.X=\'Z\';6.1d.5K(F);F.H.6F=6.1d.6K(6.1p(F,\'1C\')).6I;q.S.X=q.7.2Q;5q=Q}8(F.H.4c){F.H.4c.1B(6.J.1w[i].1h(0),[6.E.k])}}}}8(5q){6.1d.9k()}},6D:C(){6.J.1u={};1j(i 1F 6.J.1w){8(6.J.1w[i]!=10){u F=6.J.1w[i].1h(0);8(6(6.E.k).6j(\'.\'+F.H.a)){F.H.p=6.1M(6.T.2y(F),6.T.5j(F));8(F.H.2u){6.J.1w[i].4z(F.H.2u)}6.J.1u[i]=6.J.1w[i];8(6.1d&&F.H.s&&6.E.k.7.1T){F.H.B=6(\'.\'+F.H.a,F);q.S.X=\'Z\';6.1d.5K(F);q.S.X=q.7.2Q}}}}},5i:C(e){8(6.E.k==10){G}6.J.2p=D;u i;u 5y=D;u 5X=0;1j(i 1F 6.J.1u){u F=6.J.1u[i].1h(0);8(6.J.2p==D&&6.J[F.H.t](F.H.p.x,F.H.p.y,F.H.p.1n,F.H.p.1i)){8(F.H.2r&&F.H.h==D){6.J.1u[i].4z(F.H.2r)}8(F.H.h==D&&F.H.4a){5y=Q}F.H.h=Q;6.J.2p=F;8(6.1d&&F.H.s&&6.E.k.7.1T){6.1d.O.1h(0).1S=F.H.6H;6.1d.5i(F)}5X++}L 8(F.H.h==Q){8(F.H.49){F.H.49.1B(F,[e,6.E.O.1h(0).3N,F.H.M])}8(F.H.2r){6.J.1u[i].4l(F.H.2r)}F.H.h=D}}8(6.1d&&!6.J.2p&&6.E.k.1T){6.1d.O.1h(0).S.X=\'Z\'}8(5y){6.J.2p.H.4a.1B(6.J.2p,[e,6.E.O.1h(0).3N])}},5R:C(e){u i;1j(i 1F 6.J.1u){u F=6.J.1u[i].1h(0);8(F.H.2u){6.J.1u[i].4l(F.H.2u)}8(F.H.2r){6.J.1u[i].4l(F.H.2r)}8(F.H.s){6.1d.5S[6.1d.5S.1I]=i}8(F.H.4b&&F.H.h==Q){F.H.h=D;F.H.4b.1B(F,[e,F.H.M])}F.H.m=D;F.H.h=D}6.J.1u={}},4k:C(){G A.1W(C(){8(A.4j){8(A.H.s){1C=6.1p(A,\'1C\');6.1d.6Q[1C]=10;6(\'.\'+A.H.a,A).6C()}6.J.1w[\'d\'+A.5b]=10;A.4j=D;A.f=10}})},3e:C(o){G A.1W(C(){8(A.4j==Q||!o.6P||!6.T||!6.E){G}A.H={a:o.6P,2u:o.9i||D,2r:o.9j||D,6H:o.9a||D,4b:o.99||o.4b||D,4a:o.4a||o.90||D,49:o.49||o.91||D,4c:o.4c||D,t:o.4d&&(o.4d==\'6h\'||o.4d==\'6k\')?o.4d:\'1b\',M:o.M?o.M:D,m:D,h:D};8(o.8Z==Q&&6.1d){1C=6.1p(A,\'1C\');6.1d.6Q[1C]=A.H.a;A.H.s=Q;8(o.1Q){A.H.1Q=o.1Q;A.H.6F=6.1d.6K(1C).6I}}A.4j=Q;A.5b=K(1t.6L()*5a);6.J.1w[\'d\'+A.5b]=6(A);6.J.3L++})}};6.4u.1M({8Y:6.J.4k,8W:6.J.3e});6.8X=6.J.6D;6.18={2J:10,3j:D,4m:10,4R:C(e){6.18.3j=Q;6.18.2n(e,A,Q)},5f:C(e){8(6.18.2J!=A)G;6.18.3j=D;6.18.1X(e,A)},2n:C(e,B,3j){8(6.18.2J!=10)G;8(!B){B=A}6.18.2J=B;1J=6.1M(6.T.2y(B),6.T.21(B));3Q=6(B);2h=3Q.1p(\'2h\');3T=3Q.1p(\'3T\');8(2h){6.18.4m=2h;3Q.1p(\'2h\',\'\');6(\'#6r\').54(2h);8(3T)6(\'#4V\').54(3T.2k(\'92://\',\'\'));L 6(\'#4V\').54(\'\');O=6(\'#3J\');8(B.1K.1S){O.1h(0).1S=B.1K.1S}L{O.1h(0).1S=\'\'}59=6.T.21(O.1h(0));6T=3j&&B.1K.11==\'4I\'?\'2I\':B.1K.11;6Y(6T){23\'14\':1y=1J.y-59.1i;1x=1J.x;2z;23\'12\':1y=1J.y;1x=1J.x-59.1n;2z;23\'2R\':1y=1J.y;1x=1J.x+1J.1n;2z;23\'4I\':6(\'1l\').2c(\'2D\',6.18.2D);1b=6.T.3O(e);1y=1b.y+15;1x=1b.x+15;2z;93:1y=1J.y+1J.1i;1x=1J.x;2z}O.I({14:1y+\'1a\',12:1x+\'1a\'});8(B.1K.3M==D){O.2n()}L{O.98(B.1K.3M)}8(B.1K.2Y)B.1K.2Y.1B(B);3Q.2c(\'61\',6.18.1X).2c(\'6l\',6.18.5f)}},2D:C(e){8(6.18.2J==10){6(\'1l\').31(\'2D\',6.18.2D);G}1b=6.T.3O(e);6(\'#3J\').I({14:1b.y+15+\'1a\',12:1b.x+15+\'1a\'})},1X:C(e,B){8(!B){B=A}8(6.18.3j!=Q&&6.18.2J==B){6.18.2J=10;6(\'#3J\').97(1);6(B).1p(\'2h\',6.18.4m).31(\'61\',6.18.1X).31(\'6l\',6.18.5f);8(B.1K.2U)B.1K.2U.1B(B);6.18.4m=10}},3e:C(N){8(!6.18.O){6(\'1l\').3K(\'<24 1C="3J"><24 1C="6r"></24><24 1C="4V"></24></24>\');6(\'#3J\').I({11:\'2j\',1L:96,X:\'Z\'});6.18.O=Q}G A.1W(C(){8(6.1p(A,\'2h\')){A.1K={11:/14|2I|12|2R|4I/.2S(N.11)?N.11:\'2I\',1S:N.1S?N.1S:D,3M:N.3M?N.3M:D,2Y:N.2Y&&N.2Y.1z==2e?N.2Y:D,2U:N.2U&&N.2U.1z==2e?N.2U:D};u B=6(A);B.2c(\'94\',6.18.2n);B.2c(\'4R\',6.18.4R)}})}};6.4u.95=6.18.3e;',62,632,'||||||jQuery|dragCfg|if||||||||||||dragged||||||elm||||var||||||this|el|function|false|iDrag|iEL|return|dropCfg|css|iDrop|parseInt|else|fx|options|helper|oC|true|document|style|iUtil|es|elem|255|display|props|none|null|position|left||top||dx|dy|iTooltip|tp|px|pointer|oldStyle|iSort|oR|containment|axis|get|hb|for|result|body|opacity|wb|cont|attr|easing|cursorAt|wrs|Math|highlighted|dhs|zones|nx|ny|constructor|vp|apply|id|parseFloat|currentPointer|in|0px|documentElement|length|pos|tooltipCFG|zIndex|extend|duration|color|browser|onChange|dhe|className|so|nodeEl|step|each|hide|visibility|clientScroll|els|getSize|zoney|case|div|onDragModifier|zonex|clonedEl|newStyles|margins|parentNode|animationHandler|bind|styles|Function|prop|nmp|title|grid|absolute|replace|old|cs|show|scrollTop|overzone|si|hc|hidden|newCoords|ac|new|window|orig|getPosition|break|marginLeft|curCSS|parseColor|mousemove|wr|128|marginRight|marginBottom|bottom|current|marginTop|block|0x|ih|oldVisibility|msie|oD|right|test|fA|onHide|onDrag|onStart|139|onShow|zonew|iw|unbind|zoneh|F0|ghosting|de|frameClass|toInteger|rgb|dh|rule|scrollLeft|gx|width|build|restoreStyle|oldDisplay|onSlide|speed|focused|user|currentStyle|onStop|np|cssRules|height|vertically|horizontally|pr|cssSides|timer|border|queue|namedColors|relative|parentBorders|overflow|nRx|oP|contBorders|insideParent|nRy|clientHeight|gy|event|tooltipHelper|append|count|delay|firstChild|getPointer|typeof|jEl|clientWidth|complete|href|max|prot|styleSheets|diffY|sideEnd|diffX|self|getValues||init|parent|while|opera||getBorder|onOut|onHover|onDrop|onActivate|tolerance|borderColor|hidehelper|startTime|dEs|dragstop|isDroppable|destroy|removeClass|oldTitle|dragElem|oldPosition|callback|opt|isDraggable|exec|211|fn|192|snapDistance|src|select|addClass|margin|nodeName|padding|ActiveXObject|png|oldBorder|parseStyle|sliderPos|mouse|sliderSize|func|toLowerCase|parentPos|offsetLeft|169|scrollHeight|borderWidth|focus|borderLeftWidth|offsetTop|Color|tooltipURL|innerHeight|offsetHeight|offsetWidth|sizes||scrollWidth|floatVal|pause|html||object|oldFloat|stopAnim|helperSize|10000|idsa|innerWidth|cssSidesEnd|pValue|hidefocused|borderTopWidth|fontWeight|checkhover|getSizeLite|unselectable|iSlider|dragmove|100|traverseDOM|revert|oneIsSortable|fractions|Array|autoSize|hpc|windowSize|draginit|filter|applyOnHover|clnt|firstNum|delta|fxe|linear|cssProps|KhtmlUserSelect|wid|on|styleFloat|getClient|measure|handle|toggle|colorCssProps|cursor|move|dragHelper|checkdrop|changed|img|Width|userSelect|insertBefore|hlt|getContainment|listStyle|auto|mouseout|165|107|emptyGIF|images|offsetParent|mousedown|224|String|140|240|230|144|tagName|notColor|borderBottomWidth|fit|paddingTop|is|intersect|blur|paddingRight|paddingLeft|245|borderRightWidth|highlight|tooltipTitle|paddingBottom|getScroll|values|fitToContainer|abs|split|setInterval|min|isFunction|getTime|DraggableDestroy|remeasure|oldOverflow|os|animate|shc|hash|mouseup|serialize|random|clearInterval|custom|trim|accept|collected|Date|snapToGrid|filteredPosition|initialPosition|getMargins|dragstart|distance|switch|fxCheckTag|pow|indexOf|empty|alpha|nextSibling||darkcyan|gold|darkgrey|header|fuchsia|brown|fixPNG|option|215|optgroup|blue|frameset|cyan|tfoot|getPositionLite|darkblue|darkgreen|204|153|darkorchid|frame|150|233|pageY|darkred|darksalmon|darkorange|clientX|darkviolet|darkkhaki|script|col|122|189|darkolivegreen|darkmagenta|183|148|destroyWrapper|dl|colgroup|ul|table|th|ol|fxWrapper|Microsoft|AlphaImageLoader|getPadding|form|button|float|w_|green|prototype|br|input|iframe|textarea|hr|buildWrapper||tr|meta|beige|azure|aqua|220|black|purgeEvents|tbody|caption|wrapper|createElement|cssFloat|centerEl|td|clientY|DXImageTransform|removeChild|appendChild|pageX|progid|thead|MozUserSelect|string|toUpperCase|dequeue|100000000|RegExp|cssText|off|fromHandler|modifyContainer|check|cloneNode|selectKeyHelper|dragmoveBy|indigo|rules|dotted|dashed|transparent|isNaN|match|solid|double|outset|borderStyle|inset|ridge|groove|lastSi|sqrt|Droppable|recallDroppables|DroppableDestroy|sortable|onhover|onout|http|default|mouseover|ToolTip|3000|fadeOut|fadeIn|ondrop|helperclass|ondragstart|find|onselectstart|mozUserSelect|Object|moz|khtml|activeclass|hoverclass|start|Draggable|number|PI|selectorText|olive|orange|navy|maroon|magenta|pink|purple|yellow|fontSize|white|silver|red|lime|lightyellow|173|216|lightblue|khaki|130|lightcyan|lightgreen|182|193|lightpink|lightgrey|238|letterSpacing|203|outlineColor|borderTopColor|outlineOffset|Top|Bottom|outlineWidth|borderRightColor|borderBottomColor|borderLeftColor|backgroundColor|textIndent|lineHeight|minWidth|Right|minHeight|cos|stopAll|Left|stop|maxWidth|maxHeight'.split('|'),0,{}))

jQuery.autocomplete = function(input, options) {
	// Create a link to self
	var me = this;

	// Create jQuery object for input element
	var $input = $(input).attr("autocomplete", "off");

	// Apply inputClass if necessary
	if (options.inputClass) $input.addClass(options.inputClass);

	// Create results
	var results = document.createElement("div");
	// Create jQuery object for results
	var $results = $(results);
	$results.hide().addClass(options.resultsClass).css("position", "absolute");
	if( options.width > 0 ) $results.css("width", options.width);

	// Add to body element
	$("body").append(results);

	input.autocompleter = me;

	var timeout = null;
	var prev = "";
	var active = -1;
	var cache = {};
	var keyb = false;
	var hasFocus = false;
	var lastKeyPressCode = null;

	// flush cache
	function flushCache(){
		cache = {};
		cache.data = {};
		cache.length = 0;
	};

	// flush cache
	flushCache();

	// if there is a data array supplied
	if( options.data != null ){
		var sFirstChar = "", stMatchSets = {}, row = [];

		// no url was specified, we need to adjust the cache length to make sure it fits the local data store
		if( typeof options.url != "string" ) options.cacheLength = 1;

		// loop through the array and create a lookup structure
		for( var i=0; i < options.data.length; i++ ){
			// if row is a string, make an array otherwise just reference the array
			row = ((typeof options.data[i] == "string") ? [options.data[i]] : options.data[i]);

			// if the length is zero, don't add to list
			if( row[0].length > 0 ){
				// get the first character
				sFirstChar = row[0].substring(0, 1).toLowerCase();
				// if no lookup array for this character exists, look it up now
				if( !stMatchSets[sFirstChar] ) stMatchSets[sFirstChar] = [];
				// if the match is a string
				stMatchSets[sFirstChar].push(row);
			}
		}

		// add the data items to the cache
		for( var k in stMatchSets ){
			// increase the cache size
			options.cacheLength++;
			// add to the cache
			addToCache(k, stMatchSets[k]);
		}
	}

	$input
	.keydown(function(e) {
		// track last key pressed
		lastKeyPressCode = e.keyCode;
		switch(e.keyCode) {
			case 38: // up
				e.preventDefault();
				moveSelect(-1);
				break;
			case 40: // down
				e.preventDefault();
				moveSelect(1);
				break;
			case 9:  // tab
			case 13: // return
				if( selectCurrent() ){
					// make sure to blur off the current field
					$input.get(0).blur();
					e.preventDefault();
				}
				break;
			default:
				active = -1;
				if (timeout) clearTimeout(timeout);
				timeout = setTimeout(function(){onChange();}, options.delay);
				break;
		}
	})
	.focus(function(){
		// track whether the field has focus, we shouldn't process any results if the field no longer has focus
		hasFocus = true;
	})
	.blur(function() {
		// track whether the field has focus
		hasFocus = false;
		hideResults();
	});

	hideResultsNow();

	function onChange() {
		// ignore if the following keys are pressed: [del] [shift] [capslock]
		if( lastKeyPressCode == 46 || (lastKeyPressCode > 8 && lastKeyPressCode < 32) ) return $results.hide();
		var v = $input.val();
		if (v == prev) return;
		prev = v;
		if (v.length >= options.minChars) {
			$input.addClass(options.loadingClass);
			requestData(v);
		} else {
			$input.removeClass(options.loadingClass);
			$results.hide();
		}
	};

 	function moveSelect(step) {

		var lis = $("li", results);
		if (!lis) return;

		active += step;

		if (active < 0) {
			active = 0;
		} else if (active >= lis.size()) {
			active = lis.size() - 1;
		}

		lis.removeClass("ac_over");

		$(lis[active]).addClass("ac_over");

		// Weird behaviour in IE
		// if (lis[active] && lis[active].scrollIntoView) {
		// 	lis[active].scrollIntoView(false);
		// }

	};

	function selectCurrent() {
		var li = $("li.ac_over", results)[0];
		if (!li) {
			var $li = $("li", results);
			if (options.selectOnly) {
				if ($li.length == 1) li = $li[0];
			} else if (options.selectFirst) {
				li = $li[0];
			}
		}
		if (li) {
			selectItem(li);
			return true;
		} else {
			return false;
		}
	};

	function selectItem(li) {
		if (!li) {
			li = document.createElement("li");
			li.extra = [];
			li.selectValue = "";
		}
		var v = $.trim(li.selectValue ? li.selectValue : li.innerHTML);
		input.lastSelected = v;
		prev = v;
		$results.html("");
		$input.val(v);
		hideResultsNow();
		if (options.onItemSelect) setTimeout(function() { options.onItemSelect(li) }, 1);
	};

	// selects a portion of the input string
	function createSelection(start, end){
		// get a reference to the input element
		var field = $input.get(0);
		if( field.createTextRange ){
			var selRange = field.createTextRange();
			selRange.collapse(true);
			selRange.moveStart("character", start);
			selRange.moveEnd("character", end);
			selRange.select();
		} else if( field.setSelectionRange ){
			field.setSelectionRange(start, end);
		} else {
			if( field.selectionStart ){
				field.selectionStart = start;
				field.selectionEnd = end;
			}
		}
		field.focus();
	};

	// fills in the input box w/the first match (assumed to be the best match)
	function autoFill(sValue){
		// if the last user key pressed was backspace, don't autofill
		if( lastKeyPressCode != 8 ){
			// fill in the value (keep the case the user has typed)
			$input.val($input.val() + sValue.substring(prev.length));
			// select the portion of the value not typed by the user (so the next character will erase)
			createSelection(prev.length, sValue.length);
		}
	};

	function showResults() {
		// get the position of the input field right now (in case the DOM is shifted)
		var pos = findPos(input);
		// either use the specified width, or autocalculate based on form element
		var iWidth = (options.width > 0) ? options.width : $input.width();
		// reposition
		$results.css({
			width: parseInt(iWidth) + "px",
			top: (pos.y + input.offsetHeight) + "px",
			left: pos.x + "px"
		}).show();
	};

	function hideResults() {
		if (timeout) clearTimeout(timeout);
		timeout = setTimeout(hideResultsNow, 200);
	};

	function hideResultsNow() {
		if (timeout) clearTimeout(timeout);
		$input.removeClass(options.loadingClass);
		if ($results.is(":visible")) {
			$results.hide();
		}
		if (options.mustMatch) {
			var v = $input.val();
			if (v != input.lastSelected) {
				selectItem(null);
			}
		}
	};

	function receiveData(q, data) {
		if (data) {
			$input.removeClass(options.loadingClass);
			results.innerHTML = "";

			// if the field no longer has focus or if there are no matches, do not display the drop down
			if( !hasFocus || data.length == 0 ) return hideResultsNow();

			if ($.browser.msie) {
				// we put a styled iframe behind the calendar so HTML SELECT elements don't show through
				$results.append(document.createElement('iframe'));
			}
			results.appendChild(dataToDom(data));
			// autofill in the complete box w/the first match as long as the user hasn't entered in more data
			if( options.autoFill && ($input.val().toLowerCase() == q.toLowerCase()) ) autoFill(data[0][0]);
			showResults();
		} else {
			hideResultsNow();
		}
	};

	function parseData(data) {
		if (!data) return null;
		var parsed = [];
		var rows = data.split(options.lineSeparator);
		for (var i=0; i < rows.length; i++) {
			var row = $.trim(rows[i]);
			if (row) {
				parsed[parsed.length] = row.split(options.cellSeparator);
			}
		}
		return parsed;
	};

	function dataToDom(data) {
		var ul = document.createElement("ul");
		var num = data.length;

		// limited results to a max number
		if( (options.maxItemsToShow > 0) && (options.maxItemsToShow < num) ) num = options.maxItemsToShow;

		for (var i=0; i < num; i++) {
			var row = data[i];
			if (!row) continue;
			var li = document.createElement("li");
			if (options.formatItem) {
				li.innerHTML = options.formatItem(row, i, num);
				li.selectValue = row[0];
			} else {
				li.innerHTML = row[0];
				li.selectValue = row[0];
			}
			var extra = null;
			if (row.length > 1) {
				extra = [];
				for (var j=1; j < row.length; j++) {
					extra[extra.length] = row[j];
				}
			}
			li.extra = extra;
			ul.appendChild(li);
			$(li).hover(
				function() { $("li", ul).removeClass("ac_over"); $(this).addClass("ac_over"); active = $("li", ul).indexOf($(this).get(0)); },
				function() { $(this).removeClass("ac_over"); }
			).click(function(e) { e.preventDefault(); e.stopPropagation(); selectItem(this) });
		}
		return ul;
	};

	function requestData(q) {
		if (!options.matchCase) q = q.toLowerCase();
		var data = options.cacheLength ? loadFromCache(q) : null;
		// recieve the cached data
		if (data) {
			receiveData(q, data);
		// if an AJAX url has been supplied, try loading the data now
		} else if( (typeof options.url == "string") && (options.url.length > 0) ){
			$.get(makeUrl(q), function(data) {
				data = parseData(data);
				addToCache(q, data);
				receiveData(q, data);
			});
		// if there's been no data found, remove the loading class
		} else {
			$input.removeClass(options.loadingClass);
		}
	};

	function makeUrl(q) {
		var url = options.url + "?q=" + encodeURI(q);
		for (var i in options.extraParams) {
			url += "&" + i + "=" + encodeURI(options.extraParams[i]);
		}
		return url;
	};

	function loadFromCache(q) {
		if (!q) return null;
		if (cache.data[q]) return cache.data[q];
		if (options.matchSubset) {
			for (var i = q.length - 1; i >= options.minChars; i--) {
				var qs = q.substr(0, i);
				var c = cache.data[qs];
				if (c) {
					var csub = [];
					for (var j = 0; j < c.length; j++) {
						var x = c[j];
						var x0 = x[0];
						if (matchSubset(x0, q)) {
							csub[csub.length] = x;
						}
					}
					return csub;
				}
			}
		}
		return null;
	};

	function matchSubset(s, sub) {
		if (!options.matchCase) s = s.toLowerCase();
		var i = s.indexOf(sub);
		if (i == -1) return false;
		return i == 0 || options.matchContains;
	};

	this.flushCache = function() {
		flushCache();
	};

	this.setExtraParams = function(p) {
		options.extraParams = p;
	};

	this.findValue = function(){
		var q = $input.val();

		if (!options.matchCase) q = q.toLowerCase();
		var data = options.cacheLength ? loadFromCache(q) : null;
		if (data) {
			findValueCallback(q, data);
		} else if( (typeof options.url == "string") && (options.url.length > 0) ){
			$.get(makeUrl(q), function(data) {
				data = parseData(data)
				addToCache(q, data);
				findValueCallback(q, data);
			});
		} else {
			// no matches
			findValueCallback(q, null);
		}
	}

	function findValueCallback(q, data){
		if (data) $input.removeClass(options.loadingClass);

		var num = (data) ? data.length : 0;
		var li = null;

		for (var i=0; i < num; i++) {
			var row = data[i];

			if( row[0].toLowerCase() == q.toLowerCase() ){
				li = document.createElement("li");
				if (options.formatItem) {
					li.innerHTML = options.formatItem(row, i, num);
					li.selectValue = row[0];
				} else {
					li.innerHTML = row[0];
					li.selectValue = row[0];
				}
				var extra = null;
				if( row.length > 1 ){
					extra = [];
					for (var j=1; j < row.length; j++) {
						extra[extra.length] = row[j];
					}
				}
				li.extra = extra;
			}
		}

		if( options.onFindValue ) setTimeout(function() { options.onFindValue(li) }, 1);
	}

	function addToCache(q, data) {
		if (!data || !q || !options.cacheLength) return;
		if (!cache.length || cache.length > options.cacheLength) {
			flushCache();
			cache.length++;
		} else if (!cache[q]) {
			cache.length++;
		}
		cache.data[q] = data;
	};

	function findPos(obj) {
		var curleft = obj.offsetLeft || 0;
		var curtop = obj.offsetTop || 0;
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
		return {x:curleft,y:curtop};
	}
}

jQuery.fn.autocomplete = function(url, options, data) {
	// Make sure options exists
	options = options || {};
	// Set url as option
	options.url = url;
	// set some bulk local data
	options.data = ((typeof data == "object") && (data.constructor == Array)) ? data : null;

	// Set default values for required options
	options.inputClass = options.inputClass || "ac_input";
	options.resultsClass = options.resultsClass || "ac_results";
	options.lineSeparator = options.lineSeparator || "\n";
	options.cellSeparator = options.cellSeparator || "|";
	options.minChars = options.minChars || 1;
	options.delay = options.delay || 400;
	options.matchCase = options.matchCase || 0;
	options.matchSubset = options.matchSubset || 1;
	options.matchContains = options.matchContains || 0;
	options.cacheLength = options.cacheLength || 1;
	options.mustMatch = options.mustMatch || 0;
	options.extraParams = options.extraParams || {};
	options.loadingClass = options.loadingClass || "ac_loading";
	options.selectFirst = options.selectFirst || false;
	options.selectOnly = options.selectOnly || false;
	options.maxItemsToShow = options.maxItemsToShow || -1;
	options.autoFill = options.autoFill || false;
	options.width = parseInt(options.width, 10) || 0;

	this.each(function() {
		var input = this;
		new jQuery.autocomplete(input, options);
	});

	// Don't break the chain
	return this;
}

jQuery.fn.autocompleteArray = function(data, options) {
	return this.autocomplete(null, options, data);
}

jQuery.fn.indexOf = function(e){
	for( var i=0; i<this.length; i++ ){
		if( this[i] == e ) return i;
	}
	return -1;
};

// requires jQuery
$(document).ready(function(){
	$('a[@rel="external"]').each(function(){
		this.target = "_blank";
	});
});

/*
 * Thickbox 3.1 - One Box To Rule Them All.
 * By Cody Lindley (http://www.codylindley.com)
 * Copyright (c) 2007 cody lindley
 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
*/
		  
var tb_pathToImage = "/images/loadingAnimation.gif";

/*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/

//on page load call tb_init
$(document).ready(function(){   
	tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox
	imgLoader = new Image();// preload image
	imgLoader.src = tb_pathToImage;
});

//add thickbox to href & area elements that have a class of .thickbox
function tb_init(domChunk){
	$(domChunk).click(function(){
	var t = this.title || this.name || null;
	var a = this.href || this.alt;
	var g = this.rel || false;
	tb_show(t,a,g);
	this.blur();
	return false;
	});
}

function tb_show(caption, url, imageGroup) {//function called when the user clicks on a thickbox link

	try {
		if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
			$("body","html").css({height: "100%", width: "100%"});
			$("html").css("overflow","hidden");
			if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6
				$("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
				$("#TB_overlay").click(tb_remove);
			}
		}else{//all others
			if(document.getElementById("TB_overlay") === null){
				$("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");
				$("#TB_overlay").click(tb_remove);
			}
		}
		
		if(tb_detectMacXFF()){
			$("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash
		}else{
			$("#TB_overlay").addClass("TB_overlayBG");//use background and opacity
		}
		
		if(caption===null){caption="";}
		$("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' /></div>");//add loader to the page
		$('#TB_load').show();//show loader
		
		var baseURL;
	   if(url.indexOf("?")!==-1){ //ff there is a query string involved
			baseURL = url.substr(0, url.indexOf("?"));
	   }else{ 
	   		baseURL = url;
	   }
	   
	   var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/;
	   var urlType = baseURL.toLowerCase().match(urlString);

		if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images
				
			TB_PrevCaption = "";
			TB_PrevURL = "";
			TB_PrevHTML = "";
			TB_NextCaption = "";
			TB_NextURL = "";
			TB_NextHTML = "";
			TB_imageCount = "";
			TB_FoundURL = false;
			if(imageGroup){
				TB_TempArray = $("a[@rel="+imageGroup+"]").get();
				for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) {
					var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString);
						if (!(TB_TempArray[TB_Counter].href == url)) {						
							if (TB_FoundURL) {
								TB_NextCaption = TB_TempArray[TB_Counter].title;
								TB_NextURL = TB_TempArray[TB_Counter].href;
								TB_NextHTML = "<span id='TB_next'>&nbsp;&nbsp;<a href='#'>Next &gt;</a></span>";
							} else {
								TB_PrevCaption = TB_TempArray[TB_Counter].title;
								TB_PrevURL = TB_TempArray[TB_Counter].href;
								TB_PrevHTML = "<span id='TB_prev'>&nbsp;&nbsp;<a href='#'>&lt; Prev</a></span>";
							}
						} else {
							TB_FoundURL = true;
							TB_imageCount = "Image " + (TB_Counter + 1) +" of "+ (TB_TempArray.length);											
						}
				}
			}

			imgPreloader = new Image();
			imgPreloader.onload = function(){		
			imgPreloader.onload = null;
				
			// Resizing large images - orginal by Christian Montoya edited by me.
			var pagesize = tb_getPageSize();
			var x = pagesize[0] - 150;
			var y = pagesize[1] - 150;
			var imageWidth = imgPreloader.width;
			var imageHeight = imgPreloader.height;
			if (imageWidth > x) {
				imageHeight = imageHeight * (x / imageWidth); 
				imageWidth = x; 
				if (imageHeight > y) { 
					imageWidth = imageWidth * (y / imageHeight); 
					imageHeight = y; 
				}
			} else if (imageHeight > y) { 
				imageWidth = imageWidth * (y / imageHeight); 
				imageHeight = y; 
				if (imageWidth > x) { 
					imageHeight = imageHeight * (x / imageWidth); 
					imageWidth = x;
				}
			}
			// End Resizing
			
			TB_WIDTH = imageWidth + 30;
			TB_HEIGHT = imageHeight + 60;
			$("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>" + "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a> or Esc Key</div>"); 		
			
			$("#TB_closeWindowButton").click(tb_remove);
			
			if (!(TB_PrevHTML === "")) {
				function goPrev(){
					if($(document).unbind("click",goPrev)){$(document).unbind("click",goPrev);}
					$("#TB_window").remove();
					$("body").append("<div id='TB_window'></div>");
					tb_show(TB_PrevCaption, TB_PrevURL, imageGroup);
					return false;	
				}
				$("#TB_prev").click(goPrev);
			}
			
			if (!(TB_NextHTML === "")) {		
				function goNext(){
					$("#TB_window").remove();
					$("body").append("<div id='TB_window'></div>");
					tb_show(TB_NextCaption, TB_NextURL, imageGroup);				
					return false;	
				}
				$("#TB_next").click(goNext);
				
			}

			document.onkeydown = function(e){ 	
				if (e == null) { // ie
					keycode = event.keyCode;
				} else { // mozilla
					keycode = e.which;
				}
				if(keycode == 27){ // close
					tb_remove();
				} else if(keycode == 190){ // display previous image
					if(!(TB_NextHTML == "")){
						document.onkeydown = "";
						goNext();
					}
				} else if(keycode == 188){ // display next image
					if(!(TB_PrevHTML == "")){
						document.onkeydown = "";
						goPrev();
					}
				}	
			};
			
			tb_position();
			$("#TB_load").remove();
			$("#TB_ImageOff").click(tb_remove);
			$("#TB_window").css({display:"block"}); //for safari using css instead of show
			};
			
			imgPreloader.src = url;
		}else{//code to show html
			
			var queryString = url.replace(/^[^\?]+\??/,'');
			var params = tb_parseQuery( queryString );

			TB_WIDTH = (params['width']*1) + 30 || 630; //defaults to 630 if no paramaters were added to URL
			TB_HEIGHT = (params['height']*1) + 40 || 440; //defaults to 440 if no paramaters were added to URL
			ajaxContentW = TB_WIDTH - 30;
			ajaxContentH = TB_HEIGHT - 45;
			
			if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window		
					urlNoQuery = url.split('TB_');
					$("#TB_iframeContent").remove();
					if(params['modal'] != "true"){//iframe no modal
						$("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a> or Esc Key</div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' > </iframe>");
					}else{//iframe modal
					$("#TB_overlay").unbind();
						$("#TB_window").append("<iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;'> </iframe>");
					}
			}else{// not an iframe, ajax
					if($("#TB_window").css("display") != "block"){
						if(params['modal'] != "true"){//ajax no modal
						$("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>close</a> or Esc Key</div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div>");
						}else{//ajax modal
						$("#TB_overlay").unbind();
						$("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>");	
						}
					}else{//this means the window is already up, we are just loading new content via ajax
						$("#TB_ajaxContent")[0].style.width = ajaxContentW +"px";
						$("#TB_ajaxContent")[0].style.height = ajaxContentH +"px";
						$("#TB_ajaxContent")[0].scrollTop = 0;
						$("#TB_ajaxWindowTitle").html(caption);
					}
			}
					
			$("#TB_closeWindowButton").click(tb_remove);
			
				if(url.indexOf('TB_inline') != -1){	
					$("#TB_ajaxContent").append($('#' + params['inlineId']).children());
					$("#TB_window").unload(function () {
						$('#' + params['inlineId']).append( $("#TB_ajaxContent").children() ); // move elements back when you're finished
					});
					tb_position();
					$("#TB_load").remove();
					$("#TB_window").css({display:"block"}); 
				}else if(url.indexOf('TB_iframe') != -1){
					tb_position();
					if($.browser.safari){//safari needs help because it will not fire iframe onload
						$("#TB_load").remove();
						$("#TB_window").css({display:"block"});
					}
				}else{
					$("#TB_ajaxContent").load(url += "&random=" + (new Date().getTime()),function(){//to do a post change this load method
						tb_position();
						$("#TB_load").remove();
						tb_init("#TB_ajaxContent a.thickbox");
						$("#TB_window").css({display:"block"});
					});
				}
			
		}

		if(!params['modal']){
			document.onkeyup = function(e){ 	
				if (e == null) { // ie
					keycode = event.keyCode;
				} else { // mozilla
					keycode = e.which;
				}
				if(keycode == 27){ // close
					tb_remove();
				}	
			};
		}
		
	} catch(e) {
		//nothing here
	}
}

//helper functions below
function tb_showIframe(){
	$("#TB_load").remove();
	$("#TB_window").css({display:"block"});
}

function tb_remove() {
 	$("#TB_imageOff").unbind("click");
	$("#TB_closeWindowButton").unbind("click");
	$("#TB_window").fadeOut("fast",function(){$('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();});
	$("#TB_load").remove();
	if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
		$("body","html").css({height: "auto", width: "auto"});
		$("html").css("overflow","");
	}
	document.onkeydown = "";
	document.onkeyup = "";
	return false;
}

function tb_position() {
$("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'});
	if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6
		$("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
	}
}

function tb_parseQuery ( query ) {
   var Params = {};
   if ( ! query ) {return Params;}// return empty object
   var Pairs = query.split(/[;&]/);
   for ( var i = 0; i < Pairs.length; i++ ) {
      var KeyVal = Pairs[i].split('=');
      if ( ! KeyVal || KeyVal.length != 2 ) {continue;}
      var key = unescape( KeyVal[0] );
      var val = unescape( KeyVal[1] );
      val = val.replace(/\+/g, ' ');
      Params[key] = val;
   }
   return Params;
}

function tb_getPageSize(){
	var de = document.documentElement;
	var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
	var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
	arrayPageSize = [w,h];
	return arrayPageSize;
}

function tb_detectMacXFF() {
  var userAgent = navigator.userAgent.toLowerCase();
  if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
    return true;
  }
}



var SitePoint = SitePoint || {};

SitePoint.Zoomer = {
	lastX: 0,
	lastY: 0,
	currentZoom: 3,
	zoomMin: 2,
	zoomMax: 4,
	originalImgId: '',
	initZoomWidthHeight: 200,
	zoomWidthHeight: 200,
	zoomMaxWidthHeight: 600,
	mouseDown: true,
	hiresImage: null,
	pageScrollX: 0,
	pageScrollY: 0
};

// A branching method called SitePoint.Zoomer.PageScroll.Update will be created
SitePoint.Zoomer.PageScroll = (function() {
	if ($.browser.msie) {
		if (jQuery.browser.version=="7.0") {
	  		return {
			    Update: function() {	    
					// IE 7
					SitePoint.Zoomer.pageScrollX = document.documentElement.scrollLeft;
			      	SitePoint.Zoomer.pageScrollY = document.documentElement.scrollTop;
				}
			}
		} else {
		    return {
			    Update: function() {	    
					// IE 6
					SitePoint.Zoomer.pageScrollX = document.body.scrollLeft;
					SitePoint.Zoomer.pageScrollY = document.body.scrollTop;
				}
			}
		}
	} else {
		// All others
    	return {
       		Update: function() {
				SitePoint.Zoomer.pageScrollX=self.pageXOffset;
				SitePoint.Zoomer.pageScrollY=self.pageYOffset;
			}
		}   
    }
})();

SitePoint.Zoomer.Init = function (originalImgId, hiresImgSrc) {
	// Original image must have an id
	SitePoint.Zoomer.originalImgId = originalImgId;
	
	var stageWidth = $(originalImgId).width();
	var stageHeight = $(originalImgId).height();
	
	originalImgSrc=$(originalImgId).attr('src');
	var originalParent=$(originalImgId).parent();

	// We need something to cover the original image and detect mouse events,
	// otherwise we run into difficulties with dragging images and layerX.
	if($.browser.msie) {
		originalParent.prepend('<div id="gz_zoombox" style="width:' + stageWidth + 'px; height:' + stageHeight + 'px; ' + 'overflow:hidden;position:absolute;display:block;z-index:101;filter:alpha(opacity=0);background-color:#fff;overflow:hidden;"></div>' );
	} else {
		originalParent.prepend('<div id="gz_zoombox" style="width:' + stageWidth + 'px; height:' + stageHeight + 'px; ' + 'overflow:hidden;position:absolute;display:block;z-index:101;background-color:transparent;overflow:hidden;"></div>' );
	}
	
	// Wrap that up in another div, and put the highres image in that
	var gz_window='<div id="gz_window" style="border:1px solid black;background-color:#fff;width:' + SitePoint.Zoomer.initZoomWidthHeight + 'px;height:' + SitePoint.Zoomer.initZoomWidthHeight + 'px;display:none;position:absolute;overflow:hidden;"><div id="gz_loadinghires" style="background-color:#e8e8e8;color:#000;font-size:10px;position:absolute;z-index:100;top:0;left:0;">Loading...</div><div id="gz_hires" style="position:absolute;display:block;top:0;left:0"></div></div>'; 
	
	originalParent.prepend('<div id="gz_stage" style="width:' + stageWidth + 'px; height:' + stageHeight + 'px;position:absolute;margin:0;overflow:hidden;display:block;z-index:100;">' + gz_window + '</div>' );
	
	// Put our *lores* image inside that container for now...
	$('#gz_hires').append('<img style="position:absolute;z-index:1;display:none;width:1024px;height:768px;" src="' + originalImgSrc + '" />');
	
	SitePoint.Zoomer.PageScroll.Update();
	
	// Bind the event handling to the transparent layer on top of everything
	$('#gz_zoombox').bind("mouseenter mouseleave mousemove mousedown mouseup", function(e) {
		SitePoint.Zoomer.HandleMouse(e) 
		return false;
	});
	
	// Create a load for the image and an appropriate onready method
	// to handle that load...
	SitePoint.Zoomer.hiresImage = new Image(stageWidth, stageHeight);
	SitePoint.Zoomer.hiresImage.src=hiresImgSrc;
	SitePoint.Zoomer.hiresImage.onload = function() {
		SitePoint.Zoomer.HiresLoaded();
	}
}

SitePoint.Zoomer.HandleMouse = function(e)
{
	// Mouse position within the stage... take a few more pixels off for the 1px border
	if (e.type == 'mouseleave') {
		// Hide the window
		$('#gz_window').hide();
		SitePoint.Zoomer.mouseDown=false;
	}
	else if (e.type == 'mousemove') {
		// Move the window to where the mouse is, zoom and resize
	}
	else if (e.type == 'mouseenter') {
		// Show the window
		$('#gz_window').show();
		SitePoint.Zoomer.mouseDown=false;
	}
	else if (e.type == 'mousedown')	{
		SitePoint.Zoomer.mouseDown=true;
	}
	else if (e.type == 'mouseup') {
		SitePoint.Zoomer.mouseDown=false;
	}

	SitePoint.Zoomer.SetWindow(e.clientX, e.clientY);
	return false;
}

SitePoint.Zoomer.SetWindow = function(mouseX, mouseY) {
	
	if (SitePoint.Zoomer.mouseDown) {
		// There was (enough of) a change in x...
		if(Math.abs(mouseX-SitePoint.Zoomer.lastX) >= 12) {
   			// Make the zoom window bigger/smaller respectively...
   			if(mouseX-SitePoint.Zoomer.lastX > 0)
   			{
   				// moved right - box bigger
				SitePoint.Zoomer.zoomWidthHeight=SitePoint.Zoomer.zoomWidthHeight+12;
				// @TODO But not bigger than max size
	   		}
	   		else
	   		{
	   			// moved left - box smaller
				SitePoint.Zoomer.zoomWidthHeight=SitePoint.Zoomer.zoomWidthHeight-12;
	   		}
			$('#gz_window').width(SitePoint.Zoomer.zoomWidthHeight);
			$('#gz_window').height(SitePoint.Zoomer.zoomWidthHeight);
   			SitePoint.Zoomer.lastX=mouseX;
   		}
	
		// There was a change in y...
		if (Math.abs(SitePoint.Zoomer.lastY-mouseY) >= 1) {
			// Zoom accordingly
			SitePoint.Zoomer.currentZoom*=((mouseY>SitePoint.Zoomer.lastY)?(0.909):(1.1));
			// keep track of last mouse Y
			SitePoint.Zoomer.lastY=mouseY;
			// Make sure our zoom is no larger or smaller than our zoom limits
			if (SitePoint.Zoomer.currentZoom < SitePoint.Zoomer.zoomMin) { SitePoint.Zoomer.currentZoom=SitePoint.Zoomer.zoomMin; }
			if (SitePoint.Zoomer.currentZoom > SitePoint.Zoomer.zoomMax) { SitePoint.Zoomer.currentZoom=SitePoint.Zoomer.zoomMax; }
		}
	}		

	// Move the magnifier to where the mouse is
	var boxOffset=$('#gz_zoombox').offset();
	    
    var windowWidth=$('#gz_window').width();
	var windowHeight=$('#gz_window').height();
	var halfWindowWidth=windowWidth/2;
	var halfWindowHeight=halfWindowWidth;
	
	SitePoint.Zoomer.PageScroll.Update();	
    var adjustedMouseX=mouseX-boxOffset.left+SitePoint.Zoomer.pageScrollX;
    var adjustedMouseY=mouseY-boxOffset.top+SitePoint.Zoomer.pageScrollY;
    
    var windowLeft=adjustedMouseX-halfWindowWidth;
    var windowTop=adjustedMouseY-halfWindowHeight;

	var hiresOffsetX=(windowWidth*SitePoint.Zoomer.currentZoom)/(2*SitePoint.Zoomer.currentZoom)+(boxOffset.left-SitePoint.Zoomer.pageScrollX)*SitePoint.Zoomer.currentZoom;
	var hiresOffsetY=(windowHeight*SitePoint.Zoomer.currentZoom)/(2*SitePoint.Zoomer.currentZoom)+(boxOffset.top-SitePoint.Zoomer.pageScrollY)*SitePoint.Zoomer.currentZoom;

	$('#gz_window').css({
		'left' : windowLeft,
		'top' : windowTop
		});
	
	var hiresImgX=((mouseX * SitePoint.Zoomer.currentZoom) * -1) + hiresOffsetX;
	var hiresImgY=((mouseY * SitePoint.Zoomer.currentZoom) * -1) + hiresOffsetY;

	// Set the offset of the image inside the window	
	$('#gz_hires').css({
		'left' : hiresImgX, 
		'top' : hiresImgY
		});
	
	// Set the width and height of the image
	$('#gz_hires img').css({
		'width' : $(SitePoint.Zoomer.originalImgId).width()*SitePoint.Zoomer.currentZoom, 
		'height' : $(SitePoint.Zoomer.originalImgId).height()*SitePoint.Zoomer.currentZoom
		});
}

SitePoint.Zoomer.HiresLoaded = function() {
	// Called if the hires img is loaded
	// Get the size of the current image and set it on our hires image
	$(SitePoint.Zoomer.hiresImage).width($('#gz_hires img').width());
	$(SitePoint.Zoomer.hiresImage).height($('#gz_hires img').height());
	// replace the existing image with our hires one
	$('#gz_hires img').replaceWith(SitePoint.Zoomer.hiresImage);
	$('#gz_loadinghires').remove();
}

/**
 *	SitePoint Store Javascript
 */
var SitePoint = SitePoint || {};

$(function(){
	SitePoint.Store.init();
});

/**
 * class SitePoint.Store
 */
SitePoint.Store = (function()
{
	// Private
	var rpcUrl 					= '/rpc/xmlrpc';
	var minicartUrl				= '/store/minicart';
	var addToCartUrl			= '/store/addtocartform';
	var editCartUrl				= '/checkout';
	var cartUrl					= '/store/cart';
	var minicartContainer		= '#gz_minicartcontainer';
	var productImages			= '.gz_productimage';
	var minicartDiv				= '#gz_minicart';
	var cartContainer			= '#gz_editcart';
	var relatedProductClass		= 'gz_relatedproduct';
	var relatedProductsContainer= '#gz_relatedproducts';
	var minicartFlashOn			= '#afa';
	var minicartFlashOff		= '#fff';
	var asyncMethod				= 'Ajax';
	
	generateAsyncMethod=function() {
 		if (asyncMethod=="Ajax") {
			return function(url,data,callback,method) {
				method="post" ? jQuery.post(url,data,callback) : jQuery.get(url,data,callback);
			};
		};
	};

	return {
		init:function() {
			// Decorate our newly created application with the asynchronous
			// method we are going to use.
			this.asyncRequest=generateAsyncMethod();
			
			// Set the submit functionality for all addToCartForms
			SitePoint.Store.applyBehaviours();
		},
		applyBehaviours:function() {
			// All form submits
			// unbind any submits first
			$(".gz_addtocartform").unbind();
			$(".gz_addtocartform").submit(function(e) 
			{
					e.preventDefault();
					productId = parseInt(this.productid.value);
					quantity  = parseInt(this.quantity.value);
					
					// Is this a related product?
					// $(this).hasClass(relatedProductClass) ? relatedProduct=true : relatedProduct=false;			
					$(this.quantity).addClass('gz_inputloading');	
					
					SitePoint.Store.addProductToCart(productId, quantity);
					return false;
				}
			);
			$("#gz_cartform").submit(
				function() {
					return false;
				}
			);
			// Set the click value for the submit buttons in this form
			$(".gz_updatecart").click(
				function() {
					SitePoint.Store.updateCart();
					return false;
				}
			);
			// Set the remove behaviours
			$(".gz_removecart").click(
				function() {
					SitePoint.Store.removeProductFromCart(this);
					return false;
				}
			);
			// Set the checkout
			$("#gz_checkoutbutton").click(
				function() {
					$("#gz_cartform").unbind();
					$("#gz_cartform").submit();
				}
			);
			// Show / hide options when delivery location changed.
			$('#ss_withinaustralia, #ss_outsideaustralia').click(
				SitePoint.Store.updateDeliveryLocation
				);
			SitePoint.Store.updateDeliveryLocation();
			// Blank totals when a cart option is changed
			$('input.cartoption').click(function(){
				$('td.total').html('-');
			});
		},
		
		addProductToCart: function(productid, quantity)
		{
			Gazette.Rpc.call(rpcUrl, 'cart.addProduct', [productid, quantity], SitePoint.Store.addProductToCartComplete);
		},
		
		addProductToCartComplete: function(response) 
		{
			r = Gazette.Rpc.parseResponse(response);
			if ( r.message )
			{
				alert(r.message);
			}
			
			$('#quantity_'+r.productid).removeClass('gz_inputloading');
			
			relatedProduct = false;
			if ( relatedProduct ) 
			{
				SitePoint.Store.updateRelatedProductsDiv();
			} 
			else 
			{
				SitePoint.Store.updateAddToCartDiv(r.productid);
			}
		},

		flashMinicart:function() {
			$(minicartDiv).animate(
				{backgroundColor:minicartFlashOn},
				400,
				"swing",
				function() {
					$(minicartDiv).animate({backgroundColor:minicartFlashOff}, 400);
				}
			);
		},
		addThrobber:function(parentDiv,text) {
			if (!arguments[1]) text="Loading...";
			// Adds a throbber to the given parent div
			$(parentDiv).addClass('gz_loading');
			$(parentDiv).fadeTo(0.1,0.5, function() {
				$(parentDiv).before('<div class="gz_throbber"><strong>'+text+'</strong></div>');
				// Position the throbber
				$(parentDiv).prev().css("height",$(parentDiv).height());
				$(parentDiv).prev().css("width",$(parentDiv).width());
				//Move the strong element down into the middle of the div we are about to load
				$(parentDiv).prev().find("strong").css("top",$(parentDiv).height()/2);
				// Then display it
				$(parentDiv).prev().css("display","block");
			});
		},
		removeThrobber:function(parentDiv) {
			// Search through the given parentDiv for any throbbers, then
			// remove them
			$(parentDiv).prev().css("display","none");
			$(parentDiv).prev().remove();
			$(parentDiv).fadeTo(0.1,1);
			$(parentDiv).removeClass('gz_loading');
		},
		updateCartDiv:function(returnedHtml) {
			if(arguments[0]) {
				$(cartContainer).html(returnedHtml);
				SitePoint.Store.cartUpdated();
				SitePoint.Store.removeThrobber(cartContainer);
			} else {
				$(cartContainer).each(function() {
					$(this).load(
						editCartUrl,
						{'editcartform':1},
						function(){
							SitePoint.Store.cartUpdated();
							SitePoint.Store.removeThrobber(cartContainer);							
						}
					);
				});
			}
			SitePoint.Store.updateMinicartDiv();
		},
		updateMinicartDiv:function() {
			// This should be done via an asyncRequest
			$(minicartContainer).each(function() {
				$(this).load(
					minicartUrl,
					'',
					function() { 
						SitePoint.Store.flashMinicart();
					}
				);
			});
		},
		updateAddToCartDiv:function(productId) {
			div = $('#gz_addtocartform_'+productId).parent('div').get(0);
			$(div).each(function() {
				$(this).load(
					addToCartUrl,
					{productid:productId},
					function(){
						SitePoint.Store.applyBehaviours();
						SitePoint.Store.updateMinicartDiv();
					}
				);
			});
		},
		updateRelatedProductsDiv:function() {
			// @TODO - load the related products div
			/*$(this).load(
				addToCartUrl,
				{productid:productId},
				SitePoint.Store.applySubmitBehaviours
			);*/
			SitePoint.Store.addThrobber(cartContainer,"Adding Product...");
			SitePoint.Store.updateCartDiv();
		},


		
		removeProductFromCart:function(anchor)
		{
			// Extract the get string from the link, removing the ?
			if (confirm("You are about to remove a product from your cart. Are you sure?")) 
			{
				// Simple submit the delete button name, server will take care of the rest.
				name = $(anchor).attr('name');
		
				// Introduce our throbber here...
				SitePoint.Store.addThrobber(cartContainer, "Removing Product...");
	
				SitePoint.Store.asyncRequest(
					cartUrl,
					name+'=remove',
					function() {
						SitePoint.Store.updateCartDiv();
					},
					'post'
				);
			}
		},

		updateDeliveryLocation:function() {			
			$('#ss_withinaustralia').each(function(){
				if ( this.checked )
				{
					$('tr#ss_postage').show();
					$('tr#ss_insuranceline').hide();
				}
				else
				{
					$('tr#ss_postage').hide();
					$('tr#ss_insuranceline').show();
				}
			});
		},
		
		updateCart:function() {	
			// TODO: Validate cart - don't update if there are errors 
			
			$('input.quantity').each(function(){
				// Check quantity is valid int
				re = /^\d+$/;
				if ( !re.test(this.value) )
				{
					// Give some feedback to user, maybe display an alert?
					$(this).css('border', 'solid 2px #f00');
				}
			});
		
			// Introduce our throbber here...
			SitePoint.Store.addThrobber(cartContainer,"Updating...");
		
			// Create an async request to POST it into the cart					
			var post=$('#gz_cartform').find('input').serialize();

			if (post!="") {
				SitePoint.Store.asyncRequest(
					editCartUrl,
					post,
					function(returnedHtml){
						SitePoint.Store.updateCartDiv();
					},
					"post"
				);
			}
		},
		cartUpdated:function() {
			// Re-apply our button behaviours
			SitePoint.Store.applyBehaviours();
		},
		getMiniCartDiv:function() {
			return minicartDiv;
		}
	};
})();


/*$preload=new Image();
$preload.src="/images/minicart_anim.gif";*/

StampShop=(function() {
	var loginUrl="/checkout";
	var loginForm="#gz_loginform";
	var loginFormContainer="#gz_loginformcontainer";
	var stubsDiv="#gz_stubs";
	var customerDetailsUrl="/checkout";
	var customerDetailsForm="#gz_customerdetailsform";
	var customerFormContainer="#gz_customerformcontainer";
	var minicartAnimationClass="ss_cartanim";
	var previousConflict=false;
	var searchForm="#ss_searchform";
	var searchResultContainerDiv="#ss_searchresults";
	var searchUrl="/search";
	var keypressUpdateTimer;
	var keypressUpdateDelay=3000;
	var calcUrl='http://www.commbank.com.au/Today/ForeignExchange/TBC-FxCalc.htm';
	var officeLocator='http://www.nowwhere.com.au/austpost/postofficelocator/default.aspx';
	var cscLink="/what-is-a-csc";
	
	var togglesMap={
			"gz_personaldetailsok":"gz_personalfields",
			"gz_contactdetailsok":"gz_contactfields",
			"gz_unchangedsubscriptions":"gz_subscriptionfields",
			"gz_shiptocustomer":"gz_shipfields"
		}
		
	return {
	init:function() {
		// Override completely the flashminicart animation for stampshop
		SitePoint.Store.flashMinicart=function() {
			var minicartDiv=SitePoint.Store.getMiniCartDiv();
			var minicartAnimClass=StampShop.getMinicartAnimClass();
			$(minicartDiv).addClass(minicartAnimClass);
			var minicartTimeout=setTimeout(function() {
				$(minicartDiv).removeClass(minicartAnimClass);
				clearTimeout(minicartTimeout);
			},4500);
		}
		
		StampShop.that=SitePoint.Store.updateCartDiv;
		SitePoint.Store.updateCartDiv=function() {
			// Is there a keypress timer already started?
			if(typeof(StampShop.keypressUpdateTimer)=='number') {
				// Clear it...
				clearTimeout(StampShop.keypressUpdateTimer);
				StampShop.keypressUpdateTimer=null;
			}
			// Call the original method
			StampShop.that();
			// Check to see what the users contact detail country is
			var customerLocation=$("select#gz_country").val();
			var deliveryLocation=$("input[@name=deliverylocation]:checked").val();
			if (deliveryLocation=="outsideaustralia" && customerLocation=="AUS" && !StampShop.previousConflict) {
				// There was a conflict so lets change the interface a bit
				$('#gz_shiptocustomer').removeAttr("checked");
				StampShop.updateToggles();
			}
			StampShop.applyBehaviours();
		}
		
		StampShop.that2=SitePoint.Store.cartUpdated;
		SitePoint.Store.cartUpdated=function() {
			// Call original method
			StampShop.that2();
			StampShop.applyBehaviours();
		}
		
		// Product Magnify behaviour
		$('#ss_productmagnify').click(function() {
			var t = this.title || this.name || null;
			// 'a' is the larger image src location
			var a = this.href || this.alt;
					
			smallerImageSrcOriginal=$('#ss_productsmallimage').attr('src');
			// Need to remove the height and width tag
			
			smallerImageSrc=smallerImageSrcOriginal.substring(0,smallerImageSrcOriginal.indexOf('?'));
			
			$('#ss_magnifycontainer').html('<div style="position:relative"><img id="gz_smallimage" style="position:static;border-style:none;margin:0;width:640px;height:480px;" src="' + smallerImageSrc + '?width=640&height=480&method=pad" \/><div style="clear:both"><\/div></div>');
			
			smallerImageSrcAppended=smallerImageSrc+'#TB_inline?inlineId=ss_magnifycontainer&width=645&height=485';
			
			var g = this.rel || false;
			tb_show(t,smallerImageSrcAppended,g);
			SitePoint.Zoomer.Init('#gz_smallimage', smallerImageSrc + '?width=1024&height=768&method=pad&z=100');
			this.blur();
			return false;
		});
		
		// Look for any calculator links and apply our openCalc function...
		$("a[href$='/currency-converter']").click(function() {
			StampShop.openCalc();
			return false;
		});
		
		// Post office locator links too...
		$("a[href$='/post-office-locator']").click(function() {
			newWin = window.open(officeLocator, "StampShop", 'height=672,width=812,resizeable=1');
			if (window.focus) {newWin.focus()};
			return false;
		});
		
		$("a#ss_csclink").click(function() {				
			// Create a new hidden div
			$('body').append('<div id="ss_cscajax" style="display:none"><h1>What is a CSC?</h1></div>');
			
			// Ajax the content into a div
			$('#ss_cscajax').load('/what-is-a-csc #gz_maincontent', function() {	
				// Manually call the thickbox
				tb_show("What is a CSC?", "#TB_inline?inlineId=ss_cscajax&height=300&width=550", false);
				});
					
			return false;
		});
			
		$('#gz_updatecartbutton').hide();
		
		// Product thumb/list view button behaviours
		StampShop.applyBehaviours();
	},
	// Enable auto-suggest on suburb fields (see: http://www.pengoworks.com/workshop/jquery/autocomplete_docs.txt)
	autoSuggestSuburbs : function(enabled, fields) 
	{
	        if ( enabled )
	        {
	        	$(fields.city).each(
	        		function() {
						$(fields.city).autocomplete('/store/suburbs', {
								minChars: 1, 
								autoFill: false, 
								delay: 500, 
								cacheLength: 1000, 
								maxItemsToShow: 6,
								extraParams: fields,
								formatItem: function(row) {
										return row[0] + ' ' + row[1] + ' ' + row[2];
								},
								onItemSelect: function(li) {
										$(this.extraParams.state).attr('value', li.extra[0]).pulse('#afa');
										$(this.extraParams.postcode).attr('value', li.extra[1]).pulse('#afa');
								}	
						});
					}
				);
					
	        }
	        else
	        {
	                $(fields.city).each(function(){
	                        $(this).unbind();
	                });
	        }
	},
	updateCountryRequires:function() {

	        if ($('select#gz_country').val()=='AUS') 
	        {
	                $('#ss_customerstaterequire').show();
	                $('#ss_customerpostcoderequire').show();
	        } 
	        else 
	        {
	                $('#ss_customerstaterequire').hide();
	                $('#ss_customerpostcoderequire').hide();
	        }

	        if ($('select#gz_shipcountry').val()=='AUS') 
	        {
	                $('#ss_shipstaterequire').show();
	                $('#ss_shippostcoderequire').show();
	        } 
	        else 
	        {
	                $('#ss_shipstaterequire').hide();
	                $('#ss_shippostcoderequire').hide();
	        }

	        StampShop.autoSuggestSuburbs($('select#gz_country').val() == 'AUS', { 
	                        city:     '#gz_city', 
	                        state:    '#gz_state', 
	                        postcode: '#gz_postcode' 
	                });

	        StampShop.autoSuggestSuburbs($('select#gz_shipcountry').val() == 'AUS', { 
	                        city:     '#gz_shipcity', 
	                        state:    '#gz_shipstate', 
	                        postcode: '#gz_shippostcode' 
	                });
	},
	checkDeliveryConflict:function() {
		var customerLocation=$("select#gz_country").val();
		var deliveryLocation=$("input[@name=deliverylocation]:checked").val();
		if ($('#gz_shiptocustomer').attr("checked") || $('#gz_shipcountry').val()=="AUS") {
			if ( (deliveryLocation=="outsideaustralia" && customerLocation=="AUS")
			|| (deliveryLocation=="outsideaustralia" && $('#gz_shipcountry').val()=="AUS") ) {
				alert("You have selected postage outside of Australia and delivery to an Australian address. Please correct this conflict before proceeding.");
				$('#gz_shiptocustomer').removeAttr("checked");
				$('#gz_shipcountry').val("");
				StampShop.updateToggles();
				return true;
			}
		}
		return false;
	},	
	applyBehaviours:function() {
		$('#gz_useraccountyes').click(function(){StampShop.updateAccountRadio()});
		$('#gz_useraccountno').click(function(){StampShop.updateAccountRadio()});
		$('#gz_agreement').click(function(){StampShop.updateAgreement()});
		$(loginForm).unbind();
		$(loginForm).submit(function(e) {
			if ((this.username.value!="")&&(this.password.value!="")) {
				SitePoint.Store.addThrobber(loginForm,"Logging In...");
				var post=jQuery.makeArray($(this).find('input'));
				if (post!="") {
					SitePoint.Store.asyncRequest(
						loginUrl,
						post,
						function(returnedHtml) {
							StampShop.loggedIn(jQuery.trim(returnedHtml));
						},
						'post'
					);
				}
			}
			return false;
		});
		
		$(searchForm).unbind();
		$(searchForm).submit(function(e) {
			if (this.keyword.value!="") {
				SitePoint.Store.addThrobber(searchResultContainerDiv,"Searching Products...");
				var inputField=$(this).find('input');
				inputField.addClass('gz_inputloading');
				var post=jQuery.makeArray(inputField);
				if (post!="")  {
					SitePoint.Store.asyncRequest(
						searchUrl,
						post,
						function(returnedHtml) {
							inputField.removeClass('gz_inputloading');
							StampShop.updateSearchResultDiv(jQuery.trim(returnedHtml));
						},
						'post'
					);
				}
			}
			return false;
		});
				
		// Apply toggles
		$(".gz_toggle").click(function() {
			if((mapping=togglesMap[this.id])!=null) {
				if($(this).attr("checked")) {
					$('#'+mapping).hide();
					return;
				}
				$('#'+mapping).show();
			}
		});

		// Apply a specific behaviors for the deliver to my current address
		// option
		$('#gz_shiptocustomer').click(function() {
			StampShop.checkDeliveryConflict();
			StampShop.updateCountryRequires();
		});
		
		$('#gz_country').click(function() {
			StampShop.checkDeliveryConflict();
			StampShop.updateCountryRequires();
		});
		
		$('#gz_shipcountry').click(function() {
			StampShop.checkDeliveryConflict();
			StampShop.updateCountryRequires();
		});
		
		//$('#gz_customerdetailsform').unbind();
		$('#gz_customerdetailsform').submit(function() {
			if(!StampShop.checkDeliveryConflict()) {
				// Submit the form if there were no delivery errors
				this.submit();
			}
			return false;
		});
		
		$("#gz_cartform input.quantity").keypress(function(e) {
			if (typeof tempTimer=='number') window.clearTimeout(tempTimer);
			var tempVar=e.target;
			tempTimer=setTimeout(function() {
				StampShop.keypressUpdateCartForm(tempVar);
			},100);
		});
		
		// All changes to postage and handling options should fire off
		// A cart update for javascript users....
		$('input.cartoption').click(function() {
			SitePoint.Store.updateCart();
		});
		
		StampShop.updateAgreement();
		StampShop.updateToggles();
		StampShop.updateAccountRadio();
		StampShop.updateCountryRequires();
		
		$('#gz_updatecartbutton').hide();
	},
	keypressUpdateCartForm:function(e) {
		if (StampShop.isNumeric($(e).val())) {
			// Is there a timer already started?
			if(typeof(StampShop.keypressUpdateTimer)=='number') {
				// Clear it...
				clearTimeout(StampShop.keypressUpdateTimer);
			}
			// Start a new timer
			StampShop.keypressUpdateTimer=setTimeout(function(){
				SitePoint.Store.updateCart();
				StampShop.keypressUpdateTimer=null;
			}, keypressUpdateDelay);
		}
	},
	loggedIn:function(returnedHtml) {
		// remove throbber
		SitePoint.Store.removeThrobber(loginForm);
		if (returnedHtml==="1") {
			StampShop.updateCustomerDetailsDiv();
		} else {
			// Replace the existing loginform with the returnedHtml
			// there must have been an error
			$(loginFormContainer).html(returnedHtml);
			StampShop.applyBehaviours();
		}
	},
	updateCustomerDetailsDiv:function() {
		SitePoint.Store.addThrobber(customerDetailsForm, "Loading Details...");
		$(customerFormContainer).load(
			customerDetailsUrl+'?customerdetailsform=1',
			null,
			function() {
				$(customerFormContainer).show();
				StampShop.customerDetailsUpdated()
			}
		);
	},
	updateSearchResultDiv:function(returnedHtml) {
		SitePoint.Store.removeThrobber(searchResultContainerDiv);
		$(searchResultContainerDiv).html(returnedHtml);
		StampShop.applyBehaviours();
	},
	customerDetailsUpdated:function() {
		$(loginForm).remove();
		StampShop.applyBehaviours();
	},
	updateToggles:function() {
		$('.gz_toggle').each(function() {
			if((mapping=togglesMap[this.id])!=null) {
				if($(this).attr("checked")) {
					$('#'+mapping).hide();
				} else {
					$('#'+mapping).show();
				}
			}
		});
	},
	updateAccountRadio:function() {
		$('#gz_useraccountyes').each(function(){
			if ($('#gz_useraccountyes').attr("checked")) {
				$('#gz_accountfields').hide();
				$('#gz_customerformcontainer').hide();
				$('#gz_loginfields').show();
			} else {
				$('#gz_accountfields').show();
				$('#gz_customerformcontainer').show();				
				$('#gz_loginfields').hide();
			}
		});
	},
	updateAgreement:function() {
		$('#gz_agreement').each(function(){
			if($('#gz_agreement').attr("checked")) {
				//$('#gz_proceed').removeAttr("disabled");
				$('#gz_proceed').unbind('click');
			} else {
				//$('#gz_proceedpayment').attr("disabled","disabled");
				$('#gz_proceed').click(function() {
					alert("You must agree to the Terms and Conditions before proceeding.");
					return false;
				});
			}
		});
	},
	openCalc:function() {
		alert("Note: The foreign currency exchange rates should be used as a guide only.");	
		newWin = window.open(calcUrl,"StampShop","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=510,height=350");
		if (window.focus) {newWin.focus()};
		return false;
	},
	getMinicartAnimClass:function() {
		return minicartAnimationClass;
	},
	isNumeric:function (value) {
		if (value == null || !value.toString().match(/^\d+$/)) return false;
  		return true;
	}

	};// End returned object
})();

// Run on page load
$(function() {
	StampShop.init();
});

SitePoint.Promo = {
	rpcUrl: '/rpc/xmlrpc',
	getPromo: function(domid, contentid, dimension, pixels)
	{
		Gazette.Rpc.call(SitePoint.Promo.rpcUrl, 'promo.getPromo', [domid, contentid,dimension,pixels], SitePoint.Promo.getPromoComplete);
	},
	getPromoComplete: function(response)
	{
		var r = Gazette.Rpc.parseResponse(response);
		var domid=r.domid;
		if (r.success==1)
		{
			$promo = '<a href="'+r.promolink+'" title="'+r.imagecaption+'">';
			$promo+= '<img src="/assets/image/'+r.imagepath+'" alt="'+r.imagealt+'" />';
			$promo+= '</a>';
			$(domid).append($promo);
		}
	}
}
Survey = {}

Survey.init = function()
{
	$('.surveyForm').submit(Survey.submit);
	
	
	$('.surveyOption input')
		.change(Survey.selectionChange)
		.change();
		
	$('.surveyOption.image input').hide()
}
$(document).ready(Survey.init);


Survey.submit = function(e)
{
	e.preventDefault();
	
	$.ajax({
	  	type: "post",
	  	data: $(this).serialize(), 
	  	url: $(this).attr('action'),
	  	success: Survey.submitSuccess
	});
	
	$(this).addClass('submitInProgress');
	$(this).css('opacity', 0.5);
	//$(this).append('<div class=""')
	
	return false;
}

Survey.submitSuccess = function(data)
{
	html = $(data).find('div.survey').html();
	
	form = $('form.submitInProgress').get(0);
	
	$(form.parentNode).html(html);
	Survey.init();
}

Survey.selectionChange = function(e)
{
	question = $(this).parents('.surveyQuestion');
	
	$(question).find('input').each(function(){
		
		
		if ( $(this).attr('checked') ) 
		{
			$(this).parents('label').addClass('selected');
		}	
		else
		{
			$(this).parents('label').removeClass('selected');	
		}
	});
}