/*
 * jQuery JavaScript Library v1.3.2
 * http://jquery.com/
 *
 * Copyright (c) 2009 John Resig
 * Dual licensed under the MIT and GPL licenses.
 * http://docs.jquery.com/License
 *
 * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
 * Revision: 6246
 */
(function(){var window=this,undefined,_jQuery=window.jQuery,_$=window.$,jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context)
},quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,isSimple=/^.[^:#\[\.,]*$/;
jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;
if(selector.nodeType){this[0]=selector;
this.length=1;
this.context=selector;
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&&elem.id!=match[3]){return jQuery().find(selector)
}var ret=jQuery(elem||[]);
ret.context=document;
ret.selector=selector;
return ret
}}else{return jQuery(context).find(selector)
}}else{if(jQuery.isFunction(selector)){return jQuery(document).ready(selector)
}}if(selector.selector&&selector.context){this.selector=selector.selector;
this.context=selector.context
}return this.setArray(jQuery.isArray(selector)?selector:jQuery.makeArray(selector))
},selector:"",jquery:"1.3.2",size:function(){return this.length
},get:function(num){return num===undefined?Array.prototype.slice.call(this):this[num]
},pushStack:function(elems,name,selector){var ret=jQuery(elems);
ret.prevObject=this;
ret.context=this.context;
if(name==="find"){ret.selector=this.selector+(this.selector?" ":"")+selector
}else{if(name){ret.selector=this.selector+"."+name+"("+selector+")"
}}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){return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this)
},attr:function(name,value,type){var options=name;
if(typeof name==="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]){var wrap=jQuery(html,this[0].ownerDocument).clone();
if(this[0].parentNode){wrap.insertBefore(this[0])
}wrap.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,function(elem){if(this.nodeType==1){this.appendChild(elem)
}})
},prepend:function(){return this.domManip(arguments,true,function(elem){if(this.nodeType==1){this.insertBefore(elem,this.firstChild)
}})
},before:function(){return this.domManip(arguments,false,function(elem){this.parentNode.insertBefore(elem,this)
})
},after:function(){return this.domManip(arguments,false,function(elem){this.parentNode.insertBefore(elem,this.nextSibling)
})
},end:function(){return this.prevObject||jQuery([])
},push:[].push,sort:[].sort,splice:[].splice,find:function(selector){if(this.length===1){var ret=this.pushStack([],"find",selector);
ret.length=0;
jQuery.find(selector,this[0],ret);
return ret
}else{return this.pushStack(jQuery.unique(jQuery.map(this,function(elem){return jQuery.find(selector,elem)
})),"find",selector)
}},clone:function(events){var ret=this.map(function(){if(!jQuery.support.noCloneEvent&&!jQuery.isXMLDoc(this)){var html=this.outerHTML;
if(!html){var div=this.ownerDocument.createElement("div");
div.appendChild(this.cloneNode(true));
html=div.innerHTML
}return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]
}else{return this.cloneNode(true)
}});
if(events===true){var orig=this.find("*").andSelf(),i=0;
ret.find("*").andSelf().each(function(){if(this.nodeName!==orig[i].nodeName){return 
}var events=jQuery.data(orig[i],"events");
for(var type in events){for(var handler in events[type]){jQuery.event.add(this,type,events[type][handler],events[type][handler].data)
}}i++
})
}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,jQuery.grep(this,function(elem){return elem.nodeType===1
})),"filter",selector)
},closest:function(selector){var pos=jQuery.expr.match.POS.test(selector)?jQuery(selector):null,closer=0;
return this.map(function(){var cur=this;
while(cur&&cur.ownerDocument){if(pos?pos.index(cur)>-1:jQuery(cur).is(selector)){jQuery.data(cur,"closest",closer);
return cur
}cur=cur.parentNode;
closer++
}})
},not:function(selector){if(typeof selector==="string"){if(isSimple.test(selector)){return this.pushStack(jQuery.multiFilter(selector,this,true),"not",selector)
}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 !!selector&&this.is("."+selector)
},val:function(value){if(value===undefined){var elem=this[0];
if(elem){if(jQuery.nodeName(elem,"option")){return(elem.attributes.value||{}).specified?elem.value:elem.text
}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(option).val();
if(one){return value
}values.push(value)
}}return values
}return(elem.value||"").replace(/\r/g,"")
}return undefined
}if(typeof value==="number"){value+=""
}return this.each(function(){if(this.nodeType!=1){return 
}if(jQuery.isArray(value)&&/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.replace(/ jQuery\d+="(?:\d+|null)"/g,""):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),"slice",Array.prototype.slice.call(arguments).join(","))
},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)
},domManip:function(args,table,callback){if(this[0]){var fragment=(this[0].ownerDocument||this[0]).createDocumentFragment(),scripts=jQuery.clean(args,(this[0].ownerDocument||this[0]),fragment),first=fragment.firstChild;
if(first){for(var i=0,l=this.length;
i<l;
i++){callback.call(root(this[i],first),this.length>1||i>0?fragment.cloneNode(true):fragment)
}}if(scripts){jQuery.each(scripts,evalScript)
}}return this;
function root(elem,cur){return table&&jQuery.nodeName(elem,"table")&&jQuery.nodeName(cur,"tr")?(elem.getElementsByTagName("tbody")[0]||elem.appendChild(elem.ownerDocument.createElement("tbody"))):elem
}}};
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(typeof target==="boolean"){deep=target;
target=arguments[1]||{};
i=2
}if(typeof target!=="object"&&!jQuery.isFunction(target)){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 exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{},toString=Object.prototype.toString;
jQuery.extend({noConflict:function(deep){window.$=_$;
if(deep){window.jQuery=_jQuery
}return jQuery
},isFunction:function(obj){return toString.call(obj)==="[object Function]"
},isArray:function(obj){return toString.call(obj)==="[object Array]"
},isXMLDoc:function(elem){return elem.nodeType===9&&elem.documentElement.nodeName!=="HTML"||!!elem.ownerDocument&&jQuery.isXMLDoc(elem.ownerDocument)
},globalEval:function(data){if(data&&/\S/.test(data)){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");
script.type="text/javascript";
if(jQuery.support.scriptEval){script.appendChild(document.createTextNode(data))
}else{script.text=data
}head.insertBefore(script,head.firstChild);
head.removeChild(script)
}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase()
},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 typeof value==="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 elem&&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,extra){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;
if(extra==="border"){return 
}jQuery.each(which,function(){if(!extra){val-=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0
}if(extra==="margin"){val+=parseFloat(jQuery.curCSS(elem,"margin"+this,true))||0
}else{val-=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0
}})
}if(elem.offsetWidth!==0){getWH()
}else{jQuery.swap(elem,props,getWH)
}return Math.max(0,Math.round(val))
}return jQuery.curCSS(elem,name,force)
},curCSS:function(elem,name,force){var ret,style=elem.style;
if(name=="opacity"&&!jQuery.support.opacity){ret=jQuery.attr(style,"opacity");
return ret==""?"1":ret
}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){ret=computedStyle.getPropertyValue(name)
}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,fragment){context=context||document;
if(typeof context.createElement==="undefined"){context=context.ownerDocument||context[0]&&context[0].ownerDocument||document
}if(!fragment&&elems.length===1&&typeof elems[0]==="string"){var match=/^<(\w+)\s*\/?>$/.exec(elems[0]);
if(match){return[context.createElement(match[1])]
}}var ret=[],scripts=[],div=context.createElement("div");
jQuery.each(elems,function(i,elem){if(typeof elem==="number"){elem+=""
}if(!elem){return 
}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=elem.replace(/^\s+/,"").substring(0,10).toLowerCase();
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.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];
div.innerHTML=wrap[1]+elem+wrap[2];
while(wrap[0]--){div=div.lastChild
}if(!jQuery.support.tbody){var hasBody=/<tbody/i.test(elem),tbody=!tags.indexOf("<table")&&!hasBody?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&!hasBody?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(!jQuery.support.leadingWhitespace&&/^\s/.test(elem)){div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild)
}elem=jQuery.makeArray(div.childNodes)
}if(elem.nodeType){ret.push(elem)
}else{ret=jQuery.merge(ret,elem)
}});
if(fragment){for(var i=0;
ret[i];
i++){if(jQuery.nodeName(ret[i],"script")&&(!ret[i].type||ret[i].type.toLowerCase()==="text/javascript")){scripts.push(ret[i].parentNode?ret[i].parentNode.removeChild(ret[i]):ret[i])
}else{if(ret[i].nodeType===1){ret.splice.apply(ret,[i+1,0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))))
}fragment.appendChild(ret[i])
}}return scripts
}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;
name=notxml&&jQuery.props[name]||name;
if(elem.tagName){var special=/href|src|style/.test(name);
if(name=="selected"&&elem.parentNode){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
}if(name=="tabIndex"){var attributeNode=elem.getAttributeNode("tabIndex");
return attributeNode&&attributeNode.specified?attributeNode.value:elem.nodeName.match(/(button|input|object|select|textarea)/i)?0:elem.nodeName.match(/^(a|area)$/i)&&elem.href?0:undefined
}return elem[name]
}if(!jQuery.support.style&&notxml&&name=="style"){return jQuery.attr(elem.style,"cssText",value)
}if(set){elem.setAttribute(name,""+value)
}var attr=!jQuery.support.hrefNormalized&&notxml&&special?elem.getAttribute(name,2):elem.getAttribute(name);
return attr===null?undefined:attr
}if(!jQuery.support.opacity&&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||typeof array==="string"||jQuery.isFunction(array)||array.setInterval){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.support.getAll){while((elem=second[i++])!=null){if(elem.nodeType!=8){first[pos++]=elem
}}}else{while((elem=second[i++])!=null){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.]+)/)||[0,"0"])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};
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),name,selector)
}
});
jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(selector){var ret=[],insert=jQuery(selector);
for(var i=0,l=insert.length;
i<l;
i++){var elems=(i>0?this.clone(true):this).get();
jQuery.fn[original].apply(jQuery(insert[i]),elems);
ret=ret.concat(elems)
}return this.pushStack(ret,name,selector)
}
});
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,state){if(typeof state!=="boolean"){state=!jQuery.className.has(this,classNames)
}jQuery.className[state?"add":"remove"](this,classNames)
},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).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).children().remove();
while(this.firstChild){this.removeChild(this.firstChild)
}}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments)
}
});
function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0
}var expando="jQuery"+now(),uuid=0,windowData={};
jQuery.extend({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]
}},queue:function(elem,type,data){if(elem){type=(type||"fx")+"queue";
var q=jQuery.data(elem,type);
if(!q||jQuery.isArray(data)){q=jQuery.data(elem,type,jQuery.makeArray(data))
}else{if(data){q.push(data)
}}}return q
},dequeue:function(elem,type){var queue=jQuery.queue(elem,type),fn=queue.shift();
if(!type||type==="fx"){fn=queue[0]
}if(fn!==undefined){fn.call(elem)
}}});
jQuery.fn.extend({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)
})
},queue:function(type,data){if(typeof type!=="string"){data=type;
type="fx"
}if(data===undefined){return jQuery.queue(this[0],type)
}return this.each(function(){var queue=jQuery.queue(this,type,data);
if(type=="fx"&&queue.length==1){queue[0].call(this)
}})
},dequeue:function(type){return this.each(function(){jQuery.dequeue(this,type)
})
}});
/*
 * Sizzle CSS Selector Engine - v0.9.3
 *  Copyright 2009, The Dojo Foundation
 *  Released under the MIT, BSD, and GPL Licenses.
 *  More information: http://sizzlejs.com/
 */
