
var move_title=function(){var title=$('div.main_content .h1').prepend("// ");var header=$('#header');header.prepend(title.attr("id","title").css('visibility','visible'));};(function($){$.fn.enhanceMenu=function(options){settings=jQuery.extend({effect:'slide_x',duration:800},options);this.each(function(){var menu=$(this);$('ul',menu).parent('li').addClass('parent_li');var nav_li=$('ul#nav li').children('ul').hide().end();if(settings.effect=='fade'){nav_li.hover(function(){$(this).find('> ul').stop(true,true).fadeIn(settings.duration);},function(){$(this).find('> ul').stop(true,true).fadeOut(settings.duration);});}
else if(settings.effect=='slide'){nav_li.hover(function(){$(this).children('ul').stop(true,true).delay(150).slideDown(settings.duration);},function(){$(this).children('ul').stop(true,true).delay(150).slideUp(settings.duration);});}
else{nav_li.hover(function(){$(this).find('> ul').stop(true,true).show();},function(){$(this).find('> ul').stop(true,true).hide();});}});};})(jQuery);var buttons=function(){var btns=$('input[type="submit"]:not(#search_button), button, input[type="reset"], a.make_me_btn');btns.addClass('button').wrap('<span class="button_left" />').wrap('<span class="button_right" />');};var portfolio_overlay=function(){$('li.portfolio_item').each(function(){var item=$(this),image=$('img',item),height=image.height(),width=image.width();image.after('<span class="img_overlay"/>');var overlay=$('span.img_overlay',item).hide();overlay.css({'width':width,'height':height,'filter':'alpha(opacity=70)'});var description=$('div.portfolio_description',item).css('opacity',0);description.css({'width':width-10,'min-height':height/2-9,'top':height+10});var itemHeight=height/2+description.outerHeight();item.css({'width':width+10,'height':itemHeight,'min-height':height+10});item.hover(function(){overlay.fadeIn('500');description.stop().animate({'top':height/2,'opacity':1});},function(){overlay.stop(true,true).fadeOut('500');description.stop().animate({'top':height+10,'opacity':0});});});};var tabs=function(){var tabsContainer=$('div.tabs > div'),tabs_links=$('div.tabs_nav a');tabsContainer.hide().filter(':first').show();tabs_links.click(function(){tabsContainer.hide();tabsContainer.filter(this.hash).fadeIn();tabs_links.parent('li').removeClass('current');$(this).parent('li').addClass('current');return false;}).filter(':first').click();};var topPanel=function(){var trigger=$('div#header_bar a.login_link'),panel=$('div#top_panel');trigger.click(function(){panel.slideToggle();});};var captions=function(){var images=$('div.main_content img.caption');images.each(function(i){var image=$(this);align=image.attr('align'),css=image.css('float'),margin_bottom=image.css('margin-bottom'),margin_left=image.css('margin-left'),margin_right=image.css('margin-right'),caption=image.attr('title');caption==0?caption=image.attr('alt'):' ';image.css('margin-bottom',0);if(align=='left'||css=='left')img_float='left';else if(align=='right'||css=='right')img_float='right';else img_float='none';image.wrap('<div class="caption_wrap" />');image.parent().css({'width':image.outerWidth(),'float':img_float,'margin-bottom':margin_bottom,'margin-left':margin_left,'margin-right':margin_right}).append('<p>'+caption+'</p>');});};var form=function(){var inputs=$('input, textarea');inputs.focus(function(){$(this).prev('label').addClass('focus_field');});inputs.blur(function(){$(this).prev('label').removeClass('focus_field');});}
var quotes=function(){var quotes_para=$('blockquote p');$('<span class="quot_mark left">&#8220;</span>').prependTo(quotes_para);$('<span class="quot_mark_end right">&#8221; </span>').appendTo(quotes_para);};(function($){$.fn.lazyload=function(options){var settings={threshold:0,failurelimit:0,event:"scroll",effect:"show",container:window};if(options){$.extend(settings,options);}
var elements=this;if("scroll"==settings.event){$(settings.container).bind("scroll",function(event){var counter=0;elements.each(function(){if($.abovethetop(this,settings)||$.leftofbegin(this,settings)){}else if(!$.belowthefold(this,settings)&&!$.rightoffold(this,settings)){$(this).trigger("appear");}else{if(counter++>settings.failurelimit){return false;}}});var temp=$.grep(elements,function(element){return!element.loaded;});elements=$(temp);});}
this.each(function(){var self=this;if(undefined==$(self).attr("original")){$(self).attr("original",$(self).attr("src"));}
if("scroll"!=settings.event||undefined==$(self).attr("src")||settings.placeholder==$(self).attr("src")||($.abovethetop(self,settings)||$.leftofbegin(self,settings)||$.belowthefold(self,settings)||$.rightoffold(self,settings))){if(settings.placeholder){$(self).attr("src",settings.placeholder);}else{$(self).removeAttr("src");}
self.loaded=false;}else{self.loaded=true;}
$(self).one("appear",function(){if(!this.loaded){$("<img />").bind("load",function(){$(self).hide().attr("src",$(self).attr("original"))
[settings.effect](settings.effectspeed);self.loaded=true;}).attr("src",$(self).attr("original"));};});if("scroll"!=settings.event){$(self).bind(settings.event,function(event){if(!self.loaded){$(self).trigger("appear");}});}});$(settings.container).trigger(settings.event);return this;};$.belowthefold=function(element,settings){if(settings.container===undefined||settings.container===window){var fold=$(window).height()+$(window).scrollTop();}else{var fold=$(settings.container).offset().top+$(settings.container).height();}
return fold<=$(element).offset().top-settings.threshold;};$.rightoffold=function(element,settings){if(settings.container===undefined||settings.container===window){var fold=$(window).width()+$(window).scrollLeft();}else{var fold=$(settings.container).offset().left+$(settings.container).width();}
return fold<=$(element).offset().left-settings.threshold;};$.abovethetop=function(element,settings){if(settings.container===undefined||settings.container===window){var fold=$(window).scrollTop();}else{var fold=$(settings.container).offset().top;}
return fold>=$(element).offset().top+settings.threshold+$(element).height();};$.leftofbegin=function(element,settings){if(settings.container===undefined||settings.container===window){var fold=$(window).scrollLeft();}else{var fold=$(settings.container).offset().left;}
return fold>=$(element).offset().left+settings.threshold+$(element).width();};$.extend($.expr[':'],{"below-the-fold":"$.belowthefold(a, {threshold : 0, container: window})","above-the-fold":"!$.belowthefold(a, {threshold : 0, container: window})","right-of-fold":"$.rightoffold(a, {threshold : 0, container: window})","left-of-fold":"!$.rightoffold(a, {threshold : 0, container: window})"});})(jQuery);var zebratables=function(){$('tr:nth-child(odd)').addClass('tr_odd');};var back_to_top=function(){var topLink=$('#back_to_top');var page_height=$(document).height();var window_height=$(window).height();$(window).scroll(function(){var y=$(window).scrollTop();if(y>page_height-window_height-70){topLink.show(400);}
else{topLink.hide(400);}});};