/**
 * jQuery.ScrollTo - Easy element scrolling using jQuery.
 * Copyright (c) 2007-2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 9/11/2008
 * @author Ariel Flesler
 * @version 1.4
 *
 * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
 */
;(function(h){var m=h.scrollTo=function(b,c,g){h(window).scrollTo(b,c,g)};m.defaults={axis:'y',duration:1};m.window=function(b){return h(window).scrollable()};h.fn.scrollable=function(){return this.map(function(){var b=this.parentWindow||this.defaultView,c=this.nodeName=='#document'?b.frameElement||b:this,g=c.contentDocument||(c.contentWindow||c).document,i=c.setInterval;return c.nodeName=='IFRAME'||i&&h.browser.safari?g.body:i?g.documentElement:this})};h.fn.scrollTo=function(r,j,a){if(typeof j=='object'){a=j;j=0}if(typeof a=='function')a={onAfter:a};a=h.extend({},m.defaults,a);j=j||a.speed||a.duration;a.queue=a.queue&&a.axis.length>1;if(a.queue)j/=2;a.offset=n(a.offset);a.over=n(a.over);return this.scrollable().each(function(){var k=this,o=h(k),d=r,l,e={},p=o.is('html,body');switch(typeof d){case'number':case'string':if(/^([+-]=)?\d+(px)?$/.test(d)){d=n(d);break}d=h(d,this);case'object':if(d.is||d.style)l=(d=h(d)).offset()}h.each(a.axis.split(''),function(b,c){var g=c=='x'?'Left':'Top',i=g.toLowerCase(),f='scroll'+g,s=k[f],t=c=='x'?'Width':'Height',v=t.toLowerCase();if(l){e[f]=l[i]+(p?0:s-o.offset()[i]);if(a.margin){e[f]-=parseInt(d.css('margin'+g))||0;e[f]-=parseInt(d.css('border'+g+'Width'))||0}e[f]+=a.offset[i]||0;if(a.over[i])e[f]+=d[v]()*a.over[i]}else e[f]=d[i];if(/^\d+$/.test(e[f]))e[f]=e[f]<=0?0:Math.min(e[f],u(t));if(!b&&a.queue){if(s!=e[f])q(a.onAfterFirst);delete e[f]}});q(a.onAfter);function q(b){o.animate(e,j,a.easing,b&&function(){b.call(this,r,a)})};function u(b){var c='scroll'+b,g=k.ownerDocument;return p?Math.max(g.documentElement[c],g.body[c]):k[c]}}).end()};function n(b){return typeof b=='object'?b:{top:b,left:b}}})(jQuery);

/**
 * jQuery.LocalScroll - Animated scrolling navigation, using anchors.
 * Copyright (c) 2007-2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 6/3/2008
 * @author Ariel Flesler
 * @version 1.2.6
 **/
