$(function(){var e=$("#select-photo").length;$("div.template a").click(function(){if(!e){return true}var j=this.id;var i=j.substr(1,j.length);var g=tplData[i];if(!g.mphotos){var h=ImageSetWidget.get_selected();if(h){$("#next-step-form").attr("action","./"+g.name+"/result/");$("#selected-images").val(h.storage.get(h.i).url);$("#next-step-form").submit();return false}}return true});if(e){function f(g){}CustomImage.init();CustomImage.addListener("start",function(){ImageSetWidget.set_isDisabled(true)}).addListener("success",function(g,h){UploadedImages.add({url:g,thumbUrl:h},true);ImageSetWidget.set_isDisabled(false);f({url:g,thumbUrl:h})});ImageSetWidget.set__unselectSelectedOnClick(true);enhancedStorage.init({max_items:maxHistoryItems});var d=$("#results div.items");var c=new FloatHint({domContainer:d});EnhancedImages=new ImageSetWidget({id:"enhanced",storage:enhancedStorage,itemConstructor:ImageSetItem,domContainer:d,select_callback:function(h,j,i,g){f(i)},hint:c,max_items:maxHistoryItems});EnhancedImageCandidate.init();uploadedStorage.init({max_items:maxHistoryItems});var b=$("#uploaded-photos div.items");var a=new FloatHint({domContainer:b});UploadedImages=new ImageSetWidget({id:"uploaded",storage:uploadedStorage,itemConstructor:ImageSetItem,domContainer:$("#uploaded-photos div.items"),select_callback:function(h,j,i,g){f(i)},hint:a,max_items:maxHistoryItems});SampleImages=new ImageSetWidget({id:"samples",storage:samplesStorage,itemConstructor:SampleImageSetItem,domContainer:$("#open-demo"),select_callback:function(h,j,i,g){f({url:h,thumbUrl:h})}})}(function(){var l={domain:"avatar.pho.to",hoursToLive:24*30};var k=$("div.group");var j=$("div.template:gt(22)",k);var i=$("a.templates-more");var h=function(){$.cookies.set("fte","1",l);j.show();i.hide();$("#show-popular").attr("checked","");$("#show-all").attr("checked","checked")};var g=function(){$.cookies.set("ate","",l);j.hide();i.show();$("#show-popular").attr("checked","checked");$("#show-all").attr("checked","")};$("#show-all").click(function(){h();return true});$("#show-popular").click(function(){g();return true});i.click(function(){h();return false})})();$("div.template").hover(function(){$("div.template-hint",$(this)).show()},function(){$("div.template-hint",$(this)).hide()})});
