$(document).ready(function()
{
	// frontpage slider
	$("#slideController").jFlow({
		slides: "#slides",  // the div where all your sliding divs are nested in
		controller: ".jFlowControl", // must be class, use . sign  
		slideWrapper : "#jFlowSlide", // must be id, use # sign  
		selectedWrapper: "jFlowSelected",  // just pure text, no sign  
		width: "700px",  // this is the width for the content-slider  
		height: "400px",  // this is the height for the content-slider  
		duration: 200,  // time in miliseconds to transition one slide  
		prev: ".jFlowPrev", // must be class, use . sign  
		next: ".jFlowNext" // must be class, use . sign
	});



	
	$('<div class="tl"></div><div class="tr"></div><div class="bl"></div><div class="br"></div>').appendTo("div.single-field");


	// contact form validation
	$("#contactForm").validate({
		rules: {
			client_name: "required",
			client_email: {
				required: true,
				email: true
			},
			message: "required",
			captcha: "required"
		},
		messages: {
			client_name: "",
			client_email: "",
			message: "",
			captcha: ""
		}
	});
	

	$( '#bundle-item-tiny li' ).mouseover(
		function(){
			$( "#bundle-slides div" ).hide();
			$( '#bundle-item' + $( this ).attr( 'id' ).replace( 'switch', '' ) ).show();
		}
	);
	//$( '#bundle-item-tiny li' ).mouseout(
		//function(){
			//$( "#bundle-slides div" ).hide();
		//}
	//);
	
	$('a.newsThumb').lightBox(); // Select all links with lightbox class

});
/*
* Author:      Marco Kuiper (http://www.marcofolio.net/)
*/

google.setOnLoadCallback(function()
{
	// Safely inject CSS3 and give the search results a shadow
	var cssObj = { 'box-shadow' : '#888 5px 10px 10px', // Added when CSS3 is standard
		'-webkit-box-shadow' : '#888 5px 10px 10px', // Safari
		'-moz-box-shadow' : '#888 5px 10px 10px'}; // Firefox 3.5+
	$("#search-suggestions").css(cssObj);
	
	// Fade out the suggestions box when not active
	 $("#inputString").blur(function(){
	 	$('#search-suggestions').fadeOut();
	 });
});

function lookup(inputString) {
	if(inputString.length == 0) {
		$('#suggestions').fadeOut(); // Hide the suggestions box
	} else {
		$.post("/search/lite", {queryString: ""+inputString+""}, function(data) { // Do an AJAX call
			$('#search-suggestions').fadeIn(); // Show the suggestions box
			$('#search-suggestions').html(data); // Fill the suggestions box
		});
	}
}