$(document).ready(function() {
		   
	$('.to_top').click(function(){ 
		$('html, body').animate({scrollTop:0}, 'slow');
		return false; 
	}); 


});

function addIdea($cat_id)
{
	$('#addIdea' + $cat_id).slideToggle('slow');
}

function submitIdea($form_id)
{
	$form_id = '#' + $form_id;	
	
	$idea_text = $($form_id + " input[name=idea]").val();
	$site = $($form_id + " input[name=site]").val();
	$cat_id = $($form_id + " input[name=cat_id]").val();

	$url = '/processForms.php?type=addIdea&site=' + $site + '&cat_id=' + $cat_id + '&idea_text=' + $idea_text;
	
	// Original form data
	$origForm = $('#addIdea' + $cat_id).html();
	
	$.getJSON($url,
	function(data)
	{
		if (data[0] == true)
		{
			data[1] = '<div class="container success">' + data[1] + '</div>';
			
			$('#addIdea' + $cat_id).slideToggle('slow');
			setTimeout(function() { $('#addIdea' + $cat_id).html(data[1]).slideToggle('slow'); }, 600); 
		}
		else
		{
			data[1] = '<div class="container error">' + data[1] + '</div>';
			
			$('#addIdea' + $cat_id).slideToggle('slow');
			setTimeout(function() { $('#addIdea' + $cat_id).html(data[1]).slideToggle('slow'); }, 600);

		}

	});
}

