/*




This is the function that attached the Javascript functions to the page
*/

document.observe('dom:loaded', init);


function init(){

	if ($('rotating_image'))
		new SlideShow('rotating_image', { delay: 2 });
	
	/*
	
	
	#PrimaryNav Drop Down show's the first ul child
	*/
	$$("#PrimaryNav li").each(function(node, i){

		var node = $(node);

		if(node.select("ul").length > 0){

			var ul = node.select("ul").first();
			
			var toggleStuff = function(){
				node.toggleClassName("hover");
				ul.toggle();
			};
			
			node.observe('mouseover', toggleStuff).observe('mouseout', toggleStuff);						 

		}
		
	});
	

	/*
	
	
	
	Nullify # links
		$$("a").each(function(node, i){
		var node = $(node);
		if(node.href.indexOf("#") != -1){
			node.observe('click', function(e){
				$(e.target).blur();
				e.stop();
		  });
		}
	});
	*/

	/*
	
	
	
	Forms
	*/
		/*
		
		
		
		Focus on an input
		*/
		$$("form input").each(function(node, i){
			var node = $(node);
			var toggleStuff = function(){
				node.toggleClassName("focus");
			};
			node.observe('focus', toggleStuff).observe('blur', toggleStuff);
		});

	
}
