public function execute()
 {
     $task = WDW_CFM_Library::get('task');
     $id = WDW_CFM_Library::get('current_id', 0);
     $message = WDW_CFM_Library::get('message');
     echo WDW_CFM_Library::message_id($message);
     if (method_exists($this, $task)) {
         check_admin_referer('nonce_cfm', 'nonce_cfm');
         $this->{$task}($id);
     } else {
         $this->display();
     }
 }
function contact_form_maker_ajax()
{
    require_once WD_CFM_DIR . '/framework/WDW_CFM_Library.php';
    $page = WDW_CFM_Library::get('action');
    if ($page != 'ContactFormmakerwdcaptcha') {
        if (function_exists('current_user_can')) {
            if (!current_user_can('manage_options')) {
                die('Access Denied');
            }
        } else {
            die('Access Denied');
        }
    }
    if ($page != '') {
        require_once WD_CFM_DIR . '/admin/controllers/CFMController' . ucfirst($page) . '.php';
        $controller_class = 'CFMController' . ucfirst($page);
        $controller = new $controller_class();
        $controller->execute();
    }
}
    public function display($id)
    {
        $form_maker_front_end = "";
        $result = $this->model->showform($id);
        if (!$result) {
            return;
        }
        $ok = $this->model->savedata($result[0], $id);
        if (is_numeric($ok)) {
            $this->model->remove($ok);
        }
        $row = $result[0];
        $label_id = $result[2];
        $label_type = $result[3];
        $form_theme = $result[4];
        if (isset($_SESSION['cfm_form_submit_type' . $id])) {
            $type_and_id = $_SESSION['cfm_form_submit_type' . $id];
            $type_and_id = explode(',', $type_and_id);
            $form_get_type = $type_and_id[0];
            $form_get_id = isset($type_and_id[1]) ? $type_and_id[1] : '';
            $_SESSION['cfm_form_submit_type' . $id] = 0;
            if ($form_get_type == 3) {
                $_SESSION['cfm_massage_after_submit' . $id] = "";
                $after_submission_text = $this->model->get_after_submission_text($form_get_id);
                require_once WD_CFM_DIR . '/framework/WDW_CFM_Library.php';
                $form_maker_front_end .= WDW_CFM_Library::message(wpautop(html_entity_decode($after_submission_text)), 'warning', $id);
                return $form_maker_front_end;
            }
        }
        if (isset($_SESSION['cfm_massage_after_submit' . $id]) && $_SESSION['cfm_massage_after_submit' . $id] != "") {
            $message = $_SESSION['cfm_massage_after_submit' . $id];
            $_SESSION['cfm_massage_after_submit' . $id] = "";
            if ($_SESSION['cfm_error_or_no' . $id]) {
                $error = 'error';
            } else {
                $error = 'warning';
            }
            require_once WD_CFM_DIR . '/framework/WDW_CFM_Library.php';
            $form_maker_front_end .= WDW_CFM_Library::message($message, $error, $id);
        }
        if (isset($_SESSION['show_submit_text' . $id])) {
            if ($_SESSION['show_submit_text' . $id] == 1) {
                $_SESSION['show_submit_text' . $id] = 0;
                $form_maker_front_end .= $row->submit_text;
                return;
            }
        }
        $this->model->increment_views_count($id);
        $new_form_theme = explode('{', $form_theme);
        $count_after_explod_theme = count($new_form_theme);
        for ($i = 0; $i < $count_after_explod_theme; $i++) {
            $body_or_classes[$i] = explode('}', $new_form_theme[$i]);
        }
        for ($i = 0; $i < $count_after_explod_theme; $i++) {
            if ($i == 0) {
                $body_or_classes[$i][0] = ".contactform" . $id . ' ' . str_replace(',', ", .contactform" . $id, $body_or_classes[$i][0]);
            } else {
                $body_or_classes[$i][1] = ".contactform" . $id . ' ' . str_replace(',', ", .contactform" . $id, $body_or_classes[$i][1]);
            }
        }
        for ($i = 0; $i < $count_after_explod_theme; $i++) {
            $body_or_classes_implode[$i] = implode('}', $body_or_classes[$i]);
        }
        $form_theme = implode('{', $body_or_classes_implode);
        $form_maker_front_end .= '<style class="cfm_style">' . str_replace('[SITE_ROOT]', WD_CFM_URL, $form_theme) . '</style>';
        $check_js = '';
        $onload_js = '';
        $onsubmit_js = '';
        $form_maker_front_end .= '<form name="contactform' . $id . '" action="' . $_SERVER['REQUEST_URI'] . '" method="post" id="contactform' . $id . '" class="contactform' . $id . '" enctype="multipart/form-data" onsubmit="check_required(\'submit\', \'' . $id . '\'); return false;">
      <input type="hidden" id="counter' . $id . '" value="' . $row->counter . '" name="counter' . $id . '" />
      <input type="hidden" id="Itemid' . $id . '" value="" name="Itemid' . $id . '" />';
        $is_type = array();
        $id1s = array();
        $types = array();
        $labels = array();
        $paramss = array();
        $required_sym = $row->requiredmark;
        $fields = explode('*:*new_field*:*', $row->form_fields);
        $fields = array_slice($fields, 0, count($fields) - 1);
        $disabled_fields = explode(',', $row->disabled_fields);
        $disabled_fields = array_slice($disabled_fields, 0, count($disabled_fields) - 1);
        foreach ($fields as $field) {
            $temp = explode('*:*id*:*', $field);
            array_push($id1s, $temp[0]);
            $temp = explode('*:*type*:*', $temp[1]);
            array_push($types, $temp[0]);
            $temp = explode('*:*w_field_label*:*', $temp[1]);
            array_push($labels, $temp[0]);
            array_push($paramss, $temp[1]);
        }
        $form_id = $id;
        if ($row->autogen_layout == 0) {
            $form = $row->custom_front;
        } else {
            $form = $row->form_front;
        }
        foreach ($id1s as $id1s_key => $id1) {
            $label = $labels[$id1s_key];
            $type = $types[$id1s_key];
            $params = $paramss[$id1s_key];
            if (strpos($form, '%' . $id1 . ' - ' . $label . '%') || strpos($form, '%' . $id1 . ' -' . $label . '%')) {
                $rep = '';
                $required = FALSE;
                $param = array();
                $param['attributes'] = '';
                $is_type[$type] = TRUE;
                if (!in_array($id1, $disabled_fields)) {
                    switch ($type) {
                        case 'type_section_break':
                            $params_names = array('w_editor');
                            $temp = $params;
                            foreach ($params_names as $params_name) {
                                $temp = explode('*:*' . $params_name . '*:*', $temp);
                                $param[$params_name] = $temp[0];
                                $temp = $temp[1];
                            }
                            $rep = '<div type="type_section_break" class="wdform-field-section-break"><div class="wdform_section_break">' . html_entity_decode($param['w_editor']) . '</div></div>';
                            break;
                        case 'type_editor':
                            $params_names = array('w_editor');
                            $temp = $params;
                            foreach ($params_names as $params_name) {
                                $temp = explode('*:*' . $params_name . '*:*', $temp);
                                $param[$params_name] = $temp[0];
                                $temp = $temp[1];
                            }
                            $rep = '<div type="type_editor" class="wdform-field">' . html_entity_decode($param['w_editor']) . '</div>';
                            break;
                        case 'type_send_copy':
                            $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_first_val', 'w_required');
                            $temp = $params;
                            foreach ($params_names as $params_name) {
                                $temp = explode('*:*' . $params_name . '*:*', $temp);
                                $param[$params_name] = $temp[0];
                                $temp = $temp[1];
                            }
                            if ($temp) {
                                $temp = explode('*:*w_attr_name*:*', $temp);
                                $attrs = array_slice($temp, 0, count($temp) - 1);
                                foreach ($attrs as $attr) {
                                    $param['attributes'] = $param['attributes'] . ' ' . $attr;
                                }
                            }
                            $input_active = $param['w_first_val'] == 'true' ? "checked='checked'" : "";
                            $post_value = isset($_POST["counter" . $form_id]) ? $_POST["counter" . $form_id] : NULL;
                            if (isset($post_value)) {
                                $post_temp = isset($_POST['wdform_' . $id1 . '_element' . $form_id]) ? $_POST['wdform_' . $id1 . '_element' . $form_id] : NULL;
                                $input_active = isset($post_temp) ? "checked='checked'" : "";
                            }
                            $param['w_field_label_pos1'] = $param['w_field_label_pos'] == "left" ? "float: left;" : "";
                            $param['w_field_label_pos2'] = $param['w_field_label_pos'] == "left" ? "" : "display: block;";
                            $required = $param['w_required'] == "yes" ? TRUE : FALSE;
                            $rep = '<div type="type_send_copy" class="wdform-field"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . ' width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label"><label for="wdform_' . $id1 . '_element' . $form_id . '">' . $label . '</label></span>';
                            if ($required) {
                                $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
                            }
                            $rep .= '</div>
              <div class="wdform-element-section" style="min-width:inherit !important; ' . $param['w_field_label_pos2'] . '" >
                <div class="checkbox-div" style="left:3px">
                <input type="checkbox" id="wdform_' . $id1 . '_element' . $form_id . '" name="wdform_' . $id1 . '_element' . $form_id . '" ' . $input_active . ' ' . $param['attributes'] . '/>
                <label for="wdform_' . $id1 . '_element' . $form_id . '"></label>
                </div>
              </div></div>';
                            $onsubmit_js .= '
              if (!jQuery("#wdform_' . $id1 . '_element' . $form_id . '").is(":checked")) {
                jQuery("<input type=\\"hidden\\" name=\\"wdform_send_copy_' . $form_id . '\\" value = \\"1\\" />").appendTo("#contactform' . $form_id . '");
              }';
                            if ($required) {
                                $check_js .= '
                if (x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0) {
                  if (x.find(jQuery("div[wdid=' . $id1 . '] input:checked")).length == 0) {
                    alert("' . addslashes($label . ' ' . __('field is required.', 'contact_form_maker')) . '");
                    old_bg=x.find(jQuery("div[wdid=' . $id1 . ']")).css("background-color");
                    x.find(jQuery("div[wdid=' . $id1 . ']")).effect( "shake", {}, 500 ).css("background-color","#FF8F8B").animate({backgroundColor: old_bg}, {duration: 500, queue: false });
                    return false;
                  }						
                }';
                            }
                            break;
                        case 'type_text':
                            $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_first_val', 'w_title', 'w_required', 'w_unique');
                            $temp = $params;
                            if (strpos($temp, 'w_regExp_status') > -1) {
                                $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_first_val', 'w_title', 'w_required', 'w_regExp_status', 'w_regExp_value', 'w_regExp_common', 'w_regExp_arg', 'w_regExp_alert', 'w_unique');
                            }
                            foreach ($params_names as $params_name) {
                                $temp = explode('*:*' . $params_name . '*:*', $temp);
                                $param[$params_name] = $temp[0];
                                $temp = $temp[1];
                            }
                            if ($temp) {
                                $temp = explode('*:*w_attr_name*:*', $temp);
                                $attrs = array_slice($temp, 0, count($temp) - 1);
                                foreach ($attrs as $attr) {
                                    $param['attributes'] = $param['attributes'] . ' ' . $attr;
                                }
                            }
                            $param['w_first_val'] = isset($_POST['wdform_' . $id1 . '_element' . $form_id]) ? $_POST['wdform_' . $id1 . '_element' . $form_id] : $param['w_first_val'];
                            $wdformfieldsize = $param['w_field_label_pos'] == "left" ? $param['w_field_label_size'] + $param['w_size'] + 10 : max($param['w_field_label_size'], $param['w_size']);
                            $param['w_field_label_pos1'] = $param['w_field_label_pos'] == "left" ? "float: left;" : "";
                            $param['w_field_label_pos2'] = $param['w_field_label_pos'] == "left" ? "" : "display: block;";
                            $input_active = $param['w_first_val'] == $param['w_title'] ? "input_deactive" : "input_active";
                            $required = $param['w_required'] == "yes" ? TRUE : FALSE;
                            $param['w_regExp_status'] = isset($param['w_regExp_status']) ? $param['w_regExp_status'] : "no";
                            $rep = '<div type="type_text" class="wdform-field" style="width:' . $wdformfieldsize . 'px"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . ' width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
                            if ($required) {
                                $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
                            }
                            $rep .= '</div><div class="wdform-element-section" style="' . $param['w_field_label_pos2'] . ' width: ' . $param['w_size'] . 'px;"  ><input type="text" class="' . $input_active . '" id="wdform_' . $id1 . '_element' . $form_id . '" name="wdform_' . $id1 . '_element' . $form_id . '" value="' . $param['w_first_val'] . '" title="' . $param['w_title'] . '"  style="width: 100%;" ' . $param['attributes'] . '></div></div>';
                            if ($required) {
                                $check_js .= '
                if (x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0) {
                  if (jQuery("#wdform_' . $id1 . '_element' . $form_id . '").val()=="' . $param['w_title'] . '" || jQuery("#wdform_' . $id1 . '_element' . $form_id . '").val()=="") {
                    alert("' . addslashes($label . ' ' . __('field is required.', 'contact_form_maker')) . '");
                    jQuery("#wdform_' . $id1 . '_element' . $form_id . '").addClass( "form-error" );
                    old_bg=x.find(jQuery("div[wdid=' . $id1 . ']")).css("background-color");
                    x.find(jQuery("div[wdid=' . $id1 . ']")).effect( "shake", {}, 500 ).css("background-color","#FF8F8B").animate({backgroundColor: old_bg}, {duration: 500, queue: false });
                    jQuery("#wdform_' . $id1 . '_element' . $form_id . '").focus();
                    jQuery("#wdform_' . $id1 . '_element' . $form_id . '").change(function() { if( jQuery(this).val()!="" ) jQuery(this).removeClass("form-error"); else jQuery(this).addClass("form-error");});
                    return false;
                  }
                }';
                            }
                            if ($param['w_regExp_status'] == 'yes') {
                                $check_js .= '
				       	  var RegExpression = "";
					        var rules = unescape("' . $param["w_regExp_value"] . '");
  		      	    ("' . $param["w_regExp_arg"] . '".length <= 0) ?  RegExpression = new RegExp(rules) : RegExpression = new RegExp(rules' . ', "' . $param["w_regExp_arg"] . '");
			        	  if (jQuery("#wdform_' . $id1 . '_element' . $form_id . '").val().length > 0) {
                    if (RegExpression.test(jQuery("#wdform_' . $id1 . '_element' . $form_id . '").val()) != true) {
                      alert(" ' . $param["w_regExp_alert"] . ' ");
                      old_bg = x.find(jQuery("div[wdid=' . $id1 . ']")).css("background-color");
                      x.find(jQuery("div[wdid=' . $id1 . ']")).effect( "shake", {}, 500 ).css("background-color","#FF8F8B").animate({backgroundColor: old_bg}, {duration: 500, queue: false });
                      jQuery("#wdform_' . $id1 . '_element' . $form_id . '").addClass("form-error");
                      jQuery("#wdform_' . $id1 . '_element' . $form_id . '").focus();
                      jQuery("#wdform_' . $id1 . '_element' . $form_id . '").change(function() { if( jQuery(this).val()!="" ) jQuery(this).removeClass("form-error"); else jQuery(this).addClass("form-error");});
                      return false;
                    }
                  }';
                            }
                            break;
                        case 'type_number':
                            $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_first_val', 'w_title', 'w_required', 'w_unique', 'w_class');
                            $temp = $params;
                            foreach ($params_names as $params_name) {
                                $temp = explode('*:*' . $params_name . '*:*', $temp);
                                $param[$params_name] = $temp[0];
                                $temp = $temp[1];
                            }
                            if ($temp) {
                                $temp = explode('*:*w_attr_name*:*', $temp);
                                $attrs = array_slice($temp, 0, count($temp) - 1);
                                foreach ($attrs as $attr) {
                                    $param['attributes'] = $param['attributes'] . ' ' . $attr;
                                }
                            }
                            $param['w_first_val'] = isset($_POST['wdform_' . $id1 . '_element' . $form_id]) ? $_POST['wdform_' . $id1 . '_element' . $form_id] : $param['w_first_val'];
                            $wdformfieldsize = $param['w_field_label_pos'] == "left" ? $param['w_field_label_size'] + $param['w_size'] + 10 : max($param['w_field_label_size'], $param['w_size']);
                            $param['w_field_label_pos1'] = $param['w_field_label_pos'] == "left" ? "float: left;" : "";
                            $param['w_field_label_pos2'] = $param['w_field_label_pos'] == "left" ? "" : "display:block;";
                            $input_active = $param['w_first_val'] == $param['w_title'] ? "input_deactive" : "input_active";
                            $required = $param['w_required'] == "yes" ? TRUE : FALSE;
                            $rep = '<div type="type_number" class="wdform-field" style="width:' . $wdformfieldsize . 'px"><div class="wdform-label-section"  class="' . $param['w_class'] . '" style="' . $param['w_field_label_pos1'] . ' width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
                            if ($required) {
                                $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
                            }
                            $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ' width: ' . $param['w_size'] . 'px;"><input type="text" class="' . $input_active . '" id="wdform_' . $id1 . '_element' . $form_id . '" name="wdform_' . $id1 . '_element' . $form_id . '" value="' . $param['w_first_val'] . '" title="' . $param['w_title'] . '" style="width: 100%;" ' . $param['attributes'] . '></div></div>';
                            if ($required) {
                                $check_js .= '
                if (x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0) {
                  if (jQuery("#wdform_' . $id1 . '_element' . $form_id . '").val()=="' . $param['w_title'] . '" || jQuery("#wdform_' . $id1 . '_element' . $form_id . '").val()=="") {
                    alert("' . addslashes($label . ' ' . __('field is required.', 'contact_form_maker')) . '");
                    jQuery("#wdform_' . $id1 . '_element' . $form_id . '").addClass( "form-error" );
                    old_bg=x.find(jQuery("div[wdid=' . $id1 . ']")).css("background-color");
                    x.find(jQuery("div[wdid=' . $id1 . ']")).effect( "shake", {}, 500 ).css("background-color","#FF8F8B").animate({backgroundColor: old_bg}, {duration: 500, queue: false });
                    jQuery("#wdform_' . $id1 . '_element' . $form_id . '").focus();
                    jQuery("#wdform_' . $id1 . '_element' . $form_id . '").change(function() { if( jQuery(this).val()!="" ) jQuery(this).removeClass("form-error"); else jQuery(this).addClass("form-error");});
                    return false;
                  }
                }';
                            }
                            break;
                        case 'type_password':
                            $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_required', 'w_unique', 'w_class');
                            $temp = $params;
                            foreach ($params_names as $params_name) {
                                $temp = explode('*:*' . $params_name . '*:*', $temp);
                                $param[$params_name] = $temp[0];
                                $temp = $temp[1];
                            }
                            if ($temp) {
                                $temp = explode('*:*w_attr_name*:*', $temp);
                                $attrs = array_slice($temp, 0, count($temp) - 1);
                                foreach ($attrs as $attr) {
                                    $param['attributes'] = $param['attributes'] . ' ' . $attr;
                                }
                            }
                            $wdformfieldsize = $param['w_field_label_pos'] == "left" ? $param['w_field_label_size'] + $param['w_size'] + 10 : max($param['w_field_label_size'], $param['w_size']);
                            $param['w_field_label_pos1'] = $param['w_field_label_pos'] == "left" ? "float: left;" : "";
                            $param['w_field_label_pos2'] = $param['w_field_label_pos'] == "left" ? "" : "display: block;";
                            $required = $param['w_required'] == "yes" ? TRUE : FALSE;
                            $rep = '<div type="type_password" class="wdform-field" style="width:' . $wdformfieldsize . 'px"><div class="wdform-label-section"  class="' . $param['w_class'] . '" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
                            if ($required) {
                                $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
                            }
                            $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ' width: ' . $param['w_size'] . 'px;"><input type="password" id="wdform_' . $id1 . '_element' . $form_id . '" name="wdform_' . $id1 . '_element' . $form_id . '" style="width: 100%;" ' . $param['attributes'] . '></div></div>';
                            if ($required) {
                                $check_js .= '
                if (x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0) {
                  if (jQuery("#wdform_' . $id1 . '_element' . $form_id . '").val()=="") {
                    alert("' . addslashes($label . ' ' . __('field is required.', 'contact_form_maker')) . '");
                    jQuery("#wdform_' . $id1 . '_element' . $form_id . '").addClass( "form-error" );
                    old_bg=x.find(jQuery("div[wdid=' . $id1 . ']")).css("background-color");
                    x.find(jQuery("div[wdid=' . $id1 . ']")).effect( "shake", {}, 500 ).css("background-color","#FF8F8B").animate({backgroundColor: old_bg}, {duration: 500, queue: false });
                    jQuery("#wdform_' . $id1 . '_element' . $form_id . '").focus();
                    jQuery("#wdform_' . $id1 . '_element' . $form_id . '").change(function() { if( jQuery(this).val()!="" ) jQuery(this).removeClass("form-error"); else jQuery(this).addClass("form-error");});
                    return false;
                  }
                }';
                            }
                            break;
                        case 'type_textarea':
                            $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size_w', 'w_size_h', 'w_first_val', 'w_title', 'w_required', 'w_unique', 'w_class');
                            $temp = $params;
                            foreach ($params_names as $params_name) {
                                $temp = explode('*:*' . $params_name . '*:*', $temp);
                                $param[$params_name] = $temp[0];
                                $temp = $temp[1];
                            }
                            if ($temp) {
                                $temp = explode('*:*w_attr_name*:*', $temp);
                                $attrs = array_slice($temp, 0, count($temp) - 1);
                                foreach ($attrs as $attr) {
                                    $param['attributes'] = $param['attributes'] . ' ' . $attr;
                                }
                            }
                            $param['w_first_val'] = isset($_POST['wdform_' . $id1 . '_element' . $form_id]) ? $_POST['wdform_' . $id1 . '_element' . $form_id] : $param['w_first_val'];
                            $wdformfieldsize = $param['w_field_label_pos'] == "left" ? $param['w_field_label_size'] + $param['w_size_w'] + 10 : max($param['w_field_label_size'], $param['w_size_w']);
                            $param['w_field_label_pos1'] = $param['w_field_label_pos'] == "left" ? "float: left;" : "";
                            $param['w_field_label_pos2'] = $param['w_field_label_pos'] == "left" ? "" : "display:block;";
                            $input_active = $param['w_first_val'] == $param['w_title'] ? "input_deactive" : "input_active";
                            $required = $param['w_required'] == "yes" ? TRUE : FALSE;
                            $rep = '<div type="type_textarea" class="wdform-field"  style="width:' . $wdformfieldsize . 'px"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
                            if ($required) {
                                $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
                            }
                            $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ' width: ' . $param['w_size_w'] . 'px"><textarea class="' . $input_active . '" id="wdform_' . $id1 . '_element' . $form_id . '" name="wdform_' . $id1 . '_element' . $form_id . '" title="' . $param['w_title'] . '"  style="width: 100%; height: ' . $param['w_size_h'] . 'px;" ' . $param['attributes'] . '>' . $param['w_first_val'] . '</textarea></div></div>';
                            if ($required) {
                                $check_js .= '
                if (x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0) {
                  if (jQuery("#wdform_' . $id1 . '_element' . $form_id . '").val()=="' . $param['w_title'] . '" || jQuery("#wdform_' . $id1 . '_element' . $form_id . '").val()=="") {
                    alert("' . addslashes($label . ' ' . __('field is required.', 'contact_form_maker')) . '");
                    jQuery("#wdform_' . $id1 . '_element' . $form_id . '").addClass( "form-error" );
                    old_bg=x.find(jQuery("div[wdid=' . $id1 . ']")).css("background-color");
                    x.find(jQuery("div[wdid=' . $id1 . ']")).effect( "shake", {}, 500 ).css("background-color","#FF8F8B").animate({backgroundColor: old_bg}, {duration: 500, queue: false });
                    jQuery("#wdform_' . $id1 . '_element' . $form_id . '").focus();
                    jQuery("#wdform_' . $id1 . '_element' . $form_id . '").change(function() { if( jQuery(this).val()!="" ) jQuery(this).removeClass("form-error"); else jQuery(this).addClass("form-error");});
                    return false;
                  }
                }';
                            }
                            break;
                        case 'type_wdeditor':
                            $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size_w', 'w_size_h', 'w_title', 'w_required', 'w_class');
                            $temp = $params;
                            foreach ($params_names as $params_name) {
                                $temp = explode('*:*' . $params_name . '*:*', $temp);
                                $param[$params_name] = $temp[0];
                                $temp = $temp[1];
                            }
                            if ($temp) {
                                $temp = explode('*:*w_attr_name*:*', $temp);
                                $attrs = array_slice($temp, 0, count($temp) - 1);
                                foreach ($attrs as $attr) {
                                    $param['attributes'] = $param['attributes'] . ' ' . $attr;
                                }
                            }
                            $wdformfieldsize = $param['w_field_label_pos'] == "left" ? $param['w_field_label_size'] + $param['w_size_w'] + 10 : max($param['w_field_label_size'], $param['w_size_w']);
                            $param['w_field_label_pos1'] = $param['w_field_label_pos'] == "left" ? "float: left;" : "";
                            $param['w_field_label_pos2'] = $param['w_field_label_pos'] == "left" ? "" : "display: block;";
                            $required = $param['w_required'] == "yes" ? TRUE : FALSE;
                            $rep = '<div type="type_wdeditor" class="wdform-field"  style="width:' . $wdformfieldsize . 'px"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
                            if ($required) {
                                $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
                            }
                            $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ' width: ' . $param['w_size_w'] . 'px">';
                            if (user_can_richedit()) {
                                ob_start();
                                wp_editor($param['w_title'], 'wdform_' . $id1 . '_wd_editor' . $form_id, array('teeny' => FALSE, 'media_buttons' => FALSE, 'textarea_rows' => 5));
                                $wd_editor = ob_get_clean();
                            } else {
                                $wd_editor = '<textarea  class="' . $param['w_class'] . '" name="wdform_' . $id1 . '_wd_editor' . $form_id . '" id="wdform_' . $id1 . '_wd_editor' . $form_id . '" style="width: ' . $param['w_size_w'] . 'px; height: ' . $param['w_size_h'] . 'px; " class="mce_editable" aria-hidden="true">' . $param['w_title'] . '</textarea>';
                            }
                            $rep .= $wd_editor . '</div></div>';
                            if ($required) {
                                $check_js .= '
                if (x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0) {
                  if (tinyMCE.get("wdform_' . $id1 . '_wd_editor' . $form_id . '").getContent()=="") {
                    alert("' . addslashes($label . ' ' . __('field is required.', 'contact_form_maker')) . '");
                    jQuery("#wdform_' . $id1 . '_wd_editor' . $form_id . '").addClass( "form-error" );
                    old_bg=x.find(jQuery("div[wdid=' . $id1 . ']")).css("background-color");
                    x.find(jQuery("div[wdid=' . $id1 . ']")).effect( "shake", {}, 500 ).css("background-color","#FF8F8B").animate({backgroundColor: old_bg}, {duration: 500, queue: false });
                    jQuery("#wdform_' . $id1 . '_wd_editor' . $form_id . '").focus();
                    jQuery("#wdform_' . $id1 . '_wd_editor' . $form_id . '").change(function() { if( jQuery(this).val()!="" ) jQuery(this).removeClass("form-error"); else jQuery(this).addClass("form-error");});
                    return false;
                  }
                }';
                            }
                            break;
                        case 'type_phone':
                            $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_first_val', 'w_title', 'w_mini_labels', 'w_required', 'w_unique', 'w_class');
                            $temp = $params;
                            foreach ($params_names as $params_name) {
                                $temp = explode('*:*' . $params_name . '*:*', $temp);
                                $param[$params_name] = $temp[0];
                                $temp = $temp[1];
                            }
                            if ($temp) {
                                $temp = explode('*:*w_attr_name*:*', $temp);
                                $attrs = array_slice($temp, 0, count($temp) - 1);
                                foreach ($attrs as $attr) {
                                    $param['attributes'] = $param['attributes'] . ' ' . $attr;
                                }
                            }
                            $w_first_val = explode('***', $param['w_first_val']);
                            $w_title = explode('***', $param['w_title']);
                            $param['w_first_val'] = (isset($_POST['wdform_' . $id1 . '_element_first' . $form_id]) ? $_POST['wdform_' . $id1 . '_element_first' . $form_id] : $w_first_val[0]) . '***' . (isset($_POST['wdform_' . $id1 . '_element_last' . $form_id]) ? $_POST['wdform_' . $id1 . '_element_last' . $form_id] : $w_first_val[1]);
                            $wdformfieldsize = $param['w_field_label_pos'] == "left" ? $param['w_field_label_size'] + $param['w_size'] + 65 : max($param['w_field_label_size'], $param['w_size'] + 65);
                            $param['w_field_label_pos1'] = $param['w_field_label_pos'] == "left" ? "float: left;" : "";
                            $param['w_field_label_pos2'] = $param['w_field_label_pos'] == "left" ? "" : "display:block;";
                            $input_active = $param['w_first_val'] == $param['w_title'] ? "input_deactive" : "input_active";
                            $required = $param['w_required'] == "yes" ? TRUE : FALSE;
                            $w_first_val = explode('***', $param['w_first_val']);
                            $w_title = explode('***', $param['w_title']);
                            $w_mini_labels = explode('***', $param['w_mini_labels']);
                            $rep = '<div type="type_phone" class="wdform-field" style="width:' . $wdformfieldsize . 'px"><div class="wdform-label-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label" >' . $label . '</span>';
                            if ($required) {
                                $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
                            }
                            $rep .= '
              </div>
              <div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ' width: ' . ($param['w_size'] + 65) . 'px;">
                <div style="display: table-cell;vertical-align: middle;">
                  <div><input type="text" class="' . $input_active . '" id="wdform_' . $id1 . '_element_first' . $form_id . '" name="wdform_' . $id1 . '_element_first' . $form_id . '" value="' . $w_first_val[0] . '" title="' . $w_title[0] . '" style="width: 50px;" ' . $param['attributes'] . '></div>
                  <div><label class="mini_label">' . $w_mini_labels[0] . '</label></div>
                </div>
                <div style="display: table-cell;vertical-align: middle;">
                  <div class="wdform_line" style="margin: 0px 4px 10px 4px; padding: 0px;">-</div>
                </div>
                <div style="display: table-cell;vertical-align: middle; width:100%;">
                  <div><input type="text" class="' . $input_active . '" id="wdform_' . $id1 . '_element_last' . $form_id . '" name="wdform_' . $id1 . '_element_last' . $form_id . '" value="' . $w_first_val[1] . '" title="' . $w_title[1] . '" style="width: 100%;" ' . $param['attributes'] . '></div>
                  <div><label class="mini_label">' . $w_mini_labels[1] . '</label></div>
                </div>
              </div>
              </div>';
                            if ($required) {
                                $check_js .= '
                if (x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0) {
                  if (jQuery("#wdform_' . $id1 . '_element_first' . $form_id . '").val()=="' . $w_title[0] . '" || jQuery("#wdform_' . $id1 . '_element_first' . $form_id . '").val()=="" || jQuery("#wdform_' . $id1 . '_element_last' . $form_id . '").val()=="' . $w_title[1] . '" || jQuery("#wdform_' . $id1 . '_element_last' . $form_id . '").val()=="") {
                    alert("' . addslashes($label . ' ' . __('field is required.', 'contact_form_maker')) . '");
                    old_bg=x.find(jQuery("div[wdid=' . $id1 . ']")).css("background-color");
                    x.find(jQuery("div[wdid=' . $id1 . ']")).effect( "shake", {}, 500 ).css("background-color","#FF8F8B").animate({backgroundColor: old_bg}, {duration: 500, queue: false });
                    jQuery("#wdform_' . $id1 . '_element_first' . $form_id . '").focus();
                    return false;
                  }
                }';
                            }
                            break;
                        case 'type_name':
                            $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_first_val', 'w_title', 'w_mini_labels', 'w_size', 'w_name_format', 'w_required', 'w_unique', 'w_class');
                            $temp = $params;
                            foreach ($params_names as $params_name) {
                                $temp = explode('*:*' . $params_name . '*:*', $temp);
                                $param[$params_name] = $temp[0];
                                $temp = $temp[1];
                            }
                            if ($temp) {
                                $temp = explode('*:*w_attr_name*:*', $temp);
                                $attrs = array_slice($temp, 0, count($temp) - 1);
                                foreach ($attrs as $attr) {
                                    $param['attributes'] = $param['attributes'] . ' ' . $attr;
                                }
                            }
                            $w_first_val = explode('***', $param['w_first_val']);
                            $w_title = explode('***', $param['w_title']);
                            $w_mini_labels = explode('***', $param['w_mini_labels']);
                            $element_title = isset($_POST['wdform_' . $id1 . '_element_title' . $form_id]) ? $_POST['wdform_' . $id1 . '_element_title' . $form_id] : NULL;
                            $element_first = isset($_POST['wdform_' . $id1 . '_element_first' . $form_id]) ? $_POST['wdform_' . $id1 . '_element_first' . $form_id] : NULL;
                            if (isset($element_title)) {
                                $param['w_first_val'] = (isset($_POST['wdform_' . $id1 . '_element_title' . $form_id]) ? $_POST['wdform_' . $id1 . '_element_title' . $form_id] : $w_first_val[0]) . '***' . (isset($_POST['wdform_' . $id1 . '_element_first' . $form_id]) ? $_POST['wdform_' . $id1 . '_element_first' . $form_id] : $w_first_val[1]) . '***' . (isset($_POST['wdform_' . $id1 . '_element_last' . $form_id]) ? $_POST['wdform_' . $id1 . '_element_last' . $form_id] : $w_first_val[2]) . '***' . (isset($_POST['wdform_' . $id1 . '_element_middle' . $form_id]) ? $_POST['wdform_' . $id1 . '_element_middle' . $form_id] : $w_first_val[3]);
                            } else {
                                if (isset($element_first)) {
                                    $param['w_first_val'] = (isset($_POST['wdform_' . $id1 . '_element_first' . $form_id]) ? $_POST['wdform_' . $id1 . '_element_first' . $form_id] : $w_first_val[0]) . '***' . (isset($_POST['wdform_' . $id1 . '_element_last' . $form_id]) ? $_POST['wdform_' . $id1 . '_element_last' . $form_id] : $w_first_val[1]);
                                }
                            }
                            $input_active = $param['w_first_val'] == $param['w_title'] ? "input_deactive" : "input_active";
                            $required = $param['w_required'] == "yes" ? TRUE : FALSE;
                            $w_first_val = explode('***', $param['w_first_val']);
                            $w_title = explode('***', $param['w_title']);
                            if ($param['w_name_format'] == 'normal') {
                                $w_name_format = '
                <div style="display: table-cell; width:50%">
                  <div><input type="text" class="' . $input_active . '" id="wdform_' . $id1 . '_element_first' . $form_id . '" name="wdform_' . $id1 . '_element_first' . $form_id . '" value="' . $w_first_val[0] . '" title="' . $w_title[0] . '"  style="width: 100%;"' . $param['attributes'] . '></div>
                  <div><label class="mini_label">' . $w_mini_labels[1] . '</label></div>
                </div>
                <div style="display:table-cell;"><div style="margin: 0px 8px; padding: 0px;"></div></div>
                <div  style="display: table-cell; width:50%">
                  <div><input type="text" class="' . $input_active . '" id="wdform_' . $id1 . '_element_last' . $form_id . '" name="wdform_' . $id1 . '_element_last' . $form_id . '" value="' . $w_first_val[1] . '" title="' . $w_title[1] . '" style="width: 100%;" ' . $param['attributes'] . '></div>
                  <div><label class="mini_label">' . $w_mini_labels[2] . '</label></div>
                </div>';
                                $w_size = 2 * $param['w_size'];
                            } else {
                                $w_name_format = '
                <div style="display: table-cell;">
                  <div><input type="text" class="' . $input_active . '" id="wdform_' . $id1 . '_element_title' . $form_id . '" name="wdform_' . $id1 . '_element_title' . $form_id . '" value="' . $w_first_val[0] . '" title="' . $w_title[0] . '" style="width: 40px;"></div>
                  <div><label class="mini_label">' . $w_mini_labels[0] . '</label></div>
                </div>
                <div style="display:table-cell;"><div style="margin: 0px 1px; padding: 0px;"></div></div>
                <div style="display: table-cell; width:30%">
                  <div><input type="text" class="' . $input_active . '" id="wdform_' . $id1 . '_element_first' . $form_id . '" name="wdform_' . $id1 . '_element_first' . $form_id . '" value="' . $w_first_val[1] . '" title="' . $w_title[1] . '" style="width:100%;"></div>
                  <div><label class="mini_label">' . $w_mini_labels[1] . '</label></div>
                </div>
                <div style="display:table-cell;"><div style="margin: 0px 4px; padding: 0px;"></div></div>
                <div style="display: table-cell; width:30%">
                  <div><input type="text" class="' . $input_active . '" id="wdform_' . $id1 . '_element_last' . $form_id . '" name="wdform_' . $id1 . '_element_last' . $form_id . '" value="' . $w_first_val[2] . '" title="' . $w_title[2] . '" style="width:  100%;"></div>
                  <div><label class="mini_label">' . $w_mini_labels[2] . '</label></div>
                </div>
                <div style="display:table-cell;"><div style="margin: 0px 4px; padding: 0px;"></div></div>
                <div style="display: table-cell; width:30%">
                  <div><input type="text" class="' . $input_active . '" id="wdform_' . $id1 . '_element_middle' . $form_id . '" name="wdform_' . $id1 . '_element_middle' . $form_id . '" value="' . $w_first_val[3] . '" title="' . $w_title[3] . '" style="width: 100%;"></div>
                  <div><label class="mini_label">' . $w_mini_labels[3] . '</label></div>
                </div>';
                                $w_size = 3 * $param['w_size'] + 80;
                            }
                            $wdformfieldsize = $param['w_field_label_pos'] == "left" ? $param['w_field_label_size'] + $w_size : max($param['w_field_label_size'], $w_size);
                            $param['w_field_label_pos1'] = $param['w_field_label_pos'] == "left" ? "float: left;" : "";
                            $param['w_field_label_pos2'] = $param['w_field_label_pos'] == "left" ? "" : "display: block;";
                            $rep = '<div type="type_name" class="wdform-field"  style="width:' . $wdformfieldsize . 'px"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
                            if ($required) {
                                $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
                            }
                            $rep .= '</div>
              <div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ' width: ' . $w_size . 'px;">' . $w_name_format . '</div></div>';
                            if ($required) {
                                if ($param['w_name_format'] == 'normal') {
                                    $check_js .= '
                  if (x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0) {
                    if (jQuery("#wdform_' . $id1 . '_element_first' . $form_id . '").val()=="' . $w_title[0] . '" || jQuery("#wdform_' . $id1 . '_element_first' . $form_id . '").val()=="" || jQuery("#wdform_' . $id1 . '_element_last' . $form_id . '").val()=="' . $w_title[1] . '" || jQuery("#wdform_' . $id1 . '_element_last' . $form_id . '").val()=="") {
                      alert("' . addslashes($label . ' ' . __('field is required.', 'contact_form_maker')) . '");
                      old_bg=x.find(jQuery("div[wdid=' . $id1 . ']")).css("background-color");
                      x.find(jQuery("div[wdid=' . $id1 . ']")).effect( "shake", {}, 500 ).css("background-color","#FF8F8B").animate({backgroundColor: old_bg}, {duration: 500, queue: false });
                      jQuery("#wdform_' . $id1 . '_element_first' . $form_id . '").focus();
                      return false;
                    }
                  }';
                                } else {
                                    $check_js .= '
                  if (x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0) {
                    if (jQuery("#wdform_' . $id1 . '_element_title' . $form_id . '").val()=="' . $w_title[0] . '" || jQuery("#wdform_' . $id1 . '_element_title' . $form_id . '").val()=="" || jQuery("#wdform_' . $id1 . '_element_first' . $form_id . '").val()=="' . $w_title[1] . '" || jQuery("#wdform_' . $id1 . '_element_first' . $form_id . '").val()=="" || jQuery("#wdform_' . $id1 . '_element_last' . $form_id . '").val()=="' . $w_title[2] . '" || jQuery("#wdform_' . $id1 . '_element_last' . $form_id . '").val()=="" || jQuery("#wdform_' . $id1 . '_element_middle' . $form_id . '").val()=="' . $w_title[3] . '" || jQuery("#wdform_' . $id1 . '_element_middle' . $form_id . '").val()=="") {
                      alert("' . addslashes($label . ' ' . __('field is required.', 'contact_form_maker')) . '");
                      old_bg=x.find(jQuery("div[wdid=' . $id1 . ']")).css("background-color");
                      x.find(jQuery("div[wdid=' . $id1 . ']")).effect( "shake", {}, 500 ).css("background-color","#FF8F8B").animate({backgroundColor: old_bg}, {duration: 500, queue: false });
                      jQuery("#wdform_' . $id1 . '_element_first' . $form_id . '").focus();
                      return false;
                    }
                  }';
                                }
                            }
                            break;
                        case 'type_address':
                            $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_mini_labels', 'w_disabled_fields', 'w_required', 'w_class');
                            $temp = $params;
                            foreach ($params_names as $params_name) {
                                $temp = explode('*:*' . $params_name . '*:*', $temp);
                                $param[$params_name] = $temp[0];
                                $temp = $temp[1];
                            }
                            if ($temp) {
                                $temp = explode('*:*w_attr_name*:*', $temp);
                                $attrs = array_slice($temp, 0, count($temp) - 1);
                                foreach ($attrs as $attr) {
                                    $param['attributes'] = $param['attributes'] . ' ' . $attr;
                                }
                            }
                            $wdformfieldsize = $param['w_field_label_pos'] == "left" ? $param['w_field_label_size'] + $param['w_size'] : max($param['w_field_label_size'], $param['w_size']);
                            $param['w_field_label_pos1'] = $param['w_field_label_pos'] == "left" ? "float: left;" : "";
                            $param['w_field_label_pos2'] = $param['w_field_label_pos'] == "left" ? "" : "display: block;";
                            $required = $param['w_required'] == "yes" ? TRUE : FALSE;
                            $w_mini_labels = explode('***', $param['w_mini_labels']);
                            $w_disabled_fields = explode('***', $param['w_disabled_fields']);
                            $rep = '<div type="type_address" class="wdform-field"  style="width:' . $wdformfieldsize . 'px"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
                            if ($required) {
                                $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
                            }
                            $address_fields = '';
                            $g = 0;
                            if (isset($w_disabled_fields[0]) && $w_disabled_fields[0] == 'no') {
                                $g += 2;
                                $address_fields .= '<span style="float: left; width: 100%; padding-bottom: 8px; display: block;"><input type="text" id="wdform_' . $id1 . '_street1' . $form_id . '" name="wdform_' . $id1 . '_street1' . $form_id . '" value="' . (isset($_POST['wdform_' . $id1 . '_street1' . $form_id]) ? $_POST['wdform_' . $id1 . '_street1' . $form_id] : "") . '" style="width: 100%;" ' . $param['attributes'] . '><label class="mini_label" >' . $w_mini_labels[0] . '</label></span>';
                            }
                            if (isset($w_disabled_fields[1]) && $w_disabled_fields[1] == 'no') {
                                $g += 2;
                                $address_fields .= '<span style="float: left; width: 100%; padding-bottom: 8px; display: block;"><input type="text" id="wdform_' . $id1 . '_street2' . $form_id . '" name="wdform_' . ($id1 + 1) . '_street2' . $form_id . '" value="' . (isset($_POST['wdform_' . ($id1 + 1) . '_street2' . $form_id]) ? $_POST['wdform_' . ($id1 + 1) . '_street2' . $form_id] : "") . '" style="width: 100%;" ' . $param['attributes'] . '><label class="mini_label" >' . $w_mini_labels[1] . '</label></span>';
                            }
                            if (isset($w_disabled_fields[2]) && $w_disabled_fields[2] == 'no') {
                                $g++;
                                $address_fields .= '<span style="float: left; width: 48%; padding-bottom: 8px;"><input type="text" id="wdform_' . $id1 . '_city' . $form_id . '" name="wdform_' . ($id1 + 2) . '_city' . $form_id . '" value="' . (isset($_POST['wdform_' . ($id1 + 2) . '_city' . $form_id]) ? $_POST['wdform_' . ($id1 + 2) . '_city' . $form_id] : "") . '" style="width: 100%;" ' . $param['attributes'] . '><label class="mini_label" >' . $w_mini_labels[2] . '</label></span>';
                            }
                            if (isset($w_disabled_fields[3]) && $w_disabled_fields[3] == 'no') {
                                $g++;
                                $w_states = array("", "Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "District Of Columbia", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming");
                                $w_state_options = '';
                                $post_state = isset($_POST['wdform_' . ($id1 + 3) . '_state' . $form_id]) ? $_POST['wdform_' . ($id1 + 3) . '_state' . $form_id] : "";
                                foreach ($w_states as $w_state) {
                                    if ($w_state == $post_state) {
                                        $selected = 'selected="selected"';
                                    } else {
                                        $selected = '';
                                    }
                                    $w_state_options .= '<option value="' . $w_state . '" ' . $selected . '>' . $w_state . '</option>';
                                }
                                if (isset($w_disabled_fields[5]) && $w_disabled_fields[5] == 'yes' && isset($w_disabled_fields[6]) && $w_disabled_fields[6] == 'yes') {
                                    $address_fields .= '<span style="float: ' . ($g % 2 == 0 ? 'right' : 'left') . '; width: 48%; padding-bottom: 8px;"><select type="text" id="wdform_' . $id1 . '_state' . $form_id . '" name="wdform_' . ($id1 + 3) . '_state' . $form_id . '" style="width: 100%;" ' . $param['attributes'] . '>' . $w_state_options . '</select><label class="mini_label" style="display: block;" id="' . $id1 . '_mini_label_state">' . $w_mini_labels[3] . '</label></span>';
                                } else {
                                    $address_fields .= '<span style="float: ' . ($g % 2 == 0 ? 'right' : 'left') . '; width: 48%; padding-bottom: 8px;"><input type="text" id="wdform_' . $id1 . '_state' . $form_id . '" name="wdform_' . ($id1 + 3) . '_state' . $form_id . '" value="' . (isset($_POST['wdform_' . ($id1 + 3) . '_state' . $form_id]) ? $_POST['wdform_' . ($id1 + 3) . '_state' . $form_id] : "") . '" style="width: 100%;" ' . $param['attributes'] . '><label class="mini_label">' . $w_mini_labels[3] . '</label></span>';
                                }
                            }
                            if (isset($w_disabled_fields[4]) && $w_disabled_fields[4] == 'no') {
                                $g++;
                                $address_fields .= '<span style="float: ' . ($g % 2 == 0 ? 'right' : 'left') . '; width: 48%; padding-bottom: 8px;"><input type="text" id="wdform_' . $id1 . '_postal' . $form_id . '" name="wdform_' . ($id1 + 4) . '_postal' . $form_id . '" value="' . (isset($_POST['wdform_' . ($id1 + 4) . '_postal' . $form_id]) ? $_POST['wdform_' . ($id1 + 4) . '_postal' . $form_id] : "") . '" style="width: 100%;" ' . $param['attributes'] . '><label class="mini_label">' . $w_mini_labels[4] . '</label></span>';
                            }
                            $w_countries = array("", "Afghanistan", "Albania", "Algeria", "Andorra", "Angola", "Antigua and Barbuda", "Argentina", "Armenia", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bhutan", "Bolivia", "Bosnia and Herzegovina", "Botswana", "Brazil", "Brunei", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Central African Republic", "Chad", "Chile", "China", "Colombi", "Comoros", "Congo (Brazzaville)", "Congo", "Costa Rica", "Cote d'Ivoire", "Croatia", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "East Timor (Timor Timur)", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Fiji", "Finland", "France", "Gabon", "Gambia, The", "Georgia", "Germany", "Ghana", "Greece", "Grenada", "Guatemala", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Honduras", "Hungary", "Iceland", "India", "Indonesia", "Iran", "Iraq", "Ireland", "Israel", "Italy", "Jamaica", "Japan", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Korea, North", "Korea, South", "Kuwait", "Kyrgyzstan", "Laos", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libya", "Liechtenstein", "Lithuania", "Luxembourg", "Macedonia", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Mauritania", "Mauritius", "Mexico", "Micronesia", "Moldova", "Monaco", "Mongolia", "Morocco", "Mozambique", "Myanmar", "Namibia", "Nauru", "Nepa", "Netherlands", "New Zealand", "Nicaragua", "Niger", "Nigeria", "Norway", "Oman", "Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Poland", "Portugal", "Qatar", "Romania", "Russia", "Rwanda", "Saint Kitts and Nevis", "Saint Lucia", "Saint Vincent", "Samoa", "San Marino", "Sao Tome and Principe", "Saudi Arabia", "Senegal", "Serbia and Montenegro", "Seychelles", "Sierra Leone", "Singapore", "Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "Spain", "Sri Lanka", "Sudan", "Suriname", "Swaziland", "Sweden", "Switzerland", "Syria", "Taiwan", "Tajikistan", "Tanzania", "Thailand", "Togo", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom", "United States", "Uruguay", "Uzbekistan", "Vanuatu", "Vatican City", "Venezuela", "Vietnam", "Yemen", "Zambia", "Zimbabwe");
                            $w_options = '';
                            $post_country = isset($_POST['wdform_' . ($id1 + 5) . '_country' . $form_id]) ? $_POST['wdform_' . ($id1 + 5) . '_country' . $form_id] : "";
                            foreach ($w_countries as $w_country) {
                                if ($w_country == $post_country) {
                                    $selected = 'selected="selected"';
                                } else {
                                    $selected = '';
                                }
                                $w_options .= '<option value="' . $w_country . '" ' . $selected . '>' . $w_country . '</option>';
                            }
                            if (isset($w_disabled_fields[5]) && $w_disabled_fields[5] == 'no') {
                                $g++;
                                $address_fields .= '<span style="float: ' . ($g % 2 == 0 ? 'right' : 'left') . '; width: 48%; padding-bottom: 8px;display: inline-block;"><select type="text" id="wdform_' . $id1 . '_country' . $form_id . '" name="wdform_' . ($id1 + 5) . '_country' . $form_id . '" style="width:100%" ' . $param['attributes'] . '>' . $w_options . '</select><label class="mini_label">' . $w_mini_labels[5] . '</label></span>';
                            }
                            $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ' width: ' . $param['w_size'] . 'px;"><div>
              ' . $address_fields . '</div></div></div>';
                            if ($required) {
                                $check_js .= '
                if (x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0) {
                  if (jQuery("#wdform_' . $id1 . '_street1' . $form_id . '").val()=="" || jQuery("#wdform_' . $id1 . '_street2' . $form_id . '").val()=="" || jQuery("#wdform_' . $id1 . '_city' . $form_id . '").val()=="" || jQuery("#wdform_' . $id1 . '_state' . $form_id . '").val()=="" || jQuery("#wdform_' . $id1 . '_postal' . $form_id . '").val()=="" || jQuery("#wdform_' . $id1 . '_country' . $form_id . '").val()=="") {
                    alert("' . addslashes($label . ' ' . __('field is required.', 'contact_form_maker')) . '");
                    old_bg=x.find(jQuery("div[wdid=' . $id1 . ']")).css("background-color");
                    x.find(jQuery("div[wdid=' . $id1 . ']")).effect( "shake", {}, 500 ).css("background-color","#FF8F8B").animate({backgroundColor: old_bg}, {duration: 500, queue: false });
                    jQuery("#wdform_' . $id1 . '_street1' . $form_id . '").focus();
                    return false;
                  }
                }';
                            }
                            $post = isset($_POST['wdform_' . ($id1 + 5) . '_country' . $form_id]) ? $_POST['wdform_' . ($id1 + 5) . '_country' . $form_id] : NULL;
                            if (isset($post)) {
                                $onload_js .= ' jQuery("#wdform_' . $id1 . '_country' . $form_id . '").val("' . (isset($_POST['wdform_' . ($id1 + 5) . "_country" . $form_id]) ? $_POST['wdform_' . ($id1 + 5) . "_country" . $form_id] : '') . '");';
                            }
                            if (isset($w_disabled_fields[6]) && $w_disabled_fields[6] == 'yes') {
                                $onload_js .= ' jQuery("#wdform_' . $id1 . '_country' . $form_id . '").change(function() { 
                if (jQuery(this).val()=="United States") {
                  jQuery("#wdform_' . $id1 . '_state' . $form_id . '").parent().height("50px");
                  jQuery("#wdform_' . $id1 . '_state' . $form_id . '").parent().append("<select type=\\"text\\" id=\\"wdform_' . $id1 . '_state' . $form_id . '\\" name=\\"wdform_' . ($id1 + 3) . '_state' . $form_id . '\\" style=\\"width: 100%; \\" ' . $param['attributes'] . '>' . addslashes($w_state_options) . '</select><label class=\\"mini_label\\" style=\\"display: block;\\" id=\\"' . $id1 . '_mini_label_state\\">' . $w_mini_labels[3] . '</label>");
                  jQuery("#wdform_' . $id1 . '_state' . $form_id . '").parent().children("input:first, label:first").remove();
                }
                else {
                  if (jQuery("#wdform_' . $id1 . '_state' . $form_id . '").prop("tagName")=="SELECT") {
                    jQuery("#wdform_' . $id1 . '_state' . $form_id . '").parent().append("<input type=\\"text\\" id=\\"wdform_' . $id1 . '_state' . $form_id . '\\" name=\\"wdform_' . ($id1 + 3) . '_state' . $form_id . '\\" value=\\"' . (isset($_POST['wdform_' . ($id1 + 3) . '_state' . $form_id]) ? $_POST['wdform_' . ($id1 + 3) . '_state' . $form_id] : "") . '\\" style=\\"width: 100%;\\" ' . $param['attributes'] . '><label class=\\"mini_label\\">' . $w_mini_labels[3] . '</label>");
                    jQuery("#wdform_' . $id1 . '_state' . $form_id . '").parent().children("select:first, label:first").remove();	
                  }
                }
              });';
                            }
                            break;
                        case 'type_submitter_mail':
                            $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_first_val', 'w_title', 'w_required', 'w_unique', 'w_class');
                            $temp = $params;
                            foreach ($params_names as $params_name) {
                                $temp = explode('*:*' . $params_name . '*:*', $temp);
                                $param[$params_name] = $temp[0];
                                $temp = $temp[1];
                            }
                            if ($temp) {
                                $temp = explode('*:*w_attr_name*:*', $temp);
                                $attrs = array_slice($temp, 0, count($temp) - 1);
                                foreach ($attrs as $attr) {
                                    $param['attributes'] = $param['attributes'] . ' ' . $attr;
                                }
                            }
                            $param['w_first_val'] = isset($_POST['wdform_' . $id1 . '_element' . $form_id]) ? $_POST['wdform_' . $id1 . '_element' . $form_id] : $param['w_first_val'];
                            $wdformfieldsize = $param['w_field_label_pos'] == "left" ? $param['w_field_label_size'] + $param['w_size'] : max($param['w_field_label_size'], $param['w_size']);
                            $param['w_field_label_pos1'] = $param['w_field_label_pos'] == "left" ? "float: left;" : "";
                            $param['w_field_label_pos2'] = $param['w_field_label_pos'] == "left" ? "" : "display: block;";
                            $input_active = $param['w_first_val'] == $param['w_title'] ? "input_deactive" : "input_active";
                            $required = $param['w_required'] == "yes" ? TRUE : FALSE;
                            $rep = '<div type="type_submitter_mail" class="wdform-field"  style="width:' . $wdformfieldsize . 'px"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
                            if ($required) {
                                $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
                            }
                            $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ' width: ' . $param['w_size'] . 'px;"><input type="text" class="' . $input_active . '" id="wdform_' . $id1 . '_element' . $form_id . '" name="wdform_' . $id1 . '_element' . $form_id . '" value="' . $param['w_first_val'] . '" title="' . $param['w_title'] . '"  style="width: 100%;" ' . $param['attributes'] . '></div></div>';
                            if ($required) {
                                $check_js .= '
                if (x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0) {
                  if (jQuery("#wdform_' . $id1 . '_element' . $form_id . '").val()=="' . $param['w_title'] . '" || jQuery("#wdform_' . $id1 . '_element' . $form_id . '").val()=="") {
                    alert("' . addslashes($label . ' ' . __('field is required.', 'contact_form_maker')) . '");
                    jQuery("#wdform_' . $id1 . '_element' . $form_id . '").addClass( "form-error" );
                    old_bg=x.find(jQuery("div[wdid=' . $id1 . ']")).css("background-color");
                    x.find(jQuery("div[wdid=' . $id1 . ']")).effect( "shake", {}, 500 ).css("background-color","#FF8F8B").animate({backgroundColor: old_bg}, {duration: 500, queue: false });
                    jQuery("#wdform_' . $id1 . '_element' . $form_id . '").focus();
                    jQuery("#wdform_' . $id1 . '_element' . $form_id . '").change(function() { if( jQuery(this).val()!="" ) jQuery(this).removeClass("form-error"); else jQuery(this).addClass("form-error");});
                    return false;
                  }
                }';
                            }
                            $check_js .= '
              if (x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0) {
                if (jQuery("#wdform_' . $id1 . '_element' . $form_id . '").val() != "") {
                  if (jQuery("#wdform_' . $id1 . '_element' . $form_id . '").val().search(/^\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+$/) == -1) {
                    alert("' . addslashes(__("This is not a valid email address.", 'contact_form_maker')) . '");
                    old_bg=x.find(jQuery("div[wdid=' . $id1 . ']")).css("background-color");
                    x.find(jQuery("div[wdid=' . $id1 . ']")).effect( "shake", {}, 500 ).css("background-color","#FF8F8B").animate({backgroundColor: old_bg}, {duration: 500, queue: false });
                    jQuery("#wdform_' . $id1 . '_element' . $form_id . '").focus();
                    return false;
                  }
                }
              }';
                            break;
                        case 'type_checkbox':
                            $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_flow', 'w_choices', 'w_choices_checked', 'w_rowcol', 'w_required', 'w_randomize', 'w_allow_other', 'w_allow_other_num', 'w_class');
                            $temp = $params;
                            foreach ($params_names as $params_name) {
                                $temp = explode('*:*' . $params_name . '*:*', $temp);
                                $param[$params_name] = $temp[0];
                                $temp = $temp[1];
                            }
                            if ($temp) {
                                $temp = explode('*:*w_attr_name*:*', $temp);
                                $attrs = array_slice($temp, 0, count($temp) - 1);
                                foreach ($attrs as $attr) {
                                    $param['attributes'] = $param['attributes'] . ' ' . $attr;
                                }
                            }
                            $param['w_field_label_pos1'] = $param['w_field_label_pos'] == "left" ? "float: left;" : "";
                            $param['w_field_label_pos2'] = $param['w_field_label_pos'] == "left" ? "" : "display: block;";
                            $required = $param['w_required'] == "yes" ? TRUE : FALSE;
                            $param['w_choices'] = explode('***', $param['w_choices']);
                            $param['w_choices_checked'] = explode('***', $param['w_choices_checked']);
                            $post_value = isset($_POST["counter" . $form_id]) ? $_POST["counter" . $form_id] : NULL;
                            $is_other = FALSE;
                            if (isset($post_value)) {
                                if ($param['w_allow_other'] == "yes") {
                                    $is_other = FALSE;
                                    $other_element = isset($_POST['wdform_' . $id1 . "_other_input" . $form_id]) ? $_POST['wdform_' . $id1 . "_other_input" . $form_id] : NULL;
                                    if (isset($other_element)) {
                                        $is_other = TRUE;
                                    }
                                }
                            } else {
                                $is_other = $param['w_allow_other'] == "yes" && $param['w_choices_checked'][$param['w_allow_other_num']] == 'true';
                            }
                            $rep = '<div type="type_checkbox" class="wdform-field"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
                            if ($required) {
                                $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
                            }
                            $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ';">';
                            $rep .= '<div style="display: ' . ($param['w_flow'] == 'hor' ? 'inline-block' : 'table-row') . '; vertical-align:top">';
                            foreach ($param['w_choices'] as $key => $choice) {
                                if ($key % $param['w_rowcol'] == 0 && $key > 0) {
                                    $rep .= '</div><div style="display: ' . ($param['w_flow'] == 'hor' ? 'inline-block' : 'table-row') . ';  vertical-align:top">';
                                }
                                if (!isset($post_value)) {
                                    $param['w_choices_checked'][$key] = $param['w_choices_checked'][$key] == 'true' ? 'checked="checked"' : '';
                                } else {
                                    $post_valuetemp = isset($_POST['wdform_' . $id1 . "_element" . $form_id . $key]) ? $_POST['wdform_' . $id1 . "_element" . $form_id . $key] : NULL;
                                    $param['w_choices_checked'][$key] = isset($post_valuetemp) ? 'checked="checked"' : '';
                                }
                                $rep .= '<div style="display: ' . ($param['w_flow'] != 'hor' ? 'table-cell' : 'table-row') . ';"><label class="wdform-ch-rad-label" for="wdform_' . $id1 . '_element' . $form_id . '' . $key . '">' . $choice . '</label><div class="checkbox-div forlabs"><input type="checkbox" ' . ($param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == $key ? 'other="1"' : '') . ' id="wdform_' . $id1 . '_element' . $form_id . '' . $key . '" name="wdform_' . $id1 . '_element' . $form_id . '' . $key . '" value="' . htmlspecialchars($choice) . '" ' . ($param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == $key ? 'onclick="if(set_checked(&quot;wdform_' . $id1 . '&quot;,&quot;' . $key . '&quot;,&quot;' . $form_id . '&quot;)) show_other_input(&quot;wdform_' . $id1 . '&quot;,&quot;' . $form_id . '&quot;);"' : '') . ' ' . $param['w_choices_checked'][$key] . ' ' . $param['attributes'] . '><label for="wdform_' . $id1 . '_element' . $form_id . '' . $key . '"></label></div></div>';
                            }
                            $rep .= '</div>';
                            $rep .= '</div></div>';
                            if ($required) {
                                $check_js .= '
                if (x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0) {
                  if (x.find(jQuery("div[wdid=' . $id1 . '] input:checked")).length == 0) {
                    alert("' . addslashes($label . ' ' . __('field is required.', 'contact_form_maker')) . '");
                    old_bg = x.find(jQuery("div[wdid=' . $id1 . ']")).css("background-color");
                    x.find(jQuery("div[wdid=' . $id1 . ']")).effect( "shake", {}, 500 ).css("background-color","#FF8F8B").animate({backgroundColor: old_bg}, {duration: 500, queue: false });
                    return false;
                  }
                }';
                            }
                            if ($is_other) {
                                $onload_js .= 'show_other_input("wdform_' . $id1 . '","' . $form_id . '"); jQuery("#wdform_' . $id1 . '_other_input' . $form_id . '").val("' . (isset($_POST['wdform_' . $id1 . "_other_input" . $form_id]) ? $_POST['wdform_' . $id1 . "_other_input" . $form_id] : '') . '");';
                            }
                            $onsubmit_js .= '
                jQuery("<input type=\\"hidden\\" name=\\"wdform_' . $id1 . '_allow_other' . $form_id . '\\" value = \\"' . $param['w_allow_other'] . '\\" />").appendTo("#contactform' . $form_id . '");
                jQuery("<input type=\\"hidden\\" name=\\"wdform_' . $id1 . '_allow_other_num' . $form_id . '\\" value = \\"' . $param['w_allow_other_num'] . '\\" />").appendTo("#contactform' . $form_id . '");';
                            break;
                        case 'type_radio':
                            $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_flow', 'w_choices', 'w_choices_checked', 'w_rowcol', 'w_required', 'w_randomize', 'w_allow_other', 'w_allow_other_num', 'w_class');
                            $temp = $params;
                            foreach ($params_names as $params_name) {
                                $temp = explode('*:*' . $params_name . '*:*', $temp);
                                $param[$params_name] = $temp[0];
                                $temp = $temp[1];
                            }
                            if ($temp) {
                                $temp = explode('*:*w_attr_name*:*', $temp);
                                $attrs = array_slice($temp, 0, count($temp) - 1);
                                foreach ($attrs as $attr) {
                                    $param['attributes'] = $param['attributes'] . ' ' . $attr;
                                }
                            }
                            $param['w_field_label_pos1'] = $param['w_field_label_pos'] == "left" ? "float: left;" : "";
                            $param['w_field_label_pos2'] = $param['w_field_label_pos'] == "left" ? "" : "display:block;";
                            $required = $param['w_required'] == "yes" ? TRUE : FALSE;
                            $param['w_choices'] = explode('***', $param['w_choices']);
                            $param['w_choices_checked'] = explode('***', $param['w_choices_checked']);
                            $post_value = isset($_POST["counter" . $form_id]) ? $_POST["counter" . $form_id] : NULL;
                            $is_other = FALSE;
                            if (isset($post_value)) {
                                if ($param['w_allow_other'] == "yes") {
                                    $is_other = FALSE;
                                    $other_element = isset($_POST['wdform_' . $id1 . "_other_input" . $form_id]) ? $_POST['wdform_' . $id1 . "_other_input" . $form_id] : "";
                                    if (isset($other_element)) {
                                        $is_other = TRUE;
                                    }
                                }
                            } else {
                                $is_other = $param['w_allow_other'] == "yes" && $param['w_choices_checked'][$param['w_allow_other_num']] == 'true';
                            }
                            $rep = '<div type="type_radio" class="wdform-field"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
                            if ($required) {
                                $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
                            }
                            $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ';">';
                            $rep .= '<div style="display: ' . ($param['w_flow'] == 'hor' ? 'inline-block' : 'table-row') . '; vertical-align: top;">';
                            foreach ($param['w_choices'] as $key => $choice) {
                                if ($key % $param['w_rowcol'] == 0 && $key > 0) {
                                    $rep .= '</div><div style="display: ' . ($param['w_flow'] == 'hor' ? 'inline-block' : 'table-row') . ';  vertical-align:top">';
                                }
                                if (!isset($post_value)) {
                                    $param['w_choices_checked'][$key] = $param['w_choices_checked'][$key] == 'true' ? 'checked="checked"' : '';
                                } else {
                                    $param['w_choices_checked'][$key] = htmlspecialchars($choice) == htmlspecialchars(isset($_POST['wdform_' . $id1 . "_element" . $form_id]) ? $_POST['wdform_' . $id1 . "_element" . $form_id] : "") ? 'checked="checked"' : '';
                                }
                                $rep .= '<div style="display: ' . ($param['w_flow'] != 'hor' ? 'table-cell' : 'table-row') . ';"><label class="wdform-ch-rad-label" for="wdform_' . $id1 . '_element' . $form_id . '' . $key . '">' . $choice . '</label><div class="radio-div forlabs"><input type="radio" ' . ($param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == $key ? 'other="1"' : '') . ' id="wdform_' . $id1 . '_element' . $form_id . '' . $key . '" name="wdform_' . $id1 . '_element' . $form_id . '" value="' . htmlspecialchars($choice) . '" onclick="set_default(&quot;wdform_' . $id1 . '&quot;,&quot;' . $key . '&quot;,&quot;' . $form_id . '&quot;); ' . ($param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == $key ? 'show_other_input(&quot;wdform_' . $id1 . '&quot;,&quot;' . $form_id . '&quot;);' : '') . '" ' . $param['w_choices_checked'][$key] . ' ' . $param['attributes'] . '><label for="wdform_' . $id1 . '_element' . $form_id . '' . $key . '"></label></div></div>';
                            }
                            $rep .= '</div></div></div>';
                            if ($required) {
                                $check_js .= '
                if (x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0) {
                  if (x.find(jQuery("div[wdid=' . $id1 . '] input:checked")).length == 0 || jQuery("#wdform_' . $id1 . '_other_input' . $form_id . '").val() == "") {
                    alert("' . addslashes($label . ' ' . __('field is required.', 'contact_form_maker')) . '");
                    old_bg=x.find(jQuery("div[wdid=' . $id1 . ']")).css("background-color");
                    x.find(jQuery("div[wdid=' . $id1 . ']")).effect( "shake", {}, 500 ).css("background-color","#FF8F8B").animate({backgroundColor: old_bg}, {duration: 500, queue: false });
                    return false;
                  }						
                }';
                            }
                            if ($is_other) {
                                $onload_js .= 'show_other_input("wdform_' . $id1 . '","' . $form_id . '"); jQuery("#wdform_' . $id1 . '_other_input' . $form_id . '").val("' . (isset($_POST['wdform_' . $id1 . "_other_input" . $form_id]) ? $_POST['wdform_' . $id1 . "_other_input" . $form_id] : '') . '");';
                            }
                            $onsubmit_js .= '
                jQuery("<input type=\\"hidden\\" name=\\"wdform_' . $id1 . '_allow_other' . $form_id . '\\" value = \\"' . $param['w_allow_other'] . '\\" />").appendTo("#contactform' . $form_id . '");
                jQuery("<input type=\\"hidden\\" name=\\"wdform_' . $id1 . '_allow_other_num' . $form_id . '\\" value = \\"' . $param['w_allow_other_num'] . '\\" />").appendTo("#contactform' . $form_id . '");';
                            break;
                        case 'type_own_select':
                            $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_choices', 'w_choices_checked', 'w_choices_disabled', 'w_required', 'w_class');
                            $temp = $params;
                            foreach ($params_names as $params_name) {
                                $temp = explode('*:*' . $params_name . '*:*', $temp);
                                $param[$params_name] = $temp[0];
                                $temp = $temp[1];
                            }
                            if ($temp) {
                                $temp = explode('*:*w_attr_name*:*', $temp);
                                $attrs = array_slice($temp, 0, count($temp) - 1);
                                foreach ($attrs as $attr) {
                                    $param['attributes'] = $param['attributes'] . ' ' . $attr;
                                }
                            }
                            $wdformfieldsize = $param['w_field_label_pos'] == "left" ? $param['w_field_label_size'] + $param['w_size'] : max($param['w_field_label_size'], $param['w_size']);
                            $param['w_field_label_pos1'] = $param['w_field_label_pos'] == "left" ? "float: left;" : "";
                            $param['w_field_label_pos2'] = $param['w_field_label_pos'] == "left" ? "" : "display: block;";
                            $required = $param['w_required'] == "yes" ? TRUE : FALSE;
                            $param['w_choices'] = explode('***', $param['w_choices']);
                            $param['w_choices_checked'] = explode('***', $param['w_choices_checked']);
                            $param['w_choices_disabled'] = explode('***', $param['w_choices_disabled']);
                            $post_value = isset($_POST["counter" . $form_id]) ? $_POST["counter" . $form_id] : NULL;
                            $rep = '<div type="type_own_select" class="wdform-field"  style="width:' . $wdformfieldsize . 'px"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
                            if ($required) {
                                $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
                            }
                            $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ' width: ' . $param['w_size'] . 'px; "><select id="wdform_' . $id1 . '_element' . $form_id . '" name="wdform_' . $id1 . '_element' . $form_id . '" style="width: 100%"  ' . $param['attributes'] . '>';
                            foreach ($param['w_choices'] as $key => $choice) {
                                if (!isset($post_value)) {
                                    $param['w_choices_checked'][$key] = $param['w_choices_checked'][$key] == 'true' ? 'selected="selected"' : '';
                                } else {
                                    $param['w_choices_checked'][$key] = htmlspecialchars($choice) == htmlspecialchars(isset($_POST['wdform_' . $id1 . "_element" . $form_id]) ? $_POST['wdform_' . $id1 . "_element" . $form_id] : "") ? 'selected="selected"' : '';
                                }
                                if ($param['w_choices_disabled'][$key] == "true") {
                                    $choice_value = '';
                                } else {
                                    $choice_value = $choice;
                                }
                                $rep .= '<option id="wdform_' . $id1 . '_option' . $key . '" value="' . htmlspecialchars($choice_value) . '" ' . $param['w_choices_checked'][$key] . '>' . $choice . '</option>';
                            }
                            $rep .= '</select></div></div>';
                            if ($required) {
                                $check_js .= '
                if (x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0) {
                  if (jQuery("#wdform_' . $id1 . '_element' . $form_id . '").val()=="") {
                      alert("' . addslashes($label . ' ' . __('field is required.', 'contact_form_maker')) . '");
                      jQuery("#wdform_' . $id1 . '_element' . $form_id . '").addClass( "form-error" );
                      old_bg=x.find(jQuery("div[wdid=' . $id1 . ']")).css("background-color");
                      x.find(jQuery("div[wdid=' . $id1 . ']")).effect( "shake", {}, 500 ).css("background-color","#FF8F8B").animate({backgroundColor: old_bg}, {duration: 500, queue: false });
                      jQuery("#wdform_' . $id1 . '_element' . $form_id . '").focus();
                      jQuery("#wdform_' . $id1 . '_element' . $form_id . '").change(function() { if( jQuery(this).val()!="" ) jQuery(this).removeClass("form-error"); else jQuery(this).addClass("form-error");});
                      return false;
                    }
                }';
                            }
                            break;
                        case 'type_captcha':
                            $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_digit', 'w_class');
                            $temp = $params;
                            foreach ($params_names as $params_name) {
                                $temp = explode('*:*' . $params_name . '*:*', $temp);
                                $param[$params_name] = $temp[0];
                                $temp = $temp[1];
                            }
                            if ($temp) {
                                $temp = explode('*:*w_attr_name*:*', $temp);
                                $attrs = array_slice($temp, 0, count($temp) - 1);
                                foreach ($attrs as $attr) {
                                    $param['attributes'] = $param['attributes'] . ' ' . $attr;
                                }
                            }
                            $param['w_field_label_pos1'] = $param['w_field_label_pos'] == "left" ? "float: left;" : "";
                            $param['w_field_label_pos2'] = $param['w_field_label_pos'] == "left" ? "" : "display: block;";
                            $rep = '<div type="type_captcha" class="wdform-field"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . ' width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span></div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . '"><div style="display: table;"><div style="display: table-cell;vertical-align: middle;"><div valign="middle" style="display: table-cell; text-align: center;"><img type="captcha" digit="' . $param['w_digit'] . '" src=" ' . add_query_arg(array('action' => 'ContactFormmakerwdcaptcha', 'digit' => $param['w_digit'], 'i' => $form_id), admin_url('admin-ajax.php')) . '" id="wd_captcha' . $form_id . '" class="captcha_img" style="display:none" ' . $param['attributes'] . '></div><div valign="middle" style="display: table-cell;"><div class="captcha_refresh" id="_element_refresh' . $form_id . '" ' . $param['attributes'] . '></div></div></div><div style="display: table-cell;vertical-align: middle;"><div style="display: table-cell;"><input type="text" class="captcha_input" id="wd_captcha_input' . $form_id . '" name="captcha_input" style="width: ' . ($param['w_digit'] * 10 + 15) . 'px;" ' . $param['attributes'] . '></div></div></div></div></div>';
                            $onload_js .= 'jQuery("#wd_captcha' . $form_id . '").click(function() {captcha_refresh("wd_captcha","' . $form_id . '")});';
                            $onload_js .= 'jQuery("#_element_refresh' . $form_id . '").click(function() {captcha_refresh("wd_captcha","' . $form_id . '")});';
                            $check_js .= '
              if (x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0) {
                if (jQuery("#wd_captcha_input' . $form_id . '").val()=="") {
                  alert("' . addslashes($label . ' ' . __('field is required.', 'contact_form_maker')) . '");
                  old_bg=x.find(jQuery("div[wdid=' . $id1 . ']")).css("background-color");
                  x.find(jQuery("div[wdid=' . $id1 . ']")).effect( "shake", {}, 500 ).css("background-color","#FF8F8B").animate({backgroundColor: old_bg}, {duration: 500, queue: false });
                  jQuery("#wd_captcha_input' . $form_id . '").focus();
                  return false;
                }
              }';
                            $onload_js .= 'captcha_refresh("wd_captcha", "' . $form_id . '");';
                            break;
                        case 'type_recaptcha':
                            $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_public', 'w_private', 'w_theme', 'w_class');
                            $temp = $params;
                            foreach ($params_names as $params_name) {
                                $temp = explode('*:*' . $params_name . '*:*', $temp);
                                $param[$params_name] = $temp[0];
                                $temp = $temp[1];
                            }
                            if ($temp) {
                                $temp = explode('*:*w_attr_name*:*', $temp);
                                $attrs = array_slice($temp, 0, count($temp) - 1);
                                foreach ($attrs as $attr) {
                                    $param['attributes'] = $param['attributes'] . ' ' . $attr;
                                }
                            }
                            $param['w_field_label_pos1'] = $param['w_field_label_pos'] == "left" ? "float: left;" : "";
                            $param['w_field_label_pos2'] = $param['w_field_label_pos'] == "left" ? "" : "display: block;";
                            $publickey = $row->public_key ? $row->public_key : '0';
                            $error = NULL;
                            require_once WD_CFM_DIR . '/recaptchalib.php';
                            $rep = '<script>var RecaptchaOptions = {theme: "' . $param['w_theme'] . '"};</script><div type="type_recaptcha" class="wdform-field"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span></div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ';">
              <div id="wd_recaptcha' . $form_id . '" ' . $param['attributes'] . '>' . recaptcha_get_html($publickey, $error) . '</div></div></div>';
                            break;
                        case 'type_map':
                            $params_names = array('w_center_x', 'w_center_y', 'w_long', 'w_lat', 'w_zoom', 'w_width', 'w_height', 'w_info', 'w_class');
                            $temp = $params;
                            foreach ($params_names as $params_name) {
                                $temp = explode('*:*' . $params_name . '*:*', $temp);
                                $param[$params_name] = $temp[0];
                                $temp = $temp[1];
                            }
                            if ($temp) {
                                $temp = explode('*:*w_attr_name*:*', $temp);
                                $attrs = array_slice($temp, 0, count($temp) - 1);
                                foreach ($attrs as $attr) {
                                    $param['attributes'] = $param['attributes'] . ' ' . $attr;
                                }
                            }
                            $marker = '';
                            $param['w_long'] = explode('***', $param['w_long']);
                            $param['w_lat'] = explode('***', $param['w_lat']);
                            $param['w_info'] = explode('***', $param['w_info']);
                            foreach ($param['w_long'] as $key => $w_long) {
                                $marker .= 'long' . $key . '="' . $w_long . '" lat' . $key . '="' . $param['w_lat'][$key] . '" info' . $key . '="' . str_replace(array("\r\n", "\n", "\r"), '<br />', $param['w_info'][$key]) . '"';
                            }
                            $rep = '<div type="type_map" class="wdform-field"  style="width:' . $param['w_width'] . 'px"><div class="wdform-label-section" style="display: table-cell;"><span id="wdform_' . $id1 . '_element_label' . $form_id . '" style="display: none;">' . $label . '</span></div><div class="wdform-element-section ' . $param['w_class'] . '" style="width: ' . $param['w_width'] . 'px;"><div id="wdform_' . $id1 . '_element' . $form_id . '" zoom="' . $param['w_zoom'] . '" center_x="' . $param['w_center_x'] . '" center_y="' . $param['w_center_y'] . '" style="width: 100%; height: ' . $param['w_height'] . 'px;" ' . $marker . ' ' . $param['attributes'] . '></div></div></div>';
                            $onload_js .= 'if_gmap_init("wdform_' . $id1 . '", ' . $form_id . ');';
                            foreach ($param['w_long'] as $key => $w_long) {
                                $onload_js .= 'add_marker_on_map("wdform_' . $id1 . '",' . $key . ', "' . $w_long . '", "' . $param['w_lat'][$key] . '", "' . str_replace(array("\r\n", "\n", "\r"), '<br />', $param['w_info'][$key]) . '", ' . $form_id . ',false);';
                            }
                            break;
                        case 'type_submit_reset':
                            $params_names = array('w_submit_title', 'w_reset_title', 'w_class', 'w_act');
                            $temp = $params;
                            foreach ($params_names as $params_name) {
                                $temp = explode('*:*' . $params_name . '*:*', $temp);
                                $param[$params_name] = $temp[0];
                                $temp = $temp[1];
                            }
                            if ($temp) {
                                $temp = explode('*:*w_attr_name*:*', $temp);
                                $attrs = array_slice($temp, 0, count($temp) - 1);
                                foreach ($attrs as $attr) {
                                    $param['attributes'] = $param['attributes'] . ' ' . $attr;
                                }
                            }
                            $param['w_act'] = $param['w_act'] == "false" ? 'style="display: none;"' : "";
                            $rep = '<div type="type_submit_reset" class="wdform-field"><div class="wdform-label-section" style="display: table-cell;"></div><div class="wdform-element-section ' . $param['w_class'] . '" style="display: table-cell;"><button type="button" class="button-submit" onclick="check_required' . $form_id . '(&quot;submit&quot;, &quot;' . $form_id . '&quot;);" ' . $param['attributes'] . '>' . $param['w_submit_title'] . '</button><button type="button" class="button-reset" onclick="check_required' . $form_id . '(&quot;reset&quot;);" ' . $param['w_act'] . ' ' . $param['attributes'] . '>' . $param['w_reset_title'] . '</button></div></div>';
                            break;
                    }
                }
                $form = str_replace('%' . $id1 . ' - ' . $labels[$id1s_key] . '%', $rep, $form);
                $form = str_replace('%' . $id1 . ' -' . $labels[$id1s_key] . '%', $rep, $form);
            }
        }
        $rep1 = array('form_id_temp');
        $rep2 = array($id . 'contact');
        $form = str_replace($rep1, $rep2, $form);
        $form_maker_front_end .= $form;
        $form_maker_front_end .= '<div class="wdform_preload"></div>';
        $form_maker_front_end .= '</form>';
        ?>
    <script type="text/javascript">
      function contactformOnload<?php 
        echo $id;
        ?>
