var Common={gsub:function(d,b,a){var c=d;var e=c.indexOf(b);if(e>-1){c=""+(c.substring(0,e)+a+c.substring((e+b.length),c.length))}if(c.indexOf(b)>-1){return Common.gsub(c,b,a)}else{return c}},track:function(a){if(typeof(_gaq)!="undefined"){_gaq.push(["_trackPageview",a]);_gaq.push(["_setAccount","UA-365214-11"]);_gaq.push(["_trackPageview",a])}},param_from_url:function(b,e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var a="[\\?&]"+e+"=([^&#]*)";var d=new RegExp(a);var c=d.exec(b);if(c==null){return null}else{return decodeURIComponent(c[1])}},mixpanel_track:function(b,a){Common.log("Mixpanel hit on event: "+b);if(mpq){a=(a==undefined)?{}:a;a.registered=(Common.logged_in()?"yes":"no");mpq.push(["track",b,a])}},mixpanel_track_link:function(d,c,b,a){a=a||false;Common.log("Mixpanel hit on event: "+d);proceed_to_url=function(){if(a){window.top.location.replace(b)}else{window.location=b}};if(mpq){c=(c==undefined)?{}:c;c.registered=(Common.logged_in()?"yes":"no");mpq.push(["track",d,c,proceed_to_url])}else{proceed_to_url()}},log:function(a){if(typeof(console)!="undefined"&&typeof(console.log)=="function"){console.log(a)}},logged_in:function(){var a=Common.readCookie("username");return !!a},change_param_from_url:function(b,f,d){f=f.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var a="[\\?&]"+f+"=([^&#]*)";var e=new RegExp(a);var c=e.exec(b);if(c==null){return b+"&"+f+"="&encodeURIComponent("new_value")}else{}},set_parent_hash:function(b,c,a){Common.set_parent_location(Common.change_hash_param(b,c,a))},change_hash_param:function(d,h,f){var b=d.search("#");if(b==-1){return d+"#"+h+"="+f}h=h.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var c="[\\?&#]"+h+"=([^&#]*)";var g=new RegExp(c);var e=g.exec(d.substr(b));if(e==null){return d+"&"+h+"="+f}else{var a=d.search(e[0]);return(d.substr(0,a+1)+h+"="+encodeURIComponent(f)+d.substr(a+e[0].length))}},set_parent_location:function(a){try{parent.location=a}catch(b){}},preloadimg:function(b){var a=new Image();a.src=b},createCookie:function(c,d,e){if(e){var b=new Date();b.setTime(b.getTime()+(e*24*60*60*1000));var a="; expires="+b.toGMTString()}else{var a=""}document.cookie=c+"="+d+a+"; path=/"},readCookie:function(b){var e=b+"=";var a=document.cookie.split(";");for(var d=0;d<a.length;d++){var g=a[d];while(g.charAt(0)==" "){g=g.substring(1,g.length)}if(g.indexOf(e)==0){var f=g.substring(e.length,g.length);return decodeURIComponent(f.replace(/\+/g,"%20"))}}return null},eraseCookie:function(a){createCookie(a,"",-1)},track_time:function(a,c){for(var b=0;b<c.length;b++){window.track_time_index=0;value=c[b];setTimeout(function(){var d=c[window.track_time_index];window.track_time_index++;$.get(a,{time:d})},value*1000*60)}},add_url_param:function(a,c,b){if(a.indexOf("?")>0){return(a+"&"+c+"="+b)}else{return(a+"?"+c+"="+b)}},number_with_precision:function(b,a){return b.toFixed(a)},number_with_delimiter:function(c,a){a=a||",";x=(c+"").split(".");x[1]=x.length>1?"."+x[1]:"";var b=/(\d+)(\d{3})/;while(b.test(x[0])){x[0]=x[0].replace(b,"$1"+a+"$2")}return x.join("")},number_to_currency:function(a,b){b=b||"$";return b+number_with_delimiter(number_with_precision(a,2))}};$(document).ready(function(){var a=Common.readCookie("username");if(a){$("#usr-links-username").html("Hi, "+a);$("#usr-links-logged-in").show();$("#usr-links-logged-out").hide();$("#developer-login-bar").show();$("#get-started-link").hide()}});$(document).ready(function(){$(".fancy-submit-button").each(function(){var b=$(this).attr("value");var a=$('<div class="more-btn submit-button-div" tabindex="0"><a href="#" title="'+b+'">'+b+"</a></div>").insertBefore($(this)).click(function(){$(this).closest("form").submit();return false});if($(this).hasClass("inline-fancy-submit-button")){a.css("display","inline")}$(this).hide()})});(function(f){f.facebox=function(m,l){f.facebox.loading();if(m.ajax){g(m.ajax)}else{if(m.image){c(m.image)}else{if(m.div){j(m.div)}else{if(f.isFunction(m)){m.call(f)}else{f.facebox.reveal(m,l)}}}}};f.extend(f.facebox,{settings:{opacity:0,overlay:true,loadingImage:"/legacy/javascripts/facebox/loading.gif",closeImage:"/legacy/javascripts/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="/legacy/javascripts/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(){k();if(f("#facebox .loading").length==1){return true}e();f("#facebox .content").empty();f("#facebox .body").children().hide().end().append('<div class="loading"><img src="'+f.facebox.settings.loadingImage+'"/></div>');f("#facebox").css({top:h()[1]+(i()/10),left:385.5}).show();f(document).bind("keydown.facebox",function(l){if(l.keyCode==27){f.facebox.close()}return true});f(document).trigger("loading.facebox")},reveal:function(m,l){f(document).trigger("beforeReveal.facebox");if(l){f("#facebox .content").addClass(l)}f("#facebox .content").append(m);f("#facebox .loading").remove();f("#facebox .body").children().fadeIn("normal");f("#facebox").css("left",f(window).width()/2-(f("#facebox table").width()/2));f(document).trigger("reveal.facebox").trigger("afterReveal.facebox")},close:function(){f(document).trigger("close.facebox");return false}});f.fn.facebox=function(l){k(l);function m(){f.facebox.loading(true);var n=this.rel.match(/facebox\[?\.(\w+)\]?/);if(n){n=n[1]}j(this.href,n);return false}return this.click(m)};function k(n){if(f.facebox.settings.inited){return true}else{f.facebox.settings.inited=true}f(document).trigger("init.facebox");d();var l=f.facebox.settings.imageTypes.join("|");f.facebox.settings.imageTypesRegexp=new RegExp("."+l+"$","i");if(n){f.extend(f.facebox.settings,n)}f("body").append(f.facebox.settings.faceboxHtml);var m=[new Image(),new Image()];m[0].src=f.facebox.settings.closeImage;m[1].src=f.facebox.settings.loadingImage;f("#facebox").find(".b:first, .bl, .br, .tl, .tr").each(function(){m.push(new Image());m.slice(-1).src=f(this).css("background-image").replace(/url\((.+)\)/,"$1")});f("#facebox .close").click(f.facebox.close);f("#facebox .close_image").attr("src",f.facebox.settings.closeImage)}function h(){var m,l;if(self.pageYOffset){l=self.pageYOffset;m=self.pageXOffset}else{if(document.documentElement&&document.documentElement.scrollTop){l=document.documentElement.scrollTop;m=document.documentElement.scrollLeft}else{if(document.body){l=document.body.scrollTop;m=document.body.scrollLeft}}}return new Array(m,l)}function i(){var l;if(self.innerHeight){l=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){l=document.documentElement.clientHeight}else{if(document.body){l=document.body.clientHeight}}}return l}function d(){var l=f.facebox.settings;l.loadingImage=l.loading_image||l.loadingImage;l.closeImage=l.close_image||l.closeImage;l.imageTypes=l.image_types||l.imageTypes;l.faceboxHtml=l.facebox_html||l.faceboxHtml}function j(m,l){if(m.match(/#/)){var o=window.location.href.split("#")[0];var p=m.replace(o,"");var n=f(p).clone().show();n.get(0).id="facebox-"+n.get(0).id;f.facebox.reveal(n,l)}else{if(m.match(f.facebox.settings.imageTypesRegexp)){c(m,l)}else{g(m,l)}}}function c(m,l){var n=new Image();n.onload=function(){f.facebox.reveal('<div class="image"><img src="'+n.src+'" /></div>',l)};n.src=m}function g(m,l){f.get(m,function(n){f.facebox.reveal(n,l)})}function b(){return f.facebox.settings.overlay==false||f.facebox.settings.opacity===null}function e(){if(b()){return}if(f("facebox_overlay").length==0){f("body").append('<div id="facebox_overlay" class="facebox_hide"></div>')}f("#facebox_overlay").hide().addClass("facebox_overlayBG").css("opacity",f.facebox.settings.opacity).click(function(){f(document).trigger("close.facebox")}).fadeIn(200);return false}function a(){if(b()){return}f("#facebox_overlay").fadeOut(200,function(){f("#facebox_overlay").removeClass("facebox_overlayBG");f("#facebox_overlay").addClass("facebox_hide");f("#facebox_overlay").remove()});return false}f(document).bind("close.facebox",function(){f(document).unbind("keydown.facebox");f("#facebox").fadeOut(function(){f("#facebox .content").removeClass().addClass("content");a();f("#facebox .loading").remove()})})})(jQuery);
