var ajax_json_parameters = {
	dataType:		'json', 
	beforeSubmit:	function(){ $('#ajax_loading').show(); },
	resetForm:		true,
	
	success:		function(data){
					
					if(window.ajax_json_success_prefunction != undefined)
					ajax_json_success_prefunction(data);
					
						$.each(data, function(key, value){
							if(key=='js'){
								eval(value);
							}
							else if(key=='html'){
								$.each(value, function(html_id, html_contents){
								
								var target = "#" + html_id;
								$(target).html(html_contents);
								
								if(!$(target).size())
								alert('ajax error: element ' + html_id + ' not found');
								
								});
							}
						});
						
					$('#ajax_loading').hide();
					
					if(window.ajax_json_success_postfunction != undefined)
					ajax_json_success_postfunction(data);
					
					},
					
	error:			function(request_object, status_text){
						$('#loading').hide();
						alert(status_text + request_object.responseText);
					}
}

function xconfirm(){
	return confirm('are you sure?');
}

function post_send(url, field, value){
	$('#post_send_field_1')[0].name = field;
	$('#post_send_field_1')[0].value = value;
	$('#post_send_form')[0].action = url;
	$('#post_send_form')[0].submit();
}

var app = function() {
	return {
		confirm : function() {
			return confirm('are you sure?');
		}
	};
}();


function div_scroll(the_obj, move, container_height, save_to_cookie){

margin = $(the_obj).css('marginTop');
// get margin without px
margin = margin.substring(0, margin.length-2);

// get current margin
current_margin = parseInt(margin);
//console.log('current ' + margin);

// get next margin
margin = parseInt(margin) + move;
//console.log('next ' + margin);
//console.log('height ' + $(the_obj).height());

// get object height
the_obj_height = $(the_obj).height();

// dont scroll down if already at bottom
if( ( container_height - current_margin > the_obj_height ) && ( move < 0 ) ){
	return;
}

//dont scroll up if already at top
if(margin>0)
return;

  if(move > 0){
  move_new = '+=' + move + 'px';
  }
  else{
  move = move * -1;
  move_new = '-=' + move + 'px';
  }
	
$(the_obj).animate({'marginTop': move_new}, 'slow');
}
