$(document).ready(function(){
/*************************************
	REMOVE DEFAULT INPUT VALUES
**************************************/
	/*
$('input, textarea').focus(function() {
		value=$(this).val();
		$(this).attr("value","");
	});
	$('input, textarea').blur(function() {
		if($(this).val()=="") {
			$(this).val(value);
		}
	});
*/
	/*-------------------------------------
		LOGIC FOR REMOVING STYLES FROM LAST MENU ITEM
	-------------------------------------*/
	$('#mainNavContainer li').last().css('background', 'transparent');
	$('#mainNavContainer li').last().css('border-right', '0');
	$('#mainNavContainer li').first().css('border-left', '0');
	
	/*-------------------------------------
		RESIZE IMAGES ACCORDING TO PARENT CONTAINER
	-------------------------------------*/
	$('.fullShowImage').imagefit();
	
	/*-------------------------------------
		CHECK ICON LINKS FOR URL
	-------------------------------------*/
	$('.fullShowDetails a, .showInfo a').each(function(){
		var $href = $(this).attr('href');
		if ( ($href == '#' || $href == '') ) {
			$(this).css('display', 'none');
		}
	});
	$('.extras a').each(function(){
		var $href = $(this).attr('href');
		if ( ($href == '#'/*  || $href == '' */) ) {
			$('.extras li').css('display', 'none');
		}
	});
	/*-------------------------------------
		REGISTER BUTTON POP UP
	-------------------------------------*/	
	$(".classDetails span")
	.filter(":odd")
	.hide()
	.end()
	.filter(":even")
	.hover(
	  function () {
	    $(this).toggleClass("active")
	      .next().stop(true, true).toggle(100);
	  }
	);
	/*-------------------------------------
		TABLESORTER
	-------------------------------------*/
	$(".displayTable")
		.tablesorter({
		widthFixed: true,
		headers: {11: {sorter: false},12: {sorter:false},13: {sorter:false}}, 
		onRenderHeader: function (){
			this.wrapInner("<span></span>");
		}
		, debug: false
	});
	/*-------------------------------------
		ZEBRA STRIPE ADMIN TABLES
	-------------------------------------*/
		$(".displayTable tr").mouseover(function() {
			$(this).addClass("over");
		});
		$(".displayTable tr").mouseout(function() {
			$(this).removeClass("over");
		});
		$(".displayTable tr:odd").addClass("alt");
		
		$(".ticketTable tr").mouseover(function() {
			$(this).addClass("over");
		});
		$(".ticketTable tr").mouseout(function() {
			$(this).removeClass("over");
		});
		$(".ticketTable tr:even").addClass("alt");
		
		$(".auditionTable tr").mouseover(function() {
			$(this).addClass("over");
		});
		$(".auditionTable tr").mouseout(function() {
			$(this).removeClass("over");
		});
		$(".auditionTable tr:even").addClass("alt");
/*-------------------------------------
	MODAL WINDOW
-------------------------------------*/
	//select all the a tag with name equal to modal
	$('a[name=modal]').click(function(e) {
		//Cancel the link behavior
		e.preventDefault();
		
		//Get the A tag
		var id = $(this).attr('href');
	
		//Get the screen height and width
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
	
		//Set heigth and width to mask to fill up the whole screen
		$('#mask').css({'width':maskWidth,'height':maskHeight});
		
		//transition effect		
		$('#mask').fadeIn(200);	
		$('#mask').fadeTo("fast",0.8);	
	
		//Get the window height and width
		var winH = $(window).height();
		var winW = $(window).width();
              
		//Set the popup window to center
		$(id).css('top',  winH/2-$(id).height()/2);
		$(id).css('left', winW/2-$(id).width()/2);
	
		//transition effect
		$(id).fadeIn(200); 
	
	});
	
	//if close button is clicked
	$('.window .close').click(function (e) {
		//Cancel the link behavior
		e.preventDefault();
		
		$('#mask').hide();
		$('.window').hide();
	});		
	
	//if mask is clicked
	$('#mask').click(function () {
		$(this).hide();
		$('.window').hide();
	});			
});/*CLOSING BRACKETS*/