;(function($){$.ui={plugin:{add:function(module,option,set){var proto=$.ui[module].prototype;for(var i in set){proto.plugins[i]=proto.plugins[i]||[];proto.plugins[i].push([option,set[i]]);}},call:function(instance,name,args){var set=instance.plugins[name];if(!set){return;}
for(var i=0;i<set.length;i++){if(instance.options[set[i][0]]){set[i][1].apply(instance.element,args);}}}},cssCache:{},css:function(name){if($.ui.cssCache[name]){return $.ui.cssCache[name];}
var tmp=$('<div class="ui-gen">').addClass(name).css({position:'absolute',top:'-5000px',left:'-5000px',display:'block'}).appendTo('body');$.ui.cssCache[name]=!!((!(/auto|default/).test(tmp.css('cursor'))||(/^[1-9]/).test(tmp.css('height'))||(/^[1-9]/).test(tmp.css('width'))||!(/none/).test(tmp.css('backgroundImage'))||!(/transparent|rgba\(0, 0, 0, 0\)/).test(tmp.css('backgroundColor'))));try{$('body').get(0).removeChild(tmp.get(0));}catch(e){}
return $.ui.cssCache[name];},disableSelection:function(el){$(el).attr('unselectable','on').css('MozUserSelect','none');},enableSelection:function(el){$(el).attr('unselectable','off').css('MozUserSelect','');},hasScroll:function(e,a){var scroll=/top/.test(a||"top")?'scrollTop':'scrollLeft',has=false;if(e[scroll]>0)return true;e[scroll]=1;has=e[scroll]>0?true:false;e[scroll]=0;return has;}};var _remove=$.fn.remove;$.fn.remove=function(){$("*",this).add(this).triggerHandler("remove");return _remove.apply(this,arguments);};function getter(namespace,plugin,method){var methods=$[namespace][plugin].getter||[];methods=(typeof methods=="string"?methods.split(/,?\s+/):methods);return($.inArray(method,methods)!=-1);}
$.widget=function(name,prototype){var namespace=name.split(".")[0];name=name.split(".")[1];$.fn[name]=function(options){var isMethodCall=(typeof options=='string'),args=Array.prototype.slice.call(arguments,1);if(isMethodCall&&getter(namespace,name,options)){var instance=$.data(this[0],name);return(instance?instance[options].apply(instance,args):undefined);}
return this.each(function(){var instance=$.data(this,name);if(isMethodCall&&instance&&$.isFunction(instance[options])){instance[options].apply(instance,args);}else if(!isMethodCall){$.data(this,name,new $[namespace][name](this,options));}});};$[namespace][name]=function(element,options){var self=this;this.widgetName=name;this.widgetBaseClass=namespace+'-'+name;this.options=$.extend({},$.widget.defaults,$[namespace][name].defaults,options);this.element=$(element).bind('setData.'+name,function(e,key,value){return self.setData(key,value);}).bind('getData.'+name,function(e,key){return self.getData(key);}).bind('remove',function(){return self.destroy();});this.init();};$[namespace][name].prototype=$.extend({},$.widget.prototype,prototype);};$.widget.prototype={init:function(){},destroy:function(){this.element.removeData(this.widgetName);},getData:function(key){return this.options[key];},setData:function(key,value){this.options[key]=value;if(key=='disabled'){this.element[value?'addClass':'removeClass'](this.widgetBaseClass+'-disabled');}},enable:function(){this.setData('disabled',false);},disable:function(){this.setData('disabled',true);}};$.widget.defaults={disabled:false};$.ui.mouse={mouseInit:function(){var self=this;this.element.bind('mousedown.'+this.widgetName,function(e){return self.mouseDown(e);});if($.browser.msie){this._mouseUnselectable=this.element.attr('unselectable');this.element.attr('unselectable','on');}
this.started=false;},mouseDestroy:function(){this.element.unbind('.'+this.widgetName);($.browser.msie&&this.element.attr('unselectable',this._mouseUnselectable));},mouseDown:function(e){(this._mouseStarted&&this.mouseUp(e));this._mouseDownEvent=e;var self=this,btnIsLeft=(e.which==1),elIsCancel=(typeof this.options.cancel=="string"?$(e.target).parents().add(e.target).filter(this.options.cancel).length:false);if(!btnIsLeft||elIsCancel||!this.mouseCapture(e)){return true;}
this._mouseDelayMet=!this.options.delay;if(!this._mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){self._mouseDelayMet=true;},this.options.delay);}
if(this.mouseDistanceMet(e)&&this.mouseDelayMet(e)){this._mouseStarted=(this.mouseStart(e)!==false);if(!this._mouseStarted){e.preventDefault();return true;}}
this._mouseMoveDelegate=function(e){return self.mouseMove(e);};this._mouseUpDelegate=function(e){return self.mouseUp(e);};$(document).bind('mousemove.'+this.widgetName,this._mouseMoveDelegate).bind('mouseup.'+this.widgetName,this._mouseUpDelegate);return false;},mouseMove:function(e){if($.browser.msie&&!e.button){return this.mouseUp(e);}
if(this._mouseStarted){this.mouseDrag(e);return false;}
if(this.mouseDistanceMet(e)&&this.mouseDelayMet(e)){this._mouseStarted=(this.mouseStart(this._mouseDownEvent,e)!==false);(this._mouseStarted?this.mouseDrag(e):this.mouseUp(e));}
return!this._mouseStarted;},mouseUp:function(e){$(document).unbind('mousemove.'+this.widgetName,this._mouseMoveDelegate).unbind('mouseup.'+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this.mouseStop(e);}
return false;},mouseDistanceMet:function(e){return(Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance);},mouseDelayMet:function(e){return this._mouseDelayMet;},mouseStart:function(e){},mouseDrag:function(e){},mouseStop:function(e){},mouseCapture:function(e){return true;}};$.ui.mouse.defaults={cancel:null,distance:1,delay:0};})(jQuery);(function($){$.widget("ui.draggable",$.extend({},$.ui.mouse,{init:function(){var o=this.options;if(o.helper=='original'&&!(/(relative|absolute|fixed)/).test(this.element.css('position')))
this.element.css('position','relative');this.element.addClass('ui-draggable');(o.disabled&&this.element.addClass('ui-draggable-disabled'));this.mouseInit();},mouseStart:function(e){var o=this.options;if(this.helper||o.disabled||$(e.target).is('.ui-resizable-handle'))return false;var handle=!this.options.handle||!$(this.options.handle,this.element).length?true:false;$(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==e.target)handle=true;});if(!handle)return false;if($.ui.ddmanager)$.ui.ddmanager.current=this;this.helper=$.isFunction(o.helper)?$(o.helper.apply(this.element[0],[e])):(o.helper=='clone'?this.element.clone():this.element);if(!this.helper.parents('body').length)this.helper.appendTo((o.appendTo=='parent'?this.element[0].parentNode:o.appendTo));if(this.helper[0]!=this.element[0]&&!(/(fixed|absolute)/).test(this.helper.css("position")))this.helper.css("position","absolute");this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0)};this.cssPosition=this.helper.css("position");this.offset=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.offset.click={left:e.pageX-this.offset.left,top:e.pageY-this.offset.top};this.offsetParent=this.helper.offsetParent();var po=this.offsetParent.offset();if(this.offsetParent[0]==document.body&&$.browser.mozilla)po={top:0,left:0};this.offset.parent={top:po.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:po.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)};var p=this.element.position();this.offset.relative=this.cssPosition=="relative"?{top:p.top-(parseInt(this.helper.css("top"),10)||0)+this.offsetParent[0].scrollTop,left:p.left-(parseInt(this.helper.css("left"),10)||0)+this.offsetParent[0].scrollLeft}:{top:0,left:0};this.originalPosition=this.generatePosition(e);this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};if(o.cursorAt){if(o.cursorAt.left!=undefined)this.offset.click.left=o.cursorAt.left+this.margins.left;if(o.cursorAt.right!=undefined)this.offset.click.left=this.helperProportions.width-o.cursorAt.right+this.margins.left;if(o.cursorAt.top!=undefined)this.offset.click.top=o.cursorAt.top+this.margins.top;if(o.cursorAt.bottom!=undefined)this.offset.click.top=this.helperProportions.height-o.cursorAt.bottom+this.margins.top;}
if(o.containment){if(o.containment=='parent')o.containment=this.helper[0].parentNode;if(o.containment=='document'||o.containment=='window')this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,$(o.containment=='document'?document:window).width()-this.offset.relative.left-this.offset.parent.left-this.helperProportions.width-this.margins.left-(parseInt(this.element.css("marginRight"),10)||0),($(o.containment=='document'?document:window).height()||document.body.parentNode.scrollHeight)-this.offset.relative.top-this.offset.parent.top-this.helperProportions.height-this.margins.top-(parseInt(this.element.css("marginBottom"),10)||0)];if(!(/^(document|window|parent)$/).test(o.containment)){var ce=$(o.containment)[0];var co=$(o.containment).offset();this.containment=[co.left+(parseInt($(ce).css("borderLeftWidth"),10)||0)-this.offset.relative.left-this.offset.parent.left,co.top+(parseInt($(ce).css("borderTopWidth"),10)||0)-this.offset.relative.top-this.offset.parent.top,co.left+Math.max(ce.scrollWidth,ce.offsetWidth)-(parseInt($(ce).css("borderLeftWidth"),10)||0)-this.offset.relative.left-this.offset.parent.left-this.helperProportions.width-this.margins.left-(parseInt(this.element.css("marginRight"),10)||0),co.top+Math.max(ce.scrollHeight,ce.offsetHeight)-(parseInt($(ce).css("borderTopWidth"),10)||0)-this.offset.relative.top-this.offset.parent.top-this.helperProportions.height-this.margins.top-(parseInt(this.element.css("marginBottom"),10)||0)];}}
this.propagate("start",e);this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};if($.ui.ddmanager&&!o.dropBehaviour)$.ui.ddmanager.prepareOffsets(this,e);this.helper.addClass("ui-draggable-dragging");this.mouseDrag(e);return true;},convertPositionTo:function(d,pos){if(!pos)pos=this.position;var mod=d=="absolute"?1:-1;return{top:(pos.top
+this.offset.relative.top*mod
+this.offset.parent.top*mod
-(this.cssPosition=="fixed"||(this.cssPosition=="absolute"&&this.offsetParent[0]==document.body)?0:this.offsetParent[0].scrollTop)*mod
+(this.cssPosition=="fixed"?$(document).scrollTop():0)*mod
+this.margins.top*mod),left:(pos.left
+this.offset.relative.left*mod
+this.offset.parent.left*mod
-(this.cssPosition=="fixed"||(this.cssPosition=="absolute"&&this.offsetParent[0]==document.body)?0:this.offsetParent[0].scrollLeft)*mod
+(this.cssPosition=="fixed"?$(document).scrollLeft():0)*mod
+this.margins.left*mod)};},generatePosition:function(e){var o=this.options;var position={top:(e.pageY
-this.offset.click.top
-this.offset.relative.top
-this.offset.parent.top
+(this.cssPosition=="fixed"||(this.cssPosition=="absolute"&&this.offsetParent[0]==document.body)?0:this.offsetParent[0].scrollTop)
-(this.cssPosition=="fixed"?$(document).scrollTop():0)),left:(e.pageX
-this.offset.click.left
-this.offset.relative.left
-this.offset.parent.left
+(this.cssPosition=="fixed"||(this.cssPosition=="absolute"&&this.offsetParent[0]==document.body)?0:this.offsetParent[0].scrollLeft)
-(this.cssPosition=="fixed"?$(document).scrollLeft():0))};if(!this.originalPosition)return position;if(this.containment){if(position.left<this.containment[0])position.left=this.containment[0];if(position.top<this.containment[1])position.top=this.containment[1];if(position.left>this.containment[2])position.left=this.containment[2];if(position.top>this.containment[3])position.top=this.containment[3];}
if(o.grid){var top=this.originalPosition.top+Math.round((position.top-this.originalPosition.top)/o.grid[1])*o.grid[1];position.top=this.containment?(!(top<this.containment[1]||top>this.containment[3])?top:(!(top<this.containment[1])?top-o.grid[1]:top+o.grid[1])):top;var left=this.originalPosition.left+Math.round((position.left-this.originalPosition.left)/o.grid[0])*o.grid[0];position.left=this.containment?(!(left<this.containment[0]||left>this.containment[2])?left:(!(left<this.containment[0])?left-o.grid[0]:left+o.grid[0])):left;}
return position;},mouseDrag:function(e){this.position=this.generatePosition(e);this.positionAbs=this.convertPositionTo("absolute");this.position=this.propagate("drag",e)||this.position;if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+'px';if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+'px';if($.ui.ddmanager)$.ui.ddmanager.drag(this,e);return false;},mouseStop:function(e){var dropped=false;if($.ui.ddmanager&&!this.options.dropBehaviour)
var dropped=$.ui.ddmanager.drop(this,e);if((this.options.revert=="invalid"&&!dropped)||(this.options.revert=="valid"&&dropped)||this.options.revert===true){var self=this;$(this.helper).animate(this.originalPosition,parseInt(this.options.revert,10)||500,function(){self.propagate("stop",e);self.clear();});}else{this.propagate("stop",e);this.clear();}
return false;},clear:function(){this.helper.removeClass("ui-draggable-dragging");if(this.options.helper!='original'&&!this.cancelHelperRemoval)this.helper.remove();this.helper=null;this.cancelHelperRemoval=false;},plugins:{},uiHash:function(e){return{helper:this.helper,position:this.position,absolutePosition:this.positionAbs,options:this.options};},propagate:function(n,e){$.ui.plugin.call(this,n,[e,this.uiHash()]);if(n=="drag")this.positionAbs=this.convertPositionTo("absolute");return this.element.triggerHandler(n=="drag"?n:"drag"+n,[e,this.uiHash()],this.options[n]);},destroy:function(){if(!this.element.data('draggable'))return;this.element.removeData("draggable").unbind(".draggable").removeClass('ui-draggable');this.mouseDestroy();}}));$.extend($.ui.draggable,{defaults:{appendTo:"parent",axis:false,cancel:":input",delay:0,distance:1,helper:"original"}});$.ui.plugin.add("draggable","cursor",{start:function(e,ui){var t=$('body');if(t.css("cursor"))ui.options._cursor=t.css("cursor");t.css("cursor",ui.options.cursor);},stop:function(e,ui){if(ui.options._cursor)$('body').css("cursor",ui.options._cursor);}});$.ui.plugin.add("draggable","zIndex",{start:function(e,ui){var t=$(ui.helper);if(t.css("zIndex"))ui.options._zIndex=t.css("zIndex");t.css('zIndex',ui.options.zIndex);},stop:function(e,ui){if(ui.options._zIndex)$(ui.helper).css('zIndex',ui.options._zIndex);}});$.ui.plugin.add("draggable","opacity",{start:function(e,ui){var t=$(ui.helper);if(t.css("opacity"))ui.options._opacity=t.css("opacity");t.css('opacity',ui.options.opacity);},stop:function(e,ui){if(ui.options._opacity)$(ui.helper).css('opacity',ui.options._opacity);}});$.ui.plugin.add("draggable","iframeFix",{start:function(e,ui){$(ui.options.iframeFix===true?"iframe":ui.options.iframeFix).each(function(){$('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css($(this).offset()).appendTo("body");});},stop:function(e,ui){$("div.DragDropIframeFix").each(function(){this.parentNode.removeChild(this);});}});$.ui.plugin.add("draggable","scroll",{start:function(e,ui){var o=ui.options;var i=$(this).data("draggable");o.scrollSensitivity=o.scrollSensitivity||20;o.scrollSpeed=o.scrollSpeed||20;i.overflowY=function(el){do{if(/auto|scroll/.test(el.css('overflow'))||(/auto|scroll/).test(el.css('overflow-y')))return el;el=el.parent();}while(el[0].parentNode);return $(document);}(this);i.overflowX=function(el){do{if(/auto|scroll/.test(el.css('overflow'))||(/auto|scroll/).test(el.css('overflow-x')))return el;el=el.parent();}while(el[0].parentNode);return $(document);}(this);if(i.overflowY[0]!=document&&i.overflowY[0].tagName!='HTML')i.overflowYOffset=i.overflowY.offset();if(i.overflowX[0]!=document&&i.overflowX[0].tagName!='HTML')i.overflowXOffset=i.overflowX.offset();},drag:function(e,ui){var o=ui.options;var i=$(this).data("draggable");if(i.overflowY[0]!=document&&i.overflowY[0].tagName!='HTML'){if((i.overflowYOffset.top+i.overflowY[0].offsetHeight)-e.pageY<o.scrollSensitivity)
i.overflowY[0].scrollTop=i.overflowY[0].scrollTop+o.scrollSpeed;if(e.pageY-i.overflowYOffset.top<o.scrollSensitivity)
i.overflowY[0].scrollTop=i.overflowY[0].scrollTop-o.scrollSpeed;}else{if(e.pageY-$(document).scrollTop()<o.scrollSensitivity)
$(document).scrollTop($(document).scrollTop()-o.scrollSpeed);if($(window).height()-(e.pageY-$(document).scrollTop())<o.scrollSensitivity)
$(document).scrollTop($(document).scrollTop()+o.scrollSpeed);}
if(i.overflowX[0]!=document&&i.overflowX[0].tagName!='HTML'){if((i.overflowXOffset.left+i.overflowX[0].offsetWidth)-e.pageX<o.scrollSensitivity)
i.overflowX[0].scrollLeft=i.overflowX[0].scrollLeft+o.scrollSpeed;if(e.pageX-i.overflowXOffset.left<o.scrollSensitivity)
i.overflowX[0].scrollLeft=i.overflowX[0].scrollLeft-o.scrollSpeed;}else{if(e.pageX-$(document).scrollLeft()<o.scrollSensitivity)
$(document).scrollLeft($(document).scrollLeft()-o.scrollSpeed);if($(window).width()-(e.pageX-$(document).scrollLeft())<o.scrollSensitivity)
$(document).scrollLeft($(document).scrollLeft()+o.scrollSpeed);}}});$.ui.plugin.add("draggable","snap",{start:function(e,ui){var inst=$(this).data("draggable");inst.snapElements=[];$(ui.options.snap===true?'.ui-draggable':ui.options.snap).each(function(){var $t=$(this);var $o=$t.offset();if(this!=inst.element[0])inst.snapElements.push({item:this,width:$t.outerWidth(),height:$t.outerHeight(),top:$o.top,left:$o.left});});},drag:function(e,ui){var inst=$(this).data("draggable");var d=ui.options.snapTolerance||20;var x1=ui.absolutePosition.left,x2=x1+inst.helperProportions.width,y1=ui.absolutePosition.top,y2=y1+inst.helperProportions.height;for(var i=inst.snapElements.length-1;i>=0;i--){var l=inst.snapElements[i].left,r=l+inst.snapElements[i].width,t=inst.snapElements[i].top,b=t+inst.snapElements[i].height;if(!((l-d<x1&&x1<r+d&&t-d<y1&&y1<b+d)||(l-d<x1&&x1<r+d&&t-d<y2&&y2<b+d)||(l-d<x2&&x2<r+d&&t-d<y1&&y1<b+d)||(l-d<x2&&x2<r+d&&t-d<y2&&y2<b+d)))continue;if(ui.options.snapMode!='inner'){var ts=Math.abs(t-y2)<=20;var bs=Math.abs(b-y1)<=20;var ls=Math.abs(l-x2)<=20;var rs=Math.abs(r-x1)<=20;if(ts)ui.position.top=inst.convertPositionTo("relative",{top:t-inst.helperProportions.height,left:0}).top;if(bs)ui.position.top=inst.convertPositionTo("relative",{top:b,left:0}).top;if(ls)ui.position.left=inst.convertPositionTo("relative",{top:0,left:l-inst.helperProportions.width}).left;if(rs)ui.position.left=inst.convertPositionTo("relative",{top:0,left:r}).left;}
if(ui.options.snapMode!='outer'){var ts=Math.abs(t-y1)<=20;var bs=Math.abs(b-y2)<=20;var ls=Math.abs(l-x1)<=20;var rs=Math.abs(r-x2)<=20;if(ts)ui.position.top=inst.convertPositionTo("relative",{top:t,left:0}).top;if(bs)ui.position.top=inst.convertPositionTo("relative",{top:b-inst.helperProportions.height,left:0}).top;if(ls)ui.position.left=inst.convertPositionTo("relative",{top:0,left:l}).left;if(rs)ui.position.left=inst.convertPositionTo("relative",{top:0,left:r-inst.helperProportions.width}).left;}};}});$.ui.plugin.add("draggable","connectToSortable",{start:function(e,ui){var inst=$(this).data("draggable");inst.sortables=[];$(ui.options.connectToSortable).each(function(){if($.data(this,'sortable')){var sortable=$.data(this,'sortable');inst.sortables.push({instance:sortable,shouldRevert:sortable.options.revert});sortable.refreshItems();sortable.propagate("activate",e,inst);}});},stop:function(e,ui){var inst=$(this).data("draggable");$.each(inst.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;inst.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert)this.instance.options.revert=true;this.instance.mouseStop(e);this.instance.element.triggerHandler("sortreceive",[e,$.extend(this.instance.ui(),{sender:inst.element})],this.instance.options["receive"]);this.instance.options.helper=this.instance.options._helper;}else{this.instance.propagate("deactivate",e,inst);}});},drag:function(e,ui){var inst=$(this).data("draggable"),self=this;var checkPos=function(o){var l=o.left,r=l+o.width,t=o.top,b=t+o.height;return(l<(this.positionAbs.left+this.offset.click.left)&&(this.positionAbs.left+this.offset.click.left)<r&&t<(this.positionAbs.top+this.offset.click.top)&&(this.positionAbs.top+this.offset.click.top)<b);};$.each(inst.sortables,function(i){if(checkPos.call(inst,this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=$(self).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return ui.helper[0];};e.target=this.instance.currentItem[0];this.instance.mouseCapture(e,true);this.instance.mouseStart(e,true,true);this.instance.offset.click.top=inst.offset.click.top;this.instance.offset.click.left=inst.offset.click.left;this.instance.offset.parent.left-=inst.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=inst.offset.parent.top-this.instance.offset.parent.top;inst.propagate("toSortable",e);}
if(this.instance.currentItem)this.instance.mouseDrag(e);}else{if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance.mouseStop(e,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();if(this.instance.placeholder)this.instance.placeholder.remove();inst.propagate("fromSortable",e);}};});}});$.ui.plugin.add("draggable","stack",{start:function(e,ui){var group=$.makeArray($(ui.options.stack.group)).sort(function(a,b){return(parseInt($(a).css("zIndex"),10)||ui.options.stack.min)-(parseInt($(b).css("zIndex"),10)||ui.options.stack.min);});$(group).each(function(i){this.style.zIndex=ui.options.stack.min+i;});this[0].style.zIndex=ui.options.stack.min+group.length;}});})(jQuery);(function($){$.widget("ui.droppable",{init:function(){this.element.addClass("ui-droppable");this.isover=0;this.isout=1;var o=this.options,accept=o.accept;o=$.extend(o,{accept:o.accept&&o.accept.constructor==Function?o.accept:function(d){return $(d).is(accept);}});this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};$.ui.ddmanager.droppables.push(this);},plugins:{},ui:function(c){return{draggable:(c.currentItem||c.element),helper:c.helper,position:c.position,absolutePosition:c.positionAbs,options:this.options,element:this.element};},destroy:function(){var drop=$.ui.ddmanager.droppables;for(var i=0;i<drop.length;i++)
if(drop[i]==this)
drop.splice(i,1);this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable");},over:function(e){var draggable=$.ui.ddmanager.current;if(!draggable||(draggable.currentItem||draggable.element)[0]==this.element[0])return;if(this.options.accept.call(this.element,(draggable.currentItem||draggable.element))){$.ui.plugin.call(this,'over',[e,this.ui(draggable)]);this.element.triggerHandler("dropover",[e,this.ui(draggable)],this.options.over);}},out:function(e){var draggable=$.ui.ddmanager.current;if(!draggable||(draggable.currentItem||draggable.element)[0]==this.element[0])return;if(this.options.accept.call(this.element,(draggable.currentItem||draggable.element))){$.ui.plugin.call(this,'out',[e,this.ui(draggable)]);this.element.triggerHandler("dropout",[e,this.ui(draggable)],this.options.out);}},drop:function(e,custom){var draggable=custom||$.ui.ddmanager.current;if(!draggable||(draggable.currentItem||draggable.element)[0]==this.element[0])return false;var childrenIntersection=false;this.element.find(".ui-droppable").not(".ui-draggable-dragging").each(function(){var inst=$.data(this,'droppable');if(!inst) return;if(inst.options.greedy&&$.ui.intersect(draggable,$.extend(inst,{offset:inst.element.offset()}),inst.options.tolerance)){childrenIntersection=true;return false;}});if(childrenIntersection)return false;if(this.options.accept.call(this.element,(draggable.currentItem||draggable.element))){$.ui.plugin.call(this,'drop',[e,this.ui(draggable)]);this.element.triggerHandler("drop",[e,this.ui(draggable)],this.options.drop);return true;}
//drop.splice(i,1);this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable");},over:function(e){var draggable=$.ui.ddmanager.current;if(!draggable||(draggable.currentItem||draggable.element)[0]==this.element[0])return;if(this.options.accept.call(this.element,(draggable.currentItem||draggable.element))){$.ui.plugin.call(this,'over',[e,this.ui(draggable)]);this.element.triggerHandler("dropover",[e,this.ui(draggable)],this.options.over);}},out:function(e){var draggable=$.ui.ddmanager.current;if(!draggable||(draggable.currentItem||draggable.element)[0]==this.element[0])return;if(this.options.accept.call(this.element,(draggable.currentItem||draggable.element))){$.ui.plugin.call(this,'out',[e,this.ui(draggable)]);this.element.triggerHandler("dropout",[e,this.ui(draggable)],this.options.out);}},drop:function(e,custom){var draggable=custom||$.ui.ddmanager.current;if(!draggable||(draggable.currentItem||draggable.element)[0]==this.element[0])return false;var childrenIntersection=false;this.element.find(".ui-droppable").not(".ui-draggable-dragging").each(function(){var inst=$.data(this,'droppable');if(inst.options.greedy&&$.ui.intersect(draggable,$.extend(inst,{offset:inst.element.offset()}),inst.options.tolerance)){childrenIntersection=true;return false;}}});if(childrenIntersection)return false;if(this.options.accept.call(this.element,(draggable.currentItem||draggable.element))){$.ui.plugin.call(this,'drop',[e,this.ui(draggable)]);this.element.triggerHandler("drop",[e,this.ui(draggable)],this.options.drop);return true;}
return false;},activate:function(e){var draggable=$.ui.ddmanager.current;$.ui.plugin.call(this,'activate',[e,this.ui(draggable)]);if(draggable)this.element.triggerHandler("dropactivate",[e,this.ui(draggable)],this.options.activate);},deactivate:function(e){var draggable=$.ui.ddmanager.current;$.ui.plugin.call(this,'deactivate',[e,this.ui(draggable)]);if(draggable)this.element.triggerHandler("dropdeactivate",[e,this.ui(draggable)],this.options.deactivate);}});$.extend($.ui.droppable,{defaults:{disabled:false,tolerance:'intersect'}});$.ui.intersect=function(draggable,droppable,toleranceMode){if(!droppable.offset)return false;var x1=(draggable.positionAbs||draggable.position.absolute).left,x2=x1+draggable.helperProportions.width,y1=(draggable.positionAbs||draggable.position.absolute).top,y2=y1+draggable.helperProportions.height;var l=droppable.offset.left,r=l+droppable.proportions.width,t=droppable.offset.top,b=t+droppable.proportions.height;switch(toleranceMode){case'fit':return(l<x1&&x2<r&&t<y1&&y2<b);break;case'intersect':return(l<x1+(draggable.helperProportions.width/2)&&x2-(draggable.helperProportions.width/2)<r&&t<y1+(draggable.helperProportions.height/2)&&y2-(draggable.helperProportions.height/2)<b);break;case'pointer':return(l<((draggable.positionAbs||draggable.position.absolute).left+(draggable.clickOffset||draggable.offset.click).left)&&((draggable.positionAbs||draggable.position.absolute).left+(draggable.clickOffset||draggable.offset.click).left)<r&&t<((draggable.positionAbs||draggable.position.absolute).top+(draggable.clickOffset||draggable.offset.click).top)&&((draggable.positionAbs||draggable.position.absolute).top+(draggable.clickOffset||draggable.offset.click).top)<b);break;case'touch':return((y1>=t&&y1<=b)||(y2>=t&&y2<=b)||(y1<t&&y2>b))&&((x1>=l&&x1<=r)||(x2>=l&&x2<=r)||(x1<l&&x2>r));break;default:return false;break;}};$.ui.ddmanager={current:null,droppables:[],prepareOffsets:function(t,e){var m=$.ui.ddmanager.droppables;var type=e?e.type:null;for(var i=0;i<m.length;i++){if(m[i].options.disabled||(t&&!m[i].options.accept.call(m[i].element,(t.currentItem||t.element))))continue;m[i].visible=m[i].element.css("display")!="none";if(!m[i].visible)continue;m[i].offset=m[i].element.offset();m[i].proportions={width:m[i].element[0].offsetWidth,height:m[i].element[0].offsetHeight};if(type=="dragstart"||type=="sortactivate")m[i].activate.call(m[i],e);}},drop:function(draggable,e){var dropped=false;$.each($.ui.ddmanager.droppables,function(){if(!this.options)return;if(!this.options.disabled&&this.visible&&$.ui.intersect(draggable,this,this.options.tolerance))
dropped=this.drop.call(this,e);if(!this.options.disabled&&this.visible&&this.options.accept.call(this.element,(draggable.currentItem||draggable.element))){this.isout=1;this.isover=0;this.deactivate.call(this,e);}});return dropped;},drag:function(draggable,e){if(draggable.options.refreshPositions)$.ui.ddmanager.prepareOffsets(draggable,e);$.each($.ui.ddmanager.droppables,function(){if(this.options.disabled||this.greedyChild||!this.visible)return;var intersects=$.ui.intersect(draggable,this,this.options.tolerance);var c=!intersects&&this.isover==1?'isout':(intersects&&this.isover==0?'isover':null);if(!c)return;var parentInstance;if(this.options.greedy){var parent=this.element.parents('.ui-droppable:eq(0)');if(parent.length){parentInstance=$.data(parent[0],'droppable');parentInstance.greedyChild=(c=='isover'?1:0);}}
if(parentInstance&&c=='isover'){parentInstance['isover']=0;parentInstance['isout']=1;parentInstance.out.call(parentInstance,e);}
this[c]=1;this[c=='isout'?'isover':'isout']=0;this[c=="isover"?"over":"out"].call(this,e);if(parentInstance&&c=='isout'){parentInstance['isout']=0;parentInstance['isover']=1;parentInstance.over.call(parentInstance,e);}});}};$.ui.plugin.add("droppable","activeClass",{activate:function(e,ui){$(this).addClass(ui.options.activeClass);},deactivate:function(e,ui){$(this).removeClass(ui.options.activeClass);},drop:function(e,ui){$(this).removeClass(ui.options.activeClass);}});$.ui.plugin.add("droppable","hoverClass",{over:function(e,ui){$(this).addClass(ui.options.hoverClass);},out:function(e,ui){$(this).removeClass(ui.options.hoverClass);},drop:function(e,ui){$(this).removeClass(ui.options.hoverClass);}});})(jQuery);(function($){$.widget("ui.resizable",$.extend({},$.ui.mouse,{init:function(){var self=this,o=this.options;var elpos=this.element.css('position');this.originalElement=this.element;this.element.addClass("ui-resizable").css({position:/static/.test(elpos)?'relative':elpos});$.extend(o,{_aspectRatio:!!(o.aspectRatio),helper:o.helper||o.ghost||o.animate?o.helper||'proxy':null,knobHandles:o.knobHandles===true?'ui-resizable-knob-handle':o.knobHandles});var aBorder='1px solid #DEDEDE';o.defaultTheme={'ui-resizable':{display:'block'},'ui-resizable-handle':{position:'absolute',background:'#F2F2F2',fontSize:'0.1px'},'ui-resizable-n':{cursor:'n-resize',height:'4px',left:'0px',right:'0px',borderTop:aBorder},'ui-resizable-s':{cursor:'s-resize',height:'4px',left:'0px',right:'0px',borderBottom:aBorder},'ui-resizable-e':{cursor:'e-resize',width:'4px',top:'0px',bottom:'0px',borderRight:aBorder},'ui-resizable-w':{cursor:'w-resize',width:'4px',top:'0px',bottom:'0px',borderLeft:aBorder},'ui-resizable-se':{cursor:'se-resize',width:'4px',height:'4px',borderRight:aBorder,borderBottom:aBorder},'ui-resizable-sw':{cursor:'sw-resize',width:'4px',height:'4px',borderBottom:aBorder,borderLeft:aBorder},'ui-resizable-ne':{cursor:'ne-resize',width:'4px',height:'4px',borderRight:aBorder,borderTop:aBorder},'ui-resizable-nw':{cursor:'nw-resize',width:'4px',height:'4px',borderLeft:aBorder,borderTop:aBorder}};o.knobTheme={'ui-resizable-handle':{background:'#F2F2F2',border:'1px solid #808080',height:'8px',width:'8px'},'ui-resizable-n':{cursor:'n-resize',top:'0px',left:'45%'},'ui-resizable-s':{cursor:'s-resize',bottom:'0px',left:'45%'},'ui-resizable-e':{cursor:'e-resize',right:'0px',top:'45%'},'ui-resizable-w':{cursor:'w-resize',left:'0px',top:'45%'},'ui-resizable-se':{cursor:'se-resize',right:'0px',bottom:'0px'},'ui-resizable-sw':{cursor:'sw-resize',left:'0px',bottom:'0px'},'ui-resizable-nw':{cursor:'nw-resize',left:'0px',top:'0px'},'ui-resizable-ne':{cursor:'ne-resize',right:'0px',top:'0px'}};o._nodeName=this.element[0].nodeName;if(o._nodeName.match(/canvas|textarea|input|select|button|img/i)){var el=this.element;if(/relative/.test(el.css('position'))&&$.browser.opera)
el.css({position:'relative',top:'auto',left:'auto'});el.wrap($('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:el.css('position'),width:el.outerWidth(),height:el.outerHeight(),top:el.css('top'),left:el.css('left')}));var oel=this.element;this.element=this.element.parent();this.element.data('resizable',this);this.element.css({marginLeft:oel.css("marginLeft"),marginTop:oel.css("marginTop"),marginRight:oel.css("marginRight"),marginBottom:oel.css("marginBottom")});oel.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});if($.browser.safari&&o.preventDefault)oel.css('resize','none');o.proportionallyResize=oel.css({position:'static',zoom:1,display:'block'});this.element.css({margin:oel.css('margin')});this._proportionallyResize();}
if(!o.handles)o.handles=!$('.ui-resizable-handle',this.element).length?"e,s,se":{n:'.ui-resizable-n',e:'.ui-resizable-e',s:'.ui-resizable-s',w:'.ui-resizable-w',se:'.ui-resizable-se',sw:'.ui-resizable-sw',ne:'.ui-resizable-ne',nw:'.ui-resizable-nw'};if(o.handles.constructor==String){o.zIndex=o.zIndex||1000;if(o.handles=='all')o.handles='n,e,s,w,se,sw,ne,nw';var n=o.handles.split(",");o.handles={};var insertionsDefault={handle:'position: absolute; display: none; overflow:hidden;',n:'top: 0pt; width:100%;',e:'right: 0pt; height:100%;',s:'bottom: 0pt; width:100%;',w:'left: 0pt; height:100%;',se:'bottom: 0pt; right: 0px;',sw:'bottom: 0pt; left: 0px;',ne:'top: 0pt; right: 0px;',nw:'top: 0pt; left: 0px;'};for(var i=0;i<n.length;i++){var handle=$.trim(n[i]),dt=o.defaultTheme,hname='ui-resizable-'+handle,loadDefault=!$.ui.css(hname)&&!o.knobHandles,userKnobClass=$.ui.css('ui-resizable-knob-handle'),allDefTheme=$.extend(dt[hname],dt['ui-resizable-handle']),allKnobTheme=$.extend(o.knobTheme[hname],!userKnobClass?o.knobTheme['ui-resizable-handle']:{});var applyZIndex=/sw|se|ne|nw/.test(handle)?{zIndex:++o.zIndex}:{};var defCss=(loadDefault?insertionsDefault[handle]:''),axis=$(['<div class="ui-resizable-handle ',hname,'" style="',defCss,insertionsDefault.handle,'"></div>'].join('')).css(applyZIndex);o.handles[handle]='.ui-resizable-'+handle;this.element.append(axis.css(loadDefault?allDefTheme:{}).css(o.knobHandles?allKnobTheme:{}).addClass(o.knobHandles?'ui-resizable-knob-handle':'').addClass(o.knobHandles));}
if(o.knobHandles)this.element.addClass('ui-resizable-knob').css(!$.ui.css('ui-resizable-knob')?{}:{});}
this._renderAxis=function(target){target=target||this.element;for(var i in o.handles){if(o.handles[i].constructor==String)
o.handles[i]=$(o.handles[i],this.element).show();if(o.transparent)
o.handles[i].css({opacity:0});if(this.element.is('.ui-wrapper')&&o._nodeName.match(/textarea|input|select|button/i)){var axis=$(o.handles[i],this.element),padWrapper=0;padWrapper=/sw|ne|nw|se|n|s/.test(i)?axis.outerHeight():axis.outerWidth();var padPos=['padding',/ne|nw|n/.test(i)?'Top':/se|sw|s/.test(i)?'Bottom':/^e$/.test(i)?'Right':'Left'].join("");if(!o.transparent)
target.css(padPos,padWrapper);this._proportionallyResize();}
if(!$(o.handles[i]).length)continue;}};this._renderAxis(this.element);o._handles=$('.ui-resizable-handle',self.element);if(o.disableSelection)
o._handles.each(function(i,e){$.ui.disableSelection(e);});o._handles.mouseover(function(){if(!o.resizing){if(this.className)
var axis=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);self.axis=o.axis=axis&&axis[1]?axis[1]:'se';}});if(o.autoHide){o._handles.hide();$(self.element).addClass("ui-resizable-autohide").hover(function(){$(this).removeClass("ui-resizable-autohide");o._handles.show();},function(){if(!o.resizing){$(this).addClass("ui-resizable-autohide");o._handles.hide();}});}
this.mouseInit();},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,options:this.options,originalSize:this.originalSize,originalPosition:this.originalPosition};},propagate:function(n,e){$.ui.plugin.call(this,n,[e,this.ui()]);if(n!="resize")this.element.triggerHandler(["resize",n].join(""),[e,this.ui()],this.options[n]);},destroy:function(){var el=this.element,wrapped=el.children(".ui-resizable").get(0);this.mouseDestroy();var _destroy=function(exp){$(exp).removeClass("ui-resizable ui-resizable-disabled").removeData("resizable").unbind(".resizable").find('.ui-resizable-handle').remove();};_destroy(el);if(el.is('.ui-wrapper')&&wrapped){el.parent().append($(wrapped).css({position:el.css('position'),width:el.outerWidth(),height:el.outerHeight(),top:el.css('top'),left:el.css('left')})).end().remove();_destroy(wrapped);}},mouseStart:function(e){if(this.options.disabled)return false;var handle=false;for(var i in this.options.handles){if($(this.options.handles[i])[0]==e.target)handle=true;}
if(!handle)return false;var o=this.options,iniPos=this.element.position(),el=this.element,num=function(v){return parseInt(v,10)||0;},ie6=$.browser.msie&&$.browser.version<7;o.resizing=true;o.documentScroll={top:$(document).scrollTop(),left:$(document).scrollLeft()};if(el.is('.ui-draggable')||(/absolute/).test(el.css('position'))){var sOffset=$.browser.msie&&!o.containment&&(/absolute/).test(el.css('position'))&&!(/relative/).test(el.parent().css('position'));var dscrollt=sOffset?o.documentScroll.top:0,dscrolll=sOffset?o.documentScroll.left:0;el.css({position:'absolute',top:(iniPos.top+dscrollt),left:(iniPos.left+dscrolll)});}
if($.browser.opera&&/relative/.test(el.css('position')))
el.css({position:'relative',top:'auto',left:'auto'});this._renderProxy();var curleft=num(this.helper.css('left')),curtop=num(this.helper.css('top'));if(o.containment){curleft+=$(o.containment).scrollLeft()||0;curtop+=$(o.containment).scrollTop()||0;}
this.offset=this.helper.offset();this.position={left:curleft,top:curtop};this.size=o.helper||ie6?{width:el.outerWidth(),height:el.outerHeight()}:{width:el.width(),height:el.height()};this.originalSize=o.helper||ie6?{width:el.outerWidth(),height:el.outerHeight()}:{width:el.width(),height:el.height()};this.originalPosition={left:curleft,top:curtop};this.sizeDiff={width:el.outerWidth()-el.width(),height:el.outerHeight()-el.height()};this.originalMousePosition={left:e.pageX,top:e.pageY};o.aspectRatio=(typeof o.aspectRatio=='number')?o.aspectRatio:((this.originalSize.height/this.originalSize.width)||1);if(o.preserveCursor)
$('body').css('cursor',this.axis+'-resize');this.propagate("start",e);return true;},mouseDrag:function(e){var el=this.helper,o=this.options,props={},self=this,smp=this.originalMousePosition,a=this.axis;var dx=(e.pageX-smp.left)||0,dy=(e.pageY-smp.top)||0;var trigger=this._change[a];if(!trigger)return false;var data=trigger.apply(this,[e,dx,dy]),ie6=$.browser.msie&&$.browser.version<7,csdif=this.sizeDiff;if(o._aspectRatio||e.shiftKey)
data=this._updateRatio(data,e);data=this._respectSize(data,e);this.propagate("resize",e);el.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!o.helper&&o.proportionallyResize)
this._proportionallyResize();this._updateCache(data);this.element.triggerHandler("resize",[e,this.ui()],this.options["resize"]);return false;},mouseStop:function(e){this.options.resizing=false;var o=this.options,num=function(v){return parseInt(v,10)||0;},self=this;if(o.helper){var pr=o.proportionallyResize,ista=pr&&(/textarea/i).test(pr.get(0).nodeName),soffseth=ista&&$.ui.hasScroll(pr.get(0),'left')?0:self.sizeDiff.height,soffsetw=ista?0:self.sizeDiff.width;var s={width:(self.size.width-soffsetw),height:(self.size.height-soffseth)},left=(parseInt(self.element.css('left'),10)+(self.position.left-self.originalPosition.left))||null,top=(parseInt(self.element.css('top'),10)+(self.position.top-self.originalPosition.top))||null;if(!o.animate)
this.element.css($.extend(s,{top:top,left:left}));if(o.helper&&!o.animate)this._proportionallyResize();}
if(o.preserveCursor)
$('body').css('cursor','auto');this.propagate("stop",e);if(o.helper)this.helper.remove();return false;},_updateCache:function(data){var o=this.options;this.offset=this.helper.offset();if(data.left)this.position.left=data.left;if(data.top)this.position.top=data.top;if(data.height)this.size.height=data.height;if(data.width)this.size.width=data.width;},_updateRatio:function(data,e){var o=this.options,cpos=this.position,csize=this.size,a=this.axis;if(data.height)data.width=(csize.height/o.aspectRatio);else if(data.width)data.height=(csize.width*o.aspectRatio);if(a=='sw'){data.left=cpos.left+(csize.width-data.width);data.top=null;}
if(a=='nw'){data.top=cpos.top+(csize.height-data.height);data.left=cpos.left+(csize.width-data.width);}
return data;},_respectSize:function(data,e){var el=this.helper,o=this.options,pRatio=o._aspectRatio||e.shiftKey,a=this.axis,ismaxw=data.width&&o.maxWidth&&o.maxWidth<data.width,ismaxh=data.height&&o.maxHeight&&o.maxHeight<data.height,isminw=data.width&&o.minWidth&&o.minWidth>data.width,isminh=data.height&&o.minHeight&&o.minHeight>data.height;if(isminw)data.width=o.minWidth;if(isminh)data.height=o.minHeight;if(ismaxw)data.width=o.maxWidth;if(ismaxh)data.height=o.maxHeight;var dw=this.originalPosition.left+this.originalSize.width,dh=this.position.top+this.size.height;var cw=/sw|nw|w/.test(a),ch=/nw|ne|n/.test(a);if(isminw&&cw)data.left=dw-o.minWidth;if(ismaxw&&cw)data.left=dw-o.maxWidth;if(isminh&&ch)data.top=dh-o.minHeight;if(ismaxh&&ch)data.top=dh-o.maxHeight;var isNotwh=!data.width&&!data.height;if(isNotwh&&!data.left&&data.top)data.top=null;else if(isNotwh&&!data.top&&data.left)data.left=null;return data;},_proportionallyResize:function(){var o=this.options;if(!o.proportionallyResize)return;var prel=o.proportionallyResize,el=this.helper||this.element;if(!o.borderDif){var b=[prel.css('borderTopWidth'),prel.css('borderRightWidth'),prel.css('borderBottomWidth'),prel.css('borderLeftWidth')],p=[prel.css('paddingTop'),prel.css('paddingRight'),prel.css('paddingBottom'),prel.css('paddingLeft')];o.borderDif=$.map(b,function(v,i){var border=parseInt(v,10)||0,padding=parseInt(p[i],10)||0;return border+padding;});}
prel.css({height:(el.height()-o.borderDif[0]-o.borderDif[2])+"px",width:(el.width()-o.borderDif[1]-o.borderDif[3])+"px"});},_renderProxy:function(){var el=this.element,o=this.options;this.elementOffset=el.offset();if(o.helper){this.helper=this.helper||$('<div style="overflow:hidden;"></div>');var ie6=$.browser.msie&&$.browser.version<7,ie6offset=(ie6?1:0),pxyoffset=(ie6?2:-1);this.helper.addClass(o.helper).css({width:el.outerWidth()+pxyoffset,height:el.outerHeight()+pxyoffset,position:'absolute',left:this.elementOffset.left-ie6offset+'px',top:this.elementOffset.top-ie6offset+'px',zIndex:++o.zIndex});this.helper.appendTo("body");if(o.disableSelection)
$.ui.disableSelection(this.helper.get(0));}else{this.helper=el;}},_change:{e:function(e,dx,dy){return{width:this.originalSize.width+dx};},w:function(e,dx,dy){var o=this.options,cs=this.originalSize,sp=this.originalPosition;return{left:sp.left+dx,width:cs.width-dx};},n:function(e,dx,dy){var o=this.options,cs=this.originalSize,sp=this.originalPosition;return{top:sp.top+dy,height:cs.height-dy};},s:function(e,dx,dy){return{height:this.originalSize.height+dy};},se:function(e,dx,dy){return $.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[e,dx,dy]));},sw:function(e,dx,dy){return $.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[e,dx,dy]));},ne:function(e,dx,dy){return $.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[e,dx,dy]));},nw:function(e,dx,dy){return $.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[e,dx,dy]));}}}));$.extend($.ui.resizable,{defaults:{cancel:":input",distance:1,delay:0,preventDefault:true,transparent:false,minWidth:10,minHeight:10,aspectRatio:false,disableSelection:true,preserveCursor:true,autoHide:false,knobHandles:false}});$.ui.plugin.add("resizable","containment",{start:function(e,ui){var o=ui.options,self=$(this).data("resizable"),el=self.element;var oc=o.containment,ce=(oc instanceof $)?oc.get(0):(/parent/.test(oc))?el.parent().get(0):oc;if(!ce)return;self.containerElement=$(ce);if(/document/.test(oc)||oc==document){self.containerOffset={left:0,top:0};self.containerPosition={left:0,top:0};self.parentData={element:$(document),left:0,top:0,width:$(document).width(),height:$(document).height()||document.body.parentNode.scrollHeight};}
else{self.containerOffset=$(ce).offset();self.containerPosition=$(ce).position();self.containerSize={height:$(ce).innerHeight(),width:$(ce).innerWidth()};var co=self.containerOffset,ch=self.containerSize.height,cw=self.containerSize.width,width=($.ui.hasScroll(ce,"left")?ce.scrollWidth:cw),height=($.ui.hasScroll(ce)?ce.scrollHeight:ch);self.parentData={element:ce,left:co.left,top:co.top,width:width,height:height};}},resize:function(e,ui){var o=ui.options,self=$(this).data("resizable"),ps=self.containerSize,co=self.containerOffset,cs=self.size,cp=self.position,pRatio=o._aspectRatio||e.shiftKey,cop={top:0,left:0},ce=self.containerElement;if(ce[0]!=document&&/static/.test(ce.css('position')))
cop=self.containerPosition;if(cp.left<(o.helper?co.left:cop.left)){self.size.width=self.size.width+(o.helper?(self.position.left-co.left):(self.position.left-cop.left));if(pRatio)self.size.height=self.size.width*o.aspectRatio;self.position.left=o.helper?co.left:cop.left;}
if(cp.top<(o.helper?co.top:0)){self.size.height=self.size.height+(o.helper?(self.position.top-co.top):self.position.top);if(pRatio)self.size.width=self.size.height/o.aspectRatio;self.position.top=o.helper?co.top:0;}
var woset=(o.helper?self.offset.left-co.left:(self.position.left-cop.left))+self.sizeDiff.width,hoset=(o.helper?self.offset.top-co.top:self.position.top)+self.sizeDiff.height;if(woset+self.size.width>=self.parentData.width){self.size.width=self.parentData.width-woset;if(pRatio)self.size.height=self.size.width*o.aspectRatio;}
if(hoset+self.size.height>=self.parentData.height){self.size.height=self.parentData.height-hoset;if(pRatio)self.size.width=self.size.height/o.aspectRatio;}},stop:function(e,ui){var o=ui.options,self=$(this).data("resizable"),cp=self.position,co=self.containerOffset,cop=self.containerPosition,ce=self.containerElement;var helper=$(self.helper),ho=helper.offset(),w=helper.innerWidth(),h=helper.innerHeight();if(o.helper&&!o.animate&&/relative/.test(ce.css('position')))
$(this).css({left:(ho.left-co.left),top:(ho.top-co.top),width:w,height:h});if(o.helper&&!o.animate&&/static/.test(ce.css('position')))
$(this).css({left:cop.left+(ho.left-co.left),top:cop.top+(ho.top-co.top),width:w,height:h});}});$.ui.plugin.add("resizable","grid",{resize:function(e,ui){var o=ui.options,self=$(this).data("resizable"),cs=self.size,os=self.originalSize,op=self.originalPosition,a=self.axis,ratio=o._aspectRatio||e.shiftKey;o.grid=typeof o.grid=="number"?[o.grid,o.grid]:o.grid;var ox=Math.round((cs.width-os.width)/(o.grid[0]||1))*(o.grid[0]||1),oy=Math.round((cs.height-os.height)/(o.grid[1]||1))*(o.grid[1]||1);if(/^(se|s|e)$/.test(a)){self.size.width=os.width+ox;self.size.height=os.height+oy;}
else if(/^(ne)$/.test(a)){self.size.width=os.width+ox;self.size.height=os.height+oy;self.position.top=op.top-oy;}
else if(/^(sw)$/.test(a)){self.size.width=os.width+ox;self.size.height=os.height+oy;self.position.left=op.left-ox;}
else{self.size.width=os.width+ox;self.size.height=os.height+oy;self.position.top=op.top-oy;self.position.left=op.left-ox;}}});$.ui.plugin.add("resizable","animate",{stop:function(e,ui){var o=ui.options,self=$(this).data("resizable");var pr=o.proportionallyResize,ista=pr&&(/textarea/i).test(pr.get(0).nodeName),soffseth=ista&&$.ui.hasScroll(pr.get(0),'left')?0:self.sizeDiff.height,soffsetw=ista?0:self.sizeDiff.width;var style={width:(self.size.width-soffsetw),height:(self.size.height-soffseth)},left=(parseInt(self.element.css('left'),10)+(self.position.left-self.originalPosition.left))||null,top=(parseInt(self.element.css('top'),10)+(self.position.top-self.originalPosition.top))||null;self.element.animate($.extend(style,top&&left?{top:top,left:left}:{}),{duration:o.animateDuration||"slow",easing:o.animateEasing||"swing",step:function(){var data={width:parseInt(self.element.css('width'),10),height:parseInt(self.element.css('height'),10),top:parseInt(self.element.css('top'),10),left:parseInt(self.element.css('left'),10)};if(pr)pr.css({width:data.width,height:data.height});self._updateCache(data);self.propagate("animate",e);}});}});$.ui.plugin.add("resizable","ghost",{start:function(e,ui){var o=ui.options,self=$(this).data("resizable"),pr=o.proportionallyResize,cs=self.size;if(!pr)self.ghost=self.element.clone();else self.ghost=pr.clone();self.ghost.css({opacity:.25,display:'block',position:'relative',height:cs.height,width:cs.width,margin:0,left:0,top:0}).addClass('ui-resizable-ghost').addClass(typeof o.ghost=='string'?o.ghost:'');self.ghost.appendTo(self.helper);},resize:function(e,ui){var o=ui.options,self=$(this).data("resizable"),pr=o.proportionallyResize;if(self.ghost)self.ghost.css({position:'relative',height:self.size.height,width:self.size.width});},stop:function(e,ui){var o=ui.options,self=$(this).data("resizable"),pr=o.proportionallyResize;if(self.ghost&&self.helper)self.helper.get(0).removeChild(self.ghost.get(0));}});$.ui.plugin.add("resizable","alsoResize",{start:function(e,ui){var o=ui.options,self=$(this).data("resizable"),_store=function(exp){$(exp).each(function(){$(this).data("resizable-alsoresize",{width:parseInt($(this).width(),10),height:parseInt($(this).height(),10),left:parseInt($(this).css('left'),10),top:parseInt($(this).css('top'),10)});});};if(typeof(o.alsoResize)=='object'){if(o.alsoResize.length){o.alsoResize=o.alsoResize[0];_store(o.alsoResize);}
else{$.each(o.alsoResize,function(exp,c){_store(exp);});}}else{_store(o.alsoResize);}},resize:function(e,ui){var o=ui.options,self=$(this).data("resizable"),os=self.originalSize,op=self.originalPosition;var delta={height:(self.size.height-os.height)||0,width:(self.size.width-os.width)||0,top:(self.position.top-op.top)||0,left:(self.position.left-op.left)||0},_alsoResize=function(exp,c){$(exp).each(function(){var start=$(this).data("resizable-alsoresize"),style={},css=c&&c.length?c:['width','height','top','left'];$.each(css||['width','height','top','left'],function(i,prop){var sum=(start[prop]||0)+(delta[prop]||0);if(sum&&sum>=0)
style[prop]=sum||null;});$(this).css(style);});};if(typeof(o.alsoResize)=='object'){$.each(o.alsoResize,function(exp,c){_alsoResize(exp,c);});}else{_alsoResize(o.alsoResize);}},stop:function(e,ui){$(this).removeData("resizable-alsoresize-start");}});})(jQuery);(function($){function contains(a,b){var safari2=$.browser.safari&&$.browser.version<522;if(a.contains&&!safari2){return a.contains(b);}
if(a.compareDocumentPosition)
return!!(a.compareDocumentPosition(b)&16);while(b=b.parentNode)
if(b==a)return true;return false;};$.widget("ui.sortable",$.extend({},$.ui.mouse,{init:function(){var o=this.options;this.containerCache={};this.element.addClass("ui-sortable");this.refresh();this.floating=this.items.length?(/left|right/).test(this.items[0].item.css('float')):false;if(!(/(relative|absolute|fixed)/).test(this.element.css('position')))this.element.css('position','relative');this.offset=this.element.offset();this.mouseInit();},plugins:{},ui:function(inst){return{helper:(inst||this)["helper"],placeholder:(inst||this)["placeholder"]||$([]),position:(inst||this)["position"],absolutePosition:(inst||this)["positionAbs"],options:this.options,element:this.element,item:(inst||this)["currentItem"],sender:inst?inst.element:null};},propagate:function(n,e,inst,noPropagation){$.ui.plugin.call(this,n,[e,this.ui(inst)]);if(!noPropagation)this.element.triggerHandler(n=="sort"?n:"sort"+n,[e,this.ui(inst)],this.options[n]);},serialize:function(o){var items=($.isFunction(this.options.items)?this.options.items.call(this.element):$(this.options.items,this.element)).not('.ui-sortable-helper');var str=[];o=o||{};items.each(function(){var res=($(this).attr(o.attribute||'id')||'').match(o.expression||(/(.+)[-=_](.+)/));if(res)str.push((o.key||res[1])+'[]='+(o.key&&o.expression?res[1]:res[2]));});return str.join('&');},toArray:function(attr){var items=($.isFunction(this.options.items)?this.options.items.call(this.element):$(this.options.items,this.element)).not('.ui-sortable-helper');var ret=[];items.each(function(){ret.push($(this).attr(attr||'id'));});return ret;},intersectsWith:function(item){var x1=this.positionAbs.left,x2=x1+this.helperProportions.width,y1=this.positionAbs.top,y2=y1+this.helperProportions.height;var l=item.left,r=l+item.width,t=item.top,b=t+item.height;if(this.options.tolerance=="pointer"||this.options.forcePointerForContainers||(this.options.tolerance=="guess"&&this.helperProportions[this.floating?'width':'height']>item[this.floating?'width':'height'])){return(y1+this.offset.click.top>t&&y1+this.offset.click.top<b&&x1+this.offset.click.left>l&&x1+this.offset.click.left<r);}else{return(l<x1+(this.helperProportions.width/2)&&x2-(this.helperProportions.width/2)<r&&t<y1+(this.helperProportions.height/2)&&y2-(this.helperProportions.height/2)<b);}},intersectsWithEdge:function(item){var x1=this.positionAbs.left,x2=x1+this.helperProportions.width,y1=this.positionAbs.top,y2=y1+this.helperProportions.height;var l=item.left,r=l+item.width,t=item.top,b=t+item.height;if(this.options.tolerance=="pointer"||(this.options.tolerance=="guess"&&this.helperProportions[this.floating?'width':'height']>item[this.floating?'width':'height'])){if(!(y1+this.offset.click.top>t&&y1+this.offset.click.top<b&&x1+this.offset.click.left>l&&x1+this.offset.click.left<r))return false;if(this.floating){if(x1+this.offset.click.left>l&&x1+this.offset.click.left<l+item.width/2)return 2;if(x1+this.offset.click.left>l+item.width/2&&x1+this.offset.click.left<r)return 1;}else{if(y1+this.offset.click.top>t&&y1+this.offset.click.top<t+item.height/2)return 2;if(y1+this.offset.click.top>t+item.height/2&&y1+this.offset.click.top<b)return 1;}}else{if(!(l<x1+(this.helperProportions.width/2)&&x2-(this.helperProportions.width/2)<r&&t<y1+(this.helperProportions.height/2)&&y2-(this.helperProportions.height/2)<b))return false;if(this.floating){if(x2>l&&x1<l)return 2;if(x1<r&&x2>r)return 1;}else{if(y2>t&&y1<t)return 1;if(y1<b&&y2>b)return 2;}}
return false;},refresh:function(){this.refreshItems();this.refreshPositions();},refreshItems:function(){this.items=[];this.containers=[this];var items=this.items;var self=this;var queries=[[$.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):$(this.options.items,this.element),this]];if(this.options.connectWith){for(var i=this.options.connectWith.length-1;i>=0;i--){var cur=$(this.options.connectWith[i]);for(var j=cur.length-1;j>=0;j--){var inst=$.data(cur[j],'sortable');if(inst&&!inst.options.disabled){queries.push([$.isFunction(inst.options.items)?inst.options.items.call(inst.element):$(inst.options.items,inst.element),inst]);this.containers.push(inst);}};};}
for(var i=queries.length-1;i>=0;i--){queries[i][0].each(function(){$.data(this,'sortable-item',queries[i][1]);items.push({item:$(this),instance:queries[i][1],width:0,height:0,left:0,top:0});});};},refreshPositions:function(fast){if(this.offsetParent){var po=this.offsetParent.offset();this.offset.parent={top:po.top+this.offsetParentBorders.top,left:po.left+this.offsetParentBorders.left};}
for(var i=this.items.length-1;i>=0;i--){if(this.items[i].instance!=this.currentContainer&&this.currentContainer&&this.items[i].item[0]!=this.currentItem[0])
continue;var t=this.options.toleranceElement?$(this.options.toleranceElement,this.items[i].item):this.items[i].item;if(!fast){this.items[i].width=t[0].offsetWidth;this.items[i].height=t[0].offsetHeight;}
var p=t.offset();this.items[i].left=p.left;this.items[i].top=p.top;};if(this.options.custom&&this.options.custom.refreshContainers){this.options.custom.refreshContainers.call(this);}else{for(var i=this.containers.length-1;i>=0;i--){var p=this.containers[i].element.offset();this.containers[i].containerCache.left=p.left;this.containers[i].containerCache.top=p.top;this.containers[i].containerCache.width=this.containers[i].element.outerWidth();this.containers[i].containerCache.height=this.containers[i].element.outerHeight();};}},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this.mouseDestroy();for(var i=this.items.length-1;i>=0;i--)
this.items[i].item.removeData("sortable-item");},createPlaceholder:function(that){var self=that||this,o=self.options;if(o.placeholder.constructor==String){var className=o.placeholder;o.placeholder={element:function(){return $('<div></div>').addClass(className)[0];},update:function(i,p){p.css(i.offset()).css({width:i.outerWidth(),height:i.outerHeight()});}};}
self.placeholder=$(o.placeholder.element.call(self.element,self.currentItem)).appendTo('body').css({position:'absolute'});o.placeholder.update.call(self.element,self.currentItem,self.placeholder);},contactContainers:function(e){for(var i=this.containers.length-1;i>=0;i--){if(this.intersectsWith(this.containers[i].containerCache)){if(!this.containers[i].containerCache.over){if(this.currentContainer!=this.containers[i]){var dist=10000;var itemWithLeastDistance=null;var base=this.positionAbs[this.containers[i].floating?'left':'top'];for(var j=this.items.length-1;j>=0;j--){if(!contains(this.containers[i].element[0],this.items[j].item[0]))continue;var cur=this.items[j][this.containers[i].floating?'left':'top'];if(Math.abs(cur-base)<dist){dist=Math.abs(cur-base);itemWithLeastDistance=this.items[j];}}
if(!itemWithLeastDistance&&!this.options.dropOnEmpty)
continue;if(this.placeholder)this.placeholder.remove();if(this.containers[i].options.placeholder){this.containers[i].createPlaceholder(this);}else{this.placeholder=null;;}
this.currentContainer=this.containers[i];itemWithLeastDistance?this.rearrange(e,itemWithLeastDistance,null,true):this.rearrange(e,null,this.containers[i].element,true);this.propagate("change",e);this.containers[i].propagate("change",e,this);}
this.containers[i].propagate("over",e,this);this.containers[i].containerCache.over=1;}}else{if(this.containers[i].containerCache.over){this.containers[i].propagate("out",e,this);this.containers[i].containerCache.over=0;}}};},mouseCapture:function(e,overrideHandle){if(this.options.disabled||this.options.type=='static')return false;this.refreshItems();var currentItem=null,self=this,nodes=$(e.target).parents().each(function(){if($.data(this,'sortable-item')==self){currentItem=$(this);return false;}});if($.data(e.target,'sortable-item')==self)currentItem=$(e.target);if(!currentItem)return false;if(this.options.handle&&!overrideHandle){var validHandle=false;$(this.options.handle,currentItem).find("*").andSelf().each(function(){if(this==e.target)validHandle=true;});if(!validHandle)return false;}
this.currentItem=currentItem;return true;},mouseStart:function(e,overrideHandle,noActivation){var o=this.options;this.currentContainer=this;this.refreshPositions();this.helper=typeof o.helper=='function'?$(o.helper.apply(this.element[0],[e,this.currentItem])):this.currentItem.clone();if(!this.helper.parents('body').length)$(o.appendTo!='parent'?o.appendTo:this.currentItem[0].parentNode)[0].appendChild(this.helper[0]);this.helper.css({position:'absolute',clear:'both'}).addClass('ui-sortable-helper');this.margins={left:(parseInt(this.currentItem.css("marginLeft"),10)||0),top:(parseInt(this.currentItem.css("marginTop"),10)||0)};this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.offset.click={left:e.pageX-this.offset.left,top:e.pageY-this.offset.top};this.offsetParent=this.helper.offsetParent();var po=this.offsetParent.offset();this.offsetParentBorders={top:(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)};this.offset.parent={top:po.top+this.offsetParentBorders.top,left:po.left+this.offsetParentBorders.left};this.originalPosition=this.generatePosition(e);this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};if(o.placeholder)this.createPlaceholder();this.propagate("start",e);this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};if(o.cursorAt){if(o.cursorAt.left!=undefined)this.offset.click.left=o.cursorAt.left;if(o.cursorAt.right!=undefined)this.offset.click.left=this.helperProportions.width-o.cursorAt.right;if(o.cursorAt.top!=undefined)this.offset.click.top=o.cursorAt.top;if(o.cursorAt.bottom!=undefined)this.offset.click.top=this.helperProportions.height-o.cursorAt.bottom;}
if(o.containment){if(o.containment=='parent')o.containment=this.helper[0].parentNode;if(o.containment=='document'||o.containment=='window')this.containment=[0-this.offset.parent.left,0-this.offset.parent.top,$(o.containment=='document'?document:window).width()-this.offset.parent.left-this.helperProportions.width-this.margins.left-(parseInt(this.element.css("marginRight"),10)||0),($(o.containment=='document'?document:window).height()||document.body.parentNode.scrollHeight)-this.offset.parent.top-this.helperProportions.height-this.margins.top-(parseInt(this.element.css("marginBottom"),10)||0)];if(!(/^(document|window|parent)$/).test(o.containment)){var ce=$(o.containment)[0];var co=$(o.containment).offset();this.containment=[co.left+(parseInt($(ce).css("borderLeftWidth"),10)||0)-this.offset.parent.left,co.top+(parseInt($(ce).css("borderTopWidth"),10)||0)-this.offset.parent.top,co.left+Math.max(ce.scrollWidth,ce.offsetWidth)-(parseInt($(ce).css("borderLeftWidth"),10)||0)-this.offset.parent.left-this.helperProportions.width-this.margins.left-(parseInt(this.currentItem.css("marginRight"),10)||0),co.top+Math.max(ce.scrollHeight,ce.offsetHeight)-(parseInt($(ce).css("borderTopWidth"),10)||0)-this.offset.parent.top-this.helperProportions.height-this.margins.top-(parseInt(this.currentItem.css("marginBottom"),10)||0)];}}
if(this.options.placeholder!='clone')
this.currentItem.css('visibility','hidden');if(!noActivation){for(var i=this.containers.length-1;i>=0;i--){this.containers[i].propagate("activate",e,this);}}
if($.ui.ddmanager)$.ui.ddmanager.current=this;if($.ui.ddmanager&&!o.dropBehaviour)$.ui.ddmanager.prepareOffsets(this,e);this.dragging=true;this.mouseDrag(e);return true;},convertPositionTo:function(d,pos){if(!pos)pos=this.position;var mod=d=="absolute"?1:-1;return{top:(pos.top
+this.offset.parent.top*mod
-(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)*mod
+this.margins.top*mod),left:(pos.left
+this.offset.parent.left*mod
-(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft)*mod
+this.margins.left*mod)};},generatePosition:function(e){var o=this.options;var position={top:(e.pageY
-this.offset.click.top
-this.offset.parent.top
+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)),left:(e.pageX
-this.offset.click.left
-this.offset.parent.left
+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft))};if(!this.originalPosition)return position;if(this.containment){if(position.left<this.containment[0])position.left=this.containment[0];if(position.top<this.containment[1])position.top=this.containment[1];if(position.left>this.containment[2])position.left=this.containment[2];if(position.top>this.containment[3])position.top=this.containment[3];}
if(o.grid){var top=this.originalPosition.top+Math.round((position.top-this.originalPosition.top)/o.grid[1])*o.grid[1];position.top=this.containment?(!(top<this.containment[1]||top>this.containment[3])?top:(!(top<this.containment[1])?top-o.grid[1]:top+o.grid[1])):top;var left=this.originalPosition.left+Math.round((position.left-this.originalPosition.left)/o.grid[0])*o.grid[0];position.left=this.containment?(!(left<this.containment[0]||left>this.containment[2])?left:(!(left<this.containment[0])?left-o.grid[0]:left+o.grid[0])):left;}
return position;},mouseDrag:function(e){this.position=this.generatePosition(e);this.positionAbs=this.convertPositionTo("absolute");$.ui.plugin.call(this,"sort",[e,this.ui()]);this.positionAbs=this.convertPositionTo("absolute");this.helper[0].style.left=this.position.left+'px';this.helper[0].style.top=this.position.top+'px';for(var i=this.items.length-1;i>=0;i--){var intersection=this.intersectsWithEdge(this.items[i]);if(!intersection)continue;if(this.items[i].item[0]!=this.currentItem[0]&&this.currentItem[intersection==1?"next":"prev"]()[0]!=this.items[i].item[0]&&!contains(this.currentItem[0],this.items[i].item[0])&&(this.options.type=='semi-dynamic'?!contains(this.element[0],this.items[i].item[0]):true)){this.direction=intersection==1?"down":"up";this.rearrange(e,this.items[i]);this.propagate("change",e);break;}}
this.contactContainers(e);if($.ui.ddmanager)$.ui.ddmanager.drag(this,e);this.element.triggerHandler("sort",[e,this.ui()],this.options["sort"]);return false;},rearrange:function(e,i,a,hardRefresh){a?a[0].appendChild(this.currentItem[0]):i.item[0].parentNode.insertBefore(this.currentItem[0],(this.direction=='down'?i.item[0]:i.item[0].nextSibling));this.counter=this.counter?++this.counter:1;var self=this,counter=this.counter;window.setTimeout(function(){if(counter==self.counter)self.refreshPositions(!hardRefresh);},0);if(this.options.placeholder)
this.options.placeholder.update.call(this.element,this.currentItem,this.placeholder);},mouseStop:function(e,noPropagation){if($.ui.ddmanager&&!this.options.dropBehaviour)
$.ui.ddmanager.drop(this,e);if(this.options.revert){var self=this;var cur=self.currentItem.offset();if(self.placeholder)self.placeholder.animate({opacity:'hide'},(parseInt(this.options.revert,10)||500)-50);$(this.helper).animate({left:cur.left-this.offset.parent.left-self.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:cur.top-this.offset.parent.top-self.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){self.clear(e);});}else{this.clear(e,noPropagation);}
return false;},clear:function(e,noPropagation){if(this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!=this.currentItem.parent()[0])this.propagate("update",e,null,noPropagation);if(!contains(this.element[0],this.currentItem[0])){this.propagate("remove",e,null,noPropagation);for(var i=this.containers.length-1;i>=0;i--){if(contains(this.containers[i].element[0],this.currentItem[0])){this.containers[i].propagate("update",e,this,noPropagation);this.containers[i].propagate("receive",e,this,noPropagation);}};};for(var i=this.containers.length-1;i>=0;i--){this.containers[i].propagate("deactivate",e,this,noPropagation);if(this.containers[i].containerCache.over){this.containers[i].propagate("out",e,this);this.containers[i].containerCache.over=0;}}
this.dragging=false;if(this.cancelHelperRemoval){this.propagate("stop",e,null,noPropagation);return false;}
$(this.currentItem).css('visibility','');if(this.placeholder)this.placeholder.remove();this.helper.remove();this.helper=null;this.propagate("stop",e,null,noPropagation);return true;}}));$.extend($.ui.sortable,{getter:"serialize toArray",defaults:{helper:"clone",tolerance:"guess",distance:1,delay:0,scroll:true,scrollSensitivity:20,scrollSpeed:20,cancel:":input",items:'> *',zIndex:1000,dropOnEmpty:true,appendTo:"parent"}});$.ui.plugin.add("sortable","cursor",{start:function(e,ui){var t=$('body');if(t.css("cursor"))ui.options._cursor=t.css("cursor");t.css("cursor",ui.options.cursor);},stop:function(e,ui){if(ui.options._cursor)$('body').css("cursor",ui.options._cursor);}});$.ui.plugin.add("sortable","zIndex",{start:function(e,ui){var t=ui.helper;if(t.css("zIndex"))ui.options._zIndex=t.css("zIndex");t.css('zIndex',ui.options.zIndex);},stop:function(e,ui){if(ui.options._zIndex)$(ui.helper).css('zIndex',ui.options._zIndex);}});$.ui.plugin.add("sortable","opacity",{start:function(e,ui){var t=ui.helper;if(t.css("opacity"))ui.options._opacity=t.css("opacity");t.css('opacity',ui.options.opacity);},stop:function(e,ui){if(ui.options._opacity)$(ui.helper).css('opacity',ui.options._opacity);}});$.ui.plugin.add("sortable","scroll",{start:function(e,ui){var o=ui.options;var i=$(this).data("sortable");i.overflowY=function(el){do{if(/auto|scroll/.test(el.css('overflow'))||(/auto|scroll/).test(el.css('overflow-y')))return el;el=el.parent();}while(el[0].parentNode);return $(document);}(i.currentItem);i.overflowX=function(el){do{if(/auto|scroll/.test(el.css('overflow'))||(/auto|scroll/).test(el.css('overflow-x')))return el;el=el.parent();}while(el[0].parentNode);return $(document);}(i.currentItem);if(i.overflowY[0]!=document&&i.overflowY[0].tagName!='HTML')i.overflowYOffset=i.overflowY.offset();if(i.overflowX[0]!=document&&i.overflowX[0].tagName!='HTML')i.overflowXOffset=i.overflowX.offset();},sort:function(e,ui){var o=ui.options;var i=$(this).data("sortable");if(i.overflowY[0]!=document&&i.overflowY[0].tagName!='HTML'){if((i.overflowYOffset.top+i.overflowY[0].offsetHeight)-e.pageY<o.scrollSensitivity)
i.overflowY[0].scrollTop=i.overflowY[0].scrollTop+o.scrollSpeed;if(e.pageY-i.overflowYOffset.top<o.scrollSensitivity)
i.overflowY[0].scrollTop=i.overflowY[0].scrollTop-o.scrollSpeed;}else{if(e.pageY-$(document).scrollTop()<o.scrollSensitivity)
$(document).scrollTop($(document).scrollTop()-o.scrollSpeed);if($(window).height()-(e.pageY-$(document).scrollTop())<o.scrollSensitivity)
$(document).scrollTop($(document).scrollTop()+o.scrollSpeed);}
if(i.overflowX[0]!=document&&i.overflowX[0].tagName!='HTML'){if((i.overflowXOffset.left+i.overflowX[0].offsetWidth)-e.pageX<o.scrollSensitivity)
i.overflowX[0].scrollLeft=i.overflowX[0].scrollLeft+o.scrollSpeed;if(e.pageX-i.overflowXOffset.left<o.scrollSensitivity)
i.overflowX[0].scrollLeft=i.overflowX[0].scrollLeft-o.scrollSpeed;}else{if(e.pageX-$(document).scrollLeft()<o.scrollSensitivity)
$(document).scrollLeft($(document).scrollLeft()-o.scrollSpeed);if($(window).width()-(e.pageX-$(document).scrollLeft())<o.scrollSensitivity)
$(document).scrollLeft($(document).scrollLeft()+o.scrollSpeed);}}});$.ui.plugin.add("sortable","axis",{sort:function(e,ui){var i=$(this).data("sortable");if(ui.options.axis=="y")i.position.left=i.originalPosition.left;if(ui.options.axis=="x")i.position.top=i.originalPosition.top;}});})(jQuery);
// zooloo framework
function ZoolooFramework() {
    var _zt = '';
    var _editorBasePath = '/js/fckeditor/';
    this.dummyImg = '/images/pixel.gif';
    this.getEditorBasePath = function() { return _editorBasePath; };
    this.setEditorBasePath = function(path) { if(typeof path == 'string') _editorBasePath = path; };
    this.setZt = function(zt) { if(typeof zt == 'string') _zt = zt; };
    this.alert = function(alertMsg,alertTitle,alertCallback) { jAlert(alertMsg,alertTitle,alertCallback); };
    this.notify = function(notificationMsg) { $.jGrowl(notificationMsg); };
    this.confirm = function(confirmMsg,confirmTitle,confirmOkCallback,confirmCancelCallback) {
        if(!confirmTitle) confirmTitle = ZMsg.DEFAULT_CONFIRM_BOX_TITLE;
        var confirmCallback = function(val) {
            if(val) {
                if(confirmOkCallback) { confirmOkCallback(); }
            }
            else {
                if(confirmCancelCallback) { confirmCancelCallback(); }
            }
        };
        jConfirm(confirmMsg,confirmTitle,confirmCallback);
    };
    this.tooltip = function(selector,additionalOptions) {
        (additionalOptions instanceof Object) ? $(selector).tooltip(additionalOptions) : $(selector).tooltip();
    };
    this.displayErrors = function(response,targetContainer,showDetailErrMsg,afterCallback) {
        var delimiter = (targetContainer) ? '<br/>' : "\n";
        showDetailErrMsg = (showDetailErrMsg!==0) ? 1 : 0;
        var errMsg = '';
        if(response.error) { errMsg+=response.error+delimiter; }
        if(response.data && showDetailErrMsg==1) {
            var errs = response.data.errors;
            if(errs) {
                for(var k in errs) {
                    if(errs[k]) {
                        errMsg+=errs[k]+delimiter;
                    }
                }
                if(afterCallback instanceof Function) { afterCallback(); }
            }
        }
        if(targetContainer) {
            targetContainer.show();
            targetContainer.html(errMsg);
            if(afterCallback instanceof Function) { afterCallback(); }
        }
        else { this.alert(errMsg,null,afterCallback); }
    };
    this.displayAd = function(adContent) {
        if(adContent) {
            $.modal.close(false);
            $(adContent).modal({onClose: function(dialog){ $.modal.close(false); }});
        }
    };
    this.zfBlockUI = function(blockMsg) {
        var options = {
            css:{padding:0,margin:0,border:0,backgroundColor:'transparent',cursor:'wait',fontSize:'40px',color:'#00abff',fontWeight:'bold'},
            overlayCSS:{backgroundColor:'#00abff',opacity:'0.1'},
            baseZ:10000,
            applyPlatformOpacityRules: false
        };
        if(blockMsg) { options.message = blockMsg; }
        else blockMsg = '<img src="/images/processing.png" />';
        $.blockUI(options);
    };
    this.zfUnblockUI = function() { $.unblockUI(); };
    this.zfAjaxPost = function(postUrl, postData, preventInteractions, postSuccessCallback, postErrorCallback, additionalOptions) {
        preventInteractions = (preventInteractions===true) ? true : false;

        if(!(postSuccessCallback instanceof Function)) {
            postSuccessCallback = function(response) {
                try {
                    if(response.status!=1) {
                        var errMsg = response.error;
                        if(errMsg) { this.alert(errMsg); }
                    }
                }
                catch(err) {}
            };
        }
        if(!(postErrorCallback instanceof Function)) { postErrorCallback = function() {}; }
        
        postUrl = _tokenizeUrl(postUrl);
        ajaxOptions = {
            type:'POST',
            url:postUrl,
            data:postData,
            timeout:30000,
            beforeSend:function() { if(preventInteractions) { ZFramework.zfBlockUI('<img src="/images/processing.png" />'); } },
            complete:function() { if(preventInteractions) { ZFramework.zfUnblockUI(); } },
            success:function(response) {
                try {
                    if(preventInteractions) { ZFramework.zfUnblockUI(); }
                    response = JSON.parse(response);
                    if(!(response instanceof Object)) { throw('JSON.parse'); }
                    if(response.status==0 && response.session==0) {
                        if(response.force==1) window.location.reload();
                        else ZFramework.alert(ZFramework.i18n(ZMsg.SESSION_EXPIRED),null,function(){ window.location.reload(); });
                    }
                    else {
                        if(!response.data) { response.data = {}; }
                        if(postSuccessCallback instanceof Function) { postSuccessCallback(response); }
                    }
                }
                catch(err) {
                    if(preventInteractions) ZFramework.alert(ZFramework.i18n(),null,function(){ if(err.message!='JSON.parse') window.location.reload(); });
                }
            },
            error:function() {
                if(preventInteractions) { ZFramework.zfUnblockUI(); }
                if(postErrorCallback instanceof Function) { postErrorCallback(); }
            }
        };

        if(additionalOptions instanceof Object) {
            for(var i in additionalOptions) {
                if(additionalOptions[i]) { ajaxOptions[i] = additionalOptions[i]; }
            }
        }

        $.ajax(ajaxOptions);
    };
    this.zfMakeDraggable = function(selector,helper,dragcallback,additionalOptions) {
        if(!dragcallback) { dragcallback = function(ev,ui) {}; }
        var dragOptions = {
            delay       : 200,
            revert        : true,
            opacity        : 0.7,
            helper        : helper,    // or a function that returns a dom element
            zIndex        : 10000,
            drag        : function(ev,ui) { dragcallback(ev,ui); }
        };
        // add additional options
        if(additionalOptions instanceof Object) {
            for(var i in additionalOptions) {
                if(additionalOptions[i]) { dragOptions[i] = additionalOptions[i]; }
            }
        }
        $(selector).draggable(dragOptions);
    };
    this.zfMakeDroppable = function(selector,acceptSelector,dropcallback,additionalOptions) {
        if(!dropcallback) { dropcallback = function(ev,ui) {}; }
        var dropOptions = {
            accept        : acceptSelector,
            drop        : function(ev,ui) { dropcallback(ev,ui); }
        };
        // add additional options
        if(additionalOptions instanceof Object) {
            for(var i in additionalOptions) {
                if(additionalOptions[i]) { dropOptions[i] = additionalOptions[i]; }
            }
        }
        $(selector).droppable(dropOptions);
    };
    this.zfMakeSortable = function(selector,acceptSelector,fromOtherSelector,updateCallback,additionalOptions) {
        // add preprocessing for stop
        var newUpdateCallback = function(ev,ui) {
            if(updateCallback instanceof Function) { updateCallback(ev,ui); }
        };
        var sortOptions = {
            delay       : 200,
            placeholder : 'fw_sortspot',
            items       : acceptSelector,
            connectWith : $(fromOtherSelector),
            update      : newUpdateCallback
        };
        // add additional options
        if(additionalOptions instanceof Object) {
            for(var i in additionalOptions) {
                if(additionalOptions[i]) { sortOptions[i] = additionalOptions[i]; }
            }
        }
        // add preprocessing for start
        var startCallback = sortOptions.start;
        var newStartCallback = function(ev,ui) {
            if(startCallback instanceof Function) { startCallback(ev,ui); }
        };
        sortOptions.start = newStartCallback;
        $(selector).sortable(sortOptions);
    };
    this.i18n = function(msg,args) {
        var defaultMsg = ZMsg.DEFAULT_MESSAGE;
        try {
            // message id must be supplied
            if(!msg || typeof msg != 'string') { return defaultMsg; }
            // argument must be json, if supplied
            if(args) {
                if(!(args instanceof Object)) { return defaultMsg; }
            }
            else return msg;

            // process message
            var k,v,re;
            for(k in args) {
                if(args[k]) {
                    v = args[k];
                    re = new RegExp('{{'+k+'}}','g');
                    msg = msg.replace(re,v);
                }
            }
            return msg;
        }
        catch(err) { return defaultMsg; }
    };
    this.setInputMaxLength = function(selector,maxlength) {
        $(selector).keypress(function(e) {
            if(e.which!=0 && e.which!=13 && e.which!=8 && $(this).val().length>=maxlength && (this.selectionStart==this.selectionEnd)) {
                return false;
            }
        }).bind('paste',function() {
            setTimeout(function(){
                var el = $(selector);
                var str = el.val();
                if(str.length>maxlength) el.val(str.substr(0,maxlength));
            },10);
        });
    };
    this.generateGUID = function() {
        var result, i, j;
        result = '';
        for(j=0; j<32; j++) {
            if( j == 8 || j == 12|| j == 16|| j == 20) { result = result + '-'; }
            i = Math.floor(Math.random()*16).toString(16).toUpperCase();
            result = result + i;
        }
        return result;
    };
    this.objectExists = function(objectName) {
        try {
            var re = /^[a-zA-Z_\x7f-\xff][a-zA-Z_\x7f-\xff]*$/;
            if(objectName.match(re)) {
                var c = eval(objectName);
                return (c instanceof Object) ? true : false;
            }
            return false;
        }
        catch(error) { return false; }
    };
    this.getHashParams = function () {
        var hashParams = {};
        var hash = window.location.hash.substr(1);
        var paramPairs = hash.split('&');
        if(paramPairs.length>0) {
            for(var k in paramPairs) {
                if(paramPairs[k] && paramPairs[k].indexOf('=')!=-1) {
                    var parts = paramPairs[k].split('=');
                    hashParams[decodeURIComponent(parts[0])] = decodeURIComponent(parts[1]).replace(/\+/g,' ');
                }
            }
        }
        return hashParams;
    };
    
    this.getQueryParams = function () {
        var queryParams = {};
        var query = window.location.search.substr(1);
        var paramPairs = query.split('&');
        if(paramPairs.length>0) {
            for(var k in paramPairs) {
                if(paramPairs[k] && paramPairs[k].indexOf('=')!=-1) {
                    var parts = paramPairs[k].split('=');
                    queryParams[decodeURIComponent(parts[0])] = decodeURIComponent(parts[1]).replace(/\+/g, ' ');
                }
            }
        }
        return queryParams;
    };

    this.openWindow = function(url, name, options, successCallback) {
        if(typeof successCallback!='function') { successCallback = function() {}; }
        var win = window.open(url, name, options);
        win.focus();
        if (typeof win == 'object') {
            win.focus();
            var interval = setInterval(function(){
                if (!win || win.closed) {
                    clearInterval(interval);
                    successCallback();
                }
            }, 500);
        }
    };


    function _tokenizeUrl(targetUrl) {
        targetUrl+=(targetUrl.indexOf('?')!=-1)?'&':'?';
        targetUrl+='_zt='+_zt;
        return targetUrl;
    }
    
}