(function(){var chunker=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,done=0,toString=Object.prototype.toString;
var Sizzle=function(selector,context,results,seed){results=results||[];
context=context||document;
if(context.nodeType!==1&&context.nodeType!==9){return[]
}if(!selector||typeof selector!=="string"){return results
}var parts=[],m,set,checkSet,check,mode,extra,prune=true;
chunker.lastIndex=0;
while((m=chunker.exec(selector))!==null){parts.push(m[1]);
if(m[2]){extra=RegExp.rightContext;
break
}}if(parts.length>1&&origPOS.exec(selector)){if(parts.length===2&&Expr.relative[parts[0]]){set=posProcess(parts[0]+parts[1],context)
}else{set=Expr.relative[parts[0]]?[context]:Sizzle(parts.shift(),context);
while(parts.length){selector=parts.shift();
if(Expr.relative[selector]){selector+=parts.shift()
}set=posProcess(selector,set)
}}}else{var ret=seed?{expr:parts.pop(),set:makeArray(seed)}:Sizzle.find(parts.pop(),parts.length===1&&context.parentNode?context.parentNode:context,isXML(context));
set=Sizzle.filter(ret.expr,ret.set);
if(parts.length>0){checkSet=makeArray(set)
}else{prune=false
}while(parts.length){var cur=parts.pop(),pop=cur;
if(!Expr.relative[cur]){cur=""
}else{pop=parts.pop()
}if(pop==null){pop=context
}Expr.relative[cur](checkSet,pop,isXML(context))
}}if(!checkSet){checkSet=set
}if(!checkSet){throw"Syntax error, unrecognized expression: "+(cur||selector)
}if(toString.call(checkSet)==="[object Array]"){if(!prune){results.push.apply(results,checkSet)
}else{if(context.nodeType===1){for(var i=0;
checkSet[i]!=null;
i++){if(checkSet[i]&&(checkSet[i]===true||checkSet[i].nodeType===1&&contains(context,checkSet[i]))){results.push(set[i])
}}}else{for(var i=0;
checkSet[i]!=null;
i++){if(checkSet[i]&&checkSet[i].nodeType===1){results.push(set[i])
}}}}}else{makeArray(checkSet,results)
}if(extra){Sizzle(extra,context,results,seed);
if(sortOrder){hasDuplicate=false;
results.sort(sortOrder);
if(hasDuplicate){for(var i=1;
i<results.length;
i++){if(results[i]===results[i-1]){results.splice(i--,1)
}}}}}return results
};
Sizzle.matches=function(expr,set){return Sizzle(expr,null,null,set)
};
Sizzle.find=function(expr,context,isXML){var set,match;
if(!expr){return[]
}for(var i=0,l=Expr.order.length;
i<l;
i++){var type=Expr.order[i],match;
if((match=Expr.match[type].exec(expr))){var left=RegExp.leftContext;
if(left.substr(left.length-1)!=="\\"){match[1]=(match[1]||"").replace(/\\/g,"");
set=Expr.find[type](match,context,isXML);
if(set!=null){expr=expr.replace(Expr.match[type],"");
break
}}}}if(!set){set=context.getElementsByTagName("*")
}return{set:set,expr:expr}
};
Sizzle.filter=function(expr,set,inplace,not){var old=expr,result=[],curLoop=set,match,anyFound,isXMLFilter=set&&set[0]&&isXML(set[0]);
while(expr&&set.length){for(var type in Expr.filter){if((match=Expr.match[type].exec(expr))!=null){var filter=Expr.filter[type],found,item;
anyFound=false;
if(curLoop==result){result=[]
}if(Expr.preFilter[type]){match=Expr.preFilter[type](match,curLoop,inplace,result,not,isXMLFilter);
if(!match){anyFound=found=true
}else{if(match===true){continue
}}}if(match){for(var i=0;
(item=curLoop[i])!=null;
i++){if(item){found=filter(item,match,i,curLoop);
var pass=not^!!found;
if(inplace&&found!=null){if(pass){anyFound=true
}else{curLoop[i]=false
}}else{if(pass){result.push(item);
anyFound=true
}}}}}if(found!==undefined){if(!inplace){curLoop=result
}expr=expr.replace(Expr.match[type],"");
if(!anyFound){return[]
}break
}}}if(expr==old){if(anyFound==null){throw"Syntax error, unrecognized expression: "+expr
}else{break
}}old=expr
}return curLoop
};
var Expr=Sizzle.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(elem){return elem.getAttribute("href")
}},relative:{"+":function(checkSet,part,isXML){var isPartStr=typeof part==="string",isTag=isPartStr&&!/\W/.test(part),isPartStrNotTag=isPartStr&&!isTag;
if(isTag&&!isXML){part=part.toUpperCase()
}for(var i=0,l=checkSet.length,elem;
i<l;
i++){if((elem=checkSet[i])){while((elem=elem.previousSibling)&&elem.nodeType!==1){}checkSet[i]=isPartStrNotTag||elem&&elem.nodeName===part?elem||false:elem===part
}}if(isPartStrNotTag){Sizzle.filter(part,checkSet,true)
}},">":function(checkSet,part,isXML){var isPartStr=typeof part==="string";
if(isPartStr&&!/\W/.test(part)){part=isXML?part:part.toUpperCase();
for(var i=0,l=checkSet.length;
i<l;
i++){var elem=checkSet[i];
if(elem){var parent=elem.parentNode;
checkSet[i]=parent.nodeName===part?parent:false
}}}else{for(var i=0,l=checkSet.length;
i<l;
i++){var elem=checkSet[i];
if(elem){checkSet[i]=isPartStr?elem.parentNode:elem.parentNode===part
}}if(isPartStr){Sizzle.filter(part,checkSet,true)
}}},"":function(checkSet,part,isXML){var doneName=done++,checkFn=dirCheck;
if(!part.match(/\W/)){var nodeCheck=part=isXML?part:part.toUpperCase();
checkFn=dirNodeCheck
}checkFn("parentNode",part,doneName,checkSet,nodeCheck,isXML)
},"~":function(checkSet,part,isXML){var doneName=done++,checkFn=dirCheck;
if(typeof part==="string"&&!part.match(/\W/)){var nodeCheck=part=isXML?part:part.toUpperCase();
checkFn=dirNodeCheck
}checkFn("previousSibling",part,doneName,checkSet,nodeCheck,isXML)
}},find:{ID:function(match,context,isXML){if(typeof context.getElementById!=="undefined"&&!isXML){var m=context.getElementById(match[1]);
return m?[m]:[]
}},NAME:function(match,context,isXML){if(typeof context.getElementsByName!=="undefined"){var ret=[],results=context.getElementsByName(match[1]);
for(var i=0,l=results.length;
i<l;
i++){if(results[i].getAttribute("name")===match[1]){ret.push(results[i])
}}return ret.length===0?null:ret
}},TAG:function(match,context){return context.getElementsByTagName(match[1])
}},preFilter:{CLASS:function(match,curLoop,inplace,result,not,isXML){match=" "+match[1].replace(/\\/g,"")+" ";
if(isXML){return match
}for(var i=0,elem;
(elem=curLoop[i])!=null;
i++){if(elem){if(not^(elem.className&&(" "+elem.className+" ").indexOf(match)>=0)){if(!inplace){result.push(elem)
}}else{if(inplace){curLoop[i]=false
}}}}return false
},ID:function(match){return match[1].replace(/\\/g,"")
},TAG:function(match,curLoop){for(var i=0;
curLoop[i]===false;
i++){}return curLoop[i]&&isXML(curLoop[i])?match[1]:match[1].toUpperCase()
},CHILD:function(match){if(match[1]=="nth"){var test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(match[2]=="even"&&"2n"||match[2]=="odd"&&"2n+1"||!/\D/.test(match[2])&&"0n+"+match[2]||match[2]);
match[2]=(test[1]+(test[2]||1))-0;
match[3]=test[3]-0
}match[0]=done++;
return match
},ATTR:function(match,curLoop,inplace,result,not,isXML){var name=match[1].replace(/\\/g,"");
if(!isXML&&Expr.attrMap[name]){match[1]=Expr.attrMap[name]
}if(match[2]==="~="){match[4]=" "+match[4]+" "
}return match
},PSEUDO:function(match,curLoop,inplace,result,not){if(match[1]==="not"){if(match[3].match(chunker).length>1||/^\w/.test(match[3])){match[3]=Sizzle(match[3],null,null,curLoop)
}else{var ret=Sizzle.filter(match[3],curLoop,inplace,true^not);
if(!inplace){result.push.apply(result,ret)
}return false
}}else{if(Expr.match.POS.test(match[0])||Expr.match.CHILD.test(match[0])){return true
}}return match
},POS:function(match){match.unshift(true);
return match
}},filters:{enabled:function(elem){return elem.disabled===false&&elem.type!=="hidden"
},disabled:function(elem){return elem.disabled===true
},checked:function(elem){return elem.checked===true
},selected:function(elem){elem.parentNode.selectedIndex;
return elem.selected===true
},parent:function(elem){return !!elem.firstChild
},empty:function(elem){return !elem.firstChild
},has:function(elem,i,match){return !!Sizzle(match[3],elem).length
},header:function(elem){return/h\d/i.test(elem.nodeName)
},text:function(elem){return"text"===elem.type
},radio:function(elem){return"radio"===elem.type
},checkbox:function(elem){return"checkbox"===elem.type
},file:function(elem){return"file"===elem.type
},password:function(elem){return"password"===elem.type
},submit:function(elem){return"submit"===elem.type
},image:function(elem){return"image"===elem.type
},reset:function(elem){return"reset"===elem.type
},button:function(elem){return"button"===elem.type||elem.nodeName.toUpperCase()==="BUTTON"
},input:function(elem){return/input|select|textarea|button/i.test(elem.nodeName)
}},setFilters:{first:function(elem,i){return i===0
},last:function(elem,i,match,array){return i===array.length-1
},even:function(elem,i){return i%2===0
},odd:function(elem,i){return i%2===1
},lt:function(elem,i,match){return i<match[3]-0
},gt:function(elem,i,match){return i>match[3]-0
},nth:function(elem,i,match){return match[3]-0==i
},eq:function(elem,i,match){return match[3]-0==i
}},filter:{PSEUDO:function(elem,match,i,array){var name=match[1],filter=Expr.filters[name];
if(filter){return filter(elem,i,match,array)
}else{if(name==="contains"){return(elem.textContent||elem.innerText||"").indexOf(match[3])>=0
}else{if(name==="not"){var not=match[3];
for(var i=0,l=not.length;
i<l;
i++){if(not[i]===elem){return false
}}return true
}}}},CHILD:function(elem,match){var type=match[1],node=elem;
switch(type){case"only":case"first":while(node=node.previousSibling){if(node.nodeType===1){return false
}}if(type=="first"){return true
}node=elem;
case"last":while(node=node.nextSibling){if(node.nodeType===1){return false
}}return true;
case"nth":var first=match[2],last=match[3];
if(first==1&&last==0){return true
}var doneName=match[0],parent=elem.parentNode;
if(parent&&(parent.sizcache!==doneName||!elem.nodeIndex)){var count=0;
for(node=parent.firstChild;
node;
node=node.nextSibling){if(node.nodeType===1){node.nodeIndex=++count
}}parent.sizcache=doneName
}var diff=elem.nodeIndex-last;
if(first==0){return diff==0
}else{return(diff%first==0&&diff/first>=0)
}}},ID:function(elem,match){return elem.nodeType===1&&elem.getAttribute("id")===match
},TAG:function(elem,match){return(match==="*"&&elem.nodeType===1)||elem.nodeName===match
},CLASS:function(elem,match){return(" "+(elem.className||elem.getAttribute("class"))+" ").indexOf(match)>-1
},ATTR:function(elem,match){var name=match[1],result=Expr.attrHandle[name]?Expr.attrHandle[name](elem):elem[name]!=null?elem[name]:elem.getAttribute(name),value=result+"",type=match[2],check=match[4];
return result==null?type==="!=":type==="="?value===check:type==="*="?value.indexOf(check)>=0:type==="~="?(" "+value+" ").indexOf(check)>=0:!check?value&&result!==false:type==="!="?value!=check:type==="^="?value.indexOf(check)===0:type==="$="?value.substr(value.length-check.length)===check:type==="|="?value===check||value.substr(0,check.length+1)===check+"-":false
},POS:function(elem,match,i,array){var name=match[2],filter=Expr.setFilters[name];
if(filter){return filter(elem,i,match,array)
}}}};
var origPOS=Expr.match.POS;
for(var type in Expr.match){Expr.match[type]=RegExp(Expr.match[type].source+/(?![^\[]*\])(?![^\(]*\))/.source)
}var makeArray=function(array,results){array=Array.prototype.slice.call(array);
if(results){results.push.apply(results,array);
return results
}return array
};
try{Array.prototype.slice.call(document.documentElement.childNodes)
}catch(e){makeArray=function(array,results){var ret=results||[];
if(toString.call(array)==="[object Array]"){Array.prototype.push.apply(ret,array)
}else{if(typeof array.length==="number"){for(var i=0,l=array.length;
i<l;
i++){ret.push(array[i])
}}else{for(var i=0;
array[i];
i++){ret.push(array[i])
}}}return ret
}
}var sortOrder;
if(document.documentElement.compareDocumentPosition){sortOrder=function(a,b){var ret=a.compareDocumentPosition(b)&4?-1:a===b?0:1;
if(ret===0){hasDuplicate=true
}return ret
}
}else{if("sourceIndex" in document.documentElement){sortOrder=function(a,b){var ret=a.sourceIndex-b.sourceIndex;
if(ret===0){hasDuplicate=true
}return ret
}
}else{if(document.createRange){sortOrder=function(a,b){var aRange=a.ownerDocument.createRange(),bRange=b.ownerDocument.createRange();
aRange.selectNode(a);
aRange.collapse(true);
bRange.selectNode(b);
bRange.collapse(true);
var ret=aRange.compareBoundaryPoints(Range.START_TO_END,bRange);
if(ret===0){hasDuplicate=true
}return ret
}
}}}(function(){var form=document.createElement("form"),id="script"+(new Date).getTime();
form.innerHTML="<input name='"+id+"'/>";
var root=document.documentElement;
root.insertBefore(form,root.firstChild);
if(!!document.getElementById(id)){Expr.find.ID=function(match,context,isXML){if(typeof context.getElementById!=="undefined"&&!isXML){var m=context.getElementById(match[1]);
return m?m.id===match[1]||typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id").nodeValue===match[1]?[m]:undefined:[]
}};
Expr.filter.ID=function(elem,match){var node=typeof elem.getAttributeNode!=="undefined"&&elem.getAttributeNode("id");
return elem.nodeType===1&&node&&node.nodeValue===match
}
}root.removeChild(form)
})();
(function(){var div=document.createElement("div");
div.appendChild(document.createComment(""));
if(div.getElementsByTagName("*").length>0){Expr.find.TAG=function(match,context){var results=context.getElementsByTagName(match[1]);
if(match[1]==="*"){var tmp=[];
for(var i=0;
results[i];
i++){if(results[i].nodeType===1){tmp.push(results[i])
}}results=tmp
}return results
}
}div.innerHTML="<a href='#'></a>";
if(div.firstChild&&typeof div.firstChild.getAttribute!=="undefined"&&div.firstChild.getAttribute("href")!=="#"){Expr.attrHandle.href=function(elem){return elem.getAttribute("href",2)
}
}})();
if(document.querySelectorAll){(function(){var oldSizzle=Sizzle,div=document.createElement("div");
div.innerHTML="<p class='TEST'></p>";
if(div.querySelectorAll&&div.querySelectorAll(".TEST").length===0){return 
}Sizzle=function(query,context,extra,seed){context=context||document;
if(!seed&&context.nodeType===9&&!isXML(context)){try{return makeArray(context.querySelectorAll(query),extra)
}catch(e){}}return oldSizzle(query,context,extra,seed)
};
Sizzle.find=oldSizzle.find;
Sizzle.filter=oldSizzle.filter;
Sizzle.selectors=oldSizzle.selectors;
Sizzle.matches=oldSizzle.matches
})()
}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var div=document.createElement("div");
div.innerHTML="<div class='test e'></div><div class='test'></div>";
if(div.getElementsByClassName("e").length===0){return 
}div.lastChild.className="e";
if(div.getElementsByClassName("e").length===1){return 
}Expr.order.splice(1,0,"CLASS");
Expr.find.CLASS=function(match,context,isXML){if(typeof context.getElementsByClassName!=="undefined"&&!isXML){return context.getElementsByClassName(match[1])
}}
})()
}function dirNodeCheck(dir,cur,doneName,checkSet,nodeCheck,isXML){var sibDir=dir=="previousSibling"&&!isXML;
for(var i=0,l=checkSet.length;
i<l;
i++){var elem=checkSet[i];
if(elem){if(sibDir&&elem.nodeType===1){elem.sizcache=doneName;
elem.sizset=i
}elem=elem[dir];
var match=false;
while(elem){if(elem.sizcache===doneName){match=checkSet[elem.sizset];
break
}if(elem.nodeType===1&&!isXML){elem.sizcache=doneName;
elem.sizset=i
}if(elem.nodeName===cur){match=elem;
break
}elem=elem[dir]
}checkSet[i]=match
}}}function dirCheck(dir,cur,doneName,checkSet,nodeCheck,isXML){var sibDir=dir=="previousSibling"&&!isXML;
for(var i=0,l=checkSet.length;
i<l;
i++){var elem=checkSet[i];
if(elem){if(sibDir&&elem.nodeType===1){elem.sizcache=doneName;
elem.sizset=i
}elem=elem[dir];
var match=false;
while(elem){if(elem.sizcache===doneName){match=checkSet[elem.sizset];
break
}if(elem.nodeType===1){if(!isXML){elem.sizcache=doneName;
elem.sizset=i
}if(typeof cur!=="string"){if(elem===cur){match=true;
break
}}else{if(Sizzle.filter(cur,[elem]).length>0){match=elem;
break
}}}elem=elem[dir]
}checkSet[i]=match
}}}var contains=document.compareDocumentPosition?function(a,b){return a.compareDocumentPosition(b)&16
}:function(a,b){return a!==b&&(a.contains?a.contains(b):true)
};
var isXML=function(elem){return elem.nodeType===9&&elem.documentElement.nodeName!=="HTML"||!!elem.ownerDocument&&isXML(elem.ownerDocument)
};
var posProcess=function(selector,context){var tmpSet=[],later="",match,root=context.nodeType?[context]:context;
while((match=Expr.match.PSEUDO.exec(selector))){later+=match[0];
selector=selector.replace(Expr.match.PSEUDO,"")
}selector=Expr.relative[selector]?selector+"*":selector;
for(var i=0,l=root.length;
i<l;
i++){Sizzle(selector,root[i],tmpSet)
}return Sizzle.filter(later,tmpSet)
};
jQuery.find=Sizzle;
jQuery.filter=Sizzle.filter;
jQuery.expr=Sizzle.selectors;
jQuery.expr[":"]=jQuery.expr.filters;
Sizzle.selectors.filters.hidden=function(elem){return elem.offsetWidth===0||elem.offsetHeight===0
};
Sizzle.selectors.filters.visible=function(elem){return elem.offsetWidth>0||elem.offsetHeight>0
};
Sizzle.selectors.filters.animated=function(elem){return jQuery.grep(jQuery.timers,function(fn){return elem===fn.elem
}).length
};
jQuery.multiFilter=function(expr,elems,not){if(not){expr=":not("+expr+")"
}return Sizzle.matches(expr,elems)
};
jQuery.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
};
jQuery.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
};
jQuery.sibling=function(n,elem){var r=[];
for(;
n;
n=n.nextSibling){if(n.nodeType==1&&n!=elem){r.push(n)
}}return r
};
return ;
window.Sizzle=Sizzle
})();
jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8){return 
}if(elem.setInterval&&elem!=window){elem=window
}if(!handler.guid){handler.guid=this.guid++
}if(data!==undefined){var fn=handler;
handler=this.proxy(fn);
handler.data=data
}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){return typeof jQuery!=="undefined"&&!jQuery.event.triggered?jQuery.event.handle.apply(arguments.callee.elem,arguments):undefined
});
handle.elem=elem;
jQuery.each(types.split(/\s+/),function(index,type){var namespaces=type.split(".");
type=namespaces.shift();
handler.type=namespaces.slice().sort().join(".");
var handlers=events[type];
if(jQuery.event.specialAll[type]){jQuery.event.specialAll[type].setup.call(elem,data,namespaces)
}if(!handlers){handlers=events[type]={};
if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem,data,namespaces)===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 namespaces=type.split(".");
type=namespaces.shift();
var namespace=RegExp("(^|\\.)"+namespaces.slice().sort().join(".*\\.")+"(\\.|$)");
if(events[type]){if(handler){delete events[type][handler.guid]
}else{for(var handle in events[type]){if(namespace.test(events[type][handle].type)){delete events[type][handle]
}}}if(jQuery.event.specialAll[type]){jQuery.event.specialAll[type].teardown.call(elem,namespaces)
}for(ret in events[type]){break
}if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem,namespaces)===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(event,data,elem,bubbling){var type=event.type||event;
if(!bubbling){event=typeof event==="object"?event[expando]?event:jQuery.extend(jQuery.Event(type),event):jQuery.Event(type);
if(type.indexOf("!")>=0){event.type=type=type.slice(0,-1);
event.exclusive=true
}if(!elem){event.stopPropagation();
if(this.global[type]){jQuery.each(jQuery.cache,function(){if(this.events&&this.events[type]){jQuery.event.trigger(event,data,this.handle.elem)
}})
}}if(!elem||elem.nodeType==3||elem.nodeType==8){return undefined
}event.result=undefined;
event.target=elem;
data=jQuery.makeArray(data);
data.unshift(event)
}event.currentTarget=elem;
var handle=jQuery.data(elem,"handle");
if(handle){handle.apply(elem,data)
}if((!elem[type]||(jQuery.nodeName(elem,"a")&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false){event.result=false
}if(!bubbling&&elem[type]&&!event.isDefaultPrevented()&&!(jQuery.nodeName(elem,"a")&&type=="click")){this.triggered=true;
try{elem[type]()
}catch(e){}}this.triggered=false;
if(!event.isPropagationStopped()){var parent=elem.parentNode||elem.ownerDocument;
if(parent){jQuery.event.trigger(event,data,parent,true)
}}},handle:function(event){var all,handlers;
event=arguments[0]=jQuery.event.fix(event||window.event);
event.currentTarget=this;
var namespaces=event.type.split(".");
event.type=namespaces.shift();
all=!namespaces.length&&!event.exclusive;
var namespace=RegExp("(^|\\.)"+namespaces.slice().sort().join(".*\\.")+"(\\.|$)");
handlers=(jQuery.data(this,"events")||{})[event.type];
for(var j in handlers){var handler=handlers[j];
if(all||namespace.test(handler.type)){event.handler=handler;
event.data=handler.data;
var ret=handler.apply(this,arguments);
if(ret!==undefined){event.result=ret;
if(ret===false){event.preventDefault();
event.stopPropagation()
}}if(event.isImmediatePropagationStopped()){break
}}}},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 toElement view wheelDelta which".split(" "),fix:function(event){if(event[expando]){return event
}var originalEvent=event;
event=jQuery.Event(originalEvent);
for(var i=this.props.length,prop;
i;
){prop=this.props[--i];
event[prop]=originalEvent[prop]
}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=proxy||function(){return fn.apply(this,arguments)
};
proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;
return proxy
},special:{ready:{setup:bindReady,teardown:function(){}}},specialAll:{live:{setup:function(selector,namespaces){jQuery.event.add(this,namespaces[0],liveHandler)
},teardown:function(namespaces){if(namespaces.length){var remove=0,name=RegExp("(^|\\.)"+namespaces[0]+"(\\.|$)");
jQuery.each((jQuery.data(this,"events").live||{}),function(){if(name.test(this.type)){remove++
}});
if(remove<1){jQuery.event.remove(this,namespaces[0],liveHandler)
}}}}}};
jQuery.Event=function(src){if(!this.preventDefault){return new jQuery.Event(src)
}if(src&&src.type){this.originalEvent=src;
this.type=src.type
}else{this.type=src
}this.timeStamp=now();
this[expando]=true
};
function returnFalse(){return false
}function returnTrue(){return true
}jQuery.Event.prototype={preventDefault:function(){this.isDefaultPrevented=returnTrue;
var e=this.originalEvent;
if(!e){return 
}if(e.preventDefault){e.preventDefault()
}e.returnValue=false
},stopPropagation:function(){this.isPropagationStopped=returnTrue;
var e=this.originalEvent;
if(!e){return 
}if(e.stopPropagation){e.stopPropagation()
}e.cancelBubble=true
},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=returnTrue;
this.stopPropagation()
},isDefaultPrevented:returnFalse,isPropagationStopped:returnFalse,isImmediatePropagationStopped:returnFalse};
var withinElement=function(event){var parent=event.relatedTarget;
while(parent&&parent!=this){try{parent=parent.parentNode
}catch(e){parent=this
}}if(parent!=this){event.type=event.data;
jQuery.event.handle.apply(this,arguments)
}};
jQuery.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(orig,fix){jQuery.event.special[fix]={setup:function(){jQuery.event.add(this,orig,withinElement,fix)
},teardown:function(){jQuery.event.remove(this,orig,withinElement)
}}
});
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){return this.each(function(){jQuery.event.trigger(type,data,this)
})
},triggerHandler:function(type,data){if(this[0]){var event=jQuery.Event(type);
event.preventDefault();
event.stopPropagation();
jQuery.event.trigger(event,data,this[0]);
return event.result
}},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.mouseenter(fnOver).mouseleave(fnOut)
},ready:function(fn){bindReady();
if(jQuery.isReady){fn.call(document,jQuery)
}else{jQuery.readyList.push(fn)
}return this
},live:function(type,fn){var proxy=jQuery.event.proxy(fn);
proxy.guid+=this.selector+type;
jQuery(document).bind(liveConvert(type,this.selector),this.selector,proxy);
return this
},die:function(type,fn){jQuery(document).unbind(liveConvert(type,this.selector),fn?{guid:fn.guid+this.selector+type}:null);
return this
}});
function liveHandler(event){var check=RegExp("(^|\\.)"+event.type+"(\\.|$)"),stop=true,elems=[];
jQuery.each(jQuery.data(this,"events").live||[],function(i,fn){if(check.test(fn.type)){var elem=jQuery(event.target).closest(fn.data)[0];
if(elem){elems.push({elem:elem,fn:fn})
}}});
elems.sort(function(a,b){return jQuery.data(a.elem,"closest")-jQuery.data(b.elem,"closest")
});
jQuery.each(elems,function(){if(this.fn.call(this.elem,event,this.fn.data)===false){return(stop=false)
}});
return stop
}function liveConvert(type,selector){return["live",type,selector.replace(/\./g,"`").replace(/ /g,"|")].join(".")
}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)
});
jQuery.readyList=null
}jQuery(document).triggerHandler("ready")
}}});
var readyBound=false;
function bindReady(){if(readyBound){return 
}readyBound=true;
if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);
jQuery.ready()
},false)
}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);
jQuery.ready()
}});
if(document.documentElement.doScroll&&window==window.top){(function(){if(jQuery.isReady){return 
}try{document.documentElement.doScroll("left")
}catch(error){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,mouseenter,mouseleave,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)
}
});
jQuery(window).bind("unload",function(){for(var id in jQuery.cache){if(id!=1&&jQuery.cache[id].handle){jQuery.event.remove(jQuery.cache[id].handle.elem)
}}});
(function(){jQuery.support={};
var root=document.documentElement,script=document.createElement("script"),div=document.createElement("div"),id="script"+(new Date).getTime();
div.style.display="none";
div.innerHTML='   <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';
var all=div.getElementsByTagName("*"),a=div.getElementsByTagName("a")[0];
if(!all||!all.length||!a){return 
}jQuery.support={leadingWhitespace:div.firstChild.nodeType==3,tbody:!div.getElementsByTagName("tbody").length,objectAll:!!div.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!div.getElementsByTagName("link").length,style:/red/.test(a.getAttribute("style")),hrefNormalized:a.getAttribute("href")==="/a",opacity:a.style.opacity==="0.5",cssFloat:!!a.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};
script.type="text/javascript";
try{script.appendChild(document.createTextNode("window."+id+"=1;"))
}catch(e){}root.insertBefore(script,root.firstChild);
if(window[id]){jQuery.support.scriptEval=true;
delete window[id]
}root.removeChild(script);
if(div.attachEvent&&div.fireEvent){div.attachEvent("onclick",function(){jQuery.support.noCloneEvent=false;
div.detachEvent("onclick",arguments.callee)
});
div.cloneNode(true).fireEvent("onclick")
}jQuery(function(){var div=document.createElement("div");
div.style.width=div.style.paddingLeft="1px";
document.body.appendChild(div);
jQuery.boxModel=jQuery.support.boxModel=div.offsetWidth===2;
document.body.removeChild(div).style.display="none"
})
})();
var styleFloat=jQuery.support.cssFloat?"cssFloat":"styleFloat";
jQuery.props={"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};
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)
}var type="GET";
if(params){if(jQuery.isFunction(params)){callback=params;
params=null
}else{if(typeof params==="object"){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)
}if(callback){self.each(callback,[res.responseText,status,res])
}}});
return this
},serialize:function(){return jQuery.param(this.serializeArray())
},serializeArray:function(){return this.map(function(){return this.elements?jQuery.makeArray(this.elements):this
}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))
}).map(function(i,elem){var val=jQuery(this).val();
return val==null?null:jQuery.isArray(val)?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",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()
},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 parts=/^(\w+:)?\/\/([^\/?#]+)/.exec(s.url);
if(s.dataType=="script"&&type=="GET"&&parts&&(parts[1]&&parts[1]!=location.protocol||parts[2]!=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();
script.onload=script.onreadystatechange=null;
head.removeChild(script)
}}
}head.appendChild(script);
return undefined
}var requestDone=false;
var xhr=s.xhr();
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){if(s.global&&!--jQuery.active){jQuery.event.trigger("ajaxStop")
}xhr.abort();
return false
}if(s.global){jQuery.event.trigger("ajaxSend",[xhr,s])
}var onreadystatechange=function(isTimeout){if(xhr.readyState==0){if(ival){clearInterval(ival);
ival=null;
if(s.global&&!--jQuery.active){jQuery.event.trigger("ajaxStop")
}}}else{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)
}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(isTimeout){xhr.abort()
}if(s.async){xhr=null
}}}};
if(s.async){var ival=setInterval(onreadystatechange,13);
if(s.timeout>0){setTimeout(function(){if(xhr&&!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
}catch(e){}return false
},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");
return xhr.status==304||xhrRes==jQuery.lastModified[url]
}catch(e){}return false
},httpData:function(xhr,type,s){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(s&&s.dataFilter){data=s.dataFilter(data,type)
}if(typeof data==="string"){if(type=="script"){jQuery.globalEval(data)
}if(type=="json"){data=window["eval"]("("+data+")")
}}return data
},param:function(a){var s=[];
function add(key,value){s[s.length]=encodeURIComponent(key)+"="+encodeURIComponent(value)
}if(jQuery.isArray(a)||a.jquery){jQuery.each(a,function(){add(this.name,this.value)
})
}else{for(var j in a){if(jQuery.isArray(a[j])){jQuery.each(a[j],function(){add(j,this)
})
}else{add(j,jQuery.isFunction(a[j])?a[j]():a[j])
}}}return s.join("&").replace(/%20/g,"+")
}});
var elemdisplay={},timerId,fxAttrs=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];
function genFx(type,num){var obj={};
jQuery.each(fxAttrs.concat.apply([],fxAttrs.slice(0,num)),function(){obj[this]=type
});
return obj
}jQuery.fn.extend({show:function(speed,callback){if(speed){return this.animate(genFx("show",3),speed,callback)
}else{for(var i=0,l=this.length;
i<l;
i++){var old=jQuery.data(this[i],"olddisplay");
this[i].style.display=old||"";
if(jQuery.css(this[i],"display")==="none"){var tagName=this[i].tagName,display;
if(elemdisplay[tagName]){display=elemdisplay[tagName]
}else{var elem=jQuery("<"+tagName+" />").appendTo("body");
display=elem.css("display");
if(display==="none"){display="block"
}elem.remove();
elemdisplay[tagName]=display
}jQuery.data(this[i],"olddisplay",display)
}}for(var i=0,l=this.length;
i<l;
i++){this[i].style.display=jQuery.data(this[i],"olddisplay")||""
}return this
}},hide:function(speed,callback){if(speed){return this.animate(genFx("hide",3),speed,callback)
}else{for(var i=0,l=this.length;
i<l;
i++){var old=jQuery.data(this[i],"olddisplay");
if(!old&&old!=="none"){jQuery.data(this[i],"olddisplay",jQuery.css(this[i],"display"))
}}for(var i=0,l=this.length;
i<l;
i++){this[i].style.display="none"
}return this
}},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){var bool=typeof fn==="boolean";
return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn==null||bool?this.each(function(){var state=bool?fn:jQuery(this).is(":hidden");
jQuery(this)[state?"show":"hide"]()
}):this.animate(genFx("toggle",3),fn,fn2)
},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(){var opt=jQuery.extend({},optall),p,hidden=this.nodeType==1&&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")&&this.style){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
})
},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
}});
jQuery.each({slideDown:genFx("show",1),slideUp:genFx("hide",1),slideToggle:genFx("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(name,props){jQuery.fn[name]=function(speed,callback){return this.animate(props,speed,callback)
}
});
jQuery.extend({speed:function(speed,easing,fn){var opt=typeof speed==="object"?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&!jQuery.isFunction(easing)&&easing};
opt.duration=jQuery.fx.off?0:typeof opt.duration==="number"?opt.duration:jQuery.fx.speeds[opt.duration]||jQuery.fx.speeds._default;
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:[],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){this.elem.style.display="block"
}},cur:function(force){if(this.elem[this.prop]!=null&&(!this.elem.style||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;
var self=this;
function t(gotoEnd){return self.step(gotoEnd)
}t.elem=this.elem;
if(t()&&jQuery.timers.push(t)&&!timerId){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(timerId);
timerId=undefined
}},13)
}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);
this.options.show=true;
this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());
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){jQuery(this.elem).hide()
}if(this.options.hide||this.options.show){for(var p in this.options.curAnim){jQuery.attr(this.elem.style,p,this.options.orig[p])
}}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,_default:400},step:{opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now)
},_default:function(fx){if(fx.elem.style&&fx.elem.style[fx.prop]!=null){fx.elem.style[fx.prop]=fx.now+fx.unit
}else{fx.elem[fx.prop]=fx.now
}}}});
if(document.documentElement.getBoundingClientRect){jQuery.fn.offset=function(){if(!this[0]){return{top:0,left:0}
}if(this[0]===this[0].ownerDocument.body){return jQuery.offset.bodyOffset(this[0])
}var box=this[0].getBoundingClientRect(),doc=this[0].ownerDocument,body=doc.body,docElem=doc.documentElement,clientTop=docElem.clientTop||body.clientTop||0,clientLeft=docElem.clientLeft||body.clientLeft||0,top=box.top+(self.pageYOffset||jQuery.boxModel&&docElem.scrollTop||body.scrollTop)-clientTop,left=box.left+(self.pageXOffset||jQuery.boxModel&&docElem.scrollLeft||body.scrollLeft)-clientLeft;
return{top:top,left:left}
}
}else{jQuery.fn.offset=function(){if(!this[0]){return{top:0,left:0}
}if(this[0]===this[0].ownerDocument.body){return jQuery.offset.bodyOffset(this[0])
}jQuery.offset.initialized||jQuery.offset.initialize();
var elem=this[0],offsetParent=elem.offsetParent,prevOffsetParent=elem,doc=elem.ownerDocument,computedStyle,docElem=doc.documentElement,body=doc.body,defaultView=doc.defaultView,prevComputedStyle=defaultView.getComputedStyle(elem,null),top=elem.offsetTop,left=elem.offsetLeft;
while((elem=elem.parentNode)&&elem!==body&&elem!==docElem){computedStyle=defaultView.getComputedStyle(elem,null);
top-=elem.scrollTop,left-=elem.scrollLeft;
if(elem===offsetParent){top+=elem.offsetTop,left+=elem.offsetLeft;
if(jQuery.offset.doesNotAddBorder&&!(jQuery.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(elem.tagName))){top+=parseInt(computedStyle.borderTopWidth,10)||0,left+=parseInt(computedStyle.borderLeftWidth,10)||0
}prevOffsetParent=offsetParent,offsetParent=elem.offsetParent
}if(jQuery.offset.subtractsBorderForOverflowNotVisible&&computedStyle.overflow!=="visible"){top+=parseInt(computedStyle.borderTopWidth,10)||0,left+=parseInt(computedStyle.borderLeftWidth,10)||0
}prevComputedStyle=computedStyle
}if(prevComputedStyle.position==="relative"||prevComputedStyle.position==="static"){top+=body.offsetTop,left+=body.offsetLeft
}if(prevComputedStyle.position==="fixed"){top+=Math.max(docElem.scrollTop,body.scrollTop),left+=Math.max(docElem.scrollLeft,body.scrollLeft)
}return{top:top,left:left}
}
}jQuery.offset={initialize:function(){if(this.initialized){return 
}var body=document.body,container=document.createElement("div"),innerDiv,checkDiv,table,td,rules,prop,bodyMarginTop=body.style.marginTop,html='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';
rules={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};
for(prop in rules){container.style[prop]=rules[prop]
}container.innerHTML=html;
body.insertBefore(container,body.firstChild);
innerDiv=container.firstChild,checkDiv=innerDiv.firstChild,td=innerDiv.nextSibling.firstChild.firstChild;
this.doesNotAddBorder=(checkDiv.offsetTop!==5);
this.doesAddBorderForTableAndCells=(td.offsetTop===5);
innerDiv.style.overflow="hidden",innerDiv.style.position="relative";
this.subtractsBorderForOverflowNotVisible=(checkDiv.offsetTop===-5);
body.style.marginTop="1px";
this.doesNotIncludeMarginInBodyOffset=(body.offsetTop===0);
body.style.marginTop=bodyMarginTop;
body.removeChild(container);
this.initialized=true
},bodyOffset:function(body){jQuery.offset.initialized||jQuery.offset.initialize();
var top=body.offsetTop,left=body.offsetLeft;
if(jQuery.offset.doesNotIncludeMarginInBodyOffset){top+=parseInt(jQuery.curCSS(body,"marginTop",true),10)||0,left+=parseInt(jQuery.curCSS(body,"marginLeft",true),10)||0
}return{top:top,left:left}
}};
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||document.body;
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 null
}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",lower=name.toLowerCase();
jQuery.fn["inner"+name]=function(){return this[0]?jQuery.css(this[0],lower,false,"padding"):null
};
jQuery.fn["outer"+name]=function(margin){return this[0]?jQuery.css(this[0],lower,false,margin?"margin":"border"):null
};
var type=name.toLowerCase();
jQuery.fn[type]=function(size){return this[0]==window?document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(document.documentElement["client"+name],document.body["scroll"+name],document.documentElement["scroll"+name],document.body["offset"+name],document.documentElement["offset"+name]):size===undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,typeof size==="string"?size:size+"px")
}
})
})();
(function(C){function B(){this._defaults={sites:[],icons:"js/bookmark/bookmarks.png",iconSize:16,target:"_blank",compact:true,popup:false,popupText:"Bookmark this site...",addFavorite:false,favoriteText:"Favorite",favoriteIcon:0,addEmail:false,emailText:"E-mail",emailIcon:1,emailSubject:"Interesting page",emailBody:"I thought you might find this page interesting:\n{t} ({u})",manualBookmark:"Please close this dialog and\npress Ctrl-D to bookmark this page."};
this._sites={aol:{display:"myAOL",icon:2,url:"http://favorites.my.aol.com/ffclient/webroot/0.4.1/src/html/addBookmarkDialog.html?url={u}&amp;title={t}&amp;favelet=true"},ask:{display:"Ask",icon:3,url:"http://myjeeves.ask.com/mysearch/BookmarkIt?v=1.2&amp;t=webpages&amp;url={u}&amp;title={t}"},backflip:{display:"Backflip",icon:62,url:"http://www.backflip.com/add_page_pop.ihtml?url={u}&amp;title={t}"},ballhype:{display:"BallHype",icon:63,url:"http://ballhype.com/post/url/?url={u}&amp;title={t}"},bebo:{display:"Bebo",icon:64,url:"http://bebo.com/c/share?Url={u}&amp;Title={t}"},blinklist:{display:"BlinkList",icon:4,url:"http://www.blinklist.com/index.php?Action=Blink/addblink.php&amp;Url={u}&amp;Title={t}"},bloglines:{display:"Bloglines",icon:48,url:"http://www.bloglines.com/citations?url={u}"},blogmarks:{display:"Blogmarks",icon:5,url:"http://blogmarks.net/my/new.php?mini=1&amp;simple=1&amp;url={u}&amp;title={t}"},care2:{display:"Care2",icon:6,url:"http://www.care2.com/news/news_post.html?url={u}&amp;title={t}"},current:{display:"Current",icon:49,url:"http://current.com/clipper.htm?url={u}&amp;title={t}"},delicious:{display:"del.icio.us",icon:7,url:"http://del.icio.us/post?url={u}&amp;title={t}"},digg:{display:"Digg",icon:8,url:"http://digg.com/submit?phase=2&amp;url={u}&amp;title={t}"},diigo:{display:"Diigo",icon:9,url:"http://www.diigo.com/post?url={u}&amp;title={t}"},dzone:{display:"DZone",icon:10,url:"http://www.dzone.com/links/add.html?url={u}&amp;title={t}"},facebook:{display:"Facebook",icon:11,url:"http://www.facebook.com/sharer.php?u={u}&amp;t={t}"},fark:{display:"Fark",icon:12,url:"http://cgi.fark.com/cgi/fark/submit.pl?new_url={u}&amp;new_comment={t}"},faves:{display:"Faves",icon:13,url:"http://faves.com/Authoring.aspx?u={u}&amp;t={t}"},feedmelinks:{display:"Feed Me Links",icon:14,url:"http://feedmelinks.com/categorize?from=toolbar&amp;op=submit&amp;url={u}&amp;name={t}"},fresqui:{display:"Fresqui",icon:51,url:"http://ocio.fresqui.com/post?url={u}&amp;title={t}"},friendfeed:{display:"FriendFeed",icon:52,url:"http://friendfeed.com/share?url={u}&amp;title={t}"},funp:{display:"funP",icon:53,url:"http://funp.com/pages/submit/add.php?title={t}&amp;url={u}"},furl:{display:"Furl",icon:15,url:"http://www.furl.net/storeIt.jsp?t={t}&amp;u={u}"},google:{display:"Google",icon:16,url:"http://www.google.com/bookmarks/mark?op=edit&amp;bkmk={u}&amp;title={t}"},hugg:{display:"Hugg",icon:17,url:"http://www.hugg.com/submit?url={u}"},kaboodle:{display:"Kaboodle",icon:65,url:"http://www.kaboodle.com/grab/addItemWithUrl?url={u}&amp;pidOrRid=pid=&amp;redirectToKPage=true"},kirtsy:{display:"Kirtsy",icon:54,url:"http://www.kirtsy.com/submit.php?url={u}"},kool:{display:"Koolontheweb",icon:43,url:"http://www.koolontheweb.com/post?url={u}&title={t}"},linkagogo:{display:"LinkaGoGo",icon:18,url:"http://www.linkagogo.com/go/AddNoPopup?url={u}&amp;title={t}"},linkedin:{display:"LinkedIn",icon:66,url:"http://www.linkedin.com/shareArticle?mini=true&amp;url={u}&amp;title={t}&amp;ro=false&amp;summary=&amp;source="},livejournal:{display:"LiveJournal",icon:19,url:"http://www.livejournal.com/update.bml?subject={u}"},magnolia:{display:"ma.gnolia",icon:20,url:"http://ma.gnolia.com/bookmarklet/add?url={u}&amp;title={t}"},meneame:{display:"menéame",icon:55,url:"http://meneame.net/submit.php?url={u}"},mindbody:{display:"MindBodyGreen",icon:21,url:"http://www.mindbodygreen.com/passvote.action?u={u}"},misterwong:{display:"Mister Wong",icon:22,url:"http://www.mister-wong.com/index.php?action=addurl&amp;bm_url={u}&amp;bm_description={t}"},mixx:{display:"Mixx",icon:23,url:"http://www.mixx.com/submit/story?page_url={u}&amp;title={t}"},multiply:{display:"Multiply",icon:24,url:"http://multiply.com/gus/journal/compose/addthis?body=&amp;url={u}&amp;subject={t}"},myspace:{display:"MySpace",icon:25,url:"http://www.myspace.com/Modules/PostTo/Pages/?c={u}&amp;t={t}"},n4g:{display:"N4G",icon:56,url:"http://www.n4g.com/tips.aspx?url={u}&amp;title={t}"},netscape:{display:"Netscape",icon:26,url:"http://www.netscape.com/submit/?U={u}&amp;T={t}"},netvouz:{display:"Netvouz",icon:27,url:"http://netvouz.com/action/submitBookmark?url={u}&amp;title={t}&amp;popup=no"},newsvine:{display:"Newsvine",icon:28,url:"http://www.newsvine.com/_wine/save?u={u}&amp;h={t}"},nowpublic:{display:"NowPublic",icon:29,url:"http://view.nowpublic.com/?src={u}&amp;t={t}"},oknotizie:{display:"OKNOtizie",icon:57,url:"http://oknotizie.alice.it/post?url={u}&amp;title={t}"},propeller:{display:"Propeller",icon:58,url:"http://www.propeller.com/submit/?U={u}&amp;T={t}"},reddit:{display:"reddit",icon:30,url:"http://reddit.com/submit?url={u}&amp;title={t}"},scoopeo:{display:"Scoopeo",icon:46,url:"http://www.scoopeo.com/scoop/new?newurl={u}&amp;title={t}"},segnalo:{display:"Segnalo",icon:31,url:"http://segnalo.alice.it/post.html.php?url={u}&amp;title={t}"},simpy:{display:"Simpy",icon:32,url:"http://www.simpy.com/simpy/LinkAdd.do?href={u}&amp;title={t}"},slashdot:{display:"Slashdot",icon:33,url:"http://slashdot.org/bookmark.pl?url={u}&amp;title={t}"},smarking:{display:"Smarking",icon:34,url:"http://smarking.com/editbookmark/?url={u}&amp;title={t}"},sphinn:{display:"Sphinn",icon:44,url:"http://sphinn.com/submit.php?url={u}&amp;title={t}"},spurl:{display:"Spurl",icon:35,url:"http://www.spurl.net/spurl.php?url={u}&amp;title={t}"},squidoo:{display:"Squidoo",icon:42,url:"http://www.squidoo.com/lensmaster/bookmark?{u}&title={t}"},stumbleupon:{display:"StumbleUpon",icon:36,url:"http://www.stumbleupon.com/submit?url={u}&amp;title={t}"},tailrank:{display:"Tailrank",icon:37,url:"http://tailrank.com/share/?title={t}&amp;link_href={u}"},technorati:{display:"Technorati",icon:38,url:"http://www.technorati.com/faves?add={u}"},thisnext:{display:"ThisNext",icon:39,url:"http://www.thisnext.com/pick/new/submit/sociable/?url={u}&amp;name={t}"},twitthis:{display:"TwitThis",icon:45,url:"http://twitthis.com/twit?url={u}"},wikio:{display:"Wikio",icon:47,url:"http://www.wikio.com/vote?newurl={u}"},windows:{display:"Windows Live",icon:40,url:"https://favorites.live.com/quickadd.aspx?marklet=1&amp;mkt=en-us&amp;url={u}&amp;title={t}"},xanga:{display:"Xanga",icon:59,url:"http://www.xanga.com/private/editorx.aspx?t={t}&amp;u={u}"},yahoobm:{display:"Yahoo Bookmarks",icon:60,url:"http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&amp;u={u}&t={t}"},yahoobuzz:{display:"Yahoo Buzz",icon:67,url:"http://buzz.yahoo.com/submit?submitUrl={u}&amp;submitHeadline={t}"},yahoo:{display:"Yahoo MyWeb",icon:41,url:"http://myweb2.search.yahoo.com/myresults/bookmarklet?t={t}&amp;u={u}"},yardbarker:{display:"Yardbarker",icon:68,url:"http://www.yardbarker.com/author/new/?pUrl={u}"},yigg:{display:"Yigg",icon:61,url:"http://www.yigg.de/neu?exturl={u}&amp;exttitle={t}"}}
}C.extend(B.prototype,{markerClassName:"hasBookmark",setDefaults:function(D){A(this._defaults,D||{});
return this
},addSite:function(G,F,E,D){this._sites[G]={display:F,icon:E,url:D};
return this
},getSites:function(){return this._sites
},_attachBookmark:function(E,D){E=C(E);
if(E.hasClass(this.markerClassName)){return 
}E.addClass(this.markerClassName);
this._updateBookmark(E,D)
},_changeBookmark:function(E,D){E=C(E);
if(!E.hasClass(this.markerClassName)){return 
}this._updateBookmark(E,D)
},_updateBookmark:function(I,F){F=A(A({},this._defaults),F);
var H=F.sites;
if(H.length==0){C.each(this._sites,function(J){H.push(J)
})
}var E=(F.popup?'<span class="bookmark_popup_text">'+F.popupText+'</span><div class="bookmark_popup">':"")+'<ul class="bookmark_list'+(F.compact?" bookmark_compact":"")+'">';
var G=function(N,M,K,J){var L='<li><a href="'+K+'"'+(J?' onclick="'+J+'"':(F.target?' target="'+F.target+'"':""))+">";
if(M!=null){if(typeof M=="number"){L+='<span title="'+N+'" style="background: transparent url('+F.icons+") no-repeat -"+(M*F.iconSize)+"px 0px;"+(C.browser.mozilla&&C.browser.version<"1.9"?" padding-left: "+F.iconSize+"px; padding-bottom: "+Math.max(0,(F.iconSize/2)-5)+"px;":"")+'"></span>'
}else{L+='<img src="'+M+'" alt="'+N+'" title="'+N+'"'+((C.browser.mozilla&&C.browser.version<"1.9")||(C.browser.msie&&C.browser.version<"7.0")?' style="vertical-align: bottom;"':(C.browser.msie?' style="vertical-align: middle;"':(C.browser.opera||C.browser.safari?' style="vertical-align: baseline;"':"")))+"/>"
}L+=(F.compact?"":"&#xa0;")
}L+=(F.compact?"":N)+"</a></li>";
return L
};
if(F.addFavorite){E+=G(F.favoriteText,F.favoriteIcon,"#","jQuery.bookmark._addFavourite()")
}if(F.addEmail){E+=G(F.emailText,F.emailIcon,"mailto:?subject="+escape(F.emailSubject)+"&amp;body="+escape(F.emailBody.replace(/{u}/,window.location.href).replace(/{t}/,document.title)))
}var D=this._sites;
C.each(H,function(K,L){var J=D[L];
if(J){E+=G(J.display,J.icon,J.url.replace(/{u}/,escape(window.location.href)).replace(/{t}/,escape(document.title)))
}});
E+="</ul>"+(F.popup?"</div>":"");
I.html(E);
if(F.popup){C(I).click(function(){var K=C(this);
var L=K.offset();
var J=C.bookmark._getExtras(K);
C(".bookmark_popup",K).css("left",L.left).css("top",L.top+K.height()+J[1]).toggle()
})
}},_getExtras:function(D){var E=function(F){return{thin:1,medium:2,thick:3}[F]||F
};
return[parseInt(E(D.css("border-left-width")))+parseInt(E(D.css("border-right-width")))+parseInt(D.css("padding-left"))+parseInt(D.css("padding-right")),parseInt(E(D.css("border-top-width")))+parseInt(E(D.css("border-bottom-width")))+parseInt(D.css("padding-top"))+parseInt(D.css("padding-bottom"))]
},_destroyBookmark:function(D){D=C(D);
if(!D.hasClass(this.markerClassName)){return 
}D.removeClass(this.markerClassName);
D.empty()
},_addFavourite:function(){if(C.browser.msie){window.external.addFavorite(window.location.href,document.title)
}else{alert(this._defaults.manualBookmark)
}}});
function A(F,E){C.extend(F,E);
for(var D in E){if(E[D]==null){F[D]=null
}}return F
}C.fn.bookmark=function(E){var D=Array.prototype.slice.call(arguments,1);
return this.each(function(){if(typeof E=="string"){C.bookmark["_"+E+"Bookmark"].apply(C.bookmark,[this].concat(D))
}else{C.bookmark._attachBookmark(this,E||{})
}})
};
C.bookmark=new B()
})(jQuery);
var ANONYMOUS_USER="anonymousUser";
function openBookmarkDiv(){var A=$("#bookmarkIt").offset();
$("#popup-bookmark").css({left:A.left,top:A.top+$("#bookmarkIt").height()+2,height:0,opacity:0,"z-index":10001});
$("#popup-bookmark").show();
$("#popup-bookmark").animate({height:100,opacity:1},500,null,function(){var B=$($.DIV()).css({top:"0px",left:"0px",position:"absolute","z-index":10000,opacity:"0",background:"black",width:$("body").width(),height:$("#main-div").height()});
$("body").append(B);
B.click(function(){B.remove();
closeBookmarkDiv()
})
})
}function closeBookmarkDiv(){$("#popup-bookmark").animate({height:0,opacity:0},500,null,function(){$("#popup-bookmark").hide()
})
}$().ready(function(){resizeWindow();
initFeedback();
$("#header-logo").hover(function(){$("#header-home-icon").css({opacity:0,display:"inline"});
$("#header-home-icon").animate({opacity:1},200)
},function(){$("#header-home-icon").animate({opacity:0},200)
});
$("#header-logout-link").tooltip({track:true,showURL:false,bodyHandler:function(){return $.DIV({},"Logout")
},showURL:false});
$(".textfield").hover(function(){$(this).removeClass("textfield");
$(this).addClass("textfield-hover")
},function(){$(this).addClass("textfield");
$(this).removeClass("textfield-hover")
});
$("#popup-bookmark").bookmark({compact:true,addEmail:true,addFavorite:true});
$("#bookmarkIt").click(function(){if($("#popup-bookmark").css("display")=="none"){openBookmarkDiv()
}else{closeBookmarkDiv()
}})
});
function resizeWindow(){if($("html").width()<1000){$("html").css("width",1000)
}else{$("html").css("width","100%")
}var A=parseInt(($("html").width()-758)/2);
if(A<235){A=$("html").width()-235-758
}A=Math.max(A,14);
$("#main-div").attr("align","left");
$("#main-div").attr("margin-left",A);
$("html").css("background-position",A+"px 0px");
$("body").css("background-position",A+"px 0px");
$("#header-div").css("margin-left",(A+10)+"px");
$("#footer-div").css("margin-left",(A+10)+"px");
$("#sub-header-div").css("margin-left",(A+10)+"px");
$("#content-div").css("margin-left",(A+8)+"px");
$("#statlog-div").show();
$("#statlog-div").css({left:$("#main-div").width()+$("#main-div").offset().left+20,top:20});
$("#ads-div").show();
$("#ads-div").css({left:$("#main-div").width()+$("#main-div").offset().left+20,top:100})
}$(window).resize(function(){resizeWindow()
});
var __username=null;
var __selectedImageCategory=null;
var __selectedImageGenerator=null;
var __selectedLibraryImage=null;
var __showAdvancedParams=false;
var __generatingImage=false;
function initGeneratorPage(){dwr.engine.setActiveReverseAjax(true);
$(document).unload(function(){dwr.engine.setActiveReverseAjax(false)
});
dwr.engine._maxPollRetries=1000;
AjaxController.getImageGenerators(function(A){ImageGeneratorManager.getInstance().initFromJSON(A);
var B=null;
if(__username!=ANONYMOUS_USER){B=$.A({id:"image-generator-category-tab-title_library","class":"tab-title-right",href:"javascript:void(0)"},$.IMG({src:"images/transparent.gif","class":"icon-tab-library"}),"My Library");
$(B).click(function(){selectLibraryImageTab()
})
}$("#image-category-tab-title-bar").append($.map(ImageGeneratorManager.getInstance().getImageGeneratorCategories(),function(D){var C=$.A({id:"image-generator-category-tab-title_"+D.id,"class":"tab-title",href:"javascript:void(0)"},$.IMG({src:"images/transparent.gif","class":"icon-tab-"+D.id}),D.name);
$(C).click(function(){var F=$(this).attr("id").match("_(.*)")[1];
var E=ImageGeneratorManager.getInstance().getImageGeneratorCategory(F);
selectImageCategoryTab(E);
selectImageGenerator(E.getImageGenerators()[0])
});
return C
}),B);
AjaxController.getGeneratorStats(function(C){initRating();
GeneratorStatManager.getInstance().initFromJSON(C);
GeneratorStatManager.getInstance().loadRatedImageGeneratorsFromCookie();
$("#total-image-generated-count").text(""+GeneratorStatManager.getInstance().getTotalImageGeneratedCount());
var D=ImageGeneratorManager.getInstance().getImageGeneratorCategories()[0];
selectImageCategoryTab(D);
selectImageGenerator(D.getImageGenerators()[0]);
AjaxController.getAllGeneratedImageHistory(function(E){GeneratedImageHistoryManager.getAllHistoryInstance().initFromJSON(E);
$.each(GeneratedImageHistoryManager.getAllHistoryInstance().getGeneratedImages(),function(F,G){addGeneratedImage("allHistory",G)
});
if(__username==ANONYMOUS_USER){GeneratedImageHistoryManager.getMyHistoryInstance().loadFromCookie();
$.each(GeneratedImageHistoryManager.getMyHistoryInstance().getGeneratedImages(),function(F,G){addGeneratedImage("myHistory",G)
});
$("#loading-div").hide();
$("#real-content-div").show();
resizeWindow()
}else{refreshLibraryImages();
AjaxController.getMyGeneratedImageHistory(function(F){if(F==null){F=[]
}GeneratedImageHistoryManager.getMyHistoryInstance().setGeneratedImages(F);
$.each(GeneratedImageHistoryManager.getMyHistoryInstance().getGeneratedImages(),function(G,H){addGeneratedImage("myHistory",H)
});
$("#loading-div").hide();
$("#real-content-div").show();
resizeWindow()
})
}})
})
});
$("#my-generated-image-section-tab-title").click(showMyGeneratedImageSectionTab);
$("#all-generated-image-section-tab-title").click(showAllGeneratedImageSectionTab);
$("#generate-button").click(generateImage);
initComment();
initLibrary();
showMyGeneratedImageSectionTab();
$.preload(["images/progressbar-gradient.gif","images/selector-hover.gif","images/tab-bg-hover.png","images/feedback-hide.gif"]);
if(__username!=ANONYMOUS_USER){AjaxController.getColorThemes(function(A){ColorThemeManager.getInstance().initFromJSON(A)
})
}startCometConnectionMonitor()
}function startCometConnectionMonitor(){if(dwr.engine._activeReverseAjax){$("#comet-connection-div").attr("class","on")
}else{$("#comet-connection-div").attr("class","");
dwr.engine.setActiveReverseAjax(true);
setTimeout(startCometConnectionMonitor,5000);
return 
}setTimeout(startCometConnectionMonitor,1000)
}function refreshLibraryImages(A){AjaxController.getLibraryImages(function(B){if(B==null){B=[]
}LibraryImageManager.getInstance().init(B);
if(A){A()
}})
}function selectLibraryImageTab(){$("#image-generator-description").hide();
$("#library-image-description").show();
__selectedImageCategory=null;
$("#image-category-tab-title-bar .tab-title-selected").attr("class","tab-title");
$("#image-generator-category-tab-title_library").attr("class","tab-title-right-selected");
$("#image-generator-selector").empty();
if(LibraryImageManager.getInstance().getLibraryImages().length==0){$("#image-generator-selector").hide();
$("#library-image-empty").show();
$("#parameter-section").hide();
$("#library-image-description").hide()
}else{$("#parameter-section").show();
$("#image-generator-selector").show();
$("#library-image-empty").hide();
$("#library-image-description").show();
$("#image-generator-selector").append($.map(LibraryImageManager.getInstance().getLibraryImages(),function(B){var A=$.A({id:"image-generator-selector-item-"+B.id,"class":"image-generator-selector-item",href:"javascript:void(0)"},$.IMG({id:"image-generator-selector-image-"+B.id,src:"./coconut/library/"+B.id,"class":"image-generator-selector-image"}));
addLibraryImageTooltip(A,B);
$(A).click(function(){selectLibraryImage(B)
});
return A
}));
$("#library-image-description-column1").show();
$("#library-image-description-column2").show();
selectLibraryImage(LibraryImageManager.getInstance().getLibraryImages()[0])
}}function initLibrary(){$("#popup-library-window").jqm({toTop:true,modal:true});
$("#library-cancel-button").click(hideAddToLibraryModalWindow);
$("#library-add-button").click(addGeneratedImageToLibrary);
$("#library-image-remove-link").click(removeFromLibrary);
$("#library-image-rename-link").click(clickRenameLink);
$("#library-image-rename-cancel-link").click(exitRenameLink);
$("#popup-library-name").keyup(function(A){if(A.keyCode==13){addGeneratedImageToLibrary()
}})
}function addGeneratedImageToLibrary(){var A=$.trim($("#popup-library-name").val());
if(A==""){$("#popup-library-message").attr("class","input-error");
$("#popup-library-message-text").text("Name is required.");
return 
}AjaxController.addGeneratedImageToLibrary(__displayedLibraryImageId,$("#popup-library-name").val(),function(B){if(B.error){$("#popup-library-message").attr("class","input-error");
$("#popup-library-message-text").text("Cannot add image to library.");
return 
}$("#popup-library-message").attr("class","input-ok");
$("#popup-library-message-text").text("Image saved in library.");
var C=$($.DIV()).css({top:"0px",left:"0px",position:"absolute","z-index":10000,opacity:"0",background:"black",width:$("body").width(),height:$("#main-div").height()});
$("body").append(C);
refreshLibraryImages(function(){if(__selectedImageCategory==null){selectLibraryImageTab();
selectLibraryImage(LibraryImageManager.getInstance().getLibraryImage(B.id))
}});
setTimeout(function(){hideAddToLibraryModalWindow();
$(C).remove()
},500)
})
}function exitRenameLink(){$("#library-image-name-textfield").hide();
$("#library-image-rename-link").show();
$("#library-image-name").show();
$("#library-image-rename-link").focus();
$("#library-image-rename-cancel-link").hide();
$("#library-image-rename-link").unbind();
$("#library-image-rename-link").click(clickRenameLink);
$("#library-image-rename-link").text("(rename)");
$("#back-element").unbind();
$("#back-element").remove();
$("#library-image-name-textfield").unbind()
}function clickRenameLink(){var A=$($.DIV({id:"back-element"})).css({top:"0px",left:"0px",position:"absolute","z-index":10000,opacity:"0",background:"black",width:$("body").width(),height:$("#main-div").height()});
$("body").append(A);
$("#library-image-description-column1").css("zIndex",10001);
$("#library-image-rename-link").unbind();
$("#library-image-rename-link").click(changeLibraryName);
$("#library-image-rename-link").text("OK");
$("#library-image-name").hide();
$("#library-image-name-textfield").val(__selectedLibraryImage.name);
$("#library-image-name-textfield").show();
$("#library-image-rename-cancel-link").show();
$("#library-image-name-textfield").focus();
$(A).click(changeLibraryName);
$("#library-image-name-textfield").keyup(function(B){$("#library-image-name-error").hide();
if(B.keyCode==13){changeLibraryName()
}})
}function changeLibraryName(){var A=$.trim($("#library-image-name-textfield").val());
if(A.length==0){$("#library-image-name-error").show();
$("#library-image-name-error").text("Invalid name");
$("#library-image-name-error-textfield").focus();
return 
}AjaxController.renameLibraryImage(__selectedLibraryImage.id,A,function(B){if(B){$("#library-image-name").text(A);
__selectedLibraryImage.name=A;
exitRenameLink()
}else{$("#library-image-name-error").show();
$("#library-image-name-error").text("Cannot rename image");
$("#library-image-name-error-textfield").focus()
}})
}function hideAddToLibraryModalWindow(){$("#popup-library-window").animate({opacity:0},500,null,function(){$("#popup-library-window").jqmHide()
})
}function toggleShowAdvancedParams(){__showAdvancedParams=!__showAdvancedParams;
if(__showAdvancedParams){showAdvancedParams()
}else{hideAdvancedParams()
}}function resetToDefaultParams(){if(__selectedImageCategory!=null){selectImageGenerator(__selectedImageGenerator)
}else{selectLibraryImage(__selectedLibraryImage)
}}function showAdvancedParams(){$("#advanced-params-body, #advanced-params-body *").show();
$("#advanced-params-label").text("Hide advanced options");
$("#advanced-params-link").attr("class","advanced-params-link-hide")
}function hideAdvancedParams(){$("#advanced-params-body, #advanced-params-body *").hide();
$("#advanced-params-label").text("Show advanced options");
$("#advanced-params-link").attr("class","advanced-params-link-show")
}function buildImageGeneratorSelector(){var A=0;
$("#image-generator-selector").empty();
$("#image-generator-selector").append($.DIV({},$.map(__selectedImageCategory.getImageGenerators(),function(C){var B=$.A({id:"image-generator-selector-item-"+C.id,"class":"image-generator-selector-item",href:"javascript:void(0)"},$.IMG({id:"image-generator-selector-image-"+C.id,src:"./images/samples/"+__selectedImageCategory.id+"/"+C.id+".gif","class":"image-generator-selector-image"}));
$(B).click(function(){var E=$(this).attr("id").split("-")[4];
var D=__selectedImageCategory.getImageGenerator(E);
selectImageGenerator(D)
});
$(B).tooltip({track:true,showURL:false,extraClass:"tooltip-generator-description",bodyHandler:function(){var E=$(this).attr("id").split("-")[4];
var M=__selectedImageCategory.getImageGenerator(E);
var H=0;
var G=GeneratorStatManager.getInstance().getGeneratorStat(E);
if(G!=null){H=G.generationCount
}var F=[];
var G=GeneratorStatManager.getInstance().getGeneratorStat(M.id);
var D;
var J;
if(G==null){D=0;
J=0
}else{D=G.ratingCount;
if(D==0){J=0
}else{J=G.totalStarCount/G.ratingCount
}}for(var I=1;
I<=5;
I++){var L=J-I+1;
var K;
if(L<=0.25){K="rating-icon-star-none"
}else{if(L<=0.75){K="rating-icon-star-half"
}else{K="rating-icon-star-full"
}}F.push($.DIV({"class":"rating-icon-star-container-small"},$.IMG({src:"images/transparent.gif","class":K})))
}return $.DIV({},$.DIV({"class":"tooltip-title"},$.IMG({src:"images/transparent.gif","class":"icon-tab-"+M.imageGeneratorCategory.id}),M.name),$.DIV({"class":"tooltip-row"},$.DIV({"class":"tooltip-label"},"Rating:"),$.DIV({"class":"tooltip-value"},$.DIV({"class":"tooltip-star-container"},F))),$.DIV({"class":"tooltip-row"},$.DIV({"class":"tooltip-label"},"Rating Count:"),$.DIV({"class":"tooltip-value"},""+D)),$.DIV({"class":"tooltip-row"},$.DIV({"class":"tooltip-label"},"Images Generated:"),$.DIV({"class":"tooltip-value image-generator-generation-count-"+E},""+H)))
}});
A++;
return B
})))
}function getOptionLabel(A,B){if(A=="param_filling"){return $.SPAN({},$.IMG({src:"images/transparent.gif","class":"icon-filling-"+B.toLowerCase().replace(/ /g,"")}),B)
}else{if(A=="param_buttonShape"){return $.SPAN({},$.IMG({src:"images/transparent.gif","class":"icon-buttonshape-"+B.toLowerCase().replace(/ /g,"")}),B)
}else{if(A=="param_innerBorder"){return $.SPAN({},$.IMG({src:"images/transparent.gif","class":"icon-innerborder-"+B.toLowerCase().replace(/ /g,"")}),B)
}else{if(A=="param_fontName"){return $.SPAN({},$.IMG({src:"images/transparent.gif","class":"icon-fontname-"+B.toLowerCase().replace(/ /g,"")}),B)
}else{if(A=="param_textStyle"){return $.SPAN({},$.IMG({src:"images/transparent.gif","class":"icon-textstyle-"+B.toLowerCase().replace(/ /g,"")}),B)
}else{if(A=="param_shape"){return $.SPAN({},$.IMG({src:"images/transparent.gif","class":"icon-shape-"+B.toLowerCase().replace(/ /g,"")}),B)
}else{if(A=="param_iconShape"){return $.SPAN({},$.IMG({src:"images/transparent.gif","class":"icon-shape-"+B.toLowerCase().replace(/ /g,"")}),B)
}else{return B
}}}}}}}}function displayImageGeneratorParameterSection(A){displayParameterSection(A.parameterTypes)
}function displayParameterSection(L){$("#params-body").empty();
$("#advanced-params-body").empty();
$(".int-selector").each(function(N,M){if($(M).destroy){$(M).destroy()
}});
__showAdvancedParams=false;
var B=false;
var K=$.TR({});
var G={};
for(var D=0;
D<L.length;
D++){var E=L[D];
var C="param_"+E.id;
G[E.id]=E;
if(!E.advancedOption){$("#params-body").append(K)
}else{B=true;
$("#advanced-params-body").append(K)
}var F=$.DIV({},E.name);
$(F).css("float","right");
var J=null;
if(E.description!=null){J=$.A({id:"param-tooltip-"+E.id,"class":"icon-help-tooltip",href:"javascript:void(0)"});
$(J).tooltip({track:true,showURL:false,bodyHandler:function(){var N=$(this).attr("id").split("-")[2];
var M=G[N];
return $.DIV({"class":"tooltip-row"},M.description)
},showURL:false})
}var H=$.TD({id:C+"-td-label",align:"right"},J,F);
if(E.valueType=="color"){$(K).append(H,$.TD({id:C+"-td-value"},$.A({id:C,"class":"color-selector",href:"javascript:void(0)"}," ")));
$("#"+C).colorPicker("Choose a color for "+E.name,E.defaultValue);
$("#"+C).tooltip({track:true,showURL:false,bodyHandler:function(){var N=$.DIV({"class":"color-square"});
var M=$.DIV({});
$(M).html("&nbsp; Hex: ");
$(M).css({width:"40px","float":"left"});
$(N).css("background-color",$.colorPicker($("#"+this.id)).getColor());
return $.DIV({"class":"tooltip-value"},N,M,$.colorPicker($("#"+this.id)).getColor())
},showURL:false})
}else{if(E.valueType=="string"){$(K).append(H,$.TD({},$.INPUT({id:C,"class":"text-selector textfield",value:E.defaultValue,maxsize:E.max}),$.DIV({id:C+"_error","class":"text-selector-error"})));
$("#"+C+"_error").css({opacity:0.8});
$("#"+C+"_error").hide();
$("#"+C).keyup(function(O){var P=$(this).attr("id").split("_")[1];
var M=G[P];
var N=$(this).val().length;
if((M.minLength!=null&&N<M.minLength)||(M.maxLength!=null&&N>M.maxLength)){if(M.minLength==null){$("#param_"+P+"_error").html("<b>"+M.name+"</b> must have less than <b>"+M.maxLength+"</b> characters.")
}else{if(M.maxLength==null){$("#param_"+P+"_error").html("<b>"+M.name+"</b> must have more than <b>"+M.minLength+"</b> characters.")
}else{$("#param_"+P+"_error").html("<b>"+M.name+"</b> must have between <b>"+M.minLength+"</b> and <b>"+M.maxLength+"</b> characters.")
}}$("#param_"+P+"_error").css({top:$("#param_"+P).offset().top-25,left:$("#param_"+P).offset().left-120});
$("#param_"+P+"_error").show()
}else{$("#param_"+P+"_error").hide()
}})
}else{if(E.valueType=="int"){$(K).append(H,$.TD({},$.DIV({id:C,"class":"int-selector ui-slider-1"},$.DIV({id:C+"_handle","class":"ui-slider-handle"})),$.INPUT({id:C+"_text","class":"int-selector-text textfield",type:"text"})));
$("#"+C+"_handle").hover(function(){$(this).removeClass("ui-slider-handle");
$(this).addClass("ui-slider-handle-hover")
},function(){$(this).addClass("ui-slider-handle");
$(this).removeClass("ui-slider-handle-hover")
});
$("#"+C).slider({index:D,min:E.minValue,max:E.maxValue,stepping:1,click:function(N,M){sliderChange(this.id,N,M)
},slide:function(N,M){sliderChange(this.id,N,M)
}});
$("#"+C+"_text").change(function(){var M=this.id.match(/param_(.*)_text/)[1];
var N=G[M];
__changeParamText(N)
});
$("#"+C+"_text").keypress(function(P){var O=(P.keyCode?P.keyCode:P.which);
if(O==13){var M=this.id.match(/param_(.*)_text/)[1];
var N=G[M];
__changeParamText(N)
}});
$("#"+C).slider("option","value",E.defaultValue);
$("#"+C+"_text").val(""+E.defaultValue);
$("#"+C).tooltip({track:true,showURL:false,bodyHandler:function(){var M=$(this).attr("id").split("_")[1];
var N=G[M];
return $.DIV({},$.DIV({"class":"tooltip-row-small"},$.DIV({"class":"tooltip-label-small"},$.B({},"Value")),$.DIV({"class":"tooltip-value-small"},$.B({},""+$("#param_"+M+"_text").val()))),$.DIV({"class":"tooltip-row-small"},$.DIV({"class":"tooltip-label-small"},"Min"),$.DIV({"class":"tooltip-value-small"},""+N.minValue)),$.DIV({"class":"tooltip-row-small"},$.DIV({"class":"tooltip-label-small"},"Max"),$.DIV({"class":"tooltip-value-small"},""+N.maxValue)))
}})
}else{if(E.valueType=="boolean"){$(K).append(H,$.TD({},$.INPUT({id:C,type:"checkbox",checked:E.defaultValue})));
$("#"+C).checkbox({cls:"jquery-safari-checkbox"});
$("#"+C).click(function(){setTimeout(function(){__refreshDependentParameters()
},1)
})
}else{if(E.valueType=="choice"){var I;
if(E.defaultValue==undefined||E.defaultValue==null){I=E.values[0]
}else{I=E.defaultValue
}$(K).append(H,$.TD({},$.A({id:C,"class":"choice-selector"},$.DIV({"class":"choice-selector-label"},getOptionLabel(C,I)))));
$("#"+C).attr("value",I);
var A=new PullDownMenu("#"+C,$.map(E.values,function(N){var M=new PullDownMenuItem(N,getOptionLabel(C,N),function(){$("#"+this.paramId).attr("value",N);
$("#"+this.paramId).children(".choice-selector-label").empty();
$("#"+this.paramId).children(".choice-selector-label").append(getOptionLabel(this.paramId,N))
});
M.paramId=C;
return M
}),{selectLastSelectedMenuItem:true,prefixClassName:"choicePullDown"})
}else{alert("Unknown parameter value type: "+E.valueType+" for "+E.id);
continue
}}}}}if(!E.groupedWithNextParameter){K=$.TR({})
}}if(B){$("#advanced-params-link-body").show();
hideAdvancedParams()
}else{$("#advanced-params-link-body").hide();
hideAdvancedParams()
}$(".text-selector").hover(function(){$(this).css({margin:"0px",border:"2px solid #e48600"})
},function(){$(this).css({margin:"1px",border:"1px solid #6e6e6e"})
});
$(".int-selector-text").hover(function(){$(this).css({margin:"0px 0px 0px 10px",border:"2px solid #e48600"})
},function(){$(this).css({margin:"1px 1px 1px 11px",border:"1px solid #6e6e6e"})
});
__refreshDependentParameters()
}function __refreshDependentParameters(){if(__selectedImageGenerator==null){return 
}for(var B=0;
B<__selectedImageGenerator.parameterTypes.length;
B++){parameterType=__selectedImageGenerator.parameterTypes[B];
if(parameterType.enabledBy==null){continue
}var A=$("#param_"+parameterType.enabledBy).attr("checked");
if(!A){$("#param_"+parameterType.id+"-td-label").css({visibility:"hidden"});
$("#param_"+parameterType.id+"-td-value").css({visibility:"hidden"})
}else{$("#param_"+parameterType.id+"-td-label").css({visibility:"visible"});
$("#param_"+parameterType.id+"-td-value").css({visibility:"visible"})
}}}function __changeParamText(B){var A=$("#param_"+B.id+"_text");
var C=A.val();
if(C==null||isNaN(C)){A($("#param_"+B.id).slider("value"));
return 
}if(C<B.minValue){A.val(""+B.minValue)
}if(C>B.maxValue){A.val(""+B.maxValue)
}$("#param_"+B.id).slider("option","value",parseInt(C));
return true
}function selectImageGenerator(B){__selectedImageGenerator=B;
$("#image-generator-icon").attr({src:"images/transparent.gif","class":"icon-tab-"+B.imageGeneratorCategory.id});
$("#image-generator-name").text(B.name);
var A=GeneratorStatManager.getInstance().getGeneratorStat(B.id);
$("#image-generator-generation-count").css("color","white");
$("#image-generator-generation-count").attr("class","image-generator-generation-count-"+B.id);
$(".image-generator-selector-image").css("border","2px solid #dddddd");
$("#image-generator-selector-image-"+B.id).css("border","2px solid #e48600");
displayImageGeneratorParameterSection(B);
showRating(B);
$("#post-a-comment-info").hide();
reloadGeneratorComments(__selectedImageGenerator.id)
}function selectLibraryImage(A){$("#library-image-icon").attr({src:"images/transparent.gif","class":"icon-tab-"+A.imageGenerator.imageGeneratorCategory.id});
$("#library-image-name").text(A.name);
$(".image-generator-selector-image").css("border",null);
$("#image-generator-selector-image-"+A.id).css("border","2px solid #e48600");
displayImageGeneratorParameterSection(A.imageGenerator);
selectImageGeneratorParameters(A.imageGenerator,A.parameters);
__selectedLibraryImage=A;
__selectedImageGenerator=A.imageGenerator
}var __ratingInteractionEnabled=true;
function initRating(){for(var A=1;
A<=5;
A++){var B=$.DIV({id:"rating-icon-star-container-"+A,"class":"rating-icon-star-container"},$.IMG({id:"rating-icon-star-"+A,src:"images/transparent.gif","class":"rating-icon-star-none"}));
$(B).hover(function(){if(!__ratingInteractionEnabled){return 
}if(GeneratorStatManager.getInstance().isImageGeneratorRated(__selectedImageGenerator.id)){$("#image-generator-rating-info").text("You have already rated.");
return 
}var D=$(this).attr("id").split("-")[4]*1;
for(var C=1;
C<=5;
C++){if(C<=D){$("#rating-icon-star-"+C).attr("class","rating-icon-star-full")
}else{$("#rating-icon-star-"+C).attr("class","rating-icon-star-none")
}}$("#image-generator-rating-info").text(["Poor","Nothing Special","Average","Pretty Cool","Awesome!"][D-1])
},function(){if(!__ratingInteractionEnabled){return 
}showRating(__selectedImageGenerator)
});
$(B).click(function(){if(GeneratorStatManager.getInstance().isImageGeneratorRated(__selectedImageGenerator.id)){return 
}var C=$(this).attr("id").split("-")[4]*1;
AjaxController.rateImageGenerator(__selectedImageGenerator.id,C,function(D){if(D){$("#image-generator-rating-info").text("Thanks for rating!");
GeneratorStatManager.getInstance().markImageGeneratorAsRated(__selectedImageGenerator.id);
GeneratorStatManager.getInstance().storeRatedImageGeneratorsToCookie()
}else{$("#image-generator-rating-info").text("Error")
}__ratingInteractionEnabled=false;
setTimeout(function(){showRating(__selectedImageGenerator)
},2000)
})
});
$("#image-generator-rating-star-container").append(B)
}}function showRating(G){__ratingInteractionEnabled=true;
var E=GeneratorStatManager.getInstance().getGeneratorStat(G.id);
var A;
var C;
if(E==null){$("#image-generator-generation-count").text("0");
A=0;
C=0
}else{$("#image-generator-generation-count").text(""+E.generationCount);
A=E.ratingCount;
if(A==0){C=0
}else{C=E.totalStarCount/E.ratingCount
}}if(GeneratorStatManager.getInstance().isImageGeneratorRated(__selectedImageGenerator.id)){$(".rating-icon-star-container").css("pointer","default")
}else{$(".rating-icon-star-container").css("pointer","cursor")
}for(var D=1;
D<=5;
D++){var B=C-D+1;
var F;
if(B<=0.25){F="rating-icon-star-none"
}else{if(B<=0.75){F="rating-icon-star-half"
}else{F="rating-icon-star-full"
}}$("#rating-icon-star-"+D).attr("class",F)
}if(A==0){$("#image-generator-rating-info").text("No ratings")
}else{$("#image-generator-rating-info").text(A+" ratings")
}}function sliderChange(B,C,A){$("#"+B+"_text").val(""+A.value)
}function getParameterValues(A){var E={};
for(var C=0;
C<A.length;
C++){var B=A[C];
if(B.valueType=="color"){E[B.id]=$.colorPicker("#param_"+B.id).getColor()
}else{if(B.valueType=="string"){var D=$("#param_"+B.id).attr("value");
if((B.minLength!=null&&D.length<B.minLength)||(B.maxLength!=null&&D.length>B.maxLength)){return 
}E[B.id]=D
}else{if(B.valueType=="int"){E[B.id]=$("#param_"+B.id+"_text").val()
}else{if(B.valueType=="boolean"){E[B.id]=$("#param_"+B.id).attr("checked")
}else{if(B.valueType=="choice"){E[B.id]=$("#param_"+B.id).attr("value")
}}}}}}return E
}function generateImage(){if(__generatingImage==true){return 
}__generatingImage=true;
$("#generate-button").css({opacity:0.4});
$("#generate-button").unbind("click");
setImageJobCurrentStep(0,0);
setImageJobMessage(0,"Initialization...");
var A=getParameterValues(__selectedImageGenerator.getParameterTypes());
AjaxController.generateImage(__selectedImageGenerator.id,A,function(B){var C={width:B.width+"px",height:B.height+"px",frameCount:B.frameCount};
var D=new GeneratedImage(B.jobId,__selectedImageGenerator,A,C);
GeneratedImageHistoryManager.getMyHistoryInstance().addGeneratedImage(D)
},function(B){alert(B)
})
}function removeAllImages(){$(".my-image-box").animate({width:0,height:0,opacity:0},1000,null,function(){$(".my-image-box").remove();
var A=GeneratedImageHistoryManager.getMyHistoryInstance().getGeneratedImages();
GeneratedImageHistoryManager.getMyHistoryInstance().removeAllGeneratedImages();
if(__username==ANONYMOUS_USER){GeneratedImageHistoryManager.getMyHistoryInstance().storeToCookie()
}else{var B=[];
$.each(A,function(C,D){B.push(D.id)
});
AjaxController.removeMyGeneratedImages(B)
}$("#my-generated-image-section-tab-noimage").show();
$("#my-generated-image-section-tab-regular").hide()
})
}function downloadInFormat(B,A){$("#download-iframe").attr("src","./coconut/images/"+B+"?download&format="+A)
}function downloadAllImages(){var A=GeneratedImageHistoryManager.getMyHistoryInstance().getGeneratedImages();
if(A.length==0){displayModalWindow("Error","No image to download.");
return 
}var C=A[0].id;
for(var B=1;
B<A.length;
B++){C+=","+A[B].id
}$("#download-iframe").attr("src","./coconut/DownloadZip?ids="+C)
}function selectImageGeneratorParameters(H,E){for(var D=0;
D<H.parameterTypes.length;
D++){var C=H.parameterTypes[D];
var B="param_"+C.id;
var G=E[C.id];
if(G==null||G==undefined){G=C.defaultValue
}if(C.valueType=="color"){if(!G.match(/^#[0-9a-fA-F]{6}/)){G=C.defaultValue
}$.colorPicker("#param_"+C.id).setColor(G)
}else{if(C.valueType=="int"){if(G<C.minValue){G=C.minValue
}if(G>C.maxValue){G=C.maxValue
}$("#"+B).slider("option","value",parseInt(G));
$("#"+B+"_text").val(""+G)
}else{if(C.valueType=="string"){$("#"+B).attr("value",G)
}else{if(C.valueType=="boolean"){if((""+G)!="true"&&(""+G)!="false"){G=C.defaultValue
}$("#"+B).attr("checked",G)
}else{if(C.valueType=="choice"){var F=false;
for(var A=0;
A<C.values.length;
A++){if(C.values[A]==G){F=true;
break
}}if(!F){G=C.defaultValue
}$("#"+B).attr("value",G);
$("#"+B).children(".choice-selector-label").empty();
$("#"+B).children(".choice-selector-label").append(getOptionLabel(B,G))
}}}}}}__refreshDependentParameters()
}function addGeneratedImage(A,G){var B=$($.DIV());
B.css("clear","both");
var I;
var E;
var F;
if(A=="myHistory"){I=GeneratedImageHistoryManager.getMyHistoryInstance();
E=$("#my-generated-image-container");
F="my_"+G.id;
if($("#my-generated-image-section-tab-noimage").css("display")!="none"){$("#my-generated-image-section-tab-noimage").hide();
$("#my-generated-image-section-tab-regular").show()
}}else{I=GeneratedImageHistoryManager.getAllHistoryInstance();
E=$("#all-generated-image-container");
F="all_"+G.id
}var D=$.DIV({id:"image-box-"+F,"class":(A=="myHistory")?"my-image-box":"all-image-box"},$.DIV({id:"image-header-"+F,"class":"image-header"},(__username==ANONYMOUS_USER||A!="myHistory")?null:$.DIV({"class":"library-image-container"},$.A({id:"library-image-"+F,"class":"library-link"},$.IMG({src:"images/transparent.gif","class":"library-icon"}))),$.DIV({"class":"download-image-container"},$.A({id:"download-gif-image-"+F,href:"./coconut/images/"+G.id+"?download","class":"download-gif-link"},$.IMG({src:"images/transparent.gif","class":"download-gif-icon"})),$.A({id:"download-more-image-"+F,"class":"download-more-link"},$.IMG({src:"images/transparent.gif","class":"download-more-icon"}))),(A=="myHistory")?($.DIV({"class":"close-image-container"},$.A({id:"del-image_"+F,"class":"remove-image-link",href:"javascript:void(0)"},$.IMG({src:"images/transparent.gif","class":"remove-image-icon"})))):null),$.DIV({"class":"clear-both"}),$.A({id:"image-link_"+F,"class":"generated-image-link",href:"javascript:void(0)"},$.IMG({id:"image_"+F,"class":"generated-image",src:"./coconut/images/"+G.id})),$.DIV({id:"image_footer_"+F,"class":"image-footer"},B[0]));
var H=parseInt(G.properties.width)+10;
if(__username==ANONYMOUS_USER){if(H<91){H=91
}}else{if(H<106){H=106
}}$(D).css({opacity:0,width:H});
$("#image-header-"+F).css({width:H-4});
$(E).append(D);
$("#library-image-"+F).tooltip({track:true,showURL:false,bodyHandler:function(){return $.DIV({},"Add image to my library")
}});
$("#library-image-"+F).click(function(){displayAddToLibraryModalWindow(G.id)
});
$("#download-gif-image-"+F).tooltip({track:true,showURL:false,bodyHandler:function(){return $.DIV({},"Download image in GIF format")
}});
$("#download-more-image-"+F).tooltip({track:true,showURL:false,bodyHandler:function(){return $.DIV({},"Download image in another format")
}});
var C;
if(G.properties.frameCount>1){C=new PullDownMenu("#download-more-image-"+F,[new PullDownMenuItem("gif","Download in GIF Format",function(){downloadInFormat(G.id,"GIF")
}),new PullDownMenuItem("swf","Download in SWF Format",function(){downloadInFormat(G.id,"SWF")
})],{prefixClassName:"formatPullDown",anchorElement:"#download-gif-image-"+F})
}else{C=new PullDownMenu("#download-more-image-"+F,[new PullDownMenuItem("gif","Download in GIF Format",function(){downloadInFormat(G.id,"GIF")
}),new PullDownMenuItem("png","Download in PNG Format",function(){downloadInFormat(G.id,"PNG")
}),new PullDownMenuItem("jpg","Download in JPG Format",function(){downloadInFormat(G.id,"JPG")
}),new PullDownMenuItem("tiff","Download in TIFF Format",function(){downloadInFormat(G.id,"TIFF")
}),new PullDownMenuItem("ico","Download in ICO Format",function(){downloadInFormat(G.id,"ICO")
}),new PullDownMenuItem("swf","Download in SWF Format",function(){downloadInFormat(G.id,"SWF")
})],{prefixClassName:"formatPullDown",anchorElement:"#download-gif-image-"+F})
}$("#del-image_"+F).tooltip({track:true,showURL:false,bodyHandler:function(){return $.DIV({},"Remove Image")
}});
$("#del-image_"+F).click(function(){$("#image-box-"+F).animate({width:80,height:30,opacity:0},1000,null,function(){$("#image-box-"+F).remove();
I.removeGeneratedImage(G);
if(__username==ANONYMOUS_USER){I.storeToCookie()
}else{AjaxController.removeMyGeneratedImages([G.id])
}if(A=="myHistory"&&I.getGeneratedImages().length==0){$("#my-generated-image-section-tab-noimage").show();
$("#my-generated-image-section-tab-regular").hide()
}})
});
addGeneratedImageTooltip($("#image_"+F),G);
$("#image-link_"+F).click(function(){if(G.imageGenerator.category!=__selectedImageCategory.id){selectImageCategoryTab(G.imageGenerator.category)
}selectImageGenerator(G.imageGenerator);
selectImageGeneratorParameters(G.imageGenerator,G.parameters)
});
$("#image-box-"+F).animate({opacity:1},1000);
$("#generate-button").css({opacity:1});
$("#generate-button").click(generateImage)
}function removeFromLibrary(){AjaxController.removeImageFromLibrary(__selectedLibraryImage.id,function(A){$("#library-image-remove-link").hide();
$("#library-image-message").show();
if(!A){$("#library-image-message").text("Cannot remove library from image")
}else{$("#library-image-message").text("Image removed from library");
refreshLibraryImages(function(){selectLibraryImageTab()
})
}$("#image-generator-selector-image-"+__selectedLibraryImage.id).animate({width:0,height:0,opacity:0});
setTimeout(function(){$("#library-image-message").hide();
$("#library-image-remove-link").show()
},2000);
return 
})
}function addGeneratedImageTooltip(A,B){$(A).tooltip({track:true,showURL:false,extraClass:"tooltip-generated-image-description",bodyHandler:function(){var D=$.DIV({"class":"tooltip-param-container"});
var E=$.DIV({"class":"tooltip-advanced-param-container"});
var C=0;
$.each(B.imageGenerator.parameterTypes,function(H,G){var J=$.DIV({"class":"tooltip-label"},G.name+": ");
var L;
if(G.enabledBy!=null&&B.parameters[G.enabledBy]!=true){return 
}if(G.valueType=="color"){var I=$.DIV({"class":"color-square"});
$(I).css("background-color",B.parameters[G.id]);
L=$.DIV({"class":"tooltip-value"},I,B.parameters[G.id])
}else{var K=B.parameters[G.id];
if(K==null){K="n/a"
}L=$.DIV({"class":"tooltip-value"},""+K)
}if(G.advancedOption){$(E).append($.DIV({"class":"tooltip-row"},J,L));
C++
}else{$(D).append($.DIV({"class":"tooltip-row"},J,L))
}});
$(D).append($.DIV({"class":"clear-both"}));
if(C>0){$(E).append($.DIV({"class":"clear-both"}))
}else{E=null
}var F=$.DIV({},$.DIV({"class":"tooltip-title"},$.IMG({src:"images/transparent.gif","class":"icon-tab-"+B.imageGenerator.imageGeneratorCategory.id}),B.imageGenerator.name),$.DIV({"class":"tooltip-section-title"},$.IMG({src:"images/transparent.gif","class":"icon-section-parameter"}),"Parameters"),D,E,$.DIV({"class":"tooltip-section-title"},$.IMG({src:"images/transparent.gif","class":"icon-section-generated-images"}),"Image Properties"),$.DIV({"class":"tooltip-row"},$.DIV({"class":"tooltip-label"},"Width:"),$.DIV({"class":"tooltip-value"},B.properties.width)),$.DIV({"class":"tooltip-row"},$.DIV({"class":"tooltip-label"},"Height:"),$.DIV({"class":"tooltip-value"},B.properties.height)),(B.properties.frameCount>1)?($.DIV({"class":"tooltip-row"},$.DIV({"class":"tooltip-label"},"Frame Count:"),$.DIV({"class":"tooltip-value"},""+B.properties.frameCount))):null);
return F
},showURL:false})
}function addLibraryImageTooltip(A,B){$(A).tooltip({track:true,showURL:false,extraClass:"tooltip-generated-image-description",bodyHandler:function(){var C=$.DIV({},$.DIV({"class":"tooltip-title-green"},$.IMG({src:"images/transparent.gif","class":"icon-tab-"+B.imageGenerator.imageGeneratorCategory.id}),B.name),$.DIV({"class":"tooltip-section-title"},$.IMG({src:"images/transparent.gif","class":"icon-section-library"}),"Library Properties"),$.DIV({"class":"tooltip-row"},$.DIV({"class":"tooltip-label"},"Generator Name:"),$.DIV({"class":"tooltip-value"},B.imageGenerator.name)),$.DIV({"class":"tooltip-row"},$.DIV({"class":"tooltip-label"},"Created:"),$.DIV({"class":"tooltip-value"},formatDate(B.insertionDate))),$.BR(),$.DIV({"class":"tooltip-section-title"},$.IMG({src:"images/transparent.gif","class":"icon-section-parameter"}),"Parameters"),$.map(B.imageGenerator.parameterTypes,function(D){var F=$.DIV({"class":"tooltip-label"},D.name+": ");
var H;
if(D.valueType=="color"){var E=$.DIV({"class":"color-square"});
$(E).css("background-color",B.parameters[D.id]);
H=$.DIV({"class":"tooltip-value"},E,B.parameters[D.id])
}else{var G=B.parameters[D.id];
if(G==null){G="n/a"
}H=$.DIV({"class":"tooltip-value"},""+G)
}return $.DIV({"class":"tooltip-row"},F,H)
}),$.BR(),$.DIV({"class":"tooltip-section-title"},$.IMG({src:"images/transparent.gif","class":"icon-section-generated-images"}),"Image Properties"),$.DIV({"class":"tooltip-row"},$.DIV({"class":"tooltip-label"},"Width:"),$.DIV({"class":"tooltip-value"},B.properties.width)),$.DIV({"class":"tooltip-row"},$.DIV({"class":"tooltip-label"},"Height:"),$.DIV({"class":"tooltip-value"},B.properties.height)),(B.properties.frameCount>1)?($.DIV({"class":"tooltip-row"},$.DIV({"class":"tooltip-label"},"Frame Count:"),$.DIV({"class":"tooltip-value"},""+B.properties.frameCount))):null);
return C
},showURL:false})
}var __stepCount=1;
function setImageJobStepCount(B,A){$("#stepCountValue").text(""+A);
__stepCount=A
}function setImageJobCurrentStep(B,A){$("#stepValue").text(""+A);
$("#progress-bar-done").css("width",parseInt(200*A/__stepCount))
}function selectImageCategoryTab(A){$("#parameter-section").show();
$("#image-generator-selector").show();
$("#library-image-empty").hide();
__selectedImageCategory=A;
$("#image-generator-description").show();
$("#library-image-description").hide();
$("#image-category-tab-title-bar A.tab-title-selected").attr("class","tab-title");
$("#image-category-tab-title-bar A.tab-title-right-selected").attr("class","tab-title-right");
$("#image-generator-category-tab-title_"+A.id).attr("class","tab-title-selected");
buildImageGeneratorSelector()
}var __displayedLibraryImageId;
function displayAddToLibraryModalWindow(A){__displayedLibraryImageId=A;
$("#popup-library-message").attr("class","");
$("#popup-library-message-text").text("");
var B=GeneratedImageHistoryManager.getMyHistoryInstance().getGeneratedImage(A);
$("#popup-library-name").val(B.imageGenerator.id+"-"+A);
$("#popup-library-image").show();
addGeneratedImageTooltip($("#popup-library-image"),B);
$("#popup-library-image").attr("src","./coconut/images/"+B.id);
$("#popup-library-window").css("opacity",0);
$("#popup-library-window").show();
centerModalWindow($("#popup-library-window"));
$("#popup-library-window").jqmShow();
$("#popup-library-window").animate({opacity:1})
}function showMyGeneratedImageSectionTab(){$("#my-generated-image-section-tab-title").attr("class","tab-title-selected");
$("#my-generated-image-section-tab").show();
$("#all-generated-image-section-tab").hide();
$("#all-generated-image-section-tab-title").attr("class","tab-title")
}function showAllGeneratedImageSectionTab(){$("#my-generated-image-section-tab").hide();
$("#my-generated-image-section-tab-title").attr("class","tab-title");
$("#all-generated-image-section-tab").show();
$("#all-generated-image-section-tab-title").attr("class","tab-title-selected")
}function setImageJobMessage(B,A){$("#progress-message").text(A)
}function setImageJobState(C,A){if(A==ImageJob.STATE_COMPLETED){__generatingImage=false;
var B=GeneratedImageHistoryManager.getMyHistoryInstance().getGeneratedImage(C);
addGeneratedImage("myHistory",B);
if(__username==ANONYMOUS_USER){GeneratedImageHistoryManager.getMyHistoryInstance().storeToCookie()
}}else{if(A==ImageJob.STATE_FAILED){__generatingImage=false;
$("#generate-button").css({opacity:1});
$("#generate-button").bind("click",generateImage)
}}}function addGeneratedImageToAllHistory(A){var B=ImageGeneratorManager.getInstance().getImageGenerator(A.generatorId);
var C=new GeneratedImage(A.id,B,A.parameters,A.properties);
GeneratedImageHistoryManager.getAllHistoryInstance().addGeneratedImage(C);
addGeneratedImage("allHistory",C)
}function removeGeneratedImageToAllHistory(A){$("#image-box-all_"+A).animate({width:0,height:0,opacity:0},1000,null,function(){$("#image-box-all-"+A).remove();
GeneratedImageHistoryManager.getAllHistoryInstance().removeGeneratedImage(A)
})
}function setGeneratorGenerationCount(F,E,A,C){var B=GeneratorStatManager.getInstance().getGeneratorStat(F);
var D=0;
if(B==null){B=new GeneratorStat(F,E,C,A);
GeneratorStatManager.getInstance().addGeneratorStat(B)
}else{D=B.generationCount;
B.generationCount=E;
B.ratingCount=A;
B.totalStarCount=C
}if(D!=E){$(".image-generator-generation-count-"+F).text(""+E);
$(".image-generator-generation-count-"+F).css("color","red");
setTimeout(function(){$(".image-generator-generation-count-"+F).css("color","white");
$("tooltip-label .image-generator-generation-count-"+F).css("color","white")
},2000);
$("#total-image-generated-count").text(""+GeneratorStatManager.getInstance().getTotalImageGeneratedCount());
$("#total-image-generated-count").css("color","#f00");
setTimeout(function(){$("#total-image-generated-count").css("color","#000")
},2000)
}};
function initRegistration(){$("#username").focus(function(){$("#username-info").attr("class","input-info");
$("#username-info-text").text("Minimum 4 characters, maximum 15 characters.")
});
$("#username").blur(function(){$("#username-info").attr("class","input-info");
$("#username-info-text").text("");
var A=$("#username").val();
if(A==""){return 
}else{if(A.length<4||A>16){$("#username-info").attr("class","input-error");
$("#username-info-text").text("Username must be between 4 and 15 characters.");
return 
}else{if(!A.match(/^[a-zA-Z0-9]+$/)){$("#username-info").attr("class","input-error");
$("#username-info-text").text("Usernames may only contain letters and numbers.");
return 
}else{AjaxController.usernameExists(A,function(B){if(B){$("#username-info").attr("class","input-error");
$("#username-info-text").html("<b>"+A+"</b> is already taken. Please choose a different username.")
}else{$("#username-info").attr("class","input-ok-nobg");
$("#username-info-text").text("")
}})
}}}});
$("#password").focus(function(){$("#password-info").attr("class","input-info");
$("#password-info-text").text("Must be at least 6 characters long.")
});
$("#password").blur(function(){var A=$("#password").val();
if(A==""){$("#password-info").attr("class","input-info");
$("#password-info-text").text("")
}else{if(!A.match(/^[a-zA-Z0-9]{6,}$/)){$("#password-info").attr("class","input-error");
$("#password-info-text").text("Passwords must be at least 6 characters and can only contain letters and numbers.")
}else{$("#password-info").attr("class","input-ok-nobg");
$("#password-info-text").text("")
}}});
$("#confirmPassword").focus(function(){$("#confirmPassword-info").attr("class","input-info");
$("#confirmPassword-info-text").text("Type in your password again for verification purposes.")
});
$("#confirmPassword").blur(function(){var B=$("#password").val();
var A=$("#confirmPassword").val();
if(A==""){$("#confirmPassword-info").attr("class","input-info");
$("#confirmPassword-info-text").text("")
}else{if(B!=A){$("#confirmPassword-info").attr("class","input-error");
$("#confirmPassword-info-text").text("Passwords do not match.")
}else{$("#confirmPassword-info").attr("class","input-ok-nobg");
$("#confirmPassword-info-text").text("")
}}});
$("#email").focus(function(){$("#email-info").attr("class","input-info");
$("#email-info-text").text("Don't worry, your email will never be shared.")
});
$("#email").blur(function(){$("#email-info").attr("class","input-info");
$("#email-info-text").text("");
var A=$("#email").val();
if(A==""){}else{if(!A.match(/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/)){$("#email-info").attr("class","input-error");
$("#email-info-text").text("The email provided does not appear to be valid")
}else{AjaxController.emailExists(A,function(B){if(B){$("#email-info").attr("class","input-error");
$("#email-info-text").html("That email is already taken. Please <a href='Login'>login</a>.")
}else{$("#email-info").attr("class","input-ok-nobg");
$("#email-info-text").text("")
}})
}}})
};
jQuery.ui||(function(G){var A=G.fn.remove,F=G.browser.mozilla&&(parseFloat(G.browser.version)<1.9);
G.ui={version:"1.7.1",plugin:{add:function(L,K,N){var J=G.ui[L].prototype;
for(var M in N){J.plugins[M]=J.plugins[M]||[];
J.plugins[M].push([K,N[M]])
}},call:function(M,K,L){var N=M.plugins[K];
if(!N||!M.element[0].parentNode){return 
}for(var J=0;
J<N.length;
J++){if(M.options[N[J][0]]){N[J][1].apply(M.element,L)
}}}},contains:function(J,K){return document.compareDocumentPosition?J.compareDocumentPosition(K)&16:J!==K&&J.contains(K)
},hasScroll:function(J,L){if(G(J).css("overflow")=="hidden"){return false
}var M=(L&&L=="left")?"scrollLeft":"scrollTop",K=false;
if(J[M]>0){return true
}J[M]=1;
K=(J[M]>0);
J[M]=0;
return K
},isOverAxis:function(K,L,J){return(K>L)&&(K<(L+J))
},isOver:function(N,L,O,J,M,K){return G.ui.isOverAxis(N,O,M)&&G.ui.isOverAxis(L,J,K)
},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};
if(F){var D=G.attr,E=G.fn.removeAttr,B="http://www.w3.org/2005/07/aaa",I=/^aria-/,H=/^wairole:/;
G.attr=function(L,M,K){var J=K!==undefined;
return(M=="role"?(J?D.call(this,L,M,"wairole:"+K):(D.apply(this,arguments)||"").replace(H,"")):(I.test(M)?(J?L.setAttributeNS(B,M.replace(I,"aaa:"),K):D.call(this,L,M.replace(I,"aaa:"))):D.apply(this,arguments)))
};
G.fn.removeAttr=function(J){return(I.test(J)?this.each(function(){this.removeAttributeNS(B,J.replace(I,""))
}):E.call(this,J))
}
}G.fn.extend({remove:function(){G("*",this).add(this).each(function(){G(this).triggerHandler("remove")
});
return A.apply(this,arguments)
},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")
},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false
})
},scrollParent:function(){var J;
if((G.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){J=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(G.curCSS(this,"position",1))&&(/(auto|scroll)/).test(G.curCSS(this,"overflow",1)+G.curCSS(this,"overflow-y",1)+G.curCSS(this,"overflow-x",1))
}).eq(0)
}else{J=this.parents().filter(function(){return(/(auto|scroll)/).test(G.curCSS(this,"overflow",1)+G.curCSS(this,"overflow-y",1)+G.curCSS(this,"overflow-x",1))
}).eq(0)
}return(/fixed/).test(this.css("position"))||!J.length?G(document):J
}});
G.extend(G.expr[":"],{data:function(J,K,L){return !!G.data(J,L[3])
},focusable:function(K){var J=K.nodeName.toLowerCase(),L=G.attr(K,"tabindex");
return(/input|select|textarea|button|object/.test(J)?!K.disabled:"a"==J||"area"==J?K.href||!isNaN(L):!isNaN(L))&&!G(K)["area"==J?"parents":"closest"](":hidden").length
},tabbable:function(J){var K=G.attr(J,"tabindex");
return(isNaN(K)||K>=0)&&G(J).is(":focusable")
}});
function C(J,O,N,K){function L(P){var Q=G[J][O][P]||[];
return(typeof Q=="string"?Q.split(/,?\s+/):Q)
}var M=L("getter");
if(K.length==1&&typeof K[0]=="string"){M=M.concat(L("getterSetter"))
}return(G.inArray(N,M)!=-1)
}G.widget=function(K,L){var J=K.split(".")[0];
K=K.split(".")[1];
G.fn[K]=function(N){var P=(typeof N=="string"),O=Array.prototype.slice.call(arguments,1);
if(P&&N.substring(0,1)=="_"){return this
}if(P&&C(J,K,N,O)){var M=G.data(this[0],K);
return(M?M[N].apply(M,O):undefined)
}return this.each(function(){var Q=G.data(this,K);
(!Q&&!P&&G.data(this,K,new G[J][K](this,N))._init());
(Q&&P&&G.isFunction(Q[N])&&Q[N].apply(Q,O))
})
};
G[J]=G[J]||{};
G[J][K]=function(N,O){var M=this;
this.namespace=J;
this.widgetName=K;
this.widgetEventPrefix=G[J][K].eventPrefix||K;
this.widgetBaseClass=J+"-"+K;
this.options=G.extend({},G.widget.defaults,G[J][K].defaults,G.metadata&&G.metadata.get(N)[K],O);
this.element=G(N).bind("setData."+K,function(Q,R,P){if(Q.target==N){return M._setData(R,P)
}}).bind("getData."+K,function(P,Q){if(P.target==N){return M._getData(Q)
}}).bind("remove",function(){return M.destroy()
})
};
G[J][K].prototype=G.extend({},G.widget.prototype,L);
G[J][K].getterSetter="option"
};
G.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")
},option:function(K,J){var L=K,M=this;
if(typeof K=="string"){if(J===undefined){return this._getData(K)
}L={};
L[K]=J
}G.each(L,function(O,N){M._setData(O,N)
})
},_getData:function(J){return this.options[J]
},_setData:function(K,J){this.options[K]=J;
if(K=="disabled"){this.element[J?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",J)
}},enable:function(){this._setData("disabled",false)
},disable:function(){this._setData("disabled",true)
},_trigger:function(K,J,P){var N=this.options[K],M=(K==this.widgetEventPrefix?K:this.widgetEventPrefix+K);
J=G.Event(J);
J.type=M;
if(J.originalEvent){for(var L=G.event.props.length,O;
L;
){O=G.event.props[--L];
J[O]=J.originalEvent[O]
}}this.element.trigger(J,P);
return !(G.isFunction(N)&&N.call(this.element[0],J,P)===false||J.isDefaultPrevented())
}};
G.widget.defaults={disabled:false};
G.ui.mouse={_mouseInit:function(){var J=this;
this.element.bind("mousedown."+this.widgetName,function(K){return J._mouseDown(K)
}).bind("click."+this.widgetName,function(K){if(J._preventClickEvent){J._preventClickEvent=false;
K.stopImmediatePropagation();
return false
}});
if(G.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");
this.element.attr("unselectable","on")
}this.started=false
},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);
(G.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))
},_mouseDown:function(K){K.originalEvent=K.originalEvent||{};
if(K.originalEvent.mouseHandled){return 
}(this._mouseStarted&&this._mouseUp(K));
this._mouseDownEvent=K;
var L=this,J=(K.which==1),M=(typeof this.options.cancel=="string"?G(K.target).parents().add(K.target).filter(this.options.cancel).length:false);
if(!J||M||!this._mouseCapture(K)){return true
}this.mouseDelayMet=!this.options.delay;
if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){L.mouseDelayMet=true
},this.options.delay)
}if(this._mouseDistanceMet(K)&&this._mouseDelayMet(K)){this._mouseStarted=(this._mouseStart(K)!==false);
if(!this._mouseStarted){K.preventDefault();
return true
}}this._mouseMoveDelegate=function(N){return L._mouseMove(N)
};
this._mouseUpDelegate=function(N){return L._mouseUp(N)
};
G(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);
(G.browser.safari||K.preventDefault());
K.originalEvent.mouseHandled=true;
return true
},_mouseMove:function(J){if(G.browser.msie&&!J.button){return this._mouseUp(J)
}if(this._mouseStarted){this._mouseDrag(J);
return J.preventDefault()
}if(this._mouseDistanceMet(J)&&this._mouseDelayMet(J)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,J)!==false);
(this._mouseStarted?this._mouseDrag(J):this._mouseUp(J))
}return !this._mouseStarted
},_mouseUp:function(J){G(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);
if(this._mouseStarted){this._mouseStarted=false;
this._preventClickEvent=(J.target==this._mouseDownEvent.target);
this._mouseStop(J)
}return false
},_mouseDistanceMet:function(J){return(Math.max(Math.abs(this._mouseDownEvent.pageX-J.pageX),Math.abs(this._mouseDownEvent.pageY-J.pageY))>=this.options.distance)
},_mouseDelayMet:function(J){return this.mouseDelayMet
},_mouseStart:function(J){},_mouseDrag:function(J){},_mouseStop:function(J){},_mouseCapture:function(J){return true
}};
G.ui.mouse.defaults={cancel:null,distance:1,delay:0}
})(jQuery);
(function(A){A.widget("ui.slider",A.extend({},A.ui.mouse,{_init:function(){var B=this,C=this.options;
this._keySliding=false;
this._handleIndex=null;
this._detectOrientation();
this._mouseInit();
this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget ui-widget-content ui-corner-all");
this.range=A([]);
if(C.range){if(C.range===true){this.range=A("<div></div>");
if(!C.values){C.values=[this._valueMin(),this._valueMin()]
}if(C.values.length&&C.values.length!=2){C.values=[C.values[0],C.values[0]]
}}else{this.range=A("<div></div>")
}this.range.appendTo(this.element).addClass("ui-slider-range");
if(C.range=="min"||C.range=="max"){this.range.addClass("ui-slider-range-"+C.range)
}this.range.addClass("ui-widget-header")
}if(A(".ui-slider-handle",this.element).length==0){A('<a href="#"></a>').appendTo(this.element).addClass("ui-slider-handle")
}if(C.values&&C.values.length){while(A(".ui-slider-handle",this.element).length<C.values.length){A('<a href="#"></a>').appendTo(this.element).addClass("ui-slider-handle")
}}this.handles=A(".ui-slider-handle",this.element).addClass("ui-state-default ui-corner-all");
this.handle=this.handles.eq(0);
this.handles.add(this.range).filter("a").click(function(D){D.preventDefault()
}).hover(function(){A(this).addClass("ui-state-hover")
},function(){A(this).removeClass("ui-state-hover")
}).focus(function(){A(".ui-slider .ui-state-focus").removeClass("ui-state-focus");
A(this).addClass("ui-state-focus")
}).blur(function(){A(this).removeClass("ui-state-focus")
});
this.handles.each(function(D){A(this).data("index.ui-slider-handle",D)
});
this.handles.keydown(function(D){var G=true;
var H=A(this).data("index.ui-slider-handle");
if(B.options.disabled){return 
}switch(D.keyCode){case A.ui.keyCode.HOME:case A.ui.keyCode.END:case A.ui.keyCode.UP:case A.ui.keyCode.RIGHT:case A.ui.keyCode.DOWN:case A.ui.keyCode.LEFT:G=false;
if(!B._keySliding){B._keySliding=true;
A(this).addClass("ui-state-active");
B._start(D,H)
}break
}var F,I,E=B._step();
if(B.options.values&&B.options.values.length){F=I=B.values(H)
}else{F=I=B.value()
}switch(D.keyCode){case A.ui.keyCode.HOME:I=B._valueMin();
break;
case A.ui.keyCode.END:I=B._valueMax();
break;
case A.ui.keyCode.UP:case A.ui.keyCode.RIGHT:if(F==B._valueMax()){return 
}I=F+E;
break;
case A.ui.keyCode.DOWN:case A.ui.keyCode.LEFT:if(F==B._valueMin()){return 
}I=F-E;
break
}B._slide(D,H,I);
return G
}).keyup(function(D){var E=A(this).data("index.ui-slider-handle");
if(B._keySliding){B._stop(D,E);
B._change(D,E);
B._keySliding=false;
A(this).removeClass("ui-state-active")
}});
this._refreshValue()
},destroy:function(){this.handles.remove();
this.range.remove();
this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider");
this._mouseDestroy()
},_mouseCapture:function(I){var H=this.options;
if(H.disabled){return false
}this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};
this.elementOffset=this.element.offset();
var E={x:I.pageX,y:I.pageY};
var C=this._normValueFromMouse(E);
var J=this._valueMax()-this._valueMin()+1,G;
var B=this,D;
this.handles.each(function(M){var L=Math.abs(C-B.values(M));
if(J>L){J=L;
G=A(this);
D=M
}});
if(H.range==true&&this.values(1)==H.min){G=A(this.handles[++D])
}this._start(I,D);
B._handleIndex=D;
G.addClass("ui-state-active").focus();
var F=G.offset();
var K=!A(I.target).parents().andSelf().is(".ui-slider-handle");
this._clickOffset=K?{left:0,top:0}:{left:I.pageX-F.left-(G.width()/2),top:I.pageY-F.top-(G.height()/2)-(parseInt(G.css("borderTopWidth"),10)||0)-(parseInt(G.css("borderBottomWidth"),10)||0)+(parseInt(G.css("marginTop"),10)||0)};
C=this._normValueFromMouse(E);
this._slide(I,D,C);
return true
},_mouseStart:function(B){return true
},_mouseDrag:function(C){var B={x:C.pageX,y:C.pageY};
var D=this._normValueFromMouse(B);
this._slide(C,this._handleIndex,D);
return false
},_mouseStop:function(B){this.handles.removeClass("ui-state-active");
this._stop(B,this._handleIndex);
this._change(B,this._handleIndex);
this._handleIndex=null;
this._clickOffset=null;
return false
},_detectOrientation:function(){this.orientation=this.options.orientation=="vertical"?"vertical":"horizontal"
},_normValueFromMouse:function(H){var I,D;
if("horizontal"==this.orientation){I=this.elementSize.width;
D=H.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)
}else{I=this.elementSize.height;
D=H.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)
}var F=(D/I);
if(F>1){F=1
}if(F<0){F=0
}if("vertical"==this.orientation){F=1-F
}var G=this._valueMax()-this._valueMin(),C=F*G,B=C%this.options.step,E=this._valueMin()+C-B;
if(B>(this.options.step/2)){E+=this.options.step
}return parseFloat(E.toFixed(5))
},_start:function(C,D){var B={handle:this.handles[D],value:this.value()};
if(this.options.values&&this.options.values.length){B.value=this.values(D);
B.values=this.values()
}this._trigger("start",C,B)
},_slide:function(E,F,G){var D=this.handles[F];
if(this.options.values&&this.options.values.length){var B=this.values(F?0:1);
if((F==0&&G>=B)||(F==1&&G<=B)){G=B
}if(G!=this.values(F)){var H=this.values();
H[F]=G;
var C=this._trigger("slide",E,{handle:this.handles[F],value:G,values:H});
var B=this.values(F?0:1);
if(C!==false){this.values(F,G,(E.type=="mousedown"&&this.options.animate),true)
}}}else{if(G!=this.value()){var C=this._trigger("slide",E,{handle:this.handles[F],value:G});
if(C!==false){this._setData("value",G,(E.type=="mousedown"&&this.options.animate))
}}}},_stop:function(C,D){var B={handle:this.handles[D],value:this.value()};
if(this.options.values&&this.options.values.length){B.value=this.values(D);
B.values=this.values()
}this._trigger("stop",C,B)
},_change:function(C,D){var B={handle:this.handles[D],value:this.value()};
if(this.options.values&&this.options.values.length){B.value=this.values(D);
B.values=this.values()
}this._trigger("change",C,B)
},value:function(B){if(arguments.length){this._setData("value",B);
this._change(null,0)
}return this._value()
},values:function(B,C,E,D){if(arguments.length>1){this.options.values[B]=C;
this._refreshValue(E);
if(!D){this._change(null,B)
}}if(arguments.length){if(this.options.values&&this.options.values.length){return this._values(B)
}else{return this.value()
}}else{return this._values()
}},_setData:function(B,C,D){A.widget.prototype._setData.apply(this,arguments);
switch(B){case"orientation":this._detectOrientation();
this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation);
this._refreshValue(D);
break;
case"value":this._refreshValue(D);
break
}},_step:function(){var B=this.options.step;
return B
},_value:function(){var B=this.options.value;
if(B<this._valueMin()){B=this._valueMin()
}if(B>this._valueMax()){B=this._valueMax()
}return B
},_values:function(B){if(arguments.length){var C=this.options.values[B];
if(C<this._valueMin()){C=this._valueMin()
}if(C>this._valueMax()){C=this._valueMax()
}return C
}else{return this.options.values
}},_valueMin:function(){var B=this.options.min;
return B
},_valueMax:function(){var B=this.options.max;
return B
},_refreshValue:function(K){var H=this.options.range,J=this.options,B=this;
if(this.options.values&&this.options.values.length){var E,F;
this.handles.each(function(N,P){var O=(B.values(N)-B._valueMin())/(B._valueMax()-B._valueMin())*100;
var M={};
M[B.orientation=="horizontal"?"left":"bottom"]=O+"%";
A(this).stop(1,1)[K?"animate":"css"](M,J.animate);
if(B.options.range===true){if(B.orientation=="horizontal"){(N==0)&&B.range.stop(1,1)[K?"animate":"css"]({left:O+"%"},J.animate);
(N==1)&&B.range[K?"animate":"css"]({width:(O-lastValPercent)+"%"},{queue:false,duration:J.animate})
}else{(N==0)&&B.range.stop(1,1)[K?"animate":"css"]({bottom:(O)+"%"},J.animate);
(N==1)&&B.range[K?"animate":"css"]({height:(O-lastValPercent)+"%"},{queue:false,duration:J.animate})
}}lastValPercent=O
})
}else{var D=this.value(),G=this._valueMin(),C=this._valueMax(),I=C!=G?(D-G)/(C-G)*100:0;
var L={};
L[B.orientation=="horizontal"?"left":"bottom"]=I+"%";
this.handle.stop(1,1)[K?"animate":"css"](L,J.animate);
(H=="min")&&(this.orientation=="horizontal")&&this.range.stop(1,1)[K?"animate":"css"]({width:I+"%"},J.animate);
(H=="max")&&(this.orientation=="horizontal")&&this.range[K?"animate":"css"]({width:(100-I)+"%"},{queue:false,duration:J.animate});
(H=="min")&&(this.orientation=="vertical")&&this.range.stop(1,1)[K?"animate":"css"]({height:I+"%"},J.animate);
(H=="max")&&(this.orientation=="vertical")&&this.range[K?"animate":"css"]({height:(100-I)+"%"},{queue:false,duration:J.animate})
}}}));
A.extend(A.ui.slider,{getter:"value values",version:"1.7.1",eventPrefix:"slide",defaults:{animate:false,delay:0,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null}})
})(jQuery);
var imageId=null;
var zoomValue=100;
var usedImageId=null;
var usedZoomValue=null;
var usedCropX=null;
var usedCropY=null;
var usedCropWidth=null;
var usedCropHeight=null;
var cropX=null;
var cropY=null;
var cropWidth=null;
var cropHeight=null;
var lastCropX=null;
var lastCropY=null;
var lastCropWidth=null;
var lastCropHeight=null;
var divContainers="";
var imgWidth;
var imgHeight;
var scaledImgWidth;
var scaledImgHeight;
var isCropping=false;
var isDragging=false;
var resize=null;
var dragOffsetX;
var dragOffsetY;
function showImageFrame(){if(!isCropping){return 
}cropX=(cropX<0)?0:cropX;
if(cropX+cropWidth>scaledImgWidth-1){cropX=scaledImgWidth-cropWidth-1;
if(cropX<0){cropX=0;
cropWidth=scaledImgWidth
}}cropY=(cropY<0)?0:cropY;
if(cropY+cropHeight>scaledImgHeight-2){cropY=scaledImgHeight-cropHeight-2;
if(cropY<0){cropY=0;
cropHeight=scaledImgHeight
}}$("#crop-width").val(""+cropWidth);
$("#crop-height").val(""+cropHeight);
$("#topDiv").css({width:scaledImgWidth,height:cropY});
$("#leftDiv").css({top:cropY,width:cropX,height:cropHeight+1});
$("#rightDiv").css({left:cropX+cropWidth+1,top:cropY,width:scaledImgWidth-cropX-cropWidth-1,height:cropHeight+1});
$("#bottomDiv").css({top:cropY+cropHeight+1,width:scaledImgWidth,height:scaledImgHeight-cropY-cropHeight-2});
$("#selectedDiv").css({left:cropX,top:cropY,width:cropWidth,height:cropHeight});
$("#selectedDivSize").text(cropWidth+"x"+cropHeight);
$("#selectedDivSize").css({left:cropWidth/2-$("#selectedDivSize").width()/2,top:cropHeight/2-5,padding:2,opacity:0.7});
$("#resize_n").css({left:cropX+cropWidth/2-5,top:cropY-5});
$("#resize_nw").css({left:cropX+cropWidth-5,top:cropY-5});
$("#resize_w").css({left:cropX+cropWidth-5,top:cropY+cropHeight/2-5});
$("#resize_sw").css({left:cropX+cropWidth-5,top:cropY+cropHeight-5});
$("#resize_s").css({left:cropX+cropWidth/2-5,top:cropY+cropHeight-5});
$("#resize_se").css({left:cropX-5,top:cropY+cropHeight-5});
$("#resize_e").css({left:cropX-5,top:cropY+cropHeight/2-5});
$("#resize_ne").css({left:cropX-5,top:cropY-5})
}function refreshMainImage(){$("#croppedImageContainer").hide();
$("#filter-block").hide();
var A=$.IMG({src:"ImageEditor?action=show&id="+imageId+"&r="+new Date()});
$(A).load(function(){$("#mainImage").attr("src","ImageEditor?action=show&id="+imageId+"&r="+new Date());
$("#mainImage").css({width:this.width,height:this.height,});
imgWidth=this.width;
imgHeight=this.height;
scaledImgWidth=parseInt((imgWidth*zoomValue)/100);
scaledImgHeight=parseInt((imgHeight*zoomValue)/100);
$("#mainDiv").show();
$("#uploadDiv").hide();
$("#selectedDiv").mousedown(function(C){if(!isDragging&&resize==null){isDragging=true;
var B=parseInt(C.clientX)-parseInt($("#imageContainer").position().left)+$("#imageContainer").scrollLeft()+$(document).scrollLeft();
var D=parseInt(C.clientY)-parseInt($("#imageContainer").position().top)+$("#imageContainer").scrollTop()+$(document).scrollTop();
dragOffsetX=B-cropX;
dragOffsetY=D-cropY
}return false
});
$("#frontImageDiv").css({position:"absolute",left:$("#mainImage").position().left,top:$("#mainImage").position().top,width:this.width,height:this.height});
zoomImage(zoomValue)
})
}function startResize(A){if(resize==null&&!isDragging){lastCropX=cropX;
lastCropY=cropY;
lastCropWidth=cropWidth;
lastCropHeight=cropHeight;
resize=A
}return false
}function zoomImage(A){scaledImgWidth=parseInt((imgWidth*A)/100);
scaledImgHeight=parseInt((imgHeight*A)/100);
$("#mainImage").css({width:scaledImgWidth,height:scaledImgHeight});
$("#frontImageDiv").css({width:scaledImgWidth,height:scaledImgHeight});
zoomValue=A;
$("#zoomValue").html(A+"%");
showImageFrame()
}function cropImage(){$("#loadingDiv").show();
if(!isCropping){cropX=0;
cropY=0;
cropWidth=scaledImgWidth;
cropHeight=scaledImgHeight
}usedCropX=cropX;
usedCropY=cropY;
usedCropWidth=cropWidth;
usedCropHeight=cropHeight;
usedImageId=imageId;
usedZoomValue=zoomValue;
var A="ImageEditor?action=crop&zoom="+zoomValue+"&id="+imageId+"&x="+cropX+"&y="+cropY+"&width="+cropWidth+"&height="+cropHeight;
$("#croppedImage").attr("src",A+"&r="+new Date());
$("#croppedImageContainer").show();
$("#loadingDiv").hide();
document.location.href="ImageEditor#cropped-image";
$("#filter-block").show();
$("#filtered-image-div").hide()
}function transformImage(A){$("#loadingDiv").show();
$.ajax({type:"GET",url:"ImageEditor?action="+A+"&id="+imageId,dataType:"script",success:function(B){$("#loadingDiv").hide();
refreshMainImage()
}})
}function confirmCancelImageEdit(){var A=confirm("Are you sure you want to cancel the edition of this image?");
if(A){$("#mainDiv").hide();
$("#uploadDiv").show();
$(".resizeDot").hide();
$("#selectedDiv").hide();
$(".imageOutSelectDiv").width(0);
isCropping=false;
$("#frontImageDiv").css({cursor:"crosshair"});
$("#croppedImageContainer").hide();
$("#filter-block").hide()
}}function downloadCroppedImage(A){location.href="ImageEditor?action=crop&zoom="+zoomValue+"&id="+imageId+"&x="+cropX+"&y="+cropY+"&width="+cropWidth+"&height="+cropHeight+"&format="+A+"&download=true";
return false
}function downloadFilteredImage(B){var C=getParameterValues(__selectedFilter.parameterTypes);
var D="ImageEditor?action=crop&zoom="+usedZoomValue+"&id="+usedImageId+"&x="+usedCropX+"&y="+usedCropY+"&width="+usedCropWidth+"&height="+usedCropHeight+"&filter="+__selectedFilter.id;
for(var A in C){D+="&_"+A+"="+escape(C[A])
}location.href=D+"&format="+B+"&download=true";
return false
}function selectNetwork(A){if(scaledImgWidth<A[2]||scaledImgHeight<A[3]){displayModalWindow("Error"," Image too small to use the format of this network ("+A[2]+"px X "+A[3]+"px) ")
}if(!isCropping){startCropping()
}cropWidth=A[2];
cropHeight=A[3];
$("#network-select .choice-selector-label").empty();
$("#network-select .choice-selector-label").append($.IMG({src:"images/transparent.gif","class":"icon-"+A[0]}),A[1]);
showImageFrame()
}function startCropping(){cropX=0;
cropY=0;
cropWidth=0;
cropHeight=0;
$(".resizeDot").show();
$("#selectedDiv").show();
isCropping=true
}function initImageCropPage(){var B=[["blogger","Blogger",150,150],["deviantart","DeviantART",150,150],["digg","Digg",48,48],["facebook","Facebook",200,250],["flickr","Flickr",48,48],["friendster","Friendster",200,200],["gravatar","Gravatar",80,80],["lastfm","Last.fm",160,160],["lifestreamfm","Lifestream.fm",170,170],["linkedin","LinkedIn",80,80],["metacafe","Metacafe",75,83],["myspace","MySpace",170,170],["misterwong","Mister Wong",48,48],["phpbb","phpBB",90,90],["sevenload","SevenLoad",200,200],["skype","Skype",96,96],["studyvz","StudyVZ",200,262],["technorati","Technorati",62,62],["twitter","Twitter",48,48],["viadeo","Viadeo",140,185],["xing","Xing",140,185],["youtube","YouTube",130,100]];
var A=new PullDownMenu("#network-select",$.map(B,function(C){return new PullDownMenuItem(C[0],$.SPAN({},$.IMG({src:"images/transparent.gif","class":"icon-"+C[0]}),C[1]),function(){selectNetwork(C)
})
}),{prefixClassName:"choicePullDown"});
$("#crop-width").keydown(function(C){if(C.keyCode!=35&&C.keyCode!=36&&C.keyCode!=37&&C.keyCode!=39&&C.keyCode!=46&&C.keyCode!=8&&(C.keyCode<48||C.keyCode>57)){event.preventDefault();
return false
}});
$("#crop-width").keyup(function(D){if(D.keyCode!=8&&D.keyCode!=35&&D.keyCode!=36&&D.keyCode!=46&&(D.keyCode<48||D.keyCode>57)){return 
}var C=parseInt($("#crop-width").val());
if(isNaN(C)){return 
}if(!isCropping){startCropping()
}$("#crop-width").val(C);
cropWidth=C;
showImageFrame()
});
$("#crop-height").keydown(function(C){if(C.keyCode!=35&&C.keyCode!=36&&C.keyCode!=37&&C.keyCode!=39&&C.keyCode!=46&&C.keyCode!=8&&(C.keyCode<48||C.keyCode>57)){event.preventDefault();
return false
}});
$("#crop-height").keyup(function(D){if(D.keyCode!=8&&D.keyCode!=35&&D.keyCode!=36&&D.keyCode!=46&&(D.keyCode<48||D.keyCode>57)){return 
}var C=parseInt($("#crop-height").val());
if(isNaN(C)){return 
}if(!isCropping){startCropping()
}$("#crop-height").val(C);
cropHeight=C;
showImageFrame()
});
$("#zoomSlider").slider({value:100,min:5,max:100,stepping:1,click:function(D,C){zoomImage(C.value)
},slide:function(D,C){zoomImage(C.value)
}});
$("#zoomSlider .ui-slider-handle").hover(function(){$(this).removeClass("ui-slider-handle");
$(this).addClass("ui-slider-handle-hover")
},function(){$(this).addClass("ui-slider-handle");
$(this).removeClass("ui-slider-handle-hover")
});
$(document).mouseup(function(C){isDragging=false;
resize=null
});
$("#frontImageDiv").mousedown(function(C){if(!isCropping){startCropping();
cropX=parseInt(C.clientX)-parseInt($("#imageContainer").position().left)+$("#imageContainer").scrollLeft()+$(document).scrollLeft()-1;
cropY=parseInt(C.clientY)-parseInt($("#imageContainer").position().top)+$("#imageContainer").scrollTop()+$(document).scrollTop()-1;
cropWidth=1;
cropHeight=1;
startResize("SW");
showImageFrame();
$("#frontImageDiv").css({cursor:"default"});
return false
}});
$(document).mousemove(function(D){if(!isDragging&&resize==null){return 
}var C=parseInt(D.clientX)-parseInt($("#imageContainer").position().left)+$("#imageContainer").scrollLeft()+$(document).scrollLeft();
var E=parseInt(D.clientY)-parseInt($("#imageContainer").position().top)+$("#imageContainer").scrollTop()+$(document).scrollTop();
if(isDragging){cropX=C-dragOffsetX;
cropY=E-dragOffsetY
}else{if(resize!=null){if(resize.indexOf("N")>-1){cropY=E;
cropHeight=lastCropY+lastCropHeight-cropY
}else{if(resize.indexOf("S")>-1){cropHeight=E-lastCropY
}}if(resize.indexOf("W")>-1){cropWidth=C-lastCropX
}else{if(resize.indexOf("E")>-1){cropX=C;
cropWidth=lastCropX+lastCropWidth-cropX
}}if(cropX>lastCropX+lastCropWidth-1){cropX=lastCropX+lastCropWidth-1;
cropWidth=1
}else{if(cropWidth<1){cropWidth=1
}}if(cropY>lastCropY+lastCropHeight-1){cropY=lastCropY+lastCropHeight-1;
cropHeight=1
}else{if(cropHeight<1){cropHeight=1
}}}}showImageFrame()
});
$("#upload-button").upload({id:"upload_form",name:"file",action:"ImageEditor?action=upload",method:"post",enctype:"multipart/form-data",autoSubmit:true,onSubmit:function(){$("#loadingDiv").show()
},onComplete:function(C){if(C==-1){alert("Error uploading image")
}imageId=C;
$("#loadingDiv").hide();
refreshMainImage();
$("form")[0].reset()
},onSelect:function(){}})
};
var __feedbackDivOpened=false;
function initFeedback(){$(".feedback-textfield").hover(function(){$(this).removeClass("feedback-textfield");
$(this).addClass("feedback-textfield-hover")
},function(){$(this).addClass("feedback-textfield");
$(this).removeClass("feedback-textfield-hover")
});
$("#feedback-image").click(function(){if(!__feedbackDivOpened){openFeedBackDiv()
}else{closeFeedBackDiv()
}});
$("#feedback-cancel-button").click(function(){closeFeedBackDiv()
});
$("#feedback-send-button").click(function(){var A=$.trim($("#feedback-email").val());
var B=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if(A.length!=0&&!B.test(A)){displayModalWindow("Error","Your e-mail address is invalid.");
return 
}var C=$.trim($("#feedback-message").val());
if(C.length==0){displayModalWindow("Error","Please enter a message.");
return 
}AjaxController.sendFeedback($("#feedback-name").val(),A,C,document.location.href,function(D){setTimeout(function(){displayModalWindow("Feedback Sent","Thank you for your feedback.");
closeFeedBackDiv();
$("#feedback-name").val("");
$("#feedback-email").val("");
$("#feedback-message").val("")
},1)
})
})
}function openFeedBackDiv(){$("#feedback-div").animate({left:-1},1000,null,function(){$("#feedback-image").attr("class","feedback-image-hide")
});
__feedbackDivOpened=true
}function closeFeedBackDiv(){$("#feedback-div").animate({left:-202},1000,null,function(){$("#feedback-image").attr("class","feedback-image-show")
});
__feedbackDivOpened=false
};
(function(D){var A=D.fn.height,C=D.fn.width;
D.fn.extend({height:function(){if(this[0]==window){return self.innerHeight||D.boxModel&&document.documentElement.clientHeight||document.body.clientHeight
}if(this[0]==document){return Math.max(document.body.scrollHeight,document.body.offsetHeight)
}return A.apply(this,arguments)
},width:function(){if(this[0]==window){return self.innerWidth||D.boxModel&&document.documentElement.clientWidth||document.body.clientWidth
}if(this[0]==document){return Math.max(document.body.scrollWidth,document.body.offsetWidth)
}return C.apply(this,arguments)
},innerHeight:function(){return this[0]==window||this[0]==document?this.height():this.is(":visible")?this[0].offsetHeight-B(this,"borderTopWidth")-B(this,"borderBottomWidth"):this.height()+B(this,"paddingTop")+B(this,"paddingBottom")
},innerWidth:function(){return this[0]==window||this[0]==document?this.width():this.is(":visible")?this[0].offsetWidth-B(this,"borderLeftWidth")-B(this,"borderRightWidth"):this.width()+B(this,"paddingLeft")+B(this,"paddingRight")
},outerHeight:function(){return this[0]==window||this[0]==document?this.height():this.is(":visible")?this[0].offsetHeight:this.height()+B(this,"borderTopWidth")+B(this,"borderBottomWidth")+B(this,"paddingTop")+B(this,"paddingBottom")
},outerWidth:function(){return this[0]==window||this[0]==document?this.width():this.is(":visible")?this[0].offsetWidth:this.width()+B(this,"borderLeftWidth")+B(this,"borderRightWidth")+B(this,"paddingLeft")+B(this,"paddingRight")
},scrollLeft:function(F){if(F!=undefined){return this.each(function(){if(this==window||this==document){window.scrollTo(F,D(window).scrollTop())
}else{this.scrollLeft=F
}})
}if(this[0]==window||this[0]==document){return self.pageXOffset||D.boxModel&&document.documentElement.scrollLeft||document.body.scrollLeft
}return this[0].scrollLeft
},scrollTop:function(F){if(F!=undefined){return this.each(function(){if(this==window||this==document){window.scrollTo(D(window).scrollLeft(),F)
}else{this.scrollTop=F
}})
}if(this[0]==window||this[0]==document){return self.pageYOffset||D.boxModel&&document.documentElement.scrollTop||document.body.scrollTop
}return this[0].scrollTop
},position:function(O,J){var G=this[0],M=G.parentNode,I=G.offsetParent,O=D.extend({margin:false,border:false,padding:false,scroll:false},O||{}),L=G.offsetLeft,K=G.offsetTop,H=G.scrollLeft,N=G.scrollTop;
if(D.browser.mozilla||D.browser.msie){L+=B(G,"borderLeftWidth");
K+=B(G,"borderTopWidth")
}if(D.browser.mozilla){do{if(D.browser.mozilla&&M!=G&&D.css(M,"overflow")!="visible"){L+=B(M,"borderLeftWidth");
K+=B(M,"borderTopWidth")
}if(M==I){break
}}while((M=M.parentNode)&&(M.tagName.toLowerCase()!="body"||M.tagName.toLowerCase()!="html"))
}var F=E(G,O,L,K,H,N);
if(J){D.extend(J,F);
return this
}else{return F
}},offset:function(G,L){var K=0,J=0,T=0,O=0,U=this[0],I=this[0],H,F,S=D.css(U,"position"),R=D.browser.mozilla,M=D.browser.msie,W=D.browser.safari,Q=D.browser.opera,N=false,P=false,G=D.extend({margin:true,border:false,padding:false,scroll:true,lite:false},G||{});
if(G.lite){return this.offsetLite(G,L)
}if(U.tagName.toLowerCase()=="body"){K=U.offsetLeft;
J=U.offsetTop;
if(R){K+=B(U,"marginLeft")+(B(U,"borderLeftWidth")*2);
J+=B(U,"marginTop")+(B(U,"borderTopWidth")*2)
}else{if(Q){K+=B(U,"marginLeft");
J+=B(U,"marginTop")
}else{if(M&&jQuery.boxModel){K+=B(U,"borderLeftWidth");
J+=B(U,"borderTopWidth")
}}}}else{do{F=D.css(I,"position");
K+=I.offsetLeft;
J+=I.offsetTop;
if(R||M){K+=B(I,"borderLeftWidth");
J+=B(I,"borderTopWidth");
if(R&&F=="absolute"){N=true
}if(M&&F=="relative"){P=true
}}H=I.offsetParent;
if(G.scroll||R){do{if(G.scroll){T+=I.scrollLeft;
O+=I.scrollTop
}if(R&&I!=U&&D.css(I,"overflow")!="visible"){K+=B(I,"borderLeftWidth");
J+=B(I,"borderTopWidth")
}I=I.parentNode
}while(I!=H)
}I=H;
if(I.tagName.toLowerCase()=="body"||I.tagName.toLowerCase()=="html"){if((W||(M&&D.boxModel))&&S!="absolute"&&S!="fixed"){K+=B(I,"marginLeft");
J+=B(I,"marginTop")
}if((R&&!N&&S!="fixed")||(M&&S=="static"&&!P)){K+=B(I,"borderLeftWidth");
J+=B(I,"borderTopWidth")
}break
}}while(I)
}var V=E(U,G,K,J,T,O);
if(L){D.extend(L,V);
return this
}else{return V
}},offsetLite:function(N,I){var K=0,J=0,G=0,M=0,L=this[0],H,N=D.extend({margin:true,border:false,padding:false,scroll:true},N||{});
do{K+=L.offsetLeft;
J+=L.offsetTop;
H=L.offsetParent;
if(N.scroll){do{G+=L.scrollLeft;
M+=L.scrollTop;
L=L.parentNode
}while(L!=H)
}L=H
}while(L&&L.tagName.toLowerCase()!="body"&&L.tagName.toLowerCase()!="html");
var F=E(this[0],N,K,J,G,M);
if(I){D.extend(I,F);
return this
}else{return F
}}});
var B=function(F,G){return parseInt(D.css(F.jquery?F[0]:F,G))||0
};
var E=function(J,I,G,K,F,H){if(!I.margin){G-=B(J,"marginLeft");
K-=B(J,"marginTop")
}if(I.border&&(D.browser.safari||D.browser.opera)){G+=B(J,"borderLeftWidth");
K+=B(J,"borderTopWidth")
}else{if(!I.border&&!(D.browser.safari||D.browser.opera)){G-=B(J,"borderLeftWidth");
K-=B(J,"borderTopWidth")
}}if(I.padding){G+=B(J,"paddingLeft");
K+=B(J,"paddingTop")
}if(I.scroll){F-=J.scrollLeft;
H-=J.scrollTop
}return I.scroll?{top:K-H,left:G-F,scrollTop:H,scrollLeft:F}:{top:K,left:G}
}
})(jQuery);
function formatRemainingTimeFromNow(A){var E=(new Date()).getTime()-A;
var C=parseInt(E/1000);
if(C<=1){return"1 second ago"
}if(C<60){return C+" seconds ago"
}var D=parseInt(C/60);
if(D<60){return D+" minutes ago"
}var F=parseInt(D/60);
if(F==1){return"1 hour ago"
}if(F<24){return F+" hours ago"
}var I=parseInt(F/24);
if(I==1){return"1 day ago"
}if(I<24){return I+" days ago"
}var B=parseInt(I/7);
if(B==1){return"1 week ago"
}if(B<=4){return I+" weeks ago"
}var G=parseInt(I/30);
if(G<=1){return"1 month ago"
}if(G<=12){return G+" month ago"
}var H=parseInt(G/12);
if(H<=1){return"1 year ago"
}return H+" year ago"
}function centerModalWindow(C){var E=$(window).width();
E=parseInt(E);
var D=$(window).height();
D=parseInt(D);
$(C).css("visible","false");
$(C).css("display","block");
var B=$(C).width();
var A=$(C).height();
var G=Math.max(0,parseInt((E-B)/2));
var F=Math.max(0,parseInt((D-A)/2));
if($(C).css("position")=="absolute"){F+=$(document).scrollTop();
G+=$(document).scrollLeft()
}$(C).css("left",G+"px");
$(C).css("top",F+"px");
$(C).css("display","none");
$(C).css("visible","true")
}function to2Decimal(A){if(A<10){return"0"+A
}else{return A
}}function formatDate(E){var A=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
dateStr=A[E.getMonth()]+" "+to2Decimal(E.getDate())+" "+E.getFullYear();
var B=E.getHours();
var C;
if(B==12){C="PM"
}else{if(B==24){B=12;
C="AM"
}else{if(B<12){C="AM"
}else{B=B-12;
C="PM"
}}}var D=to2Decimal(B)+":"+to2Decimal(E.getMinutes())+" "+C;
return dateStr+" "+D
}function displayModalWindow(A,C){var B=$.DIV({"class":"modal-window jqmWindow"},$.DIV({"class":"modal-window-title"},A),$.DIV({"class":"modal-window-body"},C),$.DIV({"class":"modal-window-footer"},$.DIV({"class":"modal-window-button-container"},$.A({id:"modal-window-button","class":"button"},"OK"))));
$("html").append(B);
$("#modal-window-button").unbind();
$("#modal-window-button").click(function(){$(B).animate({opacity:0},500,null,function(){$(B).jqmHide();
$(B).remove()
})
});
$(B).show();
$(B).css({opacity:0});
$(B).jqm({toTop:true,modal:true});
$(B).jqmShow();
$(B).css("left",($(window).width()-$(B).width())/2);
$(B).css("top",($(window).height()-$(B).height())/2);
$(B).animate({opacity:1},500)
}function intToHex(C){var B=C.toString(16);
for(var A=B.length;
A<6;
A++){B="0"+B
}B="#"+B;
return B
};
(function(E){E.fn.jqm=function(F){var A={overlay:50,overlayClass:"jqmOverlay",closeClass:"jqmClose",trigger:".jqModal",ajax:O,ajaxText:"",target:O,modal:O,toTop:O,onShow:O,onHide:O,onLoad:O};
return this.each(function(){if(this._jqm){return N[this._jqm].c=E.extend({},N[this._jqm].c,F)
}P++;
this._jqm=P;
N[P]={c:E.extend(A,E.jqm.params,F),a:O,w:E(this).addClass("jqmID"+P),s:P};
if(A.trigger){E(this).jqmAddTrigger(A.trigger)
}})
};
E.fn.jqmAddClose=function(A){return M(this,A,"jqmHide")
};
E.fn.jqmAddTrigger=function(A){return M(this,A,"jqmShow")
};
E.fn.jqmShow=function(A){return this.each(function(){E.jqm.open(this._jqm,A)
})
};
E.fn.jqmHide=function(A){return this.each(function(){E.jqm.close(this._jqm,A)
})
};
E.jqm={hash:{},open:function(V,U){var L=N[V],Q=L.c,H="."+Q.closeClass,R=(parseInt(L.w.css("z-index"))),R=(R>0)?R:3000,F=E("<div></div>").css({height:"100%",width:"100%",position:"fixed",left:0,top:0,"z-index":R-1,opacity:Q.overlay/100});
if(L.a){return O
}L.t=U;
L.a=true;
L.w.css("z-index",R);
if(Q.modal){if(!B[0]){K("bind")
}B.push(V)
}else{if(Q.overlay>0){L.w.jqmAddClose(F)
}else{F=O
}}L.o=(F)?F.addClass(Q.overlayClass).prependTo("body"):O;
if(D){E("html,body").css({height:"100%",width:"100%"});
if(F){F=F.css({position:"absolute"})[0];
for(var S in {Top:1,Left:1}){F.style.setExpression(S.toLowerCase(),"(_=(document.documentElement.scroll"+S+" || document.body.scroll"+S+"))+'px'")
}}}if(Q.ajax){var A=Q.target||L.w,T=Q.ajax,A=(typeof A=="string")?E(A,L.w):E(A),T=(T.substr(0,1)=="@")?E(U).attr(T.substring(1)):T;
A.html(Q.ajaxText).load(T,function(){if(Q.onLoad){Q.onLoad.call(this,L)
}if(H){L.w.jqmAddClose(E(H,L.w))
}J(L)
})
}else{if(H){L.w.jqmAddClose(E(H,L.w))
}}if(Q.toTop&&L.o){L.w.before('<span id="jqmP'+L.w[0]._jqm+'"></span>').insertAfter(L.o)
}(Q.onShow)?Q.onShow(L):L.w.show();
J(L);
return O
},close:function(F){var A=N[F];
if(!A.a){return O
}A.a=O;
if(B[0]){B.pop();
if(!B[0]){K("unbind")
}}if(A.c.toTop&&A.o){E("#jqmP"+A.w[0]._jqm).after(A.w).remove()
}if(A.c.onHide){A.c.onHide(A)
}else{A.w.hide();
if(A.o){A.o.remove()
}}return O
},params:{}};
var P=0,N=E.jqm.hash,B=[],D=E.browser.msie&&(E.browser.version=="6.0"),O=false,G=E('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0}),J=function(A){if(D){if(A.o){A.o.html('<p style="width:100%;height:100%"/>').prepend(G)
}else{if(!E("iframe.jqm",A.w)[0]){A.w.prepend(G)
}}}I(A)
},I=function(F){try{E(":input:visible",F.w)[0].focus()
}catch(A){}},K=function(A){E()[A]("keypress",C)[A]("keydown",C)[A]("mousedown",C)
},C=function(H){var A=N[B[B.length-1]],F=(!E(H.target).parents(".jqmID"+A.s)[0]);
if(F){I(A)
}return !F
},M=function(A,F,H){return A.each(function(){var L=this._jqm;
E(F).each(function(){if(!this[H]){this[H]=[];
E(this).click(function(){for(var Q in {jqmShow:1,jqmHide:1}){for(var R in this[Q]){if(N[this[Q][R]]){N[this[Q][R]].w[Q](this)
}}}return O
})
}this[H].push(L)
})
})
}
})(jQuery);
jQuery.cookie=function(B,I,L){if(typeof I!="undefined"){L=L||{};
if(I===null){I="";
L.expires=-1
}var E="";
if(L.expires&&(typeof L.expires=="number"||L.expires.toUTCString)){var F;
if(typeof L.expires=="number"){F=new Date();
F.setTime(F.getTime()+(L.expires*24*60*60*1000))
}else{F=L.expires
}E="; expires="+F.toUTCString()
}var K=L.path?"; path="+(L.path):"";
var G=L.domain?"; domain="+(L.domain):"";
var A=L.secure?"; secure":"";
document.cookie=[B,"=",encodeURIComponent(I),E,K,G,A].join("")
}else{var D=null;
if(document.cookie&&document.cookie!=""){var J=document.cookie.split(";");
for(var H=0;
H<J.length;
H++){var C=jQuery.trim(J[H]);
if(C.substring(0,B.length+1)==(B+"=")){D=decodeURIComponent(C.substring(B.length+1));
break
}}}return D
}};
jQuery.fn.colorPicker=function(B,A,C){$.colorPicker(this,B,A,C);
return this
};
jQuery.colorPicker=function(A,C,B,D){var A=$(A).get(0);
return A.colorPicker||(A.colorPicker=new jQuery._colorPicker(A,C,B,D))
};
var c;
var previousSelectedStripe;
var __defaultColors=["#000000","#800000","#008000","#808000","#000080","#800080","#008080","#c0c0c0","#c0dcc0","#a6caf0","#fffbf0","#a0a0a0","#808080","#ff0000","#00ff00","#ffff00","#0000ff","#ff00ff"];
var __savedColors=__defaultColors.slice();
var __selectedColorTheme=null;
jQuery._colorPicker=function(B,D,C,E){$(B).css("background",C);
var A=this;
A.currentColor=C;
A.__createColorThemeMenuItem=function(F){var K=$.DIV({"class":"theme-color-small-stripe"});
$(K).css("background",intToHex(F.color1));
var J=$.DIV({"class":"theme-color-small-stripe"});
$(J).css("background",intToHex(F.color2));
var I=$.DIV({"class":"theme-color-small-stripe"});
$(I).css("background",intToHex(F.color3));
var H=$.DIV({"class":"theme-color-small-stripe"});
$(H).css("background",intToHex(F.color4));
var G=$.DIV({"class":"theme-color-small-stripe"});
$(G).css("background",intToHex(F.color5));
return[$.DIV({"class":"theme-color-small-stripe-container"},K,J,I,H,G),F.name]
};
A.showSelectorWindow=function(M){var P=A.currentColor;
var G=$($.DIV({id:"background-div"}));
$("BODY").append(G);
$(G).css({width:$("body").width(),height:$("#main-div").height(),opacity:0,background:"black","z-index":1000});
if(__username!=ANONYMOUS_USER){if(__selectedColorTheme==null){__selectedColorTheme=ColorThemeManager.getInstance().getColorThemes()[0]
}}$("BODY").append($.DIV({id:"color-picker-window"},$.DIV({id:"color-picker-title"},$.IMG({src:"images/transparent.gif",id:"color-picker-title-icon"}),D),$.DIV({id:"color-picker-body"},$.DIV({id:"color-picker-left-column"},$.DIV({id:"color-picker-tab-bar"},$.DIV({id:"color-picker-circle-tab","class":"color-picker-tab-selected"}),$.DIV({id:"color-picker-stripe-tab","class":"color-picker-tab-unselected"}),$.DIV({id:"color-picker-rgb-tab","class":"color-picker-tab-unselected"}),$.DIV({"class":"color-picker-clear-both"})),$.DIV({id:"color-picker-circle"}),$.DIV({id:"color-picker-stripe"},$.DIV({id:"color-picker-stripe-container"},$.map(["00","33","66","99","CC","FF"],function(Q){return $.DIV({"class":"color-stripe-row"},$.map(["00","33","66"],function(R){return $.map(["00","33","66","99","CC","FF"],function(S){var T=$.DIV({"class":"color-stripe",id:"col_"+R+S+Q});
$(T).css("background","#"+R+S+Q);
return T
})
}))
}),$.map(["00","33","66","99","CC","FF"],function(Q){return $.DIV({"class":"color-stripe-row"},$.map(["99","CC","FF"],function(R){return $.map(["00","33","66","99","CC","FF"],function(S){var T=$.DIV({"class":"color-stripe",id:"col_"+R+S+Q});
$(T).css("background","#"+R+S+Q);
return T
})
}))
}))),$.DIV({id:"color-picker-rgb"},$.DIV({id:"color-picker-rgb-container"},$.TABLE({},$.TBODY({},$.TR({},$.TD({align:"right","class":"color-picker-rgb-label"},"Red"),$.TD({},$.DIV({id:"color-picker-rgb-red-slider","class":"int-selector ui-slider-red"},$.DIV({id:"color-picker-rgb-red-slider-handle","class":"color-picker-rgb-slider-handle ui-slider-handle"})),$.INPUT({id:"color-picker-rgb-red-slider-text","class":"color-picker-rgb-slider-text int-selector-text textfield",type:"text"}))),$.TR({},$.TD({align:"right","class":"color-picker-rgb-label"},"Green"),$.TD({},$.DIV({id:"color-picker-rgb-green-slider","class":"int-selector ui-slider-green"},$.DIV({id:"color-picker-rgb-green-slider-handle","class":"color-picker-rgb-slider-handle ui-slider-handle"})),$.INPUT({id:"color-picker-rgb-green-slider-text","class":"color-picker-rgb-slider-text int-selector-text textfield",type:"text"}))),$.TR({},$.TD({align:"right","class":"color-picker-rgb-label"},"Blue"),$.TD({},$.DIV({id:"color-picker-rgb-blue-slider","class":"int-selector ui-slider-blue"},$.DIV({id:"color-picker-rgb-blue-slider-handle","class":"color-picker-rgb-slider-handle ui-slider-handle"})),$.INPUT({id:"color-picker-rgb-blue-slider-text","class":"color-picker-rgb-slider-text int-selector-text textfield",type:"text"})))))))),$.DIV({id:"color-picker-right-column"},$.DIV({id:"color-picker-hex-section"},$.DIV({"class":"color-picker-sample-label"},"Hex:"),$.INPUT({id:"color-picker-hex","class":"color-picker-hex textfield",type:"text"})),$.DIV({id:"color-picker-theme-section"},(__username==ANONYMOUS_USER||ColorThemeManager.getInstance().getColorThemes()==0)?null:[$.DIV({id:"color-picker-theme-color-label","class":"color-picker-sample-label"},"Theme:"),$.DIV({id:"color-picker-theme-color-selector-container"},$.A({id:"color-picker-theme-color-selector","class":"choice-selector"},$.DIV({"class":"choice-selector-label"},A.__createColorThemeMenuItem(__selectedColorTheme))),$.DIV({"class":"color-picker-saved-color-row"},$.map([1,2,3,4,5],function(Q){return $.A({id:"color-picker-theme-color-button-"+Q,"class":"color-picker-theme-color-button color-picker-color-button",href:"javascript:void(0)"}," ")
})))]),$.DIV({"class":"clear-both"}),$.DIV({id:"color-picker-saved-color-section"},$.A({id:"color-picker-save-color-button",href:"javascript:void(0)"},">>"),$.DIV({"class":"color-picker-saved-color-container"},$.map([0,1,2],function(Q){return $.DIV({"class":"color-picker-saved-color-row"},$.map([0,1,2,3,4,5],function(R){return $.A({id:"color-picker-saved-color-button-"+(Q*6+R),"class":"color-picker-saved-color-button color-picker-color-button",href:"javascript:void(0)"}," ")
}))
}))),$.DIV({id:"color-picker-sample-section"},$.DIV({"class":"color-picker-sample-label"},"Current:"),$.DIV({id:"color-picker-current-color","class":"color-picker-sample"})),$.DIV({},$.DIV({"class":"color-picker-sample-label"},"Old:"),$.DIV({id:"color-picker-old-color","class":"color-picker-sample"})))),$.DIV({"class":"color-picker-button-container"},$.DIV({id:"color-picker-cancel-button-container"},$.A({id:"color-picker-cancel-button","class":"button"},$.IMG({src:"images/transparent.gif","class":"icon-button-cancel",align:"middle"}),"Cancel")),$.DIV({id:"color-picker-confirm-button-container"},$.A({id:"color-picker-confirm-button","class":"button"},$.IMG({src:"images/transparent.gif","class":"icon-button-ok",align:"middle"}),"OK")))),$.DIV({"class":"color-picker-clear-both"}));
if(__username!=ANONYMOUS_USER&&ColorThemeManager.getInstance().getColorThemes().length>0){var L=new PullDownMenu("#color-picker-theme-color-selector",$.map(ColorThemeManager.getInstance().getColorThemes(),function(Q){var R=new PullDownMenuItem(Q.name,A.__createColorThemeMenuItem(Q),function(){$("#color-picker-theme-color-selector .choice-selector-label").empty();
var T=A.__createColorThemeMenuItem(Q);
$("#color-picker-theme-color-selector .choice-selector-label").append(T[0]);
$("#color-picker-theme-color-selector .choice-selector-label").append(T[1]);
for(var S=1;
S<=5;
S++){$("#color-picker-theme-color-button-"+S).css("background",intToHex(Q["color"+S]))
}__selectedColorTheme=Q
});
return R
}),{selectLastSelectedMenuItem:true,prefixClassName:"choicePullDown"});
for(var K=1;
K<=5;
K++){$("#color-picker-theme-color-button-"+K).css("background",intToHex(__selectedColorTheme["color"+K]))
}}$("#color-picker-stripe").hide();
$("#color-picker-rgb").hide();
$(".color-picker-rgb-slider-handle").hover(function(){$(this).removeClass("ui-slider-handle");
$(this).addClass("ui-slider-handle-hover")
},function(){$(this).addClass("ui-slider-handle");
$(this).removeClass("ui-slider-handle-hover")
});
$(".color-picker-rgb-slider-text").hover(function(){$(this).css({margin:"0px 0px 0px 10px",border:"2px solid #e48600"})
},function(){$(this).css({margin:"1px 1px 1px 11px",border:"1px solid #6e6e6e"})
});
$(".int-selector-text").hover(function(){$(this).css({margin:"0px 0px 0px 10px",border:"2px solid #e48600"})
},function(){$(this).css({margin:"1px 1px 1px 11px",border:"1px solid #6e6e6e"})
});
$("#color-picker-rgb-red-slider").slider({min:0,max:255,stepping:1,click:function(R,Q){A.changeRedSlider(Q.value)
},slide:function(R,Q){A.changeRedSlider(Q.value)
}});
$("#color-picker-rgb-red-slider-text").change(A.changeRedSliderText);
$("#color-picker-rgb-red-slider-text").keypress(function(R){var Q=(R.keyCode?R.keyCode:R.which);
if(Q==13){A.changeRedSliderText()
}});
$("#color-picker-rgb-green-slider").slider({min:0,max:255,stepping:1,click:function(R,Q){A.changeGreenSlider(Q.value)
},slide:function(R,Q){A.changeGreenSlider(Q.value)
}});
$("#color-picker-rgb-green-slider-text").change(A.changeGreenSliderText);
$("#color-picker-rgb-green-slider-text").keypress(function(R){var Q=(R.keyCode?R.keyCode:R.which);
if(Q==13){A.changeGreenSliderText()
}});
$("#color-picker-rgb-blue-slider").slider({min:0,max:255,stepping:1,click:function(R,Q){A.changeBlueSlider(Q.value)
},slide:function(R,Q){A.changeBlueSlider(Q.value)
}});
$("#color-picker-rgb-blue-slider-text").change(A.changeBlueSliderText);
$("#color-picker-rgb-blue-slider-text").keypress(function(R){var Q=(R.keyCode?R.keyCode:R.which);
if(Q==13){A.changeBlueSliderText()
}});
A.__refreshColorSliders();
$("#color-picker-hex").keypress(function(R){var Q=$("#color-picker-hex").attr("value");
if(Q.toLowerCase().match(/[0-9a-f]{6}/)){Q="#"+Q.toLowerCase().match(/[0-9a-f]{6}/);
A.setSelectedColor(Q)
}});
$("#color-picker-circle-tab").click(function(){$("#color-picker-circle-tab").attr("class","color-picker-tab-selected");
$("#color-picker-stripe-tab").attr("class","color-picker-tab-unselected");
$("#color-picker-rgb-tab").attr("class","color-picker-tab-unselected");
$("#color-picker-circle").show();
$("#color-picker-stripe").hide();
$("#color-picker-rgb").hide()
});
$("#color-picker-stripe-tab").click(function(){$("#color-picker-circle-tab").attr("class","color-picker-tab-unselected");
$("#color-picker-stripe-tab").attr("class","color-picker-tab-selected");
$("#color-picker-rgb-tab").attr("class","color-picker-tab-unselected");
$("#color-picker-circle").hide();
$("#color-picker-stripe").show();
$("#color-picker-rgb").hide()
});
$("#color-picker-rgb-tab").click(function(){$("#color-picker-circle-tab").attr("class","color-picker-tab-unselected");
$("#color-picker-stripe-tab").attr("class","color-picker-tab-unselected");
$("#color-picker-rgb-tab").attr("class","color-picker-tab-selected");
$("#color-picker-circle").hide();
$("#color-picker-stripe").hide();
$("#color-picker-rgb").show()
});
$(".color-stripe").click(function(Q){$(previousSelectedStripe).attr("class","color-stripe");
var R=Q.target;
$(R).attr("class","color-stripe color-stripe-selected");
var S="#"+$(R).attr("id").substr("4");
A.setSelectedColor(S);
previousSelectedStripe=R
});
$(".color-stripe").tooltip({track:true,showURL:false,bodyHandler:function(){var R="#"+$(this).attr("id").substr("4");
var S=$.DIV({"class":"color-square"});
var Q=$.DIV({});
$(Q).html("&nbsp; Hex: ");
$(Q).css({width:"40px","float":"left"});
$(S).css("background-color",R);
return $.DIV({"class":"tooltip-value"},S,Q,R)
}});
var J=M.pageX;
var N=M.pageY;
var O=462;
var I=310;
if(J+O-document.body.scrollLeft+10>$("BODY").width()){J=$("BODY").width()+document.body.scrollLeft-O-10
}if(J-document.body.scrollLeft<0){J=document.body.scrollLeft
}var F=$(window).height();
var H=Math.max(document.documentElement.scrollTop,$("BODY").offset().top);
if(N-H+I+4>F){N=F+H-I-4
}if(N-H-4<0){N=H+4
}$("#color-picker-window").css({left:J,top:N});
$("#color-picker-old-color").css("background",P);
$("#color-picker-circle").farbtastic(function(Q){$("#color-picker-hex").attr("value",Q);
$("#color-picker-current-color").css("background",Q);
A.currentColor=Q;
A.__refreshColorSliders()
});
$.farbtastic("#color-picker-circle").setColor(A.currentColor);
$("#color-picker-window").css({opacity:0,width:0,height:0},100);
$("#color-picker-window").show();
$("#color-picker-window").animate({opacity:1,width:O,height:I});
$("#color-picker-confirm-button").click(function(){$(B).css("background",A.currentColor);
$("#color-picker-window").animate({opacity:0,width:0,height:0},500,null,function(){$("#background-div").remove();
$("#color-picker-window").remove()
});
A.saveColor(A.currentColor);
if(E){E(A.currentColor)
}});
$("#color-picker-cancel-button").click(function(){$("#color-picker-window").animate({opacity:0,width:0,height:0},500,null,function(){$("#background-div").remove();
$("#color-picker-window").remove();
A.currentColor=P
})
});
$("#color-picker-save-color-button").click(function(){A.saveColor(A.currentColor)
});
$(".color-picker-theme-color-button").click(function(){var R=$(this).attr("id").match(/[0-9]+/);
var Q=intToHex(__selectedColorTheme["color"+R]);
A.setSelectedColor(Q)
});
$(".color-picker-saved-color-button").click(function(){var Q=$(this).attr("id").split("-")[5];
A.setSelectedColor(__savedColors[Q])
});
$(".color-picker-theme-color-button").tooltip({track:true,showURL:false,bodyHandler:function(){var T=$(this).attr("id").match(/[0-9]+/);
var R=intToHex(__selectedColorTheme["color"+T]);
var S=$.DIV({"class":"color-square"});
var Q=$.DIV({});
$(Q).html("&nbsp; Hex: ");
$(Q).css({width:"40px","float":"left"});
$(S).css("background-color",R);
return $.DIV({"class":"tooltip-value"},S,Q,R)
}});
$(".color-picker-saved-color-button").tooltip({track:true,showURL:false,bodyHandler:function(){var T=$(this).attr("id").split("-")[5];
var R=__savedColors[T];
var S=$.DIV({"class":"color-square"});
var Q=$.DIV({});
$(Q).html("&nbsp; Hex: ");
$(Q).css({width:"40px","float":"left"});
$(S).css("background-color",R);
return $.DIV({"class":"tooltip-value"},S,Q,R)
}});
$("#color-picker-hex").hover(function(){$(this).attr("class","textfield color-picker-hex color-picker-hex-hover")
},function(){$(this).attr("class","textfield color-picker-hex")
});
$("#color-picker-old-color").click(function(){A.setSelectedColor(P)
});
A.loadSavedColorFromCookie();
A.refreshSavedColorSection()
};
this.changeRedSliderText=function(){var F=$("#color-picker-rgb-red-slider-text").val()*1;
if(isNaN(F)){A.setSelectedColor(A.currentColor);
return false
}F=Math.max(F,0);
F=Math.min(F,255);
A.changeRedSlider(F);
return true
};
this.changeGreenSliderText=function(){var F=$("#color-picker-rgb-green-slider-text").val()*1;
if(isNaN(F)){A.setSelectedColor(A.currentColor);
return false
}F=Math.max(F,0);
F=Math.min(F,255);
A.changeGreenSlider(F);
return true
};
this.changeBlueSliderText=function(){var F=$("#color-picker-rgb-blue-slider-text").val()*1;
if(isNaN(F)){A.setSelectedColor(A.currentColor);
return false
}F=Math.max(F,0);
F=Math.min(F,255);
A.changeBlueSlider(F);
return true
};
this.changeRedSlider=function(H){var G=H.toString(16);
if(G.length==1){G="0"+G
}var F="#"+G+A.currentColor.substring(3,7);
this.setSelectedColor(F)
};
this.changeGreenSlider=function(H){var G=H.toString(16);
if(G.length==1){G="0"+G
}var F="#"+A.currentColor.substring(1,3)+G+A.currentColor.substring(5,7);
this.setSelectedColor(F)
};
this.changeBlueSlider=function(H){var G=H.toString(16);
if(G.length==1){G="0"+G
}var F="#"+A.currentColor.substring(1,5)+G;
this.setSelectedColor(F)
};
this.refreshSavedColorSection=function(){for(var F=0;
F<18;
F++){$("#color-picker-saved-color-button-"+F).css("background-color",__savedColors[F])
}};
this.__refreshColorSliders=function(){var G=A.currentColor;
var I=parseInt(G.substring(1,3),16);
$("#color-picker-rgb-red-slider").slider("option","value",I);
$("#color-picker-rgb-red-slider-text").val(""+I);
var H=parseInt(G.substring(3,5),16);
$("#color-picker-rgb-green-slider").slider("option","value",H);
$("#color-picker-rgb-green-slider-text").val(""+H);
var F=parseInt(G.substring(5,7),16);
$("#color-picker-rgb-blue-slider").slider("option","value",F);
$("#color-picker-rgb-blue-slider-text").val(""+F)
};
this.setSelectedColor=function(F){$("#color-picker-hex").attr("value",F);
$("#color-picker-current-color").css("background",F);
A.currentColor=F;
if($("#color-picker-circle").get(0)){$.farbtastic("#color-picker-circle").setColor(F);
A.__refreshColorSliders()
}};
this.setColor=function(F){$(B).css("background",F);
this.setSelectedColor(F)
};
this.saveColor=function(F){F=F.toLowerCase();
var H=-1;
for(var G=0;
G<__savedColors.length;
G++){if(__savedColors[G]==F){H=G;
break
}}if(H!=-1){__savedColors.splice(H,1)
}else{__savedColors.splice(17,1)
}__savedColors.splice(0,0,F);
this.refreshSavedColorSection();
this.storeSavedColorToCookie()
};
this.getColor=function(){return A.currentColor
};
this.storeSavedColorToCookie=function(){if(__savedColors==null||__savedColors.length==0){return 
}var G=__savedColors[0];
for(var F=1;
F<__savedColors.length;
F++){G+=","+__savedColors[F]
}$.cookie("savedColor",G,{expires:7})
};
this.loadSavedColorFromCookie=function(){__savedColors=[];
var J=$.cookie("savedColor");
if(J!=null){var F=J.split(",");
for(var I=0;
I<F.length;
I++){var G=F[I];
if(G.toUpperCase().match(/#[0-9A-F]{6}/)){__savedColors.push(G);
if(__savedColors.length>=18){break
}}}}var H=0;
while(__savedColors.length<18){__savedColors.push(__defaultColors[H++])
}var J=__savedColors[0];
for(var I=1;
I<__savedColors.length;
I++){J+=","+__savedColors[I]
}};
$(B).click(function(F){A.showSelectorWindow(F)
})
};
jQuery.fn.farbtastic=function(A){$.farbtastic(this,A);
return this
};
jQuery.farbtastic=function(A,B){var A=$(A).get(0);
return A.farbtastic||(A.farbtastic=new jQuery._farbtastic(A,B))
};
jQuery._farbtastic=function(A,D){var B=this;
$(A).html('<div class="farbtastic"><div class="color"></div><div class="wheel"></div><div class="overlay"></div><div class="h-marker marker"></div><div class="sl-marker marker"></div></div>');
var C=$(".farbtastic",A);
B.wheel=$(".wheel",A).get(0);
B.radius=84;
B.square=100;
B.width=194;
B.linkTo=function(E){if(typeof B.callback=="object"){$(B.callback).unbind("keyup",B.updateValue)
}B.color=null;
if(typeof E=="function"){B.callback=E
}else{if(typeof E=="object"||typeof E=="string"){B.callback=$(E);
B.callback.bind("keyup",B.updateValue);
if(B.callback.get(0).value){B.setColor(B.callback.get(0).value)
}}}return this
};
B.updateValue=function(E){if(this.value&&this.value!=B.color){B.setColor(this.value)
}};
B.setColor=function(E){var F=B.unpack(E);
if(B.color!=E&&F){B.color=E;
B.rgb=F;
B.hsl=B.RGBToHSL(B.rgb);
B.updateDisplay()
}return this
};
B.setHSL=function(E){B.hsl=E;
B.rgb=B.HSLToRGB(E);
B.color=B.pack(B.rgb);
B.updateDisplay();
return this
};
B.widgetCoords=function(H){var F,L;
var G=H.target||H.srcElement;
var E=B.wheel;
if(typeof H.offsetX!="undefined"){var K={x:H.offsetX,y:H.offsetY};
var I=G;
while(I){I.mouseX=K.x;
I.mouseY=K.y;
K.x+=I.offsetLeft;
K.y+=I.offsetTop;
I=I.offsetParent
}var I=E;
var J={x:0,y:0};
while(I){if(typeof I.mouseX!="undefined"){F=I.mouseX-J.x;
L=I.mouseY-J.y;
break
}J.x+=I.offsetLeft;
J.y+=I.offsetTop;
I=I.offsetParent
}I=G;
while(I){I.mouseX=undefined;
I.mouseY=undefined;
I=I.offsetParent
}}else{var K=B.absolutePosition(E);
F=(H.pageX||0*(H.clientX+$("html").get(0).scrollLeft))-K.x;
L=(H.pageY||0*(H.clientY+$("html").get(0).scrollTop))-K.y
}return{x:F-B.width/2,y:L-B.width/2}
};
B.mousedown=function(E){if(!document.dragging){$(document).bind("mousemove",B.mousemove).bind("mouseup",B.mouseup);
document.dragging=true
}var F=B.widgetCoords(E);
B.circleDrag=Math.max(Math.abs(F.x),Math.abs(F.y))*2>B.square;
B.mousemove(E);
return false
};
B.mousemove=function(H){var I=B.widgetCoords(H);
if(B.circleDrag){var G=Math.atan2(I.x,-I.y)/6.28;
if(G<0){G+=1
}B.setHSL([G,B.hsl[1],B.hsl[2]])
}else{var F=Math.max(0,Math.min(1,-(I.x/B.square)+0.5));
var E=Math.max(0,Math.min(1,-(I.y/B.square)+0.5));
B.setHSL([B.hsl[0],F,E])
}return false
};
B.mouseup=function(){$(document).unbind("mousemove",B.mousemove);
$(document).unbind("mouseup",B.mouseup);
document.dragging=false
};
B.updateDisplay=function(){var E=B.hsl[0]*6.28;
$(".h-marker",C).css({left:Math.round(Math.sin(E)*B.radius+B.width/2)+"px",top:Math.round(-Math.cos(E)*B.radius+B.width/2)+"px"});
$(".sl-marker",C).css({left:Math.round(B.square*(0.5-B.hsl[1])+B.width/2)+"px",top:Math.round(B.square*(0.5-B.hsl[2])+B.width/2)+"px"});
$(".color",C).css("backgroundColor",B.pack(B.HSLToRGB([B.hsl[0],1,0.5])));
if(typeof B.callback=="object"){$(B.callback).css({backgroundColor:B.color,color:B.hsl[2]>0.5?"#000":"#fff"});
$(B.callback).each(function(){if(this.value&&this.value!=B.color){this.value=B.color
}})
}else{if(typeof B.callback=="function"){B.callback.call(B,B.color)
}}};
B.absolutePosition=function(F){var G={x:F.offsetLeft,y:F.offsetTop};
if(F.offsetParent){var E=B.absolutePosition(F.offsetParent);
G.x+=E.x;
G.y+=E.y
}return G
};
B.pack=function(F){var H=Math.round(F[0]*255);
var G=Math.round(F[1]*255);
var E=Math.round(F[2]*255);
return"#"+(H<16?"0":"")+H.toString(16)+(G<16?"0":"")+G.toString(16)+(E<16?"0":"")+E.toString(16)
};
B.unpack=function(E){if(E.length==7){return[parseInt("0x"+E.substring(1,3))/255,parseInt("0x"+E.substring(3,5))/255,parseInt("0x"+E.substring(5,7))/255]
}else{if(E.length==4){return[parseInt("0x"+E.substring(1,2))/15,parseInt("0x"+E.substring(2,3))/15,parseInt("0x"+E.substring(3,4))/15]
}}};
B.HSLToRGB=function(J){var L,K,E,H,I;
var G=J[0],M=J[1],F=J[2];
K=(F<=0.5)?F*(M+1):F+M-F*M;
L=F*2-K;
return[this.hueToRGB(L,K,G+0.33333),this.hueToRGB(L,K,G),this.hueToRGB(L,K,G-0.33333)]
};
B.hueToRGB=function(F,E,G){G=(G<0)?G+1:((G>1)?G-1:G);
if(G*6<1){return F+(E-F)*G*6
}if(G*2<1){return E
}if(G*3<2){return F+(E-F)*(0.66666-G)*6
}return F
};
B.RGBToHSL=function(J){var G,L,M,H,N,F;
var E=J[0],I=J[1],K=J[2];
G=Math.min(E,Math.min(I,K));
L=Math.max(E,Math.max(I,K));
M=L-G;
F=(G+L)/2;
N=0;
if(F>0&&F<1){N=M/(F<0.5?(2*F):(2-2*F))
}H=0;
if(M>0){if(L==E&&L!=I){H+=(I-K)/M
}if(L==I&&L!=K){H+=(2+(K-E)/M)
}if(L==K&&L!=E){H+=(4+(E-I)/M)
}H/=6
}return[H,N,F]
};
$("*",C).mousedown(B.mousedown);
B.setColor("#000000");
if(D){B.linkTo(D)
}};
(function(A){A.bind=function(C,D){var B=Array.prototype.slice.call(arguments,2);
return function(){var E=[this].concat(B,A.makeArray(arguments));
return D.apply(C,E)
}
}
})(jQuery);
(function(A){A.fn.checkbox=function(B){try{document.execCommand("BackgroundImageCache",false,true)
}catch(E){}var D={cls:"jquery-checkbox",empty:"./js/checkbox/empty.png"};
D=A.extend(D,B||{});
var C=function(F){var I=F.checked;
var G=F.disabled;
var H=A(F);
if(F.stateInterval){clearInterval(F.stateInterval)
}F.stateInterval=setInterval(function(){if(F.disabled!=G){H.trigger((G=!!F.disabled)?"disable":"enable")
}if(F.checked!=I){H.trigger((I=!!F.checked)?"check":"uncheck")
}},10);
return H
};
try{console.log(this)
}catch(E){}return this.each(function(){var H=this;
var G=C(H);
if(H.wrapper){H.wrapper.remove()
}H.wrapper=A('<span class="'+D.cls+'"><span class="mark"><img src="'+D.empty+'" /></span></span>');
H.wrapperInner=H.wrapper.children("span");
H.wrapper.hover(function(){H.wrapperInner.addClass(D.cls+"-hover")
},function(){H.wrapperInner.removeClass(D.cls+"-hover")
});
G.css({position:"absolute",zIndex:-1}).after(H.wrapper);
var F=G.parents("label");
if(F.length){F.click(function(I){G.trigger("click",[I]);
return(A.browser.msie&&A.browser.version<7)
})
}else{H.wrapper.click(function(I){G.trigger("click",[I])
})
}delete F;
G.bind("disable",function(){H.wrapperInner.addClass(D.cls+"-disabled")
}).bind("enable",function(){H.wrapperInner.removeClass(D.cls+"-disabled")
});
G.bind("check",function(){H.wrapper.addClass(D.cls+"-checked")
}).bind("uncheck",function(){H.wrapper.removeClass(D.cls+"-checked")
});
A("img",H.wrapper).bind("dragstart",function(){return false
}).bind("mousedown",function(){return false
});
if(window.getSelection){H.wrapper.css("MozUserSelect","none")
}if(H.checked){H.wrapper.addClass(D.cls+"-checked")
}if(H.disabled){H.wrapperInner.addClass(D.cls+"-disabled")
}})
}
})(jQuery);
eval(function(E,A,F,B,D,C){D=function(G){return(G<A?"":D(parseInt(G/A)))+((G=G%A)>35?String.fromCharCode(G+29):G.toString(36))
};
if(!"".replace(/^/,String)){while(F--){C[D(F)]=B[F]||D(F)
}B=[function(G){return C[G]
}];
D=function(){return"\\w+"
};
F=1
}while(F--){if(B[F]){E=E.replace(new RegExp("\\b"+D(F)+"\\b","g"),B[F])
}}return E
}("(1($){$.13.14=1(a){a=$.B({3:'H',5:'15/C-16',6:'',v:I,o:1(){},p:1(){},q:1(){},7:{}},a);r D $.E(z,a)},$.E=1(f,g){2 h=z;2 i=D 17().18().19().1a(8);2 j=$('<w '+'1b=\"w'+i+'\" '+'3=\"w'+i+'\"'+'></w>').s({J:'1c'});2 k=$('<C '+'1d=\"1e\" '+'5=\"'+g.5+'\" '+'6=\"'+g.6+'\" '+'1f=\"w'+i+'\"'+'></C>').s({K:0,L:0});2 l=$('<M '+'3=\"'+g.3+'\" '+'N=\"H\" '+'/>').s({O:'P',J:'1g',1h:-1i+'t',1j:0});f.1k('<Q></Q>');k.R(l);f.S(k);f.S(j);2 m=f.1l().s({O:'P',T:f.1m()+'t',1n:f.1o()+'t',1p:'U',1q:'1r',K:0,L:0});l.s('1s',-m.T()-10+'t');m.1t(1(e){l.s({V:e.1u-m.W().V+'t',X:e.1v-m.W().X+'t'})});l.1w(1(){h.q();u(h.v){h.F()}});$.B(z,{v:I,o:g.o,p:g.p,q:g.q,1x:1(){r l.9('G')},7:1(a){2 a=a?a:x;u(a){g.7=$.B(g.7,a)}y{r g.7}},3:1(a){2 a=a?a:x;u(a){l.9('3',G)}y{r l.9('3')}},6:1(a){2 a=a?a:x;u(a){k.9('6',a)}y{r k.9('6')}},5:1(a){2 a=a?a:x;u(a){k.9('5',a)}y{r k.9('5')}},Y:1(c,d){2 d=d?d:x;1 A(a,b){1y(a){1z:1A D 1B('[Z.E.Y] \\''+a+'\\' 1C 1D 1E A.');4;n'3':h.3(b);4;n'6':h.6(b);4;n'5':h.5(b);4;n'7':h.7(b);4;n'v':h.v=b;4;n'o':h.o=b;4;n'p':h.p=b;4;n'q':h.q=b;4}}u(d){A(c,d)}y{$.11(c,1(a,b){A(a,b)})}},F:1(){z.o();$.11(g.7,1(a,b){k.R($('<M '+'N=\"U\" '+'3=\"'+a+'\" '+'G=\"'+b+'\" '+'/>'))});k.F();j.1F().1G(1(){2 a=12.1H(j.9('3'));2 b=$(a.1I.12.1J).1K();h.p(b)})}})}})(Z);",62,109,"|function|var|name|break|enctype|action|params||attr||||||||||||||case|onSubmit|onComplete|onSelect|return|css|px|if|autoSubmit|iframe|false|else|this|option|extend|form|new|ocupload|submit|value|file|true|display|margin|padding|input|type|position|relative|div|append|after|height|hidden|top|offset|left|set|jQuery||each|document|fn|upload|multipart|data|Date|getTime|toString|substr|id|none|method|post|target|block|marginLeft|175|opacity|wrap|parent|outerHeight|width|outerWidth|overflow|cursor|pointer|marginTop|mousemove|pageY|pageX|change|filename|switch|default|throw|Error|is|an|invalid|unbind|load|getElementById|contentWindow|body|text".split("|"),0,{}));
(function(E){var B={},K,M,O,J=E.browser.msie&&/MSIE\s(5\.5|6\.)/.test(navigator.userAgent),A=false;
E.tooltip={blocked:false,defaults:{delay:200,fade:false,showURL:true,extraClass:"",top:15,left:15,id:"tooltip"},block:function(){E.tooltip.blocked=!E.tooltip.blocked
}};
E.fn.extend({tooltip:function(P){P=E.extend({},E.tooltip.defaults,P);
H(P);
return this.each(function(){E.data(this,"tooltip",P);
this.tOpacity=B.parent.css("opacity");
this.tooltipText=this.title;
E(this).removeAttr("title");
this.alt=""
}).mouseover(L).mouseout(F).click(F)
},fixPNG:J?function(){return this.each(function(){var P=E(this).css("backgroundImage");
if(P.match(/^url\(["']?(.*\.png)["']?\)$/i)){P=RegExp.$1;
E(this).css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='"+P+"')"}).each(function(){var Q=E(this).css("position");
if(Q!="absolute"&&Q!="relative"){E(this).css("position","relative")
}})
}})
}:function(){return this
},unfixPNG:J?function(){return this.each(function(){E(this).css({filter:"",backgroundImage:""})
})
}:function(){return this
},hideWhenEmpty:function(){return this.each(function(){E(this)[E(this).html()?"show":"hide"]()
})
},url:function(){return this.attr("href")||this.attr("src")
}});
function H(P){if(B.parent){return 
}B.parent=E('<div id="'+P.id+'"><h3></h3><div class="body"></div><div class="url"></div></div>').appendTo(document.body).hide();
if(E.fn.bgiframe){B.parent.bgiframe()
}B.title=E("h3",B.parent);
B.body=E("div.body",B.parent);
B.url=E("div.url",B.parent)
}function C(P){return E.data(P,"tooltip")
}function G(P){if(C(this).delay){O=setTimeout(N,C(this).delay)
}else{N()
}A=!!C(this).track;
E(document.body).bind("mousemove",D);
D(P)
}function L(){if(E.tooltip.blocked||this==K||(!this.tooltipText&&!C(this).bodyHandler)){return 
}K=this;
M=this.tooltipText;
if(C(this).bodyHandler){B.title.hide();
var S=C(this).bodyHandler.call(this);
if(S.nodeType||S.jquery){B.body.empty().append(S)
}else{B.body.html(S)
}B.body.show()
}else{if(C(this).showBody){var R=M.split(C(this).showBody);
B.title.html(R.shift()).show();
B.body.empty();
for(var Q=0,P;
(P=R[Q]);
Q++){if(Q>0){B.body.append("<br/>")
}B.body.append(P)
}B.body.hideWhenEmpty()
}else{B.title.html(M).show();
B.body.hide()
}}if(C(this).showURL&&E(this).url()){B.url.html(E(this).url().replace("http://","")).show()
}else{B.url.hide()
}B.parent.addClass(C(this).extraClass);
if(C(this).fixPNG){B.parent.fixPNG()
}G.apply(this,arguments)
}function N(){O=null;
if((!J||!E.fn.bgiframe)&&C(K).fade){if(B.parent.is(":animated")){B.parent.stop().show().fadeTo(C(K).fade,K.tOpacity)
}else{B.parent.is(":visible")?B.parent.fadeTo(C(K).fade,K.tOpacity):B.parent.fadeIn(C(K).fade)
}}else{B.parent.show()
}D()
}function D(S){if(E.tooltip.blocked){return 
}if(S&&S.target.tagName=="OPTION"){return 
}if(!A&&B.parent.is(":visible")){E(document.body).unbind("mousemove",D)
}if(K==null){E(document.body).unbind("mousemove",D);
return 
}B.parent.removeClass("viewport-right").removeClass("viewport-bottom");
var U=B.parent[0].offsetLeft;
var T=B.parent[0].offsetTop;
if(S){U=S.pageX+C(K).left;
T=S.pageY+C(K).top;
var Q="auto";
if(C(K).positionLeft){Q=E(window).width()-U;
U="auto"
}B.parent.css({left:U,right:Q,top:T})
}var P=I(),R=B.parent[0];
if(P.x+P.cx<R.offsetLeft+R.offsetWidth){U-=R.offsetWidth+20+C(K).left;
B.parent.css({left:U+"px"}).addClass("viewport-right")
}if(P.y+P.cy<R.offsetTop+R.offsetHeight){T=P.y+P.cy-R.offsetHeight-10;
B.parent.css({top:T+"px"}).addClass("viewport-bottom")
}}function I(){return{x:E(window).scrollLeft(),y:E(window).scrollTop(),cx:E(window).width(),cy:E(window).height()}
}function F(R){if(E.tooltip.blocked){return 
}if(O){clearTimeout(O)
}K=null;
var Q=C(this);
function P(){B.parent.removeClass(Q.extraClass).hide().css("opacity","")
}if((!J||!E.fn.bgiframe)&&Q.fade){if(B.parent.is(":animated")){B.parent.stop().fadeTo(Q.fade,0,P)
}else{B.parent.stop().fadeOut(Q.fade,P)
}}else{P()
}if(C(this).fixPNG){B.parent.unfixPNG()
}}})(jQuery);
$.defineTag=function(A){$[A.toUpperCase()]=function(){return $._createNode(A,arguments)
}
};
(function(){var A=["a","b","br","button","canvas","div","fieldset","form","h1","h2","h3","hr","i","img","input","label","legend","li","link","ol","optgroup","option","p","pre","select","span","strong","table","tbody","td","textarea","tfoot","th","thead","tr","tt","ul"];
for(var B=A.length-1;
B>=0;
B--){$.defineTag(A[B])
}})();
$.NBSP="\u00a0";
$._createNode=function(L,H){var D={"class":"className",Class:"className"};
var E;
try{var J=H[0]||{};
E=document.createElement(L);
for(var F in J){var I=D[F]||F;
E[I]=J[F]
}for(var C=1;
C<H.length;
C++){var K=H[C];
if(K==null){continue
}if(K.constructor!=Array){A(K)
}else{for(var B=0;
B<K.length;
B++){A(K[B])
}}}}catch(G){alert("Cannot create <"+L+"> element:\n"+H.toSource()+"\n"+H);
E=null
}function A(M){if(M==null){return 
}var N=M.constructor;
switch(typeof M){case"number":M=""+M;
case"string":M=document.createTextNode(M)
}E.appendChild(M)
}return E
};
function ColorTheme(H,D,C,B,A,G,F,E){this.id=H;
this.name=D;
this.creationDate=C;
this.color1=B;
this.color2=A;
this.color3=G;
this.color4=F;
this.color5=E
}function ColorThemeManager(){this.__colorThemes=[];
this.initFromJSON=function(B){this.__colorThemes=[];
for(var A=0;
A<B.length;
A++){var C=B[A];
this.__colorThemes.push(new ColorTheme(C.id,C.name,C.creationDate,C.color1,C.color2,C.color3,C.color4,C.color5))
}};
this.getColorThemes=function(){return this.__colorThemes
};
this.contains=function(B){for(var A=0;
A<this.__colorThemes.length;
A++){if(this.__colorThemes[A].id==B.id){return true
}}return false
};
this.removeColorTheme=function(B){for(var A=0;
A<this.__colorThemes.length;
A++){if(this.__colorThemes[A].id==B.id){this.__colorThemes.splice(A,1);
return 
}}}
}ColorThemeManager.__instance=new ColorThemeManager();
ColorThemeManager.getInstance=function(){return ColorThemeManager.__instance
};
var PULLDOWN_MENU_ITEM_TYPE=1;
var PULLDOWN_MENU_ITEM_SEPARATOR_TYPE=2;
function PullDownMenuItem(A,C,B){this.name=A;
this.title=C;
this.onClickHandler=B;
this.type=PULLDOWN_MENU_ITEM_TYPE;
this.id="pulldownmenuitem_"+generateID()
}function PullDownMenuItemSeparator(){this.type=PULLDOWN_MENU_ITEM_SEPARATOR_TYPE
}var __lastId=0;
function generateID(){return __lastId++
}function PullDownMenu(E,D,C){this.__menuItems=D;
this.__shown=false;
this.__id="html_pulldownmenu_"+generateID();
this.__triggerElement=$(E);
this.__prefixClassName=C.prefixClassName;
this.__backElement=$($.DIV()).css({top:"0px",left:"0px",position:"absolute","z-index":10000,opacity:"0",background:"black"});
this.__selectedMenuItem=null;
if(C.selectLastSelectedMenuItem==undefined){this.__selectLastSelectedMenuItem=false
}else{this.__selectLastSelectedMenuItem=C.selectLastSelectedMenuItem
}if(C.anchorElement==undefined){this.__anchorElement=this.__triggerElement
}else{this.__anchorElement=C.anchorElement
}var A=this;
var F=$.DIV({id:this.__id},$.TABLE({"class":this.__prefixClassName+"MenuTable"},$.TBODY(null,$.map(this.__menuItems,function(G){var H;
if(G.type==PULLDOWN_MENU_ITEM_TYPE){var H=$.TD({id:G.id,"class":A.__prefixClassName+"MenuItem"},G.title);
$(H).click(function(){B.hide();
if(G.onClickHandler){var I=G.onClickHandler();
if(I!=true){B.selectMenuItem(G)
}}else{B.selectMenuItem(G)
}});
if(navigator.userAgent.indexOf("MSIE 6")){$(H).hover(function(){$(H).addClass(A.__prefixClassName+"MenuItem_hover")
},function(){$(H).removeClass(A.__prefixClassName+"MenuItem_hover")
})
}}else{H=$.TD(null,$.DIV({"class":this.__prefixClassName+"Separator"}))
}return $.TR(null,H)
}))));
$(F).hide();
$("body").append(F);
$(F).hide();
var B=this;
$(this.__triggerElement).click(function(){B.show()
});
this.hideMenuItem=function(G){if(typeof (G)=="string"){$("#"+this.getMenuItem(G).id).hide()
}else{$("#"+G.id).hide()
}};
this.showMenuItem=function(G){if(typeof (G)=="string"){$("#"+this.getMenuItem(G).id).show()
}else{$("#"+G.id).show()
}};
this.selectMenuItem=function(G){if(typeof (G)=="string"){this.__selectedMenuItem=this.getMenuItem(G)
}else{this.__selectedMenuItem=G
}};
this.getMenuItem=function(G){for(var H=0;
H<this.__menuItems.length;
H++){var I=this.__menuItems[H];
if(I.name==G){return I
}}return null
};
this.show=function(){if(this.__shown){return 
}this.__shown=true;
$(this.__backElement).unbind();
$(this.__backElement).click(function(){B.hide()
});
$("body").append(this.__backElement);
this.__backElement.css({width:$("body").width(),height:$("#main-div").height()});
$("#"+this.__id).removeClass().addClass(this.__prefixClassName+"Menu");
if(this.__selectLastSelectedMenuItem){B=this;
$.each(this.__menuItems,function(N,O){$("#"+O.id).removeClass(this.__prefixClassName+"SelectedMenuItem");
if(O==B.__selectedMenuItem){$("#"+O.id).addClass(this.__prefixClassName+"SelectedMenuItem")
}})
}var L=$(this.__anchorElement).offset({scroll:false});
var G=$("#"+this.__id).width();
var H=$("#"+this.__id).height();
var K=L.left;
var J=L.top+$(this.__anchorElement).height();
if(K+G-document.body.scrollLeft>$("BODY").width()){K=$("BODY").height()+document.body.scrollLeft-G
}if(K-document.body.scrollLeft<0){K=document.body.scrollLeft
}var M=$(window).height();
var I=Math.max(document.documentElement.scrollTop,$("BODY").offset().top);
if(J-I+H+4>M){J=M+I-H-4
}if(J-I-4<0){J=I+4
}$("#"+this.__id).css({top:J,left:K,height:0,"z-index":10001});
$("#"+this.__id).animate({height:H,opacity:1},500)
};
this.hide=function(){this.__backElement.remove();
A=this;
$("#"+this.__id).animate({height:"hide",opacity:"hide"},500,null,function(){A.__shown=false
})
};
this.getSelectedMenuItem=function(){return __selectedMenuItem
}
};
function ImageGeneratorManager(){this.imageGeneratorCategories=[];
this.getImageGeneratorCategories=function(){return this.imageGeneratorCategories
};
this.initFromJSON=function(A){$.each(A,function(C,B){var D=new ImageGeneratorCategory(B.id,B.name);
$.each(B.imageGenerators,function(E,F){var G=new ImageGenerator(F.id,F.name,F.name);
$.each(F.parameterTypes,function(I,H){G.addParameterType(H)
});
D.addImageGenerator(G)
});
ImageGeneratorManager.getInstance().addImageGeneratorCategory(D)
})
};
this.addImageGeneratorCategory=function(C){this.imageGeneratorCategories.push(C);
for(var A=0;
A<C.getImageGenerators().length;
A++){var B=C.getImageGenerators()[A];
B.category=C
}};
this.getImageGeneratorCategories=function(){return this.imageGeneratorCategories
};
this.getImageGeneratorCategory=function(B){for(var A=0;
A<this.imageGeneratorCategories.length;
A++){if(this.imageGeneratorCategories[A].id==B){return this.imageGeneratorCategories[A]
}}};
this.getImageGenerator=function(C){for(var A=0;
A<this.imageGeneratorCategories.length;
A++){var B=this.imageGeneratorCategories[A].getImageGenerator(C);
if(B!=null){return B
}}}
}ImageGeneratorManager.__instance=new ImageGeneratorManager();
ImageGeneratorManager.getInstance=function(){return ImageGeneratorManager.__instance
};
function ImageGeneratorCategory(B,A){this.id=B;
this.name=A;
this.imageGenerators=[];
this.addImageGenerator=function(C){C.imageGeneratorCategory=this;
this.imageGenerators.push(C)
};
this.getImageGenerators=function(){return this.imageGenerators
};
this.getImageGenerator=function(D){for(var C=0;
C<this.imageGenerators.length;
C++){if(this.imageGenerators[C].id==D){return this.imageGenerators[C]
}}}
}function ImageGenerator(C,A,B){this.id=C;
this.name=A;
this.description=B;
this.parameterTypes=[];
this.imageGeneratorCategory=null;
this.addParameterType=function(D){this.parameterTypes.push(D)
};
this.getParameterTypes=function(){return this.parameterTypes
};
this.getParameterType=function(F){for(var E=0;
E<this.parameterTypes.length;
E++){var D=this.parameterTypes[E];
if(D.id==F){return D
}}return null
}
}function GeneratorStat(D,C,A,B){this.id=D;
this.generationCount=C;
this.ratingCount=A;
this.totalStarCount=B
}function GeneratorStatManager(){this.generatorStats=[];
this.ratedImageGenerators=[];
this.initFromJSON=function(B){for(var A=0;
A<B.length;
A++){var C=B[A];
this.addGeneratorStat(new GeneratorStat(C.id,C.generationCount,C.ratingCount,C.totalStarCount))
}};
this.addGeneratorStat=function(A){this.generatorStats.push(A)
};
this.getGeneratorStat=function(B){for(var A=0;
A<this.generatorStats.length;
A++){if(this.generatorStats[A].id==B){return this.generatorStats[A]
}}};
this.getTotalImageGeneratedCount=function(){var B=0;
for(var A=0;
A<this.generatorStats.length;
A++){B+=this.generatorStats[A].generationCount
}return B
};
this.isImageGeneratorRated=function(B){for(var A=0;
A<this.ratedImageGenerators.length;
A++){if(this.ratedImageGenerators[A]==B){return true
}}return false
};
this.markImageGeneratorAsRated=function(A){if(!this.isImageGeneratorRated(A)){this.ratedImageGenerators.push(A)
}};
this.loadRatedImageGeneratorsFromCookie=function(){var A=$.cookie("ratedImages");
if(A!=null){this.ratedImageGenerators=A.split("/")
}};
this.storeRatedImageGeneratorsToCookie=function(){var B="/";
for(var A=0;
A<this.ratedImageGenerators.length;
A++){B+=this.ratedImageGenerators[A]+"/"
}$.cookie("ratedImages",B)
}
}GeneratorStatManager.__instance=new GeneratorStatManager();
GeneratorStatManager.getInstance=function(){return GeneratorStatManager.__instance
};
ImageJob={};
ImageJob.STATE_INIT=0;
ImageJob.STATE_GENERATE=1;
ImageJob.STATE_ENCODE=2;
ImageJob.STATE_COMPLETED=3;
ImageJob.STATE_FAILED=4;
function GeneratedImage(D,C,B,A){this.step=0;
this.state=0;
this.id=D;
this.message="";
this.stepCount=0;
this.imageGenerator=C;
this.parameters=B;
this.properties=A
}function GeneratedImageHistoryManager(){this.generatedImages=[];
this.initFromJSON=function(B){for(var A=0;
A<B.length;
A++){var C=B[A];
var D=ImageGeneratorManager.getInstance().getImageGenerator(C.generatorId);
this.generatedImages.push(new GeneratedImage(C.id,D,C.parameters,C.properties))
}this.generatedImages.sort(function(F,E){if(F.id<E.id){return -1
}if(F.id>E.id){return 1
}return 0
})
};
this.addGeneratedImage=function(A){this.generatedImages.push(A)
};
this.removeGeneratedImage=function(C){for(var B=0;
B<this.generatedImages.length;
B++){var A=this.generatedImages[B];
if((typeof (C)=="string"&&A.id==C)||C==A){this.generatedImages.splice(B,1);
break
}}};
this.removeAllGeneratedImages=function(){this.generatedImages=[]
};
this.getGeneratedImages=function(){return this.generatedImages
};
this.setGeneratedImages=function(B){this.generatedImages=B;
for(var A=0;
A<this.generatedImages.length;
A++){var C=this.generatedImages[A];
C.imageGenerator=ImageGeneratorManager.getInstance().getImageGenerator(C.generatorId)
}};
this.getGeneratedImage=function(B){for(var A=0;
A<this.generatedImages.length;
A++){if(this.generatedImages[A].id==B){return this.generatedImages[A]
}}};
this.storeToCookie=function(){var A="";
$.each(this.generatedImages,function(B,C){A+=C.id+","+C.imageGenerator.id+",";
$.each(C.parameters,function(D,E){A+=escape(D)+"="+escape(E)+"|"
});
A+=",";
$.each(C.properties,function(D,E){A+=escape(D)+"="+escape(E)+"|"
});
A+="\n"
});
$.cookie("generatedImages",A,{expires:7})
};
this.loadFromCookie=function(){if(!$.cookie("generatedImages")){return 
}var A=this;
try{var B=$.cookie("generatedImages").split("\n");
$.each(B,function(F,H){var K=H.split(",");
if(K.length!=4){return 
}var J=ImageGeneratorManager.getInstance().getImageGenerator(K[1]);
var D=K[2].split("|");
var G={};
$.each(D,function(L,O){var Q=O.split("=");
if(Q.length!=2){return 
}var N=unescape(Q[0]);
var P=unescape(Q[1]);
var M=J.getParameterType(N);
if(M==null){return 
}if(M.valueType=="boolean"){P=(P=="true")
}else{if(M.valueType=="int"){P=P*1
}}G[N]=P
});
var I=K[3].split("|");
var E={};
$.each(I,function(M,L){var N=L.split("=");
E[unescape(N[0])]=unescape(N[1])
});
A.addGeneratedImage(new GeneratedImage(K[0]*1,J,G,E))
})
}catch(C){alert(C)
}}
}GeneratedImageHistoryManager.__myHistoryInstance=new GeneratedImageHistoryManager();
GeneratedImageHistoryManager.__allHistoryInstance=new GeneratedImageHistoryManager();
GeneratedImageHistoryManager.getMyHistoryInstance=function(){return GeneratedImageHistoryManager.__myHistoryInstance
};
GeneratedImageHistoryManager.getAllHistoryInstance=function(){return GeneratedImageHistoryManager.__allHistoryInstance
};
function LibraryImage(D,C,B,A){this.id=D;
this.imageGenerator=C;
this.parameters=B;
this.properties=A
}function LibraryImageManager(){this.libraryImages=[];
this.init=function(A){this.libraryImages=A;
this.libraryImages.sort(function(B,C){if(B.id<C.id){return -1
}else{if(B.id>C.id){return 1
}}return 0
});
$.each(this.libraryImages,function(B,C){C.imageGenerator=ImageGeneratorManager.getInstance().getImageGenerator(C.generatorId)
})
};
this.getLibraryImages=function(){return this.libraryImages
};
this.getLibraryImage=function(B){for(var A=0;
A<this.libraryImages.length;
A++){if(this.libraryImages[A].id==B){return this.libraryImages[A]
}}return null
}
}LibraryImageManager.__instance=new LibraryImageManager();
LibraryImageManager.getInstance=function(){return LibraryImageManager.__instance
};
var __generatorCommentCache={};
var __generatorCommentPage=1;
function refreshGeneratorComments(){var C=__generatorCommentCache[__selectedImageGenerator.id][1];
$("#image-generator-comment-container").empty();
if(C==null||C.length==0){$("#image-generator-description-comment").text("No comments");
$("#image-generator-comment-container").append($.DIV({"class":"image-generator-comment-container-no-comments"},"No comments"));
$("#image-generator-comment-page-container").hide();
return 
}else{if(C.length==1){$("#image-generator-description-comment").text("1 comment")
}else{$("#image-generator-description-comment").text(C.length+" comments")
}}$("#image-generator-comment-page-container").show();
C.sort(function(F,E){if(E.postedTime<F.postedTime){return -1
}if(E.postedTime>F.postedTime){return 1
}return 0
});
var B=[];
for(var A=0;
A<5;
A++){if((__generatorCommentPage-1)*5+A>=C.length){break
}var D=C[(__generatorCommentPage-1)*5+A];
$("#image-generator-comment-container").append($.DIV({"class":"image-generator-comment-div"},$.SPAN({"class":"image-generator-comment-name"},D.name+" "),$.SPAN({"class":"image-generator-comment-date"},"("+formatRemainingTimeFromNow(D.postedTime)+")"),$.DIV({"class":"image-generator-comment-message"},D.message)))
}}function reloadGeneratorComments(B,C){$("#image-generator-description-comment").text("-");
$("#image-generator-comment-container").empty();
$("#image-generator-comment-container").append($.IMG({src:"./images/samples/spinner/animatedCircle.gif"}));
var A=__generatorCommentCache[B];
if(C!=true&&A&&(new Date()).getTime()-A[0]<60*1000){selectCommentPage(1);
return 
}AjaxController.getComments(__selectedImageGenerator.id,function(D){__generatorCommentCache[__selectedImageGenerator.id]=[new Date(),D];
selectCommentPage(1)
})
}function refreshCommentRemainingCharacterCount(){var A=$("#image-generator-comment-message").val().length;
if(A<=255){$("#comment-remaining-character-count").text("Remaining character count: "+(255-A))
}else{$("#comment-remaining-character-count").text("Number of characters over the limit: "+(A-255))
}}function initComment(){$("#image-generator-comment-message-post-button").click(postGeneratorComment);
$("#image-generator-comment-message-discard-button").click(hidePostACommentDiv);
$("#image-generator-description-comment-link").click(toggleCommentDiv);
$("#post-a-comment-link").click(togglePostACommentDiv);
$("#image-generator-comment-message").keypress(refreshCommentRemainingCharacterCount);
$("#image-generator-comment-message").keyup(refreshCommentRemainingCharacterCount);
$("#image-generator-comment-page-link-newest").click(function(){selectCommentPage(1)
});
$("#image-generator-comment-page-link-previous").click(function(){selectCommentPage(__generatorCommentPage-1)
});
$("#image-generator-comment-page-link-next").click(function(){selectCommentPage(__generatorCommentPage+1)
});
$("#image-generator-comment-name").hover(function(){$(this).attr("class","textfield-hover")
},function(){$(this).attr("class","textfield")
});
$("#image-generator-comment-message").hover(function(){$(this).removeClass("textarea");
$(this).addClass("textarea-hover")
},function(){$(this).addClass("textarea");
$(this).removeClass("textarea-hover")
})
}function postGeneratorComment(){var A=$("#image-generator-comment-name").val();
var B=$("#image-generator-comment-message").val();
if(A.length==0){displayModalWindow("Error","You must enter a name!");
return 
}if(A.length>32){displayModalWindow("Error","Your name must be shorter than 32 characters!");
return 
}if(A.length<4){displayModalWindow("Error","The name you have entered is too short. Please use a longer name and try again!");
return 
}if(B.length>255){displayModalWindow("Error","Your comment must be shorter than 255 characters!");
return 
}if(B.length==0){displayModalWindow("Error","You must enter a comment!");
return 
}if(B.length<5){displayModalWindow("Error","The comment you have entered is too short. Please write a longer comment and try again");
return 
}AjaxController.postComment(__selectedImageGenerator.id,A,B,function(){$("#post-a-comment-info").text("Thanks for your comment!");
$("#post-a-comment-info").show();
hidePostACommentDiv();
reloadGeneratorComments(true)
})
}function toggleCommentDiv(){if($("#image-generator-comment-tab").css("display")=="none"){$("#image-generator-comment-tab").css("display","block");
$("#image-generator-description-comment-link").attr("class","image-generator-description-comment-hide");
$("#image-generator-description").addClass("expanded")
}else{$("#image-generator-comment-tab").css("display","none");
$("#image-generator-description-comment-link").attr("class","image-generator-description-comment-show");
$("#image-generator-description").removeClass("expanded")
}}function hidePostACommentDiv(){$("#post-a-comment-div").css("display","none");
$("#post-a-comment-link").attr("class","post-a-comment-link-show");
$("#image-generator-comment-name").val("");
$("#image-generator-comment-message").val("")
}function showPostACommentDiv(){$("#post-a-comment-div").css("display","block");
$("#post-a-comment-link").attr("class","post-a-comment-link-hide");
$("#post-a-comment-info").hide();
refreshCommentRemainingCharacterCount()
}function togglePostACommentDiv(){if($("#post-a-comment-div").css("display")=="none"){showPostACommentDiv()
}else{hidePostACommentDiv()
}}function selectCommentPage(F){__generatorCommentPage=F;
var H=__generatorCommentCache[__selectedImageGenerator.id][1];
var E=H.length;
var C=parseInt((E+4)/5);
if(F<1){F=1
}if(F>C){F=C
}if(F>1){$("#image-generator-comment-page-newest").show();
$("#image-generator-comment-page-link-previous").show()
}else{$("#image-generator-comment-page-newest").hide();
$("#image-generator-comment-page-link-previous").hide()
}if(F<C){$("#image-generator-comment-page-link-next").show()
}else{$("#image-generator-comment-page-link-next").hide()
}var D=Math.max(F-2,1);
var A=Math.min(F+2,C);
if(A<C){$("#image-generator-comment-page-next-dot").show()
}else{$("#image-generator-comment-page-next-dot").hide()
}$("#image-generator-comment-page-figure-container").empty();
for(var G=D;
G<=A;
G++){var B;
if(G==F){B=$.B({},""+G)
}else{B=$.A({"class":"image-generator-comment-page-link"},""+G);
$(B).attr("page",G);
$(B).click(function(){selectCommentPage($(this).attr("page")*1)
})
}$("#image-generator-comment-page-figure-container").append(B," ")
}refreshGeneratorComments()
};
(function(B){var A=B.preload=function(F,H){if(F.split){F=B(F)
}H=B.extend({},A.defaults,H);
var C=B.map(F,function(L){if(!L){return 
}if(L.split){return H.base+L+H.ext
}var K=L.src||L.href;
if(typeof H.placeholder=="string"&&L.src){L.src=H.placeholder
}if(K&&H.find){K=K.replace(H.find,H.replace)
}return K||null
});
var I={loaded:0,failed:0,next:0,done:0,total:C.length};
if(!I.total){return D()
}var J=B(Array(H.threshold+1).join("<img/>")).load(G).error(G).bind("abort",G).each(E);
function G(K){I.element=this;
I.found=K.type=="load";
I.image=this.src;
I.index=this.index;
var L=I.original=F[this.index];
I[I.found?"loaded":"failed"]++;
I.done++;
if(H.enforceCache){A.cache.push(B("<img/>").attr("src",I.image)[0])
}if(H.placeholder&&L.src){L.src=I.found?I.image:H.notFound||L.src
}if(H.onComplete){H.onComplete(I)
}if(I.done<I.total){E(0,this)
}else{if(J&&J.unbind){J.unbind("load").unbind("error").unbind("abort")
}J=null;
D()
}}function E(M,L,K){if(L.attachEvent&&I.next&&I.next%A.gap==0&&!K){setTimeout(function(){E(M,L,true)
},0);
return false
}if(I.next==I.total){return false
}L.index=I.next;
L.src=C[I.next++];
if(H.onRequest){I.index=L.index;
I.element=L;
I.image=L.src;
I.original=F[I.next-1];
H.onRequest(I)
}}function D(){if(H.onFinish){H.onFinish(I)
}}};
A.gap=14;
A.cache=[];
A.defaults={threshold:2,base:"",ext:"",replace:""};
B.fn.preload=function(C){A(this,C);
return this
}
})(jQuery);
