// JavaScript Document
// 2011 Unbank
// Script by First Scribe


	// Keeps slider centered
	function sizeLayer()
	{
	 var divSize = 2000;
	 var layerSize = (document.documentElement.clientWidth - divSize)/2;
	 if ($(window).width() <= '1000') {	 $('#splash').css({left: '-470px'}); }
	 else {$('#splash').css({ left: layerSize + 30 + 'px' }); }
	} 


$(window).load(function() {
	
	// Centers slider on load and eliminates 'flash' of the slider in the wrong position
	sizeLayer();
	$('#splash').delay(100).show();
	
});


$(document).ready(function() {		
	
	// Recenters slider on window resize
	$(window).bind('resize', sizeLayer);
	
	
	// Slider controls and effects
	$('#splash').cycle({
		pause: 		0,
		timeout: 	5000,
		fx:			'fade',
		speed:		1000,
		startingSlide: Math.floor(Math.random()*3)
	});
	
	// Search value rewrites
	$('#search-query').bind('click change focus', function() {
		var str = $(this).val();
		if (str == "Site Search") {$('#search-query').val("");}
	});
	$('#search-query').blur(function(){
		var str = $(this).val();
		if (str == "") { $('#search-query').val("Site Search");}
	}); 
});