var ZFramework = new ZoolooFramework();// zooloo container superclass
function ZoolooContainer() {
	var _tabName = '';
	var _tabProperties = {};
	var _tabDeletable = false;
	this.actions = {ADD_ELEMENT:'add element'};
	this.setTabName = function(tabName) { _tabName = tabName; };
	this.getTabName = function() { return (typeof _tabProperties === 'object' && _tabProperties.page_name) ? _tabProperties.page_name : ''; };
	this.getTabId = function() { return (typeof _tabProperties === 'object' && _tabProperties.page_id) ? _tabProperties.page_id : ''; };
	this.setTabProperties = function(tabProperties) { if(typeof tabProperties === 'object') { _tabProperties=tabProperties; } };
	this.getTabProperties = function() { return _tabProperties; };
	this.nameTab = function(tabContainer) {};
	this.processTab = function(tabId,tab,temp) {};
	this.renameTab = function(tabId,tabName,successCallback,failureCallback) {};
	this.addTab = function() {};
	this.moveTab = function(tabId,posConf,successCallback,failureCallback) {};
	this.addElement = function(tabId,typeId,elementId,elConf,parentId,posConf,iSuccessCallback,failureCallback) {};
	this.updateElement = function(elementId,elConf,iSuccessCallback,failureCallback) {};
	this.moveElement = function(tabId,elementId,newParentId,posConf,iSuccessCallback,failureCallback) {};
	this.removeElement = function(elementId,iSuccessCallback,failureCallback) {};
	this.makeAcceptPageElements = function(selector) {};
	this.makeAcceptSiteLayoutElements = function(selector) {};
	this.makeSortable = function(selector,fromOtherSelector) {};
	this.setSiteStyle = function(styleElementId,styleConf) {};
	this.setupElementContainer = function(elementId,elementClass) {};
	this.updateElementContainerTitle = function(elementId,title) {};
	this.isValidTabName = function(tabName) { return (!tabName.match(/\S+/) || !tabName.match(/^[^_\\\\<>][^\\\\<>]*$/)) ? 0 : 1; };
	this.setTabDeletable = function(deletable) { if(typeof deletable==='boolean') _tabDeletable = deletable; };
	this.isTabDeletable = function() { return _tabDeletable; };

	// for blocking certain actions while performing a specific action
	var _blockedActions = [];
	this.blockActions = function(actions) {
		_blockedActions = $.makeArray(actions);
	};
	this.clearBlockedActions = function() { _blockedActions = []; };
	this.isActionBlocked = function(action) {
		return ($.inArray(action,_blockedActions)>=0) ? 1 : 0;
	};

	// elements setup
	var _elementSetupConfs = {};	// by id
	var _elementByClassSetupConfs = {};	// by class

	this.init = function() { };
    this.getElementSetupConf = function(elementId) {
    	// get basic conf
      	var conf = _elementSetupConfs[elementId];
    	// get additional conf
    	if(conf) { conf.elConf = conf.elClass.getConf(elementId); }
    	return conf;
    };
    this.getByClassElementSetupConf = function(element) {
    	var conf;
    	var elementId = element.attr('id');
    	for(var cl in _elementByClassSetupConfs) {
	    	if(element && element.hasClass(cl)) {
	    		conf = _elementByClassSetupConfs[cl];
	    		if(conf && elementId) {
	    			conf.elConf = conf.elClass.getConf(elementId);
	    			return conf;
	    		}
	    	}
	    }
    	return conf;
    };
    // element templates
    var _elementTemplates = {};
	this.setElementTemplate = function(elementId,template) { _elementTemplates[elementId] = template; };
	this.hasElementTemplate = function(elementId,setupConf) {
		// some elements always need template
		var template = _elementTemplates[elementId];
		return (!template || typeof template != 'string' || template==='') ? 0 : 1;
	};
	this.createElement = function(elementId,elementGUID) {
		var el;
		var template = _elementTemplates[elementId];
		if(template && typeof template == 'string') { el = $(template.replace(/__ELEMENTID__/g,elementGUID)); }
		return el;
	};
}
function ZoolooElement() {
	this.setup = function(elementId,elementConf,elementAltId) {};
	this.minimize = function(elementId) {};
	this.maximize = function(elementId) {};
	this.popout = function(elementId) {};
	this.refresh = function(elementId,elementAltId) {};
	this.toggleOptions = function(elementId) {};
	this.remove = function(elementId) {};
	this.getConf = function(elementId) {return {};};
}var ZMsg = {
	// global
	DEFAULT_MESSAGE:'Sorry, an error has occurred, please try again',
	DEFAULT_CONFIRM_BOX_TITLE:'Please Confirm',
	INVALID_EMAIL:'We cannot find that e-mail address in our records',
	INVALID_PASSWORD:'The password you\'ve entered is incorrect',
	SESSION_EXPIRED:'Your ZooLoo session has expired',
	UPDATE_STATUS_FAIL:'Failed to update status.',
	INVALID_STATUS_BLANK:'Please specify your status message (cannot be blank)',
	INVALID_SERVICE_NONE:'Please select a network below',
	TIMESTAMP_JUST_NOW:'just now',

	// containers
	UNCONFIGURED_ELEMENT:'Error, please try again',
	ADD_ELEMENT_FAIL:'Error: {{reason}}, please try again',
	MOVE_ELEMENT_FAIL:'There was a problem moving the {{element}}, retry? Click OK to retry or Cancel to reload the page',
	CHANGE_STYLE_FAIL:'Unable to change style, please try again',
	CHANGE_THEME_FAIL:'Unable to change theme, please try again',
	REMOVE_ELEMENT_CONFIRM:'Are you sure you want to delete this widget?',
	EDIT_CONTENT_FAIL:'{{reason}}',
	ADD_MEDIA_FAIL:'Unable to add {{type}}',
	INVALID_EDITOR_CONTENT_ELEMENT:'Invalid content element, only photos and videos can be dropped in here',
	ADD_MEDIA_WRONG_MODE:'Adding media does not work in HTML view, please switch to non-HTML view and try again.',

	// zdashboard
	ZDASHBOARD_INVALID_TABNAME:'Please name your tab (cannot contain \\ or > or < or start with _)',
	ZDASHBOARD_ADD_TAB_FAIL:'Unable to create tab, please try again',
	ZDASHBOARD_REMOVE_TAB_CONFIRM:'Are you sure you want to delete the "<b>{{tabName}}</b>" tab and all of its content?',
	ZDASHBOARD_REMOVE_TAB_FAIL:'Unable to remove tab, please try again',
	ZDASHBOARD_RENAME_TAB_FAIL:'Unable to rename tab, please try again',
	ZDASHBOARD_MAX_WIDGET:'Sorry, you have reached the maximum number of widgets for this page',
	
	// home page
	ZDASHBOARD_HOME_INVITE_INVALID_EMAIL:'Please provide a valid e-mail to invite a friend.',
	ZDASHBOARD_HOME_INVITE_FAIL:'Error sending invite.',
	ZDASHBOARD_HOME_INVITE_SUCCESS:'Invite sent successfully',
	ZDASHBOARD_HOME_PHOTO_UPLOAD_SELECT_ALBUM:'Please choose a photo album to upload to.',
	ZDASHBOARD_HOME_PHOTO_UPLOAD_UNSPECIFIED_FILE:'Please specify file to upload',
	ZDASHBOARD_HOME_PHOTO_UPLOAD_FAIL:'There was a problem uploading your photo',
	ZDASHBOARD_HOME_UPDATE_STATUS_MSG_TOO_LONG_TITLE:'Status message too long',
	ZDASHBOARD_HOME_UPDATE_STATUS_MSG_TOO_LONG_SERVICE_LIMIT:'{{serviceName}} : maximum of {{serviceLimit}} characters<br/>',
	ZDASHBOARD_HOME_UPDATE_STATUS_MSG_TOO_LONG:'<p>Your status message is too long ({{msgLength}} characters) for the following services. If you continue, it will be shortened by the services. Do you want to continue with the status update?</p>{{message}}',
	ZDASHBOARD_HOME_UPDATE_STATUS_FAILED_SERVICES:'Unable to update your status on : {{services}}. Make sure you have authorized ZooLoo to update your status by clicking their logo under zSocial.',
	ZDASHBOARD_HOME_UNSAVED_SHARE_POST:'You have not posted your message changes, all changes will be lost if you continue.',
	ZDASHBOARD_HOME_FOLLOW_SITE_SUCCESS:'You are now following the site',
	ZDASHBOARD_HOME_MUST_SELECT_ZOOLOO:'ZooLoo must be selected for this type of post',
	ZDASHBOARD_HOME_MUST_SELECT_SERVICE:'Please select a service to post to.',
	ZDASHBOARD_HOME_SHARE_POST_SUCCESS:'Posted successfully',
	ZDASHBOARD_HOME_SHARE_POST_FAIL:'Sorry, unable to post now.',
	ZDASHBOARD_HOME_SERVICE_STATUS_NOT_AVAILABLE:'{{serviceName}} connection is offline',
	ZDASHBOARD_HOME_REQUIRED_SHARED_INPUTS:'Please specify that all necessary fields are filled out for your post.',
	ZDASHBOARD_HOME_INVALID_SHARE_VIDEO_URL:'Invalid share video url. Please share as a link instead.',

	// zcreator
	ZCREATOR_ADD_PAGE:'Add Page',
	ZCREATOR_ADD_PAGE_FAIL:'Unable to create new page',
	ZCREATOR_ADD_PAGE_FROM_TEMPLATE:'Add page from preset',
	ZCREATOR_EDIT_PAGE_PROP:'Page Info',
	ZCREATOR_EDIT_PAGE_PROP_FAIL:'Unable to update page',
	ZCREATOR_COPY_PAGE:'Copy Page',
	ZCREATOR_CREATE_TEMPLATE_FAIL:'Unable to create template, please try again',
	ZCREATOR_CREATE_PAGE_FROM_TEMPLATE_FAIL:'Unable to create a new page, please try again',
	ZCREATOR_COPY_PAGE_FAIL:'Unable to copy page, please try again',
	ZCREATOR_SWITCH_LAYOUT_FAIL:'Unable to switch layout, please try again',
	ZCREATOR_SWITCH_SITE_LAYOUT_FAIL:'Unable to switch site layout, please try again',
	ZCREATOR_INVALID_PAGENAME:'Please name your page (cannot contain \\ or > or < or start with _)',
	ZCREATOR_REMOVE_PAGE_CONFIRM:'Are you sure you want to delete the "<b>{{pageName}}</b>" page and all of its content from your site?',
	ZCREATOR_REMOVE_PAGE_FAIL:'Unable to remove page, please try again',
	ZCREATOR_RENAME_PAGE_FAIL:'Unable to rename page',
	ZCREATOR_DEFAULT_SUBMENU_NAME:'Submenu',
	ZCREATOR_SITE_MENU_SAVE_FAIL:'There was an error saving the menu, please try again',
	ZCREATOR_UNSAVED_SITE_MENU:'You have not saved your changes, all changes will be lost if you continue',
	ZCREATOR_SITE_MENU_MAX_LEVEL_REACHED:'Sorry, menu can be nested up to {{level}} level(s) only',
	ZCREATOR_SITE_LAYOUT_CANNOT_ADD_ELEMENT:'Sorry, this element cannot be added here',
	ZCREATOR_ACCESS:'Access Changed',
	ZCREATOR_ALL_PAGE_ALERT: 'You cannot change the permissions of this page because you have set permissions for all pages. Would you like to go to Privacy Manager to change these settings?',
	// submenu
	ZCREATOR_INVALID_SUBMENUNAME:'Please name your sub menu (cannot contain \\ or > or <)',
	// theme
	ZCREATOR_ADD_THEME:'Create New Theme',
	ZCREATOR_ADD_THEME_FAIL:'Unable to create new theme, please try again',
	ZCREATOR_ADD_DEFAULT_THEME_FAIL:'Unable to create default theme, please try again',
	ZCREATOR_RENAME_THEME:'Rename Theme',
	ZCREATOR_RENAME_THEME_FAIL:'Unable to rename theme, please try again',
	ZCREATOR_INVALID_THEMENAME:'Please name your theme (cannot contain \\ or > or <)',
	ZCREATOR_SAVE_THEME_AS:'Save Theme As',
	ZCREATOR_SAVE_THEME_FAIL:'There was an error saving the theme, please try again',
	ZCREATOR_UNSAVED_SITE_THEME:'You have not saved your changes, all changes will be lost if you continue',
	ZCREATOR_DELETE_THEME_CONFIRM:'Are you sure you want to delete this theme?',
	ZCREATOR_DELETE_ACTIVE_THEME:'This theme is currently used by your site, please apply a different theme to your site before deleting this theme',
	ZCREATOR_DELETE_THEME_FAIL:'There was an error deleting the theme, please try again',
	ZCREATOR_REVERT_THEME_CONFIRM:'Are you sure you want to revert this theme to its last saved state? Unsaved changes will be lost',
	ZCREATOR_RESET_THEME_CONFIRM:'Are you sure you want to reset this theme to its default state?',
	ZCREATOR_RESET_THEME_FAIL:'Unable to reset theme, please try again',
	ZCREATOR_APPLY_THEME_TO_SITE_SUCCESS:'Theme successfully applied to site',
	ZCREATOR_APPLY_THEME_UNSAVED_CONFIRM:'Your changes will be saved and applied to your site',
	ZCREATOR_APPLY_DEFAULT_THEME_UNSAVED:'You made changes to a default theme. This theme cannot be applied to your site unless you save it first. Please click \'Save As\' to save it, then apply the theme to your site.',
	ZCREATOR_UNSAVED_THEME_PREVIEW:'You have not saved your changes, please save your changes before preview.',
	ZCREATOR_UNAPPLIED_THEME:'You have not applied this theme to your site, the theme will not be applied if you continue. Click \'Apply to My Site\' to apply the theme to your site.',

	// zusercontent
	ZUSERCONTENT_SAVE_FAIL:'Unable to save content, please try again',

	//zfacebook
	ZFACEBOOK_GET_ALBUM_PHOTOS_ERROR: 'The album you have requested is currently unavailable or you do not have access to it.',
	ZFACEBOOK_ACCESS_PERMISSION_ERROR:'Please grant ZooLoo access to publish to your Facebook news feed.',
	ZFACEBOOK_COMMENT_EMPTY_ERROR: 'Facebook comment cannot be empty',
	
	// ztwitter
	ZTWITTER_WHAT_ARE_YOU_DOING:'What are you doing?',
	ZTWITTER_WHAT_ARE_YOU_DOING_NOW:'What are you doing now?',
	ZTWITTER_LATEST_STATUS:'Latest: {{status}} a moment ago',
	ZTWITTER_INIT_ERROR: 'Failed to initiate Twitter',
	ZTWITTER_SAVE_CREDENTIAL_ERROR: 'Failed to save Twitter credentials',
	ZTWITTER_GET_STATUS_ERROR: 'Failed to get user most recent status',
	ZTWITTER_POST_STATUS_SUCCESS: 'You have successfully posted a new tweet',
	ZTWITTER_SET_STATUS_ERROR: 'Failed to set user Twitter status',
	ZTWITTER_SET_STATUS_EMPTY: 'Twitter status cannot be null',
	ZTWITTER_GET_UPDATES_ERROR: 'Failed to get friends status updates',
	ZTWITTER_DELETE_STATUS_ERROR: 'Cannot delete this status',
	ZTWITTER_DELETE_STATUS_SUCCESS: 'You have successfully deleted the tweet',
	ZTWITTER_FAV_STATUS_ERROR: 'Cannot favorite the tweet',
	ZTWITTER_FAV_STATUS_SUCCESS: 'You have succesfully added this tweet to favorites',
	ZTWITTER_UNFAV_STATUS_ERROR: 'Cannot un-favorite the tweet',
	ZTWITTER_UNFAV_STATUS_SUCCESS: 'You have successfully removed this tweet from favorites',
	ZTWITTER_REPLY_EMPTY: 'Reply cannot be null or spaces',
	ZTWITTER_SEND_MSG_ERROR: 'Cannot send Twitter message',
	ZTWITTER_SEND_MSG_SUCCESS: 'The message is sent',
	ZTWITTER_GET_OUTBOX_MSG_ERROR: 'Cannot get Twitter outbox messages',
	ZTWITTER_GET_INBOX_MSG_ERROR: 'Cannot get Twitter inbox messages',
	ZTWITTER_GET_FOLLOWERS_ERROR: 'Cannot get my followers',
	ZTWITTER_DELETE_MSG_ERROR: 'Cannot delete this message',
	ZTWITTER_DELETE_MSG_SUCCESS: 'The message is deleted',
	ZTWITTER_SEND_MSG_ERROR: 'Cannot send Twitter message',
	ZTWITTER_MSG_EMPTY: 'Direct message cannot be null or spaces',
	ZTWITTER_RECIPIENT_EMPTY: 'Recipient cannot be empty',
	ZTWITTER_MENTIONS_ERROR: 'Cannot get Twitter status mentions',
	ZTWITTER_GET_FAV_ERROR: 'Cannot get Twitter favorites',
	ZTWITTER_GET_TRENDS_ERROR: 'Cannot get Twitter current trends',
	ZTWITTER_SEARCH_ERROR: 'Cannot get Twitter search results',
	ZTWITTER_UPDATE_ZSTATUS_FAIL: 'Cannot update Zooloo status',	
	ZTWITTER_USERNAME_NULL: 'Please enter your username',
	ZTWITTER_PASSWORD_NULL: 'Please enter your password',
	ZTWITTER_GET_TIMELINE_ERROR: 'Failed to get user public timeline',
	ZTWITTER_TIMELINE_PROTECTED: 'User tweets are currently protected',
	ZTWITTER_CREATE_FRIENDSHIP_ERROR: 'Error in creating twitter friendship',
	ZTWITTER_ADD_MEMBER_TO_LIST_SUCCESS: 'You have successfully added member to list',
	ZTWITTER_LIST_NAME_EMPTY: 'A list\'s name cannot be blank',
	ZTWITTER_LIST_NAME_INVALID: 'A list\'s name must start with a letter and consist only of 80 or fewer letters, numbers, \'-\', or \'_\' characters.',
	ZTWITTER_CREATE_LIST_SUCCESS: 'You have successfully created a new list',
	ZTWITTER_CREATE_LIST_ERROR: 'Failed to create a new list',
	ZTWITTER_RETWEET_SUCCESS: 'You have successfully retweeted the status',
	ZTWITTER_RETWEET_ERROR: 'Cannot retweet the status',
	ZTWITTER_LIST_DESCRIPTION_INVALID: 'A list\'s description can not be more than 100 characters',
	
	// zfeeds
	ZFEEDS_CANT_REMOVE_WIDGET: 'Cannot Remove Widget',
	ZFEEDS_REFRESHING_FEEDS:   'Updating Feeds',
	ZFEEDS_UNABLE_TO_RETRIEVE: 'Unable to Load Feeds',
	ZFEEDS_FEEDS:              'Feeds',
	ZFEEDS_CANT_GET_CONFIG:    'Unable to Load',
	ZFEEDS_FAILED_CONFIG_SAVE: 'Unable to Save',
	ZFEEDS_FAILED_CUSTOM_FEED: 'Unable to add custom feed: {{reason}}',
	ZFEEDS_CUSTOM_SERVER_ERR:  'Unable to Add Feed',

	//zphoto
	ZPHOTO_ALBUM_NAME_LENGTH: 'Album name is too long (25 characters max)',
	ZPHOTO_ALBUM_DESC_LENGTH: 'Album description is too long (200 characters max)',
	ZPHOTO_ALBUM_PLACE_LENGTH: 'Place is too long (30 characters max)',
	ZPHOTO_PHOTO_NAME_LENGTH: 'Photo name is too long (20 characters max)',
	ZPHOTO_PHOTO_KEYWORD_LENGTH: 'Photo keyword is too long (20 characters max)',
	ZPHOTO_ALBUM_NAME_NULL: 'Please name your album',
	ZPHOTO_ALBUM_NAME_DUPLICATE: 'Album name already exists',
	ZPHOTO_SUCCESS: 'Photo Uploaded',
	ZPHOTO_NAME_NULL: 'Please name your photo',
	ZPHOTO_CHOOSE_PROFILE: 'Please select a profile picture',
	ZPHOTO_REMOVE: 'Photo Deleted',
	ZPHOTO_REMOVE_CONFIRM: 'Are you sure you want to delete this photo?',
	/* note, ZPHOTO_MOVE and ZPHOTO_COPY are also used by video, so don't change them to "photo moved" or "photo copied"*/
	ZPHOTO_MOVE: 'Move Successful',
	ZPHOTO_COPY: 'Copy Successful',
	ZPHOTO_TAG: 'Photo Tagged',
	ZPHOTO_TAG_REMOVE: 'Tag Removed',
	ZPHOTO_PROFILE: 'Profile Set',
	ZPHOTO_COVER: 'Cover Set',
	ZPHOTO_COPY_NULL: 'Please select an album to copy',
	ZPHOTO_MOVE_NULL: 'Please select an album to move',
	ZPHOTO_OPERATION_NULL: 'Please select one radio box',
	ZPHOTO_COPY_BULK_NULL: 'Please select an album',
	ZPHOTO_UPDATE_ALBUM_DONE: 'Album Updated',
	ZPHOTO_UPDATE_INFO_DONE: 'Updated',
	ZPHOTO_UPDATE_ALBUM_CANCEL: 'Update Cancelled',
	ZPHOTO_REQUEST: 'Copy Successful',
	ZPHOTO_KEYWORD: 'Keyword Changed',
	ZPHOTO_SORT: 'Photos Sorted',
	ZPHOTO_COPY_NULL_PHOTO: 'Please select at least one photo',
	ZPHOTO_ALUBM_CREATE: 'Album Created',
	ZPHOTO_ALUBM_NAME_EXIST: 'Album name already exists',
	ZPHOTO_INPUT_KEYWORD: 'Click to Add Keywords',
	ZPHOTO_TAG_NULL_AREA: 'Please select a tag area',
	ZPHOTO_TAG_NULL_NAME: 'Please select a friend or add a name',
	ZPHOTO_TAG_START: 'Click on the image to start tagging',
	ZPHOTO_ALUBM_DELETE_CONFIRM: 'Delete this album?',
	ZPHOTO_ALUBM_DELETE_DONE: 'Album Deleted Successfully',
	ZPHOTO_CUSTOMIZE_ALERT: 'To set custom permissions you will need to go to Privacy Manager.  Would you like to go there now?',
	ZPHOTO_ALL_ALBUM_ALERT: 'You cannot change the permissions of this album because you have set permissions for all albums. Would you like to go to Privacy Manager to change these settings?',
	ZPHOTO_PROFILE_LIST_FAIL: 'Getting photo list for profile failed, please try again',
	ZPHOTO_LIST_FAIL: 'Getting photo list failed, please try again',
	ZPHOTO_DOWNLOAD_ALBUM_FAIL: 'Downloading failed, please try again',
	ZPHOTO_CROP_PROFILE_FAIL: 'Cropping profile photo failed, please try again',
	ZPHOTO_UPDATE_ALBUM_FAIL: 'Failed to update album, please try again',
	ZPHOTO_GET_PHOTO_FAIL: 'Getting photo failed, please try again',
	ZPHOTO_UPDATE_PHOTO_NAME_FAIL: 'Updating photo title failed, please try again',
	ZPHOTO_UPDATE_ALBUM_NAME_FAIL: 'Updating album title failed, please try again',
	ZPHOTO_SET_ALBUM_PERMISSION_FAIL: 'Failed to set album permission, please try again',
	ZPHOTO_SORT_PHOTO_FAIL: 'Sorting photos failed, please try again',
	ZPHOTO_DELETE_PHOTOS_FAIL: 'Deleting photo(s) failed, please try again',
	ZPHOTO_COPY_PHOTOS_FAIL: 'Copying photo(s) failed, please try again',
	ZPHOTO_MOVE_PHOTOS_FAIL: 'Moving photo(s) failed, please try again',
	ZPHOTO_UPDATE_PROFILE_FAIL: 'Updating profile photo failed, please try again',
	ZPHOTO_REMOVE_TAG_FAIL: 'Removing tagging failed, please try again',
	ZPHOTO_ADD_COMMENT_FAIL: 'Adding comment failed, please try again',
	ZPHOTO_DELETE_COMMENT_FAIL: 'Deleting comment failed, please try again',
	ZPHOTO_UPDATE_ALBUM_COVER_FAIL: 'Updating album cover failed, please try again',

	//zvideo
	ZVIDEO_ALBUM_NAME_LENGTH: 'Album name is too long (15 characters max)',
	ZVIDEO_VIDEO_KEYWORD_LENGTH: 'Video keyword is too long (20 characters max)',
	ZVIDEO_VIDEO_NAME_LENGTH: 'Video name is too long (20 characters max)',
	ZVIDEO_DESC_LENGTH: 'Video description is too long (100 characters max)',
	ZVIDEO_ALBUM_NAME_NULL: 'Please name your album',
	ZVIDEO_NAME_NULL: 'Please name your video',
	ZVIDEO_REMOVE: 'Video Deleted',
	ZVIDEO_REMOVE_CONFRIM: 'Are you sure you want to delete this video?',
	ZVIDEO_ALBUM_SOURCE_NULL: 'Cannot find external source, please try again',
	ZVIDEO_COPY_NULL_VIDEO: 'Please select at least one video',
	ZVIDEO_ADD_VIDEO_FAIL: 'Adding video link failed, please try again',
	ZVIDEO_GET_VIDEO_FAIL: 'Getting video failed, please try again',
	ZVIDEO_UPDATE_VIDEO_TITLE_FAIL: 'Updating video title failed, please try again',
	ZVIDEO_SORT_VIDEO_FAIL: 'Sorting videos failed, please try again',
	ZVIDEO_DELETE_VIDEOS_FAIL: 'Deleting video(s) failed, please try again',
	ZVIDEO_COPY_VIDEOS_FAIL: 'Copying video(s) failed, please try again',
	ZVIDEO_MOVE_VIDEOS_FAIL: 'Moving video(s) failed, please try again',
	ZVIDEO_SORT: 'Videos Sorted',
	ZVIDEO_ADD_VIDEO_SUCCESS: 'Your video has been successfully added',

	//zfriendmanager
	ZFRIEND_MANAGER_GROUP_IN_ALLALBUM: 'This group is in All Albums access, please remove this group from All Albums first',
	ZFRIEND_MANAGER_FRIEND_IN_ALLALBUM: 'This friend is in All Albums access, please remove this friend from All Albums first',
	ZFRIEND_MANAGER_GROUP_IN_ALLPAGE: 'This group is in All Pages access, please remove this group from All Pages first',
	ZFRIEND_MANAGER_FRIEND_IN_ALLPAGE: 'This friend is in All Pages access, please remove this friend from All Pages first',
	ZFRIEND_MANAGER_DELETE_FRIEND_1: 'Are you sure you want to delete ',
	ZFRIEND_MANAGER_DELETE_FRIEND_2: ' will not be notified',
	ZFRIEND_MANAGER_DELETE_GROUP: 'Are you sure you want to delete this group?',
	ZFRIEND_MANAGER_GROUP_NAME_LENGTH: 'Group name is too long (12 characters max)',
	ZFRIEND_MANAGER_GROUP_NAME_NULL: 'Please name your group',
	ZFRIEND_MANAGER_GROUP_NAME_EXIST: 'This group already exists',
	ZFRIEND_MANAGER_PUBLIC_WARNING: 'Make this public? By doing so, this content will be accessible to anyone online and available in search engines. As a result, you may not be able to make this content completely private in the future.',
	ZFRIEND_MANAGER_SET_ORDER_FAIL: 'Cannot Set Order',
	ZFRIEND_MANAGER_ALLOW_COPY_FAIL: 'Cannot Allow Copy Photo',
	ZFRIEND_MANAGER_DISABLE_COPY_FAIL: 'Cannot Disable Copy Photo',
	ZFRIEND_MANAGER_GET_PERMISSION_FAIL: 'Getting friend permission failed, please try again',
	ZFRIEND_MANAGER_ADD_TO_ALBUM_FAIL: 'Adding friend to album failed, please try again',
	ZFRIEND_MANAGER_ADD_GROUP_TO_ALBUM_FAIL: 'Adding group to album failed, please try again',
	ZFRIEND_MANAGER_ADD_FRIEND_TO_GROUP_FAIL: 'Adding friend to group failed, please try again',
	ZFRIEND_MANAGER_ADD_FRIEND_TO_PAGE_FAIL: 'Adding friend to page failed, please try again',
	ZFRIEND_MANAGER_ADD_GROUP_TO_PAGE_FAIL: 'Adding group to page failed, please try again',
	ZFRIEND_MANAGER_EDIT_GROUP_FAIL: 'Editing group failed, please try again',
	ZFRIEND_MANAGER_ADD_GROUP_FAIL: 'Adding group failed, please try again',
	ZFRIEND_MANAGER_REMOVE_GROUP_FAIL: 'Removing group failed, please try again',
	ZFRIEND_MANAGER_DUPLICATE_PERSON: 'This person is already in [',
	ZFRIEND_MANAGER_DUPLICATE_GROUP: 'This group is already in [',
	ZFRIEND_MANAGER_IN_DUPLICATE_GROUP: ' is already in this group',

	//zconnect
	ZCONNECT_ACCEPT_FRIEND_SUCCESS: 'Friend added',
	ZCONNECT_IGNORE_FRIEND_SUCCESS: 'Friend Ignored',

	//zprofile
	ZPROFILE_UPDATE_FAIL: 'Update Failed',
	ZPROFILE_UPDATE_SUCCESS: 'Updated',
	ZPROFILE_DELETE: 'Delete?',
	ZPROFILE_SCHOOL_NULL: 'School name can not be null',
	ZPROFILE_COMPANY_NULL: 'Company name can not be null',

	//zphotoviewer
	ZPHOTO_VIEWER_COMMENT_LENGTH: 'Comment is too long (250 characters max)',
	ZPHOTO_VIEWER_COMMENT_NULL: 'Please add a comment',
	ZPHOTO_VIEWER_REQUST_PHOTO_LOGIN: 'You have to login to save friends\' photos',
	ZPHOTO_VIEWER_COMMENT_LOGIN: 'Please login to add comments',
	ZPHOTO_VIEWER_REQUEST_PHOTO_FAIL: 'Requesting photo failed, please try again',

	//zvideoviewer
	ZVIDEO_VIEWER_COMMENT_LENGTH: 'Comment is too long (250 characters max)',
	ZVIDEO_VIEWER_COMMENT_NULL: 'Please add a comment',
	ZVIDEO_VIEWER_REQUST_VIDEO_LOGIN: 'You have to login to save friends\' videos',
	ZVIDEO_VIEWER_COMMENT_DELETE: 'Comment Deleted',
	ZVIDEO_VIEWER_REQUEST_VIDEO_FAIL: 'Requesting video failed, please try again',

	//zemailpreview
	ZEMAIL_PREVIEW_SET_ACCOUNT_FAIL: 'Unable to enable account',
	ZEMAIL_PREVIEW_SET_UNREAD_FAIL: 'Unable to set unread email number',
	ZEMAIL_PREVIEW_SET_REFRESH_FAIL: 'Unable to set auto refresh time',
	ZEMAIL_PREVIEW_PASSWORD_NULL: 'Please enter your password',
	ZEMAIL_PREVIEW_ACCOUNT_NULL: 'Please enter your account',
	ZEMAIL_PREVIEW_ADD_FAIL: 'Unable to add account; this account has already been added',
	ZEMAIL_PREVIEW_SLOW_ALERT: 'Network is slow, please try again',
	ZEMAIL_PREVIEW_GET_EMAIL_LIST_ALERT: 'Getting email list failed, please try again',
	ZEMAIL_PREVIEW_GET_EMAIL_CONTENT_ALERT: 'Getting email content failed, please try again',
	ZEMAIL_PREVIEW_ADD_EMAIL_ACCOUNT_ALERT: 'Adding email account failed, please try again',
	ZEMAIL_PREVIEW_CHANGE_EMAIL_ACCOUNT_ALERT: 'Changing email account failed, please try again',
	ZEMAIL_PREVIEW_DELETE_EMAIL_ACCOUNT_ALERT: 'Deleting email account failed, please try again',

	//zphotoframe
	ZPHOTOFRAME_NO_PHOTO: 'You have no photos in your photo frame, open options to add photos',

	//zphotoslideshow
	ZPHOTOSLIDESHOW_TITLE: 'Photo Slideshow',
	ZPHOTOSLIDESHOW_NO_PHOTO: 'You have no photos in your slideshow, open options to add photos',
	ZPHOTOSLIDESHOW_GET_OPTION_FAIL: 'Getting option failed, please try again',
	ZPHOTOSLIDESHOW_GET_PHOTO_LIST_FAIL: 'Getting photo list failed, please try again',
	ZPHOTOSLIDESHOW_SET_DELAY_FAIL: 'Setting delay time failed, please try again',
	ZPHOTOSLIDESHOW_GET_DELAY_FAIL: 'Getting delay time failed, please try again',
	ZPHOTOSLIDESHOW_GET_PHOTO_FAIL: 'Getting photo failed, please try again',
	ZPHOTOSLIDESHOW_SET_PHOTO_FAIL: 'Setting photo failed, please try again',
	ZPHOTOSLIDESHOW_ADD_ALBUM_FAIL: 'Adding album to slideshow list failed, please try again',
	ZPHOTOSLIDESHOW_DELETE_PHOTO_FAIL: 'Deleting photo from slideshow list failed, please try again',

	//zweather
	ZWEATHER_ZIP_ERROR: 'The zip code or city name cannot be found',
	ZWEATHER_CITY_EXIST: 'This city has already been added',
	ZWEATHER_CITY_NULL: 'Please enter a location',
	ZWEATHER_ADD_CITY_FAIL: 'Unable to add locations',
	ZWEATHER_REMOVE_CITY_FAIL: 'Unable to remove locations',
	ZWEATHER_SET_DEGREE_FAIL: 'Unable to set degree type',

	//zvideoframe
	ZVIDEOFRAME_ALBUM_NULL: 'Please select the album you want to save to',
	ZVIDEOFRAME_TITLE_NULL: 'Please input the title',
	ZVIDEOFRAME_ALBUM_TITLE_NULL: 'Please add the title of album',
	ZVIDEOFRAME_GET_VIDEO_LIST_FAIL: 'Getting video list failed, please try again',
	ZVIDEOFRAME_GET_VIDEO_LINK_FAIL: 'Getting video link failed, please try again',
	ZVIDEOFRAME_SAVE_VIDEO_FAIL: 'Saving video failed, please try again',
	ZVIDEOFRAME_ADD_ALBUM_FAIL: 'Adding album failed, please try again',

	//zwebvideo
	ZWEBVIDEO_GET_OPTION_FAIL: 'Error',
	ZWEBVIDEO_GET_SAVE_VIDEO_FAIL: 'Unable to save video',
	ZWEBVIDEO_GET_ADD_ALBUM_FAIL: 'Unable to add album',

	//zentertainment
	ZENTERTAINMENT_ZIP_NULL: 'Please enter a zip code',
	ZENTERTAINMENT_EVENT_NULL: 'Please enter any US/Canada zip code',
	ZENTERTAINMENT_EVENT_FORMAT: 'Please enter a valid US/Canada zip code in the format of "85255"or "A2G6T5"',
	ZENTERTAINMENT_GET_VIDEO_FAIL: 'Getting video list failed, please try again',
	ZENTERTAINMENT_GET_GAME_FAIL: 'Getting game failed, please try again',
	ZENTERTAINMENT_GET_MY_VIDEO_LINK_FAIL: 'Getting my video link failed, please try again',
	ZENTERTAINMENT_GET_MUSIC_FAIL: 'Getting music list failed, please try again',
	ZENTERTAINMENT_GET_BIG_SCREEN_FAIL: 'Getting big screen list failed, please try again',
	ZENTERTAINMENT_GET_GOSSIP_FAIL: 'Getting gossip list failed, please try again',
	ZENTERTAINMENT_GET_MOVIE_FAIL: 'Getting movie information failed, please try again',
	ZENTERTAINMENT_GET_EVENT_FAIL: 'Getting local events failed, please try again',

	//zshopping
	ZSHOPPING_CLOSE_CONFIRM: 'Close without saving?',
	ZSHOPPING_GET_OPTION_FAIL: 'Getting option failed, please try again',
	ZSHOPPING_UPDATE_MALL_FAIL: 'Updating personal mall failed, please try again',

	//zpoll
	ZPOLL_SET_ERROR: 'Error',
	ZPOLL_QUESTION_NULL_ERROR: 'Please add a question',
	ZPOLL_VOTE_SELECT_ERROR: 'Please select an answer',
	ZPOLL_SET_ANSWER_ERROR: 'Please add at least two answers',
	ZPOLL_GET_RESULT_ERROR: 'Unable to get result',
	ZPOLL_VOTE_MORE_ERROR: 'You can only vote once, but nice try',
	ZPOLL_CREATE_ERROR: 'Unable to create poll',
	ZPOLL_ENABLE_ERROR: 'Unable to disable poll',
	ZPOLL_DISABLE_ERROR: 'Unable to enable poll',
	ZPOLL_DELETE_ERROR: 'Unable to delete poll',
	ZPOLL_CREATE_CONFIRM: 'Once you finish the poll design, it cannot be edited. Are you sure you want to continue?',
	ZPOLL_VOTE_ERROR: 'Unable to vote, please try again',
	ZPOLL_GET_RESULT_ERROR: 'Unable to get result, could you try it again',

	//zlife
	ZLIFE_REMINDER_DATE_EARLY: 'The date/time is in the past',
	ZLIFE_REMINDER_CREATE_SUCCESS: 'Reminder Created',
	ZLIFE_REMINDER_UPDATE_SUCCESS: 'Reminder Updated',
	ZLIFE_REMINDER_INPUT_EMPTY: 'Please add text',
	ZLIFE_REMINDER_TIME_EMPTY: 'Please select a reminder time',
	ZLIFE_REMINDER_ALERT_EMPTY: 'Please select a reminder alert',
	ZLIFE_REMINDER_DELETE_ERROR: 'Unable to delete reminder',
	ZLIFE_REMINDER_GET_ERROR: 'Unable to retrieve reminder',
	ZLIFE_REMINDER_UPDATE_ERROR: 'Unable to update reminder',
	ZLIFE_REMINDER_CREATE_ERROR: 'Unable to create reminder',
	ZLIFE_TODO_NAME_EMPTY: 'Please add a name',
	ZLIFE_EVENT_TYPE_NAME_EMPTY: 'Please specify your event type name',
	ZLIFE_EVENT_REPEAT_TIMES: 'Please enter valid repeat times',
	ZLIFE_EVENT_TYPE_CREATE_SUCCESS: 'Your event type has been created',
	ZLIFE_EVENT_TYPE_UPDATE_SUCCESS: 'Your event type has been updated',
	ZLIFE_EVENT_TYPE_DELETE_SUCCESS: 'Your event type has been deleted',
	ZLIFE_EVENT_NAME_EMPTY: 'Please name your event',
	ZLIFE_EVENT_NAME_LENGTH: 'Event name is too long (80 characters max)',
	ZLIFE_EVENT_DATE_EMPTY: 'Please add a date',
	ZLIFE_EVENT_GET_EVENT_ERROR: 'Unable to retrieve event',
	ZLIFE_EVENT_UPDATE_EVENT_ERROR: 'Unable to update event',
	ZLIFE_EVENT_ADD_EVENT_ERROR: 'Unable to add event',
	ZLIFE_EVENT_ADD_EVENT_TYPE_ERROR: 'Unable to add event type',
	ZLIFE_EVENT_DELETE_EVENT_TYPE_ERROR: 'Unable to delete event type',
	ZLIFE_EVENT_DELETE_EVENT_ERROR: 'Unable to delete event',
	ZLIFE_EVENT_CREATE_SUCCESS: 'Event Created',
	ZLIFE_CALENDAR_GET_ERROR: 'Unable to retrieve calendar',
	ZLIFE_INVITE_ROLODEX_EMAIL: 'The e-mail is not valid or does not exist',
	ZLIFE_INVITE_EMAIL: 'E-mail is invalid',
	ZLIFE_INVITE_NAME: 'Please add the guest name',
	ZLIFE_INVITE_DELETE: 'Are you sure want to delete this invite?',
	ZLIFE_INVITE_REQUIRE: 'Missing required fields',
	ZLIFE_INVITE_REQUIRE: 'Missing required fields',
	ZLIFE_INVITE_ADD_GUEST: 'Added to guest list',
	ZLIFE_INVITE_CREATE_SUCCESS: 'Invite Sent',
	ZLIFE_INVITE_UPDATE_SUCCESS: 'Invite Updated',
	ZLIFE_RECIPE_REMOVE: 'Remove Meal Planner from zLife? You can add it from recipe card widget at any time',
	ZLIFE_RECIPE_EMPTY: 'Please add a name for your recipe',
	ZLIFE_INVITE_REMOVE_GUEST_ERROR: 'Unable to remove guest',
	ZLIFE_EVENT_UPDATE_SUCCESS: 'Event Update Successful',
	ZLIFE_TIME_ERROR: 'Please input time format with colons, ex: 12:30',
	ZLIFE_IMPORT_ERROR: 'Problem uploading file, please try again later.',
	ZLIFE_RETRIEVING_ERROR: 'Error retrieving import popup.',
	ZLIFE_GET_POP_WINDOW_ERROR: 'Could not get import popup.',
	ZLIFE_ACCEPT_INVITE_SUCCRESS: 'Success',

	//zblog
	ZBLOG_CHANGE_ALBUM_FAILED: 'Failed to get album.',
	ZBLOG_ADD_MEDIA_ERROR: 'Unable to determine media type.',
	ZBLOG_USER_LEAVE_MESSAGE_CONFIRM: 'You\'re navigating away from the page, are you sure?',
	ZBLOG_USER_LEAVE_MESSAGE: 'If you do, unpublished blog content will be lost',
	ZBLOG_USER_LEAVE_MESSAGE2: 'If you do, unsaved blog content will be lost',
	ZBLOG_GET_CATEGORY_ERROR: 'Could not get categories.',
	ZBLOG_SERVER_ERROR: 'There was a ZooLoo server error',
	ZBLOG_REFERSH_SELECTOR_ERROR: 'Cannot Refresh Post Selector',
	ZBLOG_ADD_COMMENT_ERROR: 'Unable to add comment',
	ZBLOG_COMMENT_EMPTY: 'Comment is empty.  Please type in a comment.',
	ZBLOG_COMMENT_TOO_LONG: 'Comment is too long.  It must be less than 1000 characters.',
	ZBLOG_CATEGORY_DUPLICATE: 'The category is already existed',
	ZBLOG_CATEGORY_EMPTY: 'Please input the category name',
	ZBLOG_CATEGORY_HIDDEN_POST: 'The {{category}} category is hidden, so the new blog post can\'t be seen by others until you select "Show Category" in Blog Categories.',
	ZBLOG_MAIN_CATEGORY_DELETE:'The Main category cannot be deleted.',
	ZBLOG_DELETE_POST_ERROR: 'Could not delete this post.',
	ZBLOG_DELETE_COMMENT_ERROR: 'Could not delete this comment.',
	ZBLOG_DELETE_POST_CONFIRM: 'Do you really want to delete this post?',
	
	//setting, email
	ZSETTING_EMAIL_UPGRADE: 'Please upgrade your account',
	ZSETTING_EMAIL_ERROR: 'Please make sure the e-mail address is valid',
	ZSETTING_EMAIL_NONE: 'Please add your e-mail address',
	ZSETTING_EMAIL_DELETE: 'E-mail Deleted',
	ZSETTING_EMAIL_UPDATE: 'E-mail Saved',
	ZSETTING_EMAIL_DUPLICATE: 'Duplicate e-mail forward setting',
	ZSETTING_EMAIL_RESEND_CODE: 'Check your e-mail for the new validation code',
	ZSETTING_UPDATE_SUCCESS: 'Updated',
	ZSETTING_UPDATE_FAIL: 'Update failed',

	//zcalendar
	ZCALENDAR_FUTURE_EVENTS_FAIL: 'Cannot Get Future Events',
	ZCALENDAR_SELECT_DAY_EVENTS_FAIL: 'Cannot get events for selected day',
	ZCALENDAR_EVENT_CONTENT_EMPTY: 'Please enter event content',

	//zclock
	ZCLOCK_TIMEZONE_EMPTY: 'Please select time zone.',
	ZCLOCK_SKIN_EMPTY: 'Please select skin.',
	ZCLOCK_SETTING_UPDATE_FAIL: 'Clock setting update failed',

	//zcountdown
	ZCOUNTDOWN_SAVE_SETTING_FAIL :'Save countdown config failed',
	ZCOUNTDOWN_DATE_EMPTY:'Please select a date for the countdown event',

	//zcraigslist
	ZCRAIGSLIST_SAVE_SETTING_FAIL: 'Save Craigslist search config failed',
	ZCRAIGSLIST_SEARCH_KEYWORD_EMPTY: 'Please enter search keyword! example: desk, computer, etc ',
	ZCRAIGSLIST_SEARCH_ERROR: 'Cannot get craigslist search information!',

	//zcurrentcyconverter
	ZCURRENCYCONVERTER_GET_CURRENCY_ERROR: 'Cannot Get Currency',
	ZCURRENCYCONVERTER_SAVE_SETTING_FAIL: 'Save currency converter config failed',

	//zdictionary
	ZDICTIONARY_SEARCH_ERROR: 'Error in searching dictionary/thesaurus',
	ZDICTIONARY_WORD_EMPTY: 'The word you are looking for cannot be found',

	//zespnfeed
	ZESPNFEED_GET_LIST_FAIL: 'Cannot get ESPN feeds for selected category',
	ZESPNFEED_SAVE_SETTING_FAIL: 'Save ESPN Feed config failed',

	//zebay (ebay search)
	ZEBAY_SEARCH_KEYWORD_EMPTY: 'Please enter search keyword(s)',
	ZEBAY_SEARCH_ERROR: 'Cannot get eBay search information',
	ZEBAY_SAVE_SETTING_FAIL: 'Save eBay search config failed',

	//zmyebay
	ZMYEBAY_SAVE_SETTING_FAIL: 'Save my eBay config failed',
	ZMYEBAY_GET_SESSION_ERROR: 'Cannot Get eBay Session',
	ZMYEBAY_USERNAME_EMPTY: 'Your eBay username cannot be null',
	ZMYEBAY_GET_MYBUYING_ERROR :'Cannot get my eBay buying information',
	ZMYEBAY_ACCOUNT_INVALID: 'Cannot validate this eBay account',

	//zevents (local events search)
	ZEVENTS_ZIPCODE_EMPTY: 'Please enter any US/Canada zip code',
	ZEVENTS_ZIPCODE_INVALID: 'Please enter a valid US/Canada zip code in the format of "85255" or "A2G6T5"',
	ZEVENTS_GET_EVENTS_FAIL: 'Cannot Get Local Events',
	ZEVENTS_SAVE_SETTIGN_FAIL: 'Save local events config failed',

	//zfavoritemall
	ZFAVORITEMALL_SELECT_EMPTY: 'Please select at least 1 mall to add',
	ZFAVORITEMALL_GET_MALLS_ERROR: 'Cannot get user favorate mall list',
	ZFAVORITEMALL_GET_CATEGORY_MALLS_ERROR: 'Cannot get malls for selected category',
	ZFAVORITEMALL_MALL_FULL: 'You can have at most 9 malls in your list',
	ZFAVORITEMALL_MALL_DUPLICATE: 'Please do not add duplicate mall',
	ZFAVORITEMALL_MALL_ADD_ERROR: 'Cannot add malls to favorate list',
	ZFAVORITEMALL_MALL_DELETE_ERROR: 'Cannot delete mall from favorite list',

	//zflickr
	ZFLICKR_GET_PHOTOSETS_ERROR :'Cannot retrieve photo sets',
	ZFLICKR_GET_PHOTOSTREAM_ERROR: 'Cannot get photostream',
	ZFLICKR_GET_CONTACTLIST_ERROR: 'Cannot get contact list',
	ZFLICKR_TAG_EMPTY: 'Search tags cannot be empty',
	ZFLICKR_SEARCH_ERROR: 'Cannot search Flickr',
	ZFLICKR_GET_PHOTOS_ERROR: 'Cannot get photos in photoset',
	ZFLICKR_GET_COMMENTS_ERROR: 'Cannot get comments for this photo',
	ZFLICKR_COMMENT_EMPTY: 'Comment cannot be empty',
	ZFLICKR_POST_COMMENT_ERROR: 'Cannot post photo comment',
	ZFLICKR_AUTH_FAIL_MSG: 'Flickr service is unavailable right now or your token has expired. Please try later or authenticate Zooloo again.',

	//zgooglenews
	ZGOOGLENEWS_SAVE_SETTING_FAIL: 'Google news save config failed',

	//zlastfm
	ZLASTFM_GENRE_ARTIST_EMPTY :'Genre or artist name cannot be null',
	ZLASTFM_RADIO_SELECT_EMPTY: 'Please choose "Genre" or "Similar Artist"',
	ZLASTFM_USERNAME_ARTIST_EMPTY: 'Username or artist cannot be null',
	ZLASTFM_PLAYLSIT_SELECT_EMPTY: 'Please choose "User" or "Artist"',
	ZLASTFM_SAVE_SETTING_FAIL: 'Last.fm save config failed',

	//zmonster
	ZMONSTER_KEYWORD_EMPTY: 'Search keyword cannot be null',
	ZMONSTER_SEARCH_ERROR: 'Cannot get monster search information',
	ZMONSTER_SAVE_SETTING_FAIL: 'Save monster search config failed',

	//zmortagecalculator
	ZMORTGAGECAL_PRINCIPAL_EMPTY: 'Please enter the value for the Principal field',
	ZMORTGAGECAL_INTEREST_EMPTY: 'Please enter the value for the Interst field',
	ZMORTGAGECAL_YEARS_EMPTY: 'Please enter the value in Number of years field',
	ZMORTGAGECAL_NUM_INVALID: 'Invalid input: all fields must be non-negative numbers',

	//znotepad
	ZNOTEPAD_GET_CONTENT_ERROR: 'Cannot get default notepad content',
	ZNOTEPAD_UPDATE_COLOR_ERROR: 'Cannot update notepad tab color',
	ZNOTEPAD_TABNAME_EMPTY: 'Tab Name cannot be null',
	ZNOTEPAD_UPDATE_TABNAME_ERROR: 'Cannot update notepad tab name',
	ZNOTEPAD_UPDATE_CONTENT_ERROR: 'Cannot get content for selected tab',

	//zpackagetracking
	ZPACKAGETRACKING_SEARCH_ERROR: 'Cannot get package information',
	ZPACKAGETRACKING_NUMBER_EMPTY: 'Please enter a tracking number',
	ZPACKAGETRACKING_SAVE_SETTING_ERROR: 'Save package tracking config failed',

	//zrecipecard
	ZRECIPECARD_ACCEPT_RECIPE: 'You successfully accepted the recipe',
	ZRECIPECARD_ACCEPT_INVALID_RECIPE: 'Cannot Accept Recipe because the recipe has been removed by the sender', 
	ZRECIPECARD_GET_MEALPALNNER_VISIBILITY: 'Cannot get meal planner visibility',
	ZRECIPECARD_SET_MEALPALNNER_VISIBILITY: 'Cannot set visiblity for meal planner in zLife',
	ZRECIPECARD_GET_RECIPES: 'Cannot Get Recipes',
	ZRECIPECARD_MEAL_DATE_EMPTY: 'Please choose the meal date',
	ZRECIPECARD_ADD_TO_MEALPLANNER_ERROR: 'Cannot add recipe to meal planner',
	ZRECIPECARD_ADD_RECIPE_ERROR: 'Cannot Add Recipe',
	ZRECIPECARD_UPDATE_RECIPE_ERROR: 'Cannot Update Recipe',
	ZRECIPECARD_SEARCH_NAME_EMPTY: 'Please enter recipe name that will be searched',
	ZRECIPECARD_SEARCH_ERROR: 'Cannot Search Recipe',
	ZRECIPECARD_DELETE_RECIPE: 'Cannot Delete Recipe',
	ZRECIPECARD_SHARE_FRIENDS_EMPTY: 'You need to select at least one friend to share the recipe',
	ZRECIPECARD_SEND_RECIPE_ERROR: 'Cannot send recipe invitation to friends',

	//zrestaurants (opentable restaurant search)
	ZRESTAURANTS_ZIPCODE_INVALID:'Please enter a valid zip code in the format of "12345" or "12345-6789"',
	ZRESTAURANTS_SEARCH_BY_ZIPCODE_ERROR: 'Cannot get restaurants by zip code',
	ZRESTAURANTS_GET_LOCATIONS_ERROR: 'Cannot get locations for selected state',
	ZRESTAURANTS_SEARCH_BY_LOCATION_ERROR: 'Cannot get restaurants by location',
	ZRESTAURANTS_SEARCH_BY_STATE_ERROR: 'Cannot get restaurants by state',
	ZRESTAURANTS_STATE_EMPTY: 'Please select a state',

	//zrolodex
	ZROLODEX_GET_CONTACTS_ERROR: 'Cannot Get Contacts',
	ZROLODEX_NAME_EMPTY: 'Please enter a contact name',
	ZROLODEX_ADD_CONTACT_ERROR: 'Cannot Add Contact',
	ZROLODEX_UPDATE_CONTACT_ERROR: 'Cannot Update Contact',
	ZROLODEX_SEARCH_NAME_EMPTY: 'Please enter a contact name to find',
	ZROLODEX_SEARCH_ERROR: 'Cannot Search Contact',
	ZROLODEX_DELETE_ERROR: 'Cannot Delete Contact',
	ZROLODEX_SAVE_CONTACT_SUCCESS: 'Contact {{contact}} Saved!',
	ZROLODEX_UPDATE_CONTACT_SUCCESS: 'Contact {{contact}} Updated!',
	ZROLODEX_DELETE_CONTACT_SUCCESS: 'Contact {{contact}} Deleted!',
	
	//zstickynote
	ZSTICKYNOTE_ITEM_NAME_EMPTY: 'Please enter item content',
	ZSTICKYNOTE_GET_ITEMS_ERROR: 'Cannot get stickynote items',
	ZSTICKYNOTE_ADD_ITEM_ERROR: 'Cannot add item to stickynote list',
	ZSTICKYNOTE_DELETE_ITEM_ERROR: 'Cannot delete item from stickynote list',
	ZSTICKYNOTE_UPDATE_ITEM_ERROR: 'Cannot update item in stickynote list',

	//ztodaytopsearch (google hot trends)
	ZTODAYTOPSEARCH_GET_TRENDS: 'Cannot get Google Hot Trends',
	ZTODAYTOPSEARCH_SAVE_SETTING_FAIL: 'Save Google Hot Trends config failed',

	//ztranslate
	ZTRANSLATE_SOURCE_CONTENT_EMPTY: 'Please enter the content to be translated',
	ZTRANSLATE_TARGET_LANG_NULL: 'Please choose the target language',
	ZTRANSLATE_TRANSLATE_ERROR: 'Cannot Get Translation',
	ZTRANSLATE_BEGIN_TYPE_HERE: 'Begin Typing Here...',

	//zstockticker
	ZSTOCKTICKER_SAVE_SETTING_FAIL: 'Save stockticker config failed',
	ZSTOCKTICKER_FIELDS_EXCEED: 'The number of selected fields cannot exceed 5',
	ZSTOCKTICKER_GET_STOCKS_ERROR: 'Cannot get stocks information',
	ZSTOCKTICKER_SYMBOL_EMPTY: 'Please input the stock symbols, multiple stock symbols can be separated by comma or space',
	ZSTOCKTICKER_ADD_DUPLICATE: 'Cannot add a duplicate stock',
	ZSTOCKTICKER_ADD_ERROR: 'Cannot add stock',
	ZSTOCKTICKER_DELETE_ERROR: 'Cannot delete stock',
	
	//zpaypal
	ZPAYPAL_EMAIL_INVALID:'Enter a valid email address',
	ZPAYPAL_ITEM_NAME_NULL:'Enter a name for the item',
	ZPAYPAL_ITEM_PRICE_INVALID: 'Enter a valid price for the item',
	ZPAYPAL_GET_ITEM_ERROR: 'Cannot get Paypal item information',
	ZPAYPAL_SAVE_ITEM_ERROR: 'Cannot save Paypal item information',
	ZPAYPAL_ADD_PHOTO_ERROR: 'Cannot add a photo for the item',
		
	//zmyspace
	ZMYSPACE_AUTH_FAIL_MSG: 'MySpace service is unavailable right now or your token has expired. Please try later or authenticate Zooloo again.',

	//zlinkedin
	ZLINKEDIN_AUTH_FAIL_MSG: 'LinkedIn service is unavailable right now or your token has expired. Please try later or authenticate Zooloo again.',
	ZLINKEDIN_SEARCH_KEYWORD_EMPTY: 'Search keyword cannot be empty',
	ZLINKEDIN_STATUS_EMPTY: 'LinkedIn status cannot be empty',
	ZLINKEDIN_COMMENT_EMPTY: 'LinkedIn comment cannot be empty',
	ZLINKEDIN_COMMENT_EXCEEDS_LIMIT: 'Your have exceeded the maximum length of 140 characters for comments',
	ZLINKEDIN_MSG_EMPTY: 'LinkedIn message subject and body cannot be empty',
	ZLINKEDIN_SEND_MSG_SUCCESS: 'Message is sent',	
	ZLINKEDIN_INVITATION_EMPTY: 'All fields should be non-empty for Linkedin invitation',
	ZLINKEDIN_SEND_INVITATION_SUCCESS: 'Invitation is sent',	
	ZLINKEDIN_INVITATION_EXCEEDS_LIMIT: 'The invitation message has a 200 character limit',

	//zplaylist
	ZPLAYLIST_SAVE_SETTING_FAIL: 'Save playlist.com settings failed',
	ZPLAYLIST_SOURCE_EMPTY: 'The playlist source code cannot be empty',
	ZPLAYLIST_SOURCE_INVALID: 'The playlist source code your provided was not valid, please try again',
	
	//zgoogle voice
	ZGV_SAVE_SETTING_FAIL: 'Save google voice settings failed',
	ZGV_SAVE_SETTING_DONE: 'Saved',
	ZGV_SOURCE_EMPTY: 'The google voice widget embed code cannot be empty',
	ZGV_SOURCE_INVALID: 'The google voice widget embed code your provided was not valid, please try again',
	
	//zcontact us
	ZCONTACT_US_SAVE: 'Saved',
	ZCONTACT_EMAIL_ADDRESS_ERROR: 'Please enter a valid email address',
	ZCONTACT_SENT: 'Your message has been sent, thank you',
	ZCONTACT_NAME_NULL: 'Please enter your name',
	ZCONTACT_CONTENT_NULL: 'Please enter content',
	
	//zvote us
	ZVOTE_SAVE: 'Saved',
	
	//amazon search
	ZAMAZON_SERACH_ERROR: 'Error in searching Amazon',
	
	//EZP
	EZP_GET_CATEGORY_ERROR: 'Cannot get category, please try again',
	EZP_SAVE_PROJECT_NAME_ALERT: 'Please input a project name',
	EZP_SAVE_PROJECT_NAME_ERROR: 'Cannot save the project, please try again',
	EZP_DELETE_PROJECT_CONFIRM: 'Are you sure want to delete this project?',
	EZP_GET_PROJECT_LIST_FAIL: 'Getting profile list failed, please try again',
	EZP_DELETE_PROJECT_ERROR: 'Cannot delete this project, please try again',
	EZP_SET_PHOTO_URL_ERRO: 'Please input the photo url',
	EZP_SELECT_PROJECT_CHECKOUT_ZERO: 'Please select the projects from the list.',
	EZP_PROJECT_QUANTITY_ERROR: 'Please input the correct quantity',
	EZP_GET_PRODUCTION_ERROR: 'Cannot get production list, please try again',
	EZP_CHECKOUT_CONFIRM: 'Are you sure you want to checkout? You will be redirected to another page',
	EZP_SAVE_PROJECT_NAME_LENGTH: 'Project name is too long (30 characters max)',
	
	//zshare
	ZSHARE_REMOVE: 'Removed successfully',
	ZSHARE_SECRET_QUESTION_NULL: 'Please input your question',
	ZSHARE_SECRET_ANSWER_NULL: 'Please input your true words',
	ZSHARE_SECRET_CREATE_SUCCESS: 'Your true words have been sent successfully',
	ZSHARE_MOVIE_CREATE_SUCCESS: 'Your movie has been saved successfully',
	ZSHARE_TOP_CREATE_SUCCESS: 'Your top 5 has been sent successfully',
	ZSHARE_TOP_NAME_NULL: 'Please name your list',
	ZSHARE_TOP_SEARCH_NULL: 'Please type what you are looking for',
	ZSHARE_TRIVIA_QUESTION_TITLE_NULL: 'Please input your question',
	ZSHARE_TRIVIA_QUESTION_OPTION_NUM_LIMIT: 'You need to provide at least two options for the multiple choice question',
	ZSHARE_TRIVIA_QUESTION_ANSWER_NUM_LIMIT: 'You need to provide at least one corret answer for the multiple choice question',
	ZSHARE_TRIVIA_GAME_TITLE_NULL: 'Please provide a title or a short description',
	ZSHARE_TRIVIA_QUESTIONNAIRE_CREATE_SUCCESS: 'Your questionnaire has been sent successfully',
	ZSHARE_TRIVIA_QUIZ_CREATE_SUCCESS: 'Your quiz has been sent successfully',
	ZSHARE_TRIVIA_GAME_EMPTY_ANSWER_ERROR: 'Please answer at least one question before submission',
	ZSHARE_TRIVIA_GAME_EMPTY_CREATE_ERROR: 'You need to provide at least one question',
	ZSHARE_TRIVIA_QUESTIONNAIRE_ANSWER_SUBMIT_SUCCESS: 'Your answer to the questionnaire has been sent successfully',
	ZSHARE_POLL_CREATE_SUCCESS: 'Your poll has been saved successfully',
	ZSHARE_DELETE_POST: 'Delete this post?',

	//recommend friend
	ZRECOMMEND_ACCEPT: 'Invite sent',
	ZRECOMMEND_IGNORE: 'Friends ignored',
	ZRECOMMEND_SENT_RECOMMEND: 'Recommendation sent',
	ZRECOMMEND_INPUT_FRIEND: 'Please input your friend',
	ZRECOMMEND_SELECT_FRIEND: 'Please select your friend',
	
	//find friends
	ZFIND_FRIENDS_MEMEBR_SENT: 'Invite sent',
	ZFIND_FRIENDS_EMAIL_ERROR: 'Please input email',
	ZFIND_FRIENDS_EMAIL_SUPPORT: 'Sorry, we do not currently support retrieving contacts from this email account',
	ZFIND_FRIENDS_NUM_INVALID: 'Please input a valid number.',
	ZFIND_FRIENDS_EMAIL_INVALID: 'The e-mail is not valid',
	
	//follow
	ZUNFOLLOW_SUCCESS: 'Unfollow successful',
	ZFOLLOW_SUCCESS: 'Follow successful',
	ZUNMUTE_SUCCESS: 'Successfully unhidden',
	ZMUTE_SUCCESS: 'Hide successful',
    
    //graffiti
    ZGRAFFITI_CONFIRM_DELETE: 'Are you sure you want to delete this post?',
    ZGRAFFITI_DELETE_SUCCESS: 'Post Deleted',
    ZGRAFFITI_CONFIRM_HIDE: 'This will hide all posts from {{nickname}}, to view them again you can show them in the following tab',
	ZGRAFFITI_POST_SUCCESS: 'Posted',
	ZGRAFFITI_COMMENT_NULL: 'Please add a comment',
    ZGRAFFITI_COMMENT_DELETED: 'Comment Deleted',
    ZGRAFFITI_POST_LOAD_FAILURE: 'Unable to load post',
    
    // zcontrol
    ZCONTROL_PWD_TOO_LONGORSHORT: 'Password either too short/long. Passwords should be between 6 and 15 characters.',
    ZCONTROL_PWD_UNMATCHED: 'New passwords do not match.',
    ZCONTROL_PWD_CHANGE_FAIL: 'Sorry, cannot change password. Please try again later or use the feedback form to report this.'
};function ZoolooComment () {
    var _objectTypeId;
    var _objectId;
	
    this._blurCallback = function () {};
    this._focusCallback = function () {};
    this._addCallback = function () {};
    this._deleteCallback = function () {};

    this.setup = function (objectTypeId, objectId, enableAnonymousComment, addCallback, deleteCallback) {
        this._objectTypeId = objectTypeId;
        this._objectId = objectId;

        if (typeof addCallback == 'function') {
            this._addCallback = addCallback;
        }

        if (typeof deleteCallback == 'function') {
            this._deleteCallback = deleteCallback;
        }
		
		if(enableAnonymousComment == 0) {
			if($('#comment_content').attr('name') == 'not_login') {
				$('#comment_content').attr('readonly', 'readonly');
				$('#comment_content').click(function(){
					$('#follow_promo').modal({
						onClose: function(dialog) {
							$.modal.close(false);
						}
					});
				});
			}
	        $('#comment_content').keydown(function (e) {
	            e.stopPropagation();
	        });
		}
		$('#comment_content').focus(function(){
			$(this).addClass('comment_active');
		}).blur(function(){
			$(this).removeClass('comment_active');
		});
        this.setupAddComment();
        this.setupModifyComment();
    };

    this.setupModifyComment = function() {
        $('div .zmedia_deleteComment').unbind("click").click(function(){
            var commentId = $(this).attr('name');
            $(this).parents('.global_comments').remove();
            ZFramework.zfAjaxPost("/zConnect/deleteComment", {
                comment_id: commentId
            }, false, function(response){
                ZComment._deleteCallback();
                $.jGrowl('Comment deleted');
            }, function(){
                ZFramework.alert('failed to delete comment');
            });
        });

        $('div .zGeneralCommentHide').unbind("click").click(function(){
            $(this).removeClass('zGeneralCommentHide').addClass('zGeneralCommentShow').attr('title','Show Comment').html('Show');
            var commentId = $(this).attr('name');
            //$(this).parent().parent().remove();
            $(this).parents('.global_comments').find('.global_comments_comment_box').addClass('zmedia_hiddenComment');
            ZComment.setupModifyComment();
            ZFramework.zfAjaxPost("/zConnect/hideComment", {
                comment_id: commentId
            }, false, function(response){
            }, function(){
                ZFramework.alert('failed to hide comment');
            });
        });

        $('div .zGeneralCommentShow').unbind("click").click(function(){
            $(this).removeClass('zGeneralCommentShow').addClass('zGeneralCommentHide').attr('title','Hide Comment').html('Hide');
            var commentId = $(this).attr('name');
            $(this).parents('.global_comments').find('.global_comments_comment_box').removeClass('zmedia_hiddenComment');
            ZComment.setupModifyComment();
            ZFramework.zfAjaxPost("/zConnect/showComment", {
                comment_id: commentId
            }, false, function(response){
            }, function(){
                ZFramework.alert('failed to delete comment');
            });
        });
    };

    this.setupAddComment = function() {
        $('#add_comment').unbind('click').click(function(){
            var comment = $.trim($('#comment_content').val());
			var commentName = $.trim($('#comment_name').val());
			var commentWebSite = $.trim($('#comment_website').val());
            if (comment.length === 0) {
                ZFramework.alert(ZMsg.ZPHOTO_VIEWER_COMMENT_NULL);
                return false;
            }
            ZFramework.zfAjaxPost("/zConnect/addComment", {
                type_id: ZComment._objectTypeId,
                id: ZComment._objectId,
                content: comment,
				name: commentName,
				web: commentWebSite
            }, true, function(response){
				var commentId = response.data.commentId;
				var isLogin = response.data.isLogin;
				if (commentId !== 0) {
					ZComment._addCallback();
					$('#comment_content, #comment_name, #comment_website').val('');
					if(!isLogin) {
						commentName = response.data.visitorName;
					} else {
						commentName = null;
					}
					ipAddress = response.data.ip;
					$('#comment_list').append(ZComment.generateNewComment(commentId, response.data.comment, commentName, ipAddress, commentWebSite));
					ZComment.setupModifyComment();
				}
				else {
					ZFramework.alert("Please login to add comments");
				}
            }, function() {

            });
        });
                
        $('#clear_comment').unbind('click').click(function() {
        	$('#comment_name').val('');
        	$('#comment_website').val('');
        	$('#comment_content').val('');
        });
    };

    this.populateComments = function(objectTypeId, objectId, comments, isOwner, entityId) {
        if (typeof isOwner == 'undefined') {
            isOwner = true;
            entityId = 0;
        }
        this._objectTypeId = objectTypeId;
        this._objectId = objectId;
		var template;
        $('#comment_list').html('');
	    var str = '';
        for (var i = 0; i < comments.length; i++) {
			if (comments[i]['poster_entity_id'] == 0) {
				template = $('<div class="global_comments">' + $('#comment_template_anonymous').html() + '</div>');
			} else {
				template = $('<div class="global_comments">' + $('#comment_template').html() + '</div>');
			}
	        var deleteTarget = $('div .zmedia_deleteComment', template);
	        var commentTarget = $('div .global_comments_comment', template);
	        var avatarTarget = $('.global_comments_avatar img', template);
	        var nameTarget = $('div .zGeneralCommentAuthor', template);
	        var dateTarget = $('div .zGeneralCommentDate', template);
	        var visibilityTarget = $('div .zGeneralCommentVisibility', template);
	        var boxTarget = $('div .global_comments_comment_box', template);
			var ipTarget = $('div .global_comments_ip', template);
			var domainTarget = $('div .zGeneralCommentDomain', template);
			var deleteTarget = $('div .zGeneralCommentDelete', template);
            deleteTarget.attr('name',comments[i]['id']);
            visibilityTarget.attr('name',comments[i]['id']);
            commentTarget.text(comments[i]['content']);
            avatarTarget.attr('src', '/zProfile/getSiteProfilePic/entity_id/' + comments[i]['poster_entity_id']);
            nameTarget.html(comments[i]['nickname']);
            dateTarget.html(comments[i]['post_date']);
			if(comments[i]['poster_entity_id'] == 0) {
				ipTarget.html(comments[i]['ip_address']);
			} else {
				domainTarget.attr('href', 'http://'+comments[i]['domain']);
			}
            if (isOwner || comments[i]['poster_entity_id'] == entityId) {
                deleteTarget.show();
            } else {
                deleteTarget.hide();
            }
			if(isOwner == true) {
				deleteTarget.show();
			}  else {
				deleteTarget.hide();
			}
            if (comments[i]['hidden'] == 't') {
                boxTarget.addClass('zmedia_hiddenComment');
            } else {
                boxTarget.removeClass('zmedia_hiddenComment');
            }
			if(comments[i]['domain'] != null && comments[i]['poster_entity_id'] == 0) {
				domain = '<a href="http://'+comments[i]['domain']+'" target="_blank">'+$('div .zGeneralCommentDomain', template).html()+'</a>';
				$('div .zGeneralCommentDomain', template).html(domain);
				domain = '<a href="http://'+comments[i]['domain']+'" target="_blank">'+$('div .global_comments_avatar', template).html()+'</a>';
				$('div .global_comments_avatar', template).html(domain);
			}
            try {
                if (comments[i]['hidden'] == 't') {
                    visibilityTarget.attr('className','zGeneralCommentVisibility zGeneralCommentShow').
                        attr('name', comments[i]['id']).
                        attr('title', 'Show Comment');
                } else {
                    visibilityTarget.attr('className','zGeneralCommentVisibility zGeneralCommentHide').
                        attr('name', comments[i]['id']).
                        attr('title', 'Hide Comment');
                }
            } catch (ex) {}
            str += template.html();
        }
        $('#comment_list').html(str);
        this.setupModifyComment();
    };

    this.generateNewComment = function(commentId, commentContent, visitorName, ipAddress, commentWebSite){
        var template;
		if (visitorName !== null) {
			template = $('#comment_template_anonymous').clone();
			$('div .zGeneralCommentAuthor', template).html(visitorName);
			$('div .global_comments_ip', template).html('IP:'+ipAddress);
			$('div .zmedia_deleteComment', template).remove();
			if(commentWebSite != null && ($.trim(commentWebSite)).length>0) {
				if(commentWebSite.indexOf('http://') == -1 && commentWebSite.indexOf('https://') == -1 ) {
					commentWebSite = 'http://'+commentWebSite;
				}
				var html = '<a href="'+commentWebSite+'" target="_blank">'+$('div .zGeneralCommentDomain', template).html()+'</a>';
				$('div .zGeneralCommentDomain', template).html(html);
				html = '<a href="'+commentWebSite+'" target="_blank">'+$('div .global_comments_avatar', template).html()+'</a>';
				$('div .global_comments_avatar', template).html(html);
			}
		} else {
			template = $('#comment_template');
		}
        $('div .zGeneralCommentHide', template).attr('name',commentId);
        $('div .global_comments_comment', template).html(commentContent);
        return template.html();
    };
}

