/*
	Copyright (c) 2004-2007, The Dojo Foundation
	All Rights Reserved.

	Licensed under the Academic Free License version 2.1 or above OR the
	modified BSD license. For more information on Dojo licensing, see:

		http://dojotoolkit.org/book/dojo-book-0-9/introduction/licensing
*/

/*
	This is a compiled version of Dojo, built for deployment and not for
	development. To get an editable version, please visit:

		http://dojotoolkit.org

	for documentation and information on getting the source.
*/

if(!dojo._hasResource["sfly.ajax.AjaxWrapper"]){dojo._hasResource["sfly.ajax.AjaxWrapper"]=true;dojo.provide("sfly.ajax.AjaxWrapper");dojo.provide("sfly.ajax.AjaxCache");dojo.declare("sfly.ajax.AjaxCache",null,{constructor:function(){this._cache={};},getCacheKey:function(_1,_2,_3){return _1+"|"+_2+"|"+_3.toLowerCase();},addToCache:function(_4,_5){this._cache[_4]=_5;},getFromCache:function(_6){return this._cache[_6];},clearCache:function(){this._cache={};}});var pageCache=new sfly.ajax.AjaxCache();dojo.declare("sfly.ajax.AjaxWrapper",null,{constructor:function(_7,_8,_9){if(_9.callback){this._callback=_9.callback;}this.synchronous=false;if(_9.synchronous==true){this.synchronous=true;}this._serviceRequests=_8;var _a=_9.timeout;this._fandf=_9.fireAndForget;this._pageController=_7;this._doCache=_9.cache;if(this._doCache){var _b=null;var _c="";var _d="";for(var i=0;i<_8.length;i++){_c+=dojo.toJson(_8[i].methodParams);_d+=_8[i].methodName;}this._cacheKey=pageCache.getCacheKey(_9.ajaxUrl,_c,_d);_b=pageCache.getFromCache(this._cacheKey);if(_b!=null){if(this._callback){for(var i=0;i<_b.response.length;i++){_b.response[i].requestId=_8[i].requestId;}var _f=dojo.hitch(this._pageController,this._callback);_f(this,_b);return;}}}this.bundleId=_9.bundleId;this.makeRequest(_9.ajaxUrl,_a);},makeRequest:function(_10,_11){var _12=new Object();var _13=_10;var _14=this._serviceRequests;for(var i=0;i<_14.length;i++){var _16="serviceRequests["+i+"].";var req=_14[i];_12[_16+"serviceName"]=req.serviceName;_12[_16+"requestId"]=req.requestId;_12[_16+"methodName"]=req.methodName;_12[_16+"methodParams"]=dojo.toJson(req.methodParams);if(req.requestName){_12[_16+"requestName"]=req.requestName;}var _18="&m"+i+"="+_14[i].methodName;_13+=_18;}_12["bundleId"]=this.bundleId;var _19=dojo.xhrPost({url:_13,"content":_12,load:dojo.hitch(this,this._handleCallback),error:dojo.hitch(this,this._handleError),handleAs:"json-comment-filtered",timeout:_11,"sync":this.synchronous});},_handleCallback:function(_1a){if(this._fandf){return;}var _1b=this._processResult(_1a);if(_1b=="serverTimeout"){return;}if(this._doCache){if(!_1b.error){pageCache.addToCache(this._cacheKey,_1b);}}try{var _1c=dojo.hitch(this._pageController,this._callback);_1c(this,_1b);}catch(err){this._pageController.handleInvalidResponse(this,null,err,"js");}},_handleError:function(err,dfd){this._pageController.handleInvalidResponse(this,dfd,err,"xhr");return;},_processResult:function(_1f){if(_1f!=null){if(_1f.response[0].needLogin){document.location.href=_1f.response[0].needLogin;return "serverTimeout";}else{return _1f;}}}});}if(!dojo._hasResource["sfly.component.ComponentController"]){dojo._hasResource["sfly.component.ComponentController"]=true;dojo.provide("sfly.component.ComponentController");dojo.declare("sfly.component.ComponentController",null,{constructor:function(){},_prepareServiceRequest:function(_20,_21,_22,_23,_24){var _25=new Object();for(var i=0;i<_20.length;i++){var _27=_20[i];var _28=this._serviceParamValues[_27];if(_28!=null){_25[_20[i]]=_28.valueOf();}}if(!_23){_23=this;}if(!_24){_24=null;}return {data:_25,callback:_21,instance:_23,method:_22,service:this.service,errback:_24};}});}if(!dojo._hasResource["sfly.log.Logger"]){dojo._hasResource["sfly.log.Logger"]=true;dojo.provide("sfly.log.Logger");dojo.declare("sfly.log.Logger",sfly.component.ComponentController,{constructor:function(_29,_2a){this._pageController=_29;var _2b=false;if(_2a.isDev){_2b=_2a.isDev;}this._appendToConsole=false;if(_2b==true){this._appendToConsole=true;}this._logs=new Array();this._setUpServiceParamValues(_2a.fid);this._setUpServiceParams();this.service="self";this._frequency=60000;this._setTimeoutForSends();},log:function(_2c){this._logs.push({"level":"log","msg":_2c});},debug:function(_2d){this._logs.push({"level":"debug","msg":_2d});},info:function(_2e){this._logs.push({"level":"info","msg":_2e});},warn:function(_2f){this._logs.push({"level":"warn","msg":_2f});},error:function(_30){this._logs.push({"level":"error","msg":_30});this.sendLogs();},sendLogs:function(){var _31=this._logs;var len=_31.length;if(len>0){if(this._appendToConsole){var _33="";for(var i=0;i<len;i++){_33+=_31[i].level+": "+_31[i].msg;if(i<_31.length-1){_33+="; ";}}console.log("The following log messages were posted to the server: ",_33);}this._pageController.requestServiceCall(this._prepareSendLogsCall());this._logs=new Array();}this._setTimeoutForSends();},_prepareSendLogsCall:function(){var len=this._logs.length;var _36=new Array();for(var i=0;i<len;i++){_36.push(this._logs[i].level+": "+this._logs[i].msg);}this._serviceParamValues["logMsgs"]=_36;var _38=this._prepareServiceRequest(this._sendLogsParams,null,"logToServer");return _38;},_setTimeoutForSends:function(){setTimeout(dojo.hitch(this,"sendLogs"),this._frequency);},_setUpServiceParamValues:function(fid){this._serviceParamValues=new Object();this._serviceParamValues["frameId"]=fid;},_setUpServiceParams:function(){this._sendLogsParams=new Array("frameId","logMsgs");}});}if(!dojo._hasResource["sfly.page.BasePageController"]){dojo._hasResource["sfly.page.BasePageController"]=true;dojo.provide("sfly.page.BasePageController");dojo.declare("sfly.page.BasePageController",null,{constructor:function(_3a){this._errorMsgs="";this.openCalls=new Object();this._ajaxUrl=_3a.central.ajaxUrl+"?"+_3a.central.frameId;this._trackingPixelParams=new Array();if(_3a.central.trackingPixelParams){this._trackingPixelParams=_3a.central.trackingPixelParams;}this._serviceRequests=new Array();this._unresolvedBundles=new Object();this._prevCalls=new Array();this._firstTriesTO=15000;this._lastTryTO=240000;this._logger=null;if(_3a.central.logToServer==true){this._logger=new sfly.log.Logger(this,{"isDev":_3a.central.isDev,"serviceName":_3a.central.loggerService,"fid":_3a.central.frameId});}},requestServiceCall:function(_3b,_3c,_3d,_3e){this._registerServiceCall(_3b);if(!_3c){_3c=false;}this._makeTheCalls(_3c,_3d,_3e);},_registerServiceCall:function(_3f){this.openCalls={"instance":_3f.instance,"callback":_3f.callback,"errback":_3f.errback};var _40=_3f.data;var _41={"serviceName":_3f.service,"requestId":null,"methodName":_3f.method,"methodParams":_3f.data};this._serviceRequests.push(_41);},_makeTheCalls:function(_42,_43,_44){if(_44!=true){_44=false;}var _45=this._serviceRequests;if(_45.length>0){this._doServiceCall(_45,_42,_43,_44);this._serviceRequests=new Array();}else{return;}},_doServiceCall:function(_46,_47,_48,_49){var _4a=this._handleCallback;var _4b=false;if(_48==true){_4b=true;}if(!_47){_47=false;}var uid=Math.floor(Math.random()*100001);var _4d=new sfly.ajax.AjaxWrapper(this,_46,{debug:false,cache:_47,"fireAndForget":_49,bundleId:uid,ajaxUrl:this._ajaxUrl,synchronous:_4b,timeout:this._firstTriesTO,"callback":_4a});this._unresolvedBundles[uid]={"attempt":1};var _4e=_4d._serviceRequests;var _4f=_4e.length;for(var i=0;i<_4f;i++){this._prevCalls.push(_4e[i].methodName);var _51=this._prevCalls.length;if(_51>10){this._prevCalls=this._prevCalls.splice(1,_51);}}return _4d;},handleInvalidResponse:function(_52,dfd,err,_55){var _56=true;if(_55=="js"){this._showInvalidResponseErrorDialog(err,"/application/js_error.gif");}else{if(err.dojoType=="timeout"){var xhr=dfd.xhr;xhr.abort();var _58=this._unresolvedBundles[_52.bundleId];if(_58.attempt<2){_56=false;_52.makeRequest(this._ajaxUrl,this._firstTriesTO);_58.attempt++;}else{if(_58.attempt==2){_52.makeRequest(this._ajaxUrl,this._lastTryTO);_58.attempt++;}else{delete this._unresolvedBundles[_52.bundleId];this._showInvalidResponseErrorDialog(err,"/application/xhr_error.gif");}}}else{if(err.message=="bad http response code:0"){try{var _59=dojo.body();if(_59){var _5a=new Date().getTime();var _5b=document.createElement("img");_59.appendChild(_5b);_5b.setAttribute("height","1");_5b.setAttribute("width","1");_5b.setAttribute("display","none");_5b.src="/application/badhttpstatus0_error.gif"+"?et="+encodeURIComponent(err.dojoType)+"&t="+_5a+"&e="+encodeURIComponent(err.message);_59.removeChild(_5b);}}catch(e){}}else{this._showInvalidResponseErrorDialog(err,"/application/xhr_error.gif");}}}},_showInvalidResponseErrorDialog:function(err,_5d){if(!sflyDialogMgr){return;}var _5e=new Date().getTime();var _5f=_5d+"?et="+encodeURIComponent(err.dojoType)+"&t="+_5e+"&e="+encodeURIComponent(err.message);var _60=this.getTrackingPixelParams();_5f+=_60;if(err.fileName&&err.lineNumber){_5f+="&f="+encodeURIComponent(err.fileName)+"&l="+encodeURIComponent(err.lineNumber);}if(_5f.length>256){_5f=_5f.substring(0,256);}var _61="We're sorry; the system has encountered an error. Please try again. <img src='"+_5f+"' height='1' width='1' />";var _62={type:"alert",width:550,title:"An error has occurred",content:_61,btnType:"ok",icon:"warning"};sflyDialogMgr.showSflyDialog(_62,this);this._postProcessInvalidResponse(err);this._logErrorToServer();},_logErrorToServer:function(){if(this._logger!=null){this._logger.error("An error occurred in the client code. The last 10 ajax requests were: "+this._prevCalls);}},_postProcessInvalidResponse:function(err){},_handleCallback:function(_64,_65){delete this._unresolvedBundles[_64.bundleId];if(_65){var _66=false;var _67=false;for(var i=0;i<_65.response.length;i++){var _69=this._checkErrors(_65.response[i]);if(_69.hasErrors){_66=true;}if(_69.isAppHandlingErrors){_67=true;}}var _6a=this._errorMsgs;if(_66&&!_67&&_6a.length>0){this._displayErrorDialog(_6a);}if(_65.message){this._displayServerMessageDialog(_65.message);}this._errorMsgs="";}},_checkErrors:function(_6b){var _6c=false;var _6d=false;if(_6b.error){_6c=true;var _6e=this._getComponentForCallback(_6b);var _6f=this._invokeErrback(_6e,_6b);if(!_6f){if(_6b.requestId){this._errorMsgs=this._errorMsgs+"<p> Request: "+_6b.requestId+"<br /> Error: "+_6b.error+"</p>";}else{var _70=this._createGenericErrorStr(_6b.error);this._errorMsgs=this._errorMsgs+_70;}}else{_6d=true;}}else{var _6e=this._getComponentForCallback(_6b);this._invokeCallback(_6e,_6b);}return {"hasErrors":_6c,"isAppHandlingErrors":_6d};},_displayErrorDialog:function(_71){if(!sflyDialogMgr){return;}if(_71.length>0){var _72=new Date().getTime();var _73="/application/error.gif?t="+_72;var _74=this.getTrackingPixelParams();_73+=_74;var _75="<p>The following error(s) have occurred!</p> "+_71+"<img src='"+_73+"' height='1' width='1' />";var _76={type:"alert",width:950,title:"Error",content:_75,btnType:"ok",icon:"warning"};sflyDialogMgr.showSflyDialog(_76);}},_createGenericErrorStr:function(msg){return "<p> Error: "+msg+"</p>";},displayErrorDialog:function(_78){if(!_78){_78="";}var _79=this._createGenericErrorStr(_78);this._displayErrorDialog(_79);},_displayServerMessageDialog:function(_7a){if(!sflyDialogMgr){return;}var _7b=_7a.body;var _7c={type:"alert",width:400,title:_7a.title,content:_7b,btnType:"ok",icon:"warning"};sflyDialogMgr.showSflyDialog(_7c);},_getComponentForCallback:function(_7d){return this.openCalls;},_invokeCallback:function(_7e,_7f){if(_7e&&_7e.callback){var _80=dojo.hitch(_7e.instance,_7e.callback);_80(_7f.resultValue);}this._cleanupAfterCall(_7f);},_invokeErrback:function(_81,_82){if(_81&&_81.errback){var _83=dojo.hitch(_81.instance,_81.errback);_83(_82.error);this._cleanupAfterCall(_82);return true;}else{this._cleanupAfterCall(_82);return false;}},_cleanupAfterCall:function(_84){this.openCalls=null;},_prepareServiceRequest:function(_85,_86,_87,_88,_89,_8a,_8b){var _8c=new Object();for(var i=0;i<_85.length;i++){var _8e=_85[i];var _8f=this._serviceParamValues[_8e];if(_8f!=null){_8c[_85[i]]=_8f;}}if(!_89){_89=null;}if(!_8a){_8a=this;}if(!_8b){_8b=null;}return {data:_8c,callback:_86,instance:_8a,method:_87,service:_88,requestName:_89,errback:_8b};},getTrackingPixelParams:function(){var _90="";var _91=this._trackingPixelParams.length;var _92=this._trackingPixelParams;if(_91>0){for(var i=0;i<_91;i++){_90+="&"+encodeURIComponent(_92[i].name)+"="+encodeURIComponent(_92[i].value);}}return _90;},getLogger:function(){return this._logger;}});dojo.declare("sfly.page.BasePageModel",null,{constructor:function(){this._ajaxUrl="";},_setAjaxUrl:function(url){this._ajaxUrl=url;},getAjaxUrl:function(url){return this._ajaxUrl;}});dojo.declare("sfly.page.BasePageView",null,{constructor:function(){}});}if(!dojo._hasResource["sfly.component.groups.GroupName"]){dojo._hasResource["sfly.component.groups.GroupName"]=true;dojo.provide("sfly.component.groups.GroupName");var GROUPNAME_CHECK_FINISH="groupname:checkavailablefinish";dojo.declare("sfly.component.groups.GroupNameModel",null,{constructor:function(){},setAvailable:function(_96){this._isAvailable=_96;dojo.publish(GROUPNAME_CHECK_FINISH,[this._isAvailable]);},getAvailable:function(){return this._isAvailable;}});dojo.declare("sfly.component.groups.GroupNameView",null,{constructor:function(_97,_98){this._model=_97;this._controller=_98;this._checkAvailabityLink=dojo.byId("checkAvailabityLink");if(this._checkAvailabityLink){dojo.connect(this._checkAvailabityLink,"onclick",this,"_handleCheckAvailabilityClick");}dojo.subscribe(GROUPNAME_CHECK_FINISH,this,"_handleCheckAvailabilityUpdate");},_handleCheckAvailabilityClick:function(){if(this._validateDomainName()){this._controller.clickCheckAvailability(dojo.byId("groupName").value);}return;},_handleCheckAvailabilityUpdate:function(){var _99=this._model.getAvailable();if(_99.available==true){dojo.byId("checkavailableDIV").innerHTML="<div>"+this._controller._options.nameAvailableMsg+"</div>";}else{var _9a=this._controller._options.nameTakenErrorMsg;var _9b=new String(_99.suggestion);if(_9b&&_9b.length>0){var _9c="<br/> We suggest: ";var _9d=_9b.split(",");for(var i=0;i<_9d.length;i++){_9c+="<a class=\"suggestion\" href=\"javascript:useSuggestion('"+_9d[i]+"')\">"+_9d[i]+"</a>";if(i<_9d.length-1){_9c+=", ";}}_9a+=_9c;}dojo.byId("checkavailableDIV").innerHTML="<div class=\"checkavailableerrorMsg\">"+_9a+"</div>";}},_validateDomainName:function(){var _9f=dojo.byId("groupName").value;var _a0="^\\d+$";var _a1=new RegExp(_a0);if(_a1.test(_9f)){dojo.byId("checkavailableDIV").innerHTML="<div class=\"checkavailableerrorMsg\">"+this._controller._options.az09Msg+"</div>";return false;}else{if(_9f.search("[^A-Za-z0-9]")!=-1){dojo.byId("checkavailableDIV").innerHTML="<div class=\"checkavailableerrorMsg\">"+this._controller._options.invalidCharacterMsg+"</div>";return false;}else{if((_9f.length<4)||(_9f.length>32)){dojo.byId("checkavailableDIV").innerHTML="<div class=\"checkavailableerrorMsg\">"+this._controller._options.maxfourcharMsg+"</div>";return false;}}}return true;}});dojo.declare("sfly.component.groups.GroupNamePageController",sfly.page.BasePageController,{constructor:function(_a2,_a3){this._model=_a3;this._options=_a2;this._service=_a2.service;},clickCheckAvailability:function(_a4){var _a5={data:{groupName:_a4},callback:this.handleCallback,instance:this,method:this._options.method,frameId:this._options.frameId,service:"self"};this.requestServiceCall(_a5);},handleCallback:function(_a6){this._model.setAvailable(_a6);}});}if(!dojo._hasResource["sfly.component.share.Shareout"]){dojo._hasResource["sfly.component.share.Shareout"]=true;dojo.provide("sfly.component.share.Shareout");var SERVICE_POST_FINISHED="shareout:servicepostfinished";var SERVICE_GETEMBEDTAG_FINISHED="shareout:servicegetembedfinished";dojo.declare("sfly.component.share.ShareoutModel",null,{constructor:function(){},_end:null});dojo.declare("sfly.component.share.ShareoutView",null,{constructor:function(_a7,_a8){this._model=_a7;this._controller=_a8;this._postWindowPtr=null;this._embedcodeWindowPtr=null;this._permalinkWindowPtr=null;dojo.subscribe(SERVICE_POST_FINISHED,this,"_handlePostFinish");dojo.subscribe(SERVICE_GETEMBEDTAG_FINISHED,this,"_handleMySpacePost");},processEmailClick:function(_a9){this.hideShareitMenu(_a9);var _aa=_a9.parentNode.getElementsByTagName("FORM")[0];location.href="/share/singleshare/start.sfly?sid="+_aa.shareKey.value;},processAddSharesiteClick:function(_ab){this.hideShareitMenu(_ab);var _ac=_ab.parentNode.getElementsByTagName("FORM")[0];location.href="/share/siteshare/start.sfly?sid="+_ac.shareKey.value;},processGallerypostClick:function(_ad){this.hideShareitMenu(_ad);var _ae=_ad.parentNode.getElementsByTagName("FORM")[0];location.href="/gallery/post/create/start.sfly?projectId="+_ae.projectID.value;},handleCustomShareThis:function(_af,_b0){this._controller.eventLog("other",_b0);},openShareThisPopup:function(_b1){this.hideShareitMenu(_b1.parentNode.parentNode);var _b2=_b1.parentNode.getElementsByTagName("FORM")[0];var _b3=SHARETHIS.addEntry({title:_b2.title.value,url:_b2.URL.value,content:this._getEmbedTag(_b2),summary:""},{button:false,popup:true});_b3.popup();},showShareTabWhatThisDialog:function(_b4){var _b5=_b4.parentNode.getElementsByTagName("FORM")[0];var _b6="";if(_b5.type.value=="PHOTOBOOK_20"){_b6="Now it is easier than ever to share your Shutterfly photo books anywhere on the web. Simply select from the list of sites below, add a title and description and post the photo book directly to your favorite social networking and blogging sites.";}else{_b6="Now it is easier than ever to share your Shutterfly pictures anywhere on the web. Simply select from the list of sites below, add a title and description and post the pictures directly to your favorite social networking and blogging sites.";}sflyDialogMgr.showSflyDialog({type:"alert",title:"Post to other web sites",width:300,content:_b6},this);},showWhatThisDialog:function(_b7){this.hideShareitMenu();sflyDialogMgr.showSflyDialog({type:"alert",width:300,content:_b7,title:"Post to other web sites"},this);},showEmbedcodeWindow:function(_b8,_b9){try{var _ba=_b8.parentNode.getElementsByTagName("FORM")[0];this.hideShareitMenu(_b8.parentNode.parentNode);if(this._embedcodeWindowPtr==null){this._embedcodeWindowPtr=sflyWindowMgr.createWindow({id:"shareitcodeContent",width:"400",height:"350",title:"Get embed code"});}var _bb=this._getEmbedTag(_ba);var _bc=_ba.URL.value;this._embedcodeWindowPtr.setContent(this._getEmbedcodeWindowContent(_bb,_bc,_b9));this._embedcodeWindowPtr.show();setTimeout("dojo.byId('embed').focus()",100);this._controller.eventLog("shutterfly",_ba.shareKey.value);}catch(e){alert(e);}},showPermalinkWindow:function(_bd,_be){var _bf=_bd.parentNode.getElementsByTagName("FORM")[0];this.hideShareitMenu(_bd.parentNode.parentNode);var _c0=_bf.URL.value;if(this._permalinkWindowPtr==null){var _c1=this._controller._options.i18nCopy.dialogPermalinkTitle;this._permalinkWindowPtr=sflyWindowMgr.createWindow({id:"permalinkContent",width:"400",height:"170",title:_c1});}this._permalinkWindowPtr.setContent(this._getPermalinkWindowContent(_c0,_be));this._permalinkWindowPtr.show();setTimeout("dojo.byId('link').focus()",100);this._controller.eventLog("shutterfly",_bf.shareKey.value);},processShareItBtnClick:function(_c2){if((_c2.id=="shareit-btn")&&(_c2.parentNode.id=="shareit")){this.showShareitMenu(_c2.parentNode);}},showShareitMenu:function(_c3){var _c4=this;dojo.forEach(dojo.query(_c3.tagName+".menu"),function(_c5){_c4.hideShareitMenu(_c5);});dojo.addClass(_c3,"menu");var _c6=dojo.coords(dojo.query(".shareit-menu",_c3)[0]);var _c7=dijit.getViewport();if(_c6.y+_c6.h>_c7.h){dojo.addClass(_c3,"menu-up");if(dojo.isIE==6){for(var e=_c3;e;e=e.parentNode){if(e&&e.style.zIndex){e.style.zIndex=parseInt(e.style.zIndex)+1000;break;}}}}if(_c6.x+_c6.w>_c7.w){dojo.addClass(_c3,"menu-left");}},hideShareitMenu:function(_c9){if(_c9==null){_c9=dojo.query("DIV.shareit")[0];}if(dojo.isIE==6&&dojo.hasClass(_c9,"menu-up")){for(var e=_c9;e;e=e.parentNode){if(e&&e.style.zIndex){e.style.zIndex=parseInt(e.style.zIndex)-1000;break;}}}dojo.removeClass(_c9,"menu");dojo.removeClass(_c9,"menu-up");dojo.removeClass(_c9,"menu-left");},onMouseOut:function(e,_cc){if(!e){e=window.event;}var _cd=e.relatedTarget||e.toElement;if(dojo.isDescendant(_cd,_cc)){return;}else{this.hideShareitMenu(_cc);return;}},processPostToFacebook:function(_ce){this.hideShareitMenu(_ce);var _cf=_ce.parentNode.getElementsByTagName("FORM")[0];var url=_cf.URL.value+"&eid=112";var _d1=_cf.title.value;var _d2="http://www.facebook.com/sharer.php?u="+encodeURIComponent(url)+"&t="+encodeURIComponent(_d1);var _d3=(window.screen.width-750)/2;var _d4=(window.screen.height-700)/2;window.open(_d2,"sharer","toolbar=0,status=0,scrollbars=1,width=1000,height=700,left="+_d3+",top="+_d4);this._controller.eventLog("facebook",_cf.shareKey.value);},_handleMySpacePost:function(_d5){var url=_d5.URL+"&eid=111";var _d7=_d5.title;var _d8=_d5.embedTag;var _d9=(window.screen.width-1000)/2;var _da=(window.screen.height-700)/2;window.open("about:blank","myspacewin","toolbar=0,status=0,scrollbars=1,width=1000,height=700,left="+_d9+",top="+_da);var _db=dojo.byId("myspacediv");if(_db==null){_db=dojo.body().appendChild(document.createElement("DIV"));_db.style.display="none";_db.id="myspacediv";}var _dc="<form id='myspacepostto' method='post' action='http://www.myspace.com/index.cfm?fuseaction=postto' target='myspacewin'>";_dc+="<input type='hidden' name='t' value='"+_d7+"' />";_dc+="<input type='hidden' name='c' value='"+_d8+"' />";_dc+="<input type='hidden' name='u' value='"+url+"' />";_dc+="<input type='hidden' name='l' value='1' />";_dc+="<a href='#' onclick='document.getElementById('myspacepostto').submit();return false;'>";_dc+="<img src='' border='0' alt='Post to MySpace!' /> Share on MySpace!";_dc+="</a>";_dc+="</form>";_db.innerHTML=_dc;mySpaceForm=dojo.byId("myspacepostto");mySpaceForm.submit();this._controller.eventLog("myspace",_d5.shareKey);},processPostToTwitter:function(_dd){var _de=_dd.parentNode.getElementsByTagName("FORM")[0];var _df=_de.shareKey.value;this._showPostServiceWindow("twitter",_df);this.hideShareitMenu(_dd.parentNode.parentNode);},processPostToMyspace:function(_e0){var _e1=_e0.parentNode.getElementsByTagName("FORM")[0];this._controller.getEmbedTag("myspace",_e1.shareKey.value);},processPostToWordpress:function(_e2){var _e3=_e2.parentNode.getElementsByTagName("FORM")[0];var _e4=_e3.shareKey.value;this._showPostServiceWindow("wordpress",_e4);this.hideShareitMenu(_e2.parentNode.parentNode);},processPostToBlogger:function(_e5){var _e6=_e5.parentNode.getElementsByTagName("FORM")[0];var _e7=_e6.shareKey.value;this._showPostServiceWindow("blogger",_e7);this.hideShareitMenu(_e5.parentNode.parentNode);},processPostToLiveJournal:function(_e8){var _e9=_e8.parentNode.getElementsByTagName("FORM")[0];var _ea=_e9.shareKey.value;this._showPostServiceWindow("livejournal",_ea);this.hideShareitMenu(_e8.parentNode.parentNode);},_showPostServiceWindow:function(_eb,_ec){var _ed="Post to ";if(_eb=="twitter"){_ed=_ed+"Twitter";}else{if(_eb=="blogger"){_ed=_ed+"Blogger";}else{if(_eb=="livejournal"){_ed=_ed+"LiveJournal";}else{if(_eb=="wordpress"){_ed=_ed+"WordPress";}}}}if(this._postWindowPtr==null){this._postWindowPtr=sflyWindowMgr.createWindow({id:"postServiceWin",width:"400",height:"175",title:_ed,content:"",closeCallback:this._hidePostDialog});}this._postWindowPtr.setTitle(_ed);this._postWindowPtr.setContent(this._getPostWindowContent(_eb,_ec));dojo.connect(dojo.byId("postBtn"),"onclick",this,"_processPostBtnClick");this._postWindowPtr.show();},_getEmbedTag:function(_ee){var _ef="";if(_ee.name=="myShare-shareTab"){_ef=unescape(_ee.embedTag.value);}else{_ef=_ee.embedTag.value;}return _ef;},_processPostBtnClick:function(){var _f0=dojo.byId("servicePostForm").serviceName.value;var _f1=dojo.byId("servicePostForm").username.value;var _f2=dojo.byId("servicePostForm").password.value;var url=dojo.byId("servicePostForm").blogurl.value;var _f4=dojo.byId("servicePostForm").shareKey.value;this._controller.postProject(_f0,_f1,_f2,url,_f4);dojo.byId("post-status").innerHTML="<img src=\""+this._controller._options.waitIndicator+"\"/>";},_handlePostFinish:function(_f5){if(_f5.resultCode=="500"){dojo.byId("post-status").innerHTML=_f5.resultMessage;}else{var _f6="Your share has been posted successfully.<br/><br/>";if((_f5.url!="undefined")&&(_f5.url.length>0)){_f6=_f6+"<span style=\"color:#666666;\"> Click on the link below to see your post:</span><br/><br/>";_f6=_f6+"<a href=\"#\" onclick=\"pageView.windowOpen('"+_f5.url+"');\">"+_f5.url+"</a>";}dojo.byId("post-status").innerHTML=_f6;dojo.byId("post-form").style.display="none";}},_hidePostDialog:function(){if(this._postWindowPtr!=null){this._postWindowPtr.hide();}},windowOpen:function(url){this._hidePostDialog();window.open(url);},_getPostWindowContent:function(_f8,_f9){var _fa="";if(_f8=="twitter"){_fa="Twitter";}else{if(_f8=="blogger"){_fa="Blogger";}else{if(_f8=="livejournal"){_fa="LiveJournal";}else{if(_f8=="wordpress"){_fa="WordPress";}}}}return "<div id=\"serviceWindowContent\">"+"   <div id=\"post-status\" ></div>"+"   <div id=\"post-form\" class=\"service-"+_f8+"\" >"+"       <form id=\"servicePostForm\">"+"           <div class=\"serviceUsername\">"+"               <div class=\"labelUsername\">"+_fa+" Username:</div>"+"               <input type=\"text\" id=\"username\" name=\"username\" tabindex=\"1\" />"+"           </div>"+"           <div class=\"servicePassword\">"+"               <div class=\"labelPassword\">"+_fa+" Password:</div>"+"               <input type=\"password\" id=\"password\" name=\"password\" tabindex=\"2\" />"+"           </div>"+"           <div class=\"serviceUrl \">"+"               <div class=\"labelUrl\">Blog URL:</div>"+"               <input type=\"text\" id=\"title\" name=\"blogurl\" tabindex=\"3\" />"+"           </div>"+"           <div class=\"serviceButton\" id=\"postBtn\"><img src=\""+this._controller._options.postImg+"\"/></div>"+"           <input type=\"hidden\" name=\"serviceName\" value=\""+_f8+"\" />"+"           <input type=\"hidden\" name=\"shareKey\" value=\""+_f9+"\" />"+"       </form>"+"   </div> "+"</div>";},_getEmbedcodeWindowContent:function(_fb,_fc,_fd){if(_fd==null){_fd="photo book";}return "<div id=\"shareit-win\">"+"   <div id=\"title\">Add this "+_fd+" to your blog or web page.<br/>Copy and paste the code below.</div>"+"   <div id=\"label\">Embed code</div>"+"   <div class=\"input\"><textarea id=\"embed\" onfocus=\"this.select()\" readonly>"+_fb+"</textarea></div>"+"   <div class=\"title titlebook\">Link to this book.</div>"+"   <div id=\"label\">Permalink</div>"+"   <div class=\"input\"><input type=\"input\"  onfocus=\"this.select()\" value=\""+_fc+"\" id=\"link\" name=\"link\" readonly/></div>"+"   <div class=\"close\"><a href=\"#\"><img class=\"closeBtn\" onclick=\"pageView._embedcodeWindowPtr.hide();\" src=\""+this._controller._options.closeImg+"\"/></a></div>"+"</div>";},_getPermalinkWindowContent:function(_fe,_ff){if(_ff==null){_ff="album";}return "<div id=\"shareit-win\">"+"   <div class=\"title\">Link to this "+_ff+" on your blog or web page.<br/>Copy and paste the code below.</div>"+"   <div class=\"label\">Permalink</div>"+"   <div class=\"input\"><input type=\"input\"  onfocus=\"this.select()\" value=\""+_fe+"\" id=\"link\" name=\"link\" readonly/></div>"+"   <div class=\"close\"><a href=\"#\"><img class=\"closeBtn\" onclick=\"pageView._permalinkWindowPtr.hide();\" src=\""+this._controller._options.closeImg+"\"/></a></div>"+"</div>";},_end:null});dojo.declare("sfly.component.share.ShareoutPageController",sfly.page.BasePageController,{constructor:function(_100,_101){this._model=_101;this._options=_100;this._service=_100.service;},eventLog:function(_102,_103){var _104={data:{serviceName:_102,shareKey:_103},callback:"",instance:this,method:"eventLog",frameId:this._options.frameId,service:"self"};this.requestServiceCall(_104);},getEmbedTag:function(_105,_106){var _107={data:{serviceName:_105,shareKey:_106},callback:this.handleGetEmbedTagCallback,instance:this,method:"getEmbedTag",frameId:this._options.frameId,service:"self"};this.requestServiceCall(_107);},postProject:function(_108,_109,_10a,url,_10c){var _10d={data:{serviceName:_108,username:_109,password:_10a,blogurl:url,shareKey:_10c},callback:this.handleCallback,instance:this,method:this._options.method,frameId:this._options.frameId,service:"self"};this.requestServiceCall(_10d);},handleGetEmbedTagCallback:function(data){dojo.publish(SERVICE_GETEMBEDTAG_FINISHED,[data]);},handleCallback:function(data){dojo.publish(SERVICE_POST_FINISHED,[data]);}});}if(!dojo._hasResource["sfly.component.share.SiteShare"]){dojo._hasResource["sfly.component.share.SiteShare"]=true;dojo.provide("sfly.component.share.SiteShare");dojo.declare("sfly.component.share.SiteShareModel",null,{constructor:function(_110){this._sites=new Array();this._sites.push(_110);this._currentSite=_110;},SITESHARE_GET_PAGES_FINISH:"siteshare:getpagesfinished",sitePages:function(site){this._sites.push(site);this._currentSite=site;dojo.publish(this.SITESHARE_GET_PAGES_FINISH,[site]);},getCurrentSite:function(){return this._currentSite;},setCurrentSite:function(site){this._currentSite=site;},getSite:function(_113){var site=null;for(i=0;i<this._sites.length;i++){if(this._sites[i].id==_113){site=this._sites[i];break;}}return site;},_end:null});dojo.declare("sfly.component.share.SiteShareView",null,{constructor:function(_115,_116,type,_118){this._model=_115;this._controller=_116;this._objectType=type;dojo.connect(dojo.byId("siteId"),"onchange",this,"_handleSiteChanged");dojo.connect(dojo.byId("pageId"),"onchange",this,"_handlePageChanged");dojo.connect(dojo.byId("sectionId"),"onchange",this,"_handleSectionChanged");dojo.subscribe(this._model.SITESHARE_GET_PAGES_FINISH,this,"_handleGetSitePages");this.changelocationDIV=dojo.byId("changelocation");if(this.changelocationDIV){dojo.connect(this.changelocationDIV,"onclick",this,"_handleChangeLocationClick");}this._defaultPageName="";this._defaultSectionName="";},_handleSiteRadioClick:function(){if((dojo.byId("newSite").checked==true)){dojo.byId("changelocation").style.display="none";dojo.byId("locationdetails").style.display="none";dojo.byId("defaultlocation").style.display="block";if(dojo.byId("permissionErrorDIV").style.display=="block"){dojo.byId("permissionErrorDIV").style.display="none";dojo.byId("location").style.display="block";}this._defaultPageName="Home";this._defaultSectionName="Recent pictures";if(this._objectType=="PROJECT"){this._defaultSectionName="Photo books";}if(this._objectType=="PHOTOBOOK_20"){this._defaultSectionName="Photo books";}if(this._objectType=="VIDEO"){this._defaultSectionName="Videos";}this._updateBasicViewLocation();}else{if((dojo.byId("siteList").checked==true)){dojo.byId("changelocation").style.display="block";dojo.byId("defaultlocation").style.display="block";dojo.byId("locationdetails").style.display="none";}}},_handleChangeLocationClick:function(){dojo.byId("defaultlocation").style.display="none";dojo.byId("changelocation").style.display="none";dojo.byId("locationdetails").style.display="block";if(this._objectType=="PICTURES"){dojo.byId("albumDIV").style.display="block";}this._handleSectionChanged();},_handleSiteChanged:function(){var ctrl=dojo.byId("siteId");if(ctrl!=null){dojo.byId("siteList").checked="checked";this._handleSiteRadioClick();this._processSiteChange(ctrl.options[ctrl.selectedIndex].value);}},_processSiteChange:function(_11a){this._clearSelectCtrl("pageId");this._clearSelectCtrl("sectionId");this._clearSelectCtrl("albumId");var site=this._model.getSite(_11a);if(site==null){this._controller.getSiteSection(_11a);}else{this._model.setCurrentSite(site);this._handleGetSitePages(site);}},_handlePageChanged:function(){var _11c=this._getSectionFromPage();if((_11c!=null)&&(_11c.length>0)){this._updateSectionCtrl(_11c);}else{this._updateSectionCtrl([{id:"-1",title:"new"}]);}},_handleSectionChanged:function(){if(this._objectType=="PICTURES"){var _11d=this._getAlbumFromSection();this._updateAlbumCtrl(_11d);}},_handleGetSitePages:function(site){var _11f=site.pages;if((_11f!=null)&&(_11f.length>0)){dojo.byId("permissionErrorDIV").style.display="none";dojo.byId("location").style.display="block";this._updatePageCtrl(_11f);}else{dojo.byId("permissionErrorDIV").style.display="block";dojo.byId("location").style.display="none";}},_updatePageCtrl:function(_120){this._updateSelectCtrl("pageId",_120);this._defaultPageName=_120[0].title;this._handlePageChanged();},_updateBasicViewLocation:function(){if((dojo.byId("defaultlocation")!=null)&&(dojo.byId("defaultlocation").style.display!="none")){var text="The <b>"+this._defaultSectionName+"</b> section on the <b>"+this._defaultPageName+"</b> page.";dojo.byId("defaultlocation").innerHTML=text;}},_updateSectionCtrl:function(_122){this._updateSelectCtrl("sectionId",_122);var _123=this._getSelectedId("sectionId");if(_123==-1){dojo.byId("sectionTitleDIV").style.display="inline";this._defaultSectionName=dojo.byId("sectionName").value;}else{dojo.byId("sectionTitleDIV").style.display="none";this._defaultSectionName=_122[0].title;}this._updateBasicViewLocation();this._updateAlbumCtrl(_122[0].folders);},_updateAlbumCtrl:function(_124){if(this._objectType=="PICTURES"){this._updateSelectCtrl("albumId",_124);if((_124==null)||(_124.length==0)){dojo.byId("site-existing-album").style.display="none";dojo.byId("newAlbum").style.display="none";}else{dojo.byId("site-existing-album").style.display="inline";dojo.byId("newAlbum").style.display="inline";dojo.byId("newalbum-label").style.margin="0px";}}},_updateSelectCtrl:function(_125,_126){var _127=dojo.byId(_125);_127.length=0;if(_126!=null){for(i=0;i<_126.length;i++){var _128=_126[i];var opt=document.createElement("OPTION");opt.value=_128.id;opt.innerHTML=_128.title;_127.appendChild(opt);}}},_clearSelectCtrl:function(_12a,_12b){var _12c=dojo.byId(_12a);if(_12c!=null){_12c.length=0;}},_getSelectedId:function(type){var ctrl=dojo.byId(type);return ctrl.options[ctrl.selectedIndex].value;},_getSectionFromPage:function(){var _12f=null;var site=this._model.getCurrentSite();var _131=this._getSelectedId("pageId");for(i=0;i<site.pages.length;i++){if(site.pages[i].id==_131){_12f=site.pages[i].sections;break;}}return _12f;},_getAlbumFromSection:function(){var _132=this._getSectionFromPage(this._getSelectedId("pageId"));var _133=null;if(_132!=null){var _134=this._getSelectedId("sectionId");for(i=0;i<_132.length;i++){if(_132[i].id==_134){_133=_132[i].folders;break;}}}return _133;},_end:null});dojo.declare("sfly.component.share.SiteSharePageController",sfly.page.BasePageController,{constructor:function(_135,_136){this._model=_136;this._options=_135;this._service=_135.service;},getSiteSection:function(_137){var _138={data:{siteId:_137},callback:this.handleCallback,instance:this,method:this._options.method,frameId:this._options.frameId,service:"self"};this.requestServiceCall(_138);},handleCallback:function(data){this._model.sitePages(data);},_end:null});}if(!dojo._hasResource["sfly.component.share.ShareSubNav"]){dojo._hasResource["sfly.component.share.ShareSubNav"]=true;dojo.provide("sfly.component.share.ShareSubNav");dojo.declare("sfly.component.share.ShareSubNav",null,{constructor:function(_13a,_13b){this._selectId="shareTabSubNavExistingSite";this._select=dojo.byId(this._selectId);this._numSites=this._select.getElementsByTagName("OPTION").length;this._dlg=null;var _13c={central:{frameId:_13a,ajaxUrl:_13b||"ajax.ajax"},method:"getSiteSections"};this._siteShare=new sfly.component.share.SiteSharePageController(_13c,new sfly.component.share.SiteShareModel({id:null}));dojo.subscribe(this._siteShare._model.SITESHARE_GET_PAGES_FINISH,this,"_onAddPictures");},postToShareSite:function(){if(this._numSites==1){this.onAddPictures(this._select.getElementsByTagName("OPTION")[0].value);}else{if(!this._dlg){this._dlg=sflyWindowMgr.createWindow({id:"share",width:400,height:150,title:"Share",content:dojo.byId("shareTabSubNavDlg")});}this._dlg.show();}},onAddPictures:function(_13d){var site=this._siteShare._model.getSite(_13d);if(site){this._siteShare._model.setCurrentSite(site);this._onAddPictures();}else{this._siteShare.getSiteSection(_13d);}return false;},_onAddPictures:function(){var site=this._siteShare._model.getCurrentSite();if(site&&site.pages&&site.pages.length){var page=site.pages[0].id;var path=page.split("/");path[0]="";window.location.href=site.webAddress+path.join("/")+"#addPictures";}else{sflyDialogMgr.showSflyDialog({type:"alert",icon:"warning",title:this.properties["share.sharetab.subnav.addPictures.sorry.title"],content:this.properties["share.sharetab.subnav.addPictures.sorry.text"]});}},_hideDlg:function(){this._dlg.hide();},_onNext:function(){if(dojo.byId("shareTabSubNavExisting").checked){this.onAddPictures(dojo.byId("shareTabSubNavExistingSite").value);}else{window.location.href="/sites/create/start.sfly?category=personal";}this._hideDlg();return false;},_extSites:{fb:{},myspace:{},blogger:{},twitter:{}},postTo:function(_142){console.log("posting to: "+_142);},_end:null});}if(!dojo._hasResource["sfly.component.share.UploadComplete"]){dojo._hasResource["sfly.component.share.UploadComplete"]=true;dojo.provide("sfly.component.share.UploadComplete");dojo.declare("sfly.component.share.UploadComplete",null,{_className:"uploadComplete",constructor:function(_143,_144,_145){this._frameId=_143;this._isPopup=_144;this._isNested=_145;this._images=[];this._count=0;this._albumPath=null;if(this._isNested){return;}this._baseFinishUpload=window.handleFinishUpload;window.handleFinishUpload=dojo.hitch(this,this._handleFinishUpload);window.handleFileUploadComplete=dojo.hitch(this,this._handleFileUploadComplete);this._baseUploadMore=window.handleUploadMore;window.handleUploadMore=dojo.hitch(this,this._handleUploadMore);this._baseOpenUploadCompleteOptionsView=window.handleOpenUploadCompleteOptionsView;window.handleOpenUploadCompleteOptionsView=dojo.hitch(this,this._handleOpenUploadCompleteOptionsView);var _146={"uploadComplete-email-link":{onclick:dojo.hitch(this,function(_147){_147.preventDefault();this._submitForm("email",{albumName:this._albumName,imageIds:this._images.join(",")});})},"uploadComplete-post-link":{onclick:dojo.hitch(this,function(_148){_148.preventDefault();this._submitForm("post",{albumName:this._albumName,imageIds:this._images.join(",")});})},"uploadComplete-close-link":{onclick:dojo.hitch(this,function(_149){_149.preventDefault();window.close();})}};for(var h in _146){var _14b=_146[h];for(var _14c in _14b){dojo.connect(dojo.byId(h),_14c,_14b[_14c]);}}this._ajax=new sfly.page.BasePageController({central:{ajaxUrl:"/upload/upload.share.ajax",frameId:this._frameId}});},_handleFinishUpload:function(_14d){if(this._baseFinishUpload){this._baseFinishUpload(_14d);}if(!this._images.length){return;}this._albumPath=_14d;if(_14d){this._renderCompleteMsg();}else{var now=new Date();var mon=now.getMonth()+1;this._albumName=(now.getFullYear()+"-"+(mon<10?"0":"")+mon+"-"+now.getDate());}},_handleFileUploadComplete:function(_150){if(_150){this._images.push(_150);this._count++;}},_handleUploadMore:function(){if(this._baseUploadMore){this._baseUploadMore();}this._count=0;this._hide();},_handleOpenUploadCompleteOptionsView:function(){if(this._baseOpenUploadCompleteOptionsView){this._baseOpenUploadCompleteOptionsView();}if(this._images.length){this._show();}},_renderCompleteMsg:function(){var _151={service:"self",method:"getAlbumName",frameId:this._frameId,data:{albumPath:this._albumPath},callback:dojo.hitch(this,function(_152){this._albumName=_152;var key="share.uploadComplete.msg."+(this._count>1?"plural":"singular");var msg=this.properties[key];msg=msg.replace(/\{0\}/g,this._count).replace(/\{1\}/g,this._albumName);dojo.byId("uploadComplete-msg").innerHTML=msg;})};this._ajax.requestServiceCall(_151);},_setFlashHeight:function(h){var _156=document.getElementsByTagName("embed")[0]||document.getElementsByTagName("object")[0];if(_156){_156.setAttribute("height",h);if(_156.tagName=="EMBED"){_156.parentNode.setAttribute("height",h);}}},_hide:function(){dojo.removeClass(dojo.body(),this._className);return false;},_show:function(){dojo.addClass(dojo.body(),this._className);var _157=document.getElementsByTagName("embed")[0]||document.getElementsByTagName("object")[0];var _158="-"+(_157.getAttribute("height")-70)+"px";dojo.byId("uploadComplete").style.top=_158;dojo.byId("uploadComplete").style.marginBottom=_158;return false;},_submitForm:function(dest,_15a){var form=dojo.byId("uploadComplete-"+dest+"-form");if(form){for(var parm in _15a){form[parm].value=_15a[parm];}if(this._isPopup){form.target="_blank";}form.submit();if(this._isPopup){window.close();}}},_end:null});}if(!dojo._hasResource["sfly.page.sites.site_create"]){dojo._hasResource["sfly.page.sites.site_create"]=true;dojo.provide("sfly.page.sites.site_create");dojo.declare("sfly.page.sites.site_create",null,{constructor:function(_15d,_15e,_15f,_160,divs){try{window._page=this;this._categories=new Object();this._category=_15e;this._style=_15f;this._tab=_160;this._defaultStyle=false;this._forEach(_15d,function(_162){var _163=this._categories[_162.id]=new Object();this._forEach(["id","styles"],function(_164){_163[_164]=_162[_164];});});if(!this._category||!this._categories[this._category]){this._category=_15d[0].id;}if(!this._tab){if(this._style){this._some(this._categories[this._category].styles,function(_165,_166){if(_165.id==this._style){this._tab=_166<this._numFeatured?this._featured:_165.tab;return true;}else{return false;}});}else{this._tab=this._featured;}}if(!this._style){this._style=this._categories[this._category].styles[0].id;this._defaultStyle=true;}dojo.addOnLoad(dojo.hitch(this,function(){this._categoriesDiv=dojo.byId((divs&&divs.categories)||"categories");this._tabsDiv=dojo.byId((divs&&divs.tabs)||"tabs");this._stylesDiv=dojo.byId((divs&&divs.styles)||"styles");this._render();}));}catch(ex){}},properties:{},_property:function(key){return this.properties[key]||"???"+key+"???";},_render:function(){try{this._renderCategories();this._renderTabs();this._renderStyles();}catch(ex){}},_renderCategories:function(){var _168=dojo.string.substitute("<div class='categories-title'>${0}</div>",[this._property("groupCreate.label.category")]);var _169="return _page._onCategoryClick(this, \"${0}\")";var _16a="<a href='#${0}' class='category ${1}' onclick='${2}'><input type='radio' name='groupType' value='${0}' ${3}/>${4}</a>";this._forEach(this._categories,function(_16b){var args=[_16b.id,_16b.id==this._category?"selected":"",dojo.string.substitute(_169,[_16b.id]),_16b.id==this._category?"checked":"",this._property("siteCreate.category.name."+_16b.id)];_168+=dojo.string.substitute(_16a,args);});this._categoriesDiv.innerHTML=_168;},_renderTabs:function(){var _16d="siteCreate.tab.label.";var tabs={featured:this._property(_16d+"featured")};var _16f=1;this._forEach(this._categories,function(_170){this._forEach(_170.styles,function(_171){if(!tabs[_171.tab]){tabs[_171.tab]=this._property(_16d+_171.tab);_16f++;}});});var _172="<a href='#${0}' id='${0}' class='tab ${1}' onclick='${2}' style='width: ${3}%;'><input type='radio' name='tab' value='${0}' ${4} />${5}</a>";var _173="";this._forEach(tabs,function(tab,_175){var args=[_175,(_175==this._tab)?"selected":"","return _page._onTabClick(this);",parseInt(100/_16f+0.5)-1,(_175==this._tab)?"checked":"",tab];_173+=dojo.string.substitute(_172,args);});this._tabsDiv.innerHTML=_173;this._onTabClick({id:this._tab});},_renderStyles:function(_177){var div=dojo.byId(this._category);if(!div){if(dojo.isIE){this._forEach(dojo.query("DIV.style-inner INPUT",this._stylesDIV),function(_179){_179.checked=false;});}div=this._stylesDiv.appendChild(document.createElement("DIV"));div.id=this._category;var _17a="";this._forEach(this._categories[this._category].styles,function(_17b,_17c){var s="<div id='${0}' class='style ${1} ${2} ${3}'>"+"<div class='style-inner' style='background-image: url(${4});' onclick='return _page._onStyleClick(this.parentNode)'>"+"<div>"+"<a href='#preview' class='preview' onclick='return _page._onPreviewClick(this, event);'>${5}</a>"+"<input type='radio' name='groupStyle' value='${6}' ${7} />"+"<span class='name'>${8}</span>"+"</div>"+"</div>"+"</div>";_17a+=dojo.string.substitute(s,[this._styleId(_17b.id),_17b.tab,_17c<this._numFeatured?"featured":"",_17b.id==this._style?"selected":"",_17b.thumbnail,this._property("groupCreate.label.preview"),_17b.id,_17b.id==this._style?"checked":"",this._property("siteCreate.style.name."+_17b.id)]);});div.innerHTML=_17a+"<br style='clear: both;' />";}else{var _17e="#"+this._category+" INPUT";this._forEach(dojo.query(_17e),function(_17f){if(_17f.value==this._style){_17f.checked=true;dojo.addClass(_17f.parentNode.parentNode,"selected");}else{_17f.checked=false;dojo.removeClass(_17f.parentNode.parentNode,"selected");}});}div.style.display="block";},_styleId:function(_180){return this._category+":"+this._styleIndex(_180);},_styleIndex:function(_181){var _182=-1;var key=_181||this._style;this._some(this._categories[this._category].styles,function(_184,i){if(_184.id==key){_182=i;return true;}else{return false;}});return _182;},_onCategoryClick:function(cat,_187){if(!dojo.hasClass(cat,"selected")){dojo.query(".selected",this._categoriesDiv).forEach(function(_188){dojo.removeClass(_188,"selected");});dojo.byId(this._category).style.display="none";dojo.addClass(cat,"selected");cat.firstChild.checked=true;this._category=_187;if(this._defaultStyle){this._style=this._categories[this._category].styles[0].id;}this._renderStyles();}return false;},_onTabClick:function(tab){if(!dojo.hasClass(tab,"selected")){dojo.removeClass(this._tabsDiv,this._tab);dojo.removeClass(this._tab,"selected");dojo.removeClass(this._stylesDiv,this._tab);this._tab=tab.id;dojo.addClass(this._tabsDiv,this._tab);dojo.addClass(this._tab,"selected");dojo.byId(this._tab).firstChild.checked=true;dojo.addClass(this._stylesDiv,this._tab);}return false;},_onStyleClick:function(_18a){if(!dojo.hasClass(_18a,"selected")){var chk=_18a.getElementsByTagName("INPUT")[0];window.setTimeout(function(){chk.checked=true;},0);dojo.query(".selected",this._stylesDiv).forEach(function(_18c){dojo.removeClass(_18c,"selected");});this._style=chk.value;this._defaultStyle=false;dojo.addClass(_18a,"selected");}return false;},_onPreviewClick:function(_18d,evt){dojo.stopEvent(evt);var _18f=_18d.parentNode.parentNode.parentNode.id.split(":")[1];this._showPreview(_18f);return false;},_numFeatured:12,_featured:"featured",_previewWin:null,_previewId:"previewDlg",_previewAreaId:"previewArea",_previewWidth:775,_previewHeight:500,_showPreview:function(_190){var _191="<div id='${0}' onkeydown='if(event.keyCode==27)_page._previewWin.hide()'><img src='${1}' /></div>";var _192="siteCreate.style.name.";var s=this._categories[this._category].styles[_190];if(!this._previewWin){this._previewWin=sflyWindowMgr.createWindow({id:this._previewId,width:this._previewWidth,height:this._previewHeight,title:dojo.string.substitute(this._property("siteCreate.preview.title"),[this._property(_192+s.id)]),content:dojo.string.substitute(_191,[this._previewAreaId,s.preview||"/img_/search/transparent.gif"])});}else{this._previewWin.setTitle(dojo.string.substitute(this._property("siteCreate.preview.title"),[this._property(_192+s.id)]));this._previewWin.setContent(dojo.string.substitute(_191,[this._previewAreaId,s.preview||"/img_/search/transparent.gif"]));}this._previewWin.show();window.setTimeout(function(){dojo.byId(_page._previewAreaId).focus();},100);},_forEach:function(_194,f){if(typeof _194=="object"){for(p in _194){if(typeof _194[p]!="function"){f.call(this,_194[p],p,_194);}}}else{dojo.forEach(_194,f,this);}},_some:function(_196,f){if(typeof _196=="object"){for(p in _196){if(f.call(this,_196[p],p,_196)){return true;}}return false;}else{return dojo.some(_196,f,this);}},_end:null});}