function clearForm(oForm) {
  var elements = oForm.elements; 
    
  oForm.reset();
	for(i=0; i<elements.length; i++) {
		field_type = elements[i].type.toLowerCase();

		switch(field_type) {
			case "text":
			case "password":
			case "textarea":
			case "hidden":
				elements[i].value = ""; 
				break;

			case "radio":
			case "checkbox":
				if (elements[i].checked) {
					elements[i].checked = false; 
				}
				break;

			case "select-one":
			case "select-multi":
				elements[i].selectedIndex = -1;
				break;

			default: 
				break;
		}
	}
}

$(document).ready(function() {

	$(".client-logo-reel a:first").addClass("active");

	//Get size of the image, how many images there are, then determine the size of the image reel.
	var imageWidth = $(".client-window").width();
	var imageSum = $(".client-logo-reel img").size();
	var imageReelWidth = imageWidth * imageSum;
	
	//Adjust the image reel to its new size
	$(".client-logo-reel").css({'width' : imageReelWidth});

	rotate = function(){
		var triggerID = $active.attr("rel") - 1; //Get number of times to slide
		var image_reelPosition = triggerID * imageWidth; //Determines the distance the image reel needs to slide

		$(".client-logo-reel a").removeClass('active'); //Remove all active class
		$active.addClass('active'); //Add active class (the $active is declared in the rotateSwitch function)
		
		//Slider Animation
		$(".client-logo-reel").animate({
				left: -image_reelPosition
		}, 500 );
	}; 

	//Rotation  and Timing Event
	rotateSwitch = function(){
		play = setInterval(function(){ //Set timer - this will repeat itself every 7 seconds
			$active = $('.client-logo-reel a.active').next();
			if ( $active.length === 0) { //If paging reaches the end...
				$active = $('.client-logo-reel a:first'); //go back to first
			}
			rotate(); //Trigger the paging and slider function
		}, 3000); //Timer speed in milliseconds (3 seconds)
	};

	rotateSwitch(); //Run function on launch

	//On Hover
	$(".client-logo-reel a").hover(function() {
		clearInterval(play); //Stop the rotation
	}, function() {
		rotateSwitch(); //Resume rotation
	});	

});