ZComment = new ZoolooComment();

/*
 * Superfish v1.4.8 - jQuery menu widget
 * Copyright (c) 2008 Joel Birch
 *
 * Dual licensed under the MIT and GPL licenses:
 * 	http://www.opensource.org/licenses/mit-license.php
 * 	http://www.gnu.org/licenses/gpl.html
 *
 * CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt
 */

;(function($){
	$.fn.superfish = function(op){

		var sf = $.fn.superfish,
			c = sf.c,
			$arrow = $(['<span class="',c.arrowClass,'"> &#187;</span>'].join('')),
			over = function(){
				var $$ = $(this), menu = getMenu($$);
				clearTimeout(menu.sfTimer);
				$$.showSuperfishUl().siblings().hideSuperfishUl();
			},
			out = function(){
				var $$ = $(this), menu = getMenu($$), o = sf.op;
				clearTimeout(menu.sfTimer);
				menu.sfTimer=setTimeout(function(){
					o.retainPath=($.inArray($$[0],o.$path)>-1);
					$$.hideSuperfishUl();
					if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);}
				},o.delay);	
			},
			getMenu = function($menu){
				var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0];
				sf.op = sf.o[menu.serial];
				return menu;
			},
			addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); };
			
		return this.each(function() {
			var s = this.serial = sf.o.length;
			var o = $.extend({},sf.defaults,op);
			o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){
				$(this).addClass([o.hoverClass,c.bcClass].join(' '))
					.filter('li:has(ul)').removeClass(o.pathClass);
				$(this).parents('li').addClass(o.pathClass);
			});
			sf.o[s] = sf.op = o;
			
			$('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() {
				if (o.autoArrows) addArrow( $('>a:first-child',this) );
			})
			.not('.'+c.bcClass)
				.hideSuperfishUl();
			
			var $a = $('a',this);
			$a.each(function(i){
				var $li = $a.eq(i).parents('li');
				$a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);});
			});
			o.onInit.call(this);
			
		}).each(function() {
			var menuClasses = [c.menuClass];
			if (sf.op.dropShadows  && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass);
			$(this).addClass(menuClasses.join(' '));
		});
	};

	var sf = $.fn.superfish;
	sf.o = [];
	sf.op = {};
	sf.IE7fix = function(){
		var o = sf.op;
		if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity!=undefined)
			this.toggleClass(sf.c.shadowClass+'-off');
		};
	sf.c = {
		bcClass     : 'sf-breadcrumb',
		menuClass   : 'sf-js-enabled',
		anchorClass : 'sf-with-ul',
		arrowClass  : 'sf-sub-indicator',
		shadowClass : 'sf-shadow'
	};
	sf.defaults = {
		hoverClass	: 'sfHover',
		pathClass	: 'overideThisToUse',
		pathLevels	: 1,
		delay		: 800,
		animation	: {opacity:'show'},
		speed		: 'normal',
		autoArrows	: true,
		dropShadows : true,
		disableHI	: false,		// true disables hoverIntent detection
		onInit		: function(){}, // callback functions
		onBeforeShow: function(){},
		onShow		: function(){},
		onHide		: function(){}
	};
	$.fn.extend({
		hideSuperfishUl : function(){
			var o = sf.op,
				not = (o.retainPath===true) ? o.$path : '';
			o.retainPath = false;
			var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass)
					.find('>ul').hide().css('visibility','hidden');
			o.onHide.call($ul);
			return this;
		},
		showSuperfishUl : function(){
			var o = sf.op,
				sh = sf.c.shadowClass+'-off',
				$ul = this.addClass(o.hoverClass)
					.find('>ul:hidden').css('visibility','visible');
			sf.IE7fix.call($ul);
			o.onBeforeShow.call($ul);
			$ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul); o.onShow.call($ul); });
			return this;
		}
	});

})(jQuery);
﻿/*
 * jQuery blockUI plugin
 * Version 2.10 (10/22/2008)
 * @requires jQuery v1.2.3 or later
 *
 * Examples at: http://malsup.com/jquery/block/
 * Copyright (c) 2007-2008 M. Alsup
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 * 
 * Thanks to Amir-Hossein Sobhi for some excellent contributions!
 */

