jQuery(document).ready(function(){

	jQuery('a.email').each(function(i) {
		var text = $(this).text();
		var address = text.replace(" at ", "@");
		$(this).attr('href', 'mailto:' + address);
		$(this).text(address);
	});

	jQuery("#printbtn").click( function() {
		$('.printable').jqprint();
		return false;
	});

	jQuery('#bookmark').jFav();

	jQuery('.clearField').clearField();

	jQuery('.checkbox').livequery(function(){
		if($(this).is(':checked')){$(this).parents('.checkbox_wrapper').addClass('checked')}
			});
	jQuery('.checkbox').livequery('click',function(){
		if($(this).is(':checked')){
			$(this).parents('.checkbox_wrapper').addClass('checked').removeClass('required');
			;} else if($(this).not(':checked')){$(this).parents('.checkbox_wrapper').removeClass('checked');}
			});


// Reset Font Size
	var fontSizeLevels = 2;
	var fontSizeVariation = 1;

	effectedItems = $("#column-left p,#column-full p,#att-bio p,#att-bio li,#att-related-column p,#att-related-column li");

	var originalFontSize = $('*').css('font-size');
	jQuery(".resetFont").click(function(){
		$.each(effectedItems, function(i){
			var newFontSize = originalFontSize;
			$(this).css('font-size', newFontSize);
		});
	var defaultDecreaseFontNum = 0;
	var decreaseFontNum = fontSizeLevels;
	});

	// Increase Font Size
	var defaultIncreaseFontNum = 0;
	var increaseFontNum = fontSizeLevels;
	jQuery(".increaseFont").click(function(){
		if (defaultIncreaseFontNum < increaseFontNum){
			$.each(effectedItems, function(i){
				var currentFontSize = $(this).css('font-size');
				currentFontSizeNum = parseFloat(currentFontSize, 10);
				var newFontSize = currentFontSizeNum+fontSizeVariation;
				$(this).css('font-size', newFontSize);
			});
			defaultIncreaseFontNum = defaultIncreaseFontNum+fontSizeVariation;
			defaultDecreaseFontNum = defaultDecreaseFontNum-fontSizeVariation;
		}
		return false;
	});
	
	// Decrease Font Size
	var defaultDecreaseFontNum = 0;
	var decreaseFontNum = fontSizeLevels;
	jQuery(".decreaseFont").click(function(){
		if (defaultDecreaseFontNum < (decreaseFontNum)){
			$.each(effectedItems, function(i){
				var currentFontSize = $(this).css('font-size');
				currentFontSizeNum = parseFloat(currentFontSize, 10);
				var newFontSize = currentFontSizeNum-fontSizeVariation;
				$(this).css('font-size', newFontSize);
			});
			defaultIncreaseFontNum = defaultIncreaseFontNum-fontSizeVariation;
			defaultDecreaseFontNum = defaultDecreaseFontNum+fontSizeVariation;
		}
		return false;
	});
	// END: Font Resizing

// Tooltip
jQuery('.tooltip').insertBefore('#wrapper');
jQuery(".resize a[title]").tooltip({
        tip: '.tooltip',
        effect: 'fade',
        fadeOutSpeed: 100,
        predelay: 100,
        position: "bottom left",
        offset: [2, 8]
    });

	jQuery('.select_wrapper').livequery(function(){$(this).prepend('<span>'+$(this).find('.select option:selected').text()+'</span>');});
	jQuery('.select').livequery('change',function(){$(this).prev('span').replaceWith('<span>'+$(this).find('option:selected').text()+'</span>');});
	//$('#email-form, #lookup_section form').livequery('submit',function(){$('.button').attr('disabled','disabled').addClass('disabled').val('Sending…');});

	//Tabs
	$("#tabs").height( $("#tab-1").height() );
	$('#tabs div').hide();
	$('#tabs .row-1').show();
	$('#tabs ul li.nav-1').addClass('active');
	$('#tabs ul li a').click(function(){
	$('#tabs ul li').removeClass('active');
	$(this).parent().addClass('active');
	var currentTab = $(this).attr('href');
	$('#tabs div:visible').fadeOut('fast',function(){$(currentTab).fadeIn('medium')});
	return false;
	});


});


// jFav, JQuery plugin
// v 1.0 
// SAFARI & CHROME not Supported!
// Licensed under GPL licenses.
// Copyright (C) 2008 Nikos "DuMmWiaM" Kontis, info@dummwiam.com
// http://www.DuMmWiaM.com/EffectChain

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}('(7($){$.8.9=7(d){g e=$.v({},$.8.9.k,d);g f=e.l;2.w(7(){5(!$(2).3(\'4\')||$(2).3(\'4\')=="#"){$(2).3(\'4\',j.x.4)}5(!$(2).3(\'6\')){$(2).3(\'6\',y.6)}5($.h.z){$(2).3(\'m\',$(2).3(\'4\')).3(\'4\',\'\').3(\'4\',\'A:B(0)\').3(\'C\',\'$.8.9.n(2,"\'+$(2).3(\'6\')+\'","\'+$(2).3(\'m\')+\'")\')}i{$(2).o(p)}});7 p(a){g b=$(2).3(\'4\');g c=$(2).3(\'6\');b=b.E("q:///","F://q/");5($.h.G){j.H.I(b,c)}i 5($.h.J){j.r.K(c,b,\'\')}i 5(L.M.N().O(\'P\')>-1){s(f)}i 5($.h.Q){s(f)}a.R()};t 2};$.8.9.k={l:\'S "T + D" U "V + D" W X, u Y 2 Z u 10 11.\'};$.8.9.n=7(e,a,b){e.12="r";e.6=a;e.4="";e.4=b;e.o();t 13}})(14);',62,67,'||this|attr|href|if|title|function|fn|jFav|||||||var|browser|else|window|defaults|msg|link|OperaBookmark|click|addToFavorites|file|sidebar|alert|return|to|extend|each|location|document|opera|javascript|void|onClick||replace|http|msie|external|AddFavorite|mozilla|addPanel|navigator|userAgent|toLowerCase|indexOf|chrome|safari|preventDefault|Press|Ctrl|or|CMD|for|MAC|add|page|your|bookmarks|rel|false|jQuery'.split('|'),0,{}))