/*
this code is (c) 2009, erik ryerson / 36invisible.com. all rights reserved.
visit: 36invisible.com
*/

function doFrontPage() {
		$('.dofade').hide(1); 
		$('#l_menu').hide(1);
		$('#fifty50bjj-logo_main').fadeIn(900, function() { 
			$('#fifty50bjj-logo_text').fadeIn(1000, function() { 
				$('#content_splashbox').show(700); $('#l_menu').show(); 
			}); 
		});
}

function doVisitorSlides() {
		$('div.visitorbox div.ngg-widget a').wrap('<div class="eslide"></div>').each(function() { $(this).append('<p>'+$(this).attr('title')+'</p>') });
		$('div.visitorbox div.ngg-widget').cycle({ fx: 'fade,scrollLeft,scrollDown,scrollRight,scrollUp', containerResize: false  });
}

/*
function doTab1Slides() {
		$('#hotnewsticker').cycle({ fx: 'fade' });
}
*/

function doSubScroll() {
		$('#stopper').ScrollTo(930); 
}

$(document).ready(function() {
	function moreless(x) { 
		if (x == 'less') { return 'more'; } else if (x == 'more') { return 'less'; } else if (x == 'Show') { return 'Hide'; } else { return 'Show'; } 
	}
	$('.accordion .head').click(function() {
		$(this).next('.sub_accordion').toggle('slow');
		var ml = $('.moreless', this).html();
		$('.moreless', this).html(moreless(ml));
		return false;
	}).next('.sub_accordion').hide();
	$('a.closeit').click(function() { $(this).parent().toggle('slow', function() {  $(this).parent().ScrollTo(800); }) });

	$('a').click(function() { $(this).blur(); });
	$('a.ttop').click(function() { $('#ttop').ScrollTo(800); return false; });
	$('li.current_page_item a, img#fifty50bjj-logo_main').click(function() { $('#stopper').ScrollTo(830); return false; });
	var attr_txt = $('#attribution a').html();
	$('#attribution a').mouseover(function() { $(this).html("site designed and developed by 36invisible"); }).mouseout(function(){$(this).html(attr_txt)});
	// Tabs
        $('#tabs').tabs({ fx: { opacity: 'toggle' } });
});

function rev(s) {
    r = '';
    for (i=0; i<=s.length; i++) 
    r = s.charAt(i) + r;
    return r;
} 

function contact(u,d) {
    m = rev(':otliam') + rev(u) + '@' + rev(d);
    window.location = m;
}