;(function($) {

if (/1\.(0|1|2)\.(0|1|2)/.test($.fn.jquery) || /^1.1/.test($.fn.jquery)) {
    alert('blockUI requires jQuery v1.2.3 or later!  You are using v' + $.fn.jquery);
    return;
}

// global $ methods for blocking/unblocking the entire page
$.blockUI   = function(opts) { install(window, opts); };
$.unblockUI = function(opts) { remove(window, opts); };

// plugin method for blocking element content
$.fn.block = function(opts) {
    return this.each(function() {
        if ($.css(this,'position') == 'static')
            this.style.position = 'relative';
        if ($.browser.msie) 
            this.style.zoom = 1; // force 'hasLayout'
        install(this, opts);
    });
};

// plugin method for unblocking element content
$.fn.unblock = function(opts) {
    return this.each(function() {
        remove(this, opts);
    });
};

$.blockUI.version = 2.09; // 2nd generation blocking at no extra cost!

// override these in your code to change the default behavior and style
$.blockUI.defaults = {
    // message displayed when blocking (use null for no message)
    message:  '<img src="/images/processing.png" />',
    
    // styles for the message when blocking; if you wish to disable
    // these and use an external stylesheet then do this in your code:
    // $.blockUI.defaults.css = {};
    css: { 
        padding:        0,
        margin:         0,
        width:          '30%', 
        top:            '40%', 
        left:           '35%', 
        textAlign:      'center', 
        color:          '#000', 
        border:         '3px solid #aaa',
        backgroundColor:'#fff',
        cursor:         'wait'
    },
    
    // styles for the overlay
    overlayCSS:  { 
        backgroundColor:'#000', 
        opacity:        '0.6' 
    },
    
    // z-index for the blocking overlay
    baseZ: 1000,
    
    // set these to true to have the message automatically centered
    centerX: true, // <-- only effects element blocking (page block controlled via css above)
    centerY: true,
    
    // allow body element to be stetched in ie6; this makes blocking look better
    // on "short" pages.  disable if you wish to prevent changes to the body height
    allowBodyStretch: true,
    
    // be default blockUI will supress tab navigation from leaving blocking content;
    constrainTabKey: true,
    
    // fadeOut time in millis; set to 0 to disable fadeout on unblock
    fadeOut:  400,
    
    // if true, focus will be placed in the first available input field when
    // page blocking
    focusInput: true,
    
    // suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity)
    applyPlatformOpacityRules: true,
    
    // callback method invoked when unblocking has completed; the callback is
    // passed the element that has been unblocked (which is the window object for page
    // blocks) and the options that were passed to the unblock call:
    //     onUnblock(element, options)
    onUnblock: null,
    
    // don't ask (if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493)
    quirksmodeOffsetHack: 4
};

// private data and functions follow...

//var ie6 = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent);
var ie6 = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent);
var ie8 = $.browser.msie && /MSIE 8.0/.test(navigator.userAgent);
var pageBlock = null;
var pageBlockEls = [];

function install(el, opts) {
    var full = (el == window);
    var msg = opts && opts.message !== undefined ? opts.message : undefined;
    opts = $.extend({}, $.blockUI.defaults, opts || {});
    opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {});
    var css = $.extend({}, $.blockUI.defaults.css, opts.css || {});
    msg = msg === undefined ? opts.message : msg;

    // remove the current block (if there is one)
    if (full && pageBlock) 
        remove(window, {fadeOut:0}); 
    
    // if an existing element is being used as the blocking content then we capture
    // its current place in the DOM (and current display style) so we can restore
    // it when we unblock
    if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) {
        var node = msg.jquery ? msg[0] : msg;
        var data = {};
        $(el).data('blockUI.history', data);
        data.el = node;
        data.parent = node.parentNode;
        data.display = node.style.display;
        data.position = node.style.position;
        data.parent.removeChild(node);
    }
    
    var z = opts.baseZ;
    
    // blockUI uses 3 layers for blocking, for simplicity they are all used on every platform;
    // layer1 is the iframe layer which is used to supress bleed through of underlying content
    // layer2 is the overlay layer which has opacity and a wait cursor
    // layer3 is the message content that is displayed while blocking
    
    var lyr1 = ($.browser.msie) ? $('<iframe class="blockUI" style="z-index:'+ z++ +';border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="javascript:false;"></iframe>')
                                : $('<div class="blockUI" style="display:none"></div>');
    var lyr2 = $('<div class="blockUI blockOverlay" style="z-index:'+ z++ +';cursor:wait;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');
    var lyr3 = full ? $('<div class="blockUI blockMsg blockPage" style="z-index:'+z+';position:fixed"></div>')
                    : $('<div class="blockUI blockMsg blockElement" style="z-index:'+z+';display:none;position:absolute"></div>');

    // if we have a message, style it
    if (msg) 
        lyr3.css(css);

    // style the overlay
    if (!opts.applyPlatformOpacityRules || !($.browser.mozilla && /Linux/.test(navigator.platform))) 
        lyr2.css(opts.overlayCSS);
    lyr2.css('position', full ? 'fixed' : 'absolute');
    
    // make iframe layer transparent in IE
    if ($.browser.msie) 
        lyr1.css('opacity','0.0');

    $([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el);
    
    // ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling)
    var expr = $.browser.msie && (!$.boxModel || $('object,embed', full ? null : el).length > 0);
    if ((ie6 || expr) && !ie8) {
        // give body 100% height
        if (full && opts.allowBodyStretch && $.boxModel)
            $('html,body').css('height','100%');

        // fix ie6 issue when blocked element has a border width
        if ((ie6 || !$.boxModel) && !full) {
            var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth');
            var fixT = t ? '(0 - '+t+')' : 0;
            var fixL = l ? '(0 - '+l+')' : 0;
        }

        // simulate fixed position
        $.each([lyr1,lyr2,lyr3], function(i,o) {
            var s = o[0].style;
            s.position = 'absolute';
            if (i < 2) {
                full ? s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"')
                     : s.setExpression('height','this.parentNode.offsetHeight + "px"');
                full ? s.setExpression('width','jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"')
                     : s.setExpression('width','this.parentNode.offsetWidth + "px"');
                if (fixL) s.setExpression('left', fixL);
                if (fixT) s.setExpression('top', fixT);
            }
            else if (opts.centerY) {
                if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');
                s.marginTop = 0;
            }
        });
    }
    
    // show the message
    lyr3.append(msg).show();
    if (msg && (msg.jquery || msg.nodeType))
        $(msg).show();

    // bind key and mouse events
    bind(1, el, opts);
        
    if (full) {
        pageBlock = lyr3[0];
        pageBlockEls = $(':input:enabled:visible',pageBlock);
        if (opts.focusInput)
            setTimeout(focus, 20);
    }
    else
        center(lyr3[0], opts.centerX, opts.centerY);
};

