 function my_kwicks(){
    $('.kwicks').kwicks({
		duration: 300, 
	    max: 160,  
        spacing:  0  ,

    });
}  

function stardust(){
		
	$('#flash').flash(
		{ src: "images/particles.swf",
			  width: 190,
			  height: 100,
			  wmode: "transparent",
			  }, 
			  	{ update: false }
	);	
		
		

}

function my_smothscroll(){
	$('a[href*=#]').click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
		&& location.hostname == this.hostname) {
		  var $target = $(this.hash);
		  $target = $target.length && $target
		  || $('[name=' + this.hash.slice(1) +']');
		  if ($target.length) {
			var targetOffset = $target.offset().top;
			$('html,body')
			.animate({scrollTop: targetOffset}, 700);
		   return false;
		  }
		}
	  });
	
}


function handleEnter (field, event) {
			var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
			if (keyCode == 13) {
				var i;
				for (i = 0; i < field.form.elements.length; i++)
					if (field == field.form.elements[i])
						break;
				i = (i + 1) % field.form.elements.length;
				field.form.elements[i].focus();
				return false;
			} 
			else
			return true;
	} 
	
	
	
	
	
	


function theRotator() {
	//Set the position of all images to hidden (left: -660)
	$('div#rotator ul li').css({left:-660});
	
	//Get the first image and slide it to view (gets set to left: 0)
	$('div#rotator ul li:first').css({left: 0});
		
	//Call the rotator function to run the slideshow, 6000 = change to next image after 6 seconds
	setInterval('rotate()',5000);
	
}
 
function rotate() {	
	//Get the first image
	var current = ($('div#rotator ul li.show')?  $('div#rotator ul li.show') : $('div#rotator ul li:first'));
 
	//Get next image, when it reaches the end, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('div#rotator ul li:first') :current.next()) : $('div#rotator ul li:first'));	
	
	//Set the fade in effect for the next image, the show class has higher z-index
	next.css({left: -660})
	.addClass('show')
	.animate({left: 0}, 700);
 
	//Hide the current image
	current.animate({left: -660}, 700)
	.removeClass('show');
	
};


 $(document).ready(function(){					
	my_kwicks();
	stardust();
	my_smothscroll();
	$("div#slider1").codaSlider();
	theRotator();
	
	
	
});
 
   
	


