(function(){var _jQuery=window.jQuery,_$=window.$;var jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context);};var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,isSimple=/^.[^:#\[\.]*$/,undefined;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}
if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])
selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem){if(elem.id!=match[3])
return jQuery().find(selector);return jQuery(elem);}
selector=[];}}else
return jQuery(context).find(selector);}else if(jQuery.isFunction(selector))
return jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(jQuery.makeArray(selector));},jquery:"1.2.6",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this);},attr:function(name,value,type){var options=name;if(name.constructor==String)
if(value===undefined)
return this[0]&&jQuery[type||"attr"](this[0],name);else{options={};options[name]=value;}
return this.each(function(i){for(name in options)
jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)
value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)
return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)
ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])
jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)
elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)
this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)
this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else
return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)
this[expando]=null;});if(events===true)
this.find("*").andSelf().each(function(i){if(this.nodeType==3)
return;var events=jQuery.data(this,"events");for(var type in events)
for(var handler in events[type])
jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)
if(isSimple.test(selector))
return this.pushStack(jQuery.multiFilter(selector,this,true));else
selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector=='string'?jQuery(selector):jQuery.makeArray(selector))));},is:function(selector){return!!selector&&jQuery.multiFilter(selector,this).length>0;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)
return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one)
return value;values.push(value);}}
return values;}else
return(this[0].value||"").replace(/\r/g,"");}
return undefined;}
if(value.constructor==Number)
value+='';return this.each(function(){if(this.nodeType!=1)
return;if(value.constructor==Array&&/radio|checkbox/.test(this.type))
this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)
this.selectedIndex=-1;}else
this.value=value;});},html:function(value){return value==undefined?(this[0]?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length)
data=jQuery.data(this[0],key);return data===undefined&&parts[1]?this.data(parts[0]):data;}else
return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)
elems.reverse();}
var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))
obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script"))
scripts=scripts.add(elem);else{if(elem.nodeType==1)
scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src)
jQuery.ajax({url:elem.src,async:false,dataType:"script"});else
jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)
elem.parentNode.removeChild(elem);}
function now(){return+new Date;}
jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}
if(typeof target!="object"&&typeof target!="function")
target={};if(length==i){target=this;--i;}
for(;i<length;i++)
if((options=arguments[i])!=null)
for(var name in options){var src=target[name],copy=options[name];if(target===copy)
continue;if(deep&&copy&&typeof copy=="object"&&!copy.nodeType)
target[name]=jQuery.extend(deep,src||(copy.length!=null?[]:{}),copy);else if(copy!==undefined)
target[name]=copy;}
return target;};var expando="jQuery"+now(),uuid=0,windowData={},exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{};jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)
window.jQuery=_jQuery;return jQuery;},isFunction:function(fn){return!!fn&&typeof fn!="string"&&!fn.nodeName&&fn.constructor!=Array&&/^[\s[]?function/.test(fn+"");},isXMLDoc:function(elem){return elem.documentElement&&!elem.body||elem.tagName&&elem.ownerDocument&&!elem.ownerDocument.body;},globalEval:function(data){data=jQuery.trim(data);if(data){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie)
script.text=data;else
script.appendChild(document.createTextNode(data));head.insertBefore(script,head.firstChild);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)
id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])
jQuery.cache[id]={};if(data!==undefined)
jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])
break;if(!name)
jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute)
elem.removeAttribute(expando);}
delete jQuery.cache[id];}},each:function(object,callback,args){var name,i=0,length=object.length;if(args){if(length==undefined){for(name in object)
if(callback.apply(object[name],args)===false)
break;}else
for(;i<length;)
if(callback.apply(object[i++],args)===false)
break;}else{if(length==undefined){for(name in object)
if(callback.call(object[name],name,object[name])===false)
break;}else
for(var value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}
return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))
value=value.call(elem,i);return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))
elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)
elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}
callback.call(elem);for(var name in options)
elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}
if(jQuery(elem).is(":visible"))
getWH();else
jQuery.swap(elem,props,getWH);return Math.max(0,val);}
return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=elem.style;function color(elem){if(!jQuery.browser.safari)
return false;var ret=defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}
if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret;}
if(jQuery.browser.opera&&name=="display"){var save=style.outline;style.outline="0 solid black";style.outline=save;}
if(name.match(/float/i))
name=styleFloat;if(!force&&style&&style[name])
ret=style[name];else if(defaultView.getComputedStyle){if(name.match(/float/i))
name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle&&!color(elem))
ret=computedStyle.getPropertyValue(name);else{var swap=[],stack=[],a=elem,i=0;for(;a&&color(a);a=a.parentNode)
stack.unshift(a);for(;i<stack.length;i++)
if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block";}
ret=name=="display"&&swap[stack.length-1]!=null?"none":(computedStyle&&computedStyle.getPropertyValue(name))||"";for(i=0;i<swap.length;i++)
if(swap[i]!=null)
stack[i].style.display=swap[i];}
if(name=="opacity"&&ret=="")
ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var left=style.left,rsLeft=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;style.left=ret||0;ret=style.pixelLeft+"px";style.left=left;elem.runtimeStyle.left=rsLeft;}}
return ret;},clean:function(elems,context){var ret=[];context=context||document;if(typeof context.createElement=='undefined')
context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;jQuery.each(elems,function(i,elem){if(!elem)
return;if(elem.constructor==Number)
elem+='';if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)
div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)
if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)
tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))
div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}
elem=jQuery.makeArray(div.childNodes);}
if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))
return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)
ret.push(elem);else
ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)
return undefined;var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined,msie=jQuery.browser.msie;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&jQuery.browser.safari)
elem.parentNode.selectedIndex;if(name in elem&&notxml&&!special){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)
throw"type property can't be changed";elem[name]=value;}
if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name))
return elem.getAttributeNode(name).nodeValue;return elem[name];}
if(msie&&notxml&&name=="style")
return jQuery.attr(elem.style,"cssText",value);if(set)
elem.setAttribute(name,""+value);var attr=msie&&notxml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr;}
if(msie&&name=="opacity"){if(set){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+
(parseInt(value)+''=="NaN"?"":"alpha(opacity="+value*100+")");}
return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+'':"";}
name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(set)
elem[name]=value;return elem[name];},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||array.split||array.setInterval||array.call)
ret[0]=array;else
while(i)
ret[--i]=array[i];}
return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)
if(array[i]===elem)
return i;return-1;},merge:function(first,second){var i=0,elem,pos=first.length;if(jQuery.browser.msie){while(elem=second[i++])
if(elem.nodeType!=8)
first[pos++]=elem;}else
while(elem=second[i++])
first[pos++]=elem;return first;},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;}
return ret;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++)
if(!inv!=!callback(elems[i],i))
ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!=null)
ret[ret.length]=value;}
return ret.concat.apply([],ret);}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing"}});jQuery.each({parent:function(elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")
ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++)
jQuery(args[i])[original](this);});};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)
this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)
this.parentNode.removeChild(this);}},empty:function(){jQuery(">*",this).remove();while(this.firstChild)
this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0;}var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return i<m[3]-0;},gt:function(a,i,m){return i>m[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}
return cur;},find:function(t,context){if(typeof t!="string")
return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)
return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false,re=quickChild,m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)
for(var c=ret[i].firstChild;c;c=c.nextSibling)
if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))
r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling)
if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id])break;if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~")merge[id]=true;r.push(n);}
if(m=="+")break;}}
ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true;}}
if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0])ret.shift();done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length);}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]];}else{re2=quickClass;m=re2.exec(t);}
m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2])
oid=jQuery('[@id="'+m[2]+'"]',elem)[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[];}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object")
tag="param";r=jQuery.merge(r,ret[i].getElementsByTagName(tag));}
if(m[1]==".")
r=jQuery.classFilter(r,m[2]);if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++)
if(r[i].getAttribute("id")==m[2]){tmp=[r[i]];break;}
r=tmp;}
ret=r;}
t=t.replace(re2,"");}}
if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t);}}
if(t)
ret=[];if(ret&&context==ret[0])
ret.shift();done=jQuery.merge(done,ret);return done;},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&&!pass)
tmp.push(r[i]);}
return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}
if(!m)
break;if(m[1]==":"&&m[2]=="not")
r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")
r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2]))
z=jQuery.attr(a,m[2])||'';if((type==""&&!!z||type=="="&&z==m[5]||type=="!="&&z!=m[5]||type=="^="&&z&&!z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not)
tmp.push(a);}
r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling)
if(n.nodeType==1)
n.nodeIndex=c++;merge[id]=true;}
var add=false;if(first==0){if(node.nodeIndex==last)
add=true;}else if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0)
add=true;if(add^not)
tmp.push(node);}
r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")
fn=fn[m[2]];if(typeof fn=="string")
fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}
return{r:r,t:t};},dir:function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)
matched.push(cur);cur=cur[dir];}
return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])
if(cur.nodeType==1&&++num==result)
break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem)
r.push(n);}
return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)
return;if(jQuery.browser.msie&&elem.setInterval)
elem=window;if(!handler.guid)
handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=this.proxy(fn,function(){return fn.apply(this,arguments);});handler.data=data;}
var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){if(typeof jQuery!="undefined"&&!jQuery.event.triggered)
return jQuery.event.handle.apply(arguments.callee.elem,arguments);});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)
elem.addEventListener(type,handle,false);else if(elem.attachEvent)
elem.attachEvent("on"+type,handle);}}
handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)
return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))
for(var type in events)
this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}
jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)
delete events[type][handler.guid];else
for(handler in events[type])
if(!parts[1]||events[type][handler].type==parts[1])
delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)
elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)
elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}
ret=null;delete events[type];}}});}
for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}
if(!elem){if(this.global[type])
jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)
return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event){data.unshift({type:type,target:elem,preventDefault:function(){},stopPropagation:function(){},timeStamp:now()});data[0][expando]=true;}
data[0].type=type;if(exclusive)
data[0].exclusive=true;var handle=jQuery.data(elem,"handle");if(handle)
val=handle.apply(elem,data);if((!fn||(jQuery.nodeName(elem,'a')&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)
val=false;if(event)
data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)
val=ret;}
if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}
this.triggered=false;}
return val;},handle:function(event){var val,ret,namespace,all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);namespace=event.type.split(".");event.type=namespace[0];namespace=namespace[1];all=!namespace&&!event.exclusive;handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||handler.type==namespace){event.handler=handler;event.data=handler.data;ret=handler.apply(this,arguments);if(val!==false)
val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}
return val;},fix:function(event){if(event[expando]==true)
return event;var originalEvent=event;event={originalEvent:originalEvent};var props="altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");for(var i=props.length;i;i--)
event[props[i]]=originalEvent[props[i]];event[expando]=true;event.preventDefault=function(){if(originalEvent.preventDefault)
originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)
originalEvent.stopPropagation();originalEvent.cancelBubble=true;};event.timeStamp=event.timeStamp||now();if(!event.target)
event.target=event.srcElement||document;if(event.target.nodeType==3)
event.target=event.target.parentNode;if(!event.relatedTarget&&event.fromElement)
event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}
if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))
event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)
event.metaKey=event.ctrlKey;if(!event.which&&event.button)
event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},proxy:function(fn,proxy){proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);return(fn||data).apply(this,arguments);});return this.each(function(){jQuery.event.add(this,type,one,fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){return this[0]&&jQuery.event.trigger(type,data,this[0],false,fn);},toggle:function(fn){var args=arguments,i=1;while(i<args.length)
jQuery.event.proxy(fn,args[i++]);return this.click(jQuery.event.proxy(fn,function(event){this.lastToggle=(this.lastToggle||0)%i;event.preventDefault();return args[this.lastToggle++].apply(this,arguments)||false;}));},hover:function(fnOver,fnOut){return this.bind('mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)
fn.call(document,jQuery);else
jQuery.readyList.push(function(){return fn.call(this,jQuery);});return this;}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.call(document);});jQuery.readyList=null;}
jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&&!jQuery.browser.opera)
document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}
jQuery.ready();})();if(jQuery.browser.opera)
document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i<document.styleSheets.length;i++)
if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}
jQuery.ready();},false);if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}
if(numStyles===undefined)
numStyles=jQuery("style, link[rel=stylesheet]").length;if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return;}
jQuery.ready();})();}
jQuery.event.add(window,"load",jQuery.ready);}
jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,change,select,"+"submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem)try{parent=parent.parentNode;}catch(error){parent=elem;}
return parent==elem;};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind();});jQuery.fn.extend({_load:jQuery.fn.load,load:function(url,params,callback){if(typeof url!='string')
return this._load(url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}
callback=callback||function(){};var type="GET";if(params)
if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}
var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")
self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}
return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}
return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{url:location.href,global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!="string")
s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre))
s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))
s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}
if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)
s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}
if(head)
head.removeChild(script);};}
if(s.dataType=="script"&&s.cache==null)
s.cache=false;if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}
if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}
if(s.global&&!jQuery.active++)
jQuery.event.trigger("ajaxStart");var remote=/^(?:\w+:)?\/\/([^\/?#]+)/;if(s.dataType=="script"&&type=="GET"&&remote.test(s.url)&&remote.exec(s.url)[1]!=location.host){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)
script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}
head.appendChild(script);return undefined;}
var requestDone=false;var xhr=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();if(s.username)
xhr.open(type,s.url,s.async,s.username,s.password);else
xhr.open(type,s.url,s.async);try{if(s.data)
xhr.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)
xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}
if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&jQuery.active--;xhr.abort();return false;}
if(s.global)
jQuery.event.trigger("ajaxSend",[xhr,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}
status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xhr)&&"error"||s.ifModified&&jQuery.httpNotModified(xhr,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s.dataFilter);}catch(e){status="parsererror";}}
if(status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified");}catch(e){}
if(s.ifModified&&modRes)
jQuery.lastModified[s.url]=modRes;if(!jsonp)
success();}else
jQuery.handleError(s,xhr,status);complete();if(s.async)
xhr=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)
setTimeout(function(){if(xhr){xhr.abort();if(!requestDone)
onreadystatechange("timeout");}},s.timeout);}
try{xhr.send(s.data);}catch(e){jQuery.handleError(s,xhr,null,e);}
if(!s.async)
onreadystatechange();function success(){if(s.success)
s.success(data,status);if(s.global)
jQuery.event.trigger("ajaxSuccess",[xhr,s]);}
function complete(){if(s.complete)
s.complete(xhr,status);if(s.global)
jQuery.event.trigger("ajaxComplete",[xhr,s]);if(s.global&&!--jQuery.active)
jQuery.event.trigger("ajaxStop");}
return xhr;},handleError:function(s,xhr,status,e){if(s.error)s.error(xhr,status,e);if(s.global)
jQuery.event.trigger("ajaxError",[xhr,s,e]);},active:0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}
return false;},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url]||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}
return false;},httpData:function(xhr,type,filter){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.tagName=="parsererror")
throw"parsererror";if(filter)
data=filter(data,type);if(type=="script")
jQuery.globalEval(data);if(type=="json")
data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)
jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else
for(var j in a)
if(a[j]&&a[j].constructor==Array)
jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else
s.push(encodeURIComponent(j)+"="+encodeURIComponent(jQuery.isFunction(a[j])?a[j]():a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")
this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)
return false;var opt=jQuery.extend({},optall),p,hidden=jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)
return opt.complete.call(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}
if(opt.overflow!=null)
this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))
e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}
if(parts[1])
end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else
e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}
if(!type||(typeof type=="string"&&!fn))
return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)
queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)
fn.call(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)
this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)
if(timers[i].elem==this){if(gotoEnd)
timers[i](true);timers.splice(i,1);}});if(!gotoEnd)
this.dequeue();return this;}});var queue=function(elem,type,array){if(elem){type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)
q=jQuery.data(elem,type+"queue",jQuery.makeArray(array));}
return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)
q[0].call(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:jQuery.fx.speeds[opt.duration])||jQuery.fx.speeds.def;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)
jQuery(this).dequeue();if(jQuery.isFunction(opt.old))
opt.old.call(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)
options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)
this.options.step.call(this.elem,this.now,this);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")
this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)
return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}
t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)
if(!timers[i]())
timers.splice(i--,1);if(!timers.length){clearInterval(jQuery.timerId);jQuery.timerId=null;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(0,this.cur());if(this.prop=="width"||this.prop=="height")
this.elem.style[this.prop]="1px";jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=now();if(gotoEnd||t>this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)
if(this.options.curAnim[i]!==true)
done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")
this.elem.style.display="block";}
if(this.options.hide)
this.elem.style.display="none";if(this.options.hide||this.options.show)
for(var p in this.options.curAnim)
jQuery.attr(this.elem.style,p,this.options.orig[p]);}
if(done)
this.options.complete.call(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}
return true;}};jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,def:400},step:{scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}}});jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),css=jQuery.curCSS,fixed=css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)
border(offsetParent);if(!fixed&&css(offsetParent,"position")=="fixed")
fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}
while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(css(parent,"display")))
add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&css(parent,"overflow")!="visible")
border(parent);parent=parent.parentNode;}
if((safari2&&(fixed||css(offsetChild,"position")=="absolute"))||(mozilla&&css(offsetChild,"position")!="absolute"))
add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)
add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}
results={top:top,left:left};}
function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}
function add(l,t){left+=parseInt(l,10)||0;top+=parseInt(t,10)||0;}
return results;};jQuery.fn.extend({position:function(){var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,'marginTop');offset.left-=num(this,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}
return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,'position')=='static'))
offsetParent=offsetParent.offsetParent;return jQuery(offsetParent);}});jQuery.each(['Left','Top'],function(i,name){var method='scroll'+name;jQuery.fn[method]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val;}):this[0]==window||this[0]==document?self[i?'pageYOffset':'pageXOffset']||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method];};});jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":"Bottom";jQuery.fn["inner"+name]=function(){return this[name.toLowerCase()]()+
num(this,"padding"+tl)+
num(this,"padding"+br);};jQuery.fn["outer"+name]=function(margin){return this["inner"+name]()+
num(this,"border"+tl+"Width")+
num(this,"border"+br+"Width")+
(margin?num(this,"margin"+tl)+num(this,"margin"+br):0);};});})();;;(function($){$.ui={plugin:{add:function(module,option,set){var proto=$.ui[module].prototype;for(var i in set){proto.plugins[i]=proto.plugins[i]||[];proto.plugins[i].push([option,set[i]]);}},call:function(instance,name,args){var set=instance.plugins[name];if(!set){return;}
for(var i=0;i<set.length;i++){if(instance.options[set[i][0]]){set[i][1].apply(instance.element,args);}}}},cssCache:{},css:function(name){if($.ui.cssCache[name]){return $.ui.cssCache[name];}
var tmp=$('<div class="ui-resizable-gen">').addClass(name).css({position:'absolute',top:'-5000px',left:'-5000px',display:'block'}).appendTo('body');$.ui.cssCache[name]=!!((!(/auto|default/).test(tmp.css('cursor'))||(/^[1-9]/).test(tmp.css('height'))||(/^[1-9]/).test(tmp.css('width'))||!(/none/).test(tmp.css('backgroundImage'))||!(/transparent|rgba\(0, 0, 0, 0\)/).test(tmp.css('backgroundColor'))));try{$('body').get(0).removeChild(tmp.get(0));}catch(e){}
return $.ui.cssCache[name];},disableSelection:function(e){e.unselectable="on";e.onselectstart=function(){return false;};if(e.style){e.style.MozUserSelect="none";}},enableSelection:function(e){e.unselectable="off";e.onselectstart=function(){return true;};if(e.style){e.style.MozUserSelect="";}},hasScroll:function(e,a){var scroll=/top/.test(a||"top")?'scrollTop':'scrollLeft',has=false;if(e[scroll]>0)return true;e[scroll]=1;has=e[scroll]>0?true:false;e[scroll]=0;return has;}};var _remove=$.fn.remove;$.fn.remove=function(){$("*",this).add(this).trigger("remove");return _remove.apply(this,arguments);};function getter(namespace,plugin,method){var methods=$[namespace][plugin].getter||[];methods=(typeof methods=="string"?methods.split(/,?\s+/):methods);return($.inArray(method,methods)!=-1);}
$.widget=function(name,prototype){var namespace=name.split(".")[0];name=name.split(".")[1];$.fn[name]=function(options){var isMethodCall=(typeof options=='string'),args=Array.prototype.slice.call(arguments,1);if(isMethodCall&&getter(namespace,name,options)){var instance=$.data(this[0],name);return(instance?instance[options].apply(instance,args):undefined);}
return this.each(function(){var instance=$.data(this,name);if(isMethodCall&&instance&&$.isFunction(instance[options])){instance[options].apply(instance,args);}else if(!isMethodCall){$.data(this,name,new $[namespace][name](this,options));}});};$[namespace][name]=function(element,options){var self=this;this.widgetName=name;this.widgetBaseClass=namespace+'-'+name;this.options=$.extend({disabled:false},$[namespace][name].defaults,options);this.element=$(element).bind('setData.'+name,function(e,key,value){return self.setData(key,value);}).bind('getData.'+name,function(e,key){return self.getData(key);}).bind('remove',function(){return self.destroy();});this.init();};$[namespace][name].prototype=$.extend({},$.widget.prototype,prototype);};$.widget.prototype={init:function(){},destroy:function(){this.element.removeData(this.widgetName);},getData:function(key){return this.options[key];},setData:function(key,value){this.options[key]=value;if(key=='disabled'){this.element[value?'addClass':'removeClass'](this.widgetBaseClass+'-disabled');}},enable:function(){this.setData('disabled',false);},disable:function(){this.setData('disabled',true);}};$.ui.mouse={mouseInit:function(){var self=this;this.element.bind('mousedown.'+this.widgetName,function(e){return self.mouseDown(e);});if($.browser.msie){this._mouseUnselectable=this.element.attr('unselectable');this.element.attr('unselectable','on');}
this.started=false;},mouseDestroy:function(){this.element.unbind('.'+this.widgetName);($.browser.msie&&this.element.attr('unselectable',this._mouseUnselectable));},mouseDown:function(e){(this._mouseStarted&&this.mouseUp(e));this._mouseDownEvent=e;var self=this,btnIsLeft=(e.which==1),elIsCancel=(typeof this.options.cancel=="string"?$(e.target).is(this.options.cancel):false);if(!btnIsLeft||elIsCancel||!this.mouseCapture(e)){return true;}
this._mouseDelayMet=!this.options.delay;if(!this._mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){self._mouseDelayMet=true;},this.options.delay);}
if(this.mouseDistanceMet(e)&&this.mouseDelayMet(e)){this._mouseStarted=(this.mouseStart(e)!==false);if(!this._mouseStarted){e.preventDefault();return true;}}
this._mouseMoveDelegate=function(e){return self.mouseMove(e);};this._mouseUpDelegate=function(e){return self.mouseUp(e);};$(document).bind('mousemove.'+this.widgetName,this._mouseMoveDelegate).bind('mouseup.'+this.widgetName,this._mouseUpDelegate);return false;},mouseMove:function(e){if($.browser.msie&&!e.button){return this.mouseUp(e);}
if(this._mouseStarted){this.mouseDrag(e);return false;}
if(this.mouseDistanceMet(e)&&this.mouseDelayMet(e)){this._mouseStarted=(this.mouseStart(this._mouseDownEvent,e)!==false);(this._mouseStarted?this.mouseDrag(e):this.mouseUp(e));}
return!this._mouseStarted;},mouseUp:function(e){$(document).unbind('mousemove.'+this.widgetName,this._mouseMoveDelegate).unbind('mouseup.'+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this.mouseStop(e);}
return false;},mouseDistanceMet:function(e){return(Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance);},mouseDelayMet:function(e){return this._mouseDelayMet;},mouseStart:function(e){},mouseDrag:function(e){},mouseStop:function(e){},mouseCapture:function(e){return true;}};$.ui.mouse.defaults={cancel:null,distance:1,delay:0};})(jQuery);(function($){$.widget("ui.draggable",$.extend($.ui.mouse,{init:function(){var o=this.options;if(o.helper=='original'&&!(/(relative|absolute|fixed)/).test(this.element.css('position')))
this.element.css('position','relative');this.element.addClass('ui-draggable');(o.disabled&&this.element.addClass('ui-draggable-disabled'));this.mouseInit();},mouseStart:function(e){var o=this.options;if(this.helper||o.disabled||$(e.target).is('.ui-resizable-handle'))return false;var handle=!this.options.handle||!$(this.options.handle,this.element).length?true:false;$(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==e.target)handle=true;});if(!handle)return false;if($.ui.ddmanager)$.ui.ddmanager.current=this;this.helper=$.isFunction(o.helper)?$(o.helper.apply(this.element[0],[e])):(o.helper=='clone'?this.element.clone():this.element);if(!this.helper.parents('body').length)this.helper.appendTo((o.appendTo=='parent'?this.element[0].parentNode:o.appendTo));if(this.helper[0]!=this.element[0]&&!(/(fixed|absolute)/).test(this.helper.css("position")))this.helper.css("position","absolute");this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0)};this.cssPosition=this.helper.css("position");this.offset=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.offset.click={left:e.pageX-this.offset.left,top:e.pageY-this.offset.top};this.offsetParent=this.helper.offsetParent();var po=this.offsetParent.offset();if(this.offsetParent[0]==document.body&&$.browser.mozilla)po={top:0,left:0};this.offset.parent={top:po.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:po.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)};var p=this.element.position();this.offset.relative=this.cssPosition=="relative"?{top:p.top-(parseInt(this.helper.css("top"),10)||0)+this.offsetParent[0].scrollTop,left:p.left-(parseInt(this.helper.css("left"),10)||0)+this.offsetParent[0].scrollLeft}:{top:0,left:0};this.originalPosition=this.generatePosition(e);this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};if(o.cursorAt){if(o.cursorAt.left!=undefined)this.offset.click.left=o.cursorAt.left+this.margins.left;if(o.cursorAt.right!=undefined)this.offset.click.left=this.helperProportions.width-o.cursorAt.right+this.margins.left;if(o.cursorAt.top!=undefined)this.offset.click.top=o.cursorAt.top+this.margins.top;if(o.cursorAt.bottom!=undefined)this.offset.click.top=this.helperProportions.height-o.cursorAt.bottom+this.margins.top;}
if(o.containment){if(o.containment=='parent')o.containment=this.helper[0].parentNode;if(o.containment=='document'||o.containment=='window')this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,$(o.containment=='document'?document:window).width()-this.offset.relative.left-this.offset.parent.left-this.helperProportions.width-this.margins.left-(parseInt(this.element.css("marginRight"),10)||0),($(o.containment=='document'?document:window).height()||document.body.parentNode.scrollHeight)-this.offset.relative.top-this.offset.parent.top-this.helperProportions.height-this.margins.top-(parseInt(this.element.css("marginBottom"),10)||0)];if(!(/^(document|window|parent)$/).test(o.containment)){var ce=$(o.containment)[0];var co=$(o.containment).offset();this.containment=[co.left+(parseInt($(ce).css("borderLeftWidth"),10)||0)-this.offset.relative.left-this.offset.parent.left,co.top+(parseInt($(ce).css("borderTopWidth"),10)||0)-this.offset.relative.top-this.offset.parent.top,co.left+Math.max(ce.scrollWidth,ce.offsetWidth)-(parseInt($(ce).css("borderLeftWidth"),10)||0)-this.offset.relative.left-this.offset.parent.left-this.helperProportions.width-this.margins.left-(parseInt(this.element.css("marginRight"),10)||0),co.top+Math.max(ce.scrollHeight,ce.offsetHeight)-(parseInt($(ce).css("borderTopWidth"),10)||0)-this.offset.relative.top-this.offset.parent.top-this.helperProportions.height-this.margins.top-(parseInt(this.element.css("marginBottom"),10)||0)];}}
this.propagate("start",e);this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};if($.ui.ddmanager&&!o.dropBehaviour)$.ui.ddmanager.prepareOffsets(this,e);this.helper.addClass("ui-draggable-dragging");this.mouseDrag(e);return true;},convertPositionTo:function(d,pos){if(!pos)pos=this.position;var mod=d=="absolute"?1:-1;return{top:(pos.top
+this.offset.relative.top*mod
+this.offset.parent.top*mod
-(this.cssPosition=="fixed"||(this.cssPosition=="absolute"&&this.offsetParent[0]==document.body)?0:this.offsetParent[0].scrollTop)*mod
+(this.cssPosition=="fixed"?this.offsetParent[0].scrollTop:0)*mod
+this.margins.top*mod),left:(pos.left
+this.offset.relative.left*mod
+this.offset.parent.left*mod
-(this.cssPosition=="fixed"||(this.cssPosition=="absolute"&&this.offsetParent[0]==document.body)?0:this.offsetParent[0].scrollLeft)*mod
+(this.cssPosition=="fixed"?this.offsetParent[0].scrollLeft:0)*mod
+this.margins.left*mod)};},generatePosition:function(e){var o=this.options;var position={top:(e.pageY
-this.offset.click.top
-this.offset.relative.top
-this.offset.parent.top
+(this.cssPosition=="fixed"||(this.cssPosition=="absolute"&&this.offsetParent[0]==document.body)?0:this.offsetParent[0].scrollTop)
-(this.cssPosition=="fixed"?this.offsetParent[0].scrollTop:0)),left:(e.pageX
-this.offset.click.left
-this.offset.relative.left
-this.offset.parent.left
+(this.cssPosition=="fixed"||(this.cssPosition=="absolute"&&this.offsetParent[0]==document.body)?0:this.offsetParent[0].scrollLeft)
-(this.cssPosition=="fixed"?this.offsetParent[0].scrollLeft:0))};if(!this.originalPosition)return position;if(this.containment){if(position.left<this.containment[0])position.left=this.containment[0];if(position.top<this.containment[1])position.top=this.containment[1];if(position.left>this.containment[2])position.left=this.containment[2];if(position.top>this.containment[3])position.top=this.containment[3];}
if(o.grid){var top=this.originalPosition.top+Math.round((position.top-this.originalPosition.top)/o.grid[1])*o.grid[1];position.top=this.containment?(!(top<this.containment[1]||top>this.containment[3])?top:(!(top<this.containment[1])?top-o.grid[1]:top+o.grid[1])):top;var left=this.originalPosition.left+Math.round((position.left-this.originalPosition.left)/o.grid[0])*o.grid[0];position.left=this.containment?(!(left<this.containment[0]||left>this.containment[2])?left:(!(left<this.containment[0])?left-o.grid[0]:left+o.grid[0])):left;}
return position;},mouseDrag:function(e){this.position=this.generatePosition(e);this.positionAbs=this.convertPositionTo("absolute");this.position=this.propagate("drag",e)||this.position;if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+'px';if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+'px';if($.ui.ddmanager)$.ui.ddmanager.drag(this,e);return false;},mouseStop:function(e){if($.ui.ddmanager&&!this.options.dropBehaviour)
$.ui.ddmanager.drop(this,e);if(this.options.revert){var self=this;$(this.helper).animate(this.originalPosition,parseInt(this.options.revert,10)||500,function(){self.propagate("stop",e);self.clear();});}else{this.propagate("stop",e);this.clear();}
return false;},clear:function(){this.helper.removeClass("ui-draggable-dragging");if(this.options.helper!='original'&&!this.cancelHelperRemoval)this.helper.remove();this.helper=null;this.cancelHelperRemoval=false;},plugins:{},uiHash:function(e){return{helper:this.helper,position:this.position,absolutePosition:this.positionAbs,options:this.options};},propagate:function(n,e){$.ui.plugin.call(this,n,[e,this.uiHash()]);return this.element.triggerHandler(n=="drag"?n:"drag"+n,[e,this.uiHash()],this.options[n]);},destroy:function(){if(!this.element.data('draggable'))return;this.element.removeData("draggable").unbind(".draggable").removeClass('ui-draggable');this.mouseDestroy();}}));$.extend($.ui.draggable,{defaults:{appendTo:"parent",axis:false,cancel:":input,button",delay:0,distance:0,helper:"original"}});$.ui.plugin.add("draggable","cursor",{start:function(e,ui){var t=$('body');if(t.css("cursor"))ui.options._cursor=t.css("cursor");t.css("cursor",ui.options.cursor);},stop:function(e,ui){if(ui.options._cursor)$('body').css("cursor",ui.options._cursor);}});$.ui.plugin.add("draggable","zIndex",{start:function(e,ui){var t=$(ui.helper);if(t.css("zIndex"))ui.options._zIndex=t.css("zIndex");t.css('zIndex',ui.options.zIndex);},stop:function(e,ui){if(ui.options._zIndex)$(ui.helper).css('zIndex',ui.options._zIndex);}});$.ui.plugin.add("draggable","opacity",{start:function(e,ui){var t=$(ui.helper);if(t.css("opacity"))ui.options._opacity=t.css("opacity");t.css('opacity',ui.options.opacity);},stop:function(e,ui){if(ui.options._opacity)$(ui.helper).css('opacity',ui.options._opacity);}});$.ui.plugin.add("draggable","iframeFix",{start:function(e,ui){$(ui.options.iframeFix===true?"iframe":ui.options.iframeFix).each(function(){$('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css($(this).offset()).appendTo("body");});},stop:function(e,ui){$("div.DragDropIframeFix").each(function(){this.parentNode.removeChild(this);});}});$.ui.plugin.add("draggable","scroll",{start:function(e,ui){var o=ui.options;var i=$(this).data("draggable");o.scrollSensitivity=o.scrollSensitivity||20;o.scrollSpeed=o.scrollSpeed||20;i.overflowY=function(el){do{if(/auto|scroll/.test(el.css('overflow'))||(/auto|scroll/).test(el.css('overflow-y')))return el;el=el.parent();}while(el[0].parentNode);return $(document);}(this);i.overflowX=function(el){do{if(/auto|scroll/.test(el.css('overflow'))||(/auto|scroll/).test(el.css('overflow-x')))return el;el=el.parent();}while(el[0].parentNode);return $(document);}(this);if(i.overflowY[0]!=document&&i.overflowY[0].tagName!='HTML')i.overflowYOffset=i.overflowY.offset();if(i.overflowX[0]!=document&&i.overflowX[0].tagName!='HTML')i.overflowXOffset=i.overflowX.offset();},drag:function(e,ui){var o=ui.options;var i=$(this).data("draggable");if(i.overflowY[0]!=document&&i.overflowY[0].tagName!='HTML'){if((i.overflowYOffset.top+i.overflowY[0].offsetHeight)-e.pageY<o.scrollSensitivity)
i.overflowY[0].scrollTop=i.overflowY[0].scrollTop+o.scrollSpeed;if(e.pageY-i.overflowYOffset.top<o.scrollSensitivity)
i.overflowY[0].scrollTop=i.overflowY[0].scrollTop-o.scrollSpeed;}else{if(e.pageY-$(document).scrollTop()<o.scrollSensitivity)
$(document).scrollTop($(document).scrollTop()-o.scrollSpeed);if($(window).height()-(e.pageY-$(document).scrollTop())<o.scrollSensitivity)
$(document).scrollTop($(document).scrollTop()+o.scrollSpeed);}
if(i.overflowX[0]!=document&&i.overflowX[0].tagName!='HTML'){if((i.overflowXOffset.left+i.overflowX[0].offsetWidth)-e.pageX<o.scrollSensitivity)
i.overflowX[0].scrollLeft=i.overflowX[0].scrollLeft+o.scrollSpeed;if(e.pageX-i.overflowXOffset.left<o.scrollSensitivity)
i.overflowX[0].scrollLeft=i.overflowX[0].scrollLeft-o.scrollSpeed;}else{if(e.pageX-$(document).scrollLeft()<o.scrollSensitivity)
$(document).scrollLeft($(document).scrollLeft()-o.scrollSpeed);if($(window).width()-(e.pageX-$(document).scrollLeft())<o.scrollSensitivity)
$(document).scrollLeft($(document).scrollLeft()+o.scrollSpeed);}}});$.ui.plugin.add("draggable","snap",{start:function(e,ui){var inst=$(this).data("draggable");inst.snapElements=[];$(ui.options.snap===true?'.ui-draggable':ui.options.snap).each(function(){var $t=$(this);var $o=$t.offset();if(this!=inst.element[0])inst.snapElements.push({item:this,width:$t.outerWidth(),height:$t.outerHeight(),top:$o.top,left:$o.left});});},drag:function(e,ui){var inst=$(this).data("draggable");var d=ui.options.snapTolerance||20;var x1=ui.absolutePosition.left,x2=x1+inst.helperProportions.width,y1=ui.absolutePosition.top,y2=y1+inst.helperProportions.height;for(var i=inst.snapElements.length-1;i>=0;i--){var l=inst.snapElements[i].left,r=l+inst.snapElements[i].width,t=inst.snapElements[i].top,b=t+inst.snapElements[i].height;if(!((l-d<x1&&x1<r+d&&t-d<y1&&y1<b+d)||(l-d<x1&&x1<r+d&&t-d<y2&&y2<b+d)||(l-d<x2&&x2<r+d&&t-d<y1&&y1<b+d)||(l-d<x2&&x2<r+d&&t-d<y2&&y2<b+d)))continue;if(ui.options.snapMode!='inner'){var ts=Math.abs(t-y2)<=20;var bs=Math.abs(b-y1)<=20;var ls=Math.abs(l-x2)<=20;var rs=Math.abs(r-x1)<=20;if(ts)ui.position.top=inst.convertPositionTo("relative",{top:t-inst.helperProportions.height,left:0}).top;if(bs)ui.position.top=inst.convertPositionTo("relative",{top:b,left:0}).top;if(ls)ui.position.left=inst.convertPositionTo("relative",{top:0,left:l-inst.helperProportions.width}).left;if(rs)ui.position.left=inst.convertPositionTo("relative",{top:0,left:r}).left;}
if(ui.options.snapMode!='outer'){var ts=Math.abs(t-y1)<=20;var bs=Math.abs(b-y2)<=20;var ls=Math.abs(l-x1)<=20;var rs=Math.abs(r-x2)<=20;if(ts)ui.position.top=inst.convertPositionTo("relative",{top:t,left:0}).top;if(bs)ui.position.top=inst.convertPositionTo("relative",{top:b-inst.helperProportions.height,left:0}).top;if(ls)ui.position.left=inst.convertPositionTo("relative",{top:0,left:l}).left;if(rs)ui.position.left=inst.convertPositionTo("relative",{top:0,left:r-inst.helperProportions.width}).left;}};}});$.ui.plugin.add("draggable","connectToSortable",{start:function(e,ui){var inst=$(this).data("draggable");inst.sortables=[];$(ui.options.connectToSortable).each(function(){if($.data(this,'sortable')){var sortable=$.data(this,'sortable');inst.sortables.push({instance:sortable,shouldRevert:sortable.options.revert});sortable.refresh();sortable.propagate("activate",e,inst);}});},stop:function(e,ui){var inst=$(this).data("draggable");$.each(inst.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;inst.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert)this.instance.options.revert=true;this.instance.mouseStop(e);this.instance.element.triggerHandler("sortreceive",[e,$.extend(this.instance.ui(),{sender:inst.element})],this.instance.options["receive"]);this.instance.options.helper=this.instance.options._helper;}else{this.instance.propagate("deactivate",e,inst);}});},drag:function(e,ui){var inst=$(this).data("draggable"),self=this;var checkPos=function(o){var l=o.left,r=l+o.width,t=o.top,b=t+o.height;return(l<(this.positionAbs.left+this.offset.click.left)&&(this.positionAbs.left+this.offset.click.left)<r&&t<(this.positionAbs.top+this.offset.click.top)&&(this.positionAbs.top+this.offset.click.top)<b);};$.each(inst.sortables,function(i){if(checkPos.call(inst,this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=$(self).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return ui.helper[0];};e.target=this.instance.currentItem[0];this.instance.mouseCapture(e,true,true);this.instance.mouseStart(e,true,true);this.instance.offset.click.top=inst.offset.click.top;this.instance.offset.click.left=inst.offset.click.left;this.instance.offset.parent.left-=inst.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=inst.offset.parent.top-this.instance.offset.parent.top;inst.propagate("toSortable",e);}
if(this.instance.currentItem)this.instance.mouseDrag(e);}else{if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance.mouseStop(e,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();this.instance.placeholder.remove();inst.propagate("fromSortable",e);}};});}});$.ui.plugin.add("draggable","stack",{start:function(e,ui){var group=$.makeArray($(ui.options.stack.group)).sort(function(a,b){return(parseInt($(a).css("zIndex"),10)||ui.options.stack.min)-(parseInt($(b).css("zIndex"),10)||ui.options.stack.min);});$(group).each(function(i){this.style.zIndex=ui.options.stack.min+i;});this[0].style.zIndex=ui.options.stack.min+group.length;}});})(jQuery);(function($){$.widget("ui.tabs",{init:function(){this.options.event+='.tabs';this.tabify(true);},setData:function(key,value){if((/^selected/).test(key))
this.select(value);else{this.options[key]=value;this.tabify();}},length:function(){return this.$tabs.length;},tabId:function(a){return a.title&&a.title.replace(/\s/g,'_').replace(/[^A-Za-z0-9\-_:\.]/g,'')||this.options.idPrefix+$.data(a);},ui:function(tab,panel){return{options:this.options,tab:tab,panel:panel};},tabify:function(init){this.$lis=$('li:has(a[href])',this.element);this.$tabs=this.$lis.map(function(){return $('a',this)[0];});this.$panels=$([]);var self=this,o=this.options;this.$tabs.each(function(i,a){if(a.hash&&a.hash.replace('#',''))
self.$panels=self.$panels.add(a.hash);else if($(a).attr('href')!='#'){$.data(a,'href.tabs',a.href);$.data(a,'load.tabs',a.href);var id=self.tabId(a);a.href='#'+id;var $panel=$('#'+id);if(!$panel.length){$panel=$(o.panelTemplate).attr('id',id).addClass(o.panelClass).insertAfter(self.$panels[i-1]||self.element);$panel.data('destroy.tabs',true);}
self.$panels=self.$panels.add($panel);}
else
o.disabled.push(i+1);});if(init){this.element.addClass(o.navClass);this.$panels.each(function(){var $this=$(this);$this.addClass(o.panelClass);});if(o.selected===undefined){if(location.hash){this.$tabs.each(function(i,a){if(a.hash==location.hash){o.selected=i;if($.browser.msie||$.browser.opera){var $toShow=$(location.hash),toShowId=$toShow.attr('id');$toShow.attr('id','');setTimeout(function(){$toShow.attr('id',toShowId);},500);}
scrollTo(0,0);return false;}});}
else if(o.cookie){var index=parseInt($.cookie('ui-tabs'+$.data(self.element)),10);if(index&&self.$tabs[index])
o.selected=index;}
else if(self.$lis.filter('.'+o.selectedClass).length)
o.selected=self.$lis.index(self.$lis.filter('.'+o.selectedClass)[0]);}
o.selected=o.selected===null||o.selected!==undefined?o.selected:0;o.disabled=$.unique(o.disabled.concat($.map(this.$lis.filter('.'+o.disabledClass),function(n,i){return self.$lis.index(n);}))).sort();if($.inArray(o.selected,o.disabled)!=-1)
o.disabled.splice($.inArray(o.selected,o.disabled),1);this.$panels.addClass(o.hideClass);this.$lis.removeClass(o.selectedClass);if(o.selected!==null){this.$panels.eq(o.selected).show().removeClass(o.hideClass);this.$lis.eq(o.selected).addClass(o.selectedClass);var onShow=function(){$(self.element).triggerHandler('tabsshow',[self.ui(self.$tabs[o.selected],self.$panels[o.selected])],o.show);};if($.data(this.$tabs[o.selected],'load.tabs'))
this.load(o.selected,onShow);else
onShow();}
$(window).bind('unload',function(){self.$tabs.unbind('.tabs');self.$lis=self.$tabs=self.$panels=null;});}
for(var i=0,li;li=this.$lis[i];i++)
$(li)[$.inArray(i,o.disabled)!=-1&&!$(li).hasClass(o.selectedClass)?'addClass':'removeClass'](o.disabledClass);if(o.cache===false)
this.$tabs.removeData('cache.tabs');var hideFx,showFx,baseFx={'min-width':0,duration:1},baseDuration='normal';if(o.fx&&o.fx.constructor==Array)
hideFx=o.fx[0]||baseFx,showFx=o.fx[1]||baseFx;else
hideFx=showFx=o.fx||baseFx;var resetCSS={display:'',overflow:'',height:''};if(!$.browser.msie)
resetCSS.opacity='';function hideTab(clicked,$hide,$show){$hide.animate(hideFx,hideFx.duration||baseDuration,function(){$hide.addClass(o.hideClass).css(resetCSS);if($.browser.msie&&hideFx.opacity)
$hide[0].style.filter='';if($show)
showTab(clicked,$show,$hide);});}
function showTab(clicked,$show,$hide){if(showFx===baseFx)
$show.css('display','block');$show.animate(showFx,showFx.duration||baseDuration,function(){$show.removeClass(o.hideClass).css(resetCSS);if($.browser.msie&&showFx.opacity)
$show[0].style.filter='';$(self.element).triggerHandler('tabsshow',[self.ui(clicked,$show[0])],o.show);});}
function switchTab(clicked,$li,$hide,$show){$li.addClass(o.selectedClass).siblings().removeClass(o.selectedClass);hideTab(clicked,$hide,$show);}
this.$tabs.unbind('.tabs').bind(o.event,function(){var $li=$(this).parents('li:eq(0)'),$hide=self.$panels.filter(':visible'),$show=$(this.hash);if(($li.hasClass(o.selectedClass)&&!o.unselect)||$li.hasClass(o.disabledClass)||$(this).hasClass(o.loadingClass)||$(self.element).triggerHandler('tabsselect',[self.ui(this,$show[0])],o.select)===false){this.blur();return false;}
self.options.selected=self.$tabs.index(this);if(o.unselect){if($li.hasClass(o.selectedClass)){self.options.selected=null;$li.removeClass(o.selectedClass);self.$panels.stop();hideTab(this,$hide);this.blur();return false;}else if(!$hide.length){self.$panels.stop();var a=this;self.load(self.$tabs.index(this),function(){$li.addClass(o.selectedClass).addClass(o.unselectClass);showTab(a,$show);});this.blur();return false;}}
if(o.cookie)
$.cookie('ui-tabs'+$.data(self.element),self.options.selected,o.cookie);self.$panels.stop();if($show.length){var a=this;self.load(self.$tabs.index(this),$hide.length?function(){switchTab(a,$li,$hide,$show);}:function(){$li.addClass(o.selectedClass);showTab(a,$show);});}else
throw'jQuery UI Tabs: Mismatching fragment identifier.';if($.browser.msie)
this.blur();return false;});if(!(/^click/).test(o.event))
this.$tabs.bind('click.tabs',function(){return false;});},add:function(url,label,index){if(index==undefined)
index=this.$tabs.length;var o=this.options;var $li=$(o.tabTemplate.replace(/#\{href\}/g,url).replace(/#\{label\}/g,label));$li.data('destroy.tabs',true);var id=url.indexOf('#')==0?url.replace('#',''):this.tabId($('a:first-child',$li)[0]);var $panel=$('#'+id);if(!$panel.length){$panel=$(o.panelTemplate).attr('id',id).addClass(o.hideClass).data('destroy.tabs',true);}
$panel.addClass(o.panelClass);if(index>=this.$lis.length){$li.appendTo(this.element);$panel.appendTo(this.element[0].parentNode);}else{$li.insertBefore(this.$lis[index]);$panel.insertBefore(this.$panels[index]);}
o.disabled=$.map(o.disabled,function(n,i){return n>=index?++n:n});this.tabify();if(this.$tabs.length==1){$li.addClass(o.selectedClass);$panel.removeClass(o.hideClass);var href=$.data(this.$tabs[0],'load.tabs');if(href)
this.load(index,href);}
this.element.triggerHandler('tabsadd',[this.ui(this.$tabs[index],this.$panels[index])],o.add);},remove:function(index){var o=this.options,$li=this.$lis.eq(index).remove(),$panel=this.$panels.eq(index).remove();if($li.hasClass(o.selectedClass)&&this.$tabs.length>1)
this.select(index+(index+1<this.$tabs.length?1:-1));o.disabled=$.map($.grep(o.disabled,function(n,i){return n!=index;}),function(n,i){return n>=index?--n:n});this.tabify();this.element.triggerHandler('tabsremove',[this.ui($li.find('a')[0],$panel[0])],o.remove);},enable:function(index){var o=this.options;if($.inArray(index,o.disabled)==-1)
return;var $li=this.$lis.eq(index).removeClass(o.disabledClass);if($.browser.safari){$li.css('display','inline-block');setTimeout(function(){$li.css('display','block');},0);}
o.disabled=$.grep(o.disabled,function(n,i){return n!=index;});this.element.triggerHandler('tabsenable',[this.ui(this.$tabs[index],this.$panels[index])],o.enable);},disable:function(index){var self=this,o=this.options;if(index!=o.selected){this.$lis.eq(index).addClass(o.disabledClass);o.disabled.push(index);o.disabled.sort();this.element.triggerHandler('tabsdisable',[this.ui(this.$tabs[index],this.$panels[index])],o.disable);}},select:function(index){if(typeof index=='string')
index=this.$tabs.index(this.$tabs.filter('[href$='+index+']')[0]);this.$tabs.eq(index).trigger(this.options.event);},load:function(index,callback){var self=this,o=this.options,$a=this.$tabs.eq(index),a=$a[0],bypassCache=callback==undefined||callback===false,url=$a.data('load.tabs');callback=callback||function(){};if(!url||!bypassCache&&$.data(a,'cache.tabs')){callback();return;}
var inner=function(parent){var $parent=$(parent),$inner=$parent.find('*:last');return $inner.length&&$inner||$parent;};var cleanup=function(){self.$tabs.filter('.'+o.loadingClass).removeClass(o.loadingClass).each(function(){if(o.spinner)
inner(this).parent().html(inner(this).data('label.tabs'));});self.xhr=null;};if(o.spinner){var label=inner(a).html();inner(a).wrapInner('<em></em>').find('em').data('label.tabs',label).html(o.spinner);}
var ajaxOptions=$.extend({},o.ajaxOptions,{url:url,success:function(r,s){$(a.hash).html(r);cleanup();if(o.cache)
$.data(a,'cache.tabs',true);$(self.element).triggerHandler('tabsload',[self.ui(self.$tabs[index],self.$panels[index])],o.load);o.ajaxOptions.success&&o.ajaxOptions.success(r,s);callback();}});if(this.xhr){this.xhr.abort();cleanup();}
$a.addClass(o.loadingClass);setTimeout(function(){self.xhr=$.ajax(ajaxOptions);},0);},url:function(index,url){this.$tabs.eq(index).removeData('cache.tabs').data('load.tabs',url);},destroy:function(){var o=this.options;this.element.unbind('.tabs').removeClass(o.navClass).removeData('tabs');this.$tabs.each(function(){var href=$.data(this,'href.tabs');if(href)
this.href=href;var $this=$(this).unbind('.tabs');$.each(['href','load','cache'],function(i,prefix){$this.removeData(prefix+'.tabs');});});this.$lis.add(this.$panels).each(function(){if($.data(this,'destroy.tabs'))
$(this).remove();else
$(this).removeClass([o.selectedClass,o.unselectClass,o.disabledClass,o.panelClass,o.hideClass].join(' '));});}});$.ui.tabs.defaults={unselect:false,event:'click',disabled:[],cookie:null,spinner:'Loading&#8230;',cache:false,idPrefix:'ui-tabs-',ajaxOptions:{},fx:null,tabTemplate:'<li><a href="#{href}"><span>#{label}</span></a></li>',panelTemplate:'<div></div>',navClass:'ui-tabs-nav',selectedClass:'ui-tabs-selected',unselectClass:'ui-tabs-unselect',disabledClass:'ui-tabs-disabled',panelClass:'ui-tabs-panel',hideClass:'ui-tabs-hide',loadingClass:'ui-tabs-loading'};$.ui.tabs.getter="length";$.extend($.ui.tabs.prototype,{rotation:null,rotate:function(ms,continuing){continuing=continuing||false;var self=this,t=this.options.selected;function start(){self.rotation=setInterval(function(){t=++t<self.$tabs.length?t:0;self.select(t);},ms);}
function stop(e){if(!e||e.clientX){clearInterval(self.rotation);}}
if(ms){start();if(!continuing)
this.$tabs.bind(this.options.event,stop);else
this.$tabs.bind(this.options.event,function(){stop();t=self.options.selected;start();});}
else{stop();this.$tabs.unbind(this.options.event,stop);}}});})(jQuery);;;(function($){var $preload=$.preload=function(original,settings){if(original.split)
original=$(original);settings=$.extend({},$preload.defaults,settings);var sources=$.map(original,function(source){if(!source)
return;if(source.split)
return settings.base+source+settings.ext;var url=source.src||source.href;if(typeof settings.placeholder=='string'&&source.src)
source.src=settings.placeholder;if(url&&settings.find)
url=url.replace(settings.find,settings.replace);return url||null;});var data={loaded:0,failed:0,next:0,done:0,total:sources.length};if(!data.total)
return finish();var imgs='<img/>',thres=settings.threshold;while(--thres>0)
imgs+='<img/>';imgs=$(imgs).load(handler).error(handler).bind('abort',handler).each(fetch);function handler(e){data.found=e.type=='load';data.image=this.src;var orig=data.original=original[this.index];data[data.found?'loaded':'failed']++;data.done++;if(settings.placeholder&&orig.src)
orig.src=data.found?data.image:settings.notFound||orig.src;if(settings.onComplete)
settings.onComplete(data);if(data.done<data.total)
fetch(0,this);else{if(imgs.unbind)
imgs.unbind('load').unbind('error').unbind('abort');imgs=null;finish();}};function fetch(i,img,retry){if($.browser.msie&&data.next&&data.next%$preload.gap==0&&!retry){setTimeout(function(){fetch(i,img,true);},0);return false;}
if(data.next==data.total)return false;img.index=data.next;img.src=sources[data.next++];if(settings.onRequest){data.image=img.src;data.original=original[data.next-1];settings.onRequest(data);}};function finish(){if(settings.onFinish)
settings.onFinish(data);};};$preload.gap=14;$preload.defaults={threshold:2,base:'',ext:'',replace:''};$.fn.preload=function(settings){$preload(this,settings);return this;};})(jQuery);;jQuery.extend({ImpromptuDefaults:{prefix:'jqi',buttons:{Ok:true},loaded:function(){},submit:function(){return true;},callback:function(){},opacity:0.6,zIndex:999,overlayspeed:'slow',promptspeed:'fast',show:'show',focus:0,useiframe:false},SetImpromptuDefaults:function(o){jQuery.ImpromptuDefaults=jQuery.extend({},jQuery.ImpromptuDefaults,o);},prompt:function(m,o){o=jQuery.extend({},jQuery.ImpromptuDefaults,o);var ie6=(jQuery.browser.msie&&jQuery.browser.version<7);var b=jQuery('#prompt-layer');var w=jQuery(window);var msgbox='<div class="'+o.prefix+'box" id="'+o.prefix+'box">';if(o.useiframe&&((jQuery.browser.msie&&jQuery('object, applet').length>0)||ie6))
msgbox+='<iframe src="javascript:;" class="'+o.prefix+'fade" id="'+o.prefix+'fade"></iframe>';else{if(ie6)$('select').css('visibility','hidden');msgbox+='<div class="'+o.prefix+'fade" id="'+o.prefix+'fade"></div>';}
msgbox+='<div class="'+o.prefix+'" id="'+o.prefix+'"><div class="'+o.prefix+'container"><div class="'+o.prefix+'close">X</div><div class="'+o.prefix+'message">'+m+'</div><div class="'+o.prefix+'buttons" id="'+o.prefix+'buttons">';jQuery.each(o.buttons,function(k,v){msgbox+='<button name="'+o.prefix+'button'+k+'" id="'+o.prefix+'button'+k+'" value="'+v+'">'+k+'</button>'});msgbox+='</div></div></div></div>';var jqib=b.append(msgbox).children('#'+o.prefix+'box');var jqi=jqib.children('#'+o.prefix);var jqif=jqib.children('#'+o.prefix+'fade');var getWindowScrollOffset=function(){return(document.documentElement.scrollTop||document.body.scrollTop)+'px';};var getWindowSize=function(){var size={width:window.innerWidth||(window.document.documentElement.clientWidth||window.document.body.clientWidth),height:window.innerHeight||(window.document.documentElement.clientHeight||window.document.body.clientHeight)};return size;};var ie6scroll=function(){jqib.css({top:getWindowScrollOffset()});};var flashPrompt=function(){var i=0;jqib.addClass(o.prefix+'warning');var intervalid=setInterval(function(){jqib.toggleClass(o.prefix+'warning');if(i++>1){clearInterval(intervalid);jqib.removeClass(o.prefix+'warning');}},100);};var escapeKeyClosePrompt=function(e){var kC=(window.event)?event.keyCode:e.keyCode;var Esc=(window.event)?27:e.DOM_VK_ESCAPE;if(kC==Esc)removePrompt();};var positionPrompt=function(){var wsize=getWindowSize();jqib.css({position:(ie6)?"absolute":"fixed",height:wsize.height,width:"100%",top:(ie6)?getWindowScrollOffset():0,left:0,right:0,bottom:0});jqif.css({position:"absolute",height:wsize.height,width:"100%",top:0,left:0,right:0,bottom:0});jqi.css({position:"absolute",top:"25%",left:"50%",marginLeft:((((jqi.css("paddingLeft").split("px")[0]*1)+jqi.width())/2)*-1)});};var stylePrompt=function(){jqif.css({zIndex:o.zIndex,display:"none",opacity:o.opacity});jqi.css({zIndex:o.zIndex+1,display:"none"});}
var removePrompt=function(callCallback,clicked,msg){jqi.remove();if(ie6)b.unbind('scroll',ie6scroll);w.unbind('resize',positionPrompt);jqif.fadeOut(o.overlayspeed,function(){jqif.unbind('click',flashPrompt);jqif.remove();if(callCallback)o.callback(clicked,msg);jqib.unbind('keypress',escapeKeyClosePrompt);jqib.remove();if(ie6&&!o.useiframe)$('select').css('visibility','visible');});}
positionPrompt();stylePrompt();jQuery('#'+o.prefix+'buttons').children('button').click(function(){var msg=jqi.children('.'+o.prefix+'container').children('.'+o.prefix+'message');var clicked=o.buttons[jQuery(this).text()];if(o.submit(clicked,msg))
removePrompt(true,clicked,msg);});if(ie6)w.scroll(ie6scroll);jqif.click(flashPrompt);w.resize(positionPrompt);jqib.keypress(escapeKeyClosePrompt);jqi.find('.'+o.prefix+'close').click(removePrompt);jqif.fadeIn(o.overlayspeed);jqi[o.show](o.promptspeed,o.loaded);jqi.find('#'+o.prefix+'buttons button:eq('+o.focus+')').focus();return jqib;}});;(function($){$.fn.hint=function(blurClass){if(!blurClass)blurClass='blur';return this.each(function(){var $$=$(this);var title=$$.attr('title');if(title){$$.blur(function(){if($$.val()==''){$$.val(title).addClass(blurClass);}}).focus(function(){if($$.val()==title&&$$.hasClass(blurClass)){$$.val('').removeClass(blurClass);}}).parents('form:first').submit(function(){if($$.val()==title&&$$.hasClass(blurClass)){$$.val('').removeClass(blurClass);}}).end().blur();if($.browser.mozilla&&!$$.attr('autocomplete')){setTimeout(function(){if($$.val()==title)$$.val('');$$.blur();},10);}}});};})(jQuery);;(function($){$.extend({manageAjax:function(o){o=$.extend({manageType:'normal',maxReq:0,blockSameRequest:false,global:true},o);return new $.ajaxManager(o);},ajaxManager:function(o){this.opt=o;this.queue=[];}});$.extend($.ajaxManager.prototype,{add:function(o){var quLen=this.queue.length,s=this.opt,q=this.queue,self=this,i,j;var cD=(o.data&&typeof o.data!="string")?$.param(o.data):o.data;if(s.blockSameRequest){var toPrevent=false;for(i=0;i<quLen;i++){if(q[i]&&q[i].data===cD&&q[i].url===o.url&&q[i].type===o.type){toPrevent=true;break;}}
if(toPrevent){return false;}}
q[quLen]={fnError:o.error,fnSuccess:o.success,fnComplete:o.complete,fnAbort:o.abort,error:[],success:[],complete:[],done:false,queued:false,data:cD,url:o.url,type:o.type,xhr:null};o.error=function(){if(q[quLen]){q[quLen].error=arguments;}};o.success=function(){if(q[quLen]){q[quLen].success=arguments;}};o.abort=function(){if(q[quLen]){q[quLen].abort=arguments;}};function startCallbacks(num){if(q[num].fnError){q[num].fnError.apply($,q[num].error);}
if(q[num].fnSuccess){q[num].fnSuccess.apply($,q[num].success);}
if(q[num]&&q[num].fnComplete){q[num].fnComplete.apply($,q[num].complete);}
self.abort(num,true);}
o.complete=function(){if(!q[quLen]){return;}
q[quLen].complete=arguments;q[quLen].done=true;switch(s.manageType){case'sync':if(quLen===0||!q[quLen-1]){var curQLen=q.length;for(i=quLen;i<curQLen;i++){if(q[i]){if(q[i].done){startCallbacks(i);}
else{break;}}}}
break;case'queue':startCallbacks(quLen);if(quLen===0||!q[quLen-1]){var curQLen=q.length;for(i=0,j=0;i<curQLen;i++){if(q[i]&&q[i].queued){q[i].xhr=jQuery.ajax(q[i].xhr);q[i].queued=false;break;}}}
break;case'abortOld':startCallbacks(quLen);for(i=quLen;i>=0;i--){if(q[i]){self.abort(i);}}
break;default:startCallbacks(quLen);break;}};if(s.maxReq){if(s.manageType!='queue'){for(i=quLen,j=0;i>=0;i--){if(j>=s.maxReq){this.abort(i);}
if(q[i]){j++;}}}
else{for(i=0,j=0;i<=quLen&&!q[quLen].queued;i++){if(q[i]&&!q[i].queued)
j++;if(j>s.maxReq)
q[quLen].queued=true;}}}
q[quLen].xhr=(q[quLen].queued)?o:jQuery.ajax(o);return quLen;},cleanUp:function(){this.queue=[];},abort:function(num,completed){var qLen=this.queue.length,s=this.opt,q=this.queue,self=this,i;function del(num){if(!q[num]){return;}
(!completed&&q[num].fnAbort)&&q[num].fnAbort.apply($,[num]);if(!q[num]){return;}
if(q[num].xhr){if(typeof q[num].xhr.abort!='undefined'){q[num].xhr.abort();}
if(typeof q[num].xhr.close!='undefined'){q[num].xhr.close();}
q[num].xhr=null;}
if(s.global&&$.active&&!--$.active){$.event.trigger("ajaxStop");}
q[num]=null;}
if(!num&&num!==0){for(i=0;i<qLen;i++){del(i);}
this.cleanUp();}
else{del(num);var allowCleaning=true;for(i=qLen;i>=0;i--){if(q[i]){allowCleaning=false;break;}}
if(allowCleaning){this.cleanUp();}}}});})(jQuery);;var humanMsg={setup:function(appendTo,logName,msgOpacity){humanMsg.msgID='humanMsg';if(appendTo==undefined)
appendTo='body';humanMsg.msgOpacity=.8;if(msgOpacity!=undefined)
humanMsg.msgOpacity=parseFloat(msgOpacity);jQuery(appendTo).append('<div id="'+humanMsg.msgID+'" class="humanMsg"><p></p></div>')},displayMsg:function(msg,timeout){if(msg=='')return;if(timeout==undefined)timeout=true;jQuery('#'+humanMsg.msgID).hide().queue("fx",[]).stop();clearTimeout(humanMsg.t1);clearTimeout(humanMsg.t2);jQuery('#'+humanMsg.msgID+' p').html(msg);jQuery('#'+humanMsg.msgID).show().animate({opacity:humanMsg.msgOpacity},100);if(timeout){humanMsg.t1=setTimeout("humanMsg.bindEvents()",1500);humanMsg.t2=setTimeout("humanMsg.removeMsg()",4000);}},bindEvents:function(){jQuery(window).mousemove(humanMsg.removeMsg).click(humanMsg.removeMsg).keypress(humanMsg.removeMsg);},removeMsg:function(){jQuery(window).unbind('mousemove',humanMsg.removeMsg).unbind('click',humanMsg.removeMsg).unbind('keypress',humanMsg.removeMsg);if(jQuery('#'+humanMsg.msgID).css('opacity')==humanMsg.msgOpacity){jQuery('#'+humanMsg.msgID).fadeOut('fast');}else{jQuery('#'+humanMsg.msgID).hide();}}};jQuery(document).ready(function(){humanMsg.setup();});(function($){$.fn.jcarousel=function(o){return this.each(function(){new $jc(this,o);});};var defaults={vertical:false,start:1,offset:1,size:null,scroll:3,visible:null,animation:'normal',easing:'swing',auto:0,wrap:null,initCallback:null,reloadCallback:null,itemLoadCallback:null,itemFirstInCallback:null,itemFirstOutCallback:null,itemLastInCallback:null,itemLastOutCallback:null,itemVisibleInCallback:null,itemVisibleOutCallback:null,buttonNextHTML:'<div></div>',buttonPrevHTML:'<div></div>',buttonNextEvent:'click',buttonPrevEvent:'click',buttonNextCallback:null,buttonPrevCallback:null};$.jcarousel=function(e,o){this.options=$.extend({},defaults,o||{});this.locked=false;this.container=null;this.clip=null;this.list=null;this.buttonNext=null;this.buttonPrev=null;this.wh=!this.options.vertical?'width':'height';this.lt=!this.options.vertical?'left':'top';var skin='',split=e.className.split(' ');for(var i=0;i<split.length;i++){if(split[i].indexOf('jcarousel-skin')!=-1){$(e).removeClass(split[i]);var skin=split[i];break;}}
if(e.nodeName=='UL'||e.nodeName=='OL'){this.list=$(e);this.container=this.list.parent();if(this.container.hasClass('jcarousel-clip')){if(!this.container.parent().hasClass('jcarousel-container'))
this.container=this.container.wrap('<div></div>');this.container=this.container.parent();}else if(!this.container.hasClass('jcarousel-container'))
this.container=this.list.wrap('<div></div>').parent();}else{this.container=$(e);this.list=$(e).find('>ul,>ol,div>ul,div>ol');}
if(skin!=''&&this.container.parent()[0].className.indexOf('jcarousel-skin')==-1)
this.container.wrap('<div class=" '+skin+'"></div>');this.clip=this.list.parent();if(!this.clip.length||!this.clip.hasClass('jcarousel-clip'))
this.clip=this.list.wrap('<div></div>').parent();this.buttonPrev=$('.jcarousel-prev',this.container);if(this.buttonPrev.size()==0&&this.options.buttonPrevHTML!=null)
this.buttonPrev=this.clip.before(this.options.buttonPrevHTML).prev();this.buttonPrev.addClass(this.className('jcarousel-prev'));this.buttonNext=$('.jcarousel-next',this.container);if(this.buttonNext.size()==0&&this.options.buttonNextHTML!=null)
this.buttonNext=this.clip.before(this.options.buttonNextHTML).prev();this.buttonNext.addClass(this.className('jcarousel-next'));this.clip.addClass(this.className('jcarousel-clip'));this.list.addClass(this.className('jcarousel-list'));this.container.addClass(this.className('jcarousel-container'));var di=this.options.visible!=null?Math.ceil(this.clipping()/this.options.visible):null;var li=this.list.children('li');var self=this;if(li.size()>0){var wh=0,i=this.options.offset;li.each(function(){self.format(this,i++);wh+=self.dimension(this,di);});this.list.css(this.wh,wh+'px');if(!o||o.size===undefined)
this.options.size=li.size();}
this.container.css('display','block');this.buttonNext.css('display','block');this.buttonPrev.css('display','block');this.funcNext=function(){self.next();};this.funcPrev=function(){self.prev();};this.funcResize=function(){self.reload();};if(this.options.initCallback!=null)
this.options.initCallback(this,'init');if($.browser.safari){this.buttons(false,false);$(window).bind('load',function(){self.setup();});}else
this.setup();};var $jc=$.jcarousel;$jc.fn=$jc.prototype={jcarousel:'0.2.3'};$jc.fn.extend=$jc.extend=$.extend;$jc.fn.extend({setup:function(){this.first=null;this.last=null;this.prevFirst=null;this.prevLast=null;this.animating=false;this.timer=null;this.tail=null;this.inTail=false;if(this.locked)
return;this.list.css(this.lt,this.pos(this.options.offset)+'px');var p=this.pos(this.options.start);this.prevFirst=this.prevLast=null;this.animate(p,false);$(window).unbind('resize',this.funcResize).bind('resize',this.funcResize);},reset:function(){this.list.empty();this.list.css(this.lt,'0px');this.list.css(this.wh,'10px');if(this.options.initCallback!=null)
this.options.initCallback(this,'reset');this.setup();},reload:function(){if(this.tail!=null&&this.inTail)
this.list.css(this.lt,$jc.intval(this.list.css(this.lt))+this.tail);this.tail=null;this.inTail=false;if(this.options.reloadCallback!=null)
this.options.reloadCallback(this);if(this.options.visible!=null){var self=this;var di=Math.ceil(this.clipping()/this.options.visible),wh=0,lt=0;$('li',this.list).each(function(i){wh+=self.dimension(this,di);if(i+1<self.first)
lt=wh;});this.list.css(this.wh,wh+'px');this.list.css(this.lt,-lt+'px');}
this.scroll(this.first,false);},lock:function(){this.locked=true;this.buttons();},unlock:function(){this.locked=false;this.buttons();},size:function(s){if(s!=undefined){this.options.size=s;if(!this.locked)
this.buttons();}
return this.options.size;},has:function(i,i2){if(i2==undefined||!i2)
i2=i;if(this.options.size!==null&&i2>this.options.size)
i2=this.options.size;for(var j=i;j<=i2;j++){var e=this.get(j);if(!e.length||e.hasClass('jcarousel-item-placeholder'))
return false;}
return true;},get:function(i){return $('.jcarousel-item-'+i,this.list);},add:function(i,s){var e=this.get(i),old=0,add=0;if(e.length==0){var c,e=this.create(i),j=$jc.intval(i);while(c=this.get(--j)){if(j<=0||c.length){j<=0?this.list.prepend(e):c.after(e);break;}}}else
old=this.dimension(e);e.removeClass(this.className('jcarousel-item-placeholder'));typeof s=='string'?e.html(s):e.empty().append(s);var di=this.options.visible!=null?Math.ceil(this.clipping()/this.options.visible):null;var wh=this.dimension(e,di)-old;if(i>0&&i<this.first)
this.list.css(this.lt,$jc.intval(this.list.css(this.lt))-wh+'px');this.list.css(this.wh,$jc.intval(this.list.css(this.wh))+wh+'px');return e;},remove:function(i){var e=this.get(i);if(!e.length||(i>=this.first&&i<=this.last))
return;var d=this.dimension(e);if(i<this.first)
this.list.css(this.lt,$jc.intval(this.list.css(this.lt))+d+'px');e.remove();this.list.css(this.wh,$jc.intval(this.list.css(this.wh))-d+'px');},next:function(){this.stopAuto();if(this.tail!=null&&!this.inTail)
this.scrollTail(false);else
this.scroll(((this.options.wrap=='both'||this.options.wrap=='last')&&this.options.size!=null&&this.last==this.options.size)?1:this.first+this.options.scroll);},prev:function(){this.stopAuto();if(this.tail!=null&&this.inTail)
this.scrollTail(true);else
this.scroll(((this.options.wrap=='both'||this.options.wrap=='first')&&this.options.size!=null&&this.first==1)?this.options.size:this.first-this.options.scroll);},scrollTail:function(b){if(this.locked||this.animating||!this.tail)
return;var pos=$jc.intval(this.list.css(this.lt));!b?pos-=this.tail:pos+=this.tail;this.inTail=!b;this.prevFirst=this.first;this.prevLast=this.last;this.animate(pos);},scroll:function(i,a){if(this.locked||this.animating)
return;this.animate(this.pos(i),a);},pos:function(i){if(this.locked||this.animating)
return;if(this.options.wrap!='circular')
i=i<1?1:(this.options.size&&i>this.options.size?this.options.size:i);var back=this.first>i;var pos=$jc.intval(this.list.css(this.lt));var f=this.options.wrap!='circular'&&this.first<=1?1:this.first;var c=back?this.get(f):this.get(this.last);var j=back?f:f-1;var e=null,l=0,p=false,d=0;while(back?--j>=i:++j<i){e=this.get(j);p=!e.length;if(e.length==0){e=this.create(j).addClass(this.className('jcarousel-item-placeholder'));c[back?'before':'after'](e);}
c=e;d=this.dimension(e);if(p)
l+=d;if(this.first!=null&&(this.options.wrap=='circular'||(j>=1&&(this.options.size==null||j<=this.options.size))))
pos=back?pos+d:pos-d;}
var clipping=this.clipping();var cache=[];var visible=0,j=i,v=0;var c=this.get(i-1);while(++visible){e=this.get(j);p=!e.length;if(e.length==0){e=this.create(j).addClass(this.className('jcarousel-item-placeholder'));c.length==0?this.list.prepend(e):c[back?'before':'after'](e);}
c=e;var d=this.dimension(e);if(d==0){return 0;}
if(this.options.wrap!='circular'&&this.options.size!==null&&j>this.options.size)
cache.push(e);else if(p)
l+=d;v+=d;if(v>=clipping)
break;j++;}
for(var x=0;x<cache.length;x++)
cache[x].remove();if(l>0){this.list.css(this.wh,this.dimension(this.list)+l+'px');if(back){pos-=l;this.list.css(this.lt,$jc.intval(this.list.css(this.lt))-l+'px');}}
var last=i+visible-1;if(this.options.wrap!='circular'&&this.options.size&&last>this.options.size)
last=this.options.size;if(j>last){visible=0,j=last,v=0;while(++visible){var e=this.get(j--);if(!e.length)
break;v+=this.dimension(e);if(v>=clipping)
break;}}
var first=last-visible+1;if(this.options.wrap!='circular'&&first<1)
first=1;if(this.inTail&&back){pos+=this.tail;this.inTail=false;}
this.tail=null;if(this.options.wrap!='circular'&&last==this.options.size&&(last-visible+1)>=1){var m=$jc.margin(this.get(last),!this.options.vertical?'marginRight':'marginBottom');if((v-m)>clipping)
this.tail=v-clipping-m;}
while(i-->first)
pos+=this.dimension(this.get(i));this.prevFirst=this.first;this.prevLast=this.last;this.first=first;this.last=last;return pos;},animate:function(p,a){if(this.locked||this.animating)
return;this.animating=true;var self=this;var scrolled=function(){self.animating=false;if(p==0)
self.list.css(self.lt,0);if(self.options.wrap=='both'||self.options.wrap=='last'||self.options.size==null||self.last<self.options.size)
self.startAuto();self.buttons();self.notify('onAfterAnimation');};this.notify('onBeforeAnimation');if(!this.options.animation||a==false){this.list.css(this.lt,p+'px');scrolled();}else{var o=!this.options.vertical?{'left':p}:{'top':p};this.list.animate(o,this.options.animation,this.options.easing,scrolled);}},startAuto:function(s){if(s!=undefined)
this.options.auto=s;if(this.options.auto==0)
return this.stopAuto();if(this.timer!=null)
return;var self=this;this.timer=setTimeout(function(){self.next();},this.options.auto*1000);},stopAuto:function(){if(this.timer==null)
return;clearTimeout(this.timer);this.timer=null;},buttons:function(n,p){if(n==undefined||n==null){var n=!this.locked&&this.options.size!==0&&((this.options.wrap&&this.options.wrap!='first')||this.options.size==null||this.last<this.options.size);if(!this.locked&&(!this.options.wrap||this.options.wrap=='first')&&this.options.size!=null&&this.last>=this.options.size)
n=this.tail!=null&&!this.inTail;}
if(p==undefined||p==null){var p=!this.locked&&this.options.size!==0&&((this.options.wrap&&this.options.wrap!='last')||this.first>1);if(!this.locked&&(!this.options.wrap||this.options.wrap=='last')&&this.options.size!=null&&this.first==1)
p=this.tail!=null&&this.inTail;}
var self=this;this.buttonNext[n?'bind':'unbind'](this.options.buttonNextEvent,this.funcNext)[n?'removeClass':'addClass'](this.className('jcarousel-next-disabled')).attr('disabled',n?false:true);this.buttonPrev[p?'bind':'unbind'](this.options.buttonPrevEvent,this.funcPrev)[p?'removeClass':'addClass'](this.className('jcarousel-prev-disabled')).attr('disabled',p?false:true);if(this.buttonNext.length>0&&(this.buttonNext[0].jcarouselstate==undefined||this.buttonNext[0].jcarouselstate!=n)&&this.options.buttonNextCallback!=null){this.buttonNext.each(function(){self.options.buttonNextCallback(self,this,n);});this.buttonNext[0].jcarouselstate=n;}
if(this.buttonPrev.length>0&&(this.buttonPrev[0].jcarouselstate==undefined||this.buttonPrev[0].jcarouselstate!=p)&&this.options.buttonPrevCallback!=null){this.buttonPrev.each(function(){self.options.buttonPrevCallback(self,this,p);});this.buttonPrev[0].jcarouselstate=p;}},notify:function(evt){var state=this.prevFirst==null?'init':(this.prevFirst<this.first?'next':'prev');this.callback('itemLoadCallback',evt,state);if(this.prevFirst!==this.first){this.callback('itemFirstInCallback',evt,state,this.first);this.callback('itemFirstOutCallback',evt,state,this.prevFirst);}
if(this.prevLast!==this.last){this.callback('itemLastInCallback',evt,state,this.last);this.callback('itemLastOutCallback',evt,state,this.prevLast);}
this.callback('itemVisibleInCallback',evt,state,this.first,this.last,this.prevFirst,this.prevLast);this.callback('itemVisibleOutCallback',evt,state,this.prevFirst,this.prevLast,this.first,this.last);},callback:function(cb,evt,state,i1,i2,i3,i4){if(this.options[cb]==undefined||(typeof this.options[cb]!='object'&&evt!='onAfterAnimation'))
return;var callback=typeof this.options[cb]=='object'?this.options[cb][evt]:this.options[cb];if(!$.isFunction(callback))
return;var self=this;if(i1===undefined)
callback(self,state,evt);else if(i2===undefined)
this.get(i1).each(function(){callback(self,this,i1,state,evt);});else{for(var i=i1;i<=i2;i++)
if(i!==null&&!(i>=i3&&i<=i4))
this.get(i).each(function(){callback(self,this,i,state,evt);});}},create:function(i){return this.format('<li></li>',i);},format:function(e,i){var $e=$(e).addClass(this.className('jcarousel-item')).addClass(this.className('jcarousel-item-'+i));$e.attr('jcarouselindex',i);return $e;},className:function(c){return c+' '+c+(!this.options.vertical?'-horizontal':'-vertical');},dimension:function(e,d){var el=e.jquery!=undefined?e[0]:e;var old=!this.options.vertical?el.offsetWidth+$jc.margin(el,'marginLeft')+$jc.margin(el,'marginRight'):el.offsetHeight+$jc.margin(el,'marginTop')+$jc.margin(el,'marginBottom');if(d==undefined||old==d)
return old;var w=!this.options.vertical?d-$jc.margin(el,'marginLeft')-$jc.margin(el,'marginRight'):d-$jc.margin(el,'marginTop')-$jc.margin(el,'marginBottom');$(el).css(this.wh,w+'px');return this.dimension(el);},clipping:function(){return!this.options.vertical?this.clip[0].offsetWidth-$jc.intval(this.clip.css('borderLeftWidth'))-$jc.intval(this.clip.css('borderRightWidth')):this.clip[0].offsetHeight-$jc.intval(this.clip.css('borderTopWidth'))-$jc.intval(this.clip.css('borderBottomWidth'));},index:function(i,s){if(s==undefined)
s=this.options.size;return Math.round((((i-1)/s)-Math.floor((i-1)/s))*s)+1;}});$jc.extend({defaults:function(d){return $.extend(defaults,d||{});},margin:function(e,p){if(!e)
return 0;var el=e.jquery!=undefined?e[0]:e;if(p=='marginRight'&&$.browser.safari){var old={'display':'block','float':'none','width':'auto'},oWidth,oWidth2;$.swap(el,old,function(){oWidth=el.offsetWidth;});old['marginRight']=0;$.swap(el,old,function(){oWidth2=el.offsetWidth;});return oWidth2-oWidth;}
return $jc.intval($.css(el,p));},intval:function(v){v=parseInt(v);return isNaN(v)?0:v;}});})(jQuery);;function $m(){var elements=new Array();for(var i=0;i<arguments.length;i++){var element=arguments[i];if(typeof element=='string')
element=document.getElementById(element);if(arguments.length==1)
return element;elements.push(element);}
return elements;}
function loadScript(src,callback){var script=document.createElement('script');script.type='text/javascript';script.src=src;if(callback){var evl=new Object();evl.handleEvent=function(e){callback();};script.addEventListener('load',evl,true);}
document.getElementsByTagName("head")[0].appendChild(script);return;}
function convertLatLonXY_Yahoo(point,level){var size=1<<(26-level);var pixel_per_degree=size/360.0;var pixel_per_radian=size/(2*Math.PI);var origin=new YCoordPoint(size/2,size/2);var answer=new YCoordPoint();answer.x=Math.floor(origin.x+point.lon*pixel_per_degree);var sin=Math.sin(point.lat*Math.PI/180.0);answer.y=Math.floor(origin.y+0.5*Math.log((1+sin)/(1-sin))*-pixel_per_radian);return answer;}
function loadStyle(href){var link=document.createElement('link');link.type='text/css';link.rel='stylesheet';link.href=href;document.getElementsByTagName("head")[0].appendChild(link);return;}
function getStyle(el,prop){var y;if(el.currentStyle)
y=el.currentStyle[prop];else if(window.getComputedStyle)
y=window.getComputedStyle(el,'').getPropertyValue(prop);return y;}
function lonToMetres(lon,lat){return lon*111200*Math.cos(lat*(Math.PI/180));}
function metresToLon(m,lat){return m/(111200*Math.cos(lat*(Math.PI/180)));}
function getDegreesFromGoogleZoomLevel(pixels,zoom)
{return(360*pixels)/(Math.pow(2,zoom+8));}
function getGoogleZoomLevelFromDegrees(pixels,degrees)
{return logN((360*pixels)/degrees,2)-8;}
function logN(number,base)
{return Math.log(number)/Math.log(base);}
function Mapstraction(element,api,debug){this.api=api;this.maps=new Object();this.currentElement=$m(element);this.eventListeners=new Array();this.markers=new Array();this.layers=new Array();this.polylines=new Array();this.images=new Array();this.loaded=new Object();this.onload=new Object();if(debug==true)
{this.debug=true}
else
{this.debug=false}
this.svn_revision_string='$Revision: 173 $';this.addControlsArgs=new Object();if(this.currentElement)
{this.addAPI($m(element),api);}}
Mapstraction.prototype.swap=function(element,api){if(this.api==api){return;}
var center=this.getCenter();var zoom=this.getZoom();this.currentElement.style.visibility='hidden';this.currentElement.style.display='none';this.currentElement=$m(element);this.currentElement.style.visibility='visible';this.currentElement.style.display='block';this.api=api;if(this.maps[this.api]==undefined){this.addAPI($m(element),api);this.setCenterAndZoom(center,zoom);for(var i=0;i<this.markers.length;i++){this.addMarker(this.markers[i],true);}
for(var i=0;i<this.polylines.length;i++){this.addPolyline(this.polylines[i],true);}}else{this.setCenterAndZoom(center,zoom);}
this.addControls(this.addControlsArgs);}
Mapstraction.prototype.addAPI=function(element,api){me=this;this.loaded[api]=false;this.onload[api]=new Array();switch(api){case'yahoo':if(YMap){this.maps[api]=new YMap(element);YEvent.Capture(this.maps[api],EventsList.MouseClick,function(event,location){me.clickHandler(location.Lat,location.Lon,location,me)});YEvent.Capture(this.maps[api],EventsList.changeZoom,function(){me.moveendHandler(me)});YEvent.Capture(this.maps[api],EventsList.endPan,function(){me.moveendHandler(me)});this.loaded[api]=true;}
else{alert('Yahoo map script not imported');}
break;case'google':if(GMap2){if(GBrowserIsCompatible()){this.maps[api]=new GMap2(element);GEvent.addListener(this.maps[api],'click',function(marker,location){if(location){me.clickHandler(location.y,location.x,location,me);}});GEvent.addListener(this.maps[api],'moveend',function(){me.moveendHandler(me)});this.loaded[api]=true;}
else{alert('browser not compatible with Google Maps');}}
else{alert('Google map script not imported');}
break;case'microsoft':if(VEMap){element.style.position='relative';var msft_width=parseFloat(getStyle($m(element),'width'));var msft_height=parseFloat(getStyle($m(element),'height'));var ffv=0;var ffn="Firefox/";var ffp=navigator.userAgent.indexOf(ffn);if(ffp!=-1)ffv=parseFloat(navigator.userAgent.substring(ffp+ffn.length));if(ffv>=1.5){Msn.Drawing.Graphic.CreateGraphic=function(f,b){return new Msn.Drawing.SVGGraphic(f,b)}}
this.maps[api]=new VEMap(element.id);this.maps[api].LoadMap();this.maps[api].AttachEvent("onclick",function(e){me.clickHandler(e.view.LatLong.Latitude,e.view.LatLong.Longitude,me);});this.maps[api].AttachEvent("onchangeview",function(e){me.moveendHandler(me)});this.resizeTo(msft_width,msft_height);this.loaded[api]=true;}
else{alert('Virtual Earth script not imported');}
break;case'openlayers':this.maps[api]=new OpenLayers.Map(element.id,{maxExtent:new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),maxResolution:156543,numZoomLevels:18,units:'meters',projection:"EPSG:41001"});this.layers['osmmapnik']=new OpenLayers.Layer.TMS('OSM Mapnik',["http://a.tile.openstreetmap.org/","http://b.tile.openstreetmap.org/","http://c.tile.openstreetmap.org/"],{type:'png',getURL:function(bounds){var res=this.map.getResolution();var x=Math.round((bounds.left-this.maxExtent.left)/(res*this.tileSize.w));var y=Math.round((this.maxExtent.top-bounds.top)/(res*this.tileSize.h));var z=this.map.getZoom();var limit=Math.pow(2,z);if(y<0||y>=limit){return null;}else{x=((x%limit)+limit)%limit;var path=z+"/"+x+"/"+y+"."+this.type;var url=this.url;if(url instanceof Array){url=this.selectUrl(path,url);}
return url+path;}},displayOutsideMaxExtent:true});this.layers['osm']=new OpenLayers.Layer.TMS('OSM',["http://a.tah.openstreetmap.org/Tiles/tile.php/","http://b.tah.openstreetmap.org/Tiles/tile.php/","http://c.tah.openstreetmap.org/Tiles/tile.php/"],{type:'png',getURL:function(bounds){var res=this.map.getResolution();var x=Math.round((bounds.left-this.maxExtent.left)/(res*this.tileSize.w));var y=Math.round((this.maxExtent.top-bounds.top)/(res*this.tileSize.h));var z=this.map.getZoom();var limit=Math.pow(2,z);if(y<0||y>=limit){return null;}else{x=((x%limit)+limit)%limit;var path=z+"/"+x+"/"+y+"."+this.type;var url=this.url;if(url instanceof Array){url=this.selectUrl(path,url);}
return url+path;}},displayOutsideMaxExtent:true});this.maps[api].addLayer(this.layers['osmmapnik']);this.maps[api].addLayer(this.layers['osm']);this.loaded[api]=true;break;case'openstreetmap':if(GMap2){if(GBrowserIsCompatible()){this.maps[api]=new GMap2(element);GEvent.addListener(this.maps[api],'click',function(marker,location){if(location){me.clickHandler(location.y,location.x,location,me);}});GEvent.addListener(this.maps[api],'moveend',function(){me.moveendHandler(me)});var copyright=new GCopyright(1,new GLatLngBounds(new GLatLng(-90,-180),new GLatLng(90,180)),0,"copyleft");var copyrightCollection=new GCopyrightCollection('OSM');copyrightCollection.addCopyright(copyright);var tilelayers=new Array();tilelayers[0]=new GTileLayer(copyrightCollection,1,18);tilelayers[0].getTileUrl=function(a,b){return"http://tile.openstreetmap.org/"+b+"/"+a.x+"/"+a.y+".png";};tilelayers[0].isPng=function(){return true;};tilelayers[0].getOpacity=function(){return 1.0;}
var custommap=new GMapType(tilelayers,new GMercatorProjection(19),"OSM",{errorMessage:"More OSM coming soon"});this.maps[api].addMapType(custommap);this.loaded[api]=true;var myPoint=new LatLonPoint(50.6805,-1.4062505);this.setCenterAndZoom(myPoint,11);this.maps[api].setMapType(custommap);}
else{alert('browser not compatible with Google Maps');}}
else{alert('Google map script not imported');}
break;case'multimap':this.maps[api]=new MultimapViewer(element);this.maps[api].addEventHandler('click',function(eventType,eventTarget,arg1,arg2,arg3){if(arg1){me.clickHandler(arg1.lat,arg1.lon,me);}});this.maps[api].addEventHandler('changeZoom',function(eventType,eventTarget,arg1,arg2,arg3){me.moveendHandler(me);});this.maps[api].addEventHandler('endPan',function(eventType,eventTarget,arg1,arg2,arg3){me.moveendHandler(me);});this.loaded[api]=true;break;case'map24':if(Map24){Map24.loadApi(["core_api","wrapper_api"],function(){Map24.MapApplication.init
({NodeName:element.id,MapType:"Static"});me.maps[api]=Map24.MapApplication.Map;Map24.MapApplication.Map.addListener('Map24.Event.MapClick',function(e){me.clickHandler(e.Coordinate.Latitude/60,e.Coordinate.Longitude/60,me);e.stop();});Map24.MapApplication.Map.addListener("MapPanStop",function(e){me.moveendHandler(me);});var client=Map24.MapApplication.Map.MapClient['Static'];me.loaded[api]=true;for(var i=0;i<me.onload[api].length;i++){me.onload[api][i]();}},"2.0.1247");}else{alert('map24 api not loaded');}
break;case'mapquest':myself=this;MQInitOverlays(function(){myself.loaded[api]=true;myself.maps[api]=new MQTileMap(element);for(var i=0;i<myself.onload[api].length;i++){myself.onload[api][i]();}});break;case'freeearth':this.maps[api]=new FE.Map($m(element));myself=this;this.maps[api].onLoad=function(){myself.freeEarthLoaded=true;myself.loaded[api]=true;for(var i=0;i<myself.onload[api].length;i++){myself.onload[api][i]();}}
this.maps[api].load();break;default:if(this.debug)
alert(api+' not supported by mapstraction');}}
Mapstraction._getScriptLocation=function(){var scriptLocation="";var SCRIPT_NAME="mapstraction.js";var scripts=document.getElementsByTagName('script');for(var i=0;i<scripts.length;i++){var src=scripts[i].getAttribute('src');if(src){var index=src.lastIndexOf(SCRIPT_NAME);if((index>-1)&&(index+SCRIPT_NAME.length==src.length)){scriptLocation=src.slice(0,-SCRIPT_NAME.length);break;}}}
return scriptLocation;}
Mapstraction.writeInclude=function(api,key,version){var jsfiles=new Array();var allScriptTags="";var host=Mapstraction._getScriptLocation()+"lib/";switch(api){case'google':if(version==null){version="2";}
jsfiles.push('http://maps.google.com/maps?file=api&v='+version+'&key='+key);break;case"microsoft":if(version==null){version="v3";}
jsfiles.push('http://dev.virtualearth.net/mapcontrol/'+version+'/mapcontrol.js');break;case"yahoo":if(version==null){version="3.0";}
jsfiles.push('http://api.maps.yahoo.com/ajaxymap?v='+version+'&appid='+key);break;case"openlayers":jsfiles.push('http://openlayers.org/api/OpenLayers.js');break;case"multimap":if(version==null){version="1.2";}
jsfiles.push('http://developer.multimap.com/API/maps/'+version+'/'+key);break;case"map24":jsfiles.push('http://api.maptp.map24.com/ajax?appkey='+key);break;case"mapquest":if(version==null){version="5.1";}
jsfiles.push('http://btilelog.access.mapquest.com/tilelog/transaction?transaction=script&key='+key+'&ipr=true&itk=true&v='+version);jsfiles.push('mapquest-js/mqcommon.js');jsfiles.push('mapquest-js/mqutils.js');jsfiles.push('mapquest-js/mqobjects.js');jsfiles.push('mapquest-js/mqexec.js');break;case"freeearth":jsfiles.push('http://freeearth.poly9.com/api.js');}
for(var i=0;i<jsfiles.length;i++){if(/MSIE/.test(navigator.userAgent)||/Safari/.test(navigator.userAgent)){var currentScriptTag=jsfiles[i];allScriptTags+=currentScriptTag;}else{var s=document.createElement("script");s.src=jsfiles[i];s.type="text/javascript";var h=document.getElementsByTagName("head").length?document.getElementsByTagName("head")[0]:document.body;h.appendChild(s);}}
if(allScriptTags)document.write(allScriptTags);}
Mapstraction.prototype.isLoaded=function(api){if(api==null)
api=this.api;return this.loaded[api];}
Mapstraction.prototype.setDebug=function(debug){if(debug!=null)
return this.debug=debug;else
return this.debug;}
Mapstraction.prototype.resizeTo=function(width,height){if(this.loaded[this.api]==false){myself=this;this.onload[this.api].push(function(){myself.resizeTo(width,height);});return;}
switch(this.api){case'yahoo':this.maps[this.api].resizeTo(new YSize(width,height));break;case'google':case'openstreetmap':this.currentElement.style.width=width;this.currentElement.style.height=height;this.maps[this.api].checkResize();break;case'openlayers':this.currentElement.style.width=width;this.currentElement.style.height=height;this.maps[this.api].updateSize();break;case'microsoft':this.maps[this.api].Resize(width,height);break;case'multimap':this.currentElement.style.width=width;this.currentElement.style.height=height;this.maps[this.api].resize();break;case'mapquest':this.currentElement.style.width=width;this.currentElement.style.height=height;this.maps[this.api].setSize(new MQSize(width,height));break;case'map24':Map24.MapApplication.Map.Canvas['c'].resizeTo(width,height);break;}}
Mapstraction.prototype.clickHandler=function(lat,lon,me){for(var i=0;i<this.eventListeners.length;i++){if(this.eventListeners[i][1]=='click'){this.eventListeners[i][0](new LatLonPoint(lat,lon));}}}
Mapstraction.prototype.moveendHandler=function(me){for(var i=0;i<this.eventListeners.length;i++){if(this.eventListeners[i][1]=='moveend'){this.eventListeners[i][0]();}}}
Mapstraction.prototype.addEventListener=function(type,func){var listener=new Array();listener.push(func);listener.push(type);this.eventListeners.push(listener);switch(this.api){case'openlayers':this.maps[this.api].events.register(type,this,func);break;}}
Mapstraction.prototype.addControls=function(args){if(this.loaded[this.api]==false){myself=this;this.onload[this.api].push(function(){myself.addControls(args);});return;}
var map=this.maps[this.api];this.addControlsArgs=args;switch(this.api){case'google':case'openstreetmap':if(this.controls){while(ctl=this.controls.pop()){map.removeControl(ctl);}}else{this.controls=new Array();}
c=this.controls;if(args.zoom||args.pan){if(args.zoom=='large'){c.unshift(new GLargeMapControl());map.addControl(c[0]);}else{c.unshift(new GSmallMapControl());map.addControl(c[0]);}}
if(args.scale){c.unshift(new GScaleControl());map.addControl(c[0]);}
if(this.api!="openstreetmap"){if(args.overview){c.unshift(new GOverviewMapControl());map.addControl(c[0]);}
if(args.map_type){c.unshift(new GMapTypeControl());map.addControl(c[0]);}}
break;case'yahoo':if(args.pan)map.addPanControl();else map.removePanControl();if(args.zoom=='large')map.addZoomLong();else if(args.zoom=='small')map.addZoomShort();else map.removeZoomScale();break;case'openlayers':for(var i=map.controls.length;i>1;i--){map.controls[i-1].deactivate();map.removeControl(map.controls[i-1]);}
if(args.pan){map.addControl(new OpenLayers.Control.PanZoomBar());}
else{}
if(args.zoom=='large'){map.addControl(new OpenLayers.Control.PanZoomBar());}
else if(args.zoom=='small'){map.addControl(new OpenLayers.Control.ZoomBox());}
else map.addControl(new OpenLayers.Control.ZoomBox());if(args.overview){map.addControl(new OpenLayers.Control.OverviewMap());}
if(args.map_type){map.addControl(new OpenLayers.Control.LayerSwitcher());}
break;case'multimap':pan_zoom_widget="MM";if(args.zoom&&args.zoom=="small"){pan_zoom_widget=pan_zoom_widget+"Small";}
if(args.pan){pan_zoom_widget=pan_zoom_widget+"Pan";}
if(args.zoom){pan_zoom_widget=pan_zoom_widget+"Zoom";}
pan_zoom_widget=pan_zoom_widget+"Widget";if(pan_zoom_widget!="MMWidget"){eval(" map.addWidget( new "+pan_zoom_widget+"() );");}
if(args.map_type){map.addWidget(new MMMapTypeWidget());}
if(args.overview){map.addWidget(new MMOverviewWidget());}
break;case'mapquest':if(this.controls){while(ctl=this.controls.pop()){map.removeControl(ctl);}}else{this.controls=new Array();}
c=this.controls;if(args.pan){c.unshift(new MQPanControl());map.addControl(c[0],new MQMapCornerPlacement(MQMapCorner.TOP_LEFT,new MQSize(0,0)));}
if(args.zoom=='large'){c.unshift(new MQLargeZoomControl());map.addControl(c[0],new MQMapCornerPlacement(MQMapCorner.TOP_LEFT,new MQSize(0,0)));}
else if(args.zoom=='small'){c.unshift(new MQZoomControl());map.addControl(c[0],new MQMapCornerPlacement(MQMapCorner.BOTTOM_LEFT,new MQSize(0,0)));}
if(args.map_type){c.unshift(new MQViewControl());map.addControl(c[0],new MQMapCornerPlacement(MQMapCorner.TOP_RIGHT,new MQSize(0,0)));}
break;}}
Mapstraction.prototype.addSmallControls=function(){if(this.loaded[this.api]==false){myself=this;this.onload[this.api].push(function(){myself.addSmallControls();});return;}
var map=this.maps[this.api];switch(this.api){case'yahoo':map.addPanControl();map.addZoomShort();this.addControlsArgs.pan=true;this.addControlsArgs.zoom='small';break;case'google':case'openstreetmap':map.addControl(new GSmallMapControl());this.addControlsArgs.zoom='small';break;case'openlayers':map.addControl(new OpenLayers.Control.ZoomBox());map.addControl(new OpenLayers.Control.LayerSwitcher({'ascending':false}));break;case'multimap':smallPanzoomWidget=new MMSmallPanZoomWidget();map.addWidget(smallPanzoomWidget);this.addControlsArgs.pan=true;this.addControlsArgs.zoom='small';break;case'mapquest':map.addControl(new MQZoomControl(map));map.addControl(new PanControl(map));this.addControlsArgs.pan=true;this.addControlsArgs.zoom='small';break;}}
Mapstraction.prototype.addLargeControls=function(){if(this.loaded[this.api]==false){myself=this;this.onload[this.api].push(function(){myself.addLargeControls();});return;}
var map=this.maps[this.api];switch(this.api){case'yahoo':map.addPanControl();map.addZoomLong();this.addControlsArgs.pan=true;this.addControlsArgs.zoom='large';break;case'openlayers':map.addControl(new OpenLayers.Control.PanZoomBar());break;case'google':map.addControl(new GMapTypeControl());map.addControl(new GOverviewMapControl());this.addControlsArgs.overview=true;this.addControlsArgs.map_type=true;case'openstreetmap':map.addControl(new GLargeMapControl());map.addControl(new GScaleControl());this.addControlsArgs.pan=true;this.addControlsArgs.zoom='large';this.addControlsArgs.scale=true;break;case'multimap':panzoomWidget=new MMPanZoomWidget();map.addWidget(panzoomWidget);this.addControlsArgs.pan=true;this.addControlsArgs.zoom='large';break;case'mapquest':map.addControl(new MQLargeZoomControl(map));map.addControl(new PanControl(map));map.addControl(new MQViewControl(map));this.addControlsArgs.pan=true;this.addControlsArgs.zoom='large';this.addControlsArgs.map_type=true;break;}}
Mapstraction.prototype.addMapTypeControls=function(){if(this.loaded[this.api]==false){myself=this;this.onload[this.api].push(function(){myself.addMapTypeControls();});return;}
var map=this.maps[this.api];switch(this.api){case'yahoo':map.addTypeControl();break;case'google':case'openstreetmap':map.addControl(new GMapTypeControl());break;case'multimap':map.addWidget(new MMMapTypeWidget());break;case'mapquest':map.addControl(new MQViewControl(map));break;case'openlayers':map.addControl(new OpenLayers.Control.LayerSwitcher({'ascending':false}));break;}}
Mapstraction.prototype.dragging=function(on){if(this.loaded[this.api]==false){myself=this;this.onload[this.api].push(function(){myself.dragging(on);});return;}
var map=this.maps[this.api];switch(this.api){case'google':case'openstreetmap':if(on){map.enableDragging();}else{map.disableDragging();}
break;case'yahoo':if(on){map.enableDragMap();}else{map.disableDragMap();}
break;case'multimap':if(on){map.setOption("drag","dragmap");}else{map.setOption("drag","");}
break;case'mapquest':map.enableDragging(on);break;}}
Mapstraction.prototype.setCenterAndZoom=function(point,zoom){if(this.loaded[this.api]==false){myself=this;this.onload[this.api].push(function(){myself.setCenterAndZoom(point,zoom);});return;}
var map=this.maps[this.api];switch(this.api){case'yahoo':var yzoom=18-zoom;map.drawZoomAndCenter(point.toYahoo(),yzoom);break;case'google':case'openstreetmap':map.setCenter(point.toGoogle(),zoom);break;case'microsoft':map.SetCenterAndZoom(point.toMicrosoft(),zoom);break;case'openlayers':map.setCenter(point.toOpenLayers(),zoom);break;case'multimap':map.goToPosition(new MMLatLon(point.lat,point.lng));map.setZoomFactor(zoom);break;case'map24':var newSettings=new Object();newSettings.Latitude=point.lat*60;newSettings.Longitude=point.lon*60;var client=map.MapClient['Static'];var dLon=getDegreesFromGoogleZoomLevel
(client.getCanvasSize().Width,zoom);newSettings.MinimumWidth=lonToMetres(dLon,point.lat);Map24.MapApplication.center(newSettings);break;case'mapquest':map.setCenter(new MQLatLng(point.lat,point.lng),zoom-3);break;case'freeearth':if(this.freeEarthLoaded){map.setTargetLatLng(point.toFreeEarth());}else{myself=this;this.freeEarthOnLoad.push(function(){myself.setCenterAndZoom(point);});}
break;default:if(this.debug)
alert(this.api+' not supported by Mapstraction.setCenterAndZoom');}}
Mapstraction.prototype.addMarker=function(marker,old){var map=this.maps[this.api];marker.mapstraction=this;marker.api=this.api;marker.map=this.maps[this.api];if(this.loaded[this.api]==false){myself=this;this.onload[this.api].push(function(){myself.addMarker(marker,old);});return;}
switch(this.api){case'yahoo':var ypin=marker.toYahoo();marker.setChild(ypin);map.addOverlay(ypin);if(!old){this.markers.push(marker);}
break;case'google':case'openstreetmap':var gpin=marker.toGoogle();marker.setChild(gpin);map.addOverlay(gpin);if(!old){this.markers.push(marker);}
break;case'microsoft':var mpin=marker.toMicrosoft();marker.setChild(mpin);map.AddPushpin(mpin);if(!old){this.markers.push(marker);}
break;case'openlayers':if(!this.layers['markers'])
{this.layers['markers']=new OpenLayers.Layer.Markers("markers");map.addLayer(this.layers['markers']);}
var olmarker=marker.toOpenLayers();marker.setChild(olmarker);this.layers['markers'].addMarker(olmarker);if(!old){this.markers.push(marker);}
break;case'multimap':var mmpin=marker.toMultiMap();marker.setChild(mmpin);map.addOverlay(mmpin);if(!old){this.markers.push(marker);}
break;case'map24':var m24pin=marker.toMap24();marker.setChild(m24pin);m24pin.commit();if(!old){this.markers.push(marker);}
break;case'mapquest':var mqpin=marker.toMapQuest();marker.setChild(mqpin);map.addPoi(mqpin);if(!old){this.markers.push(marker);}
break;case'freeearth':var fepin=marker.toFreeEarth();marker.setChild(fepin);map.addOverlay(fepin);if(!old){this.markers.push(marker);}
break;default:if(this.debug)
alert(this.api+' not supported by Mapstraction.addMarker');}}
Mapstraction.prototype.addMarkerWithData=function(marker,data){marker.addData(data);this.addMarker(marker);}
Mapstraction.prototype.addPolylineWithData=function(polyline,data){polyline.addData(data);this.addPolyline(polyline);}
Mapstraction.prototype.removeMarker=function(marker){if(this.loaded[this.api]==false){myself=this;this.onload[this.api].push(function(){myself.removeMarker(marker);});return;}
var map=this.maps[this.api];var tmparray=new Array();while(this.markers.length>0){current_marker=this.markers.pop();if(marker==current_marker){switch(this.api){case'google':case'openstreetmap':map.removeOverlay(marker.proprietary_marker);break;case'yahoo':map.removeOverlay(marker.proprietary_marker);break;case'microsoft':map.DeletePushpin(marker.pinID);break;case'multimap':map.removeOverlay(marker.proprietary_marker);break;case'mapquest':map.removePoi(marker.proprietary_marker);break;case'map24':marker.proprietary_marker.remove();break;case'openlayers':this.layers['markers'].removeMarker(marker.proprietary_marker);marker.proprietary_marker.destroy();break;}
marker.onmap=false;break;}else{tmparray.push(current_marker);}}
this.markers=this.markers.concat(tmparray);}
Mapstraction.prototype.removeAllMarkers=function(){if(this.loaded[this.api]==false){myself=this;this.onload[this.api].push(function(){myself.removeAllMarkers();});return;}
var map=this.maps[this.api];switch(this.api){case'yahoo':map.removeMarkersAll();break;case'google':case'openstreetmap':map.clearOverlays();break;case'microsoft':map.DeleteAllPushpins();break;case'multimap':map.removeAllOverlays();break;case'mapquest':map.removeAllPois();break;case'map24':var current_marker;while(this.markers.length>0){current_marker=this.markers.pop();current_marker.proprietary_marker.remove();}
break;case'openlayers':this.layers['markers'].clearMarkers();break;default:if(this.debug)
alert(this.api+' not supported by Mapstraction.removeAllMarkers');}
this.markers=new Array();}
Mapstraction.prototype.addPolyline=function(polyline,old){if(this.loaded[this.api]==false){myself=this;this.onload[this.api].push(function(){myself.addPolyline(polyline,old);});return;}
var map=this.maps[this.api];switch(this.api){case'yahoo':ypolyline=polyline.toYahoo();polyline.setChild(ypolyline);map.addOverlay(ypolyline);if(!old){this.polylines.push(polyline);}
break;case'google':case'openstreetmap':gpolyline=polyline.toGoogle();polyline.setChild(gpolyline);map.addOverlay(gpolyline);if(!old){this.polylines.push(polyline);}
break;case'microsoft':mpolyline=polyline.toMicrosoft();polyline.setChild(mpolyline);map.AddPolyline(mpolyline);if(!old){this.polylines.push(polyline);}
break;case'openlayers':if(this.debug)
alert(this.api+' not supported by Mapstraction.addPolyline');break;case'multimap':mmpolyline=polyline.toMultiMap();polyline.setChild(mmpolyline);map.addOverlay(mmpolyline);if(!old){this.polylines.push(polyline);}
break;case'mapquest':mqpolyline=polyline.toMapQuest();polyline.setChild(mqpolyline);map.addOverlay(mqpolyline);if(!old){this.polylines.push(polyline);}
break;case'map24':var m24polyline=polyline.toMap24();polyline.setChild(m24polyline);m24polyline.commit();if(!old){this.polylines.push(polyline);}
break;default:if(this.debug)
alert(this.api+' not supported by Mapstraction.addPolyline');}}
Mapstraction.prototype.removePolyline=function(polyline){if(this.loaded[this.api]==false){myself=this;this.onload[this.api].push(function(){myself.removePolyline(polyline);});return;}
var map=this.maps[this.api];var tmparray=new Array();while(this.polylines.length>0){current_polyline=this.polylines.pop();if(polyline==current_polyline){switch(this.api){case'google':case'openstreetmap':map.removeOverlay(polyline.proprietary_polyline);break;case'yahoo':map.removeOverlay(polyline.proprietary_polyline);break;case'microsoft':map.DeletePolyline(polyline.pllID);break;case'multimap':polyline.proprietary_polyline.remove();break;case'mapquest':map.removeOverlay(polyline.proprietary_polyline);break;case'map24':polyline.proprietary_polyline.remove();break;}
polyline.onmap=false;break;}else{tmparray.push(current_polyline);}}
this.polylines=this.polylines.concat(tmparray);}
Mapstraction.prototype.removeAllPolylines=function(){if(this.loaded[this.api]==false){myself=this;this.onload[this.api].push(function(){myself.removeAllPolylines();});return;}
var map=this.maps[this.api];switch(this.api){case'yahoo':for(var i=0,length=this.polylines.length;i<length;i++){map.removeOverlay(this.polylines[i].proprietary_polyline);}
break;case'google':case'openstreetmap':for(var i=0,length=this.polylines.length;i<length;i++){map.removeOverlay(this.polylines[i].proprietary_polyline);}
break;case'microsoft':map.DeleteAllPolylines();break;case'multimap':for(var i=0,length=this.polylines.length;i<length;i++){this.polylines[i].proprietary_polyline.remove();}
break;case'mapquest':map.removeAllOverlays();break;case'map24':var current_polyline;while(this.polylines.length>0){current_polyline=this.polylines.pop();current_polyline.proprietary_polyline.remove();}
break;default:if(this.debug)
alert(this.api+' not supported by Mapstraction.removeAllPolylines');}
this.polylines=new Array();}
Mapstraction.prototype.getCenter=function(){if(this.loaded[this.api]==false){return null;}
var map=this.maps[this.api];var point=undefined;switch(this.api){case'yahoo':var pt=map.getCenterLatLon();point=new LatLonPoint(pt.Lat,pt.Lon);break;case'google':case'openstreetmap':var pt=map.getCenter();point=new LatLonPoint(pt.lat(),pt.lng());break;case'openlayers':var pt=map.getCenter();point=new LatLonPoint(pt.lat,pt.lon);break;case'microsoft':var pt=map.GetCenter();point=new LatLonPoint(pt.Latitude,pt.Longitude);break;case'multimap':var pt=map.getCurrentPosition();point=new LatLonPoint(pt.y,pt.x);break;case'mapquest':var pt=map.getCenter();point=new LatLonPoint(pt.getLatitude(),pt.getLongitude());break;case'map24':var pt=map.MapClient['Static'].getCurrentMapView().getCenter();point=new LatLonPoint(pt.Y/60,pt.X/60);break;default:if(this.debug)
alert(this.api+' not supported by Mapstraction.getCenter');}
return point;}
Mapstraction.prototype.setCenter=function(point){if(this.loaded[this.api]==false){myself=this;this.onload[this.api].push(function(){myself.setCenter(point);});return;}
var map=this.maps[this.api];switch(this.api){case'yahoo':map.panToLatLon(point.toYahoo());break;case'google':case'openstreetmap':map.setCenter(point.toGoogle());break;case'openlayers':map.setCenter(point.toOpenLayers());break;case'microsoft':map.SetCenter(point.toMicrosoft());break;case'multimap':map.goToPosition(point.toMultiMap());break;case'mapquest':map.setCenter(point.toMapQuest());break;case'freeearth':if(this.freeEarthLoaded){map.setTargetLatLng(point.toFreeEarth());}else{myself=this;this.freeEarthOnLoad.push(function(){myself.setCenterAndZoom(point);});}
break;case'map24':var mv=map.MapClient['Static'].getCurrentMapView();var newSettings=new Object();newSettings.MinimumWidth=lonToMetres
(mv.LowerRight.Longitude-mv.TopLeft.Longitude,(mv.LowerRight.Latitude+mv.TopLeft.Latitude)/2);newSettings.Latitude=point.lat*60;newSettings.Longitude=point.lon*60;Map24.MapApplication.center(newSettings);break;default:if(this.debug)
alert(this.api+' not supported by Mapstraction.setCenter');}}
Mapstraction.prototype.setZoom=function(zoom){if(this.loaded[this.api]==false){myself=this;this.onload[this.api].push(function(){myself.setZoom(zoom);});return;}
var map=this.maps[this.api];switch(this.api){case'yahoo':var yzoom=18-zoom;map.setZoomLevel(yzoom);break;case'google':case'openstreetmap':map.setZoom(zoom);break;case'openlayers':map.zoomTo(zoom);break;case'microsoft':map.SetZoomLevel(zoom);break;case'multimap':map.setZoomFactor(zoom);break;case'mapquest':map.setZoomLevel(zoom-3);break;case'map24':var point=this.getCenter();var newSettings=new Object();newSettings.Latitude=point.lat*60;newSettings.Longitude=point.lon*60;var client=map.MapClient['Static'];var dLon=getDegreesFromGoogleZoomLevel
(client.getCanvasSize().Width,zoom);newSettings.MinimumWidth=lonToMetres(dLon,point.lat);Map24.MapApplication.center(newSettings);break;default:if(this.debug)
alert(this.api+' not supported by Mapstraction.setZoom');}}
Mapstraction.prototype.autoCenterAndZoom=function(){if(this.loaded[this.api]==false){myself=this;this.onload[this.api].push(function(){myself.autoCenterAndZoom();});return;}
var lat_max=-90;var lat_min=90;var lon_max=-180;var lon_min=180;for(var i=0;i<this.markers.length;i++){;lat=this.markers[i].location.lat;lon=this.markers[i].location.lon;if(lat>lat_max)lat_max=lat;if(lat<lat_min)lat_min=lat;if(lon>lon_max)lon_max=lon;if(lon<lon_min)lon_min=lon;}
for(i=0;i<this.polylines.length;i++){for(j=0;j<this.polylines[i].points.length;j++){lat=this.polylines[i].points[j].lat;lon=this.polylines[i].points[j].lon;if(lat>lat_max)lat_max=lat;if(lat<lat_min)lat_min=lat;if(lon>lon_max)lon_max=lon;if(lon<lon_min)lon_min=lon;}}
this.setBounds(new BoundingBox(lat_min,lon_min,lat_max,lon_max));}
Mapstraction.prototype.centerAndZoomOnPoints=function(points){var bounds=new BoundingBox(points[0].lat,points[0].lon,points[0].lat,points[0].lon);for(var i=1,len=points.length;i<len;i++){bounds.extend(points[i]);}
this.setBounds(bounds);}
Mapstraction.prototype.getZoom=function(){if(this.loaded[this.api]==false){myself=this;return-1;}
var map=this.maps[this.api];switch(this.api){case'yahoo':return 18-map.getZoomLevel();case'google':case'openstreetmap':return map.getZoom();case'openlayers':return map.zoom;case'microsoft':return map.GetZoomLevel();case'multimap':return map.getZoomFactor();case'mapquest':return map.getZoomLevel()+3;case'map24':var mv=map.MapClient['Static'].getCurrentMapView();var dLon=(mv.LowerRight.Longitude-mv.TopLeft.Longitude)/60;var width=map.MapClient['Static'].getCanvasSize().Width;var zoom=getGoogleZoomLevelFromDegrees(width,dLon);return Math.round(zoom);default:if(this.debug)
alert(this.api+' not supported by Mapstraction.getZoom');}}
Mapstraction.prototype.getZoomLevelForBoundingBox=function(bbox){if(this.loaded[this.api]==false){myself=this;return-1;}
var map=this.maps[this.api];var ne=bbox.getNorthEast();var sw=bbox.getSouthWest();switch(this.api){case'google':case'openstreetmap':var gbox=new GLatLngBounds(sw.toGoogle(),ne.toGoogle());var zoom=map.getBoundsZoomLevel(gbox);return zoom;break;case'openlayers':var olbox=bbox.toOpenLayers();var zoom=map.getZoomForExtent(olbox);break;case'multimap':var mmlocation=map.getBoundsZoomFactor(sw.toMultiMap(),ne.toMultiMap());var zoom=mmlocation.zoom_factor();return zoom;break;case'map24':var dLon=ne.lon-sw.lon;var width=map.MapClient['Static'].getCanvasSize().Width;var zoom=getGoogleZoomLevelFromDegrees(width,dLon);return Math.round(zoom);break;default:if(this.debug)
alert(this.api+' not supported by Mapstraction.getZoomLevelForBoundingBox');}}
Mapstraction.ROAD=1;Mapstraction.SATELLITE=2;Mapstraction.HYBRID=3;Mapstraction.prototype.setMapType=function(type){if(this.loaded[this.api]==false){myself=this;this.onload[this.api].push(function(){myself.setMapType(type);});return;}
var map=this.maps[this.api];switch(this.api){case'yahoo':switch(type){case Mapstraction.ROAD:map.setMapType(YAHOO_MAP_REG);break;case Mapstraction.SATELLITE:map.setMapType(YAHOO_MAP_SAT);break;case Mapstraction.HYBRID:map.setMapType(YAHOO_MAP_HYB);break;default:map.setMapType(YAHOO_MAP_REG);}
break;case'google':case'openstreetmap':switch(type){case Mapstraction.ROAD:map.setMapType(G_NORMAL_MAP);break;case Mapstraction.SATELLITE:map.setMapType(G_SATELLITE_MAP);break;case Mapstraction.HYBRID:map.setMapType(G_HYBRID_MAP);break;default:map.setMapType(G_NORMAL_MAP);}
break;case'microsoft':switch(type){case Mapstraction.ROAD:map.SetMapStyle(Msn.VE.MapStyle.Road);break;case Mapstraction.SATELLITE:map.SetMapStyle(Msn.VE.MapStyle.Aerial);break;case Mapstraction.HYBRID:map.SetMapStyle(Msn.VE.MapStyle.Hybrid);break;default:map.SetMapStyle(Msn.VE.MapStyle.Road);}
break;case'multimap':maptypes=map.getAvailableMapTypes();maptype=-1;for(var i=0;i<maptypes.length;i++){switch(maptypes[i]){case MM_WORLD_MAP:if(type==Mapstraction.ROAD){maptype=maptypes[i];}
default_type=maptypes[i];break;case MM_WORLD_AERIAL:if(type==Mapstraction.SATELLITE){maptype=maptypes[i];}
break;case MM_WORLD_HYBRID:if(type==Mapstraction.HYBRID){maptype=maptypes[i];}
break;}}
if(maptype==-1){maptype=default_type;}
map.setMapType(maptype);break;case'mapquest':switch(type){case Mapstraction.ROAD:map.setMapType("map");break;case Mapstraction.SATELLITE:map.setMapType("sat");break;case Mapstraction.HYBRID:map.setMapType("hyb");break;}
break;default:if(this.debug)
alert(this.api+' not supported by Mapstraction.setMapType');}}
Mapstraction.prototype.getMapType=function(){if(this.loaded[this.api]==false){myself=this;return-1;}
var map=this.maps[this.api];var type;switch(this.api){case'yahoo':type=map.getCurrentMapType();switch(type){case YAHOO_MAP_REG:return Mapstraction.ROAD;break;case YAHOO_MAP_SAT:return Mapstraction.SATELLITE;break;case YAHOO_MAP_HYB:return Mapstraction.HYBRID;break;default:return null;}
break;case'google':case'openstreetmap':type=map.getCurrentMapType();switch(type){case G_NORMAL_MAP:return Mapstraction.ROAD;break;case G_SATELLITE_MAP:return Mapstraction.SATELLITE;break;case G_HYBRID_MAP:return Mapstraction.HYBRID;break;default:return null;}
break;case'microsoft':type=map.GetMapStyle();switch(type){case Msn.VE.MapStyle.Road:return Mapstraction.ROAD;break;case Msn.VE.MapStyle.Aerial:return Mapstraction.SATELLITE;break;case Msn.VE.MapStyle.Hybrid:return Mapstraction.HYBRID;break;default:return null;}
break;case'multimap':maptypes=map.getAvailableMapTypes();type=map.getMapType();switch(type){case MM_WORLD_MAP:return Mapstraction.ROAD;break;case MM_WORLD_AERIAL:return Mapstraction.SATELLITE;break;case MM_WORLD_HYBRID:return Mapstraction.HYBRID;break;default:return null;}
break;case'mapquest':type=map.getMapType();switch(type){case"map":return Mapstraction.ROAD;break;case"sat":return Mapstraction.SATELLITE;break;case"hyb":return Mapstraction.HYBRID;break;default:return null;}
break;default:if(this.debug)
alert(this.api+' not supported by Mapstraction.getMapType');}}
Mapstraction.prototype.getBounds=function(){if(this.loaded[this.api]==false){return null;}
var map=this.maps[this.api];switch(this.api){case'google':case'openstreetmap':var gbox=map.getBounds();var sw=gbox.getSouthWest();var ne=gbox.getNorthEast();return new BoundingBox(sw.lat(),sw.lng(),ne.lat(),ne.lng());break;case'openlayers':var olbox=map.calculateBounds();break;case'yahoo':var ybox=map.getBoundsLatLon();return new BoundingBox(ybox.LatMin,ybox.LonMin,ybox.LatMax,ybox.LonMax);break;case'microsoft':var mbox=map.GetMapView();var nw=mbox.TopLeftLatLong;var se=mbox.BottomRightLatLong;return new BoundingBox(se.Latitude,nw.Longitude,nw.Latitude,se.Longitude);break;case'multimap':var mmbox=map.getMapBounds();var sw=mmbox.getSouthWest();var ne=mmbox.getNorthEast();return new BoundingBox(sw.lat,sw.lon,ne.lat,ne.lon);break;case'mapquest':var mqbox=map.getMapBounds();var se=mqbox.getLowerRightLatLng();var nw=mqbox.getUpperLeftLatLng();return new BoundingBox(se.lat,nw.lon,nw.lat,se.lon);break;case'map24':var mv=map.MapClient['Static'].getCurrentMapView();var se=mv.LowerRight;var nw=mv.TopLeft;return new BoundingBox(se.Latitude/60,nw.Longitude/60,nw.Latitude/60,se.Longitude/60);break;default:if(this.debug)
alert(this.api+' not supported by Mapstraction.getBounds');}}
Mapstraction.prototype.setBounds=function(bounds){if(this.loaded[this.api]==false){myself=this;this.onload[this.api].push(function(){myself.setBounds(bounds);});return;}
var map=this.maps[this.api];var sw=bounds.getSouthWest();var ne=bounds.getNorthEast();switch(this.api){case'google':case'openstreetmap':var gbounds=new GLatLngBounds(new GLatLng(sw.lat,sw.lon),new GLatLng(ne.lat,ne.lon));map.setCenter(gbounds.getCenter(),map.getBoundsZoomLevel(gbounds));break;case'openlayers':var bounds=new OpenLayers.Bounds();bounds.extend(new LatLonPoint(sw.lat,sw.lon).toOpenLayers());bounds.extend(new LatLonPoint(ne.lat,ne.lon).toOpenLayers());map.zoomToExtent(bounds);break;case'yahoo':if(sw.lon>ne.lon)
sw.lon-=360;var center=new YGeoPoint((sw.lat+ne.lat)/2,(ne.lon+sw.lon)/2);var container=map.getContainerSize();for(var zoom=1;zoom<=17;zoom++){var sw_pix=convertLatLonXY_Yahoo(sw,zoom);var ne_pix=convertLatLonXY_Yahoo(ne,zoom);if(sw_pix.x>ne_pix.x)
sw_pix.x-=(1<<(26-zoom));if(Math.abs(ne_pix.x-sw_pix.x)<=container.width&&Math.abs(ne_pix.y-sw_pix.y)<=container.height){map.drawZoomAndCenter(center,zoom);break;}}
break;case'microsoft':map.SetMapView([new VELatLong(sw.lat,sw.lon),new VELatLong(ne.lat,ne.lon)]);break;case'multimap':var mmlocation=map.getBoundsZoomFactor(sw.toMultiMap(),ne.toMultiMap());var center=new LatLonPoint(mmlocation.coords.lat,mmlocation.coords.lon);this.setCenterAndZoom(center,mmlocation.zoom_factor);break;case'mapquest':if(this.debug)
alert(this.api+' not supported by Mapstraction.setBounds');break;case'freeearth':var center=new LatLonPoint((sw.lat+ne.lat)/2,(ne.lon+sw.lon)/2);this.setCenter(center);break;case'map24':var settings=new Object();settings.Latitude=((sw.lat+ne.lat)/2)*60;settings.Longitude=((sw.lon+ne.lon)/2)*60;settings.MinimumWidth=lonToMetres
(ne.lon-sw.lon,(ne.lat+sw.lat)/2);Map24.MapApplication.center(settings);break;default:if(this.debug)
alert(this.api+' not supported by Mapstraction.setBounds');}}
Mapstraction.prototype.addImageOverlay=function(id,src,opacity,west,south,east,north){if(this.loaded[this.api]==false){myself=this;this.onload[this.api].push(function(){myself.addImageOverlay(id,src,opacity,west,south,east,north);});return;}
var map=this.maps[this.api];var b=document.createElement("img");b.style.display='block';b.setAttribute('id',id);b.setAttribute('src',src);b.style.position='absolute';b.style.zIndex=1;b.setAttribute('west',west);b.setAttribute('south',south);b.setAttribute('east',east);b.setAttribute('north',north);switch(this.api){case'google':case'openstreetmap':map.getPane(G_MAP_MAP_PANE).appendChild(b);this.setImageOpacity(id,opacity);this.setImagePosition(id);GEvent.bind(map,"zoomend",this,function(){this.setImagePosition(id)});GEvent.bind(map,"moveend",this,function(){this.setImagePosition(id)});break;case'multimap':map.getContainer().appendChild(b);this.setImageOpacity(id,opacity);this.setImagePosition(id);me=this;map.addEventHandler('changeZoom',function(eventType,eventTarget,arg1,arg2,arg3){me.setImagePosition(id);});map.addEventHandler('drag',function(eventType,eventTarget,arg1,arg2,arg3){me.setImagePosition(id);});map.addEventHandler('endPan',function(eventType,eventTarget,arg1,arg2,arg3){me.setImagePosition(id);});break;default:b.style.display='none';if(this.debug)
alert(this.api+"not supported by Mapstraction.addImageOverlay not supported");break;}}
Mapstraction.prototype.setImageOpacity=function(id,opacity){if(opacity<0){opacity=0;}if(opacity>=100){opacity=100;}
var c=opacity/100;var d=document.getElementById(id);if(typeof(d.style.filter)=='string'){d.style.filter='alpha(opacity:'+opacity+')';}
if(typeof(d.style.KHTMLOpacity)=='string'){d.style.KHTMLOpacity=c;}
if(typeof(d.style.MozOpacity)=='string'){d.style.MozOpacity=c;}
if(typeof(d.style.opacity)=='string'){d.style.opacity=c;}}
Mapstraction.prototype.setImagePosition=function(id){if(this.loaded[this.api]==false){myself=this;this.onload[this.api].push(function(){myself.setImagePosition(id);});return;}
var map=this.maps[this.api];var x=document.getElementById(id);var d;var e;switch(this.api){case'google':case'openstreetmap':d=map.fromLatLngToDivPixel(new GLatLng(x.getAttribute('north'),x.getAttribute('west')));e=map.fromLatLngToDivPixel(new GLatLng(x.getAttribute('south'),x.getAttribute('east')));break;case'multimap':d=map.geoPosToContainerPixels(new MMLatLon(x.getAttribute('north'),x.getAttribute('west')));e=map.geoPosToContainerPixels(new MMLatLon(x.getAttribute('south'),x.getAttribute('east')));break;}
x.style.top=d.y+'px';x.style.left=d.x+'px';x.style.width=e.x-d.x+'px';x.style.height=e.y-d.y+'px';}
Mapstraction.prototype.addOverlay=function(url,autoCenterAndZoom){if(this.loaded[this.api]==false){myself=this;this.onload[this.api].push(function(){myself.addOverlay(url);});return;}
var map=this.maps[this.api];switch(this.api){case'yahoo':map.addOverlay(new YGeoRSS(url));break;case'openstreetmap':case'google':var geoXML=new GGeoXml(url);map.addOverlay(geoXML,function(){if(autoCenterAndZoom){geoXML.gotoDefaultViewport(map);}});break;case'microsoft':var veLayerSpec=new VELayerSpecification();veLayerSpec.Type=VELayerType.GeoRSS;veLayerSpec.ID=1;veLayerSpec.LayerSource=url;veLayerSpec.Method='get';map.AddLayer(veLayerSpec);break;case'multimap':break;case'freeearth':if(this.freeEarthLoaded){var ferss=new FE.GeoRSS(url);map.addOverlay(ferss);}else{myself=this;this.freeEarthOnLoad.push(function(){myself.addOverlay(url);});}
break;default:if(this.debug)
alert(this.api+' not supported by Mapstraction.addGeoRSSOverlay');}}
Mapstraction.prototype.addTileLayer=function(tile_url,opacity,copyright_text,min_zoom,max_zoom){if(!tile_url)
return;if(!this.tileLayers){this.tileLayers=[];}
if(!opacity)
opacity=0.6;if(!copyright_text)
copyright_text="Mapstraction";if(!min_zoom)
min_zoom=1;if(!max_zoom)
max_zoom=18;console.log(this.api);switch(this.api){case'google':case'openstreetmap':var copyright=new GCopyright(1,new GLatLngBounds(new GLatLng(-90,-180),new GLatLng(90,180)),0,"copyleft");var copyrightCollection=new GCopyrightCollection(copyright_text);copyrightCollection.addCopyright(copyright);var tilelayers=new Array();tilelayers[0]=new GTileLayer(copyrightCollection,min_zoom,max_zoom);tilelayers[0].isPng=function(){return true;};tilelayers[0].getOpacity=function(){return opacity;}
tilelayers[0].getTileUrl=function(a,b){url=tile_url;url=url.replace(/\{Z\}/,b);url=url.replace(/\{X\}/,a.x);url=url.replace(/\{Y\}/,a.y);return url};tileLayerOverlay=new GTileLayerOverlay(tilelayers[0]);this.tileLayers.push([tile_url,tileLayerOverlay,true]);this.maps[this.api].addOverlay(tileLayerOverlay);break;}
return tileLayerOverlay;}
Mapstraction.prototype.toggleTileLayer=function(tile_url){switch(this.api){case'google':case'openstreetmap':for(var f=0;f<this.tileLayers.length;f++){if(this.tileLayers[f][0]==tile_url){if(this.tileLayers[f][2]){this.maps[this.api].removeOverlay(this.tileLayers[f][1]);this.tileLayers[f][2]=false;}else{this.maps[this.api].addOverlay(this.tileLayers[f][1]);this.tileLayers[f][2]=true;}}}
break;}}
Mapstraction.prototype.addFilter=function(field,operator,value){if(!this.filters){this.filters=[];}
this.filters.push([field,operator,value]);}
Mapstraction.prototype.removeFilter=function(field,operator,value){if(!this.filters){return;}
var del;for(var f=0;f<this.filters.length;f++){if(this.filters[f][0]==field&&(!operator||(this.filters[f][1]==operator&&this.filters[f][2]==value))){this.filters.splice(f,1);f--;}}}
Mapstraction.prototype.toggleFilter=function(field,operator,value){if(!this.filters){this.filters=[];}
var found=false;for(var f=0;f<this.filters.length;f++){if(this.filters[f][0]==field&&this.filters[f][1]==operator&&this.filters[f][2]==value){this.filters.splice(f,1);f--;found=true;}}
if(!found){this.addFilter(field,operator,value);}}
Mapstraction.prototype.removeAllFilters=function(){this.filters=[];}
Mapstraction.prototype.doFilter=function(){if(this.loaded[this.api]==false){myself=this;this.onload[this.api].push(function(){myself.doFilter();});return;}
var map=this.maps[this.api];if(this.filters){switch(this.api){case'multimap':var mmfilters=[];for(var f=0;f<this.filters.length;f++){mmfilters.push(new MMSearchFilter(this.filters[f][0],this.filters[f][1],this.filters[f][2]));}
map.setMarkerFilters(mmfilters);map.redrawMap();break;default:var vis;for(var m=0;m<this.markers.length;m++){vis=true;for(var f=0;f<this.filters.length;f++){if(!this.applyFilter(this.markers[m],this.filters[f])){vis=false;}}
if(vis){this.markers[m].show();}else{this.markers[m].hide();}}
break;}}}
Mapstraction.prototype.applyFilter=function(o,f){var vis=true;switch(f[1]){case'ge':if(o.getAttribute(f[0])<f[2]){vis=false;}
break;case'le':if(o.getAttribute(f[0])>f[2]){vis=false;}
break;case'eq':if(o.getAttribute(f[0])!=f[2]){vis=false;}
break;}
return vis;}
Mapstraction.prototype.getAttributeExtremes=function(field){var min;var max;for(var m=0;m<this.markers.length;m++){if(!min||min>this.markers[m].getAttribute(field)){min=this.markers[m].getAttribute(field);}
if(!max||max<this.markers[m].getAttribute(field)){max=this.markers[m].getAttribute(field);}}
for(var p=0;m<this.polylines.length;m++){if(!min||min>this.polylines[p].getAttribute(field)){min=this.polylines[p].getAttribute(field);}
if(!max||max<this.polylines[p].getAttribute(field)){max=this.polylines[p].getAttribute(field);}}
return[min,max];}
Mapstraction.prototype.getMap=function(){return this.maps[this.api];}
function LatLonPoint(lat,lon){this.lat=lat;this.lon=lon;this.lng=lon;}
LatLonPoint.prototype.toYahoo=function(){return new YGeoPoint(this.lat,this.lon);}
LatLonPoint.prototype.toGoogle=function(){return new GLatLng(this.lat,this.lon);}
LatLonPoint.prototype.toOpenLayers=function(){var ollon=this.lon*20037508.34/180;var ollat=Math.log(Math.tan((90+this.lat)*Math.PI/360))/(Math.PI/180);ollat=ollat*20037508.34/180;return new OpenLayers.LonLat(ollon,ollat);}
LatLonPoint.prototype.fromOpenLayers=function(){var lon=(this.lon/20037508.34)*180;var lat=(this.lat/20037508.34)*180;lat=180/Math.PI*(2*Math.atan(Math.exp(lat*Math.PI/180))-Math.PI/2);this.lon=lon;this.lat=lat;}
LatLonPoint.prototype.toMicrosoft=function(){return new VELatLong(this.lat,this.lon);}
LatLonPoint.prototype.toMultiMap=function(){return new MMLatLon(this.lat,this.lon);}
LatLonPoint.prototype.toMapQuest=function(){return new MQLatLng(this.lat,this.lon);}
LatLonPoint.prototype.toFreeEarth=function(){return new FE.LatLng(this.lat,this.lon);}
LatLonPoint.prototype.toMap24=function(){return new Map24.Point(this.lon,this.lat);}
LatLonPoint.prototype.toString=function(){return this.lat+', '+this.lon;}
LatLonPoint.prototype.distance=function(otherPoint){var d,dr;with(Math){dr=0.017453292519943295;d=cos(otherPoint.lon*dr-this.lon*dr)*cos(otherPoint.lat*dr-this.lat*dr);return acos(d)*6378.137;}
return-1;}
LatLonPoint.prototype.equals=function(otherPoint){return this.lat==otherPoint.lat&&this.lon==otherPoint.lon;}
function BoundingBox(swlat,swlon,nelat,nelon){this.sw=new LatLonPoint(swlat,swlon);this.ne=new LatLonPoint(nelat,nelon);}
BoundingBox.prototype.getSouthWest=function(){return this.sw;}
BoundingBox.prototype.getNorthEast=function(){return this.ne;}
BoundingBox.prototype.isEmpty=function(){return this.ne==this.sw;}
BoundingBox.prototype.contains=function(point){return point.lat>=this.sw.lat&&point.lat<=this.ne.lat&&point.lon>=this.sw.lon&&point.lon<=this.ne.lon;}
BoundingBox.prototype.toSpan=function(){return new LatLonPoint(Math.abs(this.sw.lat-this.ne.lat),Math.abs(this.sw.lon-this.ne.lon));}
BoundingBox.prototype.extend=function(point){if(this.sw.lat>point.lat)
this.sw.lat=point.lat;if(this.sw.lon>point.lon)
this.sw.lon=point.lon;if(this.ne.lat<point.lat)
this.ne.lat=point.lat;if(this.ne.lon<point.lon)
this.ne.lon=point.lon;return;}
function Marker(point){this.location=point;this.onmap=false;this.proprietary_marker=false;this.attributes=new Array();this.pinID="mspin-"+new Date().getTime()+'-'+(Math.floor(Math.random()*Math.pow(2,16)));}
Marker.prototype.setChild=function(some_proprietary_marker){this.proprietary_marker=some_proprietary_marker;this.onmap=true}
Marker.prototype.setLabel=function(labelText){this.labelText=labelText;}
Marker.prototype.addData=function(options){if(options.label)
this.setLabel(options.label);if(options.infoBubble)
this.setInfoBubble(options.infoBubble);if(options.icon){if(options.iconSize)
this.setIcon(options.icon,new Array(options.iconSize[0],options.iconSize[1]));else
this.setIcon(options.icon);if(options.iconAnchor)
this.setIconAnchor(new Array(options.iconAnchor[0],options.iconAnchor[1]));}
if(options.iconShadow){if(options.iconShadowSize)
this.setShadowIcon(options.iconShadow,new Array(options.iconShadowSize[0],options.iconShadowSize[1]));else
this.setIcon(options.iconShadow);}
if(options.infoDiv)
this.setInfoDiv(options.infoDiv[0],options.infoDiv[1]);if(options.draggable)
this.setDraggable(options.draggable);if(options.hover)
this.setHover(options.hover);if(options.hoverIcon)
this.setHoverIcon(options.hoverIcon);if(options.openBubble)
this.openBubble();if(options.date)
this.setAttribute('date',eval(options.date));if(options.category)
this.setAttribute('category',options.category);}
Marker.prototype.setInfoBubble=function(infoBubble){this.infoBubble=infoBubble;}
Marker.prototype.setInfoDiv=function(infoDiv,div){this.infoDiv=infoDiv;this.div=div;}
Marker.prototype.setIcon=function(iconUrl,iconSize,iconAnchor){this.iconUrl=iconUrl;if(iconSize)
this.iconSize=iconSize;if(iconAnchor)
this.iconAnchor=iconAnchor;}
Marker.prototype.setIconSize=function(iconSize){if(iconSize)
this.iconSize=iconSize;}
Marker.prototype.setIconAnchor=function(iconAnchor){if(iconAnchor)
this.iconAnchor=iconAnchor;}
Marker.prototype.setShadowIcon=function(iconShadowUrl,iconShadowSize){this.iconShadowUrl=iconShadowUrl;if(iconShadowSize)
this.iconShadowSize=iconShadowSize;}
Marker.prototype.setHoverIcon=function(hoverIconUrl){this.hoverIconUrl=hoverIconUrl;}
Marker.prototype.setDraggable=function(draggable){this.draggable=draggable;}
Marker.prototype.setHover=function(hover){this.hover=hover;}
Marker.prototype.changeIcon=function(iconUrl){if(this.proprietary_marker){this.proprietary_marker.setImage(iconUrl);}}
Marker.prototype.revertIcon=function(){this.changeIcon(this.iconUrl);}
Marker.prototype.toYahoo=function(){var ymarker;if(this.iconUrl){ymarker=new YMarker(this.location.toYahoo(),new YImage(this.iconUrl));}else{ymarker=new YMarker(this.location.toYahoo());}
if(this.iconSize){ymarker.size=new YSize(this.iconSize[0],this.iconSize[1]);}
if(this.labelText){ymarker.addLabel(this.labelText);}
if(this.infoBubble){var theInfo=this.infoBubble;var event_action;if(this.hover){event_action=EventsList.MouseOver;}
else{event_action=EventsList.MouseClick;}
YEvent.Capture(ymarker,event_action,function(){ymarker.openSmartWindow(theInfo);});}
if(this.infoDiv){var theInfo=this.infoDiv;var div=this.div;var event_div;if(this.hover){event_action=EventsList.MouseOver;}
else{event_action=EventsList.MouseClick;}
YEvent.Capture(ymarker,event_action,function(){document.getElementById(div).innerHTML=theInfo;});}
return ymarker;}
Marker.prototype.toGoogle=function(){var options=new Object();if(this.labelText){options.title=this.labelText;}
if(this.iconUrl){var icon=new GIcon(G_DEFAULT_ICON,this.iconUrl);if(this.iconSize){icon.iconSize=new GSize(this.iconSize[0],this.iconSize[1]);var anchor;if(this.iconAnchor){anchor=new GPoint(this.iconAnchor[0],this.iconAnchor[1]);}
else{anchor=new GPoint(this.iconSize[0]/2,this.iconSize[1]/2);}
icon.iconAnchor=anchor;}
if(this.iconShadowUrl){icon.shadow=this.iconShadowUrl;if(this.iconShadowSize){icon.shadowSize=new GSize(this.iconShadowSize[0],this.iconShadowSize[1]);}}
options.icon=icon;}
if(this.draggable){options.draggable=this.draggable;}
var gmarker=new GMarker(this.location.toGoogle(),options);if(this.infoBubble){var theInfo=this.infoBubble;var event_action;if(this.hover){event_action="mouseover";}
else{event_action="click";}
GEvent.addListener(gmarker,event_action,function(){gmarker.openInfoWindowHtml(theInfo,{maxWidth:100});});}
if(this.hoverIconUrl){GEvent.addListener(gmarker,"mouseover",function(){gmarker.setImage(this.hoverIconUrl);});GEvent.addListener(gmarker,"mouseout",function(){gmarker.setImage(this.iconUrl);});}
if(this.infoDiv){var theInfo=this.infoDiv;var div=this.div;var event_action;if(this.hover){event_action="mouseover";}
else{event_action="click";}
GEvent.addListener(gmarker,event_action,function(){document.getElementById(div).innerHTML=theInfo;});}
return gmarker;}
Marker.prototype.toOpenLayers=function(){if(this.iconSize){var size=new OpenLayers.Size(this.iconSize[0],this.iconSize[1]);}
else
{var size=new OpenLayers.Size(15,20);}
if(this.iconAnchor)
{var anchor=new OpenLayers.Pixel(this.iconAnchor[0],this.iconAnchor[1]);}
else
{anchor=new OpenLayers.Pixel(-(size.w/2),-size.h);}
if(this.iconUrl){var icon=new OpenLayers.Icon(this.iconUrl,size,anchor);}
else
{var icon=new OpenLayers.Icon('http://boston.openguides.org/markers/AQUA.png',size,anchor);}
var marker=new OpenLayers.Marker(this.location.toOpenLayers(),icon);return marker;}
Marker.prototype.toMicrosoft=function(){var pin=new VEPushpin(this.pinID,this.location.toMicrosoft(),this.iconUrl,this.labelText,this.infoBubble);return pin;}
Marker.prototype.toMap24=function(){var ops=new Object();ops.Longitude=this.location.lon*60;ops.Latitude=this.location.lat*60;if(this.infoBubble){ops.TooltipContent=this.infoBubble;}
if(this.labelText){}
ops.LogoURL=this.iconUrl?this.iconUrl:"http://www.free-map.org.uk/images/marker.png";ops.TooltipLayout=Map24.MapObject.LAYOUT_BUBBLE;if(this.hover){ops.TooltipOpen="OnMouseOver";}else{ops.TooltipOpen="OnClick";}
var m24Location=new Map24.Location(ops);return m24Location;}
Marker.prototype.toMultiMap=function(){if(this.iconUrl){var icon=new MMIcon(this.iconUrl);icon.iconSize=new MMDimensions(32,32);var mmmarker=new MMMarkerOverlay(this.location.toMultiMap(),{'icon':icon});}else{var mmmarker=new MMMarkerOverlay(this.location.toMultiMap());}
if(this.labelText){}
if(this.infoBubble){mmmarker.setInfoBoxContent(this.infoBubble);}
if(this.infoDiv){}
for(var key in this.attributes){mmmarker.setAttribute(key,this.attributes[key]);}
return mmmarker;}
Marker.prototype.toMapQuest=function(){var mqmarker=new MQPoi(this.location.toMapQuest());if(this.iconUrl){var mqicon=new MQMapIcon();mqicon.setImage(this.iconUrl,32,32,true,false);mqmarker.setIcon(mqicon);}
if(this.labelText){mqmarker.setInfoTitleHTML(this.labelText);}
if(this.infoBubble){mqmarker.setInfoContentHTML(this.infoBubble);}
if(this.infoDiv){var theInfo=this.infoDiv;var div=this.div;MQEventManager.addListener(mqmarker,"click",function(){document.getElementById(div).innerHTML=theInfo;});}
return mqmarker;}
Marker.prototype.toFreeEarth=function(){var feicon;if(this.iconUrl){feicon=new FE.Icon(this.iconUrl);}else{feicon=new FE.Icon("http://freeearth.poly9.com/images/bullmarker.png");}
var femarker=new FE.Pushpin(this.location.toFreeEarth(),feicon);if(this.infoBubble){var theBubble=this.infoBubble;FE.Event.addListener(femarker,'click',function(){femarker.openInfoWindowHtml(theBubble,200,100);});}
if(this.infoDiv){var theInfo=this.infoDiv;var div=this.div;FE.Event.addListener(femarker,'click',function(){document.getElementById(div).innerHTML=theInfo;});}
return femarker;}
Marker.prototype.setAttribute=function(key,value){this.attributes[key]=value;}
Marker.prototype.getAttribute=function(key){return this.attributes[key];}
Marker.prototype.openBubble=function(){if(this.mapstraction.loaded[this.api]==false){var my_marker=this;this.mapstraction.onload[this.api].push(function(){my_marker.openBubble();});return;}
if(this.api){switch(this.api){case'yahoo':var ypin=this.proprietary_marker;ypin.openSmartWindow(this.infoBubble);break;case'google':case'openstreetmap':var gpin=this.proprietary_marker;gpin.openInfoWindowHtml(this.infoBubble);break;case'microsoft':var pin=this.proprietary_marker;var el=$m(this.pinID+"_"+this.maps[this.api].GUID).onmouseover;setTimeout(el,1000);break;case'multimap':this.proprietary_marker.openInfoBox();break;case'mapquest':this.proprietary_marker.setRolloverEnabled(false);this.proprietary_marker.showInfoWindow();this.proprietary_marker.setRolloverEnabled(true);break;}}else{alert('You need to add the marker before opening it');}}
Marker.prototype.hide=function(){if(this.api){switch(this.api){case'google':case'openstreetmap':this.proprietary_marker.hide();break;case'openlayers':this.proprietary_marker.display(false);break;case'yahoo':this.proprietary_marker.hide();break;case'map24':this.proprietary_marker.hide();break;case'multimap':this.proprietary_marker.setVisibility(false);break;case'mapquest':this.proprietary_marker.setVisible(false);break;default:if(this.debug)
alert(this.api+"not supported by Marker.hide");}}}
Marker.prototype.show=function(){if(this.api){switch(this.api){case'google':case'openstreetmap':this.proprietary_marker.show();break;case'openlayers':this.proprietary_marker.display(true);break;case'map24':this.proprietary_marker.show();break;case'yahoo':this.proprietary_marker.unhide();break;case'multimap':this.proprietary_marker.setVisibility(true);break;case'mapquest':this.proprietary_marker.setVisible(true);break;default:if(this.debug)
alert(this.api+"not supported by Marker.show");}}}
function Polyline(points){this.points=points;this.attributes=new Array();this.onmap=false;this.proprietary_polyline=false;this.pllID="mspll-"+new Date().getTime()+'-'+(Math.floor(Math.random()*Math.pow(2,16)));}
Polyline.prototype.addData=function(options){if(options.color)
this.setColor(options.color);if(options.width)
this.setWidth(options.width);if(options.opacity)
this.setIcon(options.opacity);if(options.date)
this.setAttribute('date',eval(options.date));if(options.category)
this.setAttribute('category',options.category);}
Polyline.prototype.setChild=function(some_proprietary_polyline){this.proprietary_polyline=some_proprietary_polyline;this.onmap=true;}
Polyline.prototype.setColor=function(color){this.color=(color.length==7&&color[0]=="#")?color.toUpperCase():color;}
Polyline.prototype.setWidth=function(width){this.width=width;}
Polyline.prototype.setOpacity=function(opacity){this.opacity=opacity;}
Polyline.prototype.toYahoo=function(){var ypolyline;var ypoints=[];for(var i=0,length=this.points.length;i<length;i++){ypoints.push(this.points[i].toYahoo());}
ypolyline=new YPolyline(ypoints,this.color,this.width,this.opacity);return ypolyline;}
Polyline.prototype.toGoogle=function(){var gpolyline;var gpoints=[];for(var i=0,length=this.points.length;i<length;i++){gpoints.push(this.points[i].toGoogle());}
gpolyline=new GPolyline(gpoints,this.color,this.width,this.opacity);return gpolyline;}
Polyline.prototype.toMap24=function(){var m24polyline;var m24longs="";var m24lats="";for(var i=0;i<this.points.length;i++){if(i){m24longs+="|";m24lats+="|";}
m24longs+=(this.points[i].lon*60);m24lats+=(this.points[i].lat*60);}
m24polyline=new Map24.Polyline({Longitudes:m24longs,Latitudes:m24lats,Color:this.color||"black",Width:this.width||3});return m24polyline;}
Polyline.prototype.toMicrosoft=function(){var mpolyline;var mpoints=[];for(var i=0,length=this.points.length;i<length;i++){mpoints.push(this.points[i].toMicrosoft());}
var color;var opacity=this.opacity||1.0;if(this.color){color=new VEColor(parseInt(this.color.substr(1,2),16),parseInt(this.color.substr(3,2),16),parseInt(this.color.substr(5,2),16),opacity);}else{color=new VEColor(0,255,0,opacity);}
mpolyline=new VEPolyline(this.pllID,mpoints,color,this.width);return mpolyline;}
Polyline.prototype.toMultiMap=function(){var mmpolyline;var mmpoints=[];for(var i=0,length=this.points.length;i<length;i++){mmpoints.push(this.points[i].toMultiMap());}
mmpolyline=new MMPolyLineOverlay(mmpoints,this.color,this.opacity,this.width,false,undefined);return mmpolyline;}
Polyline.prototype.toMapQuest=function(){var mqpolyline=new MQLineOverlay();mqpolyline.setColor(this.color||"red");mqpolyline.setBorderWidth(this.width||3);mqpolyline.setKey("Line");mqpolyline.setColorAlpha(this.opacity);var mqpoints=new MQLatLngCollection();for(var i=0,length=this.points.length;i<length;i++){mqpoints.add(this.points[i].toMapQuest());}
mqpolyline.setShapePoints(mqpoints);return mqpolyline;}
Polyline.prototype.toFreeEarth=function(){var fepoints=new Array();for(var i=0,length=this.points.length;i<length;i++){fepoints.push(this.points[i].toFreeEarth());}
var fepolyline=new FE.Polyline(fepoints,this.color||'0xff0000',this.width||1,this.opacity||1);return fepolyline;}
Polyline.prototype.setAttribute=function(key,value){this.attributes[key]=value;}
Polyline.prototype.getAttribute=function(key){return this.attributes[key];}
Polyline.prototype.show=function(){if(this.api){}}
Polyline.prototype.hide=function(){if(this.api){}}
Mapstraction.prototype.showRoute=function(route){if(this.loaded[this.api]==false){myself=this;this.onload[this.api].push(function(){myself.showRoute(route);});return;}
var map=this.maps[this.api];switch(this.api){case'mapquest':map.addRouteHighlight(route['bounding_box'],"http://map.access.mapquest.com",route['session_id'],true);break;default:if(this.debug)
alert(api+' not supported by Mapstration.showRoute');break;}};function MapstractionGeocoder(callback,api,error_callback){this.api=api;this.callback=callback;this.geocoders=new Object();if(error_callback==null){this.error_callback=this.geocode_error}else{this.error_callback=error_callback;}
this.svn_revision_string='$Revision: 107 $';this.addAPI(api);}
MapstractionGeocoder.prototype.addAPI=function(api){me=this;switch(api){case'google':this.geocoders[api]=new GClientGeocoder();break;case'mapquest':var proxyServerName="";var proxyServerPort="";var ProxyServerPath="mapquest_proxy/JSReqHandler.php";var serverName="geocode.access.mapquest.com";var serverPort="80";var serverPath="mq";this.geocoders[api]=new MQExec(serverName,serverPath,serverPort,proxyServerName,ProxyServerPath,proxyServerPort);break;default:alert(api+' not supported by mapstraction-geocoder');}}
MapstractionGeocoder.prototype.swap=function(api){if(this.api==api){return;}
this.api=api;if(this.geocoders[this.api]==undefined){this.addAPI($(element),api);}}
MapstractionGeocoder.prototype.geocode_error=function(response){alert("Sorry, we were unable to geocode that address");}
MapstractionGeocoder.prototype.geocode_callback=function(response,mapstraction_geocoder){var return_location=new Object();switch(mapstraction_geocoder.api){case'google':if(!response||response.Status.code!=200){mapstraction_geocoder.error_callback(response);}else{return_location.street="";return_location.locality="";return_location.region="";return_location.country="";place=response.Placemark[0];if(place.AddressDetails.Country.AdministrativeArea!=null){return_location.region=place.AddressDetails.Country.AdministrativeArea.AdministrativeAreaName;if(place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea!=null){if(place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality!=null){return_location.locality=place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.LocalityName;if(place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.Thoroughfare!=null)
return_location.street=place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.Thoroughfare.ThoroughfareName;}}}
return_location.country=place.AddressDetails.Country.CountryNameCode;return_location.point=new LatLonPoint(place.Point.coordinates[1],place.Point.coordinates[0]);mapstraction_geocoder.callback(return_location);}
break;case'mapquest':break;}}
MapstractionGeocoder.prototype.geocode=function(address){var return_location=new Object();var mapstraction_geocoder=this;switch(this.api){case'google':if(address.address==null||address.address=="")
address.address=address.street+", "+address.locality+", "+address.region+", "+address.country
this.geocoders[this.api].getLocations(address.address,function(response){mapstraction_geocoder.geocode_callback(response,mapstraction_geocoder);});break;case'mapquest':var mqaddress=new MQAddress();var gaCollection=new MQLocationCollection("MQGeoAddress");mqaddress.setStreet(address.street);mqaddress.setCity(address.locality);mqaddress.setState(address.region);mqaddress.setPostalCode(address.postalcode);mqaddress.setCountry(address.country);this.geocoders[this.api].geocode(mqaddress,gaCollection);var geoAddr=gaCollection.get(0);var mqpoint=geoAddr.getMQLatLng();return_location.street=geoAddr.getStreet();return_location.locality=geoAddr.getCity();return_location.region=geoAddr.getState();return_location.country=geoAddr.getCountry();return_location.point=new LatLonPoint(mqpoint.getLatitude(),mqpoint.getLongitude());this.callback(return_location,this);break;default:alert(api+' not supported by mapstraction-geocoder');break;}};var mapstract;var geocoder;var markers=[];var libraryResults;var selectedLibraries=[];var centreMarker;var searchMode='book';var bookResults;var selectedBook;var initialPoint;var bookmarkedPoint;var ajaxManager;function show_loader()
{$('#loader').show();}
function hide_loader()
{$('#loader').hide();}
function availability_check_in_progress()
{for(var x in selectedLibraries){if(selectedLibraries[x].results&&!selectedLibraries[x].results.done){return true;}}
return false;}
function highlight_book(book_index)
{$('#book-carousel li').each(function(i){if(book_index==i){$('a img',this).css('opacity',1);}else{$('a img',this).css('opacity',0.4);}});}
function show_all_books()
{if(selectedBook){highlight_book(selectedBook.bookIndex);}else{$('#book-carousel li a img').css('opacity',1);}}
function deselect_book()
{selectedBook=null;show_all_books();}
function check_availability(book_index)
{if(!bookResults[book_index]){alert('Book not found');return;}
if($('li',libraryResults).size()===0){humanMsg.displayMsg('You must click on the map to select libraries before you can check availability');return;}
if(selectedLibraries.length<1){humanMsg.displayMsg('We cannot check availability within the libraries currently showing');return;}
var text='The availability checker is experimental.<br />Please confirm results with libraries.<br /><br />';if(availability_check_in_progress()){text+='Availability check is currently in progress. Cancel current check?';}else{text+='Check availability of this book in nearby libraries?';}
$.prompt(text,{buttons:{Yes:true,No:false},overlayspeed:1,promptspeed:1,callback:function(v,m){if(v){start_availability_check(book_index);}}});}
function start_availability_check(book_index)
{abort_library_requests();selectedBook=bookResults[book_index];highlight_book(book_index);start_library_loading_animation();var isbns=[selectedBook.isbn];$.getJSON('http://xisbn.worldcat.org/webservices/xid/isbn/'+selectedBook.isbn+'?method=getEditions&format=json&fl=isbn,form&count=10&callback=?',function(json){if(json.stat=='ok'){for(var x in json.list){if(json.list[x].isbn[0]==selectedBook.isbn){continue;}
check_book_type:for(var i in json.list[x].form){switch(json.list[x].form[i]){case'BA':case'BB':case'BC':isbns.push(json.list[x].isbn[0]);break check_book_type;}}
if(isbns.length>5){isbns=isbns.slice(0,5);}}
for(var x in selectedLibraries){selectedLibraries[x].results={done:false,available:null,on_loan:null,no_record:null,unknown:null};selectedLibraries[x].ajaxManager=$.manageAjax({manageType:'queue',maxReq:1});for(var i in isbns){selectedLibraries[x].ajaxManager.add({url:'/v1/availability/'+selectedLibraries[x].id+'/by-isbn/'+isbns[i]+'.json',success:function(json){if(json&&json.status=='ok'){store_availability_result(json.results[0]);if(json.results[0].availability=='available'){abort_library_requests(json.results[0].id);}else if(json.results[0].availability=='unknown'){abort_library_requests(json.results[0].id);}
display_availability_results(json.results[0].id);}}});}}}});}
function store_availability_result(library)
{for(var x in selectedLibraries){if(selectedLibraries[x].id==library.id){switch(library.availability){case'available':selectedLibraries[x].results.available=true;break;case'on loan':selectedLibraries[x].results.on_loan=true;break;case'no record':selectedLibraries[x].results.no_record=true;break;case'unknown':selectedLibraries[x].results.unknown=true;break;}
break;}}}
function display_availability_results(library_id)
{var x,i;for(x in selectedLibraries){if(selectedLibraries[x].id==library_id){var done=true;for(i in selectedLibraries[x].ajaxManager.queue){if(selectedLibraries[x].ajaxManager.queue[i]){done=selectedLibraries[x].ajaxManager.queue[i].done;}}
if(done){if(selectedLibraries[x].results.available){mark_book_available(library_id);}else if(selectedLibraries[x].results.on_loan){mark_book_on_loan(library_id);}else if(selectedLibraries[x].results.no_record){mark_book_no_record(library_id);}else{mark_book_unknown(library_id);}
selectedLibraries[x].results.done=true;}
break;}}}
function start_library_loading_animation()
{for(var x in selectedLibraries){$('#lib-'+selectedLibraries[x].id,libraryResults).css('background-image','url(/v1/images/ajax-loader-small.gif)')}}
function abort_library_requests(library_id)
{for(var x in selectedLibraries){if(selectedLibraries[x].id==library_id||library_id==undefined){if(selectedLibraries[x].ajaxManager){selectedLibraries[x].ajaxManager.abort();}}}}
function switch_search()
{if(searchMode=='place'){$('#address-box').slideUp('fast',function(){$('#book-box').slideDown('fast',function(){$('#book').focus();});});$('.search-mode-place').hide();$('.search-mode-book').show();searchMode='book';humanMsg.displayMsg($('#book').attr('title'));}else{$('#book-box').slideUp('fast',function(){$('#address-box').slideDown('fast',function(){$('#address').focus();});});$('.search-mode-book').hide();$('.search-mode-place').show();searchMode='place';humanMsg.displayMsg($('#address').attr('title'));}}
function mark_centre_point(point)
{$('.search input').blur();mapstract.removeAllMarkers();libraryResults.empty();centreMarker=new Marker(point);centreMarker.setIcon('http://maps.google.com/mapfiles/kml/pal3/icon28.png',[32,32]);centreMarker.setShadowIcon('http://maps.google.com/mapfiles/kml/pal3/icon28s.png',[59,32]);centreMarker.setLabel(point.lat+', '+point.lng);mapstract.addMarker(centreMarker);}
function mark_libraries(point)
{markers=[];selectedLibraries=[];var results=[];ajaxManager.add({url:"/v1/libraries/near="+point.lat+","+point.lng+".json?count=10",success:function(json){if(json===undefined){return;}
mark_centre_point(centreMarker.location);libraryResults.parent().show();results=json.results;var x,point,marker,num;for(x in results){num=parseInt(x)+1;point=new LatLonPoint(results[x].vcard.geo.latitude,results[x].vcard.geo.longitude);marker=new Marker(point);markers[x]=marker;marker.setLabel(results[x].title);if(results[x].supported=='yes'){if(selectedLibraries.length<10){selectedLibraries.push(results[x]);}
marker.setIcon('/v1/images/markers/iconb'+num+'.png',[20,34],[10,34]);libraryResults.append('<li id="lib-'+results[x].id+'" style="background: url(/v1/images/bullets/bulletb'+num+'.png) no-repeat top left; padding-left:25px;">'+results[x].title+'</li>');}else{marker.setIcon('/v1/images/markers/iconr'+num+'.png',[20,34],[10,34]);libraryResults.append('<li id="lib-'+results[x].id+'" style="background: url(/v1/images/bullets/bulletr'+num+'.png) no-repeat top left; padding-left:25px;">'+results[x].title+'</li>');}
mapstract.addMarker(marker);}
$('li',libraryResults).each(function(i){$(this).css('cursor','pointer').hover(function(){$(this).addClass('hover');highlight_marker(i);},function(){$(this).removeClass('hover');show_all_markers();});});if(results[0])humanMsg.displayMsg('Your nearest library is<br /><strong>'+results[0].title+'</strong>');}});}
function mark_book_available(library_id)
{$('#lib-'+library_id,libraryResults).css('background-image','url(/v1/images/tick.png)').attr('availability','available');}
function mark_book_on_loan(library_id)
{$('#lib-'+library_id,libraryResults).css('background-image','url(/v1/images/on_loan.png)').attr('availability','on loan');}
function mark_book_no_record(library_id)
{$('#lib-'+library_id,libraryResults).css('background-image','url(/v1/images/cross.png)').attr('availability','no record');}
function mark_book_unknown(library_id)
{$('#lib-'+library_id,libraryResults).css('background-image','url(/v1/images/error.png)').attr('availability','unknown');}
function highlight_marker(number){for(var x in markers){if(x==number)continue;markers[x].hide();}
var message=''
var selectedLibrary=$('li',libraryResults).get(number);message=$(selectedLibrary).text();if($(selectedLibrary).attr('availability')){message+='<br /><strong>'+$(selectedLibrary).attr('availability')+'</strong>';}
humanMsg.displayMsg(message,false);}
function show_all_markers(){for(var x in markers){markers[x].show();}
humanMsg.removeMsg();}
function geocode_return(geocoded_location){mapstract.setCenter(geocoded_location.point);navigatePoint(geocoded_location.point);var address=[];if(geocoded_location.street!=''){address.push(geocoded_location.street);}
if(geocoded_location.locality!=''){address.push(geocoded_location.locality);}
if(geocoded_location.region!=''){address.push(geocoded_location.region);}
centreMarker.setLabel(address.join(', '));mapstract.removeMarker(centreMarker);mapstract.addMarker(centreMarker);}
function find_address()
{var address_value=$('#address').val();if(!address_value||address_value==$('#address').attr('title')){return;}
var address=new Object();address.address=address_value+', London, UK';geocoder.geocode(address);}
function find_book()
{var book=$('#book').val();if(!book||book==$('#book').attr('title')){return;}
if(availability_check_in_progress()){$.prompt('Availability check is currently in progress. Cancel current check?',{buttons:{Yes:true,No:false},overlayspeed:1,promptspeed:1,callback:function(v,m){if(v){abort_library_requests();deselect_book();fetch_books(book);}}});}else{fetch_books(book);}}
function fetch_books(query)
{var url="http://ajax.googleapis.com/ajax/services/search/books?v=1.0&q="+encodeURIComponent(query)+"&rsz=large&callback=?";var book;var isbnMatch;var isbnRegex=new RegExp("^ISBN(.+)");selectedBook=null;bookResults=[];$('#book-carousel-object').css('visibility','hidden');jQuery.getJSON(url,function(json){if(json.responseStatus==200){for(var x in json.responseData.results){book=json.responseData.results[x];isbnMatch=isbnRegex.exec(book.bookId);if(isbnMatch){book.isbn=isbnMatch[1];book.title=book.titleNoFormatting;bookResults.push(book);}}
bookResults.sort(function(a,b){if(a.tbUrl.substring(36)=='nocover.png'&&b.tbUrl.substr(36)!='nocover.png'){return 1;}else if(b.tbUrl.substring(36)=='nocover.png'&&a.tbUrl.substr(36)!='nocover.png'){return-1;}else{return 0;}});load_book_results('Book search results');}});}
function load_featured_books()
{if(!featuredBooks){return;}
selectedBook=null;bookResults=[];bookResults=featuredBooks;load_book_results('Featured books');}
function load_book_results(title)
{var bookIndex;$('#book-carousel-object').empty();$('#book-carousel-object').append('<h4>'+title+'</h4>');$('#book-carousel-object').append('<ul id="book-carousel" class="jcarousel-skin-tango"></ul>').draggable({containment:'#book-carousel-area',delay:20});for(bookIndex in bookResults){bookResults[bookIndex].bookIndex=bookIndex;book=bookResults[bookIndex];$('#book-carousel').append('<li><a href="javascript:check_availability('+bookIndex+');"><img src="'+book.tbUrl+'" title="'+book.title+'" /></a></li>');}
$('#book-carousel li a').each(function(i){$(this).hover(function(){humanMsg.displayMsg(bookResults[i].title+'<br /><span class="author">by '+$('<p>'+bookResults[i].authors+'</p>').text()+'</span>',false);highlight_book(i);},function(){humanMsg.removeMsg()
show_all_books();});});if(bookResults.length>=1){$('#book-carousel').jcarousel({size:bookResults.length});humanMsg.displayMsg('Click on a book cover to check availability');$('#book-carousel-object').css('visibility','visible');}else{humanMsg.displayMsg('Sorry, no books found');}}
function restrict_map_movement()
{var allowedBounds=new BoundingBox(51.27,-0.54,51.711,0.321);if(allowedBounds.contains(mapstract.getCenter())){return;}
var C=mapstract.getCenter();var X=C.lng;var Y=C.lat;var AmaxX=allowedBounds.getNorthEast().lng;var AmaxY=allowedBounds.getNorthEast().lat;var AminX=allowedBounds.getSouthWest().lng;var AminY=allowedBounds.getSouthWest().lat;if(X<AminX){X=AminX;}
if(X>AmaxX){X=AmaxX;}
if(Y<AminY){Y=AminY;}
if(Y>AmaxY){Y=AmaxY;}
mapstract.setCenter(new LatLonPoint(Y,X));}
function pointFromString(point){return new LatLonPoint(point.split(',')[0],point.split(',')[1]);}
function navigatePoint(p){try{YAHOO.util.History.navigate("point",p.lat+','+p.lng);}catch(e){mark_centre_point(p);mark_libraries(p);}}
function initialize(){var currentPoint=YAHOO.util.History.getCurrentState("point");if(currentPoint){initialPoint=pointFromString(currentPoint);}
$('input[title!=""]').hint();ajaxManager=$.manageAjax({manageType:'sync',maxReq:1,dataType:'jsonp'});$.ajaxSetup({dataType:'jsonp'});$.preload(['ajax-loader.gif','ajax-loader-small.gif','tick.png','cross.png','error.png','on_loan.png','markers/iconb1.png','markers/iconb2.png','markers/iconb3.png','markers/iconb4.png','markers/iconb5.png','markers/iconr1.png','markers/iconr2.png','markers/iconr3.png','markers/iconr4.png','markers/iconr5.png','bullets/bulletb1.png','bullets/bulletb2.png','bullets/bulletb3.png','bullets/bulletb4.png','bullets/bulletb5.png','bullets/bulletr1.png','bullets/bulletr2.png','bullets/bulletr3.png','bullets/bulletr4.png','bullets/bulletr5.png'],{base:'/v1/images/'});window.alert=function(msg){humanMsg.displayMsg(msg);};load_featured_books();$('#loader').ajaxStart(function(){$(this).show();});$('#loader').ajaxStop(function(){$(this).hide();});geocoder=new MapstractionGeocoder(function(geocoded_location){if(availability_check_in_progress()){$.prompt('Availability check is currently in progress. Cancel current check?',{buttons:{Yes:true,No:false},overlayspeed:1,promptspeed:1,callback:function(v,m){if(v){abort_library_requests();deselect_book();geocode_return(geocoded_location);}}});}else{geocode_return(geocoded_location);}},'google');mapstract=new Mapstraction('map','google');mapstract.setCenterAndZoom(initialPoint,12);setTimeout(function(){mapstract.setZoom(mapstract.getZoom());},500);libraryResults=$('#library-results ol');mapstract.addControls({zoom:'large',scale:true});mapstract.getMap().getDragObject().setDraggableCursor("pointer");GEvent.addListener(mapstract.getMap(),"move",function(){restrict_map_movement();});mapstract.addEventListener('click',function(p){if(availability_check_in_progress()){$.prompt('Availability check is currently in progress. Cancel current check?',{buttons:{Yes:true,No:false},overlayspeed:1,promptspeed:1,callback:function(v,m){if(v){abort_library_requests();deselect_book();navigatePoint(p);}}});}else{navigatePoint(p);}});if(bookmarkedPoint){mapstract.setCenter(initialPoint);mark_centre_point(initialPoint);mark_libraries(initialPoint);}else{setTimeout(function(){humanMsg.displayMsg('Click on the map to see nearby libraries');},1500);}}
$(document).ready(function(){bookmarkedPoint=YAHOO.util.History.getBookmarkedState("point");initialPoint=bookmarkedPoint||"51.5074,-0.1091";YAHOO.util.History.register("point",initialPoint,function(point){point=pointFromString(point);mark_centre_point(point);mark_libraries(point);});initialPoint=pointFromString(initialPoint);YAHOO.util.History.onReady(function(){initialize();});try{YAHOO.util.History.initialize("yui-history-field","yui-history-iframe");}catch(e){initialize();}});