// JavaScript Document

	 $.noConflict();
	  jQuery(document).ready(function($) {
		// Code that uses jQuery's $ can follow here.
	
		$("ul.subnav").parent().append(); //Only shows drop down trigger when js is enabled - Adds empty span tag after ul.subnav
		
		$("ul.topnav li a").hover(function() { //When trigger is clicked...
			
			//Following events are applied to the subnav itself (moving subnav up and down)
			$(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click
	
			$(this).parent().hover(function() {
			}, function(){	
				$(this).parent().find("ul.subnav").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up
			});
	
			//Following events are applied to the trigger (Hover events for the trigger)
			}).hover(function() { 
				$(this).addClass("subhover"); //On hover over, add class "subhover"
			}, function(){	//On Hover Out
				$(this).removeClass("subhover"); //On hover out, remove class "subhover"
	
	});
		
		
	 // jQuery Form Validator
	  
		$(document).ready(function() {
		$("#commentForm").validate({meta: "validate"});
		
	  });
	  
	  
	});
	  
	 
	  
	  // Code that uses other library's $ can follow here.
	   
	  var slideTimer;
		var slideConstant	= 309;
		var direction		= -1;
		var position		= 0;
		var initialPosition = true;
	
		Event.observe(window,'load',function() {
			Event.observe('slider_arrow_left', 'click',
				function(event) {															
						if (position < 0) {
							initialPosition = false;
							position++;
							new Effect.Move('page_body_overview_widget_container_inner', { x: slideConstant * position, mode: 'absolute', queue: 'end' });
							new Effect.Move('dot_underlay', { x: (359 - (10 * position)), y: 128, mode: 'absolute' });						
						}
					}
				);
				Event.observe('slider_arrow_right', 'click',
					function(event) {		
						if (position > -2) {					
							initialPosition = false;
							position--;
							new Effect.Move('page_body_overview_widget_container_inner', { x: slideConstant * position, mode: 'absolute', queue: 'end' });
							new Effect.Move('dot_underlay', { x: (359 - (10 * position)), y: 128, mode: 'absolute' });					
						}					
					}
				);
				slideTimer = setInterval(function() {			
					position += direction;
					if (initialPosition == false) {
						if (position <= -2) {
							position = -2;
						}
						else if (position >= 0)	{
							position = 0;						
						}					
						if (position == -2 || position == 0){
							direction *= -1;
							var queue = Effect.Queues.get('global').each(function(effect) { effect.cancel(); });
						}										
					}
					else {					
						initialPosition = false;					
					}
					new Effect.Move('page_body_overview_widget_container_inner', { x: (slideConstant * position), mode: 'absolute', queue: 'end' });
					new Effect.Move('dot_underlay', { x: (359 - (10 * position)), y: 128, mode: 'absolute' });
				},
				8000
				);
			}
		); 
	  
