$(document).ready(function() {
	$('#calendar').fullCalendar({
		theme: true,
		header: {
				left: 'prev,next today',
				center: 'title',
				right: 'month,agendaWeek,agendaDay'
			},
		events: $.fullCalendar.bwCalFeed('calendar_ajax.asp'),
		eventClick: function(event) {
			/*
			window.open(event.url, 'gcalevent', 'width=700,height=600');
			return false;
			*/
		},
		loading: function(bool) {
			if (bool) {
				$('#loading').show();
			}else{
				$('#loading').hide();
			}
		}
	});
	
	$(".formValidate").validationEngine({
			validationEventTriggers:"keyup blur",					
			inlineValidation: true,	
			scroll:false,
			unbindEngine:true,
			ajaxSubmit: false,
			promptPosition: "topRight" //topLeft, topRight, bottomLeft, centerRight, bottomRight
	})
	$(".popup").colorbox({width:"85%", height:"85%", iframe:true});
	$(".popupSM").colorbox({maxHeight:"90%", maxWidth:"90%"});
	
	//FAQ
	$("dd, .dd").hide();
	$("dt, .dt").bind('click', function(){
		$("dd, .dd").hide();
		var theDT = $(this);
		$(this).next().toggle(500, function(){
			$('html,body').animate({scrollTop: theDT.offset().top},1000);
		});
	});
	
	$(".dt").prepend(" &raquo; ");
	//end faq
	
	$('.tip').tipsy({gravity: 'w'});
	$('.tipTop').tipsy({gravity: 's'});
	$('.tipLeft').tipsy({gravity: 'e'});
	$('.tipBot').tipsy({gravity: 'n'});
	
	// MAIN MENU SCRIPT //
	/*
	$('.mainMenu li').hover(function() { 
		$('a', this).addClass('active');
		$('ul li a', this).removeClass('active');
		$('ul', this).slideDown(150); 
	},function() { 
		$('a', this).removeClass('active');
		$('ul', this).slideUp(10).hide();
	});
	*/
	// END MAIN MENU SCRIPT //
	$('.rotator').cycle({
      speed:       600,
      timeout:     6000,
      pager:      '#rotatorNav',
      pagerEvent: 'mouseover',
      fastOnEvent: true
    });
	
	//TABS
	//Default Action
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content
	$("ul.tabs li").click(function() {
		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active content
		return false;
	});
	// END TABS//
	$('.vTicker').vTicker({
	   speed: 1000,
	   pause: 5000,
	   showItems: 1,
	   animation: 'fade',
	   mousePause: true
	});
});