;(function($){var g=location.href.replace(/#.*/,''),h=$.localScroll=function(a){$('body').localScroll(a)};h.defaults={duration:1e3,axis:'y',event:'click',stop:1};h.hash=function(a){a=$.extend({},h.defaults,a);a.hash=0;if(location.hash)setTimeout(function(){i(0,location,a)},0)};$.fn.localScroll=function(b){b=$.extend({},h.defaults,b);return(b.persistent||b.lazy)?this.bind(b.event,function(e){var a=$([e.target,e.target.parentNode]).filter(c)[0];a&&i(e,a,b)}):this.find('a,area').filter(c).bind(b.event,function(e){i(e,this,b)}).end().end();function c(){var a=this;return!!a.href&&!!a.hash&&a.href.replace(a.hash,'')==g&&(!b.filter||$(a).is(b.filter))}};function i(e,a,b){var c=a.hash.slice(1),d=document.getElementById(c)||document.getElementsByName(c)[0],f;if(d){e&&e.preventDefault();f=$(b.target||$.scrollTo.window());if(b.lock&&f.is(':animated')||b.onBefore&&b.onBefore.call(a,e,d,f)===!1)return;if(b.stop)f.queue('fx',[]).stop();f.scrollTo(d,b).trigger('notify.serialScroll',[d]);if(b.hash)f.queue(function(){location=a.hash;$(this).dequeue()})}}})(jQuery);

/**
 * jQuery[a] - Animated scrolling of series
 * Copyright (c) 2007-2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 3/20/2008
 * @author Ariel Flesler
 * @version 1.2.1
 *
 * http://flesler.blogspot.com/2008/02/jqueryserialscroll.html
 */
;(function($){var a='serialScroll',b='.'+a,c='bind',C=$[a]=function(b){$.scrollTo.window()[a](b)};C.defaults={duration:1e3,axis:'x',event:'click',start:0,step:1,lock:1,cycle:1,constant:1};$.fn[a]=function(y){y=$.extend({},C.defaults,y);var z=y.event,A=y.step,B=y.lazy;return this.each(function(){var j=y.target?this:document,k=$(y.target||this,j),l=k[0],m=y.items,o=y.start,p=y.interval,q=y.navigation,r;if(!B)m=w();if(y.force)t({},o);$(y.prev||[],j)[c](z,-A,s);$(y.next||[],j)[c](z,A,s);if(!l.ssbound)k[c]('prev'+b,-A,s)[c]('next'+b,A,s)[c]('goto'+b,t);if(p)k[c]('start'+b,function(e){if(!p){v();p=1;u()}})[c]('stop'+b,function(){v();p=0});k[c]('notify'+b,function(e,a){var i=x(a);if(i>-1)o=i});l.ssbound=1;if(y.jump)(B?k:w())[c](z,function(e){t(e,x(e.target))});if(q)q=$(q,j)[c](z,function(e){e.data=Math.round(w().length/q.length)*q.index(this);t(e,this)});function s(e){e.data+=o;t(e,this)};function t(e,a){if(!isNaN(a)){e.data=a;a=l}var c=e.data,n,d=e.type,f=y.exclude?w().slice(0,-y.exclude):w(),g=f.length,h=f[c],i=y.duration;if(d)e.preventDefault();if(p){v();r=setTimeout(u,y.interval)}if(!h){n=c<0?0:n=g-1;if(o!=n)c=n;else if(!y.cycle)return;else c=g-n-1;h=f[c]}if(!h||d&&o==c||y.lock&&k.is(':animated')||d&&y.onBefore&&y.onBefore.call(a,e,h,k,w(),c)===!1)return;if(y.stop)k.queue('fx',[]).stop();if(y.constant)i=Math.abs(i/A*(o-c));k.scrollTo(h,i,y).trigger('notify'+b,[c])};function u(){k.trigger('next'+b)};function v(){clearTimeout(r)};function w(){return $(m,l)};function x(a){if(!isNaN(a))return a;var b=w(),i;while((i=b.index(a))==-1&&a!=l)a=a.parentNode;return i}})}})(jQuery);

(function($){$.fn.TextAreaExpander=function(minHeight,maxHeight){var hCheck=!($.browser.msie||$.browser.opera);function ResizeTextarea(e){e=e.target||e;var vlen=e.value.length,ewidth=e.offsetWidth;if(vlen!=e.valLength||ewidth!=e.boxWidth){if(hCheck&&(vlen<e.valLength||ewidth!=e.boxWidth))e.style.height="0px";var h=Math.max(e.expandMin,Math.min(e.scrollHeight,e.expandMax));e.style.overflow=(e.scrollHeight>h?"auto":"hidden");e.style.height=h+"px";e.valLength=vlen;e.boxWidth=ewidth}return true};this.each(function(){if(this.nodeName.toLowerCase()!="textarea")return;var p=this.className.match(/expand(\d+)\-*(\d+)*/i);this.expandMin=minHeight||(p?parseInt('0'+p[1],10):0);this.expandMax=maxHeight||(p?parseInt('0'+p[2],10):99999);ResizeTextarea(this);if(!this.Initialized){this.Initialized=true;$(this).css("padding-top",0).css("padding-bottom",0);$(this).bind("keyup",ResizeTextarea).bind("focus",ResizeTextarea)}});return this}})(jQuery);


// Squares based in part on code from http://squaredesign.com/.

jQuery.jQueryRandom = 0;
jQuery.extend(jQuery.expr[":"],
{
    random: function(a, i, m, r) {
        if (i == 0) {
            jQuery.jQueryRandom = Math.floor(Math.random() * r.length);
        };
        return i == jQuery.jQueryRandom;
    }
});

jQuery(window).bind("resize", resizeWindow);
var small_squares;

function resizeWindow( e ) {
	var total = 0;
	jQuery('#menu ol').children().each(function(){total += jQuery(this).outerWidth();})
	jQuery(".box1").width((jQuery(document).width()-total-12)/2+'px');

	jQuery(".box2").width((jQuery(document).width()-total-12)/2+'px');

	var total =  Math.floor(((jQuery(document).width()-total))/1.5)
	var actual = jQuery(".box1 .small-squares").length;

	if(total > actual)
		addboxes(total-actual);

	if(total < actual){
		jQuery(".small-squares").remove();
		addboxes(total);
	}

	small_squares = jQuery('#navigation .small-squares');
}

function addboxes(number){
	var divs = '';
	var randclass = '';
	for(x=0; x<(number); x++) {
		if(Math.round(Math.random()) ==  1){
			randclass = Math.ceil(Math.random()*3)
			divs += "<div class='small-squares squares-light"+randclass+"'></div>";
		}else{
			divs += "<div class='small-squares'></div>";
		}
	}

	jQuery(".box2").append(divs);
	jQuery(".box1").append(divs);

	for(x=0; x<(number/5); x++) { //Add a few extra random ones so the sides don't match.
		jQuery("box2.small-squares:random").addClass("squares-light")
	}
}
function do_footer_squares(){
//Footer has a basically static width so we only do this once.
	var divs = '';

	for(x=0; x<(150); x++) {
		divs += "<div class='squares'></div>";
	}

	jQuery("#footright").append(divs);

	var the_squares = jQuery('#footer .squares');

	jQuery("#footer").mousemove(function(e) {
		pick = Math.round(the_squares.length * Math.random());
		jQuery(the_squares[pick]).toggleClass("squares-light");
	});


}

function do_squares(){

	var total = 0;
	jQuery('#menu ol').children().each(function(){total += jQuery(this).outerWidth();})
	//jQuery('#menu ol').width(total);

	jQuery("<div>")
		.clone(false)
		.appendTo("#navigation")
		.addClass("box1").width((jQuery(document).width()-total)/2 - 10 +'px');
	jQuery("<div>")
		.clone(false)
		.appendTo("#navigation")
		.addClass("box2").width((jQuery(document).width()-total)/2 +5 +'px');

	var number = Math.floor((jQuery(document).width()-total)/1.5);
	addboxes(number);


	small_squares = jQuery('#navigation .small-squares');

	jQuery("#navigation").mousemove(function(e) {
		pick = Math.round(small_squares.length * Math.random());
		jQuery(small_squares[pick]).toggleClass("squares-light");
	});

}



eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(5($){$.2u.4=5(j){j=1F.2v({1G:\'#2w\',1H:0.8,1a:H,1I:16+\'/2x-I-2y-I.1J\',1q:16+\'/2z.1r\',1s:16+\'/2A.1r\',1K:16+\'/2B-2C.1r\',1b:16+\'/2D-2E.1J\',1c:10,1L:2F,1M:\'1d\',1N:\'2G\',1O:\'c\',1P:\'p\',1Q:\'n\',s:[],7:0},j);o k=J;5 1R(){1S(J,k);A H}5 1S(a,b){$(\'1T, 1U, 1V\').t({\'1W\':\'2H\'});1X();j.s.D=0;j.7=0;o c=\'\';6(b.D==1){6($(a).1e(\'.4-1f\').1g(\'.4-K\').T()){c=$(a).1e(\'.4-1f\').1g(\'.4-K\').T()}q{c=a.17(\'1Y\')}j.s.1Z(B 1h(a.17(\'L\'),c))}q{2I(o i=0;i<b.D;i++){6($(b[i]).1e(\'.4-1f\').1g(\'.4-K\').T()){c=$(b[i]).1e(\'.4-1f\').1g(\'.4-K\').T()}q{c=b[i].17(\'1Y\')}j.s.1Z(B 1h(b[i].17(\'L\'),c))}}20(j.s[j.7][0]!=a.17(\'L\')){j.7++}E()}5 1X(){$(\'v\').2J(\'<m r="4-U"></m><m r="18-4"><m r="4-w-9-C"><m r="4-w-9"><1t r="4-9"><m 2K="" r="4-u"><a L="#" r="4-u-V"></a><a L="#" r="4-u-W"></a></m><m r="4-I"><a L="#" r="4-I-21"><1t X="\'+j.1I+\'"></a></m></m></m><m r="4-w-9-Y-C"><m r="4-w-9-Y"><m r="4-9-F"><1i r="4-9-F-K"></1i><1i r="4-9-F-1j"></1i></m><m r="4-1u"><a L="#" r="4-1u-22"><1t X="\'+j.1K+\'"></a></m></m></m></m>\');o c=1v();$(\'#4-U\').t({2L:j.1G,2M:j.1H,Z:c[0],11:c[1]}).23();o d=1w();$(\'#18-4\').t({24:d[1]+(c[3]/10),1k:d[0]}).M();$(\'#4-U,#18-4\').G(5(){1l()});$(\'#4-I-21,#4-1u-22\').G(5(){1l();A H});$(N).2N(5(){o a=1v();$(\'#4-U\').t({Z:a[0],11:a[1]});o b=1w();$(\'#18-4\').t({24:b[1]+(a[3]/10),1k:b[0]})})}5 E(){$(\'#4-I\').M();6(j.1a){$(\'#4-9,#4-w-9-Y-C,#4-9-F-1j\').1m()}q{$(\'#4-9,#4-u,#4-u-V,#4-u-W,#4-w-9-Y-C,#4-9-F-1j\').1m()}o a=B 1d();a.25=5(){$(\'#4-9\').2O(\'X\',j.s[j.7][0]);26(a.Z,a.11);a.25=5(){}};a.X=j.s[j.7][0]};5 26(a,b){o c=$(\'#4-w-9-C\').Z();o d=$(\'#4-w-9-C\').11();o e=(a+(j.1c*2));o f=(b+(j.1c*2));o g=c-e;o h=d-f;$(\'#4-w-9-C\').2P({Z:e,11:f},j.1L,5(){28()});6((g==0)&&(h==0)){6($.2Q.2R){1x(2S)}q{1x(2T)}}$(\'#4-w-9-Y-C\').t({Z:a});$(\'#4-u-V,#4-u-W\').t({11:b+(j.1c*2)})};5 28(){$(\'#4-I\').1m();$(\'#4-9\').23(5(){29();2a()});2b()};5 29(){$(\'#4-w-9-Y-C\').2U(\'2V\');$(\'#4-9-F-K\').1m();6(j.s[j.7][1]){$(\'#4-9-F-K\').T(j.s[j.7][1]).M()}6(j.s.D>1){$(\'#4-9-F-1j\').T(j.1M+\' \'+(j.7+1)+\' \'+j.1N+\' \'+j.s.D).M()}}5 2a(){$(\'#4-u\').M();$(\'#4-u-V,#4-u-W\').t({\'O\':\'1y P(\'+j.1b+\') Q-R\'});6(j.7!=0){6(j.1a){$(\'#4-u-V\').t({\'O\':\'P(\'+j.1q+\') 1k 15% Q-R\'}).12().1n(\'G\',5(){j.7=j.7-1;E();A H})}q{$(\'#4-u-V\').12().2c(5(){$(J).t({\'O\':\'P(\'+j.1q+\') 1k 15% Q-R\'})},5(){$(J).t({\'O\':\'1y P(\'+j.1b+\') Q-R\'})}).M().1n(\'G\',5(){j.7=j.7-1;E();A H})}}6(j.7!=(j.s.D-1)){6(j.1a){$(\'#4-u-W\').t({\'O\':\'P(\'+j.1s+\') 2d 15% Q-R\'}).12().1n(\'G\',5(){j.7=j.7+1;E();A H})}q{$(\'#4-u-W\').12().2c(5(){$(J).t({\'O\':\'P(\'+j.1s+\') 2d 15% Q-R\'})},5(){$(J).t({\'O\':\'1y P(\'+j.1b+\') Q-R\'})}).M().1n(\'G\',5(){j.7=j.7+1;E();A H})}}2e()}5 2e(){$(l).2W(5(a){2f(a)})}5 1z(){$(l).12()}5 2f(a){6(a==2g){13=2X.2h;1A=27}q{13=a.2h;1A=a.2Y}19=2Z.30(13).31();6((19==j.1O)||(19==\'x\')||(13==1A)){1l()}6((19==j.1P)||(13==37)){6(j.7!=0){j.7=j.7-1;E();1z()}}6((19==j.1Q)||(13==39)){6(j.7!=(j.s.D-1)){j.7=j.7+1;E();1z()}}}5 2b(){6((j.s.D-1)>j.7){2i=B 1d();2i.X=j.s[j.7+1][0]}6(j.7>0){2j=B 1d();2j.X=j.s[j.7-1][0]}}5 1l(){$(\'#18-4\').2k();$(\'#4-U\').32(5(){$(\'#4-U\').2k()});$(\'1T, 1U, 1V\').t({\'1W\':\'33\'})}5 1v(){o a,y;6(N.1o&&N.2l){a=N.2m+N.34;y=N.1o+N.2l}q 6(l.v.2n>l.v.2o){a=l.v.35;y=l.v.2n}q{a=l.v.36;y=l.v.2o}o b,S;6(14.1o){6(l.z.1p){b=l.z.1p}q{b=14.2m}S=14.1o}q 6(l.z&&l.z.1B){b=l.z.1p;S=l.z.1B}q 6(l.v){b=l.v.1p;S=l.v.1B}6(y<S){1C=S}q{1C=y}6(a<b){1D=a}q{1D=b}2p=B 1h(1D,1C,b,S);A 2p};5 1w(){o a,y;6(14.2q){y=14.2q;a=14.38}q 6(l.z&&l.z.1E){y=l.z.1E;a=l.z.2r}q 6(l.v){y=l.v.1E;a=l.v.2r}2s=B 1h(a,y);A 2s};5 1x(a){o b=B 2t();c=2g;3a{o c=B 2t()}20(c-b<a)};A J.12(\'G\').G(1R)}})(1F);',62,197,'||||gallery|function|if|activeImage||image||||||||||||document|div||var||else|id|imageArray|css|nav|body|container||yScroll|documentElement|return|new|box|length|_set_image_to_view|details|click|false|loading|this|caption|href|show|window|background|url|no|repeat|windowHeight|html|overlay|btnPrev|btnNext|src|data|width||height|unbind|keycode|self||THEME_IMAGES|getAttribute|preview|key|fixedNavigation|imageBlank|containerBorderSize|Image|parents|item|children|Array|span|currentNumber|left|_finish|hide|bind|innerHeight|clientWidth|imageBtnPrev|png|imageBtnNext|img|secNav|___getPageSize|___getPageScroll|___pause|transparent|_disable_keyboard_navigation|escapeKey|clientHeight|pageHeight|pageWidth|scrollTop|jQuery|overlayBgColor|overlayOpacity|imageLoading|gif|imageBtnClose|containerResizeSpeed|txtImage|txtOf|keyToClose|keyToPrev|keyToNext|_initialize|_start|embed|object|select|visibility|_set_interface|title|push|while|link|btnClose|fadeIn|top|onload|_resize_container_image_box||_show_image|_show_image_data|_set_navigation|_preload_neighbor_images|hover|right|_enable_keyboard_navigation|_keyboard_action|null|keyCode|objNext|objPrev|remove|scrollMaxY|innerWidth|scrollHeight|offsetHeight|arrayPageSize|pageYOffset|scrollLeft|arrayPageScroll|Date|fn|extend|000|ajax|ico|scroll_left|scroll_right|btn|close|lightbox|blank|400|of|hidden|for|append|style|backgroundColor|opacity|resize|attr|animate|browser|msie|250|100|slideDown|fast|keydown|event|DOM_VK_ESCAPE|String|fromCharCode|toLowerCase|fadeOut|visible|scrollMaxX|scrollWidth|offsetWidth||pageXOffset||do'.split('|'),0,{}));

jQuery(document).ready(function () {
$ = jQuery;
var b = $('#slider .scrollContainer .panel');
var c = $('#slider .scrollContainer');
if (c.length == 0 || b.length == 0) return false;
var d = true;
if (d) {
	b.css({
		'float': 'left',
		'position': 'relative'
	});
	c.css('width', b[0].offsetWidth * b.length)

	var num = 0;

	b.each(function(){
		if(num%2==1){
			_top = '500px';
		}else{
			_top = '0px';
		}
		jQuery(this).css({'top': _top});
		num++;
	});

}
var f = $('#slider .scroll').css({
	'overflow': 'hidden',
	'width': '946px'
});

f.before('<img class="scrollButtons left" alt ="&laquo;" style="font-size:3em" src="' + THEME_IMAGES + '/scroll_left.png" />').after('<img class="scrollButtons right" alt ="&raquo;"  style="font-size:3em"  src="' + THEME_IMAGES + '/scroll_right.png" />');
var g = parseInt((d ? c.css('paddingTop') : c.css('paddingLeft')) || 0) * -1;
var h = {
	target: f,
	items: '.panel' /*b*/,
	lazy: true,
	prev: 'img.left',
	next: 'img.right',
	axis: 'xy',
	offset: g,
	duration: 950,
	easing: 'swing',
	onBefore: function (e, a) {
// 		jQuery(a).hide().fadeIn(1500)
	}
};
$('#slider').serialScroll(h);
$.localScroll(h);
h.duration = 1;
$.localScroll.hash(h)
});

(function($) {
 
  $.fn.tweet = function(o){
    var s = {
      username: ["aaronharun",'ajaxedwp'],              // [string]   required, unless you want to display our tweets. :) it can be an array, just do ["username1","username2","etc"]
      list: null,                              //[string]   optional name of list belonging to username
      avatar_size: null,                      // [integer]  height and width of avatar if displayed (48px max)
      count: 3,                               // [integer]  how many tweets to display?
      intro_text: null,                       // [string]   do you want text BEFORE your your tweets?
      outro_text: null,                       // [string]   do you want text AFTER your tweets?
      join_text:  null,                       // [string]   optional text in between date and tweet, try setting to "auto"
      auto_join_text_default: "I said,",      // [string]   auto text for non verb: "i said" bullocks
      auto_join_text_ed: "I",                 // [string]   auto text for past tense: "i" surfed
      auto_join_text_ing: "I am",             // [string]   auto tense for present tense: "i was" surfing
      auto_join_text_reply: "I replied to",   // [string]   auto tense for replies: "i replied to" @someone "with"
      auto_join_text_url: "I was looking at", // [string]   auto tense for urls: "i was looking at" http:...
      loading_text: null,                     // [string]   optional loading text, displayed while tweets load
      query: null                             // [string]   optional search query
    };
    
    if(o) $.extend(s, o);
    
    $.fn.extend({
      linkUrl: function() {
        var returning = [];
        var regexp = /((ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)/gi;
        this.each(function() {
          returning.push(this.replace(regexp,"<a href=\"$1\">$1</a>"));
        });
        return $(returning);
      },
      linkUser: function() {
        var returning = [];
        var regexp = /[\@]+([A-Za-z0-9-_]+)/gi;
        this.each(function() {
          returning.push(this.replace(regexp,"<a href=\"http://twitter.com/$1\">@$1</a>"));
        });
        return $(returning);
      },
      linkHash: function() {
        var returning = [];
        var regexp = /(?:^| )[\#]+([A-Za-z0-9-_]+)/gi;
        this.each(function() {
          returning.push(this.replace(regexp, ' <a href="http://search.twitter.com/search?q=&tag=$1&lang=all&from='+s.username.join("%2BOR%2B")+'">#$1</a>'));
        });
        return $(returning);
      },
      capAwesome: function() {
        var returning = [];
        this.each(function() {
          returning.push(this.replace(/\b(awesome)\b/gi, '<span class="awesome">$1</span>'));
        });
        return $(returning);
      },
      capEpic: function() {
        var returning = [];
        this.each(function() {
          returning.push(this.replace(/\b(epic)\b/gi, '<span class="epic">$1</span>'));
        });
        return $(returning);
      },
      makeHeart: function() {
        var returning = [];
        this.each(function() {
          returning.push(this.replace(/(&lt;)+[3]/gi, "<tt class='heart'>&#x2665;</tt>"));
        });
        return $(returning);
      }
    });

    function parse_date(date_str) {
      // The non-search twitter APIs return inconsistently-formatted dates, which Date.parse
      // cannot handle in IE. We therefore perform the following transformation:
      // "Wed Apr 29 08:53:31 +0000 2009" => "Wed, Apr 29 2009 08:53:31 +0000"
      return Date.parse(date_str.replace(/^([a-z]{3})( [a-z]{3} \d\d?)(.*)( \d{4})$/i, '$1,$2$4$3'));
    }

    function relative_time(time_value) {
      var parsed_date = parse_date(time_value);
      var relative_to = (arguments.length > 1) ? arguments[1] : new Date();
      var delta = parseInt((relative_to.getTime() - parsed_date) / 1000);
      var pluralize = function (singular, n) {
        return '' + n + ' ' + singular + (n == 1 ? '' : 's');
      };
	
      if(delta < 60) {
      return 'Just now';
      } else if(delta < (60*60)) {
      return '' + pluralize("minute", parseInt(delta / 60)) + ' ago';
      } else if(delta < (24*60*60)) {
      return '' + pluralize("hour", parseInt(delta / 3600)) + ' ago';
      } else {
      return '' + pluralize("day", parseInt(delta / 86400)) + ' ago';
      }
    }

    function build_url() {
      var proto = ('https:' == document.location.protocol ? 'https:' : 'http:');
      if (s.list) {
        return proto+"//api.twitter.com/1/"+s.username[0]+"/lists/"+s.list+"/statuses.json?per_page="+s.count+"&callback=?";
      } else if (s.query == null && s.username.length == 1) {
        return proto+'//api.twitter.com/1/statuses/user_timeline.json?screen_name='+s.username[0]+'&count='+s.count+'&callback=?';
      } else {
        var query = (s.query || 'from:'+s.username.join(' OR from:'));
        return proto+'//search.twitter.com/search.json?&q='+escape(query)+'&rpp='+s.count+'&callback=?';
      }
    }

    return this.each(function(i, widget){
      var list = $('<ul class="tweet_list">').appendTo(widget);
      var intro = '<p class="tweet_intro">'+s.intro_text+'</p>';
      var outro = '<p class="tweet_outro">'+s.outro_text+'</p>';
      var loading = $('<p class="loading">'+s.loading_text+'</p>');

      if(typeof(s.username) == "string"){
        s.username = [s.username];
      }

      if (s.loading_text) $(widget).append(loading);
      $.getJSON(build_url(), function(data){
        if (s.loading_text) loading.remove();
        if (s.intro_text) list.before(intro);
        var tweets = (data.results || data);
        $.each(tweets, function(i,item){
          // auto join text based on verb tense and content
          if (s.join_text == "auto") {
            if (item.text.match(/^(@([A-Za-z0-9-_]+))(:| ).*/i)) {
              var join_text = s.auto_join_text_reply;
            } else if (item.text.match(/(^\w+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&\?\/.=]+) .*/i)) {
              var join_text = s.auto_join_text_url;
            } else if (item.text.match(/^((\w+ed)|just) .*/im)) {
              var join_text = s.auto_join_text_ed;
            } else if (item.text.match(/^(\w*ing) .*/i)) {
              var join_text = s.auto_join_text_ing;
            } else {
              var join_text = s.auto_join_text_default;
            }
          } else {
            var join_text = s.join_text;
          };

          var from_user = item.from_user || item.user.screen_name;
          var profile_image_url = item.profile_image_url || item.user.profile_image_url;
          var join_template = '<span class="tweet_join"> '+join_text+' </span>';
          var join = ((s.join_text) ? join_template : ' ');
          var avatar_template = '<a class="tweet_avatar" href="http://twitter.com/'+from_user+'"><img src="'+profile_image_url+'" height="'+s.avatar_size+'" width="'+s.avatar_size+'" alt="'+from_user+'\'s avatar" title="'+from_user+'\'s avatar" border="0"/></a>';
          var avatar = (s.avatar_size ? avatar_template : '');
          var date = '<span class="tweet_time"> (<a href="http://twitter.com/'+from_user+'/statuses/'+item.id+'" title="view tweet on twitter">'+relative_time(item.created_at)+'</a>.)</span>';
          var text = '<span class="tweet_text">' +$([item.text]).linkUrl().linkUser().linkHash().makeHeart().capAwesome().capEpic()[0]+ '</span>';

          // until we create a template option, arrange the items below to alter a tweet's display.
          list.append('<li>' + avatar + join + text + date + '</li>');
		
          list.children('li:first').addClass('tweet_first');
          list.children('li:odd').addClass('tweet_even');
          list.children('li:even').addClass('tweet_odd');
        });
        if (s.outro_text) list.after(outro);
        $(widget).trigger("loaded").trigger((tweets.length == 0 ? "empty" : "full"));
		jQuery(widget).data('twitter',jQuery(widget).html());
      });
    });
  };
})(jQuery);

jQuery(document).ready(function(){
	jQuery('#social a.expand').mouseover(function() {
		jQuery('#social').animate({height: '78px', width:'300px'}, 'slow',function(){jQuery('#social a.expand').hide();jQuery('#social a.hide').show();})
	});
	jQuery('#social a.hide').click(function() {
		jQuery('#social').animate({height: '20px',width:'50px'}, 'slow',function(){jQuery('#social a.hide').hide();jQuery('#social a.expand').show();})
	});
 	jQuery('a[title]').mouseover(function(){
		
 		jQuery('#link_info').html(jQuery(this).attr('title'));
 		
 	});

	jQuery('#social').animate({height: '78px', width:'300px'}, 'slow',function(){jQuery('#social a.expand').hide();jQuery('#social a.hide').show();})

//   	jQuery('a[title]').mouseout(function(){
// 		
//  		jQuery('#link_info').html(jQuery('#link_info').data('twitter'));
//  		
//  	}); 

});
	jQuery(document).ready(function(){if(jQuery('.gallery').length > 0){jQuery('.gallery a').gallery({fixedNavigation:true});}});

	jQuery(document).ready(function(){
		jQuery("#commentform textarea").TextAreaExpander(100);
		jQuery("#contact textarea").TextAreaExpander(100);
		do_squares();
		setTimeout("do_footer_squares()",3000); //This can be delayed.
		jQuery('#commentform .subscribe-to-comments').insertAfter('#commentform .comment-form-comment');
	});


	jQuery(document).ready(function(){
		jQuery('<div id="twit" class="border_and_back"></div>').appendTo('#footright').tweet({
		join_text: "auto",
		username: ["aaronharun",'ajaxedwp'],
		count:1,
		loading_text: "Hatching...", 
		auto_join_text_reply: ""
		});
	});