// remove the block
function remove(el, opts) {
    var full = el == window;
    var data = $(el).data('blockUI.history');
    opts = $.extend({}, $.blockUI.defaults, opts || {});
    bind(0, el, opts); // unbind events
    var els = full ? $('body').children().filter('.blockUI') : $('.blockUI', el);
    
    if (full) 
        pageBlock = pageBlockEls = null;

    if (opts.fadeOut) {
        els.fadeOut(opts.fadeOut);
        setTimeout(function() { reset(els,data,opts,el); }, opts.fadeOut);
    }
    else
        reset(els, data, opts, el);
};

// move blocking element back into the DOM where it started
function reset(els,data,opts,el) {
    els.each(function(i,o) {
        // remove via DOM calls so we don't lose event handlers
        if (this.parentNode) 
            this.parentNode.removeChild(this);
    });
    if (data && data.el) {
        data.el.style.display = data.display;
        data.el.style.position = data.position;
        data.parent.appendChild(data.el);
        $(data.el).removeData('blockUI.history');
    }
    if (typeof opts.onUnblock == 'function')
        opts.onUnblock(el,opts);
};

// bind/unbind the handler
function bind(b, el, opts) {
    var full = el == window, $el = $(el);
    
    // don't bother unbinding if there is nothing to unbind
    if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked'))) 
        return;
    if (!full) 
        $el.data('blockUI.isBlocked', b);
        
    // bind anchors and inputs for mouse and key events
    var events = 'mousedown mouseup keydown keypress click';
    b ? $(document).bind(events, opts, handler) : $(document).unbind(events, handler);

// former impl...
//    var $e = $('a,:input');
//    b ? $e.bind(events, opts, handler) : $e.unbind(events, handler);
};

