﻿var JSON;if(!JSON)JSON={};(function(){"use strict";function c(a){return a<10?"0"+a:a}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+c(this.getUTCMonth()+1)+"-"+c(this.getUTCDate())+"T"+c(this.getUTCHours())+":"+c(this.getUTCMinutes())+":"+c(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()}}var h=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,f=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,a,d,i={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},b;function g(a){f.lastIndex=0;return f.test(a)?'"'+a.replace(f,function(a){var b=i[a];return typeof b==="string"?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function e(m,n){var h,j,i,k,l=a,f,c=n[m];if(c&&typeof c==="object"&&typeof c.toJSON==="function")c=c.toJSON(m);if(typeof b==="function")c=b.call(n,m,c);switch(typeof c){case"string":return g(c);case"number":return isFinite(c)?String(c):"null";case"boolean":case"null":return String(c);case"object":if(!c)return"null";a+=d;f=[];if(Object.prototype.toString.apply(c)==="[object Array]"){k=c.length;for(h=0;h<k;h+=1)f[h]=e(h,c)||"null";i=f.length===0?"[]":a?"[\n"+a+f.join(",\n"+a)+"\n"+l+"]":"["+f.join(",")+"]";a=l;return i}if(b&&typeof b==="object"){k=b.length;for(h=0;h<k;h+=1)if(typeof b[h]==="string"){j=b[h];i=e(j,c);i&&f.push(g(j)+(a?": ":":")+i)}}else for(j in c)if(Object.prototype.hasOwnProperty.call(c,j)){i=e(j,c);i&&f.push(g(j)+(a?": ":":")+i)}i=f.length===0?"{}":a?"{\n"+a+f.join(",\n"+a)+"\n"+l+"}":"{"+f.join(",")+"}";a=l;return i}}if(typeof JSON.stringify!=="function")JSON.stringify=function(h,c,f){var g;a="";d="";if(typeof f==="number")for(g=0;g<f;g+=1)d+=" ";else if(typeof f==="string")d=f;b=c;if(c&&typeof c!=="function"&&(typeof c!=="object"||typeof c.length!=="number"))throw new Error("JSON.stringify");return e("",{"":h})};if(typeof JSON.parse!=="function")JSON.parse=function(a,c){var b;function d(f,g){var b,e,a=f[g];if(a&&typeof a==="object")for(b in a)if(Object.prototype.hasOwnProperty.call(a,b)){e=d(a,b);if(e!==undefined)a[b]=e;else delete a[b]}return c.call(f,g,a)}a=String(a);h.lastIndex=0;if(h.test(a))a=a.replace(h,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)});if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){b=eval("("+a+")");return typeof c==="function"?d({"":b},""):b}throw new SyntaxError("JSON.parse");}})();$(document).ready(function(){$("#loading").ajaxStart(function(){$(this).show()}).ajaxStop(function(){$(this).hide()})});(function(a){a.modal={defaults:{width:500,height:"auto",margin:20,appendTo:"body",cls:"default-modal",closeCls:"close-modal",contentCls:"modal-body",css:{position:"absolute",display:"block",zIndex:101},overlayCls:"default-overlay",overlayCss:{position:"fixed",zIndex:100,background:"#000000",opacity:.6,top:0,left:0},template:null,data:null,animateDuration:25,useMousePosition:false,autoResize:true,autoCenter:true,autoCenterX:true,autoCenterY:true,offset:{x:0,y:0},position:null,autoFocus:true,closeOnOverlayClick:false,closeOnEsc:true,onBeforeShow:a.noop,onShow:a.noop,onBeforeHide:a.noop,onHide:a.noop,onBeforeClose:a.noop,onClose:a.noop},mouseTrackingKey:"modal.mouseXY",instanceKey:"modal.instance",eventKeys:{beforeShow:"modal.onBeforeShow",show:"modal.onShow",beforeHide:"modal.onBeforeHide",hide:"modal.onHide",beforeClose:"modal.onBeforeClose",close:"modal.onClose"}};a.modal.instance=function(H,E){var i,k,h,c,x,g,J,v,t,b,I={},j,e,d,G=function(){a.mouseTracker.capture(a.modal.mouseTrackingKey);b=a.extend(true,b,a.modal.defaults,E);b.maxWidth=b.maxWidth||b.width;b.contentCls=b.contentCls||b.cls;if(b.autoCenter)b.autoCenterX=b.autoCenterY=true;D();C();c.data(a.modal.instanceKey,f());A()},f=function(){return{show:A,hide:z,close:n,refresh:m,overlay:j,elements:{modal:c,content:h,overlay:g}}},D=function(){i=a(window);k=a("body");d=w();h=a(H);v=h.parent();t=h.clone(true);$placeholder=a(b.appendTo||k);c=a("<div/>",{id:b.id||b.containerId||["modal",Math.floor(Math.random()*100)].join("-"),"data-modal":true,"class":b.cls,css:b.css}).hide();if(b.template){x=a(b.template).tmpl(b.data);c.append(x)}if(b.contentCls)c.find("."+b.contentCls).append(h);else c.append(h);h.css("display","block");$placeholder.append(c);b.width&&c.width(b.width);b.height&&c.height(b.height);e=l();j=a.modal.overlay||new F},C=function(){s();i.bind({resize:r,keypress:q});b.closeOnOverlayClick&&g.click(y);c.delegate("."+b.closeCls,"click",y);c.bind(a.modal.eventKeys.beforeShow,b.onBeforeShow);c.bind(a.modal.eventKeys.show,b.onShow);c.bind(a.modal.eventKeys.beforeHide,b.onBeforeHide);c.bind(a.modal.eventKeys.hide,b.onHide);c.bind(a.modal.eventKeys.beforeClose,b.onBeforeClose);c.bind(a.modal.eventKeys.close,b.onClose)},s=function(){i.unbind({resize:r,keypress:q})},F=function(){var h=function(){e()},e=function(){g=a("<div/>",{"class":b.overlayCls,css:b.overlayCss}).hide();k.append(g)},f=function(){g.width(d.fullWidth).height(d.fullHeight)},c=function(){return{show:j,hide:i,refresh:f}},j=function(a){g.fadeIn(b.animateDuration,a)},i=function(a){g.fadeOut(b.animateDuration,a)};h();return c()},u=function(){e=l();var a={};if(b.position){if(!b.autoCenterX)a.left=b.position.x;if(!b.autoCenterY)a.top=b.position.y;a=p(b.position.x,b.position.y)}else if(b.useMousePosition)a=B(b.useMousePosition);else a=o();a.left=Math.max(a.left,b.margin||20);a.top=Math.max(a.top,b.margin||20);var c=d.scrollTop-a.top;if(c<b.margin)a.top+=Math.min(Math.abs(b.margin-c),20);return a},B=function(c){var d=a.mouseTracker.history(a.modal.mouseTrackingKey),e=p(d.x,d.y);if(a.isPlainObject(c)){if(!b.autoCenterX&&c.x!=null)e.left=(d.x||0)-c.x;if(!b.autoCenterY&&c.y!=null)e.top=(d.y||0)-c.y}return e},o=function(){return{left:(d.width-e.width)/2,top:Math.max(d.height-e.height,0)/2+d.scrollTop}},p=function(c,d){var a=o();if(!b.autoCenterX&&c)a.left=c-e.width/2;if(!b.autoCenterY&&d)a.top=d-e.height/2;return a},r=function(){m()},q=function(a){var c=a.keyCode?a.keyCode:a.which;c=="27"&&b.closeOnEsc&&n()},y=function(){n();return false},w=function(c){var b=i.width(),a=i.height();return d&&!c?d:{width:b,height:a,maxHeight:a*.95,maxWidth:b,scrollTop:i.scrollTop(),fullHeight:Math.max(k.height(),a),fullWidth:Math.max(k.width(),b)}},l=function(a){return e&&!a?e:c.getDimensions()},m=function(){d=w(true);e=l(true);j.refresh();c.css(u())},A=function(g){a.mouseTracker.stop();m();if(e.height>d.maxHeight&&b.autoResize)c.height(d.maxHeight);else c.height(b.height||"auto");if(e.width>d.maxWidth&&b.autoResize)c.width(d.maxWidth);else c.width(b.width||"auto");c.triggerHandler(a.modal.eventKeys.beforeShow,f())!==false&&j.show(function(){c.fadeIn(b.animateDuration,g);c.css(u());b.autoFocus&&c.find("form :input:first").focus();c.triggerHandler(a.modal.eventKeys.show,f())})},z=function(d){a.mouseTracker.start();c.triggerHandler(a.modal.eventKeys.beforeHide,f())!==false&&c.fadeOut(b.animateDuration,function(){j.hide(d);c.triggerHandler(a.modal.eventKeys.hide,f())})},n=function(){c.triggerHandler(a.modal.eventKeys.beforeClose,f())!==false&&z(function(){s();v.append(t);c.triggerHandler(a.modal.eventKeys.close,f());c.remove();g.remove()})};G();return f()};a.mouseTracker=function(){var c={},d=function(a){b.position={x:a.pageX,y:a.pageY}},b={tracking:false,position:null,history:function(a){return c[a]},capture:function(a){c[a]=this.position},start:function(){this.tracking=true;a(document).bind("mousemove",d)},stop:function(){this.tracking=false;a(document).unbind("mousemove",d)}};b.start();return b}();a.modal.getInstance=function(b){return a(b).data(a.modal.instanceKey)};a.modal.close=function(){a("div[data-modal]").each(function(){var b=a.modal.getInstance(this);if(b)a.isFunction(b.close)&&b.close()})};a.modal.refresh=function(){a("div[data-modal]").each(function(){var b=a.modal.getInstance(this);if(b)a.isFunction(b.refresh)&&b.refresh()})};a.fn.modal=function(b){return new a.modal.instance(this,b)};a.fn.getDimensions=function(){var b=a(this),c={left:b.css("left"),display:b.css("display"),position:b.css("position")};b.css({position:"absolute",left:"-2000px",display:"block"});var d={width:b.outerWidth(),height:b.outerHeight()};b.css(c);return d}})(jQuery);(function(a){var b=a.site=function(){var f={},b={},m=function(){j();i()},j=function(){a("a.chat-link").click(function(d){d.preventDefault();var c=a(this).attr("href");if(b.chat&&!b.chat.closed)b.chat.focus();else b.chat=window.open(c,"ChatWindow","height=300,width=400,toolbar=0,menubar=0,location=0,status=0",true)});a("a[data-modal], button[data-modal]").live("click",h);g();a("input[data-type='currency']").blur(function(){var b=a(this),d=c(b.val());if(isNaN(d))b.val(c(0)).change();else b.val(d)})},i=function(){a("a[data-confirm], button[data-confirm]").click(d);a("form[data-confirm]").submit(d)},e=function(){return a.extend({debug:l,extend:k,formatCurrency:c,buttonize:g},f)},g=function(b){if(a.fn.button){b=b||"button.button, a.button";a(b).each(function(){var b=a(this),c=b.attr("data-icon")||"";if(!b.is(".ui-button"))if(a.string.empty(c))b.button();else b.button({text:a.string.empty(b.attr("data-icon-only")),icons:{primary:c}})})}},l=function(a){if(window.console)console.log(a);else alert(a)},k=function(c,b){f[c]=b;a.site=e()},c=function(c){if(a.parseFloat){var b=a.format(a.parseFloat(c),"n2");return b!=NaN.toString()+".00"?b:c}else{var b=c.replace(/[^0-9\-\.]+/i,"");return isNaN(b)?"0.00":parseFloat(b).toFixed(2)}},d=function(){var b=a(this).attr("data-confirm")||"Are you sure?";return confirm(b)},h=function(e){e.preventDefault();var c=a(this),d=c.data("modal"),b=c.data("modal-options")||{};if(typeof b=="string")b=a.parseJSON(b);var f=a.site.modal(c.attr("title")||"New Collect Page",d,b)};a(m);return e()}();a.site.extend("generateGuid",function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(b){var a=Math.random()*16|0,c=b=="x"?a:a&3|8;return c.toString(16)})});a.site.extend("openNewCollectPageModal",function(){a.site.modal("Setup a New Collect Money Page","#new-collect-page-mode-template",{width:600})});a.site.extend("modal",function(f,g,d){var b=a.extend(true,b,{maxWidth:960,template:"#DefaultModalTemplate",closeCls:"modalClose",data:{Title:f}},d),c=window.location!=window.parent.location?true:false;if(c)b=a.extend(true,b,{autoCenter:false,autoCenterX:true,autoCenterY:false,useMousePosition:{y:400}});var e=a(g).modal(b);return e})})(jQuery);$.fn.fixed=function(b){var a=$.extend({cls:""},b);return this.each(function(){var c=$(this),f=c.offset(),g=c.width(),b=$("<div></div>").append(c.clone(true));b.width(g);b.addClass(a.cls);b.hide().appendTo(document.body).addClass("fixed-toolbar");d($(this,true));$(window).scroll(function(){d($(this,true))});$(window).resize(function(){d($(this,false))});var e=false;function d(g,d){var h=$(g).scrollTop();if(h>f.top){if(!d||e==false){c.css("visibility","hidden");var a=($(window).width()-b.width())/2;b.show().css("left",a>0?a:0);e=true}}else{b.hide();c.css("visibility","visible");e=false}}})};$.string={format:function(d){var c=String(d),a=arguments;Array.prototype.splice.call(a,0,1);var b=new RegExp("{([0-"+arguments.length+"])}","g");return c.replace(b,function(c,b){return a[b]})},empty:function(a){return!(a!=null&&a.length>0)}};$.date={getCurrent:function(){return new Date},parse:function(c,a){a=a||"%Y-%m-%d %l:%i %p";var b=new AnyTime.Converter({format:a});return b.parse(c)},format:function(a,b){b=b||"%M %D at  %l:%i %p";if(!(a instanceof Date))a=this.parse(a);var c=new AnyTime.Converter({format:b});return c.format(a)}};$.list={where:function(b,c){var a=[];$.each(b,function(){c.apply(this,[this])!==false&&a.push(this)});return a},findBy:function(a,b,d){var c=this.findIndexBy(a,b,d);return a[c]},findIndexBy:function(b,d,a){for(var c in b){var e=b[c];if(e[d]==a&&a!=null)return c}return-1},removeBy:function(b,c,d){var a=this.findIndexBy(b,c,d);if(a=-1)return false;b.splice(a,1);return true},remove:function(b,a){b.splice(a,1)},reorderBy:function(b,a,d){if($.isArray(b)){b.sort(function(b,c){return b[a]-c[a]});if(d)b=$.map(b,function(b,c){b[a]=c+1;return b});else{var c=0;b=$.map(b,function(b){if(!b[a])b[a]=c+1;if(b[a]>c)c=b[a];return b})}}return b},moveBy:function(b,c,f,a){a=Math.max(1,a);a=Math.min(a,b.length);var e=this.findIndexBy(b,c,f),d=this.findIndexBy(b,c,a);if(d>=0)b[d][c]=f;if(e>=0)b[e][c]=a},index:function(b,a){a=a||"Index";if($.isArray(b))b=$.map(b,function(b,c){b[a]=c;return b})}};$.list.tmpl={getIndex:function(a,b){return $.inArray(a,b)},getAlternateCls:function(b,c,d){var a=this.getIndex(b,c);return a%2!=0?d||"alt":""}}
