
$().ready(function(){$('.post_listing > .post > .headline > h3').live('click',function(){window.location=$(this).parents('.post').attr('rel');});});
function addJavascript(jsname,pos){var th=document.getElementsByTagName(pos)[0];var s=document.createElement('script');s.setAttribute('type','text/javascript');s.setAttribute('src',jsname);th.appendChild(s);}
function addCSS(cssname){var th=document.getElementsByTagName('head')[0];var s=document.createElement('link');s.setAttribute('type','text/css');s.setAttribute('href',cssname);s.setAttribute('rel','stylesheet');th.appendChild(s);}
greenlee.bigBoxOpen=false;greenlee.code={pad:40}
greenlee.subMenuContent={};greenlee.headerMenuOpen=false;greenlee.settings={fadeSupport:false,input:{email:'',name:'',message:'Aaron, I visited your Web site and ...'}};greenlee.closeSubmenu=function(){if(typeof greenlee.bigBoxOpen!='undefined'&&greenlee.bigBoxOpen)
return false;greenlee.headerMenuOpen=false;$('.activeMenu_constant').removeClass('activeMenu_constant');if(greenlee.settings.fadeSupport){$('#sub_menu').stop().fadeOut('fast',function(){$('#content_wrapper').stop().fadeTo('fast',1);});}else{$('#sub_menu').hide();}
$('.syntaxhighlighter').removeClass('no-hand');}
greenlee.track=function(options){if(options.label!=undefined&&options.value!=undefined){_gaq.push(['_trackEvent',options.category,options.action,options.label,options.value]);}else{_gaq.push(['_trackEvent',options.category,options.action]);}}
greenlee.openbigbox=function(options){if(!greenlee.bigBoxOpen&&$('#content_wrapper').css('opacity')>0){greenlee.bigBoxOpen=true;$('a').addClass('no_hand');var pad=greenlee.code.pad;var html=(options.$element!=undefined)?$(options.$element).clone(true):options.html;if(options.$element!=undefined){var html=$(options.$element).clone(true);html.attr('id','generated');}else{html=options.html;}
$('body').append('<div id="bigbox" class="hidden"><div id="bigboxcode"></div></div>');var w=$(window).width()-pad;var scrollTop=window.pageYOffset||document.documentElement.scrollTop||0;$('#bigbox').css({width:w-(pad*2),top:(scrollTop+pad),left:pad}).empty().html(html).prepend('<div class="fp"><div class="fl"><h3>'+options.title+'</h3></div><div class="fr"><img id="close_bigbox" src="/includes/skin/Traditional/furniture/close_btn.png" alt="Close" /></div></div>');$('#generated').show();if(greenlee.settings.fadeSupport){$('#content_wrapper').fadeTo('fast',0.1,function(){$('#bigbox').slideDown('fast');});}
else{$('#bigbox').slideDown('fast');}}};$().ready(function(){$('#close_bigbox').live('click',function(){greenlee.bigBoxOpen=false;if(greenlee.settings.fadeSupport){$(this).stop().fadeOut('fast',function(){$('#content_wrapper').stop().fadeTo('fast',1,function(){$('#bigbox').remove();});});}else{$(this).hide();}});$(window).resize(function(){if(greenlee.bigBoxOpen){var pad=greenlee.code.pad;var w=$(window).width()-pad;var scrollTop=window.pageYOffset||document.documentElement.scrollTop||0;$('#bigbox').css({width:w-(pad*2),top:(scrollTop+pad),left:pad});}});$('.video_thumb').click(function(){var id=$(this).attr('index');greenlee.openbigbox({$element:$('#'+id),title:'Video'});greenlee.track({category:'video',action:'play',label:'video',value:id});});$("a[href*='http://']:not([href*='"+location.hostname+"']),[href*='https://']:not([href*='"+location.hostname+"'])").addClass("external").attr("target","_blank").attr("title","Opens new window");$('a').click(function(){if(greenlee.bigBoxOpen)
return false;var type=($(this).attr('target')=='_blank')?'outbound':'internal';greenlee.track({category:'link_'+type,action:'click',label:'href',value:$(this).attr('href')});});$('input[type=text],textarea').hover(function(){$(this).addClass('inputHover');},function(){$(this).removeClass('inputHover');});$('input[type=text],textarea').focus(function(){$(this).addClass('activeInput');});$('input[type=text],textarea').blur(function(){$(this).removeClass('activeInput');});$('button, .buttonFacade').css({opacity:0.5}).hover(function(){$(this).stop().fadeTo(250,1);},function(){$(this).stop().fadeTo(250,0.5);});$('.buttonFacade').live('click',function(){if($('a',this).length==1)
window.location=$('a',this).attr('href');});$('#contactForm').validate({submitHandler:function(form){$(form).ajaxSubmit({success:function(data){if(typeof data.errors!=undefined&&data.errors.length==0){var h='<h3>Thanks for contacting me</h3><br />Please allow a day or two for a response as I may be traveling. You may also want to <a href="http://twitter.com/aarongreenlee">follow me</a>.';}else{if(typeof data.errors==undefined){var h='Your Internet hung up on you. Please try again.';}else{var h='<h3>Server found some errors... Try Again</h3>';for(a in data.errors)
h+=data.errors[a]+'<br />'}}
$('.html_submenu').hide();$('#succsess_message_sub').show().html(h);}});},errorPlacement:function(error,element){},rules:{"frm.name":{required:true,minlength:2,maxlength:56},"frm.email":{required:true,email:true,maxlength:50},"frm.message":{required:true,minlength:6,maxlength:1024}},messages:{"frm.name":{required:'Did you forget your name?',minlength:'Wow, you have a short name.',maxlength:'Your name is crazy long.'},"frm.email":{required:'Did you forget an e-mail?',email:'You should fix your email.',maxlength:'Your e-mail is crazy long.'},"frm.message":{required:'Don\'t you have something to say?',minlength:'Your message is too short.',maxlength:'Do you really need to say that much?'}}});if('opacity'in document.body.style){greenlee.settings.fadeSupport=true;}
var hmenuPositions={runningTotal:0,totalArea:$('#menu_wrap').width(),spaceBetween:0};$('.headmenu').each(function(){hmenuPositions.runningTotal+=$(this).width();});hmenuPositions.spaceBetween=Math.floor((hmenuPositions.totalArea-hmenuPositions.runningTotal)/($('.headmenu').length-1));$('.headmenu').each(function(){var opacity=($(this).hasClass('onLocation'))?1:0.5;$(this).stop().fadeTo(500,opacity);}).hover(function(){if(!$(this).hasClass('onLocation')){$(this).removeClass('inactiveMenu').addClass('activeMenu').stop().fadeTo(200,1);}},function(){if(!$(this).hasClass('onLocation')){$(this).removeClass('activeMenu').addClass('inactiveMenu').stop().fadeTo(500,0.5);}});var $m=$('#menu_wrap');$m.children('div').click(function(){var menu=$(this).attr('id');$(this).addClass('activeMenu_constant');$('.syntaxhighlighter').addClass('no-hand');if(greenlee.headerMenuOpen==true){$('.activeMenu_constant').removeClass('activeMenu_constant');$('#sub_menu .sub_menu_content').stop().fadeTo(100,0,function(){greenlee.drawSubMenu({menu:menu,animate:true});});}else{greenlee.headerMenuOpen=true;if(greenlee.settings.fadeSupport){$('#content_wrapper').stop().fadeTo('fast',0,function(){$('#sub_menu').stop().fadeIn('fast');greenlee.drawSubMenu({menu:menu,animate:false});});}
else{greenlee.drawSubMenu({menu:menu,animate:false});$('#sub_menu').slideDown('fast');}}});var $elements=$('#menu');$elements.bind('clickoutside',function(event){greenlee.closeSubmenu();});var opwb=.7;var $wb=$('#wrecking_ball_represent');$wb.fadeTo(0,opwb);;$('#wbcontainer').hover(function(){$wb.stop().addClass('wrecking_ball_represent_on').fadeTo(150,1);},function(){$wb.fadeTo(1200,opwb,function(){$wb.removeClass('wrecking_ball_represent_on').stop()});}).click(function(){window.location='http://www.wreckingballmedia.com/?r=aarongreenlee';});});greenlee.drawSubMenu=function(options){greenlee.saveInput();var htmlString='';if(options.menu!='menu_contact'&&options.menu!='menu_about'){$('.html_submenu').hide();htmlString=greenlee.drawSecondaryMenu(options.menu,greenlee.subMenuContent[options.menu]);$('#sub_menu_content_container').show();}else{$('#succsess_message_sub').hide();$('.html_submenu').hide();$('#sub_menu_content_container').hide();$('#'+options.menu+'_sub').show();}
$('#sub_menu_content_container').html(htmlString);greenlee.insertInput(options);if(options.animate){$('#sub_menu .sub_menu_content').fadeTo(100,1);}}
greenlee.saveInput=function(){if($('#contactForm').length>0){greenlee.settings.input.email=$('#contactEmail').val();greenlee.settings.input.name=$('#contactName').val();greenlee.settings.input.message=$('#contactMessage').val();}}
greenlee.insertInput=function(options){if(options.menu=='menu_contact'){$('#contactEmail').val(greenlee.settings.input.email);$('#contactName').val(greenlee.settings.input.name);$('#contactMessage').val(greenlee.settings.input.message);}}
$().ready(function(){$('.secondary_menu').live('click',function(){$('.secondary_menu_active').removeClass('secondary_menu_active').addClass('secondary_menu_inactive');$(this).addClass('secondary_menu_active');var collection=$(this).attr('rel');var section=$(this).attr('index');$('#secondary_content').html(greenlee.drawSecondaryMenuContents(collection,section));return false;})});greenlee.drawSecondaryMenu=function(type,collection){var h='<div class="whiteout"><div class="fp"><div class="fp secondary_menu_root_wrapper">';var activeClass=' secondary_menu_active';var i=0;for(var k in collection){if(++i==1){var collection=type;section=k;};h+='<div class="secondary_menu_root '+activeClass+' fl"><span>'+k+'</span></div>';activeClass='secondary_menu_inactive';}
h+='</div><div id="secondary_content" class="pt10 pb10 cb fp">'+greenlee.drawSecondaryMenuContents(collection,section)+'</div></div></div>'
return h;}
greenlee.drawSecondaryMenuContents=function(collection,section){h='';for(var k in greenlee.subMenuContent[collection][section]){var o=greenlee.subMenuContent[collection][section][k];h+='<div class="secondary_menu_item"><a href="'+o.ROUTE+'">'+o.DISPLAY;if(typeof o.COUNT!='undefined'){h+=' ('+o.COUNT+')';}
h+='</a></div>';}
return h;}
greenlee.getScrollTop=function(){return f_filterResults(window.pageYOffset?window.pageYOffset:0,document.documentElement?document.documentElement.scrollTop:0,document.body?document.body.scrollTop:0);}
$().ready(function(){$('.codewrap').click(function(){var options={title:'Full Screen Code Sample',$element:$(this)};greenlee.track({category:'code',action:'bigger',label:'title',value:document.title});greenlee.openbigbox(options);});$('.download_code').click(function(){var l=document.location.href.replace("/share/","/download/");window.open(l,'_blank');return false;});});
$().ready(function(){$.ajax({url:'/gtalk',dataType:'json',success:function(data){greenlee.gtalk(data);}});});greenlee.gtalk=function(d){if(typeof d.status!='undefined'){if(d.status==true){var tagline=(d.message.indexOf('href=')==-1)?'My current status message:':'I am currently working on:';$('#gtalk').html('<strong>Available for </strong> <a href="http://www.google.com/talk/service/badge/Start?tk=z01q6amlqcde9625vlbbulv76dtm91hlbvjj87u89o3noh60vobul7q6ja5vm331jpqnr6oqb03ekn9gjon5dj088kt7ercb1grbpvsu1svkbhknipniusqi8vkpolj5pj26pvubgebod9lgek2nncq3o09crv6pqcntql6dc" target="_blank">chat</a>.<br />'+tagline+'<br />'+d.message).hide().addClass('root').slideDown('slow');}}}