() {
        if (navigator.userAgent.toLowerCase().indexOf('msie') != -1) {
          if (parseInt(navigator.userAgent.toLowerCase().split('msie')[1]) === 8) {
            jQuery("#contactform<?php 
        echo $id;
        ?>
").find(jQuery("input[type='radio']")).click(function() {jQuery("input[type='radio']+label").removeClass('if-ie-div-label'); jQuery("input[type='radio']:checked+label").addClass('if-ie-div-label')});	
            jQuery("#contactform<?php 
        echo $id;
        ?>
").find(jQuery("input[type='radio']:checked+label")).addClass('if-ie-div-label');
            jQuery("#contactform<?php 
        echo $id;
        ?>
").find(jQuery("input[type='checkbox']")).click(function() {jQuery("input[type='checkbox']+label").removeClass('if-ie-div-label'); jQuery("input[type='checkbox']:checked+label").addClass('if-ie-div-label')});	
            jQuery("#contactform<?php 
        echo $id;
        ?>
").find(jQuery("input[type='checkbox']:checked+label")).addClass('if-ie-div-label');
          }
        }
        jQuery("div[type='type_text'] input, div[type='type_number'] input, div[type='type_phone'] input, div[type='type_name'] input, div[type='type_submitter_mail'] input, div[type='type_textarea'] textarea").focus(function() {delete_value(this)}).blur(function() {return_value(this)});
        jQuery("div[type='type_number'] input, div[type='type_phone'] input").keypress(function(evt) {return check_isnum(evt)});

        jQuery('.wdform-element-section').each(function() {
          if (!jQuery(this).parent()[0].style.width) {
            if (parseInt(jQuery(this).width()) != 0) {
              if (jQuery(this).css('display') == "table-cell") {
                if (jQuery(this).parent().attr('type') != "type_captcha") {
                  jQuery(this).parent().css('width', parseInt(jQuery(this).width()) + parseInt(jQuery(this).parent().find(jQuery(".wdform-label-section"))[0].style.width)+15);
                }
                else {
                  jQuery(this).parent().css('width', (parseInt(jQuery(this).parent().find(jQuery(".captcha_input"))[0].style.width)*2+50) + parseInt(jQuery(this).parent().find(jQuery(".wdform-label-section"))[0].style.width)+15);
                }
              }
            }
          }
          if(parseInt(jQuery(this)[0].style.width.replace('px', '')) < parseInt(jQuery(this).css('min-width').replace('px', '')))
            jQuery(this).css('min-width', parseInt(jQuery(this)[0].style.width.replace('px', ''))-10);
        });	
        
        jQuery('.wdform-label').each(function() {
          if(parseInt(jQuery(this).height()) >= 2*parseInt(jQuery(this).css('line-height').replace('px', '')))
          {
            jQuery(this).parent().css('max-width',jQuery(this).parent().width());
            jQuery(this).parent().css('width','');
          }
        });
        if (jQuery(".cfm_style").parent().prop("tagName") == "P") {
          jQuery(".cfm_style").parent().css({padding: 0, margin: 0});
        }
        <?php 
        echo $onload_js;
        ?>
      }

      jQuery(window).load(function () {
        contactformOnload<?php 
        echo $id;
        ?>
();
      });

      form_view_count<?php 
        echo $id;
        ?>
 = 0;
      jQuery(document).ready(function () {
        if (document.getElementById(<?php 
        echo $id;
        ?>
+'contactform_view1')) {
          wdform_page = document.getElementById(<?php 
        echo $id;
        ?>
+'contactform_view1');
          remove_whitespace(wdform_page);
          n = wdform_page.childNodes.length - 2;
          for (z = 0; z <= n; z++) {
            if (wdform_page.childNodes[z]) {
              if (wdform_page.childNodes[z].getAttribute("disabled")) {
                var wdform_section_break = wdform_page.childNodes[z];
                move = wdform_section_break.nextSibling;
                to = wdform_section_break.previousSibling;
                l = move.childNodes.length;
                for (k = 0; k < l; k++) {
                  if (to.childNodes[k]) {
                    while (move.childNodes[k].firstChild) {
                      to.childNodes[k].appendChild(move.childNodes[k].firstChild);
                    }
                  }
                  else {
                    to.appendChild(move.childNodes[k]);
                  }
                }
                wdform_section_break.parentNode.removeChild(wdform_section_break.nextSibling);
                wdform_section_break.parentNode.removeChild(wdform_section_break);
              }
            }
          }
        }
      });
      function check_required<?php 
        echo $form_id;
        ?>
(but_type) {
        if (but_type == 'reset') {
          window.location = "<?php 
        echo $_SERVER['REQUEST_URI'];
        ?>
";
          return;
        }
        x = jQuery("#contactform<?php 
        echo $form_id;
        ?>
");
        <?php 
        echo $check_js;
        ?>
;
        var a = [];
        if (typeof a[<?php 
        echo $form_id;
        ?>
] !== 'undefined') {
          if (a[<?php 
        echo $form_id;
        ?>
] == 1) {
            return;
          }
        }
        <?php 
        echo $onsubmit_js;
        ?>
;
        a[<?php 
        echo $form_id;
        ?>
] = 1;
        document.getElementById("contactform"+<?php 
        echo $form_id;
        ?>
).submit();
      }
    </script>
    <?php 
        return $form_maker_front_end;
    }
 public function delete_all()
 {
     global $wpdb;
     $flag = FALSE;
     $isDefault = FALSE;
     $form_ids_col = $wpdb->get_col('SELECT id FROM ' . $wpdb->prefix . 'contactformmaker');
     foreach ($form_ids_col as $form_id) {
         if (isset($_POST['check_' . $form_id])) {
             $flag = TRUE;
             $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'contactformmaker WHERE id="%d"', $form_id));
             $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'contactformmaker_views WHERE form_id="%d"', $form_id));
             $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'contactformmaker_submits WHERE form_id="%d"', $form_id));
         }
     }
     if ($flag) {
         $message = 5;
     } else {
         $message = 6;
     }
     $page = WDW_CFM_Library::get('page');
     WDW_CFM_Library::spider_redirect(add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message), admin_url('admin.php')));
 }
    public function display()
    {
        $rows_data = $this->model->get_rows_data();
        $page_nav = $this->model->page_nav();
        $search_value = isset($_POST['search_value']) ? esc_html(stripslashes($_POST['search_value'])) : '';
        $asc_or_desc = isset($_POST['asc_or_desc']) ? esc_html(stripslashes($_POST['asc_or_desc'])) : 'desc';
        $order_by = isset($_POST['order_by']) ? esc_html(stripslashes($_POST['order_by'])) : 'id';
        $order_class = 'manage-column column-title sorted ' . $asc_or_desc;
        $ids_string = '';
        ?>
    <div id="fm_blocked_ips_message" style="width: 99%; display: none;"></div>
    <div style="clear: both; float: left; width: 99%;">
      <div style="float: left; font-size: 14px; font-weight: bold;">
      <?php 
        echo __("This section allows you to block IPs.", "contact_form_maker");
        ?>
        <a style="color: blue; text-decoration: none;" target="_blank" href="http://web-dorado.com/wordpress-contact-form-builder-guide-6.html"><?php 
        echo __("Read More in User Manual", "contact_form_maker");
        ?>
</a>
      </div>
      <div style="float: right; text-align: right;">
        <a style="text-decoration: none;" target="_blank" href="http://web-dorado.com/files/fromContactFormBuilder.php">
          <img width="215" border="0" alt="web-dorado.com" src="<?php 
        echo WD_CFM_URL . '/images/wd_logo.png';
        ?>
" />
        </a>
      </div>
    </div>
    <form onkeypress="spider_doNothing(event)" class="wrap" id="blocked_ips" method="post" action="admin.php?page=blocked_ips_cfm" style="float: left; width: 99%;">
      <?php 
        wp_nonce_field('nonce_cfm', 'nonce_cfm');
        ?>
      <span class="block_icon"></span>
      <h2><?php 
        echo __("Blocked IPs", "contact_form_maker");
        ?>
</h2>
      <div class="buttons_div">
        <input class="button-primary" type="submit" value="<?php 
        echo __("Save", "contact_form_maker");
        ?>
" onclick="spider_set_input_value('task', 'save_all');" />
        <input class="button-secondary" type="submit" value="<?php 
        echo __("Delete", "contact_form_maker");
        ?>
" onclick="if (confirm('<?php 
        echo addslashes(__('Do you want to unblock selected IPs?', 'contact_form_maker'));
        ?>
')) {
                                                                      spider_set_input_value('task', 'delete_all');
                                                                    } else {
                                                                      return false;
                                                                    }" />
      </div>
      <div class="tablenav top">
        <?php 
        WDW_CFM_Library::search('IP', $search_value, 'blocked_ips');
        WDW_CFM_Library::html_page_nav($page_nav['total'], $page_nav['limit'], 'blocked_ips');
        ?>
      </div>
      <table class="wp-list-table widefat fixed pages">
        <thead>
          <tr>
            <th class="manage-column column-cb check-column table_small_col"><input id="check_all" type="checkbox" style="margin: 0;" /></th>
            <th class="table_small_col <?php 
        if ($order_by == 'id') {
            echo $order_class;
        }
        ?>
">
              <a onclick="spider_set_input_value('task', '');
                          spider_set_input_value('order_by', 'id');
                          spider_set_input_value('asc_or_desc', '<?php 
        echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == 'id' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc';
        ?>
');
                          spider_form_submit(event, 'blocked_ips')" href="">
                <span>ID</span><span class="sorting-indicator"></span></th>
              </a>
            <th class="<?php 
        if ($order_by == 'ip') {
            echo $order_class;
        }
        ?>
">
              <a onclick="spider_set_input_value('task', '');
                          spider_set_input_value('order_by', 'ip');
                          spider_set_input_value('asc_or_desc', '<?php 
        echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == 'ip' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc';
        ?>
');
                          spider_form_submit(event, 'blocked_ips')" href="">
                <span>IP</span><span class="sorting-indicator"></span>
              </a>
            </th>
            <th class="table_big_col"><?php 
        echo __("Edit", "contact_form_maker");
        ?>
</th>
            <th class="table_big_col"><?php 
        echo __("Delete", "contact_form_maker");
        ?>
</th>
          </tr>		  
          <tr id="tr">
            <th></th>
            <th></th>
            <th class="edit_input"><input type="text" class="input_th" id="ip" name="ip" onkeypress="return spider_check_isnum(event)"></th>
            <th class="table_big_col">
              <a class="add_tag_th button-primary button button-small" onclick="if (spider_check_required('ip', 'IP')) {return false;}
                                                                                spider_set_input_value('task', 'save');
                                                                                spider_set_input_value('current_id', '');
                                                                                spider_form_submit(event, 'blocked_ips')" href=""><?php 
        echo __("Add IP", "contact_form_maker");
        ?>
</a>
            </th>
            <th></th>
          </tr>
        </thead>
        <tbody id="tbody_arr">
          <?php 
        if ($rows_data) {
            foreach ($rows_data as $row_data) {
                $alternate = !isset($alternate) || $alternate == 'class="alternate"' ? '' : 'class="alternate"';
                ?>
              <tr id="tr_<?php 
                echo $row_data->id;
                ?>
" <?php 
                echo $alternate;
                ?>
>
                <td class="table_small_col check-column" id="td_check_<?php 
                echo $row_data->id;
                ?>
" >
                  <input id="check_<?php 
                echo $row_data->id;
                ?>
" name="check_<?php 
                echo $row_data->id;
                ?>
" type="checkbox" />
                </td>
                <td class="table_small_col" id="td_id_<?php 
                echo $row_data->id;
                ?>
" ><?php 
                echo $row_data->id;
                ?>
</td>
                <td id="td_ip_<?php 
                echo $row_data->id;
                ?>
" >
                  <a class="pointer" id="ip<?php 
                echo $row_data->id;
                ?>
"
                     onclick="spider_edit_ip(<?php 
                echo $row_data->id;
                ?>
)" 
                     title="Edit"><?php 
                echo $row_data->ip;
                ?>
</a>
                </td>
                <td class="table_big_col" id="td_edit_<?php 
                echo $row_data->id;
                ?>
">
                  <a onclick="spider_edit_ip(<?php 
                echo $row_data->id;
                ?>
)"><?php 
                echo __("Edit", "contact_form_maker");
                ?>
</a>
                </td>
                <td class="table_big_col" id="td_delete_<?php 
                echo $row_data->id;
                ?>
">
                  <a onclick="spider_set_input_value('task', 'delete');
                              spider_set_input_value('current_id', <?php 
                echo $row_data->id;
                ?>
);
                              spider_form_submit(event, 'blocked_ips')" href=""><?php 
                echo __("Delete", "contact_form_maker");
                ?>
</a>
                </td>
              </tr>
              <?php 
                $ids_string .= $row_data->id . ',';
            }
        }
        ?>
        </tbody>
      </table>
      <input id="task" name="task" type="hidden" value="" />
      <input id="current_id" name="current_id" type="hidden" value="" />
      <input id="ids_string" name="ids_string" type="hidden" value="<?php 
        echo $ids_string;
        ?>
" />
      <input id="asc_or_desc" name="asc_or_desc" type="hidden" value="<?php 
        echo $asc_or_desc;
        ?>
" />
      <input id="order_by" name="order_by" type="hidden" value="<?php 
        echo $order_by;
        ?>
" />
    </form>
    <?php 
    }
    public function form_options($id)
    {
        $row = $this->model->get_row_data($id);
        $themes = $this->model->get_theme_rows_data();
        $page_title = $row->title . __(' form options', 'contact_form_maker');
        $label_id = array();
        $label_label = array();
        $label_type = array();
        $label_all = explode('#****#', $row->label_order_current);
        $label_all = array_slice($label_all, 0, count($label_all) - 1);
        foreach ($label_all as $key => $label_each) {
            $label_id_each = explode('#**id**#', $label_each);
            if ($label_id_each[0] == 22) {
                $default_subject = $key;
            }
            array_push($label_id, $label_id_each[0]);
            $label_order_each = explode('#**label**#', $label_id_each[1]);
            array_push($label_label, $label_order_each[0]);
            array_push($label_type, $label_order_each[1]);
        }
        $fields = explode('*:*id*:*type_submitter_mail*:*type*:*', $row->form_fields);
        $fields_count = count($fields);
        $disabled_fields = explode(',', $row->disabled_fields);
        $disabled_fields = array_slice($disabled_fields, 0, count($disabled_fields) - 1);
        $field_exist = array();
        for ($i = 0; $i < count($label_label); $i++) {
            if ($label_type[$i] == "type_submit_reset" || $label_type[$i] == "type_editor" || $label_type[$i] == "type_map" || $label_type[$i] == "type_captcha" || $label_type[$i] == "type_recaptcha" || $label_type[$i] == "type_button" || $label_type[$i] == "type_send_copy" || in_array($label_id[$i], $disabled_fields)) {
                $field_exist[$i] = FALSE;
            } else {
                $field_exist[$i] = TRUE;
            }
        }
        ?>
    <script>
      gen = "<?php 
        echo $row->counter;
        ?>
";
      form_view_max = 20;
      function set_preview() {
        jQuery("#preview_form").attr("href", '<?php 
        echo add_query_arg(array('action' => 'ContactFormMakerPreview', 'form_id' => $row->id), admin_url('admin-ajax.php'));
        ?>
&test_theme=' + jQuery("#theme").val() + '&width=1000&height=500&TB_iframe=1');
        jQuery("#edit_css").attr("href", '<?php 
        echo add_query_arg(array('action' => 'ContactFormMakerEditCSS', 'form_id' => $row->id), admin_url('admin-ajax.php'));
        ?>
&id=' + jQuery("#theme").val() + '&width=800&height=500&TB_iframe=1');
      }
    </script>
    <div style="font-size: 14px; font-weight: bold;">
      <?php 
        echo __("This section allows you to edit form options", "contact_form_maker");
        ?>
.
      <a style="color: blue; text-decoration: none;" target="_blank" href="http://web-dorado.com/wordpress-contact-form-builder-guide-3.html"><?php 
        echo __("Read More in User Manual", "contact_form_maker");
        ?>
</a>
    </div>
    <form class="wrap" method="post" action="admin.php?page=manage_cfm" style="width: 99%;" name="adminForm" id="adminForm">
      <?php 
        wp_nonce_field('nonce_cfm', 'nonce_cfm');
        ?>
      <h2><?php 
        echo $page_title;
        ?>
</h2>
      <div style="float: right; margin: 0 5px 0 0;">
        <input class="button-secondary" type="submit" onclick="if (spider_check_email('mailToAdd') ||
                                                                   spider_check_email('mail_from_other') ||
                                                                   spider_check_email('reply_to_other') ||
                                                                   spider_check_email('mail_cc') ||
                                                                   spider_check_email('mail_bcc') ||
                                                                   spider_check_email('mail_from_user') ||
                                                                   spider_check_email('reply_to_user') ||
                                                                   spider_check_email('mail_cc_user') ||
                                                                   spider_check_email('mail_bcc_user') ||
                                                                   spider_check_email('mail_from') ||
                                                                   spider_check_email('reply_to')) { return false; }; spider_set_input_value('task', 'save_options')" value="<?php 
        echo __("Save", "contact_form_maker");
        ?>
"/>
        <input class="button-secondary" type="submit" onclick="if (spider_check_email('mailToAdd') ||
                                                                   spider_check_email('mail_from_other') ||
                                                                   spider_check_email('reply_to_other') ||
                                                                   spider_check_email('mail_cc') ||
                                                                   spider_check_email('mail_bcc') ||
                                                                   spider_check_email('mail_from_user') ||
                                                                   spider_check_email('reply_to_user') ||
                                                                   spider_check_email('mail_cc_user') ||
                                                                   spider_check_email('mail_bcc_user') ||
                                                                   spider_check_email('mail_from') ||
                                                                   spider_check_email('reply_to')) { return false; }; spider_set_input_value('task', 'apply_options')" value="<?php 
        echo __("Apply", "contact_form_maker");
        ?>
"/>
        <input class="button-secondary" type="submit" onclick="spider_set_input_value('task', 'cancel_options')" value="<?php 
        echo __("Cancel", "contact_form_maker");
        ?>
"/>
      </div>
      <div class="submenu-box" style="width: 99%; float: left; margin: 15px 0 0 0;">
        <div class="submenu-pad">
          <ul id="submenu" class="configuration">
            <li>
              <a id="general" class="fm_fieldset_tab" onclick="form_maker_options_tabs('general')" href="#"><?php 
        echo __("General Options", "contact_form_maker");
        ?>
</a>
            </li>
            <li>
              <a id="custom" class="fm_fieldset_tab" onclick="form_maker_options_tabs('custom')" href="#"><?php 
        echo __("Email Options", "contact_form_maker");
        ?>
</a>
            </li>
            <li>
              <a id="actions" class="fm_fieldset_tab" onclick="form_maker_options_tabs('actions')" href="#"><?php 
        echo __("Actions after Submission", "contact_form_maker");
        ?>
</a>
            </li>
          </ul>
        </div>
      </div>
      <fieldset id="general_fieldset" class="adminform fm_fieldset_deactive">
        <legend style="color: #0B55C4; font-weight: bold;"><?php 
        echo __("General Options", "contact_form_maker");
        ?>
</legend>
        <table class="admintable" style="float: left;">
          <tr valign="top">
            <td class="fm_options_label">
              <label><?php 
        echo __("Published", "contact_form_maker");
        ?>
</label>
            </td>
            <td class="fm_options_value">
              <input type="radio" name="published" id="published_yes" value="1" <?php 
        echo $row->published ? 'checked="checked"' : '';
        ?>
 /><label for="published_yes"><?php 
        echo __("Yes", "contact_form_maker");
        ?>
</label>
              <input type="radio" name="published" id="published_no" value="0" <?php 
        echo !$row->published ? 'checked="checked"' : '';
        ?>
 /><label for="published_no"><?php 
        echo __("No", "contact_form_maker");
        ?>
</label>
            </td>
          </tr>
          <tr valign="top">
            <td class="fm_options_label">
              <label><?php 
        echo __("Save data(to database)", "contact_form_maker");
        ?>
</label>
            </td>
            <td class="fm_options_value">
              <input type="radio" name="savedb" id="savedb_yes" value="1" <?php 
        echo $row->savedb ? 'checked="checked"' : '';
        ?>
 /><label for="savedb_yes"><?php 
        echo __("Yes", "contact_form_maker");
        ?>
</label>
              <input type="radio" name="savedb" id="savedb_no" value="0" <?php 
        echo !$row->savedb ? 'checked="checked"' : '';
        ?>
 /><label for="savedb_no"><?php 
        echo __("No", "contact_form_maker");
        ?>
</label>
            </td>
          </tr>
          <tr valign="top">
            <td class="fm_options_label">
              <label for="theme"><?php 
        echo __("Theme", "contact_form_maker");
        ?>
</label>
            </td>
            <td class="fm_options_value">
              <select id="theme" name="theme" style="width:260px;" onChange="set_preview()">
                <?php 
        foreach ($themes as $theme) {
            ?>
                  <option value="<?php 
            echo $theme->id;
            ?>
" <?php 
            echo $theme->id == $row->theme ? 'selected="selected"' : '';
            ?>
 <?php 
            echo $theme->id != 4 ? 'disabled="disabled" title="This theme is disabled in free version."' : '';
            ?>
><?php 
            echo $theme->title;
            ?>
</option>
                  <?php 
        }
        ?>
              </select>
              <a href="<?php 
        echo add_query_arg(array('action' => 'ContactFormMakerPreview', 'form_id' => $row->id, 'test_theme' => $row->theme, 'width' => '1000', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php'));
        ?>
" class="button-primary thickbox thickbox-preview" id="preview_form" title="<?php 
        echo __("Form Preview", "contact_form_maker");
        ?>
" onclick="return false;">
                <?php 
        echo __("Preview", "contact_form_maker");
        ?>
              </a>
              <a onclick="alert('<?php 
        echo addslashes(__("This option is disabled in free version.", "contact_form_maker"));
        ?>
'); return false;" href="#" class="button-secondary" id="edit_css" title="Edit CSS">
                <?php 
        echo __("Edit CSS", "contact_form_maker");
        ?>
              </a>
              <div class="spider_description spider_free_desc"><?php 
        echo __("Themes are disabled in free version.", "contact_form_maker");
        ?>
</div>
            </td>
          </tr>
          <tr valign="top">
            <td class="fm_options_label">
              <label for="requiredmark"><?php 
        echo __("Required fields mark", "contact_form_maker");
        ?>
</label>
            </td>
            <td class="fm_options_value">
              <input type="text" id="requiredmark" name="requiredmark" value="<?php 
        echo $row->requiredmark;
        ?>
" style="width: 250px;" />
            </td>
          </tr>
        </table>
      </fieldset>
      <fieldset id="custom_fieldset" class="adminform fm_fieldset_deactive">
        <legend style="color: #0B55C4; font-weight: bold;"><?php 
        echo __("Email Options", "contact_form_maker");
        ?>
</legend>
        <table class="admintable">
          <tr valign="top">
            <td style="padding: 15px;">
              <label><?php 
        echo __("Send E-mail", "contact_form_maker");
        ?>
</label>
            </td>
            <td style="padding: 15px;">
              <input type="radio" name="sendemail" id="sendemail_yes" value="1" <?php 
        echo $row->sendemail ? 'checked="checked"' : '';
        ?>
 /><label for="sendemail_yes"><?php 
        echo __("Yes", "contact_form_maker");
        ?>
</label>
              <input type="radio" name="sendemail" id="sendemail_no" value="0" <?php 
        echo !$row->sendemail ? 'checked="checked"' : '';
        ?>
 /><label for="sendemail_no"><?php 
        echo __("No", "contact_form_maker");
        ?>
</label>
            </td>
          </tr>
          <tr>
            <td style="padding: 15px;">
              <label><?php 
        echo __("Mailer", "contact_form_maker");
        ?>
</label>
            </td>
            <td style="padding: 15px;">
              <input type="radio" name="wpmail" id="wpmail_yes" value="1" <?php 
        echo $row->wpmail ? 'checked="checked"' : '';
        ?>
 /><label for="wpmail_yes">wp_mail() <?php 
        echo __('function', 'contact_form_maker');
        ?>
</label>
              <input type="radio" name="wpmail" id="wpmail_no" value="0" <?php 
        echo !$row->wpmail ? 'checked="checked"' : '';
        ?>
 /><label for="wpmail_no">PHP mail() <?php 
        echo __('function', 'contact_form_maker');
        ?>
</label>
            </td>
          </tr>
        </table>
        <fieldset class="fm_mail_options">
          <legend style="color: #0B55C4; font-weight: bold;"><?php 
        echo __("Email to Administrator", "contact_form_maker");
        ?>
</legend>
          <table class="admintable">
            <tr valign="top">
              <td class="fm_options_label">
                <label for="mailToAdd"><?php 
        echo __("Email to send submissions to", "contact_form_maker");
        ?>
</label>
              </td>
              <td class="fm_options_value">
                <input type="text" id="mailToAdd" name="mailToAdd" style="width: 250px;" />
                <input type="hidden" id="mail" name="mail" value="<?php 
        echo $row->mail;
        ?>
" />
                <img src="<?php 
        echo WD_CFM_URL . '/images/add.png';
        ?>
"
                     style="vertical-align: middle; cursor: pointer;"
                     title="<?php 
        echo __("Add more emails", "contact_form_maker");
        ?>
"
                     onclick="if (spider_check_email('mailToAdd')) {return false;};cfm_create_input('mail', 'mailToAdd', 'cfm_mail_div', '<?php 
        echo WD_CFM_URL;
        ?>
')" />
                <div id="cfm_mail_div">
                  <?php 
        $mail_array = explode(',', $row->mail);
        foreach ($mail_array as $mail) {
            if ($mail && $mail != ',') {
                ?>
                      <div class="fm_mail_input">
                        <?php 
                echo $mail;
                ?>
                        <img src="<?php 
                echo WD_CFM_URL;
                ?>
/images/delete.png" class="fm_delete_img" onclick="fm_delete_mail(this, '<?php 
                echo $mail;
                ?>
')" title="<?php 
                echo __("Delete Email", "contact_form_maker");
                ?>
" />
                      </div>
                      <?php 
            }
        }
        ?>
                </div>
              </td>
            </tr>
            <tr valign="top">
              <td class="fm_options_label">
                <label for="mail_from"><?php 
        echo __("Email From", "contact_form_maker");
        ?>
</label>
              </td>
              <td class="fm_options_value">
                <?php 
        $is_other = TRUE;
        $field_disabled = TRUE;
        for ($i = 0; $i < $fields_count - 1; $i++) {
            $field_id = substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*') + 15, strlen($fields[$i]));
            if (!in_array($field_id, $disabled_fields)) {
                $field_disabled = FALSE;
                ?>
                  <div>
                    <input type="radio" name="mail_from" id="mail_from<?php 
                echo $i;
                ?>
" value="<?php 
                echo $field_id;
                ?>
"  <?php 
                echo $field_id == $row->mail_from ? 'checked="checked"' : '';
                ?>
 onclick="wdhide('mail_from_other')" />
                    <label for="mail_from<?php 
                echo $i;
                ?>
"><?php 
                echo substr($fields[$i + 1], 0, strpos($fields[$i + 1], '*:*w_field_label*:*'));
                ?>
</label>
                  </div>
                    <?php 
                if ($field_id == $row->mail_from) {
                    $is_other = FALSE;
                }
            }
        }
        ?>
                <div style="<?php 
        echo $fields_count == 1 || $field_disabled ? 'display:none;' : '';
        ?>
">
                  <input type="radio" id="other" name="mail_from" value="other" <?php 
        echo $is_other ? 'checked="checked"' : '';
        ?>
 onclick="wdshow('mail_from_other')" />
                  <label for="other">Other</label>
                </div>
								<input type="text" style="width: <?php 
        echo $fields_count == 1 || $field_disabled ? '250px' : '235px; margin-left: 15px';
        ?>
; display: <?php 
        echo $is_other ? 'block;' : 'none;';
        ?>
" id="mail_from_other" name="mail_from_other" value="<?php 
        echo $is_other && !$field_disabled ? $row->mail_from : '';
        ?>
" />
              </td>
            </tr>
            <tr valign="top">
              <td class="fm_options_label">
                <label for="mail_from_name"><?php 
        echo __("From Name", "contact_form_maker");
        ?>
</label>
              </td>
              <td class="fm_options_value">
                <input type="text" id="mail_from_name" name="mail_from_name" value="<?php 
        echo $row->mail_from_name;
        ?>
" style="width: 250px;" />
                <img src="<?php 
        echo WD_CFM_URL . '/images/add.png';
        ?>
" onclick="document.getElementById('mail_from_labels').style.display='block';" style="vertical-align: middle; display:inline-block; margin:0px; float:none; cursor: pointer;" />
								<div style="position: relative; top: -3px;">
                  <div id="mail_from_labels" class="email_labels" style="display: none;">
                    <?php 
        $choise = "document.getElementById('mail_from_name')";
        for ($i = 0; $i < count($label_label); $i++) {
            if (!$field_exist[$i]) {
                continue;
            }
            $param = htmlspecialchars(addslashes($label_label[$i]));
            $fld_label = htmlspecialchars($label_label[$i]);
            if (strlen($fld_label) > 30) {
                $fld_label = wordwrap($fld_label, 30);
                $fld_label = explode("\n", $fld_label);
                $fld_label = $fld_label[0] . ' ...';
            }
            ?>
                      <a onClick="insertAtCursor(<?php 
            echo $choise;
            ?>
,'<?php 
            echo $param;
            ?>
'); document.getElementById('mail_from_labels').style.display='none';" style="display: block; text-decoration:none;"><?php 
            echo $fld_label;
            ?>
</a>
                      <?php 
        }
        ?>
                  </div>
                </div>
              </td>
            </tr>
            <tr valign="top">
              <td class="fm_options_label">
                <label for="reply_to"><?php 
        echo __("Reply to", "contact_form_maker");
        ?>
<br/>(<?php 
        echo __("if different from 'Email From'", "contact_form_maker");
        ?>
) </label>
              </td>
              <td class="fm_options_value">
                <?php 
        $is_other = TRUE;
        $field_disabled = TRUE;
        for ($i = 0; $i < $fields_count - 1; $i++) {
            $field_id = substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*') + 15, strlen($fields[$i]));
            if (!in_array($field_id, $disabled_fields)) {
                $field_disabled = FALSE;
                ?>
                  <div>
                    <input type="radio" name="reply_to" id="reply_to<?php 
                echo $i;
                ?>
" value="<?php 
                echo $field_id;
                ?>
"  <?php 
                echo $field_id == $row->reply_to ? 'checked="checked"' : '';
                ?>
 onclick="wdhide('reply_to_other')" />
                    <label for="reply_to<?php 
                echo $i;
                ?>
"><?php 
                echo substr($fields[$i + 1], 0, strpos($fields[$i + 1], '*:*w_field_label*:*'));
                ?>
</label>
                  </div>
                  <?php 
                if ($field_id == $row->reply_to) {
                    $is_other = FALSE;
                }
            }
        }
        ?>
								<div style="<?php 
        echo $fields_count == 1 || $field_disabled ? 'display: none;' : '';
        ?>
">
                  <input type="radio" id="other1" name="reply_to" value="other" <?php 
        echo $is_other ? 'checked="checked"' : '';
        ?>
 onclick="wdshow('reply_to_other')" />
                  <label for="other1"><?php 
        echo __("Other", "contact_form_maker");
        ?>
</label>
                </div>
								<input type="text" style="width: <?php 
        echo $fields_count == 1 || $field_disabled ? '250px' : '235px; margin-left: 15px';
        ?>
; display: <?php 
        echo $is_other ? 'block;' : 'none;';
        ?>
" id="reply_to_other" name="reply_to_other" value="<?php 
        echo $is_other && $row->reply_to && !$field_disabled ? $row->reply_to : '';
        ?>
" />
              </td>
            </tr>
            <tr valign="top">
							<td class="fm_options_label">
								<label for="mail_cc">CC: </label>
							</td>
							<td class="fm_options_value">
								<input type="text" id="mail_cc" name="mail_cc" value="<?php 
        echo $row->mail_cc;
        ?>
" style="width: 250px;" />
							</td>
						</tr>
						<tr valign="top">
							<td class="fm_options_label">
								<label for="mail_bcc">BCC: </label>
							</td>
							<td class="fm_options_value">
								<input type="text" id="mail_bcc" name="mail_bcc" value="<?php 
        echo $row->mail_bcc;
        ?>
" style="width: 250px;" />
							</td>
						</tr>
						<tr valign="top">
							<td class="fm_options_label">
								<label for="mail_subject"><?php 
        echo __("Subject", "contact_form_maker");
        ?>
: </label>
							</td>
							<td class="fm_options_value">
								<input type="text" id="mail_subject" name="mail_subject" value="<?php 
        echo $row->mail_subject == '' && !in_array($label_id[$default_subject], $disabled_fields) ? '%' . $label_label[$default_subject] . '%' : $row->mail_subject;
        ?>
" style="width: 250px;" />
								<img src="<?php 
        echo WD_CFM_URL . '/images/add.png';
        ?>
" onclick="document.getElementById('mail_subject_labels').style.display='block';" style="vertical-align: middle; display:inline-block; margin:0px; float:none; cursor: pointer;" />
								<div style="position: relative; top: -3px;">
                  <div id="mail_subject_labels" class="email_labels" style="display: none;" >
                    <?php 
        $choise = "document.getElementById('mail_subject')";
        for ($i = 0; $i < count($label_label); $i++) {
            if (!$field_exist[$i]) {
                continue;
            }
            $param = htmlspecialchars(addslashes($label_label[$i]));
            $fld_label = htmlspecialchars($label_label[$i]);
            if (strlen($fld_label) > 30) {
                $fld_label = wordwrap($fld_label, 30);
                $fld_label = explode("\n", $fld_label);
                $fld_label = $fld_label[0] . ' ...';
            }
            ?>
                      <a onClick="insertAtCursor(<?php 
            echo $choise;
            ?>
,'<?php 
            echo $param;
            ?>
'); document.getElementById('mail_subject_labels').style.display='none';" style="display: block; text-decoration: none;"><?php 
            echo $fld_label;
            ?>
</a>
                      <?php 
        }
        ?>
                  </div>
                </div>
							</td>
						</tr>
						<tr valign="top">
              <td class="fm_options_label" style="vertical-align: middle;">
                <label><?php 
        echo __("Mode", "contact_form_maker");
        ?>
: </label>
              </td>
              <td class="fm_options_value">
                <input type="radio" name="mail_mode" id="htmlmode" value="1" <?php 
        if ($row->mail_mode == 1) {
            echo 'checked="checked"';
        }
        ?>
 /><label for="htmlmode">HTML</label>
                <input type="radio" name="mail_mode" id="textmode" value="0" <?php 
        if ($row->mail_mode == 0) {
            echo 'checked="checked"';
        }
        ?>
 /><label for="textmode"><?php 
        echo __("Text", "contact_form_maker");
        ?>
</label>
              </td>
            </tr>
            <tr>
              <td class="fm_options_label" valign="top">
                <label><?php 
        echo __("Custom Text in Email For Administrator", "contact_form_maker");
        ?>
</label>
              </td>
              <td class="fm_options_value">
                <div style="margin-bottom:5px">
                  <?php 
        $choise = "document.getElementById('script_mail')";
        for ($i = 0; $i < count($label_label); $i++) {
            if (!$field_exist[$i]) {
                continue;
            }
            $param = htmlspecialchars(addslashes($label_label[$i]));
            ?>
                    <input style="border: 1px solid silver; font-size: 10px;" type="button" value="<?php 
            echo htmlspecialchars($label_label[$i]);
            ?>
" onClick="insertAtCursor(<?php 
            echo $choise;
            ?>
, '<?php 
            echo $param;
            ?>
')" />
                    <?php 
        }
        ?>
                  <input style="border: 1px solid silver; font-size: 11px; font-weight: bold; display: block;" type="button" value="<?php 
        echo __("All fields list", "contact_form_maker");
        ?>
" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
, 'all')" />
                </div>
                <?php 
        if (user_can_richedit()) {
            wp_editor($row->script_mail, 'script_mail', array('teeny' => FALSE, 'textarea_name' => 'script_mail', 'media_buttons' => FALSE, 'textarea_rows' => 5));
        } else {
            ?>
                  <textarea name="script_mail" id="script_mail" cols="20" rows="10" style="width: 300px; height: 450px;"><?php 
            echo $row->script_mail;
            ?>
</textarea>
                  <?php 
        }
        ?>
              </td>
            </tr>
          </table>
        </fieldset>
        <fieldset class="fm_mail_options">
          <legend style="color: #0B55C4; font-weight: bold;"><?php 
        echo __("Email to User", "contact_form_maker");
        ?>
</legend>
          <table class="admintable">
            <tr valign="top">
              <td class="fm_options_label">
                <label for="mail"><?php 
        echo __("Send to", "contact_form_maker");
        ?>
</label>
              </td>
              <td class="fm_options_value">
                <?php 
        $fields = explode('*:*id*:*type_submitter_mail*:*type*:*', $row->form_fields);
        $fields_count = count($fields);
        if ($fields_count == 1) {
            echo __("There is no email field", "contact_form_maker");
        } else {
            for ($i = 0; $i < $fields_count - 1; $i++) {
                ?>
                    <div>
                      <input type="checkbox" name="send_to<?php 
                echo $i;
                ?>
" id="send_to<?php 
                echo $i;
                ?>
" value="<?php 
                echo substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*') + 15, strlen($fields[$i]));
                ?>
"  <?php 
                echo is_numeric(strpos($row->send_to, '*' . substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*') + 15, strlen($fields[$i])) . '*')) ? 'checked="checked"' : '';
                ?>
 />
                      <label for="send_to<?php 
                echo $i;
                ?>
"><?php 
                echo substr($fields[$i + 1], 0, strpos($fields[$i + 1], '*:*w_field_label*:*'));
                ?>
</label>
                    </div>
                    <?php 
            }
        }
        ?>
              </td>
            </tr>
            <tr valign="top">
              <td class="fm_options_label">
                <label for="mail_from_user"><?php 
        echo __("Email From", "contact_form_maker");
        ?>
</label>
              </td>
              <td class="fm_options_value">
                <input type="text" id="mail_from_user" name="mail_from_user" value="<?php 
        echo $row->mail_from_user;
        ?>
" style="width: 250px;" />
              </td>
            </tr>
            <tr valign="top">
              <td class="fm_options_label">
                <label for="mail_from_name_user"><?php 
        echo __("From Name", "contact_form_maker");
        ?>
</label>
              </td>
              <td class="fm_options_value">
                <input type="text" id="mail_from_name_user" name="mail_from_name_user" value="<?php 
        echo $row->mail_from_name_user;
        ?>
" style="width: 250px;"/>
                <img src="<?php 
        echo WD_CFM_URL . '/images/add.png';
        ?>
" onclick="document.getElementById('mail_from_name_user_labels').style.display='block';" style="vertical-align: middle; display: inline-block; margin: 0px; float: none; cursor: pointer;" />
                <div style="position: relative; top: -3px;">
                  <div id="mail_from_name_user_labels" class="email_labels" style="display:none;">
                    <?php 
        $choise = "document.getElementById('mail_from_name_user')";
        for ($i = 0; $i < count($label_label); $i++) {
            if (!$field_exist[$i]) {
                continue;
            }
            $param = htmlspecialchars(addslashes($label_label[$i]));
            $fld_label = htmlspecialchars($label_label[$i]);
            if (strlen($fld_label) > 30) {
                $fld_label = wordwrap($fld_label, 30);
                $fld_label = explode("\n", $fld_label);
                $fld_label = $fld_label[0] . ' ...';
            }
            ?>
                      <a onClick="insertAtCursor(<?php 
            echo $choise;
            ?>
,'<?php 
            echo $param;
            ?>
'); document.getElementById('mail_from_name_user_labels').style.display='none';" style="display: block; text-decoration: none;"><?php 
            echo $fld_label;
            ?>
</a>
                      <?php 
        }
        ?>
                  </div>
                </div>
              </td>
            </tr>
            <tr valign="top">
              <td class="fm_options_label">
                <label for="reply_to_user"><?php 
        echo __("Reply to", "contact_form_maker");
        ?>
<br />(<?php 
        echo __("if different from 'Email From'", "contact_form_maker");
        ?>
)</label>
              </td>
              <td class="fm_options_value">
                <input type="text" id="reply_to_user" name="reply_to_user" value="<?php 
        echo $row->reply_to_user;
        ?>
" style="width: 250px;" />
              </td>
            </tr>
            <tr valign="top">
							<td class="fm_options_label">
								<label for="mail_cc_user">CC: </label>
							</td>
							<td class="fm_options_value">
								<input type="text" id="mail_cc_user" name="mail_cc_user" value="<?php 
        echo $row->mail_cc_user;
        ?>
" style="width: 250px;" />
							</td>
						</tr>
						<tr valign="top">
							<td class="fm_options_label">
								<label for="mail_bcc_user">BCC: </label>
							</td>
							<td class="fm_options_value">
								<input type="text" id="mail_bcc_user" name="mail_bcc_user" value="<?php 
        echo $row->mail_bcc_user;
        ?>
" style="width: 250px;" />
							</td>
						</tr>
						<tr valign="top">
							<td class="fm_options_label">
								<label for="mail_subject_user"><?php 
        echo __("Subject", "contact_form_maker");
        ?>
: </label>
							</td>
							<td class="fm_options_value">
								<input type="text" id="mail_subject_user" name="mail_subject_user" value="<?php 
        echo $row->mail_subject_user == '' && !in_array($label_id[$default_subject], $disabled_fields) ? '%' . $label_label[$default_subject] . '%' : $row->mail_subject_user;
        ?>
" style="width: 250px;" />
								<img src="<?php 
        echo WD_CFM_URL . '/images/add.png';
        ?>
" onclick="document.getElementById('mail_subject_user_labels').style.display='block';" style="vertical-align: middle; display: inline-block; margin: 0px; float: none; cursor: pointer;" />
								<div style="position: relative; top: -3px;">
                  <div id="mail_subject_user_labels" class="email_labels" style="display: none;">
                  <?php 
        $choise = "document.getElementById('mail_subject_user')";
        for ($i = 0; $i < count($label_label); $i++) {
            if (!$field_exist[$i]) {
                continue;
            }
            $param = htmlspecialchars(addslashes($label_label[$i]));
            $fld_label = htmlspecialchars($label_label[$i]);
            if (strlen($fld_label) > 30) {
                $fld_label = wordwrap($fld_label, 30);
                $fld_label = explode("\n", $fld_label);
                $fld_label = $fld_label[0] . ' ...';
            }
            ?>
                    <a onClick="insertAtCursor(<?php 
            echo $choise;
            ?>
,'<?php 
            echo $param;
            ?>
'); document.getElementById('mail_subject_user_labels').style.display='none';" style="display: block; text-decoration: none;"><?php 
            echo $fld_label;
            ?>
</a>
                    <?php 
        }
        ?>
                  </div>
                </div>
							</td>
						</tr>
						<tr valign="top">
              <td class="fm_options_label" style="vertical-align: middle;">
                <label><?php 
        echo __("Mode", "contact_form_maker");
        ?>
: </label>
              </td>
              <td class="fm_options_value">
                <input type="radio" name="mail_mode_user" id="htmlmode_user" value="1" <?php 
        if ($row->mail_mode_user == 1) {
            echo 'checked="checked"';
        }
        ?>
 /><label for="htmlmode_user">HTML</label>
                <input type="radio" name="mail_mode_user" id="textmode_user" value="0" <?php 
        if ($row->mail_mode_user == 0) {
            echo 'checked="checked"';
        }
        ?>
 /><label for="textmode_user"><?php 
        echo __("Text", "contact_form_maker");
        ?>
</label>
              </td>
            </tr>
            <tr>
              <td class="fm_options_label" valign="top">
                <label><?php 
        echo __("Custom Text in Email For User", "contact_form_maker");
        ?>
</label>
              </td>
              <td class="fm_options_value">
                <div style="margin-bottom:5px">
                  <?php 
        $choise = "document.getElementById('script_mail_user')";
        for ($i = 0; $i < count($label_label); $i++) {
            if (!$field_exist[$i]) {
                continue;
            }
            $param = htmlspecialchars(addslashes($label_label[$i]));
            ?>
                    <input style="border: 1px solid silver; font-size: 10px;" type="button" value="<?php 
            echo htmlspecialchars($label_label[$i]);
            ?>
" onClick="insertAtCursor(<?php 
            echo $choise;
            ?>
, '<?php 
            echo $param;
            ?>
')" />
                    <?php 
        }
        ?>
                  <input style="border: 1px solid silver; font-size: 11px; font-weight: bold; display: block;" type="button" value="All fields list" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
, 'all')" />
                </div>
                <?php 
        if (user_can_richedit()) {
            wp_editor($row->script_mail_user, 'script_mail_user', array('teeny' => FALSE, 'textarea_name' => 'script_mail_user', 'media_buttons' => FALSE, 'textarea_rows' => 5));
        } else {
            ?>
                  <textarea name="script_mail_user" id="script_mail_user" cols="20" rows="10" style="width: 300px; height: 450px;"><?php 
            echo $row->script_mail_user;
            ?>
</textarea>
                  <?php 
        }
        ?>
              </td>
            </tr>
          </table>
        </fieldset>
      </fieldset>
      <fieldset id="actions_fieldset" class="adminform fm_fieldset_deactive">
        <legend style="color: #0B55C4; font-weight: bold;"><?php 
        echo __("Actions after submission", "contact_form_maker");
        ?>
</legend>
        <table class="admintable">
          <tr valign="top">
            <td class="fm_options_label">
              <label><?php 
        echo __("Action type", "contact_form_maker");
        ?>
</label>
            </td>
            <td class="fm_options_value">
              <div><input type="radio" name="submit_text_type" id="text_type_none" onclick="set_type('none')" value="1" <?php 
        echo $row->submit_text_type != 2 && $row->submit_text_type != 3 && $row->submit_text_type != 4 && $row->submit_text_type != 5 ? "checked" : "";
        ?>
 /><label for="text_type_none"><?php 
        echo __("Stay on Form", "contact_form_maker");
        ?>
</label></div>
              <div><input type="radio" name="submit_text_type" id="text_type_post" onclick="set_type('post')" value="2" <?php 
        echo $row->submit_text_type == 2 ? "checked" : "";
        ?>
 /><label for="text_type_post"><?php 
        echo __("Post", "contact_form_maker");
        ?>
</label></label></div>
              <div><input type="radio" name="submit_text_type" id="text_type_page" onclick="set_type('page')" value="5" <?php 
        echo $row->submit_text_type == 5 ? "checked" : "";
        ?>
 /><label for="text_type_page"><?php 
        echo __("Page", "contact_form_maker");
        ?>
</label></label></div>
              <div><input type="radio" name="submit_text_type" id="text_type_custom_text" onclick="set_type('custom_text')" value="3" <?php 
        echo $row->submit_text_type == 3 ? "checked" : "";
        ?>
 /><label for="text_type_custom_text"><?php 
        echo __("Custom Text", "contact_form_maker");
        ?>
</label></label></div>
              <div><input type="radio" name="submit_text_type" id="text_type_url" onclick="set_type('url')" value="4" <?php 
        echo $row->submit_text_type == 4 ? "checked" : "";
        ?>
 /><label for="text_type_url">URL</div>
            </td>
          </tr>
          <tr id="none" <?php 
        echo $row->submit_text_type == 2 || $row->submit_text_type == 3 || $row->submit_text_type == 4 || $row->submit_text_type == 5 ? 'style="display:none"' : '';
        ?>
>
            <td class="fm_options_label">
              <label><?php 
        echo __("Stay on Form", "contact_form_maker");
        ?>
</label>
            </td>
            <td class="fm_options_value">
              <img src="<?php 
        echo WD_CFM_URL . '/images/tick.png';
        ?>
" border="0">
            </td>
          </tr>
          <tr id="post" <?php 
        echo $row->submit_text_type != 2 ? 'style="display: none"' : '';
        ?>
>
            <td class="fm_options_label">
              <label for="post_name"><?php 
        echo __("Post", "contact_form_maker");
        ?>
</label>
            </td>
            <td class="fm_options_value">
              <select id="post_name" name="post_name" style="width: 153px; font-size: 11px;">
                <option value="0">- <?php 
        echo __("Select Post", "contact_form_maker");
        ?>
 -</option>
                <?php 
        // The Query.
        $args = array('posts_per_page' => 10000);
        query_posts($args);
        // The Loop.
        while (have_posts()) {
            the_post();
            ?>
                <option value="<?php 
            $x = get_permalink(get_the_ID());
            echo $x;
            ?>
" <?php 
            echo $row->article_id == $x ? 'selected="selected"' : '';
            ?>
><?php 
            the_title();
            ?>
</option>
                <?php 
        }
        // Reset Query.
        wp_reset_query();
        ?>
              </select>
            </td>
          </tr>
          <tr id="page" <?php 
        echo $row->submit_text_type != 5 ? 'style="display: none"' : '';
        ?>
>
            <td class="fm_options_label">
              <label for="page_name"><?php 
        echo __("Page", "contact_form_maker");
        ?>
</label>
            </td>
            <td class="fm_options_value">
              <select id="page_name" name="page_name" style="width: 153px; font-size: 11px;">
                <option value="0">- <?php 
        echo __("Select Page", "contact_form_maker");
        ?>
 -</option>
                <?php 
        // The Query.
        $pages = get_pages();
        // The Loop.
        foreach ($pages as $page) {
            $page_id = get_page_link($page->ID);
            ?>
                <option value="<?php 
            echo $page_id;
            ?>
" <?php 
            echo $row->article_id == $page_id ? 'selected="selected"' : '';
            ?>
><?php 
            echo $page->post_title;
            ?>
</option>
                  <?php 
        }
        // Reset Query.
        wp_reset_query();
        ?>
              </select>
            </td>
          </tr>
          <tr id="custom_text" <?php 
        echo $row->submit_text_type != 3 ? 'style="display: none;"' : '';
        ?>
>
            <td class="fm_options_label">
              <label for="submit_text"><?php 
        echo __("Text", "contact_form_maker");
        ?>
</label>
            </td>
            <td class="fm_options_value">
              <?php 
        if (user_can_richedit()) {
            wp_editor($row->submit_text, 'submit_text', array('teeny' => FALSE, 'textarea_name' => 'submit_text', 'media_buttons' => FALSE, 'textarea_rows' => 5));
        } else {
            ?>
                <textarea cols="36" rows="5" id="submit_text" name="submit_text" style="resize: vertical;">
                  <?php 
            echo $row->submit_text;
            ?>
                </textarea>
                <?php 
        }
        ?>
            </td>
          </tr>
          <tr id="url" <?php 
        echo $row->submit_text_type != 4 ? 'style="display:none"' : '';
        ?>
>
            <td class="fm_options_label">
              <label for="url">URL</label>
            </td>
            <td class="fm_options_value">
              <input type="text" id="url" name="url" style="width:300px" value="<?php 
        echo $row->url;
        ?>
" />
            </td>
          </tr>
        </table>
      </fieldset>

      <input type="hidden" name="fieldset_id" id="fieldset_id" value="<?php 
        echo WDW_CFM_Library::get('fieldset_id', 'general');
        ?>
" />
      <input type="hidden" id="task" name="task" value=""/>
      <input type="hidden" id="current_id" name="current_id" value="<?php 
        echo $row->id;
        ?>
" />
    </form>
    <script>
      jQuery(window).load(function () {
        form_maker_options_tabs(jQuery("#fieldset_id").val());
        spider_popup();
        jQuery("#mail_from_labels, #mail_from_name_user_labels, #mail_subject_labels, #mail_subject_user_labels").mouseleave(function() {
          jQuery(this).hide();
        });
      });
    </script>
    <?php 
    }