/*
* @bigboss common script
*/
//jQuery(document).ready(function() {jQuery('.cmbtimepicker').timepicker({'timeFormat': 'H:i','disableTimeRanges': disabled_hours});});
jQuery(document).ready(function() {jQuery('.cmbtimepicker').timepicker({'timeFormat': 'H:i'});});

function cmbPopupSubmit() {
	var cmb_name = '';
	var cmb_email = '';
	var cmb_phone = '';
	var cmb_message = '';
	var cmb_from = '00:00';
	var cmb_to = '00:00';
	var cmb_continue = true;
	jQuery(".cmb-errors").hide();
	if(jQuery("#cmb_name").length > 0) {
		cmb_name = cmb_js_trim(jQuery("#cmb_name").val());
		if(jQuery("#cmb_name").attr("data-required") == '1' && jQuery("#cmb_name").val() == '') {
			jQuery("#cmb_name_info").show();
			jQuery("#cmb_name").focus();
			cmb_continue = false;
		}
	}
	if(jQuery("#cmb_email").length > 0 && cmb_continue) {
		cmb_email = cmb_js_trim(jQuery("#cmb_email").val());
		if(jQuery("#cmb_email").attr("data-required") == '1' && jQuery("#cmb_email").val() == '') {
			jQuery("#cmb_email_info").show();
			jQuery("#cmb_email").focus();
			cmb_continue = false;
		}
	}
	if(jQuery("#cmb_phone").length > 0 && cmb_continue) {
		cmb_phone = cmb_js_trim(jQuery("#cmb_phone").val());
		if(jQuery("#cmb_phone").attr("data-required") == '1' && jQuery("#cmb_phone").val() == '') {
			jQuery("#cmb_phone_info").show();
			jQuery("#cmb_phone").focus();
			cmb_continue = false;
		}
	}
	if(jQuery("#cmb_message").length > 0 && cmb_continue) {
		cmb_message = cmb_js_trim(jQuery("#cmb_message").val());
		if(jQuery("#cmb_message").attr("data-required") == '1' && jQuery("#cmb_message").val() == '') {
			jQuery("#cmb_message_info").show();
			jQuery("#cmb_message").focus();
			cmb_continue = false;
		}
	}
	if(jQuery("#cmb_call_from").length > 0 && cmb_continue) {
		cmb_from = cmb_js_trim(jQuery("#cmb_call_from").val());
		if(jQuery("#cmb_call_from").attr("data-required") == '1' && jQuery("#cmb_call_from").val() == '00:00') {
			jQuery("#cmb_from_info").show();
			jQuery("#cmb_call_from").focus();
			cmb_continue = false;
		}
	}
	if(jQuery("#cmb_call_to").length > 0 && cmb_continue) {
		cmb_to = cmb_js_trim(jQuery("#cmb_call_to").val());
		if(jQuery("#cmb_call_to").attr("data-required") == '1' && jQuery("#cmb_call_to").val() == '00:00') {
			jQuery("#cmb_to_info").show();
			jQuery("#cmb_call_to").focus();
			cmb_continue = false;
		}
	}
	if(cmb_continue) {
		//ajax form submit
		jQuery(".cmb_loader").show();
		jQuery.ajax({
			type: "POST",
			url:jQuery("#cmb_ajax_post_url").val(),
			data : {
				'action': 'cmb_data_post',
				'name':cmb_name,
				'email':cmb_email,
				'phone':cmb_phone,
				'message':cmb_message,
				'from':cmb_from,
				'to':cmb_to
			},
			success: function(response){
				jQuery(".cmb_loader").hide();
				alert(jQuery("#cmb_call_success_text").val());
				jQuery(".cmb-modal-box, .cmb-modal-overlay").fadeOut(500, function() {
					jQuery(".cmb-modal-overlay").remove();
				});
			}
		});
	}
}
function cmbWidgetSubmit() {
	var cmb_name = '';
	var cmb_email = '';
	var cmb_phone = '';
	var cmb_message = '';
	var cmb_from = '00:00';
	var cmb_to = '00:00';
	var cmb_continue = true;
	jQuery(".cmb-w-errors").hide();
	if(jQuery("#cmb_w_name").length > 0) {
		cmb_name = cmb_js_trim(jQuery("#cmb_w_name").val());
		if(jQuery("#cmb_w_name").attr("data-required") == '1' && jQuery("#cmb_w_name").val() == '') {
			jQuery("#cmb_w_name_info").show();
			jQuery("#cmb_w_name").focus();
			cmb_continue = false;
		}
	}
	if(jQuery("#cmb_w_email").length > 0 && cmb_continue) {
		cmb_email = cmb_js_trim(jQuery("#cmb_w_email").val());
		if(jQuery("#cmb_w_email").attr("data-required") == '1' && jQuery("#cmb_w_email").val() == '') {
			jQuery("#cmb_w_email_info").show();
			jQuery("#cmb_w_email").focus();
			cmb_continue = false;
		}
	}
	if(jQuery("#cmb_w_phone").length > 0 && cmb_continue) {
		cmb_phone = cmb_js_trim(jQuery("#cmb_w_phone").val());
		if(jQuery("#cmb_w_phone").attr("data-required") == '1' && jQuery("#cmb_w_phone").val() == '') {
			jQuery("#cmb_w_phone_info").show();
			jQuery("#cmb_w_phone").focus();
			cmb_continue = false;
		}
	}
	if(jQuery("#cmb_w_message").length > 0 && cmb_continue) {
		cmb_message = cmb_js_trim(jQuery("#cmb_w_message").val());
		if(jQuery("#cmb_w_message").attr("data-required") == '1' && jQuery("#cmb_w_message").val() == '') {
			jQuery("#cmb_w_message_info").show();
			jQuery("#cmb_w_message").focus();
			cmb_continue = false;
		}
	}
	if(jQuery("#cmb_w_from").length > 0 && cmb_continue) {
		cmb_from = cmb_js_trim(jQuery("#cmb_w_from").val());
		if(jQuery("#cmb_w_from").attr("data-required") == '1' && jQuery("#cmb_w_from").val() == '') {
			jQuery("#cmb_w_from_info").show();
			jQuery("#cmb_w_from").focus();
			cmb_continue = false;
		}
	}
	if(jQuery("#cmb_w_to").length > 0 && cmb_continue) {
		cmb_to = cmb_js_trim(jQuery("#cmb_w_to").val());
		if(jQuery("#cmb_w_to").attr("data-required") == '1' && jQuery("#cmb_w_to").val() == '') {
			jQuery("#cmb_w_to_info").show();
			jQuery("#cmb_w_to").focus();
			cmb_continue = false;
		}
	}
	if(cmb_continue) {
		//ajax form submit
		jQuery(".cmb_w_loader").show();
		jQuery.ajax({
			type: "POST",
			url:jQuery("#cmb_ajax_post_w_url").val(),
			data : {
				'action': 'cmb_data_post',
				'name':cmb_name,
				'email':cmb_email,
				'phone':cmb_phone,
				'message':cmb_message,
				'from':cmb_from,
				'to':cmb_to
			},
			success: function(response){
				jQuery(".cmb_w_loader").hide();
				jQuery(".cmb-container").hide();
				jQuery(".cmb_w_success_box").show();
			}
		});
	}
}
function cmb_js_trim(str){
	return str.replace(/^\s+|\s+$/g,"");
}