/* pagescripts.js */
(function($) {

    $.fn.toggleText = function(o,c) {
		if ($(this).text() == o) {
			$(this).text(c).attr("title",c);
			return true;
		} else {
			$(this).text(o).attr("title",o);
			return false;
		}
    };
})(jQuery);

function mailer(to,name,dom,title) {
	if ((dom=='')||(dom=='undefined')||(dom==null)) {
		dom = 'bottomlounge.com';
	}
	m = to + '@' + dom;
	if ((name=='')||(name=='undefined')||(name==null)) {
		name = to + ' &#64; ' + dom;
	}
	if ((title=='')||(title=='undefined')||(title==null)) {
		title = 'email ' + name;
	}
	document.write('<a href="mailto:' + m + '" title="'+ title +'" class="email">' + name + '</a>');
}

$(function(){
});
$(document).ready(function(){
	
	// MENU
 	$(".item a.b").click(function(){
	    $(".item a.b").not(this).removeClass("active"); /*OTHERS*/
		$(this).toggleClass("active")
			   .next(".empty").slideToggle();
		$(".item a:not(.active) + .empty").slideUp("fast");
	//	if ( $(this).attr("rel") != "shadowbox" ) {
			var temp = $(this).text();
			$(this).text( $(this).attr("title") ).attr("title",temp);
			return false;
	//	}
	});
	
	Shadowbox.init();
	$('.photos').innerfade({
		 speed: 'slow',
		 timeout: 11000,
		 type: 'random',
		 containerheight: '200px'
	});
	$('.gallery').innerfade({
		speed: 'slow',
		timeout: 8500,
		type: 'random',
		containerheight: '220px',
		animationtype: 'slide'
	});
	$('#snaps .gallery').innerfade({
		timeout: 11000,
		type: 'random_start'
	});
	
	$('.galleryToggle').click(function(){
		theGal = $(this).attr('href');
	//	alert(theGal);
		$($(this).attr('href')).toggleClass('hidden');
		$(this).toggleText('Hide Band Gallery');
		return false;
	});

	
	$('a[href^="#"]').click(function(){
		$.scrollTo( this.hash, 1200);
		return false;
	});
	
});