var jaaulde=window.jaaulde||{};jaaulde.utils=jaaulde.utils||{};
jaaulde.utils.cookies=function(){var a,c,b,e,g={expiresAt:null,path:"/",domain:null,secure:false};a=function(d){var f,i;if(typeof d!=="object"||d===null)f=g;else{f={expiresAt:g.expiresAt,path:g.path,domain:g.domain,secure:g.secure};if(typeof d.expiresAt==="object"&&d.expiresAt instanceof Date)f.expiresAt=d.expiresAt;else if(typeof d.hoursToLive==="number"&&d.hoursToLive!==0){i=new Date;i.setTime(i.getTime()+d.hoursToLive*60*60*1E3);f.expiresAt=i}if(typeof d.path==="string"&&d.path!=="")f.path=d.path;
if(typeof d.domain==="string"&&d.domain!=="")f.domain=d.domain;if(d.secure===true)f.secure=d.secure}return f};c=function(d){d=a(d);return(typeof d.expiresAt==="object"&&d.expiresAt instanceof Date?"; expires="+d.expiresAt.toGMTString():"")+"; path="+d.path+(typeof d.domain==="string"?"; domain="+d.domain:"")+(d.secure===true?"; secure":"")};b=function(){var d={},f,i,k,l,o=document.cookie.split(";"),h;for(f=0;f<o.length;f+=1){i=o[f].split("=");k=i[0].replace(/^\s*/,"").replace(/\s*$/,"");try{l=decodeURIComponent(i[1])}catch(j){l=
i[1]}if(typeof JSON==="object"&&JSON!==null&&typeof JSON.parse==="function")try{h=l;l=JSON.parse(l)}catch(m){l=h}d[k]=l}return d};e=function(){};e.prototype.get=function(d){var f,i,k=b();if(typeof d==="string")f=typeof k[d]!=="undefined"?k[d]:null;else if(typeof d==="object"&&d!==null){f={};for(i in d)f[d[i]]=typeof k[d[i]]!=="undefined"?k[d[i]]:null}else f=k;return f};e.prototype.filter=function(d){var f,i={},k=b();if(typeof d==="string")d=RegExp(d);for(f in k)if(f.match(d))i[f]=k[f];return i};e.prototype.set=
function(d,f,i){if(typeof i!=="object"||i===null)i={};if(typeof f==="undefined"||f===null){f="";i.hoursToLive=-8760}else if(typeof f!=="string")if(typeof JSON==="object"&&JSON!==null&&typeof JSON.stringify==="function")f=JSON.stringify(f);else throw Error("cookies.set() received non-string value and could not serialize.");i=c(i);document.cookie=d+"="+encodeURIComponent(f)+i};e.prototype.del=function(d,f){var i={},k;if(typeof f!=="object"||f===null)f={};if(typeof d==="boolean"&&d===true)i=this.get();
else if(typeof d==="string")i[d]=true;for(k in i)typeof k==="string"&&k!==""&&this.set(k,null,f)};e.prototype.test=function(){var d=false;this.set("cT","data");if(this.get("cT")==="data"){this.del("cT");d=true}return d};e.prototype.setOptions=function(d){if(typeof d!=="object")d=null;g=a(d)};return new e}();
(function(){window.jQuery&&function(a){a.cookies=jaaulde.utils.cookies;a.each({cookify:function(c){return this.each(function(){var b,e=["name","id"],g,d=a(this),f;for(b in e)if(!isNaN(b)){g=d.attr(e[b]);if(typeof g==="string"&&g!==""){if(d.is(":checkbox, :radio")){if(d.attr("checked"))f=d.val()}else f=d.is(":input")?d.val():d.html();if(typeof f!=="string"||f==="")f=null;a.cookies.set(g,f,c);break}}})},cookieFill:function(){return this.each(function(){var c,b,e=["name","id"],g,d=a(this);for(b=function(){c=
e.pop();return!!c};b();){g=d.attr(c);if(typeof g==="string"&&g!==""){b=a.cookies.get(g);if(b!==null)if(d.is(":checkbox, :radio"))d.val()===b?d.attr("checked","checked"):d.removeAttr("checked");else d.is(":input")?d.val(b):d.html(b);break}}})},cookieBind:function(c){return this.each(function(){var b=a(this);b.cookieFill().change(function(){b.cookify(c)})})}},function(c){a.fn[c]=this})}(window.jQuery)})();if(!this.JSON)this.JSON={};
(function(){function a(l){return l<10?"0"+l:l}function c(l){g.lastIndex=0;return g.test(l)?'"'+l.replace(g,function(o){var h=i[o];return typeof h==="string"?h:"\\u"+("0000"+o.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+l+'"'}function b(l,o){var h,j,m,r,q=d,p,n=o[l];if(n&&typeof n==="object"&&typeof n.toJSON==="function")n=n.toJSON(l);if(typeof k==="function")n=k.call(o,l,n);switch(typeof n){case "string":return c(n);case "number":return isFinite(n)?String(n):"null";case "boolean":case "null":return String(n);
case "object":if(!n)return"null";d+=f;p=[];if(Object.prototype.toString.apply(n)==="[object Array]"){r=n.length;for(h=0;h<r;h+=1)p[h]=b(h,n)||"null";m=p.length===0?"[]":d?"[\n"+d+p.join(",\n"+d)+"\n"+q+"]":"["+p.join(",")+"]";d=q;return m}if(k&&typeof k==="object"){r=k.length;for(h=0;h<r;h+=1){j=k[h];if(typeof j==="string")if(m=b(j,n))p.push(c(j)+(d?": ":":")+m)}}else for(j in n)if(Object.hasOwnProperty.call(n,j))if(m=b(j,n))p.push(c(j)+(d?": ":":")+m);m=p.length===0?"{}":d?"{\n"+d+p.join(",\n"+d)+
"\n"+q+"}":"{"+p.join(",")+"}";d=q;return m}}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+a(this.getUTCMonth()+1)+"-"+a(this.getUTCDate())+"T"+a(this.getUTCHours())+":"+a(this.getUTCMinutes())+":"+a(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()}}var e=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
g=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,d,f,i={"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},k;if(typeof JSON.stringify!=="function")JSON.stringify=function(l,o,h){var j;f=d="";if(typeof h==="number")for(j=0;j<h;j+=1)f+=" ";else if(typeof h==="string")f=h;if((k=o)&&typeof o!=="function"&&(typeof o!=="object"||typeof o.length!=="number"))throw Error("JSON.stringify");return b("",
{"":l})};if(typeof JSON.parse!=="function")JSON.parse=function(l,o){function h(m,r){var q,p,n=m[r];if(n&&typeof n==="object")for(q in n)if(Object.hasOwnProperty.call(n,q)){p=h(n,q);if(p!==undefined)n[q]=p;else delete n[q]}return o.call(m,r,n)}var j;e.lastIndex=0;if(e.test(l))l=l.replace(e,function(m){return"\\u"+("0000"+m.charCodeAt(0).toString(16)).slice(-4)});if(/^[\],:{}\s]*$/.test(l.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+l+")");return typeof o==="function"?h({"":j},""):j}throw new SyntaxError("JSON.parse");}})();(function(a){function c(h){if(a.facebox.settings.inited)return true;else a.facebox.settings.inited=true;a(document).trigger("init.facebox");g();var j=a.facebox.settings.imageTypes.join("|");a.facebox.settings.imageTypesRegexp=RegExp("."+j+"$","i");h&&a.extend(a.facebox.settings,h);a("body").append(a.facebox.settings.faceboxHtml);var m=[new Image,new Image];m[0].src=a.facebox.settings.closeImage;m[1].src=a.facebox.settings.loadingImage;a("#facebox").find(".b:first, .bl, .br, .tl, .tr").each(function(){m.push(new Image);
m.slice(-1).src=a(this).css("background-image").replace(/url\((.+)\)/,"$1")});a("#facebox .close").click(a.facebox.close);a("#facebox .close_image").attr("src",a.facebox.settings.closeImage)}function b(){var h,j;if(self.pageYOffset){j=self.pageYOffset;h=self.pageXOffset}else if(document.documentElement&&document.documentElement.scrollTop){j=document.documentElement.scrollTop;h=document.documentElement.scrollLeft}else if(document.body){j=document.body.scrollTop;h=document.body.scrollLeft}return[h,
j]}function e(){var h;if(self.innerHeight)h=self.innerHeight;else if(document.documentElement&&document.documentElement.clientHeight)h=document.documentElement.clientHeight;else if(document.body)h=document.body.clientHeight;return h}function g(){var h=a.facebox.settings;h.loadingImage=h.loading_image||h.loadingImage;h.closeImage=h.close_image||h.closeImage;h.imageTypes=h.image_types||h.imageTypes;h.faceboxHtml=h.facebox_html||h.faceboxHtml}function d(h,j){if(h.match(/#/)){var m=window.location.href.split("#")[0];
m=h.replace(m,"");a.facebox.reveal(a(m).clone().show(),j)}else h.match(a.facebox.settings.imageTypesRegexp)?f(h,j):i(h,j)}function f(h,j){var m=new Image;m.onload=function(){a.facebox.reveal('<div class="image"><img src="'+m.src+'" /></div>',j)};m.src=h}function i(h,j){a.get(h,function(m){a.facebox.reveal(m,j)})}function k(){return a.facebox.settings.overlay==false||a.facebox.settings.opacity===null}function l(){if(!k()){a("facebox_overlay").length==0&&a("body").append('<div id="facebox_overlay" class="facebox_hide"></div>');
a("#facebox_overlay").hide().addClass("facebox_overlayBG").css("opacity",a.facebox.settings.opacity).click(function(){a(document).trigger("close.facebox")}).fadeIn(200);return false}}function o(){if(!k()){a("#facebox_overlay").fadeOut(200,function(){a("#facebox_overlay").removeClass("facebox_overlayBG");a("#facebox_overlay").addClass("facebox_hide");a("#facebox_overlay").remove()});return false}}a.facebox=function(h,j){a.facebox.loading();if(isIE6){a("#facebox .tl").css("background","url(lib/facebox/tl.gif)");
a("#facebox .tr").css("background","url(lib/facebox/tr.gif)");a("#facebox .bl").css("background","url(lib/facebox/bl.gif)");a("#facebox .br").css("background","url(lib/facebox/br.gif)")}if(h.ajax)i(h.ajax);else if(h.image)f(h.image);else if(h.div)d(h.div);else a.isFunction(h)?h.call(a):a.facebox.reveal(h,j)};a.extend(a.facebox,{settings:{opacity:0,overlay:false,loadingImage:"lib/facebox/loading.gif",closeImage:"lib/facebox/closelabel.gif",imageTypes:["png","jpg","jpeg","gif"],faceboxHtml:'    <div id="facebox" style="display:none;">       <div class="popup">         <table>           <tbody>             <tr>               <td class="tl"/><td class="b"/><td class="tr"/>             </tr>             <tr>               <td class="b"/>               <td class="body">                 <div class="content">                 </div>                 <div class="footer">                   <a href="#" class="close">                     <img src="lib/facebox/closelabel.gif" title="close" class="close_image" />                   </a>                 </div>               </td>               <td class="b"/>             </tr>             <tr>               <td class="bl"/><td class="b"/><td class="br"/>             </tr>           </tbody>         </table>       </div>     </div>'},
loading:function(){c();if(a("#facebox .loading").length==1)return true;l();a("#facebox .content").empty();a("#facebox .body").children().hide().end().append('<div class="loading"><img src="'+a.facebox.settings.loadingImage+'"/></div>');a("#facebox").css({top:b()[1]+e()/10,left:a(window).width()/2-a("#facebox").width()/2}).show();a(document).bind("keydown.facebox",function(h){h.keyCode==27&&a.facebox.close();return true});a(document).trigger("loading.facebox")},reveal:function(h,j){a(document).trigger("beforeReveal.facebox");
j&&a("#facebox .content").addClass(j);a("#facebox .content").append(h);a("#facebox .loading").remove();a("#facebox .body").children().fadeIn("normal");a("#facebox").css("left",a(window).width()/2-a("#facebox table").width()/2);a(document).trigger("reveal.facebox").trigger("afterReveal.facebox")},close:function(){a(document).trigger("close.facebox");crave.grayOut(false,{zindex:"50",bgcolor:"#000000",opacity:"90"});a("#flash_container").css("visibility","visible");return false}});a.fn.facebox=function(h){c(h);
return this.click(function(){a.facebox.loading(true);var j=this.rel.match(/facebox\[?\.(\w+)\]?/);if(j)j=j[1];d(this.href,j);return false})};a(document).bind("close.facebox",function(){a(document).unbind("keydown.facebox");crave.grayOut(false,{zindex:"50",bgcolor:"#000000",opacity:"90"});a("#facebox").fadeOut(function(){a("#facebox .content").removeClass().addClass("content");o();a("#facebox .loading").remove()});a("#flash_container").css("visibility","visible");a("html").css("background","white")})})(jQuery);(function(a){a.fn.checkbox=function(c){try{document.execCommand("BackgroundImageCache",false,true)}catch(b){}var e={cls:"jquery-checkbox",empty:"lib/jquery-checkbox.1.1.0b2/empty.png"};e=a.extend(e,c||{});var g=function(d){var f=d.checked,i=d.disabled,k=a(d);d.stateInterval&&clearInterval(d.stateInterval);d.stateInterval=setInterval(function(){if(d.disabled!=i)k.trigger((i=!!d.disabled)?"disable":"enable");if(d.checked!=f)k.trigger((f=!!d.checked)?"check":"uncheck")},10);return k};return this.each(function(){var d=
this,f=g(d);d.wrapper&&d.wrapper.remove();d.wrapper=a('<span class="'+e.cls+'"><span class="mark"><img src="'+e.empty+'" /></span></span>');d.wrapperInner=d.wrapper.children("span");d.wrapper.hover(function(){d.wrapperInner.addClass(e.cls+"-hover")},function(){d.wrapperInner.removeClass(e.cls+"-hover")});f.css({position:"absolute",zIndex:-1}).after(d.wrapper);var i=f.parents("label");i.length?i.click(function(k){f.trigger("click",[k]);return a.browser.msie&&a.browser.version<7}):d.wrapper.click(function(k){f.trigger("click",
[k])});delete i;f.bind("disable",function(){d.wrapperInner.addClass(e.cls+"-disabled")}).bind("enable",function(){d.wrapperInner.removeClass(e.cls+"-disabled")});f.bind("check",function(){d.wrapper.addClass(e.cls+"-checked")}).bind("uncheck",function(){d.wrapper.removeClass(e.cls+"-checked")});a("img",d.wrapper).bind("dragstart",function(){return false}).bind("mousedown",function(){return false});window.getSelection&&d.wrapper.css("MozUserSelect","none");d.checked&&d.wrapper.addClass(e.cls+"-checked");
d.disabled&&d.wrapperInner.addClass(e.cls+"-disabled")})}})(jQuery);eval(function(a,c,b,e,g,d){g=function(f){return f.toString(c)};if(!"".replace(/^/,String)){for(;b--;)d[g(b)]=e[b]||g(b);e=[function(f){return d[f]}];g=function(){return"\\w+"};b=1}for(;b--;)if(e[b])a=a.replace(RegExp("\\b"+g(b)+"\\b","g"),e[b]);return a}('2.g.q=1(b,c){b=b||"*";c=c||7;4 d=2([]);0.5(1(){4 a=2("9[@8=f]",0).6(b).5(1(){0.3=!0.3}).6(":3");d=a});e(!c){d=0}i d};2.g.p=1(b,c){b=b||"*";c=c||7;4 d=2([]);0.5(1(){4 a=2("9[@8=f]",0).6(b).5(1(){0.3=o}).6(":3");d=a});e(!c){d=0}i d};2.g.n=1(b,c){b=b||"*";c=c||7;4 d=2([]);0.5(1(){4 a=2("9[@8=f]",0).6(b).5(1(){0.3=7}).6(":j(:3)");d=a});e(!c){d=0}i d};2.m=1(a,b){b=b||"*";4 c="9[@8=f]";e(a){c+="[@l="+a+"]"}4 h=2(c).6(b);h.k(1(){h.j(0).5(1(){0.3=7}).r()})};',
28,28,"this|function|jQuery|checked|var|each|filter|false|type|input|||||if|checkbox|fn|x|return|not|click|name|radioCheckboxGroup|unCheckCheckboxes|true|checkCheckboxes|toggleCheckboxes|end".split("|"),0,{}));(function(a){a.fn.shiftClick=function(){var c,b=a(this);this.each(function(){a(this).click(function(e){if(e.shiftKey){var g=b.index(c),d=b.index(this);e=Math.max(d,g);var f=c.checked;for(g=Math.min(d,g);g<e;g++)b[g].checked=f}else c=this})})}})(jQuery);jQuery.cookie=function(a,c,b){if(typeof c!="undefined"){b=b||{};if(c===null){c="";b.expires=-1}var e="";if(b.expires&&(typeof b.expires=="number"||b.expires.toUTCString)){if(typeof b.expires=="number"){e=new Date;e.setTime(e.getTime()+b.expires*24*60*60*1E3)}else e=b.expires;e="; expires="+e.toUTCString()}var g=b.path?"; path="+b.path:"",d=b.domain?"; domain="+b.domain:"";b=b.secure?"; secure":"";document.cookie=[a,"=",encodeURIComponent(c),e,g,d,b].join("")}else{c=null;if(document.cookie&&document.cookie!=
""){b=document.cookie.split(";");for(e=0;e<b.length;e++){g=jQuery.trim(b[e]);if(g.substring(0,a.length+1)==a+"="){c=decodeURIComponent(g.substring(a.length+1));break}}}return c}};jQuery.fn.extend({everyTime:function(a,c,b,e){return this.each(function(){jQuery.timer.add(this,a,c,b,e)})},oneTime:function(a,c,b){return this.each(function(){jQuery.timer.add(this,a,c,b,1)})},stopTime:function(a,c){return this.each(function(){jQuery.timer.remove(this,a,c)})}});
jQuery.extend({timer:{global:[],guid:1,dataKey:"jQuery.timer",regex:/^([0-9]+(?:\.[0-9]*)?)\s*(.*s)?$/,powers:{ms:1,cs:10,ds:100,s:1E3,das:1E4,hs:1E5,ks:1E6},timeParse:function(a){if(a==undefined||a==null)return null;var c=this.regex.exec(jQuery.trim(a.toString()));return c[2]?parseFloat(c[1])*(this.powers[c[2]]||1):a},add:function(a,c,b,e,g){var d=0;if(jQuery.isFunction(b)){g||(g=e);e=b;b=c}c=jQuery.timer.timeParse(c);if(!(typeof c!="number"||isNaN(c)||c<0)){if(typeof g!="number"||isNaN(g)||g<0)g=
0;g=g||0;var f=jQuery.data(a,this.dataKey)||jQuery.data(a,this.dataKey,{});f[b]||(f[b]={});e.timerID=e.timerID||this.guid++;var i=function(){if(++d>g&&g!==0||e.call(a,d)===false)jQuery.timer.remove(a,b,e)};i.timerID=e.timerID;f[b][e.timerID]||(f[b][e.timerID]=window.setInterval(i,c));this.global.push(a)}},remove:function(a,c,b){var e=jQuery.data(a,this.dataKey),g;if(e){if(c){if(e[c]){if(b){if(b.timerID){window.clearInterval(e[c][b.timerID]);delete e[c][b.timerID]}}else for(b in e[c]){window.clearInterval(e[c][b]);
delete e[c][b]}for(g in e[c])break;if(!g){g=null;delete e[c]}}}else for(c in e)this.remove(a,c,b);for(g in e)break;g||jQuery.removeData(a,this.dataKey)}}}});jQuery(window).bind("unload",function(){jQuery.each(jQuery.timer.global,function(a,c){jQuery.timer.remove(c)})});window.dhtmlHistory={isIE:false,isOpera:false,isSafari:false,isKonquerer:false,isGecko:false,isSupported:false,create:function(a){var c=this,b=navigator.userAgent.toLowerCase(),e=navigator.platform.toLowerCase(),g=navigator.vendor||"";if(g==="KDE"){this.isKonqueror=true;this.isSupported=false}else if(typeof window.opera!=="undefined")this.isSupported=this.isOpera=true;else if(typeof document.all!=="undefined")this.isSupported=this.isIE=true;else if(g.indexOf("Apple Computer, Inc.")>-1){this.isSafari=
true;this.isSupported=e.indexOf("mac")>-1}else if(b.indexOf("gecko")!=-1)this.isSupported=this.isGecko=true;window.historyStorage.setup(a);if(this.isSafari)this.createSafari();else this.isOpera&&this.createOpera();this.currentLocation=a=this.getCurrentLocation();this.isIE&&this.createIE(a);this.addEventListener(window,"unload",function(){c.firstLoad=null});if(this.isIE)this.ignoreLocationChange=true;else if(historyStorage.hasKey(this.PAGELOADEDSTRING)){this.ignoreLocationChange=false;this.fireOnNewListener=
true}else{this.firstLoad=this.ignoreLocationChange=true;historyStorage.put(this.PAGELOADEDSTRING,true)}setInterval(function(){c.checkLocation()},100)},initialize:function(){if(this.isIE)if(historyStorage.hasKey(this.PAGELOADEDSTRING)){this.fireOnNewListener=true;this.firstLoad=false}else{this.fireOnNewListener=false;this.firstLoad=true;historyStorage.put(this.PAGELOADEDSTRING,true)}},addListener:function(a){this.listener=a;if(this.fireOnNewListener){this.fireHistoryEvent(this.currentLocation);this.fireOnNewListener=
false}},addEventListener:function(a,c,b){if(a.addEventListener)a.addEventListener(c,b,false);else a.attachEvent&&a.attachEvent("on"+c,function(){b(window.event)})},add:function(a,c){if(this.isSafari){a=this.removeHash(a);historyStorage.put(a,c);this.currentLocation=a;window.location.hash=a;this.putSafariState(a)}else{var b=this;window.setTimeout(function(){if(b.currentWaitTime>0)b.currentWaitTime-=b.waitTime;a=b.removeHash(a);if(document.getElementById(a)&&b.debugMode)throw Error("Exception: History locations can not have the same value as _any_ IDs that might be in the document, due to a bug in IE; please ask the developer to choose a history location that does not match any HTML IDs in this document. The following ID is already taken and cannot be a location: "+
a);historyStorage.put(a,c);b.ignoreLocationChange=true;b.ieAtomicLocationChange=true;b.currentLocation=a;window.location.hash=a;if(b.isIE)b.iframe.src="blank.html?"+a;b.ieAtomicLocationChange=false},this.currentWaitTime);this.currentWaitTime+=this.waitTime}},isFirstLoad:function(){return this.firstLoad},getVersion:function(){return"0.6"},getCurrentLocation:function(){return this.isSafari?this.getSafariState():this.getCurrentHash()},getCurrentHash:function(){var a=window.location.href,c=a.indexOf("#");
return c>=0?a.substr(c+1):""},PAGELOADEDSTRING:"DhtmlHistory_pageLoaded",listener:null,waitTime:200,currentWaitTime:0,currentLocation:null,iframe:null,safariHistoryStartPoint:null,safariStack:null,safariLength:null,ignoreLocationChange:null,fireOnNewListener:null,firstLoad:null,ieAtomicLocationChange:null,createIE:function(a){this.waitTime=400;document.write('<iframe frameborder="0" id="rshHistoryFrame" style="'+(historyStorage.debugMode?"width: 800px;height:80px;border:1px solid black;":historyStorage.hideStyles)+
'" src="blank.html?'+a+'"></iframe>');this.iframe=document.getElementById("rshHistoryFrame")},createOpera:function(){this.waitTime=400;document.write('<img src="javascript:location.href=\'javascript:dhtmlHistory.checkLocation();\';" style="'+historyStorage.hideStyles+'" />')},createSafari:function(){var a=historyStorage.debugMode?"width:800px;height:20px;border:1px solid black;margin:0;padding:0;":historyStorage.hideStyles;document.write('<form id="rshSafariForm" style="'+(historyStorage.debugMode?
historyStorage.showStyles:historyStorage.hideStyles)+'"><input type="text" style="'+a+'" id="rshSafariStack" value="[]"/><input type="text" style="'+a+'" id="rshSafariLength" value=""/></form>');this.safariStack=document.getElementById("rshSafariStack");this.safariLength=document.getElementById("rshSafariLength");if(historyStorage.hasKey(this.PAGELOADEDSTRING))this.safariHistoryStartPoint=this.safariLength.value;else{this.safariHistoryStartPoint=history.length;this.safariLength.value=this.safariHistoryStartPoint}},
getSafariStack:function(){return historyStorage.fromJSON(this.safariStack.value)},getSafariState:function(){return this.getSafariStack()[history.length-this.safariHistoryStartPoint-1]},putSafariState:function(a){var c=this.getSafariStack();c[history.length-this.safariHistoryStartPoint]=a;this.safariStack.value=historyStorage.toJSON(c)},fireHistoryEvent:function(a){var c=historyStorage.get(a);this.listener.call(null,a,c)},checkLocation:function(){if(!this.isIE&&this.ignoreLocationChange)this.ignoreLocationChange=
false;else if(!(!this.isIE&&this.ieAtomicLocationChange)){var a=this.getCurrentLocation();if(a!=this.currentLocation){this.ieAtomicLocationChange=true;if(this.isIE&&this.getIframeHash()!=a)this.iframe.src="blank.html?"+a;else if(this.isIE)return;this.currentLocation=a;this.ieAtomicLocationChange=false;this.fireHistoryEvent(a)}}},getIframeHash:function(){var a=String(this.iframe.contentWindow.document.location.search);if(a.length==1&&a.charAt(0)=="?")a="";else if(a.length>=2&&a.charAt(0)=="?")a=a.substring(1);
return a},removeHash:function(a){return a===null||a===undefined?null:a===""?"":a.length==1&&a.charAt(0)=="#"?"":a.length>1&&a.charAt(0)=="#"?a.substring(1):a},iframeLoaded:function(a){if(this.ignoreLocationChange)this.ignoreLocationChange=false;else{a=String(a.search);if(a.length==1&&a.charAt(0)=="?")a="";else if(a.length>=2&&a.charAt(0)=="?")a=a.substring(1);window.location.hash=a;this.fireHistoryEvent(a)}}};
window.historyStorage={setup:function(a){if(typeof a!=="undefined"){if(a.debugMode)this.debugMode=a.debugMode;if(a.toJSON)this.toJSON=a.toJSON;if(a.fromJSON)this.fromJSON=a.fromJSON}document.write('<form id="rshStorageForm" style="'+(this.debugMode?historyStorage.showStyles:historyStorage.hideStyles)+'"><textarea id="rshStorageField" style="'+(historyStorage.debugMode?"width: 800px;height:80px;border:1px solid black;":historyStorage.hideStyles)+'"></textarea></form>');this.storageField=document.getElementById("rshStorageField");
typeof window.opera!=="undefined"&&this.storageField.focus()},put:function(a,c){this.assertValidKey(a);this.hasKey(a)&&this.remove(a);this.storageHash[a]=c;this.saveHashTable()},get:function(a){this.assertValidKey(a);this.loadHashTable();a=this.storageHash[a];if(a===undefined)a=null;return a},remove:function(a){this.assertValidKey(a);this.loadHashTable();delete this.storageHash[a];this.saveHashTable()},reset:function(){this.storageField.value="";this.storageHash={}},hasKey:function(a){this.assertValidKey(a);
this.loadHashTable();return typeof this.storageHash[a]!=="undefined"},isValidKey:function(a){return typeof a==="string"},showStyles:"border:0;margin:0;padding:0;",hideStyles:"left:-1000px;top:-1000px;width:1px;height:1px;border:0;position:absolute;",debugMode:false,storageHash:{},hashLoaded:false,storageField:null,assertValidKey:function(a){if(!this.isValidKey(a)&&this.debugMode)throw Error("Please provide a valid key for window.historyStorage. Invalid key = "+a+".");},loadHashTable:function(){if(!this.hashLoaded){var a=
this.storageField.value;if(a!==""&&a!==null){this.storageHash=this.fromJSON(a);this.hashLoaded=true}}},saveHashTable:function(){this.loadHashTable();this.storageField.value=this.toJSON(this.storageHash)},toJSON:function(a){return a.toJSONString()},fromJSON:function(a){return a.parseJSON()}};function disableSelect(a){a.onselectstart=function(){return false};a.onmousedown=function(){return false}};var Changenumber=function(){this.carrierName=this.carrierAddress=this.cell3=this.cell2=this.cell1=this.loadCompleteCallee=this.pagetimeout="";this.bound=false};Changenumber.prototype.backendUrl="/online/pages/settings/change_number_backend.jsp";Changenumber.prototype.hideLoadingCircle=function(){$("#login_loading").hide()};
Changenumber.prototype.testCode=function(){var a=this,c=$("#change_number_code").val();$.post(this.backendUrl,{trycode:c},function(b){b=$.trim(b);if(b.substring(0,7)==="CORRECT"){b=a.cell1+"-"+a.cell2+"-"+a.cell3;$("#settings_number_box").html(b);$("#settings_carrier_box").html(a.carrierName);$.facebox.close()}else if(b.substring(0,9)==="INCORRECT"){b=b.substring(b.indexOf("ATTEMPTLEFT ")+12,b.lastIndexOf("\n"));alert("Incorrect code.  You have "+b+" more attempts")}else if(b.substring(0,7)==="OVERMAX"){alert("You have passed the maximum number of attempts.\nPlease contact support at support@startcraving.com");
$.facebox.close()}else alert("Error.  Unable to communicate with Crave server.\nCheck your internet connection")})};
Changenumber.prototype.sendCode=function(){this.cell1=$("#cell1_change").val();this.cell2=$("#cell2_change").val();this.cell3=$("#cell3_change").val();this.carrierAddress=$("#carrier_change").val();this.carrierName=$("#carrier_change option:selected").text();$.post(this.backendUrl,{sendcode:"true",cell1:this.cell1,cell2:this.cell2,cell3:this.cell3,carrier:this.carrierAddress},function(a){a=$.trim(a);if(a.substring(0,8)=="SENTLEFT"){a=a.substring(a.indexOf("SENTLEFT ")+9,a.lastIndexOf("\n"));if(a<
4&&a>0)alert("Code re-sent.  You have "+a+" more re-sends");else if(a==0){alert("You have re-sent the code too many times\nPlease contact support at support@startcraving.com");$.facebox.close()}}else alert("Error.  Unable to communicate with Crave server.\nCheck your internet connection")})};
Changenumber.prototype.sendNumberNext=function(){if($("#cell1_change").val().length!=3||$("#cell2_change").val().length!=3||$("#cell3_change").val().length!=4)alert("You must enter a 10 digit number");else{this.sendCode();this.loadSecurityPage()}};Changenumber.prototype.areaCodeCheck=function(){$("#cell1_change").val().length<3?$("#cell1_change").focus():$("#cell2_change").focus()};Changenumber.prototype.midNumCheck=function(){$("#cell2_change").val().length<3?$("#cell2_change").focus():$("#cell3_change").focus()};
Changenumber.prototype.loadEnterNumberPage=function(){$("#menu_item_enter_number").css("color","#FFFFFF");$("#menu_item_security_code").css("color","#000000");$("#change_number_sec_code_message").hide();$("#change_number_enter_number").show()};Changenumber.prototype.loadSecurityPage=function(){$("#change_number_sec_code_message").show();$("#change_number_enter_number").hide();var a=this.cell1+"-"+this.cell2+"-"+this.cell3+" ("+this.carrierName+")";$("#change_number_phone_div").html(a)};
Changenumber.prototype.bind=function(){var a=this;if(this.bound!==true){$("#cell1_change").live("keyup",function(){a.areaCodeCheck()});$("#cell2_change").live("keyup",function(){a.midNumCheck()});$("#change_number_cancel").live("click",function(){$.facebox.close()});$("#change_phone_commit").live("click",function(){a.sendNumberNext()});$("#change_number_try").live("click",function(){a.testCode()});$("#change_number_resend").live("click",function(){a.sendCode()});$("#change_number_try").live("mouseover",
function(){$("#change_number_try_table").css("backgroundPosition","0px -34px");$("#change_number_try").css("color","#00B0F0")});$("#change_number_try").live("mouseout",function(){$("#change_number_try_table").css("backgroundPosition","0px 0px");$("#change_number_try").css("color","#FFFFFF")});$("#change_phone_commit").live("mouseover",function(){$("#change_phone_commit_table").css("backgroundPosition","0px -34px");$("#change_phone_commit").css("color","#00B0F0")});$("#change_phone_commit").live("mouseout",
function(){$("#change_phone_commit_table").css("backgroundPosition","0px 0px");$("#change_phone_commit").css("color","#FFFFFF")});this.bound=true}};$(document).ready(function(){changenumber=typeof changenumber!="undefined"?changenumber:new Changenumber;changenumber.bind()});var userstate=userstate||{name:null,signup_step:0},Crave=function(){this.logged_in=false;this.signin_button=$("#signin")};Crave.prototype.SETUP_NO_STATE=0;Crave.prototype.SETUP_ENTER_NUMBER=1;Crave.prototype.SETUP_ENTER_SECURITY_CODE=2;Crave.prototype.SETUP_FRIENDS=3;Crave.prototype.SETUP_SETTINGS=4;
Crave.prototype.contentMap={contact:"/pages/contact/content.jsp",faq:"/pages/faq/content.jsp",friends:"/pages/friends/friend_content.jsp",home:"/pages/home/content.jsp",privacy:"/pages/privacy/content.jsp",settings:"/pages/settings/settings_content.jsp",tos:"/pages/tos/content.jsp"};
Crave.prototype.faceboxContentMap={enter_number:"/online/pages/signup/signup.jsp",security_code:"/online/pages/signup/signup.jsp",changenumber:"/online/pages/settings/change_number.jsp",feedback:"/online/pages/feedback/feedback.jsp",howto:"/online/pages/howto/content.html"};Crave.prototype.modal_options={zindex:"50",bgcolor:"#000000",opacity:"90"};Crave.prototype.setRedirectUrl=function(a){this.redirectUrl=a};Crave.prototype.getSignupStep=function(){return userstate.signup_step};
Crave.prototype.isSignedUp=function(){return userstate.signup_step===5};Crave.prototype.setIeTitle=function(){window.onload=function(){document.title="Join Crave"}};Crave.prototype.showLoading=function(){$("#content").empty();$("#content").html("<div style='width: 60px; text-align: center; margin-left: auto; margin-right: auto;'><img src='assets/loading/loading.gif' style='margin-left: auto; margin-right: auto'/></div>")};
Crave.prototype.loadContent=function(a,c){var b=this;if(!this.contentMap[a])return false;dhtmlHistory.add(a,"link");document.title="Crave - Know what's up";$.post(this.contentMap[a],function(e){e=$.trim(e);if(e.length==0&&a!="home")b.loadContent("home");else{$("#content").html(e);e=$("#content").find("#login_level");if(e.length!==0){e=JSON.parse(e.html());userstate.signup_step=parseInt(e.level);userstate.name=e.name;b.setLoggedIn(userstate.name)}menu.select(a);c&&c()}});$(document).ready(function(){pageTracker._trackPageview(a)})};
Crave.prototype.isLoggedIn=function(){return this.logged_in};Crave.prototype.setLoggingInProgress=function(){var a=this;$("#signin_table").fadeOut(null,function(){$("#signin").html("Signing in...");$(a).oneTime(1E4,function(){userstate&&userstate.name?a.setLoggedIn(userstate.name):a.setLoggedIn(false)});$("#signin_table").fadeIn()})};
Crave.prototype.setLoggedIn=function(a){var c=(this.logged_in=!!a)?"Sign out "+$.trim(a):"Sign In With Facebook";c!==$("#signin").html()&&$("#signin_table").fadeOut(null,function(){$("#signin").html(c);$("#signin_table").fadeIn()})};Crave.prototype.log_out=function(){fbhelper.logout()};Crave.prototype.click_logo=function(){this.loadContent("home")};Crave.prototype.click_sign_in=function(){if(this.logged_in)this.log_out();else{this.setLoggingInProgress();fbhelper.login(function(){signup.routeLogin()})}};
Crave.prototype.click_feedback=function(){this.openModalWindow("feedback")};Crave.prototype.openModalWindow=function(a,c){this.modal_box_type=a;if(this.faceboxContentMap[a]){this.grayOut(true,this.modal_options);$(document).bind("reveal.facebox",function(){c&&c()});$.facebox({ajax:this.faceboxContentMap[a]});$("#flash_container").css("visibility","hidden");isIE6&&$("#get_started_button").css("display","none")}};Crave.prototype.closeModalWindow=function(){$.facebox.close()};
Crave.prototype.grayOut=function(a,c){c=c||{};var b=c.zindex||50,e=c.opacity||70,g=e/100,d=c.bgcolor||"#000000",f=document.getElementById("darkenScreenObject");if(!f){f=document.getElementsByTagName("body")[0];var i=document.createElement("div");i.style.position="absolute";i.style.top="0px";i.style.left="0px";i.style.overflow="hidden";i.style.display="none";i.id="darkenScreenObject";f.appendChild(i);f=document.getElementById("darkenScreenObject")}if(a){if(document.body&&(document.body.scrollWidth||
document.body.scrollHeight)){i=document.body.scrollWidth+"px";var k=document.body.scrollHeight+"px"}else if(document.body.offsetWidth){i=document.body.offsetWidth+"px";k=document.body.offsetHeight+"px"}else k=i="100%";$("body").css("background","white");$("html").css("background","#191919");f.style.opacity=g;f.style.MozOpacity=g;f.style.filter="alpha(opacity="+e+")";f.style.zIndex=b;f.style.backgroundColor=d;f.style.width=i;f.style.height=k;f.style.display="block"}else f.style.display="none"};
$(document).ready(function(){$("#side_bar").hover(function(){$("#side_bar").css("background-position","30px 0px");$("#side_bar").css("width","30px")},function(){$("#side_bar").css("background-position","0px 0px");$("#side_bar").css("width","27px")});$("#side_bar").live("click",function(){crave.click_feedback()});$("#contact-link").live("click",function(){crave.click_feedback()});$("#logo").live("click",function(){crave.click_logo()});crave=new Crave;$("#signin_table").hide();$("#signin").live("click",
function(){crave.click_sign_in()});$("#howto").live("click",function(){crave.openModalWindow("howto")});$("#home-link").live("click",function(){crave.loadContent("home")});$("#faq-link").live("click",function(){crave.loadContent("faq")});$("#tos-link").live("click",function(){crave.loadContent("tos")});$("#privacy-link").live("click",function(){crave.loadContent("privacy")});dhtmlHistory.initialize();dhtmlHistory.isSafari||dhtmlHistory.addListener(function(c){crave.loadContent(c)});menu=typeof menu!=
"undefined"?menu:new Menu;menu.bind();var a=dhtmlHistory.getCurrentLocation();if(a==null||a==""||a.toLowerCase()=="home"){dhtmlHistory.add("home","link");crave.setLoggedIn(userstate.name);menu.select("home")}else crave.loadContent(a);$("#howto_table").fadeOut(null,function(){$("#howto").html("How To");$("#howto_table").fadeIn()});$(".unselectable").each(function(){disableSelect(this)});crave.setLoggedIn(userstate.name)});window.dhtmlHistory.create({toJSON:function(a){return JSON.stringify(a)},fromJSON:function(a){return JSON.parse(a)}});var FbHelper=function(){FB?FB.init({appId:fb_appid,status:true,cookie:true,xfbml:true,channelUrl:document.location.protocol+"//"+document.location.hostname+"/channel.html"}):alert("Error: Unable to contact Facebook.")};FbHelper.prototype.logoutUrl="/online/pages/home/logout.jsp";FbHelper.prototype.subscribe=function(){FB&&FB.Event.subscribe("auth.logout",function(){$.post(this.logoutUrl,{},function(){crave.setLoggedIn(false);$.cookie("JSESSIONID",null);crave.loadContent("home")})})};
FbHelper.prototype.logout=function(){FB&&FB.logout(function(){})};FbHelper.prototype.login=function(a){FB&&FB.login(function(c){c.session&&a&&a()},{perms:"offline_access, publish_stream"})};$(document).ready(function(){fbhelper=new FbHelper;fbhelper.subscribe()});var Feedback=function(){this.bound=false};Feedback.prototype.verifySolution=function(){$.ajax({type:"GET",url:"/pages/feedback/feedback_backend.jsp",data:{challenge:Recaptcha.get_challenge(),userInput:Recaptcha.get_response(),userName:$("#userName").val(),userEmail:$("#userEmail").val(),userComments:$("#userComments").val()},success:this.checkResponse,dataType:"text",error:this.handleError})};
Feedback.prototype.checkResponse=function(a){a=$.trim(a);if(a==="success"){alert("Success, your email has been sent! Thank you for your feedback!");$.facebox.close()}else if(a==="false"){alert("Your input was not correct, please try again.");Recaptcha.reload()}else this.handleError()};Feedback.prototype.handleError=function(){alert("Sorry! There seems to be server error, please try again in a few minutes while we resolve the problem.")};
Feedback.prototype.render=function(){var a=$('form[name="captchaForm"] [id*="recaptcha_div_"]').attr("id");Recaptcha.create("6LcKIQUAAAAAAA42OWddG6YFVnHeL66L5zOqU9GI",a,{theme:"blackglass",callback:Recaptcha.focus_response_field})};Feedback.prototype.bind=function(){if(this.bound!==true){var a=this;$("#feedback-submit").live("click",function(){a.verifySolution()});$('form[name="captchaForm"]').live("submit",function(){a.verifySolution()});this.bound=true}};
$(document).ready(function(){feedback=typeof feedback!="undefined"?feedback:new Feedback;feedback.bind()});var Friends=function(){this.bound=false};Friends.prototype.bind=function(){if(this.bound!==true){$("#friend_done").live("click",function(){signup.routeLogin()});$("#friend_done_table").live("mouseover",function(){$("#friend_done_table").css("backgroundPosition","0px -48px");$("#friend_done").css("color","#515151")});$("#friend_done_table").live("mouseout",function(){$("#friend_done_table").css("backgroundPosition","0px 0px");$("#friend_done").css("color","#FFFFFF")});this.bound=true}};
$(document).ready(function(){friends=typeof friends!="undefined"?friends:new Friends;friends.bind()});var Menu=function(){this.currentPage="none";this.bound=false};Menu.prototype.buttonPicCoordinates={current:"0px -68px","non-current-mouseover":"0px -34px","non-current":"0px 0px"};Menu.prototype._setButtonState=function(a,c){a.css("background-position",this.buttonPicCoordinates[c])};
Menu.prototype.bind=function(){var a=this;if(this.bound!==true){$("#menu_bar #friends_button_table").live("click mouseover mouseout",function(c){var b=$(this);if(c.type=="click"){crave.showLoading();crave.loadContent("friends")}c.type=="mouseover"&&a.currentPage!=="friends"&&a._setButtonState(b,"non-current-mouseover");c.type=="mouseout"&&a.currentPage!=="friends"&&a._setButtonState(b,"non-current")});$("#menu_bar #settings_button_table").live("click mouseover mouseout",function(c){var b=$(this);
if(c.type=="click"){crave.showLoading();crave.loadContent("settings")}c.type=="mouseover"&&a.currentPage!=="settings"&&a._setButtonState(b,"non-current-mouseover");c.type=="mouseout"&&a.currentPage!=="settings"&&a._setButtonState(b,"non-current")});this.bound=true}};
Menu.prototype.select=function(a){var c=$("#menu_bar"),b=$("#menu_bar #settings_button_table"),e=$("#menu_bar #friends_button_table");crave.isLoggedIn()&&(crave.isSignedUp()||crave.getSignupStep()>=4)?c.show():c.hide();if(a==="settings"){this._setButtonState(b,"current");this._setButtonState(e,"non-current")}else if(a==="friends"){this._setButtonState(b,"non-current");this._setButtonState(e,"current")}else{this._setButtonState(b,"non-current");this._setButtonState(e,"non-current")}this.currentPage=
a};var NumberForm=function(){this.bound=false};NumberForm.prototype.areaCodeCheck=function(){$("#cell1").get(0).value.length+1<=3?$("#cell1").get(0).focus():$("#cell2").get(0).focus()};NumberForm.prototype.midNumCheck=function(){$("#cell2").get(0).value.length+1<=3?$("#cell2").get(0).focus():$("#cell3").get(0).focus()};
NumberForm.prototype.get_started_click=function(){$("#cell1").val().length===3&&$("#cell2").val().length===3&&$("#cell3").val().length===4?fbhelper.login(function(){signup.routeLogin()}):alert("You Must Enter a 10 Digit Number")};
NumberForm.prototype.bind=function(){if(this.bound!==true){var a=this;$("#get_started_button_table").live("mouseover",function(){$("#get_started_button_table").css("background-position","0px -55px")});$("#get_started_button").live("click",function(){a.get_started_click()});$("#get_started_button_table").live("mouseout",function(){$("#get_started_button_table").css("background-position","0px 0px")});$("#cell1").live("keyup",function(){a.areaCodeCheck()});$("#cell2").live("keyup",function(){a.midNumCheck()});
$("#how_to_button_table").live("mouseover",function(){$("#how_to_button_table").css("background-position","0px -44px")});$("#how_to_button_table").live("mouseout",function(){$("#how_to_button_table").css("background-position","0px 0px")});$("#how_to_button").live("click",function(){crave.openModalWindow("howto")});this.bound=true}};$(document).ready(function(){numberform=typeof numberform!="undefined"?numberform:new NumberForm;numberform.bind()});var Settings=function(){this.bound=false};Settings.prototype.settingsUrl="/online/pages/settings/settings_backend.jsp";Settings.prototype.submitEventDays=function(){var a={};$("#event_days .event_day").each(function(c,b){b=$(b);a["event_"+b.attr("id")]=b.attr("checked")});$.post(this.settingsUrl,a);this.toggleUpdate("#event_update")};Settings.prototype.submitProbeMax=function(){$.post(this.settingsUrl,{probe_max:$("#probe_max").val()},function(){});this.toggleUpdate("#max_msg_update")};
Settings.prototype.submitFriendMax=function(){$.post(this.settingsUrl,{friend_max:$("#friend_max").val()},function(){});this.toggleUpdate("#max_msg_update")};Settings.prototype.submitSchedule=function(){var a={};$("#schedules #weekdays input").each(function(c,b){b=$(b);a["weekday_"+b.attr("class")]=b.attr("value")});$("#schedules #weekends input").each(function(c,b){b=$(b);a["weekend_"+b.attr("class")]=b.attr("value")});$.post(this.settingsUrl,a);this.toggleUpdate("#other_update")};
Settings.prototype.submitName=function(){$.post(this.settingsUrl,{name_first:$("#first_name")[0].value,name_last:$("#last_name")[0].value});this.toggleUpdate("#other_update")};Settings.prototype.submitMessagesOn=function(){var a=!$("#messages_on").is(":checked");$.post(this.settingsUrl,{messages_on:a});this.toggleUpdate("#other_update")};Settings.prototype.toggleUpdate=function(a){obj=$(a);obj.slideToggle("slow");setTimeout("obj.slideToggle('slow')",2200)};
Settings.prototype.colorSelectBorder=function(a,c){a.css("border-color",c);var b=a.attr("id"),e=b.substring(b.indexOf("_")-1,b.indexOf("_"));b=b.substring(b.indexOf("_")+1,b.indexOf("_")+2);var g;if(eval(b+"-1")>=0){g="#selectday"+e+"_"+eval(b+"- 1");$(g.toString())[0].style.borderRightColor=c}if(eval(b+"+1")<=7){g="#selectday"+e+"_"+eval(b+"+ 1");$(g.toString())[0].style.borderLeftColor=c}g="#selectday"+eval(e+"+ 1")%2+"_"+b;if(eval(e+"+ 1")%2==0)$(g.toString())[0].style.borderBottomColor=c;else $(g.toString())[0].style.borderTopColor=
c};Settings.prototype.reloadPhoneNumber=function(){$.post(this.settingsUrl,{get_phonenumber:"true"},function(a){var c=a.split(":")[0];a=a.split(":")[1];$("#number_box").html(c.substring(0,3)+"-"+c.substring(3,6)+"-"+c.substring(6,10));$("#carrier_box").html(a)})};
Settings.prototype.bind=function(){var a=this;if(this.bound!=true){$("#schedules .selection_box").live("click mouseover mouseout",function(c){var b=$(this);if(c.type=="click"){c=$("input",b);if(c.attr("value")=="false"){b.css("background-color","#999999");c.attr("value","true")}else{b.css("background-color","#FFFFFF");c.attr("value","false")}settings.submitSchedule()}else if(c.type=="mouseover")a.colorSelectBorder(b,"#0066FF");else c.type=="mouseout"&&a.colorSelectBorder(b,"#D8D8D8")});$("#event_days .night_selector input.event_day").live("click",
function(){a.submitEventDays()});$(".phone_number_label").live("click mouseover mouseout",function(c){$(this);if(c.type=="click")crave.openModalWindow("changenumber");else if(c.type=="mouseover"){$("#settings_number_box").css("border","1px solid #999999");$("#settings_carrier_box").css("border","1px solid #999999")}else if(c.type=="mouseout"){$("#settings_number_box").css("backgroundColor","#E0E0E0");$("#settings_carrier_box").css("backgroundColor","#E0E0E0");$("#settings_number_box").css("border",
"1px solid #E0E0E0");$("#settings_carrier_box").css("border","1px solid #E0E0E0")}});$("#messages_on").live("click",function(){a.submitMessagesOn()});$("#friend_max").live("blur",function(){a.submitFriendMax()});$("input#probe_max").live("blur",function(){a.submitProbeMax()});$("input#first_name").live("blur",function(){a.submitName()});$("input#last_name").live("blur",function(){a.submitName()});this.bound=true}};
Settings.prototype.render=function(){$("#messages_on:not([safari])").checkbox();$("#messages_on").css("display","block");crave.isSignedUp()||$("#inner_title").delay(1E3).slideDown("slow")};$(document).ready(function(){settings=typeof settings!="undefined"?settings:new Settings;settings.bind()});var Signup=function(){this.loadCompleteCallee=this.pagetimeout="";this.bound=false};Signup.prototype.hideModalLoadingCircle=function(){$("#login_loading").css("display","none")};
Signup.prototype.routeLogin=function(){var a=this;$("#login_box_container").ajaxError(function(){alert("Connectivity error while communicating with Crave Server");a.hideModalLoadingCircle();a.hideSignupLoadingCircle()});$.get("/online/pages/signup/signup_backend.jsp",{getstep:"true"},function(c){c=c.trim();if((c=JSON.parse(c))&&c.level&&c.name){userstate.signup_step=parseInt(c.level);userstate.name=c.name}crave.setLoggedIn(userstate.name);switch(userstate.signup_step){case 0:case 1:crave.openModalWindow("enter_number",
function(){a.loadEnterNumberPage()});break;case 2:crave.openModalWindow("security_code",function(){a.loadSecurityPage()});break;case 3:crave.loadContent("friends",function(){crave.isSignedUp()?$("#friend_done_container").css("display","none"):$("#friend_done_container").css("display","block")});break;case 4:case 5:crave.loadContent("settings")}a.hideModalLoadingCircle()})};Signup.prototype.showDivider=function(){$("#menu_item_divider").css("width","30px");$("#menu_item_divider").html("|")};
Signup.prototype.showPhone=function(){$("#menu_item_phone").css("width","140px");$("#menu_item_phone").html("Security Code");$("#menu_item_login").css("padding-right","10px");$("#menu_item_login").css("text-align","right");$("#menu_item_phone").css("padding-left","10px");$("#menu_item_phone").css("text-align","left")};Signup.prototype.hideSignupLoadingCircle=function(){$("#container #row").show();$("#container #signup_working_circle").hide();$("#signup_working_message").html("")};
Signup.prototype.showSignupLoadingCircle=function(a){$("#container #row").hide();$("#container #signup_working_circle").show();a!=null&&$("#signup_working_message").html(a)};
Signup.prototype.testCode=function(){var a=document.getElementById("security_code").value,c=this;c.showSignupLoadingCircle("Testing Crave <br/>Security Code...");$.post("/online/pages/signup/signup_backend.jsp",{trycode:a},function(b){b=b.trim();if(b.substring(0,7)==="CORRECT"){crave.setLoggingInProgress();crave.showLoading();c.routeLogin();$.facebox.close()}else if(b.substring(0,9)==="INCORRECT"){b=b.substring(b.indexOf("ATTEMPTLEFT ")+12,b.lastIndexOf("\n"));alert("Incorrect code.  You have "+b+
" more attempts")}else if(b.substring(0,7)==="OVERMAX"){alert("You have passed the maximum number of attempts.\nPlease contact support at support@startcraving.com");crave.setLoggedIn(false);$.facebox.close();crave.loadContent("home")}else alert("Error.  Unable to communicate with Crave server.\nCheck your internet connection");c.hideSignupLoadingCircle()})};
Signup.prototype.sendCode=function(){var a,c,b,e;a=$("#cell1_box").val();c=$("#cell2_box").val();b=$("#cell3_box").val();e=$("#carrier_box").val();$("#carrier_box option:selected").text();var g=this;g.showSignupLoadingCircle("Sending Crave <br/> Security Code...");$.post("/online/pages/signup/signup_backend.jsp",{sendcode:"true",cell1:a,cell2:c,cell3:b,carrier:e},function(d){g.hideSignupLoadingCircle();d=d.trim();if(d.trim().substring(0,8)=="SENTLEFT"){d=d.substring(d.indexOf("SENTLEFT ")+9,d.lastIndexOf("\n"));
if(d<4&&d>0)alert("Code re-sent.  You have "+d+" more re-sends");else if(d==0){alert("You have re-sent the code too many times\nPlease contact support at support@startcraving.com");crave.setLoggedIn(false);$.facebox.close();crave.loadContent("home")}}else alert("Error.  Unable to communicate with Crave server.\nCheck your internet connection")})};
Signup.prototype.boxNumberNext=function(){if($("#cell1_box").val().length!=3||$("#cell2_box").val().length!=3||$("#cell3_box").val().length!=4)alert("You must enter a 10 digit number");else{this.sendCode();this.loadSecurityPage()}};Signup.prototype.areaCodeCheck=function(){$("#cell1_box").get(0).value.length+1<=3?$("#cell1_box").get(0).focus():$("#cell2_box").get(0).focus()};Signup.prototype.midNumCheck=function(){$("#cell2_box").get(0).value.length+1<=3?$("#cell2_box").get(0).focus():$("#cell3_box").get(0).focus()};
Signup.prototype.loadEnterNumberPage=function(){$("#menu_item_enter_number").css("color","#FFFFFF");$("#menu_item_security_code").css("color","#000000");$("#sec_code_message").hide();$("#enter_number").show();this.updateValues()};
Signup.prototype.loadSecurityPage=function(){var a=this;$("#sec_code_message").show();$("#enter_number").hide();var c=$("#cell1_box").val(),b=$("#cell2_box").val(),e=$("#cell3_box").val(),g=$("#carrier_box option:selected").text();$("#phone_number_div").html(c+"-"+b+"-"+e+" ("+g+")");this.showDivider();this.showPhone();$("#menu_item_enter_number").css("color","#000000");$("#menu_item_security_code").css("color","#FFFFFF");$("#menu_item_security_code").unbind("click").click(function(){a.loadSecurityPage()})};
Signup.prototype.bind=function(){var a=this;if(this.bound!==true){$("#next_button").live("click",function(){a.boxNumberNext()});$("#check_code_button").live("click",function(){a.testCode()});$("#cell1_box").live("keyup",function(){a.areaCodeCheck()});$("#cell2_box").live("keyup",function(){a.midNumCheck()});$("#signup_code_resend").live("click",function(){a.sendCode()});$("#signup_code_cancel").live("click",function(){$.facebox.close()});$("#check_code_button").live("mouseover",function(){$("#check_code_button_table").css("backgroundPosition",
"0px -34px");$("#check_code_button").css("color","#00B0F0")});$("#check_code_button").live("mouseout",function(){$("#check_code_button_table").css("backgroundPosition","0px 0px");$("#check_code_button").css("color","#FFFFFF")});$("#next_button").live("mouseover",function(){$("#next_button_table").css("backgroundPosition","0px -34px");$("#next_button").css("color","#00B0F0")});$("#next_button").live("mouseout",function(){$("#next_button_table").css("backgroundPosition","0px 0px");$("#next_button").css("color",
"#FFFFFF")});$("#menu_item_enter_number").live("click",function(){a.loadEnterNumberPage()});this.bound=true}};Signup.prototype.updateValues=function(){var a=$("#cell1_box").val(),c=$("#cell2_box").val(),b=$("#cell3_box").val();if(a===""&&c===""&&b===""){$("#cell1_box").val($("#cell1").val());$("#cell2_box").val($("#cell2").val());$("#cell3_box").val($("#cell3").val());$("#carrier_box").val($("#carrier").val())}};$(document).ready(function(){signup=typeof signup!="undefined"?signup:new Signup;signup.bind()});

