function loadBlock( url, container ) {
	if ( !url || !container ) return;
	$( '#' + container ).load( url );
};
function submitForm( form_id, response_container ) {
	action = $( '#' + form_id ).attr( 'action' );
	fields = $( '#' + form_id ).serialize();
	$( '#' + response_container ).load( action, fields );
};
$.fn.clearForm = function() {
	return this.each( function() {
		var type = this.type, tag = this.tagName.toLowerCase();
		if ( tag == 'form' ) {
			return $( ':input', this ).clearForm();
		}
		if ( type == 'text' || type == 'password' || tag == 'textarea' ) {
			this.value = '';
		} else if ( type == 'checkbox' || type == 'radio' ) {
			this.checked = false;
		} else if ( tag == 'select' ) {
			this.selectedIndex = 0;
		}
	});
};
function formatPlateNumber( obj_input ) {
	
	obj_input.value = obj_input.value.toUpperCase();
	obj_input.value = obj_input.value.replace( /[ ]/g, '' );
};
function disableButton( button_id, btn_place_id, loader_place_id ) {

	if ( button_id ) {
		$( '#' + button_id ).attr( 'disabled', true );
		$( '#' + button_id ).css( 'cursor', 'default' );
	}
	$( '#' + btn_place_id ).hide();
	$( '#' + loader_place_id ).show();
};
function enableButton( button_id, btn_place_id, loader_place_id ) {

	if ( button_id ) {
	
		$( '#' + button_id ).removeAttr( 'disabled' );
		$( '#' + button_id ).css( 'cursor', 'pointer' );
	}
	
	$( '#' + btn_place_id ).show();
	$( '#' + loader_place_id ).hide();

};
function stuffJSONToSelect( select_id, data ) {

	var obj_select = $( "#" + select_id )[0];
	var count = obj_select.options.length;
	for ( var i = 0; i < count ; i++ ) {
	
		obj_select.remove( 0 );
	}
	
	for ( i in data ) {

		var option = document.createElement('option');
		option.value = i;
		option.text = data[ i ];
		
		if ( $.browser.msie ) {
			
			obj_select.add( option );
		} else {
		
			obj_select.add( option, null );
		}
	};
};