//initialize it
function init_hidden_form(){

	//make sure it exists
	if(!$('a.hidden_form, button.hidden_form').length){
		//if nothing, get outta here
		return;
	}
	
	//insert the empty form at the end of the body
	$('body').append('<div style="display: none;"><form name="action_form" method="post" action="#" id="action_form"></form></div>');
	
	//handle the a.model clicks
	$('a.hidden_form, button.hidden_form').click(function(){
	
		$hidden_form = $('#action_form');
	
		//check the href
		var $the_link = $(this).attr('href');
		
		//get the values and put them into an object
		var $the_values = $(this).attr('values');
		//alert($the_values);
		var obj = eval('(' + $the_values + ')');
		
		$.each(obj, function(key, value) { 
			$hidden_form.append('<input type="hidden" name="'+key+'" value="'+value+'" />');
		});
		
		$hidden_form.attr('action', $the_link);
		
		$hidden_form.submit();
		
		//no active link and don't follow the link
		this.blur();
		return false;
	
	});
	
}

//start up the modal stuff
$(document).ready(function(){
	init_hidden_form();
});