function showMainService( main_service_id, internet ) {
	
	showInputFields();
	
	internet = ( !internet ) ? false : true;
	
	$.ajax( {
		
		url: root_url + '?act=js/services&main_service=' + main_service_id + '&internet=' + internet + '&json=1',
		dataType: 'json',
		success: function( result ) {
			
			//if ( result.related_services_count > 0 ) {
				
				$( '#service_list' ).html( '' ).html( result.html );
				$( '#service_selection_block' ).show();
				
				if ( typeof updateIframeHeight != 'undefined' ) {
					
					updateIframeHeight();
				}
			//} else {
				
				//checkStep();
			//}
		}
	} );
	
	if ( typeof updateIframeHeight != 'undefined' ) {
		
		updateIframeHeight();
	}
}

function selectServiceCheckbox( checkbox_element, service_id ) {
	
	var service_input = $( '#service_input_' + service_id );
	var url = root_url + '?act=js/services&service=' + service_id + '&';
	
	if ( typeof service_input.get( 0 ) != 'undefined' ) {
		
		url += 'status=' + checkbox_element.checked + '&flight_no=' + service_input.val();
	} else {
		
		url += 'status=' + checkbox_element.checked;
	}
	
	$.ajax( {
		
		url: url,
		success: function( result ) {
			
			$( '#service_list' ).html( '' ).html( result );
			$( '#service_selection_block' ).show();
		}
	} );
	
	if ( typeof updateIframeHeight != 'undefined' ) {
		
		updateIframeHeight();
	}
}

function submitServicesForm() {
	
	if ( typeof $( '#service_d_form' ).get( 0 ) != 'undefined' ) {
						
		var url = root_url + '?act=js/services';
		var serialized_data = $( '#service_d_form' ).serialize();
		
		if ( serialized_data.length != 0 ) {
			
			url += '&' + serialized_data;
		}
		
		$.ajax( {
			
			url: url,
			success: function( result ) {
				
				$( '#service_list' ).html( '' ).html( result );
				$( '#service_selection_block' ).show();
			}
		} );
	}
}

function resetText( element ) {
	
	if ( element.value == flight_no_text ) {
		
		element.value = '';
	}
}

function setText( element ) {
	
	if ( element.value == '' ) {
		
		element.value = flight_no_text;
	}
}

function blurInput( id, str ) {
	var el = $( '#' + id );
	if ( el.attr( 'value' ) == '' ) {
		el.attr( 'value', str );
	} else if ( el.attr( 'value' ) == str ) {
		el.attr( 'value', '' );
	}
	return false;
}

function updateFinalPrice( price ) {
	
	$( '#final_price_span, #cnt_price_final' ).html( '' ).text( price + ' ' + site_lt );
}

function hideInputFields() {
	
	$( '#form_plate_td, #form_plate_repeat_td, #form_plate_2_td, #form_plate_repeat_2_td' ).hide();
	$( '#form_phone_asterisk' ).html( '*' );
}

function showInputFields() {
	
	$( '#form_plate_td, #form_plate_repeat_td, #form_plate_2_td, #form_plate_repeat_2_td' ).show();
	$( '#form_phone_asterisk' ).html( '' );
}