document.ajaxLoaded=false;document.TEXTresp=null;document.currentUser=eatCookie("username");Ajax.currentLightboxRequests=$H({});Ajax.cacheHash=new Object();Ajax.cacheDex=new Array();Ajax.activeLightboxCount=0;Ajax.activeLightboxSaveCount=0;var bWait={generic:function(e){if(Ajax.activeLightboxSaveCount>0){var _2=e||window.event;_2.returnValue="Your changes are still saving... ("+Ajax.activeLightboxSaveCount+")\nIf you click OK you may lose changes.";if(_2.preventDefault){_2.preventDefault();}else{new Event(_2).preventDefault();}}}};Ajax.Responders.register({onCreate:function(_3){if(_3.options.furl&&_3.options.furl.match(/\/(Lightbox|Share)/)){if($("view_exp_link")){$("view_exp_link").onclick="alert('Your lightbox is still updaing.  This link will be re-enabled as soon as it is complete'); return false";$("view_exp_link").style.color="#E1E1E1";}Ajax.activeLightboxCount++;if(_3.options.furl.match(/\/(LightboxSave|ShareSetShare)/)){if(Ajax.activeLightboxSaveCount==0){Event.observe(window,"beforeunload",bWait.generic.bindAsEventListener(bWait));}Ajax.activeLightboxSaveCount++;}if(!_3.options.furl.match(/\/(Lightbox(Info|Save)|ShareSetShare)/)){Ajax.currentLightboxRequests[_3.options.furl]=_3;var _4=$A(Ajax.currentLightboxRequests.keys()).toJSON();bakeCookie("lightbox_queue."+document.currentUser,_4,1);}}},onComplete:function(_5){if(_5.options.furl&&_5.options.furl.match(/\/(Lightbox|Share)/)){if(!_5.options.furl.match(/\/(Lightbox(Info|Save)|ShareSetShare)/)){delete Ajax.currentLightboxRequests[_5.options.furl];var _6=$A(Ajax.currentLightboxRequests.keys()).toJSON();bakeCookie("lightbox_queue."+document.currentUser,_6,1);}if(_5.options.furl.match(/\/(LightboxSave|ShareSetShare)/)){Ajax.activeLightboxSaveCount--;if(Ajax.activeLightboxSaveCount==0){Event.stopObserving(window,"beforeunload",bWait.generic.bindAsEventListener(bWait));}}Ajax.activeLightboxCount--;if(Ajax.activeLightboxCount==0){if($("view_exp_link")){$("view_exp_link").onclick="";$("view_exp_link").style.color="#666666";}}}}});var $GKW;var $GID;CacheDecider=Class.create();CacheDecider.prototype={initialize:function(_7){this.secondsToCache=_7;this.lastFetched=new Date();},keepData:function(){var _8=new Date();var _9=parseInt((_8.getTime()-this.lastFetched.getTime())/1000);if(_9<this.secondsToCache){return true;}this.lastFetched=new Date();return false;},theData:null};localJSONobj=Class.create();localJSONobj.prototype={initialize:function(rt){try{var _b=rt+" ";this.oJSON=_b.evalJSON();}catch(e){console.log("Parse Error: "+e);}if(this.oJSON.error){alert(this.oJSON.error);}if(this.oJSON.keywords){if(this.oJSON.keywords.keywords){if(this.oJSON.keywords.keywords.length==1){this.oJSON.keywords.keywords=this.oJSON.keywords.keywords[0].split(", ");}}}},getKeywords:function(){if(this.oJSON.keywords.keywords){return this.oJSON.keywords.keywords;}else{return;}},getCartDat:function(_c,_d){if(this.oJSON.item&&this.oJSON.item[_d]){if(this.oJSON.total=="undefined"){this.oJSON.total=0;}if(this.oJSON.item[_d][_c]){return this.oJSON.item[_d][_c];}else{return;}}else{if(_c.match(/total/i)){return this.oJSON.total;}else{return;}}},getLbDat:function(_e,_f){if(this.oJSON[_e]){return this.oJSON[_e];}else{return "";}},getImgDat:function(_10,_11){if(this.oJSON.item&&this.oJSON.item[_11]){if(this.oJSON.total=="undefined"){this.oJSON.total=0;}if(this.oJSON.item[_11].image){if(this.oJSON.item[_11].image[_10]){return this.oJSON.item[_11].image[_10];}else{return;}}}else{if(this.oJSON[_10]){return this.oJSON[_10];}else{return "";}}if(this.oJSON.total&&this.oJSON.sphotog){var _12=new Array;var _13=0;for(cti=0;cti<this.oJSON.total;cti++){if(this.oJSON.sphotog==this.oJSON.item[cti].S_Photog){_12.push(this.oJSON.item[cti]);}}this.oJSON.total=_12.length;this.oJSON.item=_12;}},oJSON:null};function ajax_HTML(_14,url,_16,_17){if(!_14){return;}if(url.match(/\/bin\/Cart\?op\=/)){cartdispcheck=1;if(!url.match(/\&drk\=/)){url+="&drk="+Math.random(10);}}var _18=new Ajax.Updater(_14,url,{method:_16,parameters:_17,onComplete:function(_19){cartdispcheck=0;},onFailure:function(){}});}function ajax_TEXT(url,_1b,_1c){document.TEXTresp=false;var _1d=new Ajax.Request(url,{method:_1b,parameters:_1c,onComplete:function(_1e){document.TEXTresp=_1e.responseText;},onFailure:function(){}});}function ajax_JSON(url,_20,_21,_22){document.ajaxLoaded=false;var _23=32;var _24=0;var _25=url;if(url.match(/Cart|Lightbox|Share/)){if(!url.match(/(\&|\?)drk\=/)){_25+="?drk="+Math.random(10);var _26=_21;if(typeof (_21)=="object"&&_21!=null){_26=$H(_21).toQueryString();}if(_26&&_26.toString().length<500){_25+="&"+_26;if(_20.match(/GET/i)){_21="";}}else{if(_21){_20="POST";}}}_24=1;}else{if(_21&&_21!=null){if(_21.toString().length<500){_25+="?"+_21;if(_20.match(/GET/i)){_21="";}}else{if(_21){_20="POST";}}}}var _27=Ajax.cacheHash[_25];if(!_27||!_27.theData||!_27.keepData()||_24){if(!_24){_27=new CacheDecider(60*15);Ajax.cacheHash[_25]=_27;Ajax.cacheDex.push(_25);if(Ajax.cacheDex.length>_23){var _28=Ajax.cacheDex.shift();if(_28){delete Ajax.cacheHash[_28];}}}var _29=new Ajax.Request(_25,{method:_20,parameters:_21,furl:_25,asynchronous:(_22?false:true),onComplete:function(oBj){if(!url.match(/LightboxSave/)){document.ajaxLoaded=true;mkObj(oBj,_25);}},onFailure:function(){}});}else{document.JSONobj=Ajax.cacheHash[_25].theData;document.ajaxLoaded=true;if(document.JSONobj.oJSON.callback){eval(document.JSONobj.oJSON.callback);}}}function mkObj(_2b,url){var rt=_2b.responseText;document.JSONobj=new localJSONobj(rt);if(Ajax.cacheHash[url]&&!url.match(/Cart|Lightbox|Share/)){Ajax.cacheHash[url].theData=document.JSONobj;}if(document.JSONobj.oJSON.callback){eval(document.JSONobj.oJSON.callback);}}function bakeCookie(_2e,_2f,_30){if(_30){var _31=new Date();_31.setTime(_31.getTime()+(_30*60*60*1000));var _32="; expires="+_31.toGMTString();}else{var _32="";}document.cookie=_2e+"="+_2f+_32+"; path=/";}function eatCookie(_33){var _34=_33+"=";var ca=document.cookie.split(";");for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==" "){c=c.substring(1,c.length);}if(c.indexOf(_34)==0){return c.substring(_34.length,c.length);}}return null;}function tossCookie(_38){bakeCookie(_38,"",1);}function debugObject(){ret=prompt("Enter object","document");obj=eval(ret);var _39="";for(x in obj){_39+=x+": "+obj[x]+"<br/>\n";}$("Layer1").innerHTML=_39;}if(document.currentUser){var ltstr=eatCookie("lightbox_queue."+document.currentUser);if(ltstr){var tltstr=ltstr+" ";var actions=$A(tltstr.evalJSON());if(actions.length){var last_action=actions.pop();actions.each(function(_3a){ajax_JSON(_3a,"GET",null);});tossCookie("lightbox_queue."+document.currentUser);ajax_JSON(last_action+"&callback=lightbox_mod_act(0)","GET",null);}}}