// event handler to suppress keyboard/mouse events when blocking
function handler(e) {
    // allow tab navigation (conditionally)
    if (e.keyCode && e.keyCode == 9) {
        if (pageBlock && e.data.constrainTabKey) {
            var els = pageBlockEls;
            var fwd = !e.shiftKey && e.target == els[els.length-1];
            var back = e.shiftKey && e.target == els[0];
            if (fwd || back) {
                setTimeout(function(){focus(back)},10);
                return false;
            }
        }
    }
    // allow events within the message content
    if ($(e.target).parents('div.blockMsg').length > 0)
        return true;
        
    // allow events for content that is not being blocked
    return $(e.target).parents().children().filter('div.blockUI').length == 0;
};

function focus(back) {
    if (!pageBlockEls) 
        return;
    var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0];
    if (e) 
        e.focus();
};

function center(el, x, y) {
    var p = el.parentNode, s = el.style;
    var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth');
    var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth');
    if (x) s.left = l > 0 ? (l+'px') : '0';
    if (y) s.top  = t > 0 ? (t+'px') : '0';
};

function sz(el, p) { 
    return parseInt($.css(el,p))||0; 
};

})(jQuery);
/**
 * @title: ZooLoo Tooltip
 * @author: Michael Aguiar <michaela@zogmedia.com>
 * @description: Allows you to replace the default tooltip with the style of your choice.
 */

