function	clear_field(form, field) {
	
	jQuery('input[name=' + field + ']').val('');
	
}


function 	checkvalues() {
	
	var ph1 	= jQuery('#callformphone1').attr('value');
	
	var ph2 	= jQuery('#callformphone2').attr('value');
	
	var ph3 	= jQuery('#callformphone3').attr('value');
	
	if ( ( ph1.length < 3 || ph2.length < 3 || ph3.length < 4 ) || ( isNaN(ph1) || isNaN(ph2) || isNaN(ph3) ) ) {
		
		jQuery('#call-error').html('Incorrect phone number');
		
		return false;
		
	} else if ( jQuery('#callformname').attr('value') == '' ) {

		jQuery('#call-error').html('Incorrect name');
		
		return false;

	} else if ( jQuery('#callformcode').attr('value') == '' ) {

		jQuery('#call-error').html('Incorrect captcha');
		
		return false;
		
	} else if ( jQuery('#callformcode').attr('value') != '' ) {
		
		// Validate captcha
		var data = jQuery.ajax( {
					
			url		: 'includes/captcha/securecaptcha.php?callformcode=' + jQuery('#callformcode').attr('value'),
					
			async	: false
					
		} ).responseText;


		if ( data != 'valid' ) {
		
			jQuery('#call-error').html('Incorrect captcha');
			
			return false;
			
		} else {

			jQuery('#call-error').html('');
			
			return true;

		}

	} else {
	
		return true;
		
	}
	
}


jQuery(document).ready( function() {
								 
	jQuery('#call-link').click( function() {
										 
		jQuery('.call-form').slideToggle("fast");
		
		
		return false;
	
	} );

} );
