$(document).ready(function() {
	
	// Open external links in new Window/Tab
	$("a[href^='http:']").not("[href*='" + window.location.host + "']").attr('target','_blank');
	$("a[href$='.pdf']").attr('target','_blank'); 
	
	// New Slideshow Functions
	if (document.getElementById('slides')) {
		$('#slides').innerfade({
			speed: 1000,
			timeout: 6000,
			type: 'sequence',
			containerheight: '351px',
			slide_timer_on: 'yes',
			slide_ui_parent: 'slides',
			slide_ui_text: 'slide-desc',
			pause_button_id: 'pause_button',
			slide_nav_id: 'slide_nav'
		});
		$.setOptionsButtonEvent();
	}
	
	// Lightbox
	$(".iframe").fancybox({
		'hideOnContentClick': false,
		'titleShow': false,
		'width': 700,
		'height': 430
	});
	
	$(".fancybox").fancybox({
		'hideOnContentClick': true,
		'titleShow': true 
	});
	
	// Form Validation
	if (document.getElementById('contact-form')) {
		$("#contact-form").validationEngine({
			
		});
	};
	
	// Sliding Doors Button Fade Like a Total Baller
	$('.button').each(function () {
		$(this).wrapInner('<span>');
		$('span', this).addClass('sd');
		$(this).append('<span class="hover"></span><span class="sd2"></span>');
		var thisHover = $(".hover", this);
		$('.sd', this).clone().removeClass('sd').addClass('overlay').appendTo(thisHover);
		var $span = $('> span.hover', this).css('opacity', 0);
		var $span2 = $('> span.sd2', this).css('opacity', 0);
		$(this).hover(function () {
			$span.stop().fadeTo(200, 1);
			$span2.stop().fadeTo(200, 1);
		}, function () {
			$span.stop().fadeTo(200, 0);
			$span2.stop().fadeTo(200, 0);
		});
	});
	
	// Input value switcher
	$('#s').focus(function () {
		if ($(this).val() == 'Search Learning Center') {
			$(this).val('');
			$(this).css({'color' : '#124d7a', 'font-weight' : 'bold'}); //active
		}
	});
	
	$('#s').blur(function () {
		if ($(this).val() == '') {
			$(this).val('Search Learning Center');
			$(this).css({'color' : '#a2a2a2', 'font-weight' : 'normal'}); //inactive
		}
	});
	
});
