$(document).ready(function(){var actionLinkEffectNew=function(opener){var successMessage=$("<span class='successLabel'>"+opener.attr("data-successMessage")+"</span>");opener.wrapInner("<span class='defaultLabel' />");var defaultLabel=opener.find(".defaultLabel").css("display","none");opener.append(successMessage);successMessage.css("color","green").fadeIn("slow").delay("1500").fadeOut("slow");defaultLabel.delay("2000").fadeIn();};var fadeItemOut=function(opener){opener.parents(".item").fadeOut();};var removeItem=function(opener){opener.parents(".item").remove();};var decreaseCountAndFadeOut=function(opener){opener.parents(".item").fadeOut();var page=opener.parents(".page");var brandContext="";var mode="";if(page.hasClass("offered")){mode="offered";}
if(page.hasClass("wanted")){mode="wanted";}
if(page.hasClass("b2d")){brandContext="b2d";}
if(page.hasClass("a2d")){brandContext="a2d";}
if(page.hasClass("s2d")){brandContext="s2d";}
if(page.hasClass("l2d")){brandContext="l2d";}
if(page.hasClass("v2d")){brandContext="v2d";}
var counterToDecrease=".counter."+mode+"."+brandContext+" .count";var newCount=$(counterToDecrease).html()-1;$(counterToDecrease).html(newCount);};$(".addToFavorites").newSimpleRequestDialogOpener(actionLinkEffectNew);$(".deletableNew .delete").newSimpleRequestDialogOpener(fadeItemOut);$(".deletableNew .deleteButton").newSimpleRequestDialogOpener(removeItem);$(".groups .confirmGroupmembership").newSimpleRequestDialogOpener(fadeItemOut);});jQuery(function($){$.fn.fcbkcomplete=function(opt){return this.each(function(){function init(){createFCBK();preSet();addInput(0);}
function createFCBK(){element.hide();element.attr("multiple","multiple");if(element.attr("name").indexOf("[]")==-1){element.attr("name",element.attr("name")+"[]");}
holder=$(document.createElement("ul"));holder.attr("class","holder");if(options.attachto){if(typeof(options.attachto)=="object"){options.attachto.append(holder);}
else{$(options.attachto).append(holder);}}
else{element.after(holder);}
complete=$(document.createElement("div"));complete.addClass("facebook-auto");complete.append('<div class="default">'+options.complete_text+"</div>");complete.hover(function(){options.complete_hover=0;},function(){options.complete_hover=1;});feed=$(document.createElement("ul"));feed.attr("id",elemid+"_feed");complete.prepend(feed);holder.after(complete);feed.css("width",complete.width());}
function preSet(){element.children("option").each(function(i,option){option=$(option);if(option.hasClass("selected")){addItem(option.text(),option.val(),true,option.hasClass("locked"));option.attr("selected","selected");}
cache.push({key:option.text(),value:option.val()});search_string+=""+(cache.length-1)+":"+option.text()+";";});}
$(this).bind("addItem",function(event,data){addItem(data.title,data.value,0,0,0);});$(this).bind("removeItem",function(event,data){var item=holder.children('li[rel='+data.value+']');if(item.length){removeItem(item);}});$(this).bind("destroy",function(event,data){holder.remove();complete.remove();element.show();});function addItem(title,value,preadded,locked,focusme){if(!maxItems()){return false;}
var li=document.createElement("li");var txt=document.createTextNode(title);var aclose=document.createElement("a");var liclass="bit-box"+(locked?" locked":"");$(li).attr({"class":liclass,"rel":value});$(li).prepend(txt);$(aclose).attr({"class":"closebutton","href":"#"});li.appendChild(aclose);holder.append(li);$(aclose).click(function(){removeItem($(this).parent("li"));return false;});if(!preadded){$("#"+elemid+"_annoninput").remove();var _item;addInput(focusme);if(element.children("option[value="+value+"]").length){_item=element.children("option[value="+value+"]");_item.get(0).setAttribute("selected","selected");_item.attr("selected","selected");if(!_item.hasClass("selected")){_item.addClass("selected");}}
else{var _item=$(document.createElement("option"));_item.attr("value",value).get(0).setAttribute("selected","selected");_item.attr("value",value).attr("selected","selected");_item.attr("value",value).addClass("selected");_item.text(title);element.append(_item);}
if(options.onselect){funCall(options.onselect,_item)}
element.change();}
holder.children("li.bit-box.deleted").removeClass("deleted");feed.hide();}
function removeItem(item){if(!item.hasClass('locked')){item.fadeOut("fast");if(options.onremove){var _item=element.children("option[value="+item.attr("rel")+"]");funCall(options.onremove,_item)}
element.children('option[value="'+item.attr("rel")+'"]').removeAttr("selected").removeClass("selected");item.remove();element.change();deleting=0;}}
function addInput(focusme){var li=$(document.createElement("li"));var input=$(document.createElement("input"));var getBoxTimeout=0;li.attr({"class":"bit-input","id":elemid+"_annoninput"});input.attr({"type":"text","class":"maininput","size":"1"});holder.append(li.append(input));input.focus(function(){complete.fadeIn("fast");});input.blur(function(){if(options.complete_hover){complete.fadeOut("fast");}
else{input.focus();}});holder.click(function(){input.focus();if(feed.length&&input.val().length){feed.show();}
else{feed.hide();complete.children(".default").show();}});input.keypress(function(event){if(event.keyCode==13){return false;}
input.attr("size",input.val().length+1);});input.keydown(function(event){if(event.keyCode==191){event.preventDefault();return false;}});input.keyup(function(event){var etext=xssPrevent(input.val());if(event.keyCode==8&&etext.length==0){feed.hide();if(!holder.children("li.bit-box:last").hasClass('locked')){if(holder.children("li.bit-box.deleted").length==0){holder.children("li.bit-box:last").addClass("deleted");return false;}
else{if(deleting){return;}
deleting=1;holder.children("li.bit-box.deleted").fadeOut("fast",function(){removeItem($(this));return false;});}}}
if(event.keyCode!=40&&event.keyCode!=38&&event.keyCode!=37&&event.keyCode!=39&&etext.length!=0){counter=0;if(options.json_url){if(options.cache&&json_cache){addMembers(etext);bindEvents();}
else{getBoxTimeout++;var getBoxTimeoutValue=getBoxTimeout;setTimeout(function(){if(getBoxTimeoutValue!=getBoxTimeout)return;$.getJSON(options.json_url,{tag:etext},function(data){addMembers(etext,data);json_cache=true;bindEvents();});},options.delay);}}
else{addMembers(etext);bindEvents();}
complete.children(".default").hide();feed.show();}});if(focusme){setTimeout(function(){input.focus();complete.children(".default").show();},1);}}
function addMembers(etext,data){feed.html('');if(!options.cache&&data!=null){cache=new Array();search_string="";}
addTextItem(etext);if(data!=null&&data.length){$.each(data,function(i,val){cache.push({key:val.key,value:val.value});search_string+=""+(cache.length-1)+":"+val.key+";";});}
var maximum=options.maxshownitems<cache.length?options.maxshownitems:cache.length;var filter="i";if(options.filter_case){filter="";}
var myregexp,match;try{myregexp=eval('/(?:^|;)\\s*(\\d+)\\s*:[^;]*?'+etext+'[^;]*/g'+filter);match=myregexp.exec(search_string);}
catch(ex){};var content='';while(match!=null&&maximum>0){var id=match[1];var object=cache[id];if(options.filter_selected&&element.children("option[value="+object.value+"]").hasClass("selected")){}
else{content+='<li rel="'+object.value+'">'+itemIllumination(object.key,etext)+'</li>';counter++;maximum--;}
match=myregexp.exec(search_string);}
feed.append(content);if(options.firstselected){focuson=feed.children("li:visible:first");focuson.addClass("auto-focus");}
if(counter>options.height){feed.css({"height":(options.height*24)+"px","overflow":"auto"});}
else{feed.css("height","auto");}}
function itemIllumination(text,etext){if(options.filter_case){try{eval("var text = text.replace(/(.*)("+etext+")(.*)/gi,'$1<em>$2</em>$3');");}
catch(ex){};}
else{try{eval("var text = text.replace(/(.*)("+etext.toLowerCase()+")(.*)/gi,'$1<em>$2</em>$3');");}
catch(ex){};}
return text;}
function bindFeedEvent(){feed.children("li").mouseover(function(){feed.children("li").removeClass("auto-focus");$(this).addClass("auto-focus");focuson=$(this);});feed.children("li").mouseout(function(){$(this).removeClass("auto-focus");focuson=null;});}
function removeFeedEvent(){feed.children("li").unbind("mouseover");feed.children("li").unbind("mouseout");feed.mousemove(function(){bindFeedEvent();feed.unbind("mousemove");});}
function bindEvents(){var maininput=$("#"+elemid+"_annoninput").children(".maininput");bindFeedEvent();feed.children("li").unbind("mousedown");feed.children("li").mousedown(function(){var option=$(this);addItem(option.text(),option.attr("rel"),0,0,1);feed.hide();complete.hide();});maininput.unbind("keydown");maininput.keydown(function(event){if(event.keyCode==191){event.preventDefault();return false;}
if(event.keyCode!=8){holder.children("li.bit-box.deleted").removeClass("deleted");}
if((event.keyCode==13||event.keyCode==9)&&checkFocusOn()){var option=focuson;addItem(option.text(),option.attr("rel"),0,0,1);complete.hide();event.preventDefault();focuson=null;return false;}
if((event.keyCode==13||event.keyCode==9)&&!checkFocusOn()){if(options.newel){var value=xssPrevent($(this).val());addItem(value,value,0,0,1);complete.hide();event.preventDefault();focuson=null;return false;}
if(options.addontab){focuson=feed.children("li:visible:first");var option=focuson;addItem(option.text(),option.attr("rel"),0,0,1);complete.hide();event.preventDefault();focuson=null;return false;}}
if(event.keyCode==40){removeFeedEvent();if(focuson==null||focuson.length==0){focuson=feed.children("li:visible:first");feed.get(0).scrollTop=0;}
else{focuson.removeClass("auto-focus");focuson=focuson.nextAll("li:visible:first");var prev=parseInt(focuson.prevAll("li:visible").length,10);var next=parseInt(focuson.nextAll("li:visible").length,10);if((prev>Math.round(options.height/2)||next<=Math.round(options.height/2))&&typeof(focuson.get(0))!="undefined"){feed.get(0).scrollTop=parseInt(focuson.get(0).scrollHeight,10)*(prev-Math.round(options.height/2));}}
feed.children("li").removeClass("auto-focus");focuson.addClass("auto-focus");}
if(event.keyCode==38){removeFeedEvent();if(focuson==null||focuson.length==0){focuson=feed.children("li:visible:last");feed.get(0).scrollTop=parseInt(focuson.get(0).scrollHeight,10)*(parseInt(feed.children("li:visible").length,10)-Math.round(options.height/2));}
else{focuson.removeClass("auto-focus");focuson=focuson.prevAll("li:visible:first");var prev=parseInt(focuson.prevAll("li:visible").length,10);var next=parseInt(focuson.nextAll("li:visible").length,10);if((next>Math.round(options.height/2)||prev<=Math.round(options.height/2))&&typeof(focuson.get(0))!="undefined"){feed.get(0).scrollTop=parseInt(focuson.get(0).scrollHeight,10)*(prev-Math.round(options.height/2));}}
feed.children("li").removeClass("auto-focus");focuson.addClass("auto-focus");}});}
function maxItems(){if(options.maxitems!=0){if(holder.children("li.bit-box").length<options.maxitems){return true;}
else{return false;}}}
function addTextItem(value){if(options.newel&&maxItems()){feed.children("li[fckb=1]").remove();if(value.length==0){return;}
var li=$(document.createElement("li"));li.attr({"rel":value,"fckb":"1"}).html(value);feed.prepend(li);counter++;}
else{return;}}
function funCall(func,item){var _object="";for(i=0;i<item.get(0).attributes.length;i++){if(item.get(0).attributes[i].nodeValue!=null){_object+="\"_"+item.get(0).attributes[i].nodeName+"\": \""+item.get(0).attributes[i].nodeValue+"\",";}}
_object="{"+_object+" notinuse: 0}";func.call(func,_object);}
function checkFocusOn(){if(focuson==null){return false;}
if(focuson.length==0){return false;}
return true;}
function xssPrevent(string){string=string.replace(/[\"\'][\s]*javascript:(.*)[\"\']/g,"\"\"");string=string.replace(/script(.*)/g,"");string=string.replace(/eval\((.*)\)/g,"");string=string.replace('/([\x00-\x08,\x0b-\x0c,\x0e-\x19])/','');return string;}
var options=$.extend({json_url:null,cache:false,height:"10",newel:false,addontab:false,firstselected:false,filter_case:false,filter_selected:false,complete_text:"Start to type...",maxshownitems:30,maxitems:10,onselect:null,onremove:null,attachto:null,delay:350},opt);var holder=null;var feed=null;var complete=null;var counter=0;var cache=new Array();var json_cache=false;var search_string="";var focuson=null;var deleting=0;var complete_hover=1;var element=$(this);var elemid=element.attr("id");init();return this;});};});var Handlebars={};Handlebars.VERSION="1.0.beta.6";Handlebars.helpers={};Handlebars.partials={};Handlebars.registerHelper=function(name,fn,inverse){if(inverse){fn.not=inverse;}
this.helpers[name]=fn;};Handlebars.registerPartial=function(name,str){this.partials[name]=str;};Handlebars.registerHelper('helperMissing',function(arg){if(arguments.length===2){return undefined;}else{throw new Error("Could not find property '"+arg+"'");}});var toString=Object.prototype.toString,functionType="[object Function]";Handlebars.registerHelper('blockHelperMissing',function(context,options){var inverse=options.inverse||function(){},fn=options.fn;var ret="";var type=toString.call(context);if(type===functionType){context=context.call(this);}
if(context===true){return fn(this);}else if(context===false||context==null){return inverse(this);}else if(type==="[object Array]"){if(context.length>0){for(var i=0,j=context.length;i<j;i++){ret=ret+fn(context[i]);}}else{ret=inverse(this);}
return ret;}else{return fn(context);}});Handlebars.registerHelper('each',function(context,options){var fn=options.fn,inverse=options.inverse;var ret="";if(context&&context.length>0){for(var i=0,j=context.length;i<j;i++){ret=ret+fn(context[i]);}}else{ret=inverse(this);}
return ret;});Handlebars.registerHelper('if',function(context,options){var type=toString.call(context);if(type===functionType){context=context.call(this);}
if(!context||Handlebars.Utils.isEmpty(context)){return options.inverse(this);}else{return options.fn(this);}});Handlebars.registerHelper('unless',function(context,options){var fn=options.fn,inverse=options.inverse;options.fn=inverse;options.inverse=fn;return Handlebars.helpers['if'].call(this,context,options);});Handlebars.registerHelper('with',function(context,options){return options.fn(context);});Handlebars.registerHelper('log',function(context){Handlebars.log(context);});;var handlebars=(function(){var parser={trace:function trace(){},yy:{},symbols_:{"error":2,"root":3,"program":4,"EOF":5,"statements":6,"simpleInverse":7,"statement":8,"openInverse":9,"closeBlock":10,"openBlock":11,"mustache":12,"partial":13,"CONTENT":14,"COMMENT":15,"OPEN_BLOCK":16,"inMustache":17,"CLOSE":18,"OPEN_INVERSE":19,"OPEN_ENDBLOCK":20,"path":21,"OPEN":22,"OPEN_UNESCAPED":23,"OPEN_PARTIAL":24,"params":25,"hash":26,"param":27,"STRING":28,"INTEGER":29,"BOOLEAN":30,"hashSegments":31,"hashSegment":32,"ID":33,"EQUALS":34,"pathSegments":35,"SEP":36,"$accept":0,"$end":1},terminals_:{2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"OPEN_PARTIAL",28:"STRING",29:"INTEGER",30:"BOOLEAN",33:"ID",34:"EQUALS",36:"SEP"},productions_:[0,[3,2],[4,3],[4,1],[4,0],[6,1],[6,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,3],[13,4],[7,2],[17,3],[17,2],[17,2],[17,1],[25,2],[25,1],[27,1],[27,1],[27,1],[27,1],[26,1],[31,2],[31,1],[32,3],[32,3],[32,3],[32,3],[21,1],[35,3],[35,1]],performAction:function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$){var $0=$$.length-1;switch(yystate){case 1:return $$[$0-1]
break;case 2:this.$=new yy.ProgramNode($$[$0-2],$$[$0])
break;case 3:this.$=new yy.ProgramNode($$[$0])
break;case 4:this.$=new yy.ProgramNode([])
break;case 5:this.$=[$$[$0]]
break;case 6:$$[$0-1].push($$[$0]);this.$=$$[$0-1]
break;case 7:this.$=new yy.InverseNode($$[$0-2],$$[$0-1],$$[$0])
break;case 8:this.$=new yy.BlockNode($$[$0-2],$$[$0-1],$$[$0])
break;case 9:this.$=$$[$0]
break;case 10:this.$=$$[$0]
break;case 11:this.$=new yy.ContentNode($$[$0])
break;case 12:this.$=new yy.CommentNode($$[$0])
break;case 13:this.$=new yy.MustacheNode($$[$0-1][0],$$[$0-1][1])
break;case 14:this.$=new yy.MustacheNode($$[$0-1][0],$$[$0-1][1])
break;case 15:this.$=$$[$0-1]
break;case 16:this.$=new yy.MustacheNode($$[$0-1][0],$$[$0-1][1])
break;case 17:this.$=new yy.MustacheNode($$[$0-1][0],$$[$0-1][1],true)
break;case 18:this.$=new yy.PartialNode($$[$0-1])
break;case 19:this.$=new yy.PartialNode($$[$0-2],$$[$0-1])
break;case 20:break;case 21:this.$=[[$$[$0-2]].concat($$[$0-1]),$$[$0]]
break;case 22:this.$=[[$$[$0-1]].concat($$[$0]),null]
break;case 23:this.$=[[$$[$0-1]],$$[$0]]
break;case 24:this.$=[[$$[$0]],null]
break;case 25:$$[$0-1].push($$[$0]);this.$=$$[$0-1];break;case 26:this.$=[$$[$0]]
break;case 27:this.$=$$[$0]
break;case 28:this.$=new yy.StringNode($$[$0])
break;case 29:this.$=new yy.IntegerNode($$[$0])
break;case 30:this.$=new yy.BooleanNode($$[$0])
break;case 31:this.$=new yy.HashNode($$[$0])
break;case 32:$$[$0-1].push($$[$0]);this.$=$$[$0-1]
break;case 33:this.$=[$$[$0]]
break;case 34:this.$=[$$[$0-2],$$[$0]]
break;case 35:this.$=[$$[$0-2],new yy.StringNode($$[$0])]
break;case 36:this.$=[$$[$0-2],new yy.IntegerNode($$[$0])]
break;case 37:this.$=[$$[$0-2],new yy.BooleanNode($$[$0])]
break;case 38:this.$=new yy.IdNode($$[$0])
break;case 39:$$[$0-2].push($$[$0]);this.$=$$[$0-2];break;case 40:this.$=[$$[$0]]
break;}},table:[{3:1,4:2,5:[2,4],6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{1:[3]},{5:[1,16]},{5:[2,3],7:17,8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,19],20:[2,3],22:[1,13],23:[1,14],24:[1,15]},{5:[2,5],14:[2,5],15:[2,5],16:[2,5],19:[2,5],20:[2,5],22:[2,5],23:[2,5],24:[2,5]},{4:20,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{4:21,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],24:[2,9]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],24:[2,10]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],24:[2,11]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],24:[2,12]},{17:22,21:23,33:[1,25],35:24},{17:26,21:23,33:[1,25],35:24},{17:27,21:23,33:[1,25],35:24},{17:28,21:23,33:[1,25],35:24},{21:29,33:[1,25],35:24},{1:[2,1]},{6:30,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{5:[2,6],14:[2,6],15:[2,6],16:[2,6],19:[2,6],20:[2,6],22:[2,6],23:[2,6],24:[2,6]},{17:22,18:[1,31],21:23,33:[1,25],35:24},{10:32,20:[1,33]},{10:34,20:[1,33]},{18:[1,35]},{18:[2,24],21:40,25:36,26:37,27:38,28:[1,41],29:[1,42],30:[1,43],31:39,32:44,33:[1,45],35:24},{18:[2,38],28:[2,38],29:[2,38],30:[2,38],33:[2,38],36:[1,46]},{18:[2,40],28:[2,40],29:[2,40],30:[2,40],33:[2,40],36:[2,40]},{18:[1,47]},{18:[1,48]},{18:[1,49]},{18:[1,50],21:51,33:[1,25],35:24},{5:[2,2],8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,2],22:[1,13],23:[1,14],24:[1,15]},{14:[2,20],15:[2,20],16:[2,20],19:[2,20],22:[2,20],23:[2,20],24:[2,20]},{5:[2,7],14:[2,7],15:[2,7],16:[2,7],19:[2,7],20:[2,7],22:[2,7],23:[2,7],24:[2,7]},{21:52,33:[1,25],35:24},{5:[2,8],14:[2,8],15:[2,8],16:[2,8],19:[2,8],20:[2,8],22:[2,8],23:[2,8],24:[2,8]},{14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],24:[2,14]},{18:[2,22],21:40,26:53,27:54,28:[1,41],29:[1,42],30:[1,43],31:39,32:44,33:[1,45],35:24},{18:[2,23]},{18:[2,26],28:[2,26],29:[2,26],30:[2,26],33:[2,26]},{18:[2,31],32:55,33:[1,56]},{18:[2,27],28:[2,27],29:[2,27],30:[2,27],33:[2,27]},{18:[2,28],28:[2,28],29:[2,28],30:[2,28],33:[2,28]},{18:[2,29],28:[2,29],29:[2,29],30:[2,29],33:[2,29]},{18:[2,30],28:[2,30],29:[2,30],30:[2,30],33:[2,30]},{18:[2,33],33:[2,33]},{18:[2,40],28:[2,40],29:[2,40],30:[2,40],33:[2,40],34:[1,57],36:[2,40]},{33:[1,58]},{14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],24:[2,13]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],24:[2,16]},{5:[2,17],14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],24:[2,17]},{5:[2,18],14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],24:[2,18]},{18:[1,59]},{18:[1,60]},{18:[2,21]},{18:[2,25],28:[2,25],29:[2,25],30:[2,25],33:[2,25]},{18:[2,32],33:[2,32]},{34:[1,57]},{21:61,28:[1,62],29:[1,63],30:[1,64],33:[1,25],35:24},{18:[2,39],28:[2,39],29:[2,39],30:[2,39],33:[2,39],36:[2,39]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],24:[2,19]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],24:[2,15]},{18:[2,34],33:[2,34]},{18:[2,35],33:[2,35]},{18:[2,36],33:[2,36]},{18:[2,37],33:[2,37]}],defaultActions:{16:[2,1],37:[2,23],53:[2,21]},parseError:function parseError(str,hash){throw new Error(str);},parse:function parse(input){var self=this,stack=[0],vstack=[null],lstack=[],table=this.table,yytext="",yylineno=0,yyleng=0,recovering=0,TERROR=2,EOF=1;this.lexer.setInput(input);this.lexer.yy=this.yy;this.yy.lexer=this.lexer;if(typeof this.lexer.yylloc=="undefined")
this.lexer.yylloc={};var yyloc=this.lexer.yylloc;lstack.push(yyloc);if(typeof this.yy.parseError==="function")
this.parseError=this.yy.parseError;function popStack(n){stack.length=stack.length-2*n;vstack.length=vstack.length-n;lstack.length=lstack.length-n;}
function lex(){var token;token=self.lexer.lex()||1;if(typeof token!=="number"){token=self.symbols_[token]||token;}
return token;}
var symbol,preErrorSymbol,state,action,a,r,yyval={},p,len,newState,expected;while(true){state=stack[stack.length-1];if(this.defaultActions[state]){action=this.defaultActions[state];}else{if(symbol==null)
symbol=lex();action=table[state]&&table[state][symbol];}
if(typeof action==="undefined"||!action.length||!action[0]){if(!recovering){expected=[];for(p in table[state])
if(this.terminals_[p]&&p>2){expected.push("'"+this.terminals_[p]+"'");}
var errStr="";if(this.lexer.showPosition){errStr="Parse error on line "+(yylineno+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+expected.join(", ")+", got '"+this.terminals_[symbol]+"'";}else{errStr="Parse error on line "+(yylineno+1)+": Unexpected "+(symbol==1?"end of input":"'"+(this.terminals_[symbol]||symbol)+"'");}
this.parseError(errStr,{text:this.lexer.match,token:this.terminals_[symbol]||symbol,line:this.lexer.yylineno,loc:yyloc,expected:expected});}}
if(action[0]instanceof Array&&action.length>1){throw new Error("Parse Error: multiple actions possible at state: "+state+", token: "+symbol);}
switch(action[0]){case 1:stack.push(symbol);vstack.push(this.lexer.yytext);lstack.push(this.lexer.yylloc);stack.push(action[1]);symbol=null;if(!preErrorSymbol){yyleng=this.lexer.yyleng;yytext=this.lexer.yytext;yylineno=this.lexer.yylineno;yyloc=this.lexer.yylloc;if(recovering>0)
recovering--;}else{symbol=preErrorSymbol;preErrorSymbol=null;}
break;case 2:len=this.productions_[action[1]][1];yyval.$=vstack[vstack.length-len];yyval._$={first_line:lstack[lstack.length-(len||1)].first_line,last_line:lstack[lstack.length-1].last_line,first_column:lstack[lstack.length-(len||1)].first_column,last_column:lstack[lstack.length-1].last_column};r=this.performAction.call(yyval,yytext,yyleng,yylineno,this.yy,action[1],vstack,lstack);if(typeof r!=="undefined"){return r;}
if(len){stack=stack.slice(0,-1*len*2);vstack=vstack.slice(0,-1*len);lstack=lstack.slice(0,-1*len);}
stack.push(this.productions_[action[1]][0]);vstack.push(yyval.$);lstack.push(yyval._$);newState=table[stack[stack.length-2]][stack[stack.length-1]];stack.push(newState);break;case 3:return true;}}
return true;}};var lexer=(function(){var lexer=({EOF:1,parseError:function parseError(str,hash){if(this.yy.parseError){this.yy.parseError(str,hash);}else{throw new Error(str);}},setInput:function(input){this._input=input;this._more=this._less=this.done=false;this.yylineno=this.yyleng=0;this.yytext=this.matched=this.match='';this.conditionStack=['INITIAL'];this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0};return this;},input:function(){var ch=this._input[0];this.yytext+=ch;this.yyleng++;this.match+=ch;this.matched+=ch;var lines=ch.match(/\n/);if(lines)this.yylineno++;this._input=this._input.slice(1);return ch;},unput:function(ch){this._input=ch+this._input;return this;},more:function(){this._more=true;return this;},pastInput:function(){var past=this.matched.substr(0,this.matched.length-this.match.length);return(past.length>20?'...':'')+past.substr(-20).replace(/\n/g,"");},upcomingInput:function(){var next=this.match;if(next.length<20){next+=this._input.substr(0,20-next.length);}
return(next.substr(0,20)+(next.length>20?'...':'')).replace(/\n/g,"");},showPosition:function(){var pre=this.pastInput();var c=new Array(pre.length+1).join("-");return pre+this.upcomingInput()+"\n"+c+"^";},next:function(){if(this.done){return this.EOF;}
if(!this._input)this.done=true;var token,match,col,lines;if(!this._more){this.yytext='';this.match='';}
var rules=this._currentRules();for(var i=0;i<rules.length;i++){match=this._input.match(this.rules[rules[i]]);if(match){lines=match[0].match(/\n.*/g);if(lines)this.yylineno+=lines.length;this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:lines?lines[lines.length-1].length-1:this.yylloc.last_column+match[0].length}
this.yytext+=match[0];this.match+=match[0];this.matches=match;this.yyleng=this.yytext.length;this._more=false;this._input=this._input.slice(match[0].length);this.matched+=match[0];token=this.performAction.call(this,this.yy,this,rules[i],this.conditionStack[this.conditionStack.length-1]);if(token)return token;else return;}}
if(this._input===""){return this.EOF;}else{this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(),{text:"",token:null,line:this.yylineno});}},lex:function lex(){var r=this.next();if(typeof r!=='undefined'){return r;}else{return this.lex();}},begin:function begin(condition){this.conditionStack.push(condition);},popState:function popState(){return this.conditionStack.pop();},_currentRules:function _currentRules(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;},topState:function(){return this.conditionStack[this.conditionStack.length-2];},pushState:function begin(condition){this.begin(condition);}});lexer.performAction=function anonymous(yy,yy_,$avoiding_name_collisions,YY_START){var YYSTATE=YY_START
switch($avoiding_name_collisions){case 0:if(yy_.yytext.slice(-1)!=="\\")this.begin("mu");if(yy_.yytext.slice(-1)==="\\")yy_.yytext=yy_.yytext.substr(0,yy_.yyleng-1),this.begin("emu");if(yy_.yytext)return 14;break;case 1:return 14;break;case 2:this.popState();return 14;break;case 3:return 24;break;case 4:return 16;break;case 5:return 20;break;case 6:return 19;break;case 7:return 19;break;case 8:return 23;break;case 9:return 23;break;case 10:yy_.yytext=yy_.yytext.substr(3,yy_.yyleng-5);this.popState();return 15;break;case 11:return 22;break;case 12:return 34;break;case 13:return 33;break;case 14:return 33;break;case 15:return 36;break;case 16:break;case 17:this.popState();return 18;break;case 18:this.popState();return 18;break;case 19:yy_.yytext=yy_.yytext.substr(1,yy_.yyleng-2).replace(/\\"/g,'"');return 28;break;case 20:return 30;break;case 21:return 30;break;case 22:return 29;break;case 23:return 33;break;case 24:yy_.yytext=yy_.yytext.substr(1,yy_.yyleng-2);return 33;break;case 25:return'INVALID';break;case 26:return 5;break;}};lexer.rules=[/^[^\x00]*?(?=(\{\{))/,/^[^\x00]+/,/^[^\x00]{2,}?(?=(\{\{))/,/^\{\{>/,/^\{\{#/,/^\{\{\//,/^\{\{\^/,/^\{\{\s*else\b/,/^\{\{\{/,/^\{\{&/,/^\{\{![\s\S]*?\}\}/,/^\{\{/,/^=/,/^\.(?=[} ])/,/^\.\./,/^[\/.]/,/^\s+/,/^\}\}\}/,/^\}\}/,/^"(\\["]|[^"])*"/,/^true(?=[}\s])/,/^false(?=[}\s])/,/^[0-9]+(?=[}\s])/,/^[a-zA-Z0-9_$-]+(?=[=}\s\/.])/,/^\[[^\]]*\]/,/^./,/^$/];lexer.conditions={"mu":{"rules":[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"INITIAL":{"rules":[0,1,26],"inclusive":true}};return lexer;})()
parser.lexer=lexer;return parser;})();if(typeof require!=='undefined'&&typeof exports!=='undefined'){exports.parser=handlebars;exports.parse=function(){return handlebars.parse.apply(handlebars,arguments);}
exports.main=function commonjsMain(args){if(!args[1])
throw new Error('Usage: '+args[0]+' FILE');if(typeof process!=='undefined'){var source=require('fs').readFileSync(require('path').join(process.cwd(),args[1]),"utf8");}else{var cwd=require("file").path(require("file").cwd());var source=cwd.join(args[1]).read({charset:"utf-8"});}
return exports.parser.parse(source);}
if(typeof module!=='undefined'&&require.main===module){exports.main(typeof process!=='undefined'?process.argv.slice(1):require("system").args);}};;Handlebars.Parser=handlebars;Handlebars.parse=function(string){Handlebars.Parser.yy=Handlebars.AST;return Handlebars.Parser.parse(string);};Handlebars.print=function(ast){return new Handlebars.PrintVisitor().accept(ast);};Handlebars.logger={DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(level,str){}};Handlebars.log=function(level,str){Handlebars.logger.log(level,str);};;(function(){Handlebars.AST={};Handlebars.AST.ProgramNode=function(statements,inverse){this.type="program";this.statements=statements;if(inverse){this.inverse=new Handlebars.AST.ProgramNode(inverse);}};Handlebars.AST.MustacheNode=function(params,hash,unescaped){this.type="mustache";this.id=params[0];this.params=params.slice(1);this.hash=hash;this.escaped=!unescaped;};Handlebars.AST.PartialNode=function(id,context){this.type="partial";this.id=id;this.context=context;};var verifyMatch=function(open,close){if(open.original!==close.original){throw new Handlebars.Exception(open.original+" doesn't match "+close.original);}};Handlebars.AST.BlockNode=function(mustache,program,close){verifyMatch(mustache.id,close);this.type="block";this.mustache=mustache;this.program=program;};Handlebars.AST.InverseNode=function(mustache,program,close){verifyMatch(mustache.id,close);this.type="inverse";this.mustache=mustache;this.program=program;};Handlebars.AST.ContentNode=function(string){this.type="content";this.string=string;};Handlebars.AST.HashNode=function(pairs){this.type="hash";this.pairs=pairs;};Handlebars.AST.IdNode=function(parts){this.type="ID";this.original=parts.join(".");var dig=[],depth=0;for(var i=0,l=parts.length;i<l;i++){var part=parts[i];if(part===".."){depth++;}
else if(part==="."||part==="this"){this.isScoped=true;}
else{dig.push(part);}}
this.parts=dig;this.string=dig.join('.');this.depth=depth;this.isSimple=(dig.length===1)&&(depth===0);};Handlebars.AST.StringNode=function(string){this.type="STRING";this.string=string;};Handlebars.AST.IntegerNode=function(integer){this.type="INTEGER";this.integer=integer;};Handlebars.AST.BooleanNode=function(bool){this.type="BOOLEAN";this.bool=bool;};Handlebars.AST.CommentNode=function(comment){this.type="comment";this.comment=comment;};})();;Handlebars.Exception=function(message){var tmp=Error.prototype.constructor.apply(this,arguments);for(var p in tmp){if(tmp.hasOwnProperty(p)){this[p]=tmp[p];}}
this.message=tmp.message;};Handlebars.Exception.prototype=new Error;Handlebars.SafeString=function(string){this.string=string;};Handlebars.SafeString.prototype.toString=function(){return this.string.toString();};(function(){var escape={"<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};var badChars=/&(?!\w+;)|[<>"'`]/g;var possible=/[&<>"'`]/;var escapeChar=function(chr){return escape[chr]||"&amp;";};Handlebars.Utils={escapeExpression:function(string){if(string instanceof Handlebars.SafeString){return string.toString();}else if(string==null||string===false){return"";}
if(!possible.test(string)){return string;}
return string.replace(badChars,escapeChar);},isEmpty:function(value){if(typeof value==="undefined"){return true;}else if(value===null){return true;}else if(value===false){return true;}else if(Object.prototype.toString.call(value)==="[object Array]"&&value.length===0){return true;}else{return false;}}};})();;Handlebars.Compiler=function(){};Handlebars.JavaScriptCompiler=function(){};(function(Compiler,JavaScriptCompiler){Compiler.OPCODE_MAP={appendContent:1,getContext:2,lookupWithHelpers:3,lookup:4,append:5,invokeMustache:6,appendEscaped:7,pushString:8,truthyOrFallback:9,functionOrFallback:10,invokeProgram:11,invokePartial:12,push:13,assignToHash:15,pushStringParam:16};Compiler.MULTI_PARAM_OPCODES={appendContent:1,getContext:1,lookupWithHelpers:2,lookup:1,invokeMustache:3,pushString:1,truthyOrFallback:1,functionOrFallback:1,invokeProgram:3,invokePartial:1,push:1,assignToHash:1,pushStringParam:1};Compiler.DISASSEMBLE_MAP={};for(var prop in Compiler.OPCODE_MAP){var value=Compiler.OPCODE_MAP[prop];Compiler.DISASSEMBLE_MAP[value]=prop;}
Compiler.multiParamSize=function(code){return Compiler.MULTI_PARAM_OPCODES[Compiler.DISASSEMBLE_MAP[code]];};Compiler.prototype={compiler:Compiler,disassemble:function(){var opcodes=this.opcodes,opcode,nextCode;var out=[],str,name,value;for(var i=0,l=opcodes.length;i<l;i++){opcode=opcodes[i];if(opcode==='DECLARE'){name=opcodes[++i];value=opcodes[++i];out.push("DECLARE "+name+" = "+value);}else{str=Compiler.DISASSEMBLE_MAP[opcode];var extraParams=Compiler.multiParamSize(opcode);var codes=[];for(var j=0;j<extraParams;j++){nextCode=opcodes[++i];if(typeof nextCode==="string"){nextCode="\""+nextCode.replace("\n","\\n")+"\"";}
codes.push(nextCode);}
str=str+" "+codes.join(" ");out.push(str);}}
return out.join("\n");},guid:0,compile:function(program,options){this.children=[];this.depths={list:[]};this.options=options;var knownHelpers=this.options.knownHelpers;this.options.knownHelpers={'helperMissing':true,'blockHelperMissing':true,'each':true,'if':true,'unless':true,'with':true,'log':true};if(knownHelpers){for(var name in knownHelpers){this.options.knownHelpers[name]=knownHelpers[name];}}
return this.program(program);},accept:function(node){return this[node.type](node);},program:function(program){var statements=program.statements,statement;this.opcodes=[];for(var i=0,l=statements.length;i<l;i++){statement=statements[i];this[statement.type](statement);}
this.isSimple=l===1;this.depths.list=this.depths.list.sort(function(a,b){return a-b;});return this;},compileProgram:function(program){var result=new this.compiler().compile(program,this.options);var guid=this.guid++;this.usePartial=this.usePartial||result.usePartial;this.children[guid]=result;for(var i=0,l=result.depths.list.length;i<l;i++){depth=result.depths.list[i];if(depth<2){continue;}
else{this.addDepth(depth-1);}}
return guid;},block:function(block){var mustache=block.mustache;var depth,child,inverse,inverseGuid;var params=this.setupStackForMustache(mustache);var programGuid=this.compileProgram(block.program);if(block.program.inverse){inverseGuid=this.compileProgram(block.program.inverse);this.declare('inverse',inverseGuid);}
this.opcode('invokeProgram',programGuid,params.length,!!mustache.hash);this.declare('inverse',null);this.opcode('append');},inverse:function(block){var params=this.setupStackForMustache(block.mustache);var programGuid=this.compileProgram(block.program);this.declare('inverse',programGuid);this.opcode('invokeProgram',null,params.length,!!block.mustache.hash);this.declare('inverse',null);this.opcode('append');},hash:function(hash){var pairs=hash.pairs,pair,val;this.opcode('push','{}');for(var i=0,l=pairs.length;i<l;i++){pair=pairs[i];val=pair[1];this.accept(val);this.opcode('assignToHash',pair[0]);}},partial:function(partial){var id=partial.id;this.usePartial=true;if(partial.context){this.ID(partial.context);}else{this.opcode('push','depth0');}
this.opcode('invokePartial',id.original);this.opcode('append');},content:function(content){this.opcode('appendContent',content.string);},mustache:function(mustache){var params=this.setupStackForMustache(mustache);this.opcode('invokeMustache',params.length,mustache.id.original,!!mustache.hash);if(mustache.escaped&&!this.options.noEscape){this.opcode('appendEscaped');}else{this.opcode('append');}},ID:function(id){this.addDepth(id.depth);this.opcode('getContext',id.depth);this.opcode('lookupWithHelpers',id.parts[0]||null,id.isScoped||false);for(var i=1,l=id.parts.length;i<l;i++){this.opcode('lookup',id.parts[i]);}},STRING:function(string){this.opcode('pushString',string.string);},INTEGER:function(integer){this.opcode('push',integer.integer);},BOOLEAN:function(bool){this.opcode('push',bool.bool);},comment:function(){},pushParams:function(params){var i=params.length,param;while(i--){param=params[i];if(this.options.stringParams){if(param.depth){this.addDepth(param.depth);}
this.opcode('getContext',param.depth||0);this.opcode('pushStringParam',param.string);}else{this[param.type](param);}}},opcode:function(name,val1,val2,val3){this.opcodes.push(Compiler.OPCODE_MAP[name]);if(val1!==undefined){this.opcodes.push(val1);}
if(val2!==undefined){this.opcodes.push(val2);}
if(val3!==undefined){this.opcodes.push(val3);}},declare:function(name,value){this.opcodes.push('DECLARE');this.opcodes.push(name);this.opcodes.push(value);},addDepth:function(depth){if(depth===0){return;}
if(!this.depths[depth]){this.depths[depth]=true;this.depths.list.push(depth);}},setupStackForMustache:function(mustache){var params=mustache.params;this.pushParams(params);if(mustache.hash){this.hash(mustache.hash);}
this.ID(mustache.id);return params;}};JavaScriptCompiler.prototype={nameLookup:function(parent,name,type){if(/^[0-9]+$/.test(name)){return parent+"["+name+"]";}else if(JavaScriptCompiler.isValidJavaScriptVariableName(name)){return parent+"."+name;}
else{return parent+"['"+name+"']";}},appendToBuffer:function(string){if(this.environment.isSimple){return"return "+string+";";}else{return"buffer += "+string+";";}},initializeBuffer:function(){return this.quotedString("");},namespace:"Handlebars",compile:function(environment,options,context,asObject){this.environment=environment;this.options=options||{};this.name=this.environment.name;this.isChild=!!context;this.context=context||{programs:[],aliases:{self:'this'},registers:{list:[]}};this.preamble();this.stackSlot=0;this.stackVars=[];this.compileChildren(environment,options);var opcodes=environment.opcodes,opcode;this.i=0;for(l=opcodes.length;this.i<l;this.i++){opcode=this.nextOpcode(0);if(opcode[0]==='DECLARE'){this.i=this.i+2;this[opcode[1]]=opcode[2];}else{this.i=this.i+opcode[1].length;this[opcode[0]].apply(this,opcode[1]);}}
return this.createFunctionContext(asObject);},nextOpcode:function(n){var opcodes=this.environment.opcodes,opcode=opcodes[this.i+n],name,val;var extraParams,codes;if(opcode==='DECLARE'){name=opcodes[this.i+1];val=opcodes[this.i+2];return['DECLARE',name,val];}else{name=Compiler.DISASSEMBLE_MAP[opcode];extraParams=Compiler.multiParamSize(opcode);codes=[];for(var j=0;j<extraParams;j++){codes.push(opcodes[this.i+j+1+n]);}
return[name,codes];}},eat:function(opcode){this.i=this.i+opcode.length;},preamble:function(){var out=[];this.useRegister('foundHelper');if(!this.isChild){var namespace=this.namespace;var copies="helpers = helpers || "+namespace+".helpers;";if(this.environment.usePartial){copies=copies+" partials = partials || "+namespace+".partials;";}
out.push(copies);}else{out.push('');}
if(!this.environment.isSimple){out.push(", buffer = "+this.initializeBuffer());}else{out.push("");}
this.lastContext=0;this.source=out;},createFunctionContext:function(asObject){var locals=this.stackVars;if(!this.isChild){locals=locals.concat(this.context.registers.list);}
if(locals.length>0){this.source[1]=this.source[1]+", "+locals.join(", ");}
if(!this.isChild){var aliases=[]
for(var alias in this.context.aliases){this.source[1]=this.source[1]+', '+alias+'='+this.context.aliases[alias];}}
if(this.source[1]){this.source[1]="var "+this.source[1].substring(2)+";";}
if(!this.isChild){this.source[1]+='\n'+this.context.programs.join('\n')+'\n';}
if(!this.environment.isSimple){this.source.push("return buffer;");}
var params=this.isChild?["depth0","data"]:["Handlebars","depth0","helpers","partials","data"];for(var i=0,l=this.environment.depths.list.length;i<l;i++){params.push("depth"+this.environment.depths.list[i]);}
if(asObject){params.push(this.source.join("\n  "));return Function.apply(this,params);}else{var functionSource='function '+(this.name||'')+'('+params.join(',')+') {\n  '+this.source.join("\n  ")+'}';Handlebars.log(Handlebars.logger.DEBUG,functionSource+"\n\n");return functionSource;}},appendContent:function(content){this.source.push(this.appendToBuffer(this.quotedString(content)));},append:function(){var local=this.popStack();this.source.push("if("+local+" || "+local+" === 0) { "+this.appendToBuffer(local)+" }");if(this.environment.isSimple){this.source.push("else { "+this.appendToBuffer("''")+" }");}},appendEscaped:function(){var opcode=this.nextOpcode(1),extra="";this.context.aliases.escapeExpression='this.escapeExpression';if(opcode[0]==='appendContent'){extra=" + "+this.quotedString(opcode[1][0]);this.eat(opcode);}
this.source.push(this.appendToBuffer("escapeExpression("+this.popStack()+")"+extra));},getContext:function(depth){if(this.lastContext!==depth){this.lastContext=depth;}},lookupWithHelpers:function(name,isScoped){if(name){var topStack=this.nextStack();this.usingKnownHelper=false;var toPush;if(!isScoped&&this.options.knownHelpers[name]){toPush=topStack+" = "+this.nameLookup('helpers',name,'helper');this.usingKnownHelper=true;}else if(isScoped||this.options.knownHelpersOnly){toPush=topStack+" = "+this.nameLookup('depth'+this.lastContext,name,'context');}else{this.register('foundHelper',this.nameLookup('helpers',name,'helper'));toPush=topStack+" = foundHelper || "+this.nameLookup('depth'+this.lastContext,name,'context');}
toPush+=';';this.source.push(toPush);}else{this.pushStack('depth'+this.lastContext);}},lookup:function(name){var topStack=this.topStack();this.source.push(topStack+" = ("+topStack+" === null || "+topStack+" === undefined || "+topStack+" === false ? "+
topStack+" : "+this.nameLookup(topStack,name,'context')+");");},pushStringParam:function(string){this.pushStack('depth'+this.lastContext);this.pushString(string);},pushString:function(string){this.pushStack(this.quotedString(string));},push:function(name){this.pushStack(name);},invokeMustache:function(paramSize,original,hasHash){this.populateParams(paramSize,this.quotedString(original),"{}",null,hasHash,function(nextStack,helperMissingString,id){if(!this.usingKnownHelper){this.context.aliases.helperMissing='helpers.helperMissing';this.context.aliases.undef='void 0';this.source.push("else if("+id+"=== undef) { "+nextStack+" = helperMissing.call("+helperMissingString+"); }");if(nextStack!==id){this.source.push("else { "+nextStack+" = "+id+"; }");}}});},invokeProgram:function(guid,paramSize,hasHash){var inverse=this.programExpression(this.inverse);var mainProgram=this.programExpression(guid);this.populateParams(paramSize,null,mainProgram,inverse,hasHash,function(nextStack,helperMissingString,id){if(!this.usingKnownHelper){this.context.aliases.blockHelperMissing='helpers.blockHelperMissing';this.source.push("else { "+nextStack+" = blockHelperMissing.call("+helperMissingString+"); }");}});},populateParams:function(paramSize,helperId,program,inverse,hasHash,fn){var needsRegister=hasHash||this.options.stringParams||inverse||this.options.data;var id=this.popStack(),nextStack;var params=[],param,stringParam,stringOptions;if(needsRegister){this.register('tmp1',program);stringOptions='tmp1';}else{stringOptions='{ hash: {} }';}
if(needsRegister){var hash=(hasHash?this.popStack():'{}');this.source.push('tmp1.hash = '+hash+';');}
if(this.options.stringParams){this.source.push('tmp1.contexts = [];');}
for(var i=0;i<paramSize;i++){param=this.popStack();params.push(param);if(this.options.stringParams){this.source.push('tmp1.contexts.push('+this.popStack()+');');}}
if(inverse){this.source.push('tmp1.fn = tmp1;');this.source.push('tmp1.inverse = '+inverse+';');}
if(this.options.data){this.source.push('tmp1.data = data;');}
params.push(stringOptions);this.populateCall(params,id,helperId||id,fn,program!=='{}');},populateCall:function(params,id,helperId,fn,program){var paramString=["depth0"].concat(params).join(", ");var helperMissingString=["depth0"].concat(helperId).concat(params).join(", ");var nextStack=this.nextStack();if(this.usingKnownHelper){this.source.push(nextStack+" = "+id+".call("+paramString+");");}else{this.context.aliases.functionType='"function"';var condition=program?"foundHelper && ":""
this.source.push("if("+condition+"typeof "+id+" === functionType) { "+nextStack+" = "+id+".call("+paramString+"); }");}
fn.call(this,nextStack,helperMissingString,id);this.usingKnownHelper=false;},invokePartial:function(context){params=[this.nameLookup('partials',context,'partial'),"'"+context+"'",this.popStack(),"helpers","partials"];if(this.options.data){params.push("data");}
this.pushStack("self.invokePartial("+params.join(", ")+");");},assignToHash:function(key){var value=this.popStack();var hash=this.topStack();this.source.push(hash+"['"+key+"'] = "+value+";");},compiler:JavaScriptCompiler,compileChildren:function(environment,options){var children=environment.children,child,compiler;for(var i=0,l=children.length;i<l;i++){child=children[i];compiler=new this.compiler();this.context.programs.push('');var index=this.context.programs.length;child.index=index;child.name='program'+index;this.context.programs[index]=compiler.compile(child,options,this.context);}},programExpression:function(guid){if(guid==null){return"self.noop";}
var child=this.environment.children[guid],depths=child.depths.list;var programParams=[child.index,child.name,"data"];for(var i=0,l=depths.length;i<l;i++){depth=depths[i];if(depth===1){programParams.push("depth0");}
else{programParams.push("depth"+(depth-1));}}
if(depths.length===0){return"self.program("+programParams.join(", ")+")";}else{programParams.shift();return"self.programWithDepth("+programParams.join(", ")+")";}},register:function(name,val){this.useRegister(name);this.source.push(name+" = "+val+";");},useRegister:function(name){if(!this.context.registers[name]){this.context.registers[name]=true;this.context.registers.list.push(name);}},pushStack:function(item){this.source.push(this.nextStack()+" = "+item+";");return"stack"+this.stackSlot;},nextStack:function(){this.stackSlot++;if(this.stackSlot>this.stackVars.length){this.stackVars.push("stack"+this.stackSlot);}
return"stack"+this.stackSlot;},popStack:function(){return"stack"+this.stackSlot--;},topStack:function(){return"stack"+this.stackSlot;},quotedString:function(str){return'"'+str.replace(/\\/g,'\\\\').replace(/"/g,'\\"').replace(/\n/g,'\\n').replace(/\r/g,'\\r')+'"';}};var reservedWords=("break else new var"+" case finally return void"+" catch for switch while"+" continue function this with"+" default if throw"+" delete in try"+" do instanceof typeof"+" abstract enum int short"+" boolean export interface static"+" byte extends long super"+" char final native synchronized"+" class float package throws"+" const goto private transient"+" debugger implements protected volatile"+" double import public let yield").split(" ");var compilerWords=JavaScriptCompiler.RESERVED_WORDS={};for(var i=0,l=reservedWords.length;i<l;i++){compilerWords[reservedWords[i]]=true;}
JavaScriptCompiler.isValidJavaScriptVariableName=function(name){if(!JavaScriptCompiler.RESERVED_WORDS[name]&&/^[a-zA-Z_$][0-9a-zA-Z_$]+$/.test(name)){return true;}
return false;}})(Handlebars.Compiler,Handlebars.JavaScriptCompiler);Handlebars.precompile=function(string,options){options=options||{};var ast=Handlebars.parse(string);var environment=new Handlebars.Compiler().compile(ast,options);return new Handlebars.JavaScriptCompiler().compile(environment,options);};Handlebars.compile=function(string,options){options=options||{};var compiled;function compile(){var ast=Handlebars.parse(string);var environment=new Handlebars.Compiler().compile(ast,options);var templateSpec=new Handlebars.JavaScriptCompiler().compile(environment,options,undefined,true);return Handlebars.template(templateSpec);}
return function(context,options){if(!compiled){compiled=compile();}
return compiled.call(this,context,options);};};;Handlebars.VM={template:function(templateSpec){var container={escapeExpression:Handlebars.Utils.escapeExpression,invokePartial:Handlebars.VM.invokePartial,programs:[],program:function(i,fn,data){var programWrapper=this.programs[i];if(data){return Handlebars.VM.program(fn,data);}else if(programWrapper){return programWrapper;}else{programWrapper=this.programs[i]=Handlebars.VM.program(fn);return programWrapper;}},programWithDepth:Handlebars.VM.programWithDepth,noop:Handlebars.VM.noop};return function(context,options){options=options||{};return templateSpec.call(container,Handlebars,context,options.helpers,options.partials,options.data);};},programWithDepth:function(fn,data,$depth){var args=Array.prototype.slice.call(arguments,2);return function(context,options){options=options||{};return fn.apply(this,[context,options.data||data].concat(args));};},program:function(fn,data){return function(context,options){options=options||{};return fn(context,options.data||data);};},noop:function(){return"";},invokePartial:function(partial,name,context,helpers,partials,data){options={helpers:helpers,partials:partials,data:data};if(partial===undefined){throw new Handlebars.Exception("The partial "+name+" could not be found");}else if(partial instanceof Function){return partial(context,options);}else if(!Handlebars.compile){throw new Handlebars.Exception("The partial "+name+" could not be compiled when running in runtime-only mode");}else{partials[name]=Handlebars.compile(partial);return partials[name](context,options);}}};Handlebars.template=Handlebars.VM.template;;(function($){$.fn.charCounter=function(max,settings){max=max||100;settings=$.extend({container:"<span></span>",classname:"charcounter",format:"(%1 characters remaining)",pulse:true,delay:0},settings);var p,timeout;function count(el,container){el=$(el);if(el.val().length>max){el.val(el.val().substring(0,max));if(settings.pulse&&!p){pulse(container,true);};};if(settings.delay>0){if(timeout){window.clearTimeout(timeout);}
timeout=window.setTimeout(function(){container.html(settings.format.replace(/%1/,(max-el.val().length)));},settings.delay);}else{container.html(settings.format.replace(/%1/,(max-el.val().length)));}};function pulse(el,again){if(p){window.clearTimeout(p);p=null;};el.animate({opacity:0.1},100,function(){$(this).animate({opacity:1.0},100);});if(again){p=window.setTimeout(function(){pulse(el)},200);};};return this.each(function(){var container;if(!settings.container.match(/^<.+>$/)){container=$(settings.container);}else{$(this).next("."+settings.classname).remove();container=$(settings.container).insertAfter(this).addClass(settings.classname);}
$(this).unbind(".charCounter").bind("keydown.charCounter",function(){count(this,container);}).bind("keypress.charCounter",function(){count(this,container);}).bind("keyup.charCounter",function(){count(this,container);}).bind("focus.charCounter",function(){count(this,container);}).bind("mouseover.charCounter",function(){count(this,container);}).bind("mouseout.charCounter",function(){count(this,container);}).bind("paste.charCounter",function(){var me=this;setTimeout(function(){count(me,container);},10);});if(this.addEventListener){this.addEventListener('input',function(){count(this,container);},false);};count(this,container);});};})(jQuery);;(function($){$.fn.ajaxSubmit=function(options){if(!this.length){log('ajaxSubmit: skipping submit process - no element selected');return this;}
if(typeof options=='function')
options={success:options};var url=$.trim(this.attr('action'));if(url){url=(url.match(/^([^#]+)/)||[])[1];}
url=url||window.location.href||'';options=$.extend({url:url,type:this.attr('method')||'GET',iframeSrc:/^https/i.test(window.location.href||'')?'javascript:false':'about:blank'},options||{});var veto={};this.trigger('form-pre-serialize',[this,options,veto]);if(veto.veto){log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');return this;}
if(options.beforeSerialize&&options.beforeSerialize(this,options)===false){log('ajaxSubmit: submit aborted via beforeSerialize callback');return this;}
var a=this.formToArray(options.semantic);if(options.data){options.extraData=options.data;for(var n in options.data){if(options.data[n]instanceof Array){for(var k in options.data[n])
a.push({name:n,value:options.data[n][k]});}
else
a.push({name:n,value:options.data[n]});}}
if(options.beforeSubmit&&options.beforeSubmit(a,this,options)===false){log('ajaxSubmit: submit aborted via beforeSubmit callback');return this;}
this.trigger('form-submit-validate',[a,this,options,veto]);if(veto.veto){log('ajaxSubmit: submit vetoed via form-submit-validate trigger');return this;}
var q=$.param(a);if(options.type.toUpperCase()=='GET'){options.url+=(options.url.indexOf('?')>=0?'&':'?')+q;options.data=null;}
else
options.data=q;var $form=this,callbacks=[];if(options.resetForm)callbacks.push(function(){$form.resetForm();});if(options.clearForm)callbacks.push(function(){$form.clearForm();});if(!options.dataType&&options.target){var oldSuccess=options.success||function(){};callbacks.push(function(data){var fn=options.replaceTarget?'replaceWith':'html';$(options.target)[fn](data).each(oldSuccess,arguments);});}
else if(options.success)
callbacks.push(options.success);options.success=function(data,status,xhr){for(var i=0,max=callbacks.length;i<max;i++)
callbacks[i].apply(options,[data,status,xhr||$form,$form]);};var files=$('input:file',this).fieldValue();var found=false;for(var j=0;j<files.length;j++)
if(files[j])
found=true;var multipart=false;if((files.length&&options.iframe!==false)||options.iframe||found||multipart){if(options.closeKeepAlive)
$.get(options.closeKeepAlive,fileUpload);else
fileUpload();}
else
$.ajax(options);this.trigger('form-submit-notify',[this,options]);return this;function fileUpload(){var form=$form[0];if($(':input[name=submit]',form).length){alert('Error: Form elements must not be named "submit".');return;}
var opts=$.extend({},$.ajaxSettings,options);var s=$.extend(true,{},$.extend(true,{},$.ajaxSettings),opts);var id='jqFormIO'+(new Date().getTime());var $io=$('<iframe id="'+id+'" name="'+id+'" src="'+opts.iframeSrc+'" onload="(jQuery(this).data(\'form-plugin-onload\'))()" />');var io=$io[0];$io.css({position:'absolute',top:'-1000px',left:'-1000px'});var xhr={aborted:0,responseText:null,responseXML:null,status:0,statusText:'n/a',getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(){this.aborted=1;$io.attr('src',opts.iframeSrc);}};var g=opts.global;if(g&&!$.active++)$.event.trigger("ajaxStart");if(g)$.event.trigger("ajaxSend",[xhr,opts]);if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&$.active--;return;}
if(xhr.aborted)
return;var cbInvoked=false;var timedOut=0;var sub=form.clk;if(sub){var n=sub.name;if(n&&!sub.disabled){opts.extraData=opts.extraData||{};opts.extraData[n]=sub.value;if(sub.type=="image"){opts.extraData[n+'.x']=form.clk_x;opts.extraData[n+'.y']=form.clk_y;}}}
function doSubmit(){var t=$form.attr('target'),a=$form.attr('action');form.setAttribute('target',id);if(form.getAttribute('method')!='POST')
form.setAttribute('method','POST');if(form.getAttribute('action')!=opts.url)
form.setAttribute('action',opts.url);if(!opts.skipEncodingOverride){$form.attr({encoding:'multipart/form-data',enctype:'multipart/form-data'});}
if(opts.timeout)
setTimeout(function(){timedOut=true;cb();},opts.timeout);var extraInputs=[];try{if(opts.extraData)
for(var n in opts.extraData)
extraInputs.push($('<input type="hidden" name="'+n+'" value="'+opts.extraData[n]+'" />').appendTo(form)[0]);$io.data('form-plugin-onload',cb);$io.appendTo('body');form.submit();}
finally{form.setAttribute('action',a);t?form.setAttribute('target',t):$form.removeAttr('target');$(extraInputs).remove();}};if(opts.forceSync)
doSubmit();else
setTimeout(doSubmit,10);var domCheckCount=100;function cb(){if(cbInvoked)
return;var ok=true;try{if(timedOut)throw'timeout';var data,doc;doc=io.contentWindow?io.contentWindow.document:io.contentDocument?io.contentDocument:io.document;var isXml=opts.dataType=='xml'||doc.XMLDocument||$.isXMLDoc(doc);log('isXml='+isXml);if(!isXml&&(doc.body==null||doc.body.innerHTML=='')){if(--domCheckCount){log('requeing onLoad callback, DOM not available');setTimeout(cb,250);return;}
log('Could not access iframe DOM after 100 tries.');return;}
log('response detected');cbInvoked=true;xhr.responseText=doc.body?doc.body.innerHTML:null;xhr.responseXML=doc.XMLDocument?doc.XMLDocument:doc;xhr.getResponseHeader=function(header){var headers={'content-type':opts.dataType};return headers[header];};if(opts.dataType=='json'||opts.dataType=='script'){var ta=doc.getElementsByTagName('textarea')[0];if(ta)
xhr.responseText=ta.value;else{var pre=doc.getElementsByTagName('pre')[0];if(pre)
xhr.responseText=pre.innerHTML;}}
else if(opts.dataType=='xml'&&!xhr.responseXML&&xhr.responseText!=null){xhr.responseXML=toXml(xhr.responseText);}
data=$.httpData(xhr,opts.dataType);}
catch(e){log('error caught:',e);ok=false;xhr.error=e;$.handleError(opts,xhr,'error',e);}
if(ok){opts.success(data,'success');if(g)$.event.trigger("ajaxSuccess",[xhr,opts]);}
if(g)$.event.trigger("ajaxComplete",[xhr,opts]);if(g&&!--$.active)$.event.trigger("ajaxStop");if(opts.complete)opts.complete(xhr,ok?'success':'error');setTimeout(function(){$io.removeData('form-plugin-onload');$io.remove();xhr.responseXML=null;},100);};function toXml(s,doc){if(window.ActiveXObject){doc=new ActiveXObject('Microsoft.XMLDOM');doc.async='false';doc.loadXML(s);}
else
doc=(new DOMParser()).parseFromString(s,'text/xml');return(doc&&doc.documentElement&&doc.documentElement.tagName!='parsererror')?doc:null;};};};$.fn.ajaxForm=function(options){return this.ajaxFormUnbind().bind('submit.form-plugin',function(e){e.preventDefault();$(this).ajaxSubmit(options);}).bind('click.form-plugin',function(e){var target=e.target;var $el=$(target);if(!($el.is(":submit,input:image"))){var t=$el.closest(':submit');if(t.length==0)
return;target=t[0];}
var form=this;form.clk=target;if(target.type=='image'){if(e.offsetX!=undefined){form.clk_x=e.offsetX;form.clk_y=e.offsetY;}else if(typeof $.fn.offset=='function'){var offset=$el.offset();form.clk_x=e.pageX-offset.left;form.clk_y=e.pageY-offset.top;}else{form.clk_x=e.pageX-target.offsetLeft;form.clk_y=e.pageY-target.offsetTop;}}
setTimeout(function(){form.clk=form.clk_x=form.clk_y=null;},100);});};$.fn.ajaxFormUnbind=function(){return this.unbind('submit.form-plugin click.form-plugin');};$.fn.formToArray=function(semantic){var a=[];if(this.length==0)return a;var form=this[0];var els=semantic?form.getElementsByTagName('*'):form.elements;if(!els)return a;for(var i=0,max=els.length;i<max;i++){var el=els[i];var n=el.name;if(!n)continue;if(semantic&&form.clk&&el.type=="image"){if(!el.disabled&&form.clk==el){a.push({name:n,value:$(el).val()});a.push({name:n+'.x',value:form.clk_x},{name:n+'.y',value:form.clk_y});}
continue;}
var v=$.fieldValue(el,true);if(v&&v.constructor==Array){for(var j=0,jmax=v.length;j<jmax;j++)
a.push({name:n,value:v[j]});}
else if(v!==null&&typeof v!='undefined')
a.push({name:n,value:v});}
if(!semantic&&form.clk){var $input=$(form.clk),input=$input[0],n=input.name;if(n&&!input.disabled&&input.type=='image'){a.push({name:n,value:$input.val()});a.push({name:n+'.x',value:form.clk_x},{name:n+'.y',value:form.clk_y});}}
return a;};$.fn.formSerialize=function(semantic){return $.param(this.formToArray(semantic));};$.fn.fieldSerialize=function(successful){var a=[];this.each(function(){var n=this.name;if(!n)return;var v=$.fieldValue(this,successful);if(v&&v.constructor==Array){for(var i=0,max=v.length;i<max;i++)
a.push({name:n,value:v[i]});}
else if(v!==null&&typeof v!='undefined')
a.push({name:this.name,value:v});});return $.param(a);};$.fn.fieldValue=function(successful){for(var val=[],i=0,max=this.length;i<max;i++){var el=this[i];var v=$.fieldValue(el,successful);if(v===null||typeof v=='undefined'||(v.constructor==Array&&!v.length))
continue;v.constructor==Array?$.merge(val,v):val.push(v);}
return val;};$.fieldValue=function(el,successful){var n=el.name,t=el.type,tag=el.tagName.toLowerCase();if(typeof successful=='undefined')successful=true;if(successful&&(!n||el.disabled||t=='reset'||t=='button'||(t=='checkbox'||t=='radio')&&!el.checked||(t=='submit'||t=='image')&&el.form&&el.form.clk!=el||tag=='select'&&el.selectedIndex==-1))
return null;if(tag=='select'){var index=el.selectedIndex;if(index<0)return null;var a=[],ops=el.options;var one=(t=='select-one');var max=(one?index+1:ops.length);for(var i=(one?index:0);i<max;i++){var op=ops[i];if(op.selected){var v=op.value;if(!v)
v=(op.attributes&&op.attributes['value']&&!(op.attributes['value'].specified))?op.text:op.value;if(one)return v;a.push(v);}}
return a;}
return el.value;};$.fn.clearForm=function(){return this.each(function(){$('input,select,textarea',this).clearFields();});};$.fn.clearFields=$.fn.clearInputs=function(){return this.each(function(){var t=this.type,tag=this.tagName.toLowerCase();if(t=='text'||t=='password'||tag=='textarea')
this.value='';else if(t=='checkbox'||t=='radio')
this.checked=false;else if(tag=='select')
this.selectedIndex=-1;});};$.fn.resetForm=function(){return this.each(function(){if(typeof this.reset=='function'||(typeof this.reset=='object'&&!this.reset.nodeType))
this.reset();});};$.fn.enable=function(b){if(b==undefined)b=true;return this.each(function(){this.disabled=!b;});};$.fn.selected=function(select){if(select==undefined)select=true;return this.each(function(){var t=this.type;if(t=='checkbox'||t=='radio')
this.checked=select;else if(this.tagName.toLowerCase()=='option'){var $sel=$(this).parent('select');if(select&&$sel[0]&&$sel[0].type=='select-one'){$sel.find('option').selected(false);}
this.selected=select;}});};function log(){if($.fn.ajaxSubmit.debug){var msg='[jquery.form] '+Array.prototype.join.call(arguments,'');if(window.console&&window.console.log)
window.console.log(msg);else if(window.opera&&window.opera.postError)
window.opera.postError(msg);}};})(jQuery);(function($){var inviewObjects={},viewportSize,viewportOffset,d=document,w=window,documentElement=d.documentElement,expando=$.expando;$.event.special.inview={add:function(data){inviewObjects[data.guid+"-"+this[expando]]={data:data,$element:$(this)};},remove:function(data){try{delete inviewObjects[data.guid+"-"+this[expando]];}catch(e){}}};function getViewportSize(){var mode,domObject,size={height:w.innerHeight,width:w.innerWidth};if(!size.height){mode=d.compatMode;if(mode||!$.support.boxModel){domObject=mode==='CSS1Compat'?documentElement:d.body;size={height:domObject.clientHeight,width:domObject.clientWidth};}}
return size;}
function getViewportOffset(){return{top:w.pageYOffset||documentElement.scrollTop||d.body.scrollTop,left:w.pageXOffset||documentElement.scrollLeft||d.body.scrollLeft};}
function checkInView(){var $elements=$(),elementsLength,i=0;$.each(inviewObjects,function(i,inviewObject){var selector=inviewObject.data.selector,$element=inviewObject.$element;$elements=$elements.add(selector?$element.find(selector):$element);});elementsLength=$elements.length;if(elementsLength){viewportSize=viewportSize||getViewportSize();viewportOffset=viewportOffset||getViewportOffset();for(;i<elementsLength;i++){if(!$.contains(documentElement,$elements[i])){continue;}
var $element=$($elements[i]),elementSize={height:$element.height(),width:$element.width()},elementOffset=$element.offset(),inView=$element.data('inview'),visiblePartX,visiblePartY,visiblePartsMerged;if(!viewportOffset||!viewportSize){return;}
if(elementOffset.top+elementSize.height>viewportOffset.top&&elementOffset.top<viewportOffset.top+viewportSize.height&&elementOffset.left+elementSize.width>viewportOffset.left&&elementOffset.left<viewportOffset.left+viewportSize.width){visiblePartX=(viewportOffset.left>elementOffset.left?'right':(viewportOffset.left+viewportSize.width)<(elementOffset.left+elementSize.width)?'left':'both');visiblePartY=(viewportOffset.top>elementOffset.top?'bottom':(viewportOffset.top+viewportSize.height)<(elementOffset.top+elementSize.height)?'top':'both');visiblePartsMerged=visiblePartX+"-"+visiblePartY;if(!inView||inView!==visiblePartsMerged){$element.data('inview',visiblePartsMerged).trigger('inview',[true,visiblePartX,visiblePartY]);}}else if(inView){$element.data('inview',false).trigger('inview',[false]);}}}}
$(w).bind("scroll resize",function(){viewportSize=viewportOffset=null;});setInterval(checkInView,250);})(jQuery);(function($){jQuery.fn.inviewFromTemplate=function(template,url,maxResults){var start=0;var list=this;function fetchDataAndAppendTemplate(){jQuery.ajax({type:"GET",url:url,dataType:"json",async:false,data:{"start":start,"rows":maxResults},success:function(result){$(result.data).each(function(index,value){var newItem=template(this);list.append(newItem);});start=list.children().size();}});}
fetchDataAndAppendTemplate();this.on('inview','li:last-child',function(event,isInView,visiblePartX,visiblePartY){if(isInView){fetchDataAndAppendTemplate();}});};})(jQuery);;(function($){var $window=$(window);$.fn.asynchImageLoader=$.fn.jail=function(options){options=$.extend({timeout:10,effect:false,speed:400,selector:null,offset:0,event:'load+scroll',callback:jQuery.noop,callbackAfterEachImage:jQuery.noop,placeholder:false,container:window},options);var images=this;$.jail.initialStack=this;this.data('triggerEl',(options.selector)?$(options.selector):$window);if(options.placeholder!==false){images.each(function(){$(this).attr("src",options.placeholder);});}
if(/^load/.test(options.event)){$.asynchImageLoader.later.call(this,options);}else{$.asynchImageLoader.onEvent.call(this,options,images);}
return this;};$.asynchImageLoader=$.jail={_purgeStack:function(stack){var i=0;while(true){if(i===stack.length){break;}else{if(stack[i].getAttribute('data-href')){i++;}else{stack.splice(i,1);}}}},_loadOnEvent:function(e){var $img=$(this),options=e.data.options,images=e.data.images;$.asynchImageLoader._loadImage(options,$img);$img.unbind(options.event,$.asynchImageLoader._loadOnEvent);$.asynchImageLoader._purgeStack(images);if(!!options.callback){$.asynchImageLoader._purgeStack($.jail.initialStack);$.asynchImageLoader._launchCallback($.jail.initialStack,options);}},_bufferedEventListener:function(e){var images=e.data.images,options=e.data.options,triggerEl=images.data('triggerEl');clearTimeout(images.data('poller'));images.data('poller',setTimeout(function(){images.each(function _imageLoader(){$.asynchImageLoader._loadImageIfVisible(options,this,triggerEl);});$.asynchImageLoader._purgeStack(images);if(!!options.callback){$.asynchImageLoader._purgeStack($.jail.initialStack);$.asynchImageLoader._launchCallback($.jail.initialStack,options);}},options.timeout));},onEvent:function(options,images){images=images||this;if(options.event==='scroll'||options.selector){var triggerEl=images.data('triggerEl');if(images.length>0){triggerEl.bind(options.event,{images:images,options:options},$.asynchImageLoader._bufferedEventListener);if(options.event==='scroll'||!options.selector){$window.resize({images:images,options:options},$.asynchImageLoader._bufferedEventListener);}
return;}else{if(!!triggerEl){triggerEl.unbind(options.event,$.asynchImageLoader._bufferedEventListener);}}}else{images.bind(options.event,{options:options,images:images},$.asynchImageLoader._loadOnEvent);}},later:function(options){var images=this;if(options.event==='load'){images.each(function(){$.asynchImageLoader._loadImageIfVisible(options,this,images.data('triggerEl'));});}
$.asynchImageLoader._purgeStack(images);$.asynchImageLoader._launchCallback(images,options);setTimeout(function(){if(options.event==='load'){images.each(function(){$.asynchImageLoader._loadImage(options,$(this));});}else{images.each(function(){$.asynchImageLoader._loadImageIfVisible(options,this,images.data('triggerEl'));});}
$.asynchImageLoader._purgeStack(images);$.asynchImageLoader._launchCallback(images,options);if(options.event==='load+scroll'){options.event='scroll';$.asynchImageLoader.onEvent(options,images);}},options.timeout);},_launchCallback:function(images,options){if(images.length===0&&!$.jail.isCallback){options.callback.call(this,options);$.jail.isCallback=true;}},_loadImageIfVisible:function(options,image,triggerEl){var $img=$(image),container=(/scroll/i.test(options.event))?triggerEl:$window;if($.asynchImageLoader._isInTheScreen(container,$img,options.offset)){$.asynchImageLoader._loadImage(options,$img);}},_isInTheScreen:function($ct,$img,optionOffset){var is_ct_window=$ct[0]===window,ct_offset=(is_ct_window?{top:0,left:0}:$ct.offset()),ct_top=ct_offset.top+(is_ct_window?$ct.scrollTop():0),ct_left=ct_offset.left+(is_ct_window?$ct.scrollLeft():0),ct_right=ct_left+$ct.width(),ct_bottom=ct_top+$ct.height(),img_offset=$img.offset(),img_width=$img.width(),img_height=$img.height();return(ct_top-optionOffset)<=(img_offset.top+img_height)&&(ct_bottom+optionOffset)>=img_offset.top&&(ct_left-optionOffset)<=(img_offset.left+img_width)&&(ct_right+optionOffset)>=img_offset.left;},_loadImage:function(options,$img){$img.hide();$img.attr("src",$img.attr("data-href"));$img.removeAttr('data-href');if(options.effect){if(options.speed){$img[options.effect](options.speed);}else{$img[options.effect]();}}else{$img.show();}
options.callbackAfterEachImage.call(this,$img,options);}};}(jQuery));(function($){$.fn.jcarousel=function(o){return this.each(function(){new $jc(this,o);});};var defaults={vertical:false,start:1,offset:1,size:null,scroll:3,visible:null,animation:'normal',easing:'swing',auto:0,wrap:null,initCallback:null,reloadCallback:null,itemLoadCallback:null,itemFirstInCallback:null,itemFirstOutCallback:null,itemLastInCallback:null,itemLastOutCallback:null,itemVisibleInCallback:null,itemVisibleOutCallback:null,buttonNextHTML:'<div></div>',buttonPrevHTML:'<div></div>',buttonNextEvent:'click',buttonPrevEvent:'click',buttonNextCallback:null,buttonPrevCallback:null};$.jcarousel=function(e,o){this.options=$.extend({},defaults,o||{});this.locked=false;this.container=null;this.clip=null;this.list=null;this.buttonNext=null;this.buttonPrev=null;this.wh=!this.options.vertical?'width':'height';this.lt=!this.options.vertical?'left':'top';var skin='',split=e.className.split(' ');for(var i=0;i<split.length;i++){if(split[i].indexOf('jcarousel-skin')!=-1){$(e).removeClass(split[i]);var skin=split[i];break;}}
if(e.nodeName=='UL'||e.nodeName=='OL'){this.list=$(e);this.container=this.list.parent();if(this.container.hasClass('jcarousel-clip')){if(!this.container.parent().hasClass('jcarousel-container'))
this.container=this.container.wrap('<div></div>');this.container=this.container.parent();}else if(!this.container.hasClass('jcarousel-container'))
this.container=this.list.wrap('<div></div>').parent();}else{this.container=$(e);this.list=$(e).find('>ul,>ol,div>ul,div>ol');}
if(skin!=''&&this.container.parent()[0].className.indexOf('jcarousel-skin')==-1)
this.container.wrap('<div class=" '+skin+'"></div>');this.clip=this.list.parent();if(!this.clip.length||!this.clip.hasClass('jcarousel-clip'))
this.clip=this.list.wrap('<div></div>').parent();this.buttonPrev=$('.jcarousel-prev',this.container);if(this.buttonPrev.size()==0&&this.options.buttonPrevHTML!=null)
this.buttonPrev=this.clip.before(this.options.buttonPrevHTML).prev();this.buttonPrev.addClass(this.className('jcarousel-prev'));this.buttonNext=$('.jcarousel-next',this.container);if(this.buttonNext.size()==0&&this.options.buttonNextHTML!=null)
this.buttonNext=this.clip.before(this.options.buttonNextHTML).prev();this.buttonNext.addClass(this.className('jcarousel-next'));this.clip.addClass(this.className('jcarousel-clip'));this.list.addClass(this.className('jcarousel-list'));this.container.addClass(this.className('jcarousel-container'));var di=this.options.visible!=null?Math.ceil(this.clipping()/this.options.visible):null;var li=this.list.children('li');var self=this;if(li.size()>0){var wh=0,i=this.options.offset;li.each(function(){self.format(this,i++);wh+=self.dimension(this,di);});this.list.css(this.wh,wh+'px');if(!o||o.size===undefined)
this.options.size=li.size();}
this.container.css('display','block');this.buttonNext.css('display','block');this.buttonPrev.css('display','block');this.funcNext=function(){self.next();};this.funcPrev=function(){self.prev();};this.funcResize=function(){self.reload();};if(this.options.initCallback!=null)
this.options.initCallback(this,'init');if($.browser.safari){this.buttons(false,false);$(window).bind('load',function(){self.setup();});}else
this.setup();};var $jc=$.jcarousel;$jc.fn=$jc.prototype={jcarousel:'0.2.3'};$jc.fn.extend=$jc.extend=$.extend;$jc.fn.extend({setup:function(){this.first=null;this.last=null;this.prevFirst=null;this.prevLast=null;this.animating=false;this.timer=null;this.tail=null;this.inTail=false;if(this.locked)
return;this.list.css(this.lt,this.pos(this.options.offset)+'px');var p=this.pos(this.options.start);this.prevFirst=this.prevLast=null;this.animate(p,false);$(window).unbind('resize',this.funcResize).bind('resize',this.funcResize);},reset:function(){this.list.empty();this.list.css(this.lt,'0px');this.list.css(this.wh,'10px');if(this.options.initCallback!=null)
this.options.initCallback(this,'reset');this.setup();},reload:function(){if(this.tail!=null&&this.inTail)
this.list.css(this.lt,$jc.intval(this.list.css(this.lt))+this.tail);this.tail=null;this.inTail=false;if(this.options.reloadCallback!=null)
this.options.reloadCallback(this);if(this.options.visible!=null){var self=this;var di=Math.ceil(this.clipping()/this.options.visible),wh=0,lt=0;$('li',this.list).each(function(i){wh+=self.dimension(this,di);if(i+1<self.first)
lt=wh;});this.list.css(this.wh,wh+'px');this.list.css(this.lt,-lt+'px');}
this.scroll(this.first,false);},lock:function(){this.locked=true;this.buttons();},unlock:function(){this.locked=false;this.buttons();},size:function(s){if(s!=undefined){this.options.size=s;if(!this.locked)
this.buttons();}
return this.options.size;},has:function(i,i2){if(i2==undefined||!i2)
i2=i;if(this.options.size!==null&&i2>this.options.size)
i2=this.options.size;for(var j=i;j<=i2;j++){var e=this.get(j);if(!e.length||e.hasClass('jcarousel-item-placeholder'))
return false;}
return true;},get:function(i){return $('.jcarousel-item-'+i,this.list);},add:function(i,s){var e=this.get(i),old=0,add=0;if(e.length==0){var c,e=this.create(i),j=$jc.intval(i);while(c=this.get(--j)){if(j<=0||c.length){j<=0?this.list.prepend(e):c.after(e);break;}}}else
old=this.dimension(e);e.removeClass(this.className('jcarousel-item-placeholder'));typeof s=='string'?e.html(s):e.empty().append(s);var di=this.options.visible!=null?Math.ceil(this.clipping()/this.options.visible):null;var wh=this.dimension(e,di)-old;if(i>0&&i<this.first)
this.list.css(this.lt,$jc.intval(this.list.css(this.lt))-wh+'px');this.list.css(this.wh,$jc.intval(this.list.css(this.wh))+wh+'px');return e;},remove:function(i){var e=this.get(i);if(!e.length||(i>=this.first&&i<=this.last))
return;var d=this.dimension(e);if(i<this.first)
this.list.css(this.lt,$jc.intval(this.list.css(this.lt))+d+'px');e.remove();this.list.css(this.wh,$jc.intval(this.list.css(this.wh))-d+'px');},next:function(){this.stopAuto();if(this.tail!=null&&!this.inTail)
this.scrollTail(false);else
this.scroll(((this.options.wrap=='both'||this.options.wrap=='last')&&this.options.size!=null&&this.last==this.options.size)?1:this.first+this.options.scroll);},prev:function(){this.stopAuto();if(this.tail!=null&&this.inTail)
this.scrollTail(true);else
this.scroll(((this.options.wrap=='both'||this.options.wrap=='first')&&this.options.size!=null&&this.first==1)?this.options.size:this.first-this.options.scroll);},scrollTail:function(b){if(this.locked||this.animating||!this.tail)
return;var pos=$jc.intval(this.list.css(this.lt));!b?pos-=this.tail:pos+=this.tail;this.inTail=!b;this.prevFirst=this.first;this.prevLast=this.last;this.animate(pos);},scroll:function(i,a){if(this.locked||this.animating)
return;this.animate(this.pos(i),a);},pos:function(i){if(this.locked||this.animating)
return;i=$jc.intval(i);if(this.options.wrap!='circular')
i=i<1?1:(this.options.size&&i>this.options.size?this.options.size:i);var back=this.first>i;var pos=$jc.intval(this.list.css(this.lt));var f=this.options.wrap!='circular'&&this.first<=1?1:this.first;var c=back?this.get(f):this.get(this.last);var j=back?f:f-1;var e=null,l=0,p=false,d=0;while(back?--j>=i:++j<i){e=this.get(j);p=!e.length;if(e.length==0){e=this.create(j).addClass(this.className('jcarousel-item-placeholder'));c[back?'before':'after'](e);}
c=e;d=this.dimension(e);if(p)
l+=d;if(this.first!=null&&(this.options.wrap=='circular'||(j>=1&&(this.options.size==null||j<=this.options.size))))
pos=back?pos+d:pos-d;}
var clipping=this.clipping();var cache=[];var visible=0,j=i,v=0;var c=this.get(i-1);while(++visible){e=this.get(j);p=!e.length;if(e.length==0){e=this.create(j).addClass(this.className('jcarousel-item-placeholder'));c.length==0?this.list.prepend(e):c[back?'before':'after'](e);}
c=e;var d=this.dimension(e);if(d==0){alert('jCarousel: No width/height set for items. This will cause an infinite loop. Aborting...');return 0;}
if(this.options.wrap!='circular'&&this.options.size!==null&&j>this.options.size)
cache.push(e);else if(p)
l+=d;v+=d;if(v>=clipping)
break;j++;}
for(var x=0;x<cache.length;x++)
cache[x].remove();if(l>0){this.list.css(this.wh,this.dimension(this.list)+l+'px');if(back){pos-=l;this.list.css(this.lt,$jc.intval(this.list.css(this.lt))-l+'px');}}
var last=i+visible-1;if(this.options.wrap!='circular'&&this.options.size&&last>this.options.size)
last=this.options.size;if(j>last){visible=0,j=last,v=0;while(++visible){var e=this.get(j--);if(!e.length)
break;v+=this.dimension(e);if(v>=clipping)
break;}}
var first=last-visible+1;if(this.options.wrap!='circular'&&first<1)
first=1;if(this.inTail&&back){pos+=this.tail;this.inTail=false;}
this.tail=null;if(this.options.wrap!='circular'&&last==this.options.size&&(last-visible+1)>=1){var m=$jc.margin(this.get(last),!this.options.vertical?'marginRight':'marginBottom');if((v-m)>clipping)
this.tail=v-clipping-m;}
while(i-->first)
pos+=this.dimension(this.get(i));this.prevFirst=this.first;this.prevLast=this.last;this.first=first;this.last=last;return pos;},animate:function(p,a){if(this.locked||this.animating)
return;this.animating=true;var self=this;var scrolled=function(){self.animating=false;if(p==0)
self.list.css(self.lt,0);if(self.options.wrap=='both'||self.options.wrap=='last'||self.options.size==null||self.last<self.options.size)
self.startAuto();self.buttons();self.notify('onAfterAnimation');};this.notify('onBeforeAnimation');if(!this.options.animation||a==false){this.list.css(this.lt,p+'px');scrolled();}else{var o=!this.options.vertical?{'left':p}:{'top':p};this.list.animate(o,this.options.animation,this.options.easing,scrolled);}},startAuto:function(s){if(s!=undefined)
this.options.auto=s;if(this.options.auto==0)
return this.stopAuto();if(this.timer!=null)
return;var self=this;this.timer=setTimeout(function(){self.next();},this.options.auto*1000);},stopAuto:function(){if(this.timer==null)
return;clearTimeout(this.timer);this.timer=null;},buttons:function(n,p){if(n==undefined||n==null){var n=!this.locked&&this.options.size!==0&&((this.options.wrap&&this.options.wrap!='first')||this.options.size==null||this.last<this.options.size);if(!this.locked&&(!this.options.wrap||this.options.wrap=='first')&&this.options.size!=null&&this.last>=this.options.size)
n=this.tail!=null&&!this.inTail;}
if(p==undefined||p==null){var p=!this.locked&&this.options.size!==0&&((this.options.wrap&&this.options.wrap!='last')||this.first>1);if(!this.locked&&(!this.options.wrap||this.options.wrap=='last')&&this.options.size!=null&&this.first==1)
p=this.tail!=null&&this.inTail;}
var self=this;this.buttonNext[n?'bind':'unbind'](this.options.buttonNextEvent,this.funcNext)[n?'removeClass':'addClass'](this.className('jcarousel-next-disabled')).attr('disabled',n?false:true);this.buttonPrev[p?'bind':'unbind'](this.options.buttonPrevEvent,this.funcPrev)[p?'removeClass':'addClass'](this.className('jcarousel-prev-disabled')).attr('disabled',p?false:true);if(this.buttonNext.length>0&&(this.buttonNext[0].jcarouselstate==undefined||this.buttonNext[0].jcarouselstate!=n)&&this.options.buttonNextCallback!=null){this.buttonNext.each(function(){self.options.buttonNextCallback(self,this,n);});this.buttonNext[0].jcarouselstate=n;}
if(this.buttonPrev.length>0&&(this.buttonPrev[0].jcarouselstate==undefined||this.buttonPrev[0].jcarouselstate!=p)&&this.options.buttonPrevCallback!=null){this.buttonPrev.each(function(){self.options.buttonPrevCallback(self,this,p);});this.buttonPrev[0].jcarouselstate=p;}},notify:function(evt){var state=this.prevFirst==null?'init':(this.prevFirst<this.first?'next':'prev');this.callback('itemLoadCallback',evt,state);if(this.prevFirst!==this.first){this.callback('itemFirstInCallback',evt,state,this.first);this.callback('itemFirstOutCallback',evt,state,this.prevFirst);}
if(this.prevLast!==this.last){this.callback('itemLastInCallback',evt,state,this.last);this.callback('itemLastOutCallback',evt,state,this.prevLast);}
this.callback('itemVisibleInCallback',evt,state,this.first,this.last,this.prevFirst,this.prevLast);this.callback('itemVisibleOutCallback',evt,state,this.prevFirst,this.prevLast,this.first,this.last);},callback:function(cb,evt,state,i1,i2,i3,i4){if(this.options[cb]==undefined||(typeof this.options[cb]!='object'&&evt!='onAfterAnimation'))
return;var callback=typeof this.options[cb]=='object'?this.options[cb][evt]:this.options[cb];if(!$.isFunction(callback))
return;var self=this;if(i1===undefined)
callback(self,state,evt);else if(i2===undefined)
this.get(i1).each(function(){callback(self,this,i1,state,evt);});else{for(var i=i1;i<=i2;i++)
if(i!==null&&!(i>=i3&&i<=i4))
this.get(i).each(function(){callback(self,this,i,state,evt);});}},create:function(i){return this.format('<li></li>',i);},format:function(e,i){var $e=$(e).addClass(this.className('jcarousel-item')).addClass(this.className('jcarousel-item-'+i));$e.attr('jcarouselindex',i);return $e;},className:function(c){return c+' '+c+(!this.options.vertical?'-horizontal':'-vertical');},dimension:function(e,d){var el=e.jquery!=undefined?e[0]:e;var old=!this.options.vertical?el.offsetWidth+$jc.margin(el,'marginLeft')+$jc.margin(el,'marginRight'):el.offsetHeight+$jc.margin(el,'marginTop')+$jc.margin(el,'marginBottom');if(d==undefined||old==d)
return old;var w=!this.options.vertical?d-$jc.margin(el,'marginLeft')-$jc.margin(el,'marginRight'):d-$jc.margin(el,'marginTop')-$jc.margin(el,'marginBottom');$(el).css(this.wh,w+'px');return this.dimension(el);},clipping:function(){return!this.options.vertical?this.clip[0].offsetWidth-$jc.intval(this.clip.css('borderLeftWidth'))-$jc.intval(this.clip.css('borderRightWidth')):this.clip[0].offsetHeight-$jc.intval(this.clip.css('borderTopWidth'))-$jc.intval(this.clip.css('borderBottomWidth'));},index:function(i,s){if(s==undefined)
s=this.options.size;return Math.round((((i-1)/s)-Math.floor((i-1)/s))*s)+1;}});$jc.extend({defaults:function(d){return $.extend(defaults,d||{});},margin:function(e,p){if(!e)
return 0;var el=e.jquery!=undefined?e[0]:e;if(p=='marginRight'&&$.browser.safari){var old={'display':'block','float':'none','width':'auto'},oWidth,oWidth2;$.swap(el,old,function(){oWidth=el.offsetWidth;});old['marginRight']=0;$.swap(el,old,function(){oWidth2=el.offsetWidth;});return oWidth2-oWidth;}
return $jc.intval($.css(el,p));},intval:function(v){v=parseInt(v);return isNaN(v)?0:v;}});})(jQuery);;(function($){jQuery.fn.newSimpleRequestDialogOpener=function(successFunction){$(this).each(function(index,element){var opener=$(element);var active=true;var width=550;var height=300;var openerId=opener.attr("id");var openerClass=opener.attr("class");var url=opener.attr("data-url");var title=opener.attr("data-title")||"";var text=opener.attr("data-text");var method=opener.attr("data-method")||"GET";method=method.toUpperCase();var data=opener.attr("data-data");var dialog=$('"<div class="hidden '+openerClass+"Dialog"+'" id="'+openerId+'"Dialog"><div class="section">'+text+'</div><div class="section hidden"><div>method: '+method+'</div><div>url: '+url+'</div></div></div>');dialog.dialog({title:title,autoOpen:false,width:width,closeOnEscape:true,height:height,buttons:[{text:"Ok",click:function(e){if(active===true){active=false;try{jQuery.ajax({type:method,url:url,contentType:'application/json',data:data,dataType:'json',success:function(data,textStatus,xhr){if(data.success!==false){successFunction(opener);dialog.dialog("close");}else{if(dialog.find(".errorMessage").text()!==data.message){dialog.append("<div class='boxPadding hidden ui-state-error errorMessage'>"+data.message+"</div>");dialog.find(".errorMessage").fadeIn();}}}});dialog.ajaxError(function(e,xhr,ajaxsettings,exception){if(dialog.find(".errorMessage").text()!==xhr.statusText){dialog.append("<div class='boxPadding hidden ui-state-error errorMessage'>"+xhr.statusText+"</div>");dialog.find(".errorMessage").fadeIn();}
if((xhr.status==='401')||(xhr.status==='402')||(xhr.status==='403')){window.location.href=m2dUrl({pathname:"/site/login"});}else if(xhr.status==='404'){window.location.href=m2dUrl({pathname:"/"});}else{window.location.href=m2dUrl({pathname:"/"});}});}catch(e){dialog.append("<div class='boxPadding hidden ui-state-error errorMessage'>"+e.stack()+"</div>");}}}},{text:"Cancel",click:function(e){dialog.find(".errorMessage").remove();$(this).dialog("close");}}]});opener.click(function(event){event.preventDefault();dialog.dialog("open");});});};})(jQuery);(function($){var defaultWidth=550;var defaultHeight=300;var dialog;jQuery.fn.openDialog=function(options){var settings=jQuery.extend({width:defaultWidth,height:defaultHeight},options);$(this).live("click",function(e){e.preventDefault();var opener=$(this);if(typeof(settings.preOpenHook)!=='undefined'){var preOpenHookData=settings.preOpenHook($(this));}
try{var linkId=opener.attr("id");var dialogId=linkId+"Dialog";if(typeof(settings.dialogSelector)!=='undefined'){dialog=$(settings.dialogSelector);}
else{dialog=$("#"+dialogId);}}
catch(e){alert(e);}
var dialogTitle=dialog.find(".title").text();var okButtonText=dialog.find(".ok").text();var cancelButtonText=dialog.find(".cancel").text();var buttons={};var okButton=okButtonText;var active=true;if(okButtonText!==''){buttons[okButton]=function(){if(active===true){active=false;settings.okFunction(opener,dialog,preOpenHookData);}};}
var cancelButton=cancelButtonText;if(cancelButton!==''){buttons[cancelButton]=function(){if(typeof(settings.cancelFunction)!=='undefined'){settings.cancelFunction(opener,dialog,preOpenHookData);}
dialog.dialog('close');};}
dialog.dialog({title:dialogTitle,width:settings.width,height:settings.height,buttons:buttons,close:function(dialog,preOpenHookData){settings.cancelFunction(dialog,preOpenHookData);}});dialog.dialog('open');e.preventDefault();return false;});};})(jQuery);(function($){var readyToSubmit=false;var _dialog;jQuery.fn.openFormDialog=function(allOptions){var formSettings=jQuery.extend({dataType:'json',type:'post',successFunction:function(responseText,statusText,xhr,$form){if(typeof(dialogSettings.successHook)!='undefined'){dialogSettings.successHook(responseText,statusText,xhr,$form);}
_dialog.dialog("close");$form.resetForm();},errorFunction:function(responseText,statusText,xhr,$form){if(typeof(dialogSettings.errorHook)!='undefined'){dialogSettings.errorHook(responseText,statusText,xhr,$form);}},completeFunction:function(xhr,statusText){if(typeof(dialogSettings.completeHook)!='undefined'){dialogSettings.completeHook(xhr,statusText);}}},allOptions.formOptions);var dialogSettings=jQuery.extend({width:300,height:150,okFunction:function(opener,dialog,preOpenHookData){_dialog=dialog;if(typeof(dialogSettings.okHook)!='undefined'){readyToSubmit=dialogSettings.okHook(opener,dialog,preOpenHookData);}
var formSelector="#"+dialog.attr("id")+" form";var form=$(formSelector);if(readyToSubmit){form.ajaxSubmit({dataType:formSettings.dataType,type:formSettings.type,success:formSettings.successFunction,error:formSettings.errorFunction,complete:formSettings.completeFunction});}
$("body").ajaxError(function(e,xhr,ajaxsettings,exception){if((xhr.status==401)|(xhr.status==402)|(xhr.status==403)){window.location.href=m2dUrl({pathname:"/site/login"});}
else if(xhr.status==404){}
else{if(typeof(dialogSettings.errorCallback)!='undefined'){dialogSettings.errorCallback(opener,xhr);}}});},cancelFunction:function(opener,dialog,preOpenHookData){try{if(typeof(dialogSettings.cancelHook)!='undefined'){dialogSettings.cancelHook(dialog,preOpenHookData);}
var formSelector="#"+dialog.attr("id")+" form";form=$(formSelector);form.resetForm();}catch(e){}}},allOptions.dialogOptions);$(this).openDialog(dialogSettings);};})(jQuery);(function($){var _dialog;var _opener;jQuery.fn.openSimpleRequestDialog=function(options){var settings=jQuery.extend({okFunction:function(opener,dialog,preOpenHookData){_dialog=dialog;_opener=opener;var url;if(typeof(settings.okHook)!='undefined'){var okHookData=settings.okHook(opener,dialog,preOpenHookData);}
if(typeof(okHookData)!=='undefined'){if(okHookData.url!==''){url=okHookData.url;}}else{url=dialog.find('.url').text();}
var data={};var method=settings.type||"GET";method=method.toUpperCase();jQuery.ajax({type:method,url:url,contentType:'application/json',data:data,dataType:'json',success:settings.successCallback(_opener,_dialog)});$("body").ajaxError(function(e,xhr,ajaxsettings,exception){if((xhr.status==401)|(xhr.status==402)|(xhr.status==403)){window.location.href=m2dUrl({pathname:"/site/login"});}
else if(xhr.status==404){alert(xhr.status+" This should not happen....");}
else{settings.errorCallback(opener,xhr);}});},cancelFunction:function(opener,dialog,preOpenHookData){if(typeof(settings.cancelHook)!='undefined'){settings.cancelHook(dialog,preOpenHookData);}}},options);$(this).openDialog(settings);};})(jQuery);;if(window.jQuery)(function($){if($.browser.msie)try{document.execCommand("BackgroundImageCache",false,true)}catch(e){};$.fn.rating=function(options){if(this.length==0)return this;if(typeof arguments[0]=='string'){if(this.length>1){var args=arguments;return this.each(function(){$.fn.rating.apply($(this),args);});};$.fn.rating[arguments[0]].apply(this,$.makeArray(arguments).slice(1)||[]);return this;};var options=$.extend({},$.fn.rating.options,options||{});$.fn.rating.calls++;this.not('.star-rating-applied').addClass('star-rating-applied').each(function(){var control,input=$(this);var eid=(this.name||'unnamed-rating').replace(/\[|\]/g,'_').replace(/^\_+|\_+$/g,'');var context=$(this.form||document.body);var raters=context.data('rating');if(!raters||raters.call!=$.fn.rating.calls)raters={count:0,call:$.fn.rating.calls};var rater=raters[eid];if(rater)control=rater.data('rating');if(rater&&control)
control.count++;else{control=$.extend({},options||{},($.metadata?input.metadata():($.meta?input.data():null))||{},{count:0,stars:[],inputs:[]});control.serial=raters.count++;rater=$('<span class="star-rating-control"/>');input.before(rater);rater.addClass('rating-to-be-drawn');if(input.attr('disabled'))control.readOnly=true;rater.append(control.cancel=$('<div class="rating-cancel"><a title="'+control.cancel+'">'+control.cancelValue+'</a></div>').mouseover(function(){$(this).rating('drain');$(this).addClass('star-rating-hover');}).mouseout(function(){$(this).rating('draw');$(this).removeClass('star-rating-hover');}).click(function(){$(this).rating('select');}).data('rating',control));};var star=$('<div class="star-rating rater-'+control.serial+'"><a title="'+(this.title||this.value)+'">'+this.value+'</a></div>');rater.append(star);if(this.id)star.attr('id',this.id);if(this.className)star.addClass(this.className);if(control.half)control.split=2;if(typeof control.split=='number'&&control.split>0){var stw=($.fn.width?star.width():0)||control.starWidth;var spi=(control.count%control.split),spw=Math.floor(stw/control.split);star.width(spw).find('a').css({'margin-left':'-'+(spi*spw)+'px'})};if(control.readOnly)
star.addClass('star-rating-readonly');else
star.addClass('star-rating-live').mouseover(function(){$(this).rating('fill');$(this).rating('focus');}).mouseout(function(){$(this).rating('draw');$(this).rating('blur');}).click(function(){$(this).rating('select');});if(this.checked)control.current=star;input.hide();input.change(function(){$(this).rating('select');});star.data('rating.input',input.data('rating.star',star));control.stars[control.stars.length]=star[0];control.inputs[control.inputs.length]=input[0];control.rater=raters[eid]=rater;control.context=context;input.data('rating',control);rater.data('rating',control);star.data('rating',control);context.data('rating',raters);});$('.rating-to-be-drawn').rating('draw').removeClass('rating-to-be-drawn');return this;};$.extend($.fn.rating,{calls:0,focus:function(){var control=this.data('rating');if(!control)return this;if(!control.focus)return this;var input=$(this).data('rating.input')||$(this.tagName=='INPUT'?this:null);if(control.focus)control.focus.apply(input[0],[input.val(),$('a',input.data('rating.star'))[0]]);},blur:function(){var control=this.data('rating');if(!control)return this;if(!control.blur)return this;var input=$(this).data('rating.input')||$(this.tagName=='INPUT'?this:null);if(control.blur)control.blur.apply(input[0],[input.val(),$('a',input.data('rating.star'))[0]]);},fill:function(){var control=this.data('rating');if(!control)return this;if(control.readOnly)return;this.rating('drain');this.prevAll().andSelf().filter('.rater-'+control.serial).addClass('star-rating-hover');},drain:function(){var control=this.data('rating');if(!control)return this;if(control.readOnly)return;control.rater.children().filter('.rater-'+control.serial).removeClass('star-rating-on').removeClass('star-rating-hover');},draw:function(){var control=this.data('rating');if(!control)return this;this.rating('drain');if(control.current){control.current.data('rating.input').attr('checked','checked');control.current.prevAll().andSelf().filter('.rater-'+control.serial).addClass('star-rating-on');}
else
$(control.inputs).removeAttr('checked');control.cancel[control.readOnly||control.required?'hide':'show']();this.siblings()[control.readOnly?'addClass':'removeClass']('star-rating-readonly');},select:function(value,wantCallBack){var control=this.data('rating');if(!control)return this;if(control.readOnly)return;control.current=null;if(typeof value!='undefined'){if(typeof value=='number')
return $(control.stars[value]).rating('select',undefined,wantCallBack);if(typeof value=='string')
$.each(control.stars,function(){if($(this).data('rating.input').val()==value)$(this).rating('select',undefined,wantCallBack);});}
else
control.current=this[0].tagName=='INPUT'?this.data('rating.star'):(this.is('.rater-'+control.serial)?this:null);this.data('rating',control);this.rating('draw');var input=$(control.current?control.current.data('rating.input'):null);if((wantCallBack||wantCallBack==undefined)&&control.callback)control.callback.apply(input[0],[input.val(),$('a',control.current)[0]]);},readOnly:function(toggle,disable){var control=this.data('rating');if(!control)return this;control.readOnly=toggle||toggle==undefined?true:false;if(disable)$(control.inputs).attr("disabled","disabled");else $(control.inputs).removeAttr("disabled");this.data('rating',control);this.rating('draw');},disable:function(){this.rating('readOnly',true,true);},enable:function(){this.rating('readOnly',false,false);}});$.fn.rating.options={cancel:'Cancel Rating',cancelValue:'',split:0,starWidth:16};$(function(){$('input[type=radio].star').rating();});})(jQuery);(function($){$.widget("ui.selectmenu",{_init:function(){var self=this,o=this.options;this.ids=[this.element.attr('id')+'-'+'button',this.element.attr('id')+'-'+'menu'];this._safemouseup=true;this.newelement=$('<a class="'+this.widgetBaseClass+' ui-widget ui-state-default ui-corner-all" id="'+this.ids[0]+'" role="button" href="#" aria-haspopup="true" aria-owns="'+this.ids[1]+'"></a>').insertAfter(this.element);var tabindex=this.element.attr('tabindex');if(tabindex){this.newelement.attr('tabindex',tabindex);}
this.newelement.data('selectelement',this.element);this.selectmenuIcon=$('<span class="'+this.widgetBaseClass+'-icon ui-icon"></span>').prependTo(this.newelement).addClass((o.style=="popup")?'ui-icon-triangle-2-n-s':'ui-icon-triangle-1-s');$('label[for='+this.element.attr('id')+']').attr('for',this.ids[0]).bind('click',function(){self.newelement[0].focus();return false;});this.newelement.bind('mousedown',function(event){self._toggle(event);if(o.style=="popup"){self._safemouseup=false;setTimeout(function(){self._safemouseup=true;},300);}
return false;}).bind('click',function(){return false;}).keydown(function(event){var ret=true;switch(event.keyCode){case $.ui.keyCode.ENTER:ret=true;break;case $.ui.keyCode.SPACE:ret=false;self._toggle(event);break;case $.ui.keyCode.UP:case $.ui.keyCode.LEFT:ret=false;self._moveSelection(-1);break;case $.ui.keyCode.DOWN:case $.ui.keyCode.RIGHT:ret=false;self._moveSelection(1);break;case $.ui.keyCode.TAB:ret=true;break;default:ret=false;self._typeAhead(event.keyCode,'mouseup');break;}
return ret;}).bind('mouseover focus',function(){$(this).addClass(self.widgetBaseClass+'-focus ui-state-hover');}).bind('mouseout blur',function(){$(this).removeClass(self.widgetBaseClass+'-focus ui-state-hover');});$(document).mousedown(function(event){self.close(event);});this.element.click(function(){this._refreshValue();}).focus(function(){this.newelement[0].focus();});var cornerClass=(o.style=="dropdown")?" ui-corner-bottom":" ui-corner-all"
this.list=$('<ul class="'+self.widgetBaseClass+'-menu ui-widget ui-widget-content'+cornerClass+'" aria-hidden="true" role="listbox" aria-labelledby="'+this.ids[0]+'" id="'+this.ids[1]+'"></ul>').appendTo('body');var selectOptionData=[];this.element.find('option').each(function(){selectOptionData.push({value:$(this).attr('value'),text:self._formatText(jQuery(this).text()),selected:$(this).attr('selected'),classes:$(this).attr('class'),parentOptGroup:$(this).parent('optgroup').attr('label')});});var activeClass=(self.options.style=="popup")?" ui-state-active":"";for(var i in selectOptionData){var thisLi=$('<li role="presentation"><a href="#" tabindex="-1" role="option" aria-selected="false">'+selectOptionData[i].text+'</a></li>').data('index',i).addClass(selectOptionData[i].classes).data('optionClasses',selectOptionData[i].classes||'').mouseup(function(event){if(self._safemouseup){var changed=$(this).data('index')!=self._selectedIndex();self.value($(this).data('index'));self.select(event);if(changed){self.change(event);}
self.close(event,true);}
return false;}).click(function(){return false;}).bind('mouseover focus',function(){self._selectedOptionLi().addClass(activeClass);self._focusedOptionLi().removeClass(self.widgetBaseClass+'-item-focus ui-state-hover');$(this).removeClass('ui-state-active').addClass(self.widgetBaseClass+'-item-focus ui-state-hover');}).bind('mouseout blur',function(){if($(this).is(self._selectedOptionLi())){$(this).addClass(activeClass);}
$(this).removeClass(self.widgetBaseClass+'-item-focus ui-state-hover');});if(selectOptionData[i].parentOptGroup){var optGroupName=self.widgetBaseClass+'-group-'+selectOptionData[i].parentOptGroup;if(this.list.find('li.'+optGroupName).size()){this.list.find('li.'+optGroupName+':last ul').append(thisLi);}
else{$('<li role="presentation" class="'+self.widgetBaseClass+'-group '+optGroupName+'"><span class="'+self.widgetBaseClass+'-group-label">'+selectOptionData[i].parentOptGroup+'</span><ul></ul></li>').appendTo(this.list).find('ul').append(thisLi);}}
else{thisLi.appendTo(this.list);}
this.list.bind('mousedown mouseup',function(){return false;});if(o.icons){for(var j in o.icons){if(thisLi.is(o.icons[j].find)){thisLi.data('optionClasses',selectOptionData[i].classes+' '+self.widgetBaseClass+'-hasIcon').addClass(self.widgetBaseClass+'-hasIcon');var iconClass=o.icons[j].icon||"";thisLi.find('a:eq(0)').prepend('<span class="'+self.widgetBaseClass+'-item-icon ui-icon '+iconClass+'"></span>');}}}}
this.list.find('li:last').addClass("ui-corner-bottom");if(o.style=='popup'){this.list.find('li:first').addClass("ui-corner-top");}
if(o.transferClasses){var transferClasses=this.element.attr('class')||'';this.newelement.add(this.list).addClass(transferClasses);}
var selectWidth=this.element.width();this.newelement.width((o.width)?o.width:selectWidth);if(o.style=='dropdown'){this.list.width((o.menuWidth)?o.menuWidth:((o.width)?o.width:selectWidth));}
else{this.list.width((o.menuWidth)?o.menuWidth:((o.width)?o.width-o.handleWidth:selectWidth-o.handleWidth));}
if(o.maxHeight&&o.maxHeight<this.list.height()){this.list.height(o.maxHeight);}
this._optionLis=this.list.find('li:not(.'+self.widgetBaseClass+'-group)');this.list.keydown(function(event){var ret=true;switch(event.keyCode){case $.ui.keyCode.UP:case $.ui.keyCode.LEFT:ret=false;self._moveFocus(-1);break;case $.ui.keyCode.DOWN:case $.ui.keyCode.RIGHT:ret=false;self._moveFocus(1);break;case $.ui.keyCode.HOME:ret=false;self._moveFocus(':first');break;case $.ui.keyCode.PAGE_UP:ret=false;self._scrollPage('up');break;case $.ui.keyCode.PAGE_DOWN:ret=false;self._scrollPage('down');break;case $.ui.keyCode.END:ret=false;self._moveFocus(':last');break;case $.ui.keyCode.ENTER:case $.ui.keyCode.SPACE:ret=false;self.close(event,true);$(event.target).parents('li:eq(0)').trigger('mouseup');break;case $.ui.keyCode.TAB:ret=true;self.close(event,true);break;case $.ui.keyCode.ESCAPE:ret=false;self.close(event,true);break;default:ret=false;self._typeAhead(event.keyCode,'focus');break;}
return ret;});if(o.style=='dropdown'){this.newelement.addClass(self.widgetBaseClass+"-dropdown");this.list.addClass(self.widgetBaseClass+"-menu-dropdown");}
else{this.newelement.addClass(self.widgetBaseClass+"-popup");this.list.addClass(self.widgetBaseClass+"-menu-popup");}
this.newelement.prepend('<span class="'+self.widgetBaseClass+'-status">'+selectOptionData[this._selectedIndex()].text+'</span>');this.element.hide();if(this.element.attr('disabled')==true){this.disable();}
this.value(this._selectedIndex());},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+'-disabled'+' '+this.namespace+'-state-disabled').removeAttr('aria-disabled');$('label[for='+this.newelement.attr('id')+']').attr('for',this.element.attr('id')).unbind('click');this.newelement.remove();this.list.remove();this.element.show();},_typeAhead:function(code,eventType){var self=this;if(!self._prevChar){self._prevChar=['',0];}
var C=String.fromCharCode(code);c=C.toLowerCase();var focusFound=false;function focusOpt(elem,ind){focusFound=true;$(elem).trigger(eventType);self._prevChar[1]=ind;};this.list.find('li a').each(function(i){if(!focusFound){var thisText=$(this).text();if(thisText.indexOf(C)==0||thisText.indexOf(c)==0){if(self._prevChar[0]==C){if(self._prevChar[1]<i){focusOpt(this,i);}}
else{focusOpt(this,i);}}}});this._prevChar[0]=C;},_uiHash:function(){return{value:this.value()};},open:function(event){var self=this;var disabledStatus=this.newelement.attr("aria-disabled");if(disabledStatus!='true'){this._refreshPosition();this._closeOthers(event);this.newelement.addClass('ui-state-active');this.list.appendTo('body').addClass(self.widgetBaseClass+'-open').attr('aria-hidden',false).find('li:not(.'+self.widgetBaseClass+'-group):eq('+this._selectedIndex()+') a')[0].focus();if(this.options.style=="dropdown"){this.newelement.removeClass('ui-corner-all').addClass('ui-corner-top');}
this._refreshPosition();this._trigger("open",event,this._uiHash());}},close:function(event,retainFocus){if(this.newelement.is('.ui-state-active')){this.newelement.removeClass('ui-state-active');this.list.attr('aria-hidden',true).removeClass(this.widgetBaseClass+'-open');if(this.options.style=="dropdown"){this.newelement.removeClass('ui-corner-top').addClass('ui-corner-all');}
if(retainFocus){this.newelement[0].focus();}
this._trigger("close",event,this._uiHash());}},change:function(event){this.element.trigger('change');this._trigger("change",event,this._uiHash());},select:function(event){this._trigger("select",event,this._uiHash());},_closeOthers:function(event){$('.'+this.widgetBaseClass+'.ui-state-active').not(this.newelement).each(function(){$(this).data('selectelement').selectmenu('close',event);});$('.'+this.widgetBaseClass+'.ui-state-hover').trigger('mouseout');},_toggle:function(event,retainFocus){if(this.list.is('.'+this.widgetBaseClass+'-open')){this.close(event,retainFocus);}
else{this.open(event);}},_formatText:function(text){return this.options.format?this.options.format(text):text;},_selectedIndex:function(){return this.element[0].selectedIndex;},_selectedOptionLi:function(){return this._optionLis.eq(this._selectedIndex());},_focusedOptionLi:function(){return this.list.find('.'+this.widgetBaseClass+'-item-focus');},_moveSelection:function(amt){var currIndex=parseInt(this._selectedOptionLi().data('index'),10);var newIndex=currIndex+amt;return this._optionLis.eq(newIndex).trigger('mouseup');},_moveFocus:function(amt){if(!isNaN(amt)){var currIndex=parseInt(this._focusedOptionLi().data('index'),10);var newIndex=currIndex+amt;}
else{var newIndex=parseInt(this._optionLis.filter(amt).data('index'),10);}
if(newIndex<0){newIndex=0;}
if(newIndex>this._optionLis.size()-1){newIndex=this._optionLis.size()-1;}
var activeID=this.widgetBaseClass+'-item-'+Math.round(Math.random()*1000);this._focusedOptionLi().find('a:eq(0)').attr('id','');this._optionLis.eq(newIndex).find('a:eq(0)').attr('id',activeID)[0].focus();this.list.attr('aria-activedescendant',activeID);},_scrollPage:function(direction){var numPerPage=Math.floor(this.list.outerHeight()/this.list.find('li:first').outerHeight());numPerPage=(direction=='up')?-numPerPage:numPerPage;this._moveFocus(numPerPage);},_setData:function(key,value){this.options[key]=value;if(key=='disabled'){this.close();this.element.add(this.newelement).add(this.list)
[value?'addClass':'removeClass'](this.widgetBaseClass+'-disabled'+' '+
this.namespace+'-state-disabled').attr("aria-disabled",value);}},value:function(newValue){if(arguments.length){this.element[0].selectedIndex=newValue;this._refreshValue();this._refreshPosition();}
return this.element[0].selectedIndex;},_refreshValue:function(){var activeClass=(this.options.style=="popup")?" ui-state-active":"";var activeID=this.widgetBaseClass+'-item-'+Math.round(Math.random()*1000);this.list.find('.'+this.widgetBaseClass+'-item-selected').removeClass(this.widgetBaseClass+"-item-selected"+activeClass).find('a').attr('aria-selected','false').attr('id','');this._selectedOptionLi().addClass(this.widgetBaseClass+"-item-selected"+activeClass).find('a').attr('aria-selected','true').attr('id',activeID);var currentOptionClasses=this.newelement.data('optionClasses')?this.newelement.data('optionClasses'):"";var newOptionClasses=this._selectedOptionLi().data('optionClasses')?this._selectedOptionLi().data('optionClasses'):"";this.newelement.removeClass(currentOptionClasses).data('optionClasses',newOptionClasses).addClass(newOptionClasses).find('.'+this.widgetBaseClass+'-status').html(this._selectedOptionLi().find('a:eq(0)').html());this.list.attr('aria-activedescendant',activeID)},_refreshPosition:function(){this.list.css('left',this.newelement.offset().left);var menuTop=this.newelement.offset().top;var scrolledAmt=this.list[0].scrollTop;this.list.find('li:lt('+this._selectedIndex()+')').each(function(){scrolledAmt-=$(this).outerHeight();});if(this.newelement.is('.'+this.widgetBaseClass+'-popup')){menuTop+=scrolledAmt;this.list.css('top',menuTop);}
else{menuTop+=this.newelement.height();this.list.css('top',menuTop);}}});$.extend($.ui.selectmenu,{getter:"value",version:"@VERSION",eventPrefix:"selectmenu",defaults:{transferClasses:true,style:'popup',width:null,menuWidth:null,handleWidth:26,maxHeight:null,icons:null,format:null}});})(jQuery);(function($){$('html').addClass('stylish-select');Array.prototype.indexOf=function(obj,start){for(var i=(start||0);i<this.length;i++){if(this[i]==obj){return i;}}}
$.fn.extend({getSetSSValue:function(value){if(value){$(this).val(value).change();return this;}else{return $(this).find(':selected').val();}},resetSS:function(){var oldOpts=$(this).data('ssOpts');$this=$(this);$this.next().remove();$this.unbind('.sSelect').sSelect(oldOpts);}});$.fn.sSelect=function(options){return this.each(function(){var defaults={defaultText:'Please select',animationSpeed:0,ddMaxHeight:''};var opts=$.extend(defaults,options),$input=$(this),$containerDivText=$('<div class="selectedTxt"></div>'),$containerDiv=$('<div class="newListSelected" tabindex="0"></div>'),$newUl=$('<ul class="newList"></ul>'),itemIndex=-1,currentIndex=-1,keys=[],prevKey=false,prevented=false,$newLi;$(this).data('ssOpts',options);$containerDiv.insertAfter($input);$containerDivText.prependTo($containerDiv);$newUl.appendTo($containerDiv);$input.hide();$containerDivText.data('ssReRender',!$containerDivText.is(':visible'));if($input.children('optgroup').length==0){$input.children().each(function(i){var option=$(this).text();var key=$(this).val();keys.push(option.charAt(0).toLowerCase());if($(this).attr('selected')==true){opts.defaultText=option;currentIndex=i;}
$newUl.append($('<li><a href="JavaScript:void(0);">'+option+'</a></li>').data('key',key));});$newLi=$newUl.children().children();}else{$input.children('optgroup').each(function(){var optionTitle=$(this).attr('label'),$optGroup=$('<li class="newListOptionTitle">'+optionTitle+'</li>');$optGroup.appendTo($newUl);var $optGroupList=$('<ul></ul>');$optGroupList.appendTo($optGroup);$(this).children().each(function(){++itemIndex;var option=$(this).text();var key=$(this).val();keys.push(option.charAt(0).toLowerCase());if($(this).attr('selected')==true){opts.defaultText=option;currentIndex=itemIndex;}
$optGroupList.append($('<li><a href="JavaScript:void(0);">'+option+'</a></li>').data('key',key));})});$newLi=$newUl.find('ul li a');}
var newUlHeight=$newUl.height(),containerHeight=$containerDiv.height(),newLiLength=$newLi.length;if(currentIndex!=-1){navigateList(currentIndex,true);}else{$containerDivText.text(opts.defaultText);}
function newUlPos(){var containerPosY=$containerDiv.offset().top,docHeight=jQuery(window).height(),scrollTop=jQuery(window).scrollTop();if(newUlHeight>parseInt(opts.ddMaxHeight)){newUlHeight=parseInt(opts.ddMaxHeight);}
containerPosY=containerPosY-scrollTop;if(containerPosY+newUlHeight>=docHeight){$newUl.css({top:'-'+newUlHeight+'px',height:newUlHeight});$input.onTop=true;}else{$newUl.css({top:containerHeight+'px',height:newUlHeight});$input.onTop=false;}}
newUlPos();$(window).bind('resize.sSelect',function(){newUlPos();});$(window).bind('scroll.sSelect',function(){newUlPos();});function positionFix(){$containerDiv.css('position','relative');}
function positionHideFix(){$containerDiv.css('position','static');}
$containerDivText.bind('click.sSelect',function(event){event.stopPropagation();if($(this).data('ssReRender')){newUlHeight=$newUl.height('').height();containerHeight=$containerDiv.height();$(this).data('ssReRender',false);newUlPos();}
$('.newList').not($(this).next()).hide().parent().removeClass('newListSelFocus');$newUl.toggle();positionFix();$newLi.eq(currentIndex).focus();});$newLi.bind('click.sSelect',function(e){var $clickedLi=$(e.target);currentIndex=$newLi.index($clickedLi);prevented=true;navigateList(currentIndex);$newUl.hide();$containerDiv.css('position','static');});$newLi.bind('mouseenter.sSelect',function(e){var $hoveredLi=$(e.target);$hoveredLi.addClass('newListHover');}).bind('mouseleave.sSelect',function(e){var $hoveredLi=$(e.target);$hoveredLi.removeClass('newListHover');});function navigateList(currentIndex,init){$newLi.removeClass('hiLite').eq(currentIndex).addClass('hiLite');if($newUl.is(':visible')){$newLi.eq(currentIndex).focus();}
var text=$newLi.eq(currentIndex).text();var val=$newLi.eq(currentIndex).parent().data('key');if(init==true){$input.val(val);$containerDivText.text(text);return false;}
$input.val(val)
$input.change();$containerDivText.text(text);};$input.bind('change.sSelect',function(event){$targetInput=$(event.target);if(prevented==true){prevented=false;return false;}
$currentOpt=$targetInput.find(':selected');currentIndex=$targetInput.find('option').index($currentOpt);navigateList(currentIndex,true);});function keyPress(element){$(element).unbind('keydown.sSelect').bind('keydown.sSelect',function(e){var keycode=e.which;prevented=true;switch(keycode){case 40:case 39:incrementList();return false;break;case 38:case 37:decrementList();return false;break;case 33:case 36:gotoFirst();return false;break;case 34:case 35:gotoLast();return false;break;case 13:case 27:$newUl.hide();positionHideFix();return false;break;}
keyPressed=String.fromCharCode(keycode).toLowerCase();var currentKeyIndex=keys.indexOf(keyPressed);if(typeof currentKeyIndex!='undefined'){++currentIndex;currentIndex=keys.indexOf(keyPressed,currentIndex);if(currentIndex==-1||currentIndex==null||prevKey!=keyPressed)currentIndex=keys.indexOf(keyPressed);navigateList(currentIndex);prevKey=keyPressed;return false;}});}
function incrementList(){if(currentIndex<(newLiLength-1)){++currentIndex;navigateList(currentIndex);}}
function decrementList(){if(currentIndex>0){--currentIndex;navigateList(currentIndex);}}
function gotoFirst(){currentIndex=0;navigateList(currentIndex);}
function gotoLast(){currentIndex=newLiLength-1;navigateList(currentIndex);}
$containerDiv.bind('click.sSelect',function(){keyPress(this);});$containerDiv.bind('focus.sSelect',function(){$(this).addClass('newListSelFocus');keyPress(this);});$containerDiv.bind('blur.sSelect',function(){$(this).removeClass('newListSelFocus');});$('body').bind('click.sSelect',function(){$containerDiv.removeClass('newListSelFocus');$newUl.hide();positionHideFix();});$containerDivText.bind('mouseenter.sSelect',function(e){var $hoveredTxt=$(e.target);$hoveredTxt.parent().addClass('newListSelHover');}).bind('mouseleave.sSelect',function(e){var $hoveredTxt=$(e.target);$hoveredTxt.parent().removeClass('newListSelHover');});$newUl.css('left','0').hide();});};})(jQuery);;(function($,undefined){var tag2attr={a:'href',img:'src',form:'action',base:'href',script:'src',iframe:'src',link:'href'},key=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"],aliases={"anchor":"fragment"},parser={strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/},querystring_parser=/(?:^|&|;)([^&=;]*)=?([^&;]*)/g,fragment_parser=/(?:^|&|;)([^&=;]*)=?([^&;]*)/g;function parseUri(url,strictMode)
{var str=decodeURI(url),res=parser[strictMode||false?"strict":"loose"].exec(str),uri={attr:{},param:{},seg:{}},i=14;while(i--)
{uri.attr[key[i]]=res[i]||"";}
uri.param['query']={};uri.param['fragment']={};uri.attr['query'].replace(querystring_parser,function($0,$1,$2){if($1)
{uri.param['query'][$1]=$2;}});uri.attr['fragment'].replace(fragment_parser,function($0,$1,$2){if($1)
{uri.param['fragment'][$1]=$2;}});uri.seg['path']=uri.attr.path.replace(/^\/+|\/+$/g,'').split('/');uri.seg['fragment']=uri.attr.fragment.replace(/^\/+|\/+$/g,'').split('/');uri.attr['base']=uri.attr.host?uri.attr.protocol+"://"+uri.attr.host+(uri.attr.port?":"+uri.attr.port:''):'';return uri;};function getAttrName(elm)
{var tn=elm.tagName;if(tn!==undefined)return tag2attr[tn.toLowerCase()];return tn;}
$.fn.url=function(strictMode)
{var url='';if(this.length)
{url=$(this).attr(getAttrName(this[0]))||'';}
return $.url(url,strictMode);};$.url=function(url,strictMode)
{if(arguments.length===1&&url===true)
{strictMode=true;url=undefined;}
strictMode=strictMode||false;url=url||window.location.toString();return{data:parseUri(url,strictMode),attr:function(attr)
{attr=aliases[attr]||attr;return attr!==undefined?this.data.attr[attr]:this.data.attr;},param:function(param)
{return param!==undefined?this.data.param.query[param]:this.data.param.query;},fparam:function(param)
{return param!==undefined?this.data.param.fragment[param]:this.data.param.fragment;},segment:function(seg)
{if(seg===undefined)
{return this.data.seg.path;}
else
{seg=seg<0?this.data.seg.path.length+seg:seg-1;return this.data.seg.path[seg];}},fsegment:function(seg)
{if(seg===undefined)
{return this.data.seg.fragment;}
else
{seg=seg<0?this.data.seg.fragment.length+seg:seg-1;return this.data.seg.fragment[seg];}}};};})(jQuery);(function($){var win=$(window),options,images,activeImage=-1,activeURL,prevImage,nextImage,compatibleOverlay,middle,centerWidth,centerHeight,ie6=!window.XMLHttpRequest,hiddenElements=[],documentElement=document.documentElement,preload={},preloadPrev=new Image(),preloadNext=new Image(),overlay,center,image,sizer,prevLink,nextLink,bottomContainer,bottom,caption,number;$(function(){$("body").append($([overlay=$('<div id="lbOverlay" />')[0],center=$('<div id="lbCenter" />')[0],bottomContainer=$('<div id="lbBottomContainer" />')[0]]).css("display","none"));image=$('<div id="lbImage" />').appendTo(center).append(sizer=$('<div style="position: relative;" />').append([prevLink=$('<a id="lbPrevLink" href="#" />').click(previous)[0],nextLink=$('<a id="lbNextLink" href="#" />').click(next)[0]])[0])[0];bottom=$('<div id="lbBottom" />').appendTo(bottomContainer).append([$('<a id="lbCloseLink" href="#" />').add(overlay).click(close)[0],caption=$('<div id="lbCaption" />')[0],number=$('<div id="lbNumber" />')[0],$('<div style="clear: both;" />')[0]])[0];});$.slimbox=function(_images,startImage,_options){options=$.extend({loop:false,overlayOpacity:0.8,overlayFadeDuration:400,resizeDuration:400,resizeEasing:"swing",initialWidth:250,initialHeight:250,imageFadeDuration:400,captionAnimationDuration:400,counterText:"Image {x} of {y}",closeKeys:[27,88,67],previousKeys:[37,80],nextKeys:[39,78]},_options);if(typeof _images=="string"){_images=[[_images,startImage]];startImage=0;}
middle=win.scrollTop()+(win.height()/2);centerWidth=options.initialWidth;centerHeight=options.initialHeight;$(center).css({top:Math.max(0,middle-(centerHeight/2)),width:centerWidth,height:centerHeight,marginLeft:-centerWidth/2}).show();compatibleOverlay=ie6||(overlay.currentStyle&&(overlay.currentStyle.position!="fixed"));if(compatibleOverlay)overlay.style.position="absolute";$(overlay).css("opacity",options.overlayOpacity).fadeIn(options.overlayFadeDuration);position();setup(1);images=_images;options.loop=options.loop&&(images.length>1);return changeImage(startImage);};$.fn.slimbox=function(_options,linkMapper,linksFilter){linkMapper=linkMapper||function(el){return[el.href,el.title];};linksFilter=linksFilter||function(){return true;};var links=this;return links.unbind("click").click(function(){var link=this,startIndex=0,filteredLinks,i=0,length;filteredLinks=$.grep(links,function(el,i){return linksFilter.call(link,el,i);});for(length=filteredLinks.length;i<length;++i){if(filteredLinks[i]==link)startIndex=i;filteredLinks[i]=linkMapper(filteredLinks[i],i);}
return $.slimbox(filteredLinks,startIndex,_options);});};function position(){var l=win.scrollLeft(),w=win.width();$([center,bottomContainer]).css("left",l+(w/2));if(compatibleOverlay)$(overlay).css({left:l,top:win.scrollTop(),width:w,height:win.height()});}
function setup(open){if(open){$("object").add(ie6?"select":"embed").each(function(index,el){hiddenElements[index]=[el,el.style.visibility];el.style.visibility="hidden";});}else{$.each(hiddenElements,function(index,el){el[0].style.visibility=el[1];});hiddenElements=[];}
var fn=open?"bind":"unbind";win[fn]("scroll resize",position);$(document)[fn]("keydown",keyDown);}
function keyDown(event){var code=event.keyCode,fn=$.inArray;return(fn(code,options.closeKeys)>=0)?close():(fn(code,options.nextKeys)>=0)?next():(fn(code,options.previousKeys)>=0)?previous():false;}
function previous(){return changeImage(prevImage);}
function next(){return changeImage(nextImage);}
function changeImage(imageIndex){if(imageIndex>=0){activeImage=imageIndex;activeURL=images[activeImage][0];prevImage=(activeImage||(options.loop?images.length:0))-1;nextImage=((activeImage+1)%images.length)||(options.loop?0:-1);stop();center.className="lbLoading";preload=new Image();preload.onload=animateBox;preload.src=activeURL;}
return false;}
function animateBox(){center.className="";$(image).css({backgroundImage:"url("+activeURL+")",visibility:"hidden",display:""});$(sizer).width(preload.width);$([sizer,prevLink,nextLink]).height(preload.height);$(caption).html(images[activeImage][1]||"");$(number).html((((images.length>1)&&options.counterText)||"").replace(/{x}/,activeImage+1).replace(/{y}/,images.length));if(prevImage>=0)preloadPrev.src=images[prevImage][0];if(nextImage>=0)preloadNext.src=images[nextImage][0];centerWidth=image.offsetWidth;centerHeight=image.offsetHeight;var top=Math.max(0,middle-(centerHeight/2));if(center.offsetHeight!=centerHeight){$(center).animate({height:centerHeight,top:top},options.resizeDuration,options.resizeEasing);}
if(center.offsetWidth!=centerWidth){$(center).animate({width:centerWidth,marginLeft:-centerWidth/2},options.resizeDuration,options.resizeEasing);}
$(center).queue(function(){$(bottomContainer).css({width:centerWidth,top:top+centerHeight,marginLeft:-centerWidth/2,visibility:"hidden",display:""});$(image).css({display:"none",visibility:"",opacity:""}).fadeIn(options.imageFadeDuration,animateCaption);});}
function animateCaption(){if(prevImage>=0)$(prevLink).show();if(nextImage>=0)$(nextLink).show();$(bottom).css("marginTop",-bottom.offsetHeight).animate({marginTop:0},options.captionAnimationDuration);bottomContainer.style.visibility="";}
function stop(){preload.onload=null;preload.src=preloadPrev.src=preloadNext.src=activeURL;$([center,image,bottom]).stop(true);$([prevLink,nextLink,image,bottomContainer]).hide();}
function close(){if(activeImage>=0){stop();activeImage=prevImage=nextImage=-1;$(center).hide();$(overlay).stop().fadeOut(options.overlayFadeDuration,setup);}
return false;}})(jQuery);
