$(document).ready(function() {
	
	// Testimonials
	if (document.getElementById('testimonials')) {
		$("#controller").jFlow({
			slides: "#testimonials",
			width: "700px",
			height: "210px"
		});
	};
	
	// Lightbox
	$(".iframe").fancybox({
		'hideOnContentClick': false,
		'titleShow': false
	});
	
	$(".fancybox").fancybox({
		'hideOnContentClick': true,
		'titleShow': true
	});
	
	$(".modal").fancybox({
		'type': 'iframe',
		'hideOnContentClick': false,
		'hideOnOverlayClick': false,
		'enableEscapeButton': false,
		'titleShow': false,
		'width': 800,
		'height': 430
	});
	
	// Form Validation
	if (document.getElementById('contact-form')) {
		$("#contact-form").validationEngine({
			
		});
	};
	
	// Fade
	$('.fadeThis').append('<span class="hover"></span>').each(function () {
		var $span = $('> span.hover', this).css('opacity', 0);
		$(this).hover(function () {
			$span.stop().fadeTo(300, 1);
		}, function () {
			$span.stop().fadeTo(300, 0);
		});
	});
	
	// Input value switcher
	$('#id input').focus(function () {
		if ($('#id input').val() == 'Value') {
			$('#id input').val('');
			$('#id input').css({'color' : '#124d7a', 'font-weight' : 'bold'}); //active
		}
	});
	
	$('#id input').blur(function () {
		if ($('#id input').val() == '') {
			$('#id input').val('Value');
			$('#id input').css({'color' : '#a2a2a2', 'font-weight' : 'normal'}); //inactive
		}
	});
	
});

$(window).bind("load", function() {
	$('#slideshow').nivoSlider({
		effect:'fade',
		animSpeed:1000,
		pauseTime:6000,
		startSlide:0,
		slices: 1,
		directionNav:false,
		controlNav:true,
		pauseOnHover:false
	});
});
