/*
	Masked Input plugin for jQuery
	Copyright (c) 2007-2009 Josh Bush (digitalbush.com)
	Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license) 
	Version: 1.2.2 (03/09/2009 22:39:06)
*/
(function(a){var c=(a.browser.msie?"paste":"input")+".mask";var b=(window.orientation!=undefined);a.mask={definitions:{"9":"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"}};a.fn.extend({caret:function(e,f){if(this.length==0){return}if(typeof e=="number"){f=(typeof f=="number")?f:e;return this.each(function(){if(this.setSelectionRange){this.focus();this.setSelectionRange(e,f)}else{if(this.createTextRange){var g=this.createTextRange();g.collapse(true);g.moveEnd("character",f);g.moveStart("character",e);g.select()}}})}else{if(this[0].setSelectionRange){e=this[0].selectionStart;f=this[0].selectionEnd}else{if(document.selection&&document.selection.createRange){var d=document.selection.createRange();e=0-d.duplicate().moveStart("character",-100000);f=e+d.text.length}}return{begin:e,end:f}}},unmask:function(){return this.trigger("unmask")},mask:function(j,d){if(!j&&this.length>0){var f=a(this[0]);var g=f.data("tests");return a.map(f.data("buffer"),function(l,m){return g[m]?l:null}).join("")}d=a.extend({placeholder:"_",completed:null},d);var k=a.mask.definitions;var g=[];var e=j.length;var i=null;var h=j.length;a.each(j.split(""),function(m,l){if(l=="?"){h--;e=m}else{if(k[l]){g.push(new RegExp(k[l]));if(i==null){i=g.length-1}}else{g.push(null)}}});return this.each(function(){var r=a(this);var m=a.map(j.split(""),function(x,y){if(x!="?"){return k[x]?d.placeholder:x}});var n=false;var q=r.val();r.data("buffer",m).data("tests",g);function v(x){while(++x<=h&&!g[x]){}return x}function t(x){while(!g[x]&&--x>=0){}for(var y=x;y<h;y++){if(g[y]){m[y]=d.placeholder;var z=v(y);if(z<h&&g[y].test(m[z])){m[y]=m[z]}else{break}}}s();r.caret(Math.max(i,x))}function u(y){for(var A=y,z=d.placeholder;A<h;A++){if(g[A]){var B=v(A);var x=m[A];m[A]=z;if(B<h&&g[B].test(x)){z=x}else{break}}}}function l(y){var x=a(this).caret();var z=y.keyCode;n=(z<16||(z>16&&z<32)||(z>32&&z<41));if((x.begin-x.end)!=0&&(!n||z==8||z==46)){w(x.begin,x.end)}if(z==8||z==46||(b&&z==127)){t(x.begin+(z==46?0:-1));return false}else{if(z==27){r.val(q);r.caret(0,p());return false}}}function o(B){if(n){n=false;return(B.keyCode==8)?false:null}B=B||window.event;var C=B.charCode||B.keyCode||B.which;var z=a(this).caret();if(B.ctrlKey||B.altKey||B.metaKey){return true}else{if((C>=32&&C<=125)||C>186){var x=v(z.begin-1);if(x<h){var A=String.fromCharCode(C);if(g[x].test(A)){u(x);m[x]=A;s();var y=v(x);a(this).caret(y);if(d.completed&&y==h){d.completed.call(r)}}}}}return false}function w(x,y){for(var z=x;z<y&&z<h;z++){if(g[z]){m[z]=d.placeholder}}}function s(){return r.val(m.join("")).val()}function p(y){var z=r.val();var C=-1;for(var B=0,x=0;B<h;B++){if(g[B]){m[B]=d.placeholder;while(x++<z.length){var A=z.charAt(x-1);if(g[B].test(A)){m[B]=A;C=B;break}}if(x>z.length){break}}else{if(m[B]==z[x]&&B!=e){x++;C=B}}}if(!y&&C+1<e){r.val("");w(0,h)}else{if(y||C+1>=e){s();if(!y){r.val(r.val().substring(0,C+1))}}}return(e?B:i)}if(!r.attr("readonly")){r.one("unmask",function(){r.unbind(".mask").removeData("buffer").removeData("tests")}).bind("focus.mask",function(){q=r.val();var x=p();s();setTimeout(function(){if(x==j.length){r.caret(0,x)}else{r.caret(x)}},0)}).bind("blur.mask",function(){p();if(r.val()!=q){r.change()}}).bind("keydown.mask",l).bind("keypress.mask",o).bind(c,function(){setTimeout(function(){r.caret(p(true))},0)})}p()})}})})(jQuery);jQuery.pushup={Version:"1.0.0",options:{appearDelay:0.5,fadeDelay:6,images:"../images/pushup/",message:"Important browser update available",reminder:{hours:6,message:"Remind me again in #{hours}"}},updateLinks:{IE:"http://www.microsoft.com/windows/downloads/ie/",Firefox:"http://www.getfirefox.com",Safari:"http://www.apple.com/safari/download/",Opera:"http://www.opera.com/download/"},browsVer:{Firefox:(navigator.userAgent.indexOf("Firefox")>-1)?parseFloat(navigator.userAgent.match(/Firefox[\/\s](\d+)/)[1]):false,IE:(jQuery.browser.msie)?parseFloat(jQuery.browser.version):false,Safari:(jQuery.browser.safari)?parseFloat(jQuery.browser.version):false,Opera:(jQuery.browser.opera)?parseFloat(jQuery.browser.version):false},browsers:{Firefox:3,IE:8,Opera:10,Safari:4},init:function(){jQuery.each(jQuery.pushup.browsVer,function(a,b){if(b&&b<jQuery.pushup.browsers[a]){if(!jQuery.pushup.options.ignoreReminder&&jQuery.pushup.cookiesEnabled&&Cookie.get("_pushupBlocked")){return}else{time=(jQuery.pushup.options.appearDelay!=undefined)?jQuery.pushup.options.appearDelay*1000:0;setTimeout("jQuery.pushup.show(jQuery.pushup.browserUsed)",time)}}})},show:function(){browser=typeof arguments[0]=="string"?arguments[0]:jQuery.pushup.browserUsed||"IE";elm=document.createElement("div");elm.style.display="none";elm.id="pushup";jQuery("body").prepend(elm);icon=jQuery(document.createElement("div")).addClass("pushup_icon");c=jQuery(document.createElement("span")).addClass("pushup_message");messagelink=jQuery(document.createElement("a")).addClass("pushup_messageLink").attr("target","_blank").append(icon).append(c);jQuery("#pushup").append(messagelink);jQuery(".pushup_message").html(jQuery.pushup.options.message);var a=jQuery.pushup.options.reminder.hours;if(a&&jQuery.pushup.cookiesEnabled){var b=a+" hour"+(a>1?"s":""),c=jQuery.pushup.options.reminder.message.replace("#{hours}",b);hourelem=jQuery(document.createElement("a")).attr("href","#").addClass("pushup_reminder").html(c);jQuery("#pushup").append(hourelem);jQuery(".pushup_reminder").click(function(){jQuery.pushup.setReminder(jQuery.pushup.options.reminder.hours);jQuery.pushup.hide();return false})}if(/^http\:\/\//.test(jQuery.pushup.options.images)){imgSrc=jQuery.pushup.options.images}else{jQuery("script[src]").each(function(d,e){if(/jquery\.pushup/.test(jQuery(e).attr("src"))){srcFol=jQuery(e).attr("src").replace("jquery.pushup.js","");imgSrc=srcFol+jQuery.pushup.options.images}})}styles=(jQuery.pushup.browsVer.IE<7&&jQuery.pushup.browsVer.IE)?{filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+imgSrc+browser.toLowerCase()+".png'', sizingMethod='crop')"}:{background:"url("+imgSrc+browser.toLowerCase()+".png) no-repeat top left"};jQuery(".pushup_icon").css(styles);jQuery("#pushup").fadeIn("slow");if(jQuery.pushup.options.fadeDelay!=undefined){time=jQuery.pushup.options.fadeDelay*1000;setTimeout("jQuery.pushup.hide()",time)}},hide:function(){jQuery("#pushup").fadeOut("slow")},setReminder:function(a){Cookie.set("_pushupBlocked","blocked",{duration:1/24*a})},resetReminder:function(){Cookie.remove("_pushupBlocked")}};jQuery.each(jQuery.pushup.browsVer,function(a,b){if(b){jQuery.pushup.browserUsed=a}});var Cookie={set:function(d,e){var a="",c=arguments[2]||{};if(c.duration){var b=new Date();b.setTime(b.getTime()+c.duration*1000*60*60*24);e+="; expires="+b.toGMTString()}document.cookie=d+"="+e+a+"; path=/"},remove:function(a){this.set(a,"",-1)},get:function(b){var e=document.cookie.split(";"),f=b+"=";for(var d=0,a=e.length;d<a;d++){var g=e[d];while(g.charAt(0)==" "){g=g.substring(1,g.length)}if(g.indexOf(f)==0){return g.substring(f.length,g.length)}}return null}};jQuery.pushup.cookiesEnabled=(function(a){if(Cookie.get(a)){return true}Cookie.set(a,"test",{duration:15});return Cookie.get(a)})("_pushupCookiesEnabled");jQuery(function(){jQuery.pushup.init()});if(top.location==self.location){$(document).ready(function(){$("body").append('<div id="lb_container" class="hide"><div id="lightbox" class="hide"><iframe src="/welcome/blank" id="gallery_frame" name="gallery_frame" scrolling="auto" frameborder="0" class="hide"></iframe><img src="#" alt="" class="hide" id="lbImage"/><a id="close" href="/close"><img src="/images/icons/close.png" alt="close" width="48" height="45" /></a></div></div>')});$("a.lightbox, a.gallery, a.photo").live("click",function(){imgTypes=["png","jpg","jpeg","gif"];$src=$(this).attr("href");$("#lb_container").fadeIn();$("html").addClass("lb_gal");$top=$(this).offset().top;if($(this).attr("rel")){$d=$(this).attr("rel").split(",");$width=$d[0];$height=$d[1]}else{$height=600;$width=940}imgRegExp=imgTypes.join("|");imgRegExp=new RegExp("."+imgRegExp+"$","i");$fTop=Math.round(($(window).height()-$height-60)/2);if($src.match(imgRegExp)){$("#lbImage").attr("src",$src).load(function(){var a=new Image();a.src=$src;$height=a.height;$width=a.width;$("#lbImage, #lightbox").show();$("#lightbox").css({marginTop:$top}).animate({marginTop:$fTop,width:$width,height:$height},200)})}else{if($src.search(/#/i)!=-1){url_split=$src.split("#");hash="#"+url_split[1];url=url_split[0]}else{hash="";url=$src}$("#gallery_frame").attr({src:url+"?lb"+hash});$("#gallery_frame, #lightbox").show();$("#gallery_frame").attr({style:"display:inline; width: "+$width+"px; height: "+$height+"px"});$("#lightbox").css({marginTop:$top}).animate({marginTop:$fTop,width:$width,height:$height},200)}lb=true;return false});function close_lb(){$("#lightbox").animate({marginTop:$top,width:10,height:10},200,function(){$("#lightbox, #gallery_frame, #lbImage").hide()});$("#lb_container").fadeOut(function(){$("html").removeClass("lb_gal")});$("#gallery_frame").attr({src:"/welcome/blank"});lb=false}$("#lb_container, #close").live("click",function(){close_lb();return false});function invoke_lb(b,c,a){$("body").append('<a id="ad_lb" class="lightbox" style="display:none;" rel="'+c+","+a+'" href="'+b+'"></a>');$("#ad_lb").trigger("click")}}$(document).keydown(function(a){switch(a.keyCode){case 27:top.close_lb();break}});$("#vote a.button").hover(function(){$(this).children("img").attr("src","/images/layout/vote_check.jpg")},function(){$(this).children("img").attr("src","/images/layout/vote.jpg")});$("#vote a.button").click(function(){$("#vote a.button").fadeOut("500");$current=this;$.ajax({url:$(this).attr("href"),success:function(){$($current).replaceWith('<div class="button" style="display:none"><img src="/images/layout/vote_check.jpg" alt="Vote" />Thanks for Voting</div>');$("#vote a.button").remove();$(".button").fadeIn("500")}});return false});$("#vote li").hover(function(){$(this).children(".share").fadeIn()},function(){$(this).children(".share").fadeOut()});$(".download").click(function(){_gaq.push(["_trackEvent","Download","File",$(this).attr("href")])});jQuery(function(a){a("#dob").mask("99/99/9999")});$("#region").change(function(){if($(this).find(":selected").parent().attr("label")=="Provinces"){$("#countries").val("CA")}else{if($(this).find(":selected").parent().attr("label")=="States"){$("#countries").val("US")}}});