(function($) {
    $.fn.tooltip = function(settings) {
        settings = $.extend({
            id: 'tooltip',
            title: null,
            attrFlag: null,
            className: '',
            fade: true,
            elementDelay: 100,
            left: 15,
            top: 15,
            track: true,
            isStatic: false,
            callback: function() {}
        }, settings || {});
        
        var tooltipTimeout = null;
        var id = '#' + settings.id;
        var interact = false;
                      
        function GetContent(element) {
            var text = null;
            settings.attrFlag = null;
            
            if ($(element).attr('alt') && $(element).attr('alt') !== null) {
                text = $(element).attr('alt');
                settings.title = $(element).attr('alt');
                $(element).attr('alt', '');
                settings.attrFlag = 0;
            } else if ($(element).attr('title') && $(element).attr('title') !== null) {
                text = $(element).attr('title');
                settings.title = $(element).attr('title');
                $(element).attr('title', '');
                settings.attrFlag = 1;
            }
                        
            return text;
        }
        
        function GetPosition(e, id, element) {
            var width = $(id).width();
            var height = $(id).height();
            var offset = $(element).offset();

            if (settings.isStatic) {
                if (document.body.clientWidth < (e.pageX + width + settings.left + 15)) {
                    $(id).css({'left' : offset.left - width + 20 + 'px'});
                } else {
                    $(id).css({'left' : offset.left + 'px'});
                }

                if (document.body.clientHeight < (e.pageY + height + settings.top + 15)) {
                    $(id).css({'top' : offset.top - height - settings.top - 5 + 'px'});
                } else {
                    $(id).css({'top' : offset.top - height - settings.top - 15 + 'px'});
                }
            } else {
                if (document.body.clientWidth < (e.pageX + width + settings.left + 15)) {
                    $(id).css({'left' : e.pageX - width - settings.left + 'px'});
                } else {
                    $(id).css({'left' : e.pageX + settings.left - 5 + 'px'});
                }
    
                if (document.body.clientHeight < (e.pageY + height + settings.top + 15)) {
                    $(id).css({'top' : e.pageY - height - settings.top - 10 + 'px'});
                } else {
                    $(id).css({'top' : e.pageY + settings.top + 'px'});
                }
            }
        }
        
        $.each(this, function() {
            
            var html = $('<div id='+ settings.id +' class='+ settings.className +'></div>');
            
            $(this).unbind('mouseover').unbind('mousemove').unbind('mouseout');
            $(id).unbind('mouseover').unbind('mouseout');
                
            if ($(id).length === 0) {
                html.prependTo(document.body);
            }
            
            $(this).mouseover(function(e) {
                clearTimeout(tooltipTimeout);                
                var text = GetContent(this);
                
                if (text !== null) {
                    $(id).html(text);
                }
                
                settings.callback.call(this);
                
                if ($(id).find('a').length !== 0) {
                    interact = true;
                } else {
                    interact = false;
                    $(id).html('<span>'+text+'</span>');
                }
                
                GetPosition(e, id, this);
                
                tooltipTimeout = setTimeout(function() {
                    if (settings.fade) {
                        $(id).fadeIn(settings.elementDelay);
                    } else {
                        $(id).show();
                    }   
                }, 100);
                
                $(id).mouseover(function(e) {
                    if (interact) {
                        clearTimeout(tooltipTimeout);
                        $(id).stop();
                        if (settings.fade) {
                            $(id).animate({'opacity' : '1'}, 150);
                        } else {
                            $(id).show();
                        }   
                    }
                });
            });
            
            $(this).mousemove(function(e) {
                if (settings.track) {
                    GetPosition(e, id, this);
                }
            });
            
            $(this).click(function() {
            	clearTimeout(tooltipTimeout);
                
                tooltipTimeout = setTimeout(function() {
                    if (settings.fade) {
                        if (interact) {
                            $(id).fadeOut(settings.elementDelay + 300);
                        } else {
                            $(id).fadeOut(settings.elementDelay);
                        }
                    } else {
                        $(id).hide();
                    }
                }, 100);
                
                $(id).mouseout(function() {
                    if (interact) {
                        clearTimeout(tooltipTimeout);
                        
                        tooltipTimeout = setTimeout(function() {
                            if (settings.fade) {
                                $(id).fadeOut(settings.elementDelay + 300);
                            } else {
                                $(id).hide();
                            }
                        }, 100);
                    }
                });
                if (settings.attrFlag === 0) {
                    $(this).attr('alt', settings.title);
                } else if (settings.attrFlag == 1) {
                    $(this).attr('title', settings.title);
                }
            });
            
            $(this).mouseout(function() {
                clearTimeout(tooltipTimeout);
                
                tooltipTimeout = setTimeout(function() {
                    if (settings.fade) {
                        if (interact) {
                            $(id).fadeOut(settings.elementDelay + 300);
                        } else {
                            $(id).fadeOut(settings.elementDelay);
                        }
                    } else {
                        $(id).hide();
                    }
                }, 100);
                
                $(id).mouseout(function() {
                    if (interact) {
                        clearTimeout(tooltipTimeout);
                        
                        tooltipTimeout = setTimeout(function() {
                            if (settings.fade) {
                                $(id).fadeOut(settings.elementDelay + 300);
                            } else {
                                $(id).hide();
                            }
                        }, 100);
                    }
                });
                if (settings.attrFlag === 0) {
                    $(this).attr('alt', settings.title);
                } else if (settings.attrFlag == 1) {
                    $(this).attr('title', settings.title);
                }
            });         
        });
    };
}(jQuery));// jQuery Alert Dialogs Plugin
//
// Version 1.0
//
// Cory S.N. LaViska
// A Beautiful Site (http://abeautifulsite.net/)
// 29 December 2008
//
// Visit http://abeautifulsite.net/notebook/87 for more information
//
// Usage:
//		jAlert( message, [title, callback] )
//		confirm( message, [title, callback] )
//		jPrompt( message, [value, title, callback] )
//
// History:
//
//		1.00 - Released (29 December 2008)
//
// License:
//
//		This plugin is licensed under the GNU General Public License: http://www.gnu.org/licenses/gpl.html
//
(function($) {

	$.alerts = {

		// These properties can be read/written by accessing $.alerts.propertyName from your scripts at any time

		verticalOffset: -75,                // vertical offset of the dialog from center screen, in pixels
		horizontalOffset: 0,                // horizontal offset of the dialog from center screen, in pixels/
		repositionOnResize: true,           // re-centers the dialog on window resize
		overlayOpacity: .50,                // transparency level of overlay
		overlayColor: '#000',               // base color of overlay
		draggable: false,                    // make the dialogs draggable (requires UI Draggables plugin)
		okButton: '&nbsp;OK&nbsp;',         // text for the OK button
		cancelButton: '&nbsp;Cancel&nbsp;', // text for the Cancel button
		dialogClass: null,                  // if specified, this class will be applied to all dialogs

		// Public methods

		alert: function(message, title, callback) {
			if( title == null ) title = 'Alert';
			$.alerts._show(title, message, null, 'alert', function(result) {
				if( callback ) callback(result);
			});
		},

		confirm: function(message, title, callback) {
			if( title == null ) title = 'Confirm';
			$.alerts._show(title, message, null, 'confirm', function(result) {
				if( callback ) callback(result);
			});
		},

		prompt: function(message, value, title, callback) {
			if( title == null ) title = 'Prompt';
			$.alerts._show(title, message, value, 'prompt', function(result) {
				if( callback ) callback(result);
			});
		},

		// Private methods

		_show: function(title, msg, value, type, callback) {

			$.alerts._hide();
			$.alerts._overlay('show');

			$("BODY").append('<div id="jqa_popup_container"><div class="alert_relative"><div class="jqa_top_left"></div><div class="jqa_top_shadow"></div><div class="jqa_top_right"></div><div id="jqa_popup_title"></div></div><div class="alert_relative"><div class="jqa_left_shadow"></div><div id="jqa_popup_content"><div id="jqa_popup_message"></div></div><div class="jqa_right_shadow"></div></div><div class="alert_relative"><div class="jqa_bottom_left"></div><div class="jqa_bottom_shadow"></div><div class="jqa_bottom_right"></div></div></div>');

			if( $.alerts.dialogClass ) $("#jqa_popup_container").addClass($.alerts.dialogClass);

			// IE6 Fix
			var pos = ($.browser.msie && parseInt($.browser.version) <= 6 ) ? 'absolute' : 'fixed';

			$("#jqa_popup_container").css({
				position: pos,
				zIndex: 9999999,
				padding: 0,
				margin: 0
			});

			$("#jqa_popup_title").text(title);
			$("#jqa_popup_content").addClass(type);
			$("#jqa_popup_message").text(msg);
			$("#jqa_popup_message").html( $("#jqa_popup_message").text().replace(/\n/g, '<br />') );

			$("#jqa_popup_container").css({
				minWidth: $("#jqa_popup_container").outerWidth(),
				maxWidth: $("#jqa_popup_container").outerWidth()
			});

			$.alerts._reposition();
			$.alerts._maintainPosition(true);

			switch( type ) {
				case 'alert':
					$("#jqa_popup_message").after('<div id="jqa_popup_panel"><input type="button" value="' + $.alerts.okButton + '" id="jqa_popup_ok" /></div>');
					$("#jqa_popup_ok").click( function() {
						$.alerts._hide();
						callback(true);
					});
					$("#jqa_popup_ok").focus().keypress( function(e) {
						if( e.keyCode == 13 || e.keyCode == 27 ) $("#jqa_popup_ok").trigger('click');
					});
				break;
				case 'confirm':
					$("#jqa_popup_message").after('<div id="jqa_popup_panel"><input type="button" value="' + $.alerts.okButton + '" id="jqa_popup_ok" /> <input type="button" value="' + $.alerts.cancelButton + '" id="jqa_popup_cancel" /></div>');
					$("#jqa_popup_ok").click( function() {
						$.alerts._hide();
						if( callback ) callback(true);
					});
					$("#jqa_popup_cancel").click( function() {
						$.alerts._hide();
						if( callback ) callback(false);
					});
					$("#jqa_popup_ok").focus();
					$("#jqa_popup_ok, #jqa_popup_cancel").keypress( function(e) {
						if( e.keyCode == 13 ) $("#jqa_popup_ok").trigger('click');
						if( e.keyCode == 27 ) $("#jqa_popup_cancel").trigger('click');
					});
				break;
				case 'prompt':
					$("#jqa_popup_message").append('<br /><input type="text" size="30" id="jqa_popup_prompt" />').after('<div id="jqa_popup_panel"><input type="button" value="' + $.alerts.okButton + '" id="jqa_popup_ok" /> <input type="button" value="' + $.alerts.cancelButton + '" id="jqa_popup_cancel" /></div>');
					$("#jqa_popup_prompt").width( $("#jqa_popup_message").width() );
					$("#jqa_popup_ok").click( function() {
						var val = $("#jqa_popup_prompt").val();
						$.alerts._hide();
						if( callback ) callback( val );
					});
					$("#jqa_popup_cancel").click( function() {
						$.alerts._hide();
						if( callback ) callback( null );
					});
					$("#jqa_popup_prompt, #jqa_popup_ok, #jqa_popup_cancel").keypress( function(e) {
						if( e.keyCode == 13 ) $("#jqa_popup_ok").trigger('click');
						if( e.keyCode == 27 ) $("#jqa_popup_cancel").trigger('click');
					});
					if( value ) $("#jqa_popup_prompt").val(value);
					$("#jqa_popup_prompt").focus().select();
				break;
			}

			// Make draggable
			if( $.alerts.draggable ) {
				try {
					$("#jqa_popup_container").draggable({ handle: $("#jqa_popup_title") });
					$("#jqa_popup_title").css({ cursor: 'move' });
				} catch(e) { /* requires jQuery UI draggables */ }
			}
		},

		_hide: function() {
			$("#jqa_popup_container").remove();
			$.alerts._overlay('hide');
			$.alerts._maintainPosition(false);
		},

		_overlay: function(status) {
			switch( status ) {
				case 'show':
					$.alerts._overlay('hide');
					$("BODY").append('<div id="jqa_popup_overlay"></div>');
					$("#jqa_popup_overlay").css({
						position: 'absolute',
						zIndex: 99998,
						top: '0px',
						left: '0px',
						width: '100%',
						height: $(document).height(),
						background: $.alerts.overlayColor,
						opacity: $.alerts.overlayOpacity
					});
				break;
				case 'hide':
					$("#jqa_popup_overlay").remove();
				break;
			}
		},

		_reposition: function() {
			var top = (($(window).height() / 2) - ($("#jqa_popup_container").outerHeight() / 2)) + $.alerts.verticalOffset;
			var left = (($(window).width() / 2) - ($("#jqa_popup_container").outerWidth() / 2)) + $.alerts.horizontalOffset;
			if( top < 0 ) top = 0;
			if( left < 0 ) left = 0;

			// IE6 fix
			if( $.browser.msie && parseInt($.browser.version) <= 6 ) top = top + $(window).scrollTop();

			$("#jqa_popup_container").css({
				top: top + 'px',
				left: left + 'px'
			});
			$("#jqa_popup_overlay").height( $(document).height() );
		},

		_maintainPosition: function(status) {
			if( $.alerts.repositionOnResize ) {
				switch(status) {
					case true:
						$(window).bind('resize', function() {
							$.alerts._reposition();
						});
					break;
					case false:
						$(window).unbind('resize');
					break;
				}
			}
		}

	}

	// Shortuct functions
	jAlert = function(message, title, callback) {
		$.alerts.alert(message, title, callback);
	}

	jConfirm = function(message, title, callback) {
		$.alerts.confirm(message, title, callback);
	};

	jPrompt = function(message, value, title, callback) {
		$.alerts.prompt(message, value, title, callback);
	};

})(jQuery);
/**
 * jGrowl 1.1.2
 *
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * Written by Stan Lemon <stanlemon@mac.com>
 * Last updated: 2008.08.17
 *
 * jGrowl is a jQuery plugin implementing unobtrusive userland notifications.  These 
 * notifications function similarly to the Growl Framework available for
 * Mac OS X (http://growl.info).
 *
 * To Do:
 * - Move library settings to containers and allow them to be changed per container
 *
 * Changes in 1.1.2
 * - Added iPhone styled example
 * - Fixed possible IE7 bug when determining if the ie6 class shoudl be applied.
 * - Added template for the close button, so that it's content could be customized.
 *
 * Changes in 1.1.1
 * - Fixed CSS styling bug for ie6 caused by a mispelling
 * - Changes height restriction on default notifications to min-height
 * - Added skinned examples using a variety of images
 * - Added the ability to customize the content of the [close all] box
 * - Added jTweet, an example of using jGrowl + Twitter
 *
 * Changes in 1.1.0
 * - Multiple container and instances.
 * - Standard $.jGrowl() now wraps $.fn.jGrowl() by first establishing a generic jGrowl container.
 * - Instance methods of a jGrowl container can be called by $.fn.jGrowl(methodName)
 * - Added glue preferenced, which allows notifications to be inserted before or after nodes in the container
 * - Added new log callback which is called before anything is done for the notification
 * - Corner's attribute are now applied on an individual notification basis.
 *
 * Changes in 1.0.4
 * - Various CSS fixes so that jGrowl renders correctly in IE6.
 *
 * Changes in 1.0.3
 * - Fixed bug with options persisting across notifications
 * - Fixed theme application bug
 * - Simplified some selectors and manipulations.
 * - Added beforeOpen and beforeClose callbacks
 * - Reorganized some lines of code to be more readable
 * - Removed unnecessary this.defaults context
 * - If corners plugin is present, it's now customizable.
 * - Customizable open animation.
 * - Customizable close animation.
 * - Customizable animation easing.
 * - Added customizable positioning (top-left, top-right, bottom-left, bottom-right, center)
 *
 * Changes in 1.0.2
 * - All CSS styling is now external.
 * - Added a theme parameter which specifies a secondary class for styling, such
 *   that notifications can be customized in appearance on a per message basis.
 * - Notification life span is now customizable on a per message basis.
 * - Added the ability to disable the global closer, enabled by default.
 * - Added callbacks for when a notification is opened or closed.
 * - Added callback for the global closer.
 * - Customizable animation speed.
 * - jGrowl now set itself up and tears itself down.
 *
 * Changes in 1.0.1:
 * - Removed dependency on metadata plugin in favor of .data()
 * - Namespaced all events
 */
(function($) {

	/** jGrowl Wrapper - Establish a base jGrowl Container for compatibility with older releases. **/
	$.jGrowl = function( m , o ) {
		// To maintain compatibility with older version that only supported one instance we'll create the base container.
		if ( $('#jGrowl').size() == 0 ) $('<div id="jGrowl"></div>').addClass($.jGrowl.defaults.position).appendTo('body');
		// Create a notification on the container.
		$('#jGrowl').jGrowl(m,o);
	};


	/** Raise jGrowl Notification on a jGrowl Container **/
	$.fn.jGrowl = function( m , o ) {
		if ( $.isFunction(this.each) ) {
			var args = arguments;

			return this.each(function() {
				var self = this;

				/** Create a jGrowl Instance on the Container if it does not exist **/
				if ( $(this).data('jGrowl.instance') == undefined ) {
					$(this).data('jGrowl.instance', new $.fn.jGrowl());
					$(this).data('jGrowl.instance').startup( this );
				}

				/** Optionally call jGrowl instance methods, or just raise a normal notification **/
				if ( $.isFunction($(this).data('jGrowl.instance')[m]) ) {
					$(this).data('jGrowl.instance')[m].apply( $(this).data('jGrowl.instance') , $.makeArray(args).slice(1) );
				} else {
					$(this).data('jGrowl.instance').notification( m , o );
				}
			});
		};
	};

	$.extend( $.fn.jGrowl.prototype , {

		/** Default JGrowl Settings **/
		defaults: {
			header: 		'',
			sticky: 		false,
			position: 		'top-right', // Is this still needed?
			glue: 			'after',
			theme: 			'default',
			corners: 		'10px',
			check: 			500,
			life: 			3000,
			speed: 			'normal',
			easing: 		'swing',
			closer: 		false,
			closeTemplate: '',
			closerTemplate: '<div>[ close all ]</div>',
			log: 			function(e,m,o) {},
			beforeOpen: 	function(e,m,o) {},
			open: 			function(e,m,o) {},
			beforeClose: 	function(e,m,o) {},
			close: 			function(e,m,o) {},
			animateOpen: 	{
				opacity: 	'show'
			},
			animateClose: 	{
				opacity: 	'hide'
			}
		},
		
		/** jGrowl Container Node **/
		element: 	null,
	
		/** Interval Function **/
		interval:   null,
		
		/** Create a Notification **/
		notification: 	function( message , o ) {
			var self = this;
			var o = $.extend({}, this.defaults, o);

			o.log.apply( this.element , [this.element,message,o] );

			var notification = $('<div class="jGrowl-notification"><div class="close">' + o.closeTemplate + '</div><div class="headerGrowl">' + o.header + '</div><div class="message">' + message + '</div></div>')
				.data("jGrowl", o).addClass(o.theme).children('div.close').bind("click.jGrowl", function() {
					$(this).unbind('click.jGrowl').parent().trigger('jGrowl.beforeClose').animate(o.animateClose, o.speed, o.easing, function() {
						$(this).trigger('jGrowl.close').remove();
					});
				}).parent();
				
			( o.glue == 'after' ) ? $('div.jGrowl-notification:last', this.element).after(notification) : $('div.jGrowl-notification:first', this.element).before(notification);

			/** Notification Actions **/
			$(notification).bind("mouseover.jGrowl", function() {
				$(this).data("jGrowl").pause = true;
			}).bind("mouseout.jGrowl", function() {
				$(this).data("jGrowl").pause = false;
			}).bind('jGrowl.beforeOpen', function() {
				o.beforeOpen.apply( self.element , [self.element,message,o] );
			}).bind('jGrowl.open', function() {
				o.open.apply( self.element , [self.element,message,o] );
			}).bind('jGrowl.beforeClose', function() {
				o.beforeClose.apply( self.element , [self.element,message,o] );
			}).bind('jGrowl.close', function() {
				o.close.apply( self.element , [self.element,message,o] );
			}).trigger('jGrowl.beforeOpen').animate(o.animateOpen, o.speed, o.easing, function() {
				$(this).data("jGrowl").created = new Date();
			}).trigger('jGrowl.open');
		
			/** Optional Corners Plugin **/
			if ( $.fn.corner != undefined ) $(notification).corner( o.corners );

			/** Add a Global Closer if more than one notification exists **/
			if ( $('div.jGrowl-notification:parent', this.element).size() > 1 && $('div.jGrowl-closer', this.element).size() == 0 && this.defaults.closer != false ) {
				$(this.defaults.closerTemplate).addClass('jGrowl-closer').addClass(this.defaults.theme).appendTo(this.element).animate(this.defaults.animateOpen, this.defaults.speed, this.defaults.easing).bind("click.jGrowl", function() {
					$(this).siblings().children('div.close').trigger("click.jGrowl");

					if ( $.isFunction( self.defaults.closer ) ) self.defaults.closer.apply( $(this).parent()[0] , [$(this).parent()[0]] );
				});
			};
		},

		/** Update the jGrowl Container, removing old jGrowl notifications **/
		update:	 function() {
			$(this.element).find('div.jGrowl-notification:parent').each( function() {
				if ( $(this).data("jGrowl") != undefined && $(this).data("jGrowl").created != undefined && ($(this).data("jGrowl").created.getTime() + $(this).data("jGrowl").life)  < (new Date()).getTime() && $(this).data("jGrowl").sticky != true && 
					 ($(this).data("jGrowl").pause == undefined || $(this).data("jGrowl").pause != true) ) {
					$(this).children('div.close').trigger('click.jGrowl');
				}
			});

			if ( $(this.element).find('div.jGrowl-notification:parent').size() < 2 ) {
				$(this.element).find('div.jGrowl-closer').animate(this.defaults.animateClose, this.defaults.speed, this.defaults.easing, function() {
					$(this).remove();
				});
			};
		},

		/** Setup the jGrowl Notification Container **/
		startup:	function(e) {
			this.element = $(e).addClass('jGrowl').append('<div class="jGrowl-notification"></div>');
			this.interval = setInterval( function() { jQuery(e).data('jGrowl.instance').update(); }, this.defaults.check);
			
			if ($.browser.msie && parseInt($.browser.version) < 7 && !window["XMLHttpRequest"]) $(this.element).addClass('ie6');
		},

		/** Shutdown jGrowl, removing it and clearing the interval **/
		shutdown:   function() {
			$(this.element).removeClass('jGrowl').find('div.jGrowl-notification').remove();
			clearInterval( this.interval );
		}
	});
	
	/** Reference the Defaults Object for compatibility with older versions of jGrowl **/
	$.jGrowl.defaults = $.fn.jGrowl.prototype.defaults;

})(jQuery);/*
 * SimpleModal 1.1.1 - jQuery Plugin
 * http://www.ericmmartin.com/projects/simplemodal/
 * http://plugins.jquery.com/project/SimpleModal
 * http://code.google.com/p/simplemodal/
 *
 * Copyright (c) 2007 Eric Martin - http://ericmmartin.com
 *
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * Revision: $Id: jquery.simplemodal.js 93 2008-01-15 16:14:20Z emartin24 $
 *
 */
