	$(function(){

		// Media test
		$('a.media').media( { width: 300, height: 20 } );

		// Slider
		$("select.slider").each(function() {
			$(this).selectToUISlider({labelSrc: 'text', tooltip: true, labels: 2}).hide();
		});
		
		// Lead form
		$("#lead_form").validate();
		
		// Survey form
		$("#survey_form").validate();
		
		// End form
		$("#end-review").validate();
		
		
		//if there's an element with the class 'q-radio', alter the margin on it's parent 'question' wrapper and associated label
		$(".q-radio").parent().parent().css("margin-bottom","30px");
		$(".q-radio").siblings("label").css("margin-bottom","10px");
		
		$(".dropdown").parent().parent().css("margin-bottom","30px");
		$(".dropdown").siblings("label").css("margin-bottom","6px");
	
  
  
  
		//make sure the 'sidebar-button' never overlaps the sidebar content
		//first check for the 'sidebar-button' class			
		if($(".sidebar-button").length != 0) {
			//if it's there, make sure '#col-l' is always taller than '#sidebar'
			var collheight = $("#col-l").height();
			var sidebarheight = $("#sidebar").height();		

/* 			alert(collheight + ' ' + sidebarheight); */

			if(sidebarheight >= (collheight-180)) {
				$("#col-l").css("height", sidebarheight+180);
			}
		}

	
	
		//end buttons
		
		/*$("#eb1").hover(			
			function () {
				if($(this).hasClass('eb-on') != true) {$(this).css("background-position","0 -49px");};}, 
			function () {
				if($(this).hasClass('eb-on') != true) {$(this).css("background-position","0 0");};}			
		);
		
		$("#eb2").hover(			
			function () {
				if($(this).hasClass('eb-on') != true) {$(this).css("background-position","-187px -49px");};}, 
			function () {
				if($(this).hasClass('eb-on') != true) {$(this).css("background-position","-187px 0");};}			
		);
		
		$("#eb3").hover(			
			function () {
				if($(this).hasClass('eb-on') != true) {$(this).css("background-position","-374px -49px");};}, 
			function () {
				if($(this).hasClass('eb-on') != true) {$(this).css("background-position","-374px 0");};}			
		);
		
		$("#eb4").hover(			
			function () {
				if($(this).hasClass('eb-on') != true) {$(this).css("background-position","-561px -49px");};}, 
			function () {
				if($(this).hasClass('eb-on') != true) {$(this).css("background-position","-561px 0");};}			
		);*/
		
		
		/*$(".eb").hover(			
			function () {
				if($(this).hasClass('eb-on') != true) {
					if($(this).hasClass('eb1') == true) {"background-position","0 -49px"};
					if($(this).hasClass('eb2') == true) {"background-position","-187px -49px"};
					if($(this).hasClass('eb3') == true) {"background-position","-374px -49px"};
					if($(this).hasClass('eb4') == true) {"background-position","-561px -49px"};
				};				
			}, 
			function () {
				if($(this).hasClass('eb-on') != true) {
					if($(this).hasClass('eb1') == true) {"background-position","0 0"};
					if($(this).hasClass('eb2') == true) {"background-position","-187px 0"};
					if($(this).hasClass('eb3') == true) {"background-position","-374px 0"};
					if($(this).hasClass('eb4') == true) {"background-position","-561px 0"};					
				};
			}			
		);*/
		
		
		$("#opinion").hide();
		
		function uncheckAll() {
			//$(this).css("background-position","0 -98px");
			$(".eb1").css("background-position","0 0");
			$(".eb2").css("background-position","-187px 0");
			$(".eb3").css("background-position","-374px 0");
			$(".eb4").css("background-position","-561px 0");
		};
		
		
		$(".eb1").click(			
			function () {uncheckAll();$(this).css("background-position","0 -98px");$("#opinion").val("A waste of time!");}			
		);
		$(".eb2").click(			
			function () {uncheckAll();$(this).css("background-position","-187px -98px");$("#opinion").val("OK");}			
		);
		$(".eb3").click(			
			function () {uncheckAll();$(this).css("background-position","-374px -98px");$("#opinion").val("Useful");}			
		);
		$(".eb4").click(			
			function () {uncheckAll();$(this).css("background-position","-561px -98px");$("#opinion").val("Very Helpful!");}			
		);
		
		
		
		
/*
		// Wizard
		$("#survey_form").formwizard({ //wizard settings 
		 	formPluginEnabled: false, //Ajax is used to post the form to the server
		 	validationEnabled : true, //The Validation plugin is used for validating the form at each step
		 	focusFirstInput : true // puts focus at the first input on each step
		 },
		 {
			//validation settings
			messages: {	email: "Invalid email (custom message)"} // custom message shown when the email is invalid
		 },
		 {
			// form plugin settings
			

			target: '#survey_content', 
      success: function() { 
          $('#survey_content').fadeIn('slow'); 
      },

			

			success: function(data){ // called when the form has been submitted correctly to the server
				alert(data);
				$("#status").html(data);
				//$("#status").fadeTo(500,1,function(){ $(this).html("You are now registered!").fadeTo(5000, 0); })
			},
			beforeSubmit:  function(data){ // called just before the form is submitted
				$("#data").html("Data sent to the server : <br />" + $.param(data));
			},
			dataType: 'json',

			resetForm: true
		 }
		);
		*/
	});


