
function detect_browser()
{var jbrowserVersion=parseFloat($.browser.version.substring(0,3));if($.browser.mozilla)
{if(jbrowserVersion>=1.9)
{$.globals.isFirefox3up=true;}}
else if($.browser.msie)
{if($.browser.version>=6.0)
{$.globals.isIE6up=true;}}
else if($.browser.safari)
{if(($.browser.version>=528)||(jbrowserVersion>=528))
{$.globals.isSafari4up=true;}}
else if($.browser.opera)
{if($.browser.version>=10)
{$.globals.isOpera10up=true;}}
if($.globals.isFirefox3up||$.globals.isIE6up||$.globals.isSafari4up||$.globals.isOpera10up)
{isHiFi=true;}
return isHiFi;}
function detect_platform()
{var ua=navigator.userAgent.toLowerCase();var platform='';if(ua.indexOf('win')!=-1)
{platform='win';}
else if(ua.indexOf('mac')!=-1)
{platform='mac';}
else if(ua.indexOf('unix')!=-1)
{platform='unix';}
else if(ua.indexOf('linux')!=-1)
{platform='linux';}
return platform;}
function stack_labels()
{$.each($('.stackable').find('label:first'),function(i,item)
{var input=$('#'+$(item).attr('for'));$(item).click(function()
{var this_input=$('#'+$(item).attr('for'));$(this_input).focus();$(this).parents('.stackable:first').removeClass('stacked-pair');});$(input).bind('focus',function()
{$(this).parents('.stackable:first').removeClass('stacked-pair');}).bind('blur',function()
{if($(input).val()=='')
{$(this).parents('.stackable:first').addClass('stacked-pair');}});if($(input).val()=='')
{$(this).parents('.stackable:first').addClass('stacked-pair');}});}
function fit_content_heading(h)
{var char_limit=90;$.each($(h),function(i,item)
{var t=$(item).text();var len=t.length;if(len>char_limit)
{$(item).addClass('reduced');}});}
function collapsed_comments_callback()
{$.overflow_dl.addClass('hidden');$.comments_button_range.text($.button_range_text[0]);$.comments_button_link.text($.button_link_text[0]);if($.comments_button_manually_clicked)
{$.comments_dl.attr({tabIndex:-1}).focus();}}
function expanded_comments_callback()
{$.overflow_dl.removeClass('hidden');$.comments_button_range.text($.button_range_text[1]);$.comments_button_link.text($.button_link_text[1]);if($.comments_button_manually_clicked)
{$.overflow_dl.attr({tabIndex:-1}).focus();if(comments_collapsed_onload===false)
{$('#latestcomment').attr({tabIndex:-1}).focus();comments_collapsed_onload=true;}}}
function collapse_comments()
{if($.comments_button_manually_clicked)
{$.close_duration=1000;}
else
{$.close_duration=0;}
if($.overflow_dl.hasClass('hidden'))
{if($.browser.msie)
{$.overflow_dl.animate({height:$.overflow_dl.data('height')},500,expanded_comments_callback);}
else
{$.overflow_dl.animate({opacity:100,height:$.overflow_dl.data('height')},500,expanded_comments_callback);}}
else
{if($.browser.msie)
{$.overflow_dl.animate({height:0},$.close_duration,collapsed_comments_callback);}
else
{$.overflow_dl.animate({opacity:0,height:0},$.close_duration,collapsed_comments_callback);}}}
function comments_button()
{$.overflow_dl.data('height',$.overflow_dl.height());$.overflow_dl.after($('<button/>').append($('<div/>').addClass('liner-1').append($('<div/>').addClass('liner-2').append($('<span/>').addClass('s')).append($('<span/>').addClass('a')))).bind('mouseenter focus',function()
{$(this).addClass('over');}).bind('mouseleave blur',function()
{$(this).removeClass('over');}).click(function()
{collapse_comments();}));$.comments_button=$.comments.find('button:first');$.comments_button_range=$.comments_button.find('.s:first');$.comments_button_link=$.comments_button.find('.a:first');$.comments_button_manually_clicked=false;$.comments_button.trigger('click');if(!comments_collapsed_onload)
{$.comments_button.trigger('click');}
$.comments_button_manually_clicked=true;}
function enhance_comments()
{if($.comments_len>$.comments_visible)
{$.comments_dl=$.comments.find('dl:first');$.comments_dt=$.comments_dl.find('dt');$.overflow_dl=$('<dl/>').addClass('overflow');$.comments_dl.after($.overflow_dl);var comments_max=($.comments_visible-1);$.each($.comments_dt,function(i,item)
{if(i>comments_max)
{$.number=$(item);$.comment=$.comments_dl.find('dd.comment').eq(i);$.commenter=$.comments_dl.find('dd.commenter').eq(i);$.number.addClass('overflow').clone().appendTo($.overflow_dl);$.comment.addClass('overflow').clone().appendTo($.overflow_dl);$.commenter.addClass('overflow').clone().appendTo($.overflow_dl);}});$.comments_dl.after($.overflow_dl);$.comments_dl.find('.overflow').remove();comments_button();}}
function util_hidefocus()
{if($.hidefocus===false)
{$('body').addClass('hidefocus');$.hidefocus=true;}}
function util_showfocus()
{if($.hidefocus===true)
{$('body').removeClass('hidefocus');$.hidefocus=false;}}
function suppress_outline_onfocus()
{$.hidefocus=false;$('body').bind('mousedown',util_hidefocus).bind('keydown',util_showfocus).trigger('mousedown');}
function image_hovers()
{$.each($('img[src*=-off.]'),function(i,item)
{$(item).data('offSrc',$(this).attr('src')).data('overSrc',$(this).attr('src').replace('-off','-over'));$(item).parents('a:first').bind('mouseenter focus',function()
{$.img=$(this).find('img:first');$.img.attr('src',$.img.data('overSrc'));}).bind('mouseleave blur',function()
{$.img=$(this).find('img:first');$.img.attr('src',$.img.data('offSrc'));});$('<img/>').attr({src:$(item).data('overSrc')});});}
function submit_hovers()
{$.each($('input[src*=-off.]'),function(i,item)
{$(item).data('offSrc',$(this).attr('src')).data('overSrc',$(this).attr('src').replace('-off','-over')).bind('mouseenter focus',function()
{$(this).attr('src',$(this).data('overSrc'));}).bind('mouseleave blur',function()
{$(this).attr('src',$(this).data('offSrc'));});var n=document.createElement('img');n.setAttribute('src',$(item).data('overSrc'));});}
function enhance_skiplinks()
{if($.browser.msie&&$.browser.version==6.0)
{$('p.skiplink a').bind('mouseenter hover focus',function()
{$(this).addClass('focus');$(this).css({zoom:1});window.scroll(0,$(this).offset().top);}).bind('mouseleave blur click',function()
{$(this).removeClass('focus');});}}
function fix_browser_focus()
{if($.browser.safari===false&&$.browser.opera===false)
{return;}
var hashExpression=/[\w-_]*/,locationExpression=/^[a-zA-Z0-9:\/%\.-_]*/;$("a[href*='#'], area[href*='#']").click(function()
{var parts=this.href.split("#"),target=null;if(parts[0].match(locationExpression)[0]===location.href.match(locationExpression)[0])
{target=document.getElementById(parts[1].match(hashExpression));if(target!==null)
{$(target).attr({tabIndex:-1}).focus();}}});}
function enhance_share()
{$('.share').addClass('share-enhanced');}
function prop_post()
{$.post=$('#content .post');$.each($.post,function(i,item)
{if($(item).find('.thumb').length>0)
{var p1=$(item).find('p:first');var p2=$(item).find('p.more:first');var poster_bubble=$(item).find('.poster-bubble:first');var poster=$(item).find('.poster:first');var thumb_h=$(item).find('.thumb:first').outerHeight(true);if($(p1)&&$(p2)&&$(poster_bubble)&&$(poster))
{var lhs_h=(p1.outerHeight(true)+p2.outerHeight(true)+poster_bubble.outerHeight(true)+poster.outerHeight(true));var diff=(thumb_h-lhs_h);if(diff>0)
{diff+=5;if($.browser.msie&&($.browser.version==6.0)||($.browser.version==7.0))
{diff+=1;}
$(p2).css('padding-bottom',(diff+'px'));}}}});}