(function($){
    $.modal = function(data, options){
        return $.modal.impl.init(data, options);
    };
    $.modal.close = function(refresh){
        if(typeof(refresh)=="undefined") 
            refresh = true;
        $.modal.impl.close(true, refresh);
    };
    $.fn.modal = function(options){
        return $.modal.impl.init(this, options);
    };
    $.modal.defaults = {
        //overlay: 100,
        overlayId: 'modalOverlay',
        overlayCss: {},
        containerId: 'modalContainer',
        containerCss: {},
        close: true,
        closeTitle: 'Close',
        closeClass: 'modalCloseImg',
        dataClass: 'modalData',
        closeCss: null,
        persist: false,
        onOpen: null,
        onShow: null,
        onClose: null,
        windowPos: null
    };
    $.modal.impl = {
        opts: null,
        dialog: {},
        init: function(data, options){
            if (this.dialog.data) {
                return false;
            }
            this.opts = $.extend({}, $.modal.defaults, options);
            if (typeof data == 'object') {
                data = data instanceof jQuery ? data : $(data);
                if (data.parent().parent().size() > 0) {
                    this.dialog.parentNode = data.parent();
                    if (!this.opts.persist) {
                        this.dialog.original = data.clone(true);
                    }
                }
            }
            else 
                if (typeof data == 'string' || typeof data == 'number') {
                    data = $('<div>').html(data);
                }
                else {
                    if (console) {
                        console.log('SimpleModal Error: Unsupported data type: ' + typeof data);
                    }
                    return false;
                }
            this.dialog.data = data.addClass(this.opts.dataClass);
            data = null;
            this.create();
            this.open();
            if ($.isFunction(this.opts.onShow)) {
                this.opts.onShow.apply(this, [this.dialog]);
            }
            return this;
        },
        create: function(){
            this.dialog.overlay = $('<div>').attr('id', this.opts.overlayId).addClass(this.opts.overlayId).css($.extend(this.opts.overlayCss, {
                //opacity: this.opts.overlay / 100,
                height: '100%',
                width: '100%',
                position: 'fixed',
                left: 0,
                top: 0,
                zIndex: 1000000
            })).hide().appendTo('body');
            this.dialog.container = $('<div>').attr('id', this.opts.containerId).addClass(this.opts.containerId).css($.extend(this.opts.containerCss, {
                position: 'absolute',
                top: '50%',
                zIndex: 1000100
            })).append(this.opts.close ? '<a class="'+ this.opts.closeClass + '" title="' + this.opts.closeTitle + '"></a>' : '').hide().appendTo('body');
            
            if (this.opts.closeCss) {
                $('.'+this.opts.closeClass).css(this.opts.closeCss);
            }
            if ($.browser.msie && ($.browser.version < 7)) {
                this.fixIE();
            }
            this.dialog.container.append(this.dialog.data.hide());
        },
        bindEvents: function(){
            var modal = this;
            $('.' + this.opts.closeClass).click(function(e){
                e.preventDefault();
                modal.close(true,false);
            });
            
            if (this.opts.close === true) {
                $('#modalOverlay').click(function(e) {
                    e.preventDefault();
                    modal.close(false,false);
                });
            }
            
            jQuery('#'+this.opts.containerId).keydown(function(e) {
                // Escape
                if (e.keyCode == 27) {
                    jQuery.modal.close(false);
                }
            });
        },
        unbindEvents: function(){
            $('.' + this.opts.closeClass).unbind('click');
        },
        fixIE: function(){
            var wHeight = $(document.body).height() + 'px';
            var wWidth = $(document.body).width() + 'px';
            this.dialog.overlay.css({
                position: 'absolute',
                height: wHeight,
                width: wWidth
            });
            this.dialog.container.css({
                position: 'absolute'
            });
            this.dialog.iframe = $('<iframe src="javascript:false;">').css($.extend(this.opts.iframeCss, {
                //opacity: 0,
                position: 'absolute',
                height: wHeight,
                width: wWidth,
                zIndex: 1000,
                top: 0,
                left: 0
            })).hide().appendTo('body');
        },
        open: function(){
            this.opts.windowPos = $(document).scrollTop();
            $(document).scrollTop(0);
            if (this.dialog.iframe) {
                this.dialog.iframe.show();
            }
            if ($.isFunction(this.opts.onOpen)) {
                this.opts.onOpen.apply(this, [this.dialog]);
            }
            else {
                this.dialog.overlay.show();
                this.dialog.container.show();
                this.dialog.data.show();
            }
            this.bindEvents();
            this.dialog.container.css({
                marginLeft: '-' + this.dialog.container.width() / 2 + 'px',
                marginTop: '-' + (this.dialog.container.height() + 14) / 2 + 'px'
            });
            
            this.dialog.container.css({
                
            });
        },
        close: function(external, refresh) {
            if (!this.dialog.data) {
                return false;
            }
            if ($.isFunction(this.opts.onClose) && !external) {
                this.opts.onClose.apply(this, [this.dialog]);
            }
            else {
                if (this.dialog.parentNode) {
                    if (this.opts.persist) {
                        this.dialog.data.hide().appendTo(this.dialog.parentNode);
                    }
                    else {
                        this.dialog.data.remove();
                        this.dialog.original.appendTo(this.dialog.parentNode);
                    }
                }
                else {
                    this.dialog.data.remove();
                }
                this.dialog.container.remove();
                this.dialog.overlay.remove();
                if (this.dialog.iframe) {
                    this.dialog.iframe.remove();
                }
                this.dialog = {};
                if(typeof(refresh)=="undefined") 
                    refresh = true;
                if(refresh)
                    location.reload();
            }
            if (this.opts.windowPos !== null) {
                $(document).scrollTop(this.opts.windowPos);
            }
            this.unbindEvents();
        }
    };
})(jQuery);
/*
 * Autocomplete - jQuery plugin 1.0.2
 *
 * Copyright (c) 2007 Dylan Verheul, Dan G. Switzer, Anjesh Tuladhar, Jörn Zaefferer
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * Revision: $Id: jquery.autocomplete.js 5747 2008-06-25 18:30:55Z joern.zaefferer $
 *
 */

;(function($) {
	
$.fn.extend({
	autocomplete: function(urlOrData, options) {
		var isUrl = typeof urlOrData == "string";
		options = $.extend({}, $.Autocompleter.defaults, {
			url: isUrl ? urlOrData : null,
			data: isUrl ? null : urlOrData,
			delay: isUrl ? $.Autocompleter.defaults.delay : 10,
			max: options && !options.scroll ? 10 : 150
		}, options);
		
		// if highlight is set to false, replace it with a do-nothing function
		options.highlight = options.highlight || function(value) { return value; };
		
		// if the formatMatch option is not specified, then use formatItem for backwards compatibility
		options.formatMatch = options.formatMatch || options.formatItem;
		
		return this.each(function() {
			new $.Autocompleter(this, options);
		});
	},
	result: function(handler) {
		return this.bind("result", handler);
	},
	search: function(handler) {
		return this.trigger("search", [handler]);
	},
	flushCache: function() {
		return this.trigger("flushCache");
	},
	setOptions: function(options){
		return this.trigger("setOptions", [options]);
	},
	unautocomplete: function() {
		return this.trigger("unautocomplete");
	}
});

$.Autocompleter = function(input, options) {

	var KEY = {
		UP: 38,
		DOWN: 40,
		DEL: 46,
		TAB: 9,
		RETURN: 13,
		ESC: 27,
		COMMA: 188,
		PAGEUP: 33,
		PAGEDOWN: 34,
		BACKSPACE: 8
	};

	// Create $ object for input element
	var $input = $(input).attr("autocomplete", "off").addClass(options.inputClass);

	var timeout;
	var previousValue = "";
	var cache = $.Autocompleter.Cache(options);
	var hasFocus = 0;
	var lastKeyPressCode;
	var config = {
		mouseDownOnSelect: false
	};
	var select = $.Autocompleter.Select(options, input, selectCurrent, config);
	
	var blockSubmit;
	
	// prevent form submit in opera when selecting with return key
	$.browser.opera && $(input.form).bind("submit.autocomplete", function() {
		if (blockSubmit) {
			blockSubmit = false;
			return false;
		}
	});
	
	// only opera doesn't trigger keydown multiple times while pressed, others don't work with keypress at all
	$input.bind(($.browser.opera ? "keypress" : "keydown") + ".autocomplete", function(event) {
		// track last key pressed
		lastKeyPressCode = event.keyCode;
		switch(event.keyCode) {
		
			case KEY.UP:
				event.preventDefault();
				if ( select.visible() ) {
					select.prev();
				} else {
					onChange(0, true);
				}
				break;
				
			case KEY.DOWN:
				event.preventDefault();
				if ( select.visible() ) {
					select.next();
				} else {
					onChange(0, true);
				}
				break;
				
			case KEY.PAGEUP:
				event.preventDefault();
				if ( select.visible() ) {
					select.pageUp();
				} else {
					onChange(0, true);
				}
				break;
				
			case KEY.PAGEDOWN:
				event.preventDefault();
				if ( select.visible() ) {
					select.pageDown();
				} else {
					onChange(0, true);
				}
				break;
			
			// matches also semicolon
			case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA:
			case KEY.TAB:
			case KEY.RETURN:
				if( selectCurrent() ) {
					// stop default to prevent a form submit, Opera needs special handling
					event.preventDefault();
					blockSubmit = true;
					return false;
				}
				break;
				
			case KEY.ESC:
				select.hide();
				break;
				
			default:
				clearTimeout(timeout);
				timeout = setTimeout(onChange, options.delay);
				break;
		}
	}).focus(function(){
		// track whether the field has focus, we shouldn't process any
		// results if the field no longer has focus
		hasFocus++;
	}).blur(function() {
		hasFocus = 0;
		if (!config.mouseDownOnSelect) {
			hideResults();
		}
	}).click(function() {
		// show select when clicking in a focused field
		if ( hasFocus++ > 1 && !select.visible() ) {
			onChange(0, true);
		}
	}).bind("search", function() {
		// TODO why not just specifying both arguments?
		var fn = (arguments.length > 1) ? arguments[1] : null;
		function findValueCallback(q, data) {
			var result;
			if( data && data.length ) {
				for (var i=0; i < data.length; i++) {
					if( data[i].result.toLowerCase() == q.toLowerCase() ) {
						result = data[i];
						break;
					}
				}
			}
			if( typeof fn == "function" ) fn(result);
			else $input.trigger("result", result && [result.data, result.value]);
		}
		$.each(trimWords($input.val()), function(i, value) {
			request(value, findValueCallback, findValueCallback);
		});
	}).bind("flushCache", function() {
		cache.flush();
	}).bind("setOptions", function() {
		$.extend(options, arguments[1]);
		// if we've updated the data, repopulate
		if ( "data" in arguments[1] )
			cache.populate();
	}).bind("unautocomplete", function() {
	    select.hide(); // JN ZL Mod
		select.unbind();
		$input.unbind();
		$(input.form).unbind(".autocomplete");
	});
	
	
	function selectCurrent() {
		var selected = select.selected();
		if( !selected )
			return false;
		
		var v = selected.result;
		previousValue = v;
		
		if ( options.multiple ) {
			var words = trimWords($input.val());
			if ( words.length > 1 ) {
				v = words.slice(0, words.length - 1).join( options.multipleSeparator ) + options.multipleSeparator + v;
			}
			v += options.multipleSeparator;
		}
		
		$input.val(v);
		hideResultsNow();
		$input.trigger("result", [selected.data, selected.value]);
		return true;
	}
	
	function onChange(crap, skipPrevCheck) {
		if( lastKeyPressCode == KEY.DEL ) {
			select.hide();
			return;
		}
		
		var currentValue = $input.val();
		
		if ( !skipPrevCheck && currentValue == previousValue )
			return;
		
		previousValue = currentValue;
		
		currentValue = lastWord(currentValue);
		if ( currentValue.length >= options.minChars) {
			$input.addClass(options.loadingClass);
			if (!options.matchCase)
				currentValue = currentValue.toLowerCase();
			request(currentValue, receiveData, hideResultsNow);
		} else {
			stopLoading();
			select.hide();
		}
	};
	
	function trimWords(value) {
		if ( !value ) {
			return [""];
		}
		var words = value.split( options.multipleSeparator );
		var result = [];
		$.each(words, function(i, value) {
			if ( $.trim(value) )
				result[i] = $.trim(value);
		});
		return result;
	}
	
	function lastWord(value) {
		if ( !options.multiple )
			return value;
		var words = trimWords(value);
		return words[words.length - 1];
	}
	
	// fills in the input box w/the first match (assumed to be the best match)
	// q: the term entered
	// sValue: the first matching result
	function autoFill(q, sValue){
		// autofill in the complete box w/the first match as long as the user hasn't entered in more data
		// if the last user key pressed was backspace, don't autofill
		if( options.autoFill && (lastWord($input.val()).toLowerCase() == q.toLowerCase()) && lastKeyPressCode != KEY.BACKSPACE ) {
			// fill in the value (keep the case the user has typed)
			$input.val($input.val() + sValue.substring(lastWord(previousValue).length));
			// select the portion of the value not typed by the user (so the next character will erase)
			$.Autocompleter.Selection(input, previousValue.length, previousValue.length + sValue.length);
		}
	};

	function hideResults() {
		clearTimeout(timeout);
		timeout = setTimeout(hideResultsNow, 200);
	};

	function hideResultsNow() {
		var wasVisible = select.visible();
		select.hide();
		clearTimeout(timeout);
		stopLoading();
		if (options.mustMatch) {
			// call search and run callback
			$input.search(
				function (result){
					// if no value found, clear the input box
					if( !result ) {
						if (options.multiple) {
							var words = trimWords($input.val()).slice(0, -1);
							$input.val( words.join(options.multipleSeparator) + (words.length ? options.multipleSeparator : "") );
						}
						else
							$input.val( "" );
					}
				}
			);
		}
		if (wasVisible)
			// position cursor at end of input field
			$.Autocompleter.Selection(input, input.value.length, input.value.length);
	};

	function receiveData(q, data) {
		if ( data && data.length && hasFocus ) {
			stopLoading();
			select.display(data, q);
			autoFill(q, data[0].value);
			select.show();
		} else {
			hideResultsNow();
		}
	};

	function request(term, success, failure) {
		if (!options.matchCase)
			term = term.toLowerCase();
		var data = cache.load(term);
		// recieve the cached data
		if (data && data.length) {
			success(term, data);
		// if an AJAX url has been supplied, try loading the data now
		} else if( (typeof options.url == "string") && (options.url.length > 0) ){
			
			var extraParams = {
				timestamp: +new Date()
			};
			$.each(options.extraParams, function(key, param) {
				extraParams[key] = typeof param == "function" ? param() : param;
			});
			
			$.ajax({
				// try to leverage ajaxQueue plugin to abort previous requests
				mode: "abort",
				// limit abortion to this input
				port: "autocomplete" + input.name,
				dataType: options.dataType,
				url: options.url,
				data: $.extend({
					q: lastWord(term),
					limit: options.max
				}, extraParams),
				success: function(data) {
					var parsed = options.parse && options.parse(data) || parse(data);
					cache.add(term, parsed);
					success(term, parsed);
				}
			});
		} else {
			// if we have a failure, we need to empty the list -- this prevents the the [TAB] key from selecting the last successful match
			select.emptyList();
			failure(term);
		}
	};
	
	function parse(data) {
		var parsed = [];
		var rows = data.split("\n");
		for (var i=0; i < rows.length; i++) {
			var row = $.trim(rows[i]);
			if (row) {
				row = row.split("|");
				parsed[parsed.length] = {
					data: row,
					value: row[0],
					result: options.formatResult && options.formatResult(row, row[0]) || row[0]
				};
			}
		}
		return parsed;
	};

	function stopLoading() {
		$input.removeClass(options.loadingClass);
	};

};

$.Autocompleter.defaults = {
	inputClass: "ac_input",
	resultsClass: "ac_results",
	loadingClass: "ac_loading",
	minChars: 1,
	delay: 400,
	matchCase: false,
	matchSubset: true,
	matchContains: false,
	cacheLength: 10,
	max: 100,
	mustMatch: false,
	extraParams: {},
	selectFirst: true,
	formatItem: function(row) { return row[0]; },
	formatMatch: null,
	autoFill: false,
	width: 0,
	multiple: false,
	multipleSeparator: ", ",
	highlight: function(value, term) {
		return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>");
	},
    scroll: true,
    scrollHeight: 180
};

$.Autocompleter.Cache = function(options) {

	var data = {};
	var length = 0;
	
	function matchSubset(s, sub) {
		if (!options.matchCase) 
			s = s.toLowerCase();
		var i = s.indexOf(sub);
		if (i == -1) return false;
		return i == 0 || options.matchContains;
	};
	
	function add(q, value) {
		if (length > options.cacheLength){
			flush();
		}
		if (!data[q]){ 
			length++;
		}
		data[q] = value;
	}
	
	function populate(){
		if( !options.data ) return false;
		// track the matches
		var stMatchSets = {},
			nullData = 0;

		// no url was specified, we need to adjust the cache length to make sure it fits the local data store
		if( !options.url ) options.cacheLength = 1;
		
		// track all options for minChars = 0
		stMatchSets[""] = [];
		
		// loop through the array and create a lookup structure
		for ( var i = 0, ol = options.data.length; i < ol; i++ ) {
			var rawValue = options.data[i];
			// if rawValue is a string, make an array otherwise just reference the array
			rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue;
			
			var value = options.formatMatch(rawValue, i+1, options.data.length);
			if ( value === false )
				continue;
				
			var firstChar = value.charAt(0).toLowerCase();
			// if no lookup array for this character exists, look it up now
			if( !stMatchSets[firstChar] ) 
				stMatchSets[firstChar] = [];

			// if the match is a string
			var row = {
				value: value,
				data: rawValue,
				result: options.formatResult && options.formatResult(rawValue) || value
			};
			
			// push the current match into the set list
			stMatchSets[firstChar].push(row);

			// keep track of minChars zero items
			if ( nullData++ < options.max ) {
				stMatchSets[""].push(row);
			}
		};

		// add the data items to the cache
		$.each(stMatchSets, function(i, value) {
			// increase the cache size
			options.cacheLength++;
			// add to the cache
			add(i, value);
		});
	}
	
	// populate any existing data
	setTimeout(populate, 25);
	
	function flush(){
		data = {};
		length = 0;
	}
	
	return {
		flush: flush,
		add: add,
		populate: populate,
		load: function(q) {
			if (!options.cacheLength || !length)
				return null;
			/* 
			 * if dealing w/local data and matchContains than we must make sure
			 * to loop through all the data collections looking for matches
			 */
			if( !options.url && options.matchContains ){
				// track all matches
				var csub = [];
				// loop through all the data grids for matches
				for( var k in data ){
					// don't search through the stMatchSets[""] (minChars: 0) cache
					// this prevents duplicates
					if( k.length > 0 ){
						var c = data[k];
						$.each(c, function(i, x) {
							// if we've got a match, add it to the array
							if (matchSubset(x.value, q)) {
								csub.push(x);
							}
						});
					}
				}				
				return csub;
			} else 
			// if the exact item exists, use it
			if (data[q]){
				return data[q];
			} else
			if (options.matchSubset) {
				for (var i = q.length - 1; i >= options.minChars; i--) {
					var c = data[q.substr(0, i)];
					if (c) {
						var csub = [];
						$.each(c, function(i, x) {
							if (matchSubset(x.value, q)) {
								csub[csub.length] = x;
							}
						});
						return csub;
					}
				}
			}
			return null;
		}
	};
};

$.Autocompleter.Select = function (options, input, select, config) {
	var CLASSES = {
		ACTIVE: "ac_over"
	};
	
	var listItems,
		active = -1,
		data,
		term = "",
		needsInit = true,
		element,
		list;
	
	// Create results
	function init() {
		if (!needsInit)
			return;
		element = $("<div/>")
		.hide()
		.addClass(options.resultsClass)
		.css("position", "absolute")
		.appendTo(document.body);
	
		list = $("<ul/>").appendTo(element).mouseover( function(event) {
			if(target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') {
	            active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event));
			    $(target(event)).addClass(CLASSES.ACTIVE);            
	        }
		}).click(function(event) {
			$(target(event)).addClass(CLASSES.ACTIVE);
			select();
			// TODO provide option to avoid setting focus again after selection? useful for cleanup-on-focus
			input.focus();
			return false;
		}).mousedown(function() {
			config.mouseDownOnSelect = true;
		}).mouseup(function() {
			config.mouseDownOnSelect = false;
		});
		
		if( options.width > 0 )
			element.css("width", options.width);
			
		needsInit = false;
	} 
	
	function target(event) {
		var element = event.target;
		while(element && element.tagName != "LI")
			element = element.parentNode;
		// more fun with IE, sometimes event.target is empty, just ignore it then
		if(!element)
			return [];
		return element;
	}

	function moveSelect(step) {
		listItems.slice(active, active + 1).removeClass(CLASSES.ACTIVE);
		movePosition(step);
        var activeItem = listItems.slice(active, active + 1).addClass(CLASSES.ACTIVE);
        if(options.scroll) {
            var offset = 0;
            listItems.slice(0, active).each(function() {
				offset += this.offsetHeight;
			});
            if((offset + activeItem[0].offsetHeight - list.scrollTop()) > list[0].clientHeight) {
                list.scrollTop(offset + activeItem[0].offsetHeight - list.innerHeight());
            } else if(offset < list.scrollTop()) {
                list.scrollTop(offset);
            }
        }
	};
	
	function movePosition(step) {
		active += step;
		if (active < 0) {
			active = listItems.size() - 1;
		} else if (active >= listItems.size()) {
			active = 0;
		}
	}
	
	function limitNumberOfItems(available) {
		return options.max && options.max < available
			? options.max
			: available;
	}
	
	function fillList() {
		list.empty();
		var max = limitNumberOfItems(data.length);
		for (var i=0; i < max; i++) {
			if (!data[i])
				continue;
			var formatted = options.formatItem(data[i].data, i+1, max, data[i].value, term);
			if ( formatted === false )
				continue;
			var li = $("<li/>").html( options.highlight(formatted, term) ).addClass(i%2 == 0 ? "ac_even" : "ac_odd").appendTo(list)[0];
			$.data(li, "ac_data", data[i]);
		}
		listItems = list.find("li");
		if ( options.selectFirst ) {
			listItems.slice(0, 1).addClass(CLASSES.ACTIVE);
			active = 0;
		}
		// apply bgiframe if available
		if ( $.fn.bgiframe )
			list.bgiframe();
	}
	
	return {
		display: function(d, q) {
			init();
			data = d;
			term = q;
			fillList();
		},
		next: function() {
			moveSelect(1);
		},
		prev: function() {
			moveSelect(-1);
		},
		pageUp: function() {
			if (active != 0 && active - 8 < 0) {
				moveSelect( -active );
			} else {
				moveSelect(-8);
			}
		},
		pageDown: function() {
			if (active != listItems.size() - 1 && active + 8 > listItems.size()) {
				moveSelect( listItems.size() - 1 - active );
			} else {
				moveSelect(8);
			}
		},
		hide: function() {
			element && element.hide();
			listItems && listItems.removeClass(CLASSES.ACTIVE);
			active = -1;
		},
		visible : function() {
			return element && element.is(":visible");
		},
		current: function() {
			return this.visible() && (listItems.filter("." + CLASSES.ACTIVE)[0] || options.selectFirst && listItems[0]);
		},
		show: function() {
			var offset = $(input).offset();
			element.css({
				width: typeof options.width == "string" || options.width > 0 ? options.width : $(input).width(),
				top: offset.top + input.offsetHeight,
				left: offset.left
			}).show();
            if(options.scroll) {
                list.scrollTop(0);
                list.css({
					maxHeight: options.scrollHeight,
					overflow: 'auto'
				});
				
                if($.browser.msie && typeof document.body.style.maxHeight === "undefined") {
					var listHeight = 0;
					listItems.each(function() {
						listHeight += this.offsetHeight;
					});
					var scrollbarsVisible = listHeight > options.scrollHeight;
                    list.css('height', scrollbarsVisible ? options.scrollHeight : listHeight );
					if (!scrollbarsVisible) {
						// IE doesn't recalculate width when scrollbar disappears
						listItems.width( list.width() - parseInt(listItems.css("padding-left")) - parseInt(listItems.css("padding-right")) );
					}
                }
                
            }
		},
		selected: function() {
			var selected = listItems && listItems.filter("." + CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE);
			return selected && selected.length && $.data(selected[0], "ac_data");
		},
		emptyList: function (){
			list && list.empty();
		},
		unbind: function() {
			element && element.remove();
		}
	};
};

$.Autocompleter.Selection = function(field, start, end) {
	if( field.createTextRange ){
		var selRange = field.createTextRange();
		selRange.collapse(true);
		selRange.moveStart("character", start);
		selRange.moveEnd("character", end);
		selRange.select();
	} else if( field.setSelectionRange ){
		field.setSelectionRange(start, end);
	} else {
		if( field.selectionStart ){
			field.selectionStart = start;
			field.selectionEnd = end;
		}
	}
	field.focus();
};

})(jQuery);function ZooLooSearch() {
	this.setup = function() {
	    $('#search-form-category').click(function(e) {
	        if ($('#z_search_dropdown_menu').is(':hidden')) {
	            $('#z_search_dropdown_menu').slideDown('fast');
	        } else {
	            $('#z_search_dropdown_menu').slideUp('fast');
	        }
	        e.preventDefault();
	    });

	    $('.dropDownLink').click(function(e) {
	        $('#search-form-category').html($(this).html());
	        $('#z_search_dropdown_menu').slideUp('fast');
	        if($(this).html() == 'ZooLoo') {
				var formId = 'zooloo_sites';
	        } else {
	        	var formId = $(this).html();
	        }
	        var searchWord =$('#fw_search_menu_form form:visible :text').val();
	        $('#fw_search_menu_form form').hide();
	        $('#search_form_' + formId).show().find(':text').val(searchWord);
	        ZFramework.zfAjaxPost('/zConnect/setSearchType', {
	            search_type: $(this).html()
	        }, false, function(response){
	        }, function(){
	        });
	        e.preventDefault();
	    });
	    var commitForm = false;

	    $("#z_search_form").submit(function() {
			return commitForm;
	    });

		$('#z_search_input').keyup(function(event){
			event = event || window.event;
			if (event.keyCode == 13) {
				$('#z_search_button').trigger('click');
			}
			event.preventDefault();
		});

	    $('#z_search_button').click(function(event) {
	        var type = $('#search-form-category').html();
	        if(type == 'ZooLoo') {
				type = 'zooloo_sites';
	        }
	        $('#search_form_' + type).submit();
	        event.preventDefault();
	    });
	};
}
var ZSearch = new ZooLooSearch();