public function execute($id = '', $startdate = '', $enddate = '', $submit_date = '', $submitter_ip = '', $username = '', $useremail = '', $form_fields = '', $show = '')
 {
     require_once WD_FM_DIR . '/framework/WDW_FM_Library.php';
     $task = WDW_FM_Library::get('action');
     if (method_exists($this, $task) && $task != 'display') {
         return $this->{$task}();
     } else {
         return $this->display((int) $id, $startdate, $enddate, $submit_date, $submitter_ip, $username, $useremail, $form_fields, $show);
     }
 }
 public function update_db()
 {
     global $wpdb;
     $id = isset($_POST['current_id']) ? (int) esc_html(stripslashes($_POST['current_id'])) : 0;
     $title = isset($_POST['title']) ? esc_html(stripslashes($_POST['title'])) : '';
     $css = isset($_POST['css']) ? stripslashes(preg_replace("/(^[\r\n]*|[\r\n]+)[\\s\t]*[\r\n]+/", "\n", $_POST['css'])) : '';
     $default = isset($_POST['default']) ? esc_html(stripslashes($_POST['default'])) : 0;
     $save = $wpdb->update($wpdb->prefix . 'formmaker_themes', array('title' => $title, 'css' => $css, 'default' => $default), array('id' => $id));
     if ($save !== FALSE) {
         echo WDW_FM_Library::message('Item Succesfully Saved.', 'updated');
     } else {
         echo WDW_FM_Library::message('Error. Please install plugin again.', 'error');
     }
 }
示例#3
0
    public function form_options($id)
    {
        $row = $this->model->get_row_data($id);
        $themes = $this->model->get_theme_rows_data();
        $queries = $this->model->get_queries_rows_data($id);
        $userGroups = get_editable_roles();
        $page_title = $row->title . ' form options';
        $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);
            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);
        ?>
    <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' => 'FormMakerPreview', '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' => 'FormMakerEditCSS', 'form_id' => $row->id), admin_url('admin-ajax.php'));
        ?>
&id=' + jQuery("#theme").val() + '&width=800&height=500&TB_iframe=1');
      }
		function set_condition() {
			field_condition = '';
			for(i=0;i<500;i++) {
				conditions = '';
				if(document.getElementById("condition"+i)) {
					field_condition+=document.getElementById("show_hide"+i).value+"*:*show_hide*:*";
					field_condition+=document.getElementById("fields"+i).value+"*:*field_label*:*";
					field_condition+=document.getElementById("all_any"+i).value+"*:*all_any*:*";
					for(k=0;k<500;k++) {
						if(document.getElementById("condition_div"+i+"_"+k)) {
							conditions+=document.getElementById("field_labels"+i+"_"+k).value+"***";
							conditions+=document.getElementById("is_select"+i+"_"+k).value+"***";
							if(document.getElementById("field_value"+i+"_"+k).tagName=="SELECT" ) {
								if(document.getElementById("field_value"+i+"_"+k).getAttribute('multiple')) {
									var sel = document.getElementById("field_value"+i+"_"+k);
									var selValues = '';
									for(m=0; m < sel.length; m++) {
										if(sel.options[m].selected)
										
										selValues += sel.options[m].value+"@@@";
									}
									conditions+=selValues;
								} else {
									conditions+=document.getElementById("field_value"+i+"_"+k).value;
								}								
							}
							else
								conditions+=document.getElementById("field_value"+i+"_"+k).value;
							conditions+="*:*next_condition*:*";
						}
					}
					field_condition+=conditions;
					field_condition+="*:*new_condition*:*";
				}
			}
			document.getElementById('condition').value = field_condition;
		}      
    
		function show_verify_options(s){
			if(s){
				jQuery(".verification_div").removeAttr( "style" );
				jQuery(".expire_link").removeAttr( "style" );
					
			} else{
				jQuery(".verification_div").css( 'display', 'none' );
				jQuery(".expire_link").css( 'display', 'none' );
			}
		}      
    </script>
    <style>
    .CodeMirror {
      border: 1px solid #ccc;
      font-size: 12px;
      margin-bottom: 6px;
      background: white;
    }
    </style>
    <div style="clear: both; float: left; width: 99%;">
      <div style="float:left; font-size: 14px; font-weight: bold;">
        This section allows you to edit form options.
        <a style="color: blue; text-decoration: none;" target="_blank" href="https://web-dorado.com/wordpress-form-maker-guide-3.html">Read More in User Manual</a>
      </div>
      <div style="float: right; text-align: right;">
        <a style="text-decoration: none;" target="_blank" href="https://web-dorado.com/files/fromFormMaker.php">
          <img width="215" border="0" alt="web-dorado.com" src="<?php 
        echo WD_FM_URL . '/images/wd_logo.png';
        ?>
" />
        </a>
      </div>
    </div>
    <form class="wrap" method="post" action="admin.php?page=manage_fm" style="float: left; width: 99%;" name="adminForm" id="adminForm">
      <?php 
        wp_nonce_field('nonce_fm', 'nonce_fm');
        ?>
      <h2><?php 
        echo $page_title;
        ?>
</h2>
      <div style="float: right; margin: 0 5px 0 0;">
        <input class="button-secondary" type="submit" onclick="if (fm_check_email('mailToAdd') ||
                                                                   fm_check_email('from_mail') ||
                                                                   fm_check_email('reply_to') ||
                                                                   fm_check_email('mail_from_user') ||
                                                                   fm_check_email('reply_to_user') ||
                                                                   fm_check_email('mail_from_other') ||
                                                                   fm_check_email('reply_to_other') ||
                                                                   fm_check_email('paypal_email')) {return false;}; set_condition(); fm_set_input_value('task', 'save_options')" value="Save"/>
        <input class="button-secondary" type="submit" onclick="if (fm_check_email('mailToAdd') ||
                                                                   fm_check_email('from_mail') ||
                                                                   fm_check_email('reply_to') ||
                                                                   fm_check_email('mail_from_user') ||
                                                                   fm_check_email('reply_to_user') ||
                                                                   fm_check_email('mail_from_other') ||
                                                                   fm_check_email('reply_to_other') ||
                                                                   fm_check_email('paypal_email')) {return false;}; set_condition(); fm_set_input_value('task', 'apply_options')" value="Apply"/>
        <input class="button-secondary" type="submit" onclick="fm_set_input_value('task', 'cancel_options')" value="Cancel"/>
      </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="#">General Options</a>
            </li>
            <li>
              <a id="custom" class="fm_fieldset_tab" onclick="form_maker_options_tabs('custom')" href="#">Email Options</a>
            </li>
            <li>
              <a id="actions" class="fm_fieldset_tab" onclick="form_maker_options_tabs('actions')" href="#">Actions after Submission</a>
            </li>
            <li>
              <a id="payment" class="fm_fieldset_tab" onclick="form_maker_options_tabs('payment')" href="#">Payment Options</a>
            </li>
            <li>
              <a id="javascript" class="fm_fieldset_tab" onclick="form_maker_options_tabs('javascript'); codemirror_for_javascript();" href="#">JavaScript</a>
            </li>
            <li>
              <a id="conditions" class="fm_fieldset_tab" onclick="form_maker_options_tabs('conditions')" href="#">Conditional Fields</a>
            </li>
            <li>
              <a id="mapping" class="fm_fieldset_tab" onclick="form_maker_options_tabs('mapping')" href="#" >MySQL Mapping</a>
            </li>
          </ul>
        </div>
      </div>
      <fieldset id="general_fieldset" class="adminform fm_fieldset_deactive">
        <legend style="color:#0B55C4;font-weight: bold;">General Options</legend>
        <table class="admintable">
          <tr valign="top">
            <td class="fm_options_label">
              <label>Published</label>
            </td>
            <td class="fm_options_value">
              <input type="radio" name="published" id="published_yes" value="1" <?php 
        echo $row->published ? "checked" : "";
        ?>
 /><label for="published_yes">Yes</label>
              <input type="radio" name="published" id="published_no" value="0" <?php 
        echo !$row->published ? "checked" : "";
        ?>
 /><label for="published_no">No</label>
            </td>
          </tr>
          <tr valign="top">
            <td class="fm_options_label">
              <label>Save data(to database)</label>
            </td>
            <td class="fm_options_value">
              <input type="radio" name="savedb" id="savedb_yes" value="1" <?php 
        echo $row->savedb ? "checked" : "";
        ?>
 /><label for="savedb_yes">Yes</label>
              <input type="radio" name="savedb" id="savedb_no" value="0" <?php 
        echo !$row->savedb ? "checked" : "";
        ?>
 /><label for="savedb_no">No</label>
            </td>
          </tr>
          <tr valign="top">
            <td class="fm_options_label">
              <label for="theme">Theme</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' : '';
            ?>
><?php 
            echo $theme->title;
            ?>
</option>
                  <?php 
        }
        ?>
              </select>
              
              <a href="<?php 
        echo add_query_arg(array('action' => 'FormMakerEditCSS', 'id' => $row->theme, 'form_id' => $row->id, 'width' => '1000', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php'));
        ?>
" class="button-secondary thickbox thickbox-preview" id="edit_css" title="Edit CSS" onclick="return false;">
                Edit CSS
              </a>
            </td>
          </tr>
          <tr valign="top">
            <td class="fm_options_label">
              <label for="requiredmark">Required fields mark</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>
        <div class="error_fm" style="padding: 5px; font-size: 14px;">Front end submissions are disabled in free version.</div>
        <fieldset class="adminform">
          <legend style="color:#0B55C4;font-weight: bold;">Front end submissions access level</legend>
          <table>
            <tr>
              <td class="key">
                <label for="name">
                  Allow User to see submissions:
                </label>
              </td>
              <td>
                <?php 
        $checked_UserGroup = explode(',', $row->user_id_wd);
        $i = 0;
        foreach ($userGroups as $val => $uG) {
            echo '<input disabled="disabled" type="checkbox" value="' . $val . '"  id="user_' . $i . '"';
            if (in_array($val, $checked_UserGroup)) {
                echo 'checked="checked"';
            }
            echo 'onchange="acces_level(' . count($userGroups) . ')"/><label for="user_' . $i . '">' . $uG["name"] . '</label><br>';
            $i++;
        }
        ?>
                <input disabled="disabled" type="checkbox" value="guest"  id="user_<?php 
        echo $i;
        ?>
" onchange="acces_level(<?php 
        echo count($userGroups);
        ?>
)"<?php 
        echo in_array('guest', $checked_UserGroup) ? 'checked="checked"' : '';
        ?>
/><label for="user_<?php 
        echo $i;
        ?>
">Guest</label>
                <input disabled="disabled" type="hidden" name="user_id_wd" value="<?php 
        echo $row->user_id_wd;
        ?>
" id="user_id_wd" />
              </td>
            </tr>              
          </table>
        </fieldset>
        <?php 
        $labels_for_submissions = $this->model->get_labels($id);
        $payment_info = $this->model->is_paypal($id);
        $labels_id_for_submissions = array();
        $label_titles_for_submissions = array();
        $labels_type_for_submissions = array();
        if ($labels_for_submissions) {
            $label_id_for_submissions = array();
            $label_order_original_for_submissions = array();
            $label_type_for_submissions = array();
            if (strpos($row->label_order, 'type_paypal_')) {
                $row->label_order = $row->label_order . "item_total#**id**#Item Total#**label**#type_paypal_payment_total#****#total#**id**#Total#**label**#type_paypal_payment_total#****#0#**id**#Payment Status#**label**#type_paypal_payment_status#****#";
            }
            $label_all_for_submissions = explode('#****#', $row->label_order);
            $label_all_for_submissions = array_slice($label_all_for_submissions, 0, count($label_all_for_submissions) - 1);
            foreach ($label_all_for_submissions as $key => $label_each) {
                $label_id_each = explode('#**id**#', $label_each);
                array_push($label_id_for_submissions, $label_id_each[0]);
                $label_order_each = explode('#**label**#', $label_id_each[1]);
                array_push($label_order_original_for_submissions, $label_order_each[0]);
                array_push($label_type_for_submissions, $label_order_each[1]);
            }
            foreach ($label_id_for_submissions as $key => $label) {
                if (in_array($label, $labels_for_submissions)) {
                    array_push($labels_type_for_submissions, $label_type_for_submissions[$key]);
                    array_push($labels_id_for_submissions, $label);
                    array_push($label_titles_for_submissions, $label_order_original_for_submissions[$key]);
                }
            }
        }
        $stats_labels = array();
        $stats_labels_ids = array();
        foreach ($labels_type_for_submissions as $key => $label_type_cur) {
            if ($label_type_cur == "type_checkbox" || $label_type_cur == "type_radio" || $label_type_cur == "type_own_select" || $label_type_cur == "type_country" || $label_type_cur == "type_paypal_select" || $label_type_cur == "type_paypal_radio" || $label_type_cur == "type_paypal_checkbox" || $label_type_cur == "type_paypal_shipping") {
                $stats_labels_ids[] = $labels_id_for_submissions[$key];
                $stats_labels[] = $label_titles_for_submissions[$key];
            }
        }
        ?>
        <script type="text/javascript">
          function inArray(needle, myarray) {
            var length = myarray.length;
            for(var i = 0; i < length; i++) {
                if(myarray[i] == needle) return true;
            }
            return false;
          }

          function checked_labels(class_name) {
            var checked_ids ='';            
            jQuery('.'+class_name).each(function() {
              if(this.checked) {
                checked_ids += this.value+',';		
              }
            });              
            if(class_name == 'filed_label') {
              document.getElementById("frontend_submit_fields").value = checked_ids ;
              if(checked_ids == document.getElementById("all_fields").value)
                document.getElementById("all_fields").checked = true;
              else
                document.getElementById("all_fields").checked = false;
            }
            else {
              document.getElementById("frontend_submit_stat_fields").value = checked_ids ;
              if(checked_ids == document.getElementById("all_stats_fields").value)
                document.getElementById("all_stats_fields").checked = true;
              else
                document.getElementById("all_stats_fields").checked = false;
            }
          }
          
          jQuery(document).ready(function () {
            jQuery('.filed_label').each(function() {
              if(document.getElementById("frontend_submit_fields").value == document.getElementById("all_fields").value)
                document.getElementById("all_fields").checked = true;
              if(inArray(this.value, document.getElementById("frontend_submit_fields").value.split(","))) {
                this.checked = true;
              }
            });

            jQuery('.stats_filed_label').each(function() {
              if(document.getElementById("frontend_submit_stat_fields").value == document.getElementById("all_stats_fields").value)
                document.getElementById("all_stats_fields").checked = true;          
              if(inArray(this.value, document.getElementById("frontend_submit_stat_fields").value.split(","))) {
                this.checked = true;		
              }              
            });
              
            jQuery(document).on('change','input[name="all_fields"]',function() {
                jQuery('.filed_label').prop("checked" , this.checked);
            });

            jQuery(document).on('change','input[name="all_stats_fields"]',function() {
                jQuery('.stats_filed_label').prop("checked" , this.checked);
            });
          });
        </script>

        <style>
          li{
          list-style-type: none;
          }

          .simple_table
          {
          padding-left: 0px !important;
          }

          .simple_table input, .simple_table label, .simple_table img
          {
          display:inline-block !important;
          float:none !important;
          }
        </style>
        <fieldset class="adminform">
          <legend style="color:#0B55C4;font-weight: bold;">Fields to hide in frontend submissions</legend>
          <?php 
        if (count($label_titles_for_submissions)) {
            ?>
            <table style="margin-left:-3px;">
              <tr>
                <td> 
                  <label>Select fields:</label>
                </td>
                <td  class="simple_table">
                  <ul id="form_fields">
                    <li>
                    <input disabled="disabled" type="checkbox" name="all_fields" id="all_fields" value="submit_id,<?php 
            echo implode(',', $labels_id_for_submissions) . "," . ($payment_info ? "payment_info" : "");
            ?>
" onclick="checked_labels('filed_label')"/>
                    <label for="all_fields">Select All</label>
                    </li>
                    <?php 
            echo "<li><input disabled=\"disabled\" type=\"checkbox\" id=\"submit_id\" name=\"submit_id\" value=\"submit_id\" class=\"filed_label\"  onclick=\"checked_labels('filed_label')\"><label for=\"submit_id\">ID</label></li>";
            for ($i = 0, $n = count($label_titles_for_submissions); $i < $n; $i++) {
                $field_label = $label_titles_for_submissions[$i];
                echo "<li><input disabled=\"disabled\" type=\"checkbox\" id=\"filed_label" . $i . "\" name=\"filed_label" . $i . "\" value=\"" . $labels_id_for_submissions[$i] . "\" class=\"filed_label\" onclick=\"checked_labels('filed_label')\"><label for=\"filed_label" . $i . "\">" . (strlen($field_label) > 80 ? substr($field_label, 0, 80) . '...' : $field_label) . "</label></li>";
            }
            if ($payment_info) {
                echo "<li><input disabled=\"disabled\" type=\"checkbox\" id=\"payment_info\" name=\"payment_info\" value=\"payment_info\" class=\"filed_label\" onclick=\"checked_labels('filed_label')\"><label for=\"payment_info\">Payment Info</label></li>";
            }
            ?>
                  </ul>
                  <input type="hidden" name="frontend_submit_fields" value="<?php 
            echo $row->frontend_submit_fields;
            ?>
" id="frontend_submit_fields" />
                </td>	
              </tr>
              <?php 
            if ($stats_labels) {
                ?>
              <tr id="stats">
                <td> 
                  <label>Stats fields:</label>
                </td>
                <td class="simple_table">
                  <ul id="stats_fields">
                    <li>
                    <input disabled="disabled" type="checkbox" name="all_stats_fields" id="all_stats_fields" value="<?php 
                echo implode(',', $stats_labels_ids) . ",";
                ?>
" onclick="checked_labels('stats_filed_label')">
                    <label for="all_stats_fields">Select All</label>
                    </li>
                    <?php 
                for ($i = 0, $n = count($stats_labels); $i < $n; $i++) {
                    $field_label = $stats_labels[$i];
                    echo "<li><input disabled=\"disabled\" type=\"checkbox\" id=\"stats_filed_label" . $i . "\" name=\"stats_filed_label" . $i . "\" value=\"" . $stats_labels_ids[$i] . "\" class=\"stats_filed_label\" onclick=\"checked_labels('stats_filed_label')\" ><label for=\"stats_filed_label" . $i . "\">" . (strlen($field_label) > 80 ? substr($field_label, 0, 80) . '...' : $field_label) . "</label></li>";
                }
                ?>
                  </ul>
                  <input type="hidden" name="frontend_submit_stat_fields" value="<?php 
                echo $row->frontend_submit_stat_fields;
                ?>
" id="frontend_submit_stat_fields" />
                </td>	
              </tr>
              <?php 
            }
            ?>
            </table>
          <?php 
        }
        ?>
        </fieldset>
      </fieldset>
      <fieldset id="custom_fieldset" class="adminform fm_fieldset_deactive">
        <legend style="color: #0B55C4; font-weight: bold;">Email Options</legend>
        <table class="admintable">
          <tr valign="top">
            <td style="padding: 15px; width:75px;">
              <label>Send E-mail</label>
            </td>
            <td style="padding: 15px;">
              <input type="radio" name="sendemail" id="sendemail_yes" value="1" <?php 
        echo $row->sendemail ? "checked" : "";
        ?>
 /><label for="sendemail_yes">Yes</label>
              <input type="radio" name="sendemail" id="sendemail_no" value="0" <?php 
        echo !$row->sendemail ? "checked" : "";
        ?>
 /><label for="sendemail_no">No</label>
            </td>
          </tr>
        </table>
        <fieldset class="fm_mail_options">
          <legend style="color:#0B55C4;font-weight: bold;">Email to Administrator</legend>
          <table class="admintable">
            <tr valign="top">
              <td class="fm_options_label">
                <label for="mailToAdd">Email to send submissions to</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 . ($row->mail && substr($row->mail, -1) != ',' ? ',' : '');
        ?>
" />
                <img src="<?php 
        echo WD_FM_URL . '/images/add.png';
        ?>
"
                     style="vertical-align: middle; cursor: pointer;"
                     title="Add more emails"
                     onclick="if (fm_check_email('mailToAdd')) {return false;};cfm_create_input('mail', 'mailToAdd', 'cfm_mail_div', '<?php 
        echo WD_FM_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_FM_URL;
                ?>
/images/delete.png" class="fm_delete_img" onclick="fm_delete_mail(this, '<?php 
                echo $mail;
                ?>
')" title="Delete Email" />
                      </div>
                      <?php 
            }
        }
        ?>
                </div>
              </td>
            </tr>
            <tr valign="top">
              <td class="fm_options_label">
                <label for="from_mail">Email From</label>
              </td>
              <td class="fm_options_value">
                <!--<input id="from_mail" name="from_mail" value="<?php 
        echo $row->from_mail;
        ?>
" style="width:250px;" />-->
                <?php 
        $is_other = TRUE;
        for ($i = 0; $i < $fields_count - 1; $i++) {
            ?>
                  <div>
                    <input type="radio" name="from_mail" id="from_mail<?php 
            echo $i;
            ?>
" value="<?php 
            echo strlen($fields[$i]) != 1 ? substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*') + 15, strlen($fields[$i])) : $fields[$i];
            ?>
"  <?php 
            echo (strlen($fields[$i]) != 1 ? substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*') + 15, strlen($fields[$i])) : $fields[$i]) == $row->from_mail ? 'checked="checked"' : '';
            ?>
 onclick="wdhide('mail_from_other')" />
                    <label for="from_mail<?php 
            echo $i;
            ?>
"><?php 
            echo substr($fields[$i + 1], 0, strpos($fields[$i + 1], '*:*w_field_label*:*'));
            ?>
</label>
                  </div>
                  <?php 
            if (strlen($fields[$i]) != 1) {
                if (substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*') + 15, strlen($fields[$i])) == $row->from_mail) {
                    $is_other = FALSE;
                }
            } else {
                if ($fields[$i] == $row->from_mail) {
                    $is_other = false;
                }
            }
        }
        ?>
                <div style="<?php 
        echo $fields_count == 1 ? 'display:none;' : '';
        ?>
">
                  <input type="radio" id="other" name="from_mail" 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 ? '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 ? $row->from_mail : '';
        ?>
" />
              </td>
            </tr>
            <tr valign="top">
              <td class="fm_options_label">
                <label for="from_name">From Name</label>
              </td>
              <td class="fm_options_value">
                <input type="text" id="from_name" name="from_name" value="<?php 
        echo $row->from_name;
        ?>
" style="width: 250px;" />
                <img src="<?php 
        echo WD_FM_URL . '/images/add.png';
        ?>
" onclick="document.getElementById('mail_from_labels').style.display='block';" style="vertical-align: middle; cursor: pointer;display:inline-block; margin:0px; float:none;">
								<?php 
        $choise = "document.getElementById('from_name')";
        echo '<div style="position:relative; top:-3px;"><div id="mail_from_labels" class="email_labels" style="display:none;">';
        echo "<a onClick=\"insertAtCursor(" . $choise . ",'username'); document.getElementById('mail_from_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Username</a>";
        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_mark_map" || $label_type[$i] == "type_captcha" || $label_type[$i] == "type_recaptcha" || $label_type[$i] == "type_button" || $label_type[$i] == "type_file_upload" || $label_type[$i] == "type_send_copy" || $label_type[$i] == "type_matrix") {
                continue;
            }
            $param = htmlspecialchars(addslashes($label_label[$i]));
            $fld_label = $param;
            if (strlen($fld_label) > 30) {
                $fld_label = wordwrap(htmlspecialchars(addslashes($label_label[$i])), 30);
                $fld_label = explode("\n", $fld_label);
                $fld_label = $fld_label[0] . ' ...';
            }
            echo "<a onClick=\"insertAtCursor(" . $choise . ",'" . $param . "'); document.getElementById('mail_from_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">" . $fld_label . "</a>";
        }
        echo "<a onClick=\"insertAtCursor(" . $choise . ",'subid'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Submission ID</a>";
        echo "<a onClick=\"insertAtCursor(" . $choise . ",'username'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Username</a>";
        echo '</div></div>';
        ?>
              </td>
            </tr>
            <tr valign="top">
              <td class="fm_options_label">
                <label for="reply_to">Reply to<br/>(if different from "Email From") </label>
              </td>
              <td class="fm_options_value">
                <!--<input id="reply_to" name="reply_to" value="<?php 
        echo $row->reply_to;
        ?>
" style="width:250px;"/>-->
                <?php 
        $is_other = TRUE;
        for ($i = 0; $i < $fields_count - 1; $i++) {
            ?>
                  <div>
                    <input type="radio" name="reply_to" id="reply_to<?php 
            echo $i;
            ?>
" value="<?php 
            echo strlen($fields[$i]) != 1 ? substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*') + 15, strlen($fields[$i])) : $fields[$i];
            ?>
"  <?php 
            echo (strlen($fields[$i]) != 1 ? substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*') + 15, strlen($fields[$i])) : $fields[$i]) == $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 (strlen($fields[$i]) != 1) {
                if (substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*') + 15, strlen($fields[$i])) == $row->reply_to) {
                    $is_other = FALSE;
                }
            } else {
                if ($fields[$i] == $row->reply_to) {
                    $is_other = false;
                }
            }
        }
        ?>
								<div style="<?php 
        echo $fields_count == 1 ? '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">Other</label>
                </div>
								<input type="text" style="width: <?php 
        echo $fields_count == 1 ? '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 ? $row->reply_to : '';
        ?>
" />
              </td>
            </tr>
            <tr valign="top">
							<td class="fm_options_label">
								<label> 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> 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> Subject: </label>
							</td>
							<td class="fm_options_value">
								<input type="text" id="mail_subject" name="mail_subject" value="<?php 
        echo $row->mail_subject;
        ?>
" style="width:250px;" />
								<img src="<?php 
        echo WD_FM_URL . '/images/add.png';
        ?>
" onclick="document.getElementById('mail_subject_labels').style.display='block';" style="vertical-align: middle;cursor: pointer; display:inline-block; margin:0px; float:none;">
								<?php 
        $choise = "document.getElementById('mail_subject')";
        echo '<div style="position:relative; top:-3px;"><div id="mail_subject_labels" class="email_labels" style="display:none;">';
        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_mark_map" || $label_type[$i] == "type_captcha" || $label_type[$i] == "type_recaptcha" || $label_type[$i] == "type_button" || $label_type[$i] == "type_file_upload" || $label_type[$i] == "type_send_copy" || $label_type[$i] == "type_matrix") {
                continue;
            }
            $param = htmlspecialchars(addslashes($label_label[$i]));
            $fld_label = $param;
            if (strlen($fld_label) > 30) {
                $fld_label = wordwrap(htmlspecialchars(addslashes($label_label[$i])), 30);
                $fld_label = explode("\n", $fld_label);
                $fld_label = $fld_label[0] . ' ...';
            }
            echo "<a onClick=\"insertAtCursor(" . $choise . ",'" . $param . "'); document.getElementById('mail_subject_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">" . $fld_label . "</a>";
        }
        echo "<a onClick=\"insertAtCursor(" . $choise . ",'subid'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Submission ID</a>";
        echo "<a onClick=\"insertAtCursor(" . $choise . ",'username'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Username</a>";
        echo '</div></div>';
        ?>
							</td>
						</tr>
						<tr valign="top">
              <td class="fm_options_label" style="vertical-align: middle;">
                <label> Mode: </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";
        }
        ?>
 /> <label for="htmlmode">HTML</label>
                <input type="radio" name="mail_mode" id="textmode" value="0" <?php 
        if ($row->mail_mode == 0) {
            echo "checked";
        }
        ?>
 /> <label for="textmode">Text</label>
              </td>
              </tr>
              <tr valign="top">
              <td class="fm_options_label" style="vertical-align: middle;">
                <label> Attach File: </label>
              </td>
              <td class="fm_options_value">
                <input type="radio" disabled="disabled" name="mail_attachment"  value="1" id="en_attach" <?php 
        if ($row->mail_attachment == 1) {
            echo "checked";
        }
        ?>
 /> <label for="en_attach">Yes</label>
                <input type="radio" disabled="disabled" name="mail_attachment" id="dis_attach" value="0" <?php 
        if ($row->mail_attachment == 0) {
            echo "checked";
        }
        ?>
 /> <label for="dis_attach">No</label>
                <div class="error_fm" style="padding: 5px; font-size: 14px;">File attach is disabled in free version.</div>
              </td>
            </tr>
			<tr valign="top">
              <td class="fm_options_label" style="vertical-align: middle;">
                <label> Email empty fields: </label>
              </td>
              <td class="fm_options_value">
                <input type="radio" name="mail_emptyfields"  value="1" id="en_mail_emptyfields" <?php 
        if ($row->mail_emptyfields == 1) {
            echo "checked";
        }
        ?>
 /> <label for="en_mail_emptyfields">Yes</label>
                <input type="radio" name="mail_emptyfields" id="dis_mail_emptyfields" value="0" <?php 
        if ($row->mail_emptyfields == 0) {
            echo "checked";
        }
        ?>
 /> <label for="dis_mail_emptyfields">No</label>
              </td>
            </tr>
            <tr>
              <td class="fm_options_label" valign="top">
                <label>Custom Text in Email For Administrator</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 ($label_type[$i] == "type_submit_reset" || $label_type[$i] == "type_editor" || $label_type[$i] == "type_map" || $label_type[$i] == "type_mark_map" || $label_type[$i] == "type_captcha" || $label_type[$i] == "type_recaptcha" || $label_type[$i] == "type_button" || $label_type[$i] == "type_send_copy") {
                continue;
            }
            $param = htmlspecialchars(addslashes($label_label[$i]));
            $fld_label = $param;
            if (strlen($fld_label) > 30) {
                $fld_label = wordwrap(htmlspecialchars(addslashes($label_label[$i])), 30);
                $fld_label = explode("\n", $fld_label);
                $fld_label = $fld_label[0] . ' ...';
            }
            if ($label_type[$i] == "type_file_upload") {
                $fld_label .= '(as image)';
            }
            ?>
                    <input style="border: 1px solid silver; font-size: 10px;" type="button" value="<?php 
            echo $fld_label;
            ?>
" onClick="insertAtCursor(<?php 
            echo $choise;
            ?>
, '<?php 
            echo $param;
            ?>
')" />
                    <?php 
        }
        ?>
                  <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Submission ID" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'subid')" />
                  <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Ip" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'ip')" />
                  <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Username" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'username')" />
                  <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="User Email" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'useremail')" />
                  <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="All fields list" 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;">Email to User</legend>
          <table class="admintable">
            <tr valign="top">
              <td class="fm_options_label">
                <label for="mail">Send to</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) {
            ?>
                  There is no email field
                  <?php 
        } 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 strlen($fields[$i]) != 1 ? substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*') + 15, strlen($fields[$i])) : $fields[$i];
                ?>
"  <?php 
                echo is_numeric(strpos($row->send_to, '*' . (strlen($fields[$i]) != 1 ? substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*') + 15, strlen($fields[$i])) : $fields[$i]) . '*')) ? 'checked="checked"' : '';
                ?>
 style="margin: 0px 5px 0px 0px;" />
                      <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">Email From</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">From Name</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_FM_URL . '/images/add.png';
        ?>
" onclick="document.getElementById('mail_from_name_user_labels').style.display='block';" style="vertical-align: middle;cursor: pointer; display:inline-block; margin:0px; float:none;">
                <?php 
        $choise = "document.getElementById('mail_from_name_user')";
        echo '<div style="position:relative; top:-3px;"><div id="mail_from_name_user_labels" class="email_labels" style="display:none;">';
        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_mark_map" || $label_type[$i] == "type_captcha" || $label_type[$i] == "type_recaptcha" || $label_type[$i] == "type_button" || $label_type[$i] == "type_file_upload" || $label_type[$i] == "type_send_copy") {
                continue;
            }
            $param = htmlspecialchars(addslashes($label_label[$i]));
            $fld_label = $param;
            if (strlen($fld_label) > 30) {
                $fld_label = wordwrap(htmlspecialchars(addslashes($label_label[$i])), 30);
                $fld_label = explode("\n", $fld_label);
                $fld_label = $fld_label[0] . ' ...';
            }
            echo "<a onClick=\"insertAtCursor(" . $choise . ",'" . $param . "'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">" . $fld_label . "</a>";
        }
        echo "<a onClick=\"insertAtCursor(" . $choise . ",'subid'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Submission ID</a>";
        echo "<a onClick=\"insertAtCursor(" . $choise . ",'username'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Username</a>";
        echo '</div></div>';
        ?>
              </td>
            </tr>
            <tr valign="top">
              <td class="fm_options_label">
                <label for="reply_to_user">Reply to<br />(if different from "Email Form")</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> 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> 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> Subject: </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;
        ?>
" style="width:250px;" />
								<img src="<?php 
        echo WD_FM_URL . '/images/add.png';
        ?>
" onclick="document.getElementById('mail_subject_user_labels').style.display='block';" style="vertical-align: middle; cursor: pointer; display:inline-block; margin:0px; float:none;">
								<?php 
        $choise = "document.getElementById('mail_subject_user')";
        echo '<div style="position:relative; top:-3px;"><div id="mail_subject_user_labels" class="email_labels" style="display:none;">';
        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_mark_map" || $label_type[$i] == "type_captcha" || $label_type[$i] == "type_recaptcha" || $label_type[$i] == "type_button" || $label_type[$i] == "type_file_upload" || $label_type[$i] == "type_send_copy") {
                continue;
            }
            $param = htmlspecialchars(addslashes($label_label[$i]));
            $fld_label = $param;
            if (strlen($fld_label) > 30) {
                $fld_label = wordwrap(htmlspecialchars(addslashes($label_label[$i])), 30);
                $fld_label = explode("\n", $fld_label);
                $fld_label = $fld_label[0] . ' ...';
            }
            echo "<a onClick=\"insertAtCursor(" . $choise . ",'" . $param . "'); document.getElementById('mail_subject_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">" . $fld_label . "</a>";
        }
        echo "<a onClick=\"insertAtCursor(" . $choise . ",'subid'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Submission ID</a>";
        echo "<a onClick=\"insertAtCursor(" . $choise . ",'username'); \t\t\tdocument.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Username</a>";
        echo '</div></div>';
        ?>
							</td>
						</tr>
						<tr valign="top">
              <td class="fm_options_label" style="vertical-align: middle;">
                <label> Mode: </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";
        }
        ?>
 /> <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";
        }
        ?>
 /> <label for="textmode_user">Text</label>
              </td>
            </tr>
            <tr valign="top">
              <td class="fm_options_label" style="vertical-align: middle;">
                <label> Attach File: </label>
              </td>
              <td class="fm_options_value">
                <input type="radio" disabled="disabled" name="mail_attachment_user"  value="1" id="en_attach_user" <?php 
        if ($row->mail_attachment_user == 1) {
            echo "checked";
        }
        ?>
 /> <label for="en_attach_user">Yes</label>
                <input type="radio" disabled="disabled" name="mail_attachment_user" id="dis_attach_user" value="0" <?php 
        if ($row->mail_attachment_user == 0) {
            echo "checked";
        }
        ?>
 /> <label for="dis_attach_user">No</label>
                <div class="error_fm" style="padding: 5px; font-size: 14px;">File attach is disabled in free version.</div>
              </td>
            </tr>
			<tr valign="top">
				<td class="fm_options_label" style="vertical-align: middle;">
					<label> Email verification: </label>
				</td>
				<td class="fm_options_value">
					<input type="radio" name="mail_verify"  value="1" id="en_mail_verify" <?php 
        if ($row->mail_verify == 1) {
            echo "checked";
        }
        ?>
 onClick = "show_verify_options(true)" /> <label for="en_mail_verify">Yes</label>
					<input type="radio" name="mail_verify" id="dis_mail_verify" value="0" <?php 
        if ($row->mail_verify == 0) {
            echo "checked";
        }
        ?>
 onClick = "show_verify_options(false)"/> <label for="dis_mail_verify">No</label>
				</td>
            </tr>
			<tr valign="top" class="expire_link" <?php 
        echo $row->mail_verify == 0 ? 'style="display:none;"' : '';
        ?>
>
				<td class="fm_options_label" valign="top">
					<label> Verification link expires in: </label>
				</td>
				<td class="fm_options_value">
					<input class="inputbox" type="text" name="mail_verify_expiretime" maxlength="10"  value = "<?php 
        echo $row->mail_verify_expiretime ? $row->mail_verify_expiretime : 0;
        ?>
" style="width:95px;" onkeypress="return check_isnum_point(event)"/><small> -- hours (0 - never expires).</small>
				</td>
			</tr>
            <tr>
              <td class="fm_options_label" valign="top">
                <label>Custom Text in Email For User</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 ($label_type[$i] == "type_submit_reset" || $label_type[$i] == "type_editor" || $label_type[$i] == "type_map" || $label_type[$i] == "type_mark_map" || $label_type[$i] == "type_captcha" || $label_type[$i] == "type_recaptcha" || $label_type[$i] == "type_button" || $label_type[$i] == "type_file_upload" || $label_type[$i] == "type_send_copy") {
                continue;
            }
            $param = htmlspecialchars(addslashes($label_label[$i]));
            $fld_label = $param;
            if (strlen($fld_label) > 30) {
                $fld_label = wordwrap(htmlspecialchars(addslashes($label_label[$i])), 30);
                $fld_label = explode("\n", $fld_label);
                $fld_label = $fld_label[0] . ' ...';
            }
            if ($label_type[$i] == "type_file_upload") {
                $fld_label .= '(as image)';
            }
            ?>
                    <input style="border: 1px solid silver; font-size: 10px;" type="button" value="<?php 
            echo htmlspecialchars(addslashes($label_label[$i]));
            ?>
" onClick="insertAtCursor(<?php 
            echo $choise;
            ?>
, '<?php 
            echo $param;
            ?>
')" />
                    <?php 
        }
        ?>
				  <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Submission ID" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'subid')" />
                  <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Ip" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'ip')" />
                  <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Username" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'username')" />
                  <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="User Email" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'useremail')" />
                  <input style="border: 1px solid silver; font-size: 10px; margin:3px;" type="button" value="All fields list" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
, 'all')" />
				  <div class="verification_div" <?php 
        echo $row->mail_verify == 0 ? 'style="display:none;"' : '';
        ?>
><input style="border: 1px solid silver; font-size: 10px; margin:3px;" type="button" value="Verification link" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'Verification link')" /> </div>
                </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;">Actions after submission</legend>
        <table class="admintable">
          <tr valign="top">
            <td class="fm_options_label">
              <label>Action type</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">Stay on Form</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">Post</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">Page</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">Custom Text</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>Stay on Form</label>
            </td>
            <td class="fm_options_value">
              <img src="<?php 
        echo WD_FM_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">Post</label>
            </td>
            <td class="fm_options_value">
              <select id="post_name" name="post_name" style="width: 153px; font-size: 11px;">
                <option value="0">- Select Post -</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">Page</label>
            </td>
            <td class="fm_options_value">
              <select id="page_name" name="page_name" style="width: 153px; font-size: 11px;">
                <option value="0">- Select Page -</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">Text</label>
            </td>
            <td class="fm_options_value">
				<?php 
        $choise = "document.getElementById('submit_text')";
        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_mark_map" || $label_type[$i] == "type_captcha" || $label_type[$i] == "type_recaptcha" || $label_type[$i] == "type_button" || $label_type[$i] == "type_send_copy" || $label_type[$i] == "type_file_upload") {
                continue;
            }
            $param = htmlspecialchars(addslashes($label_label[$i]));
            $fld_label = $param;
            if (strlen($fld_label) > 30) {
                $fld_label = wordwrap(htmlspecialchars(addslashes($label_label[$i])), 30);
                $fld_label = explode("\n", $fld_label);
                $fld_label = $fld_label[0] . ' ...';
            }
            ?>
                    <input style="border: 1px solid silver; font-size: 10px;" type="button" value="<?php 
            echo $fld_label;
            ?>
" onClick="insertAtCursor(<?php 
            echo $choise;
            ?>
, '<?php 
            echo $param;
            ?>
')" />
                    <?php 
        }
        ?>
				<input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Submission ID" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'subid')" />
                <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Ip" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'ip')" />
				<input style="border: 1px solid silver; font-size: 10px; margin:3px;" type="button" value="User Id" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
, 'userid')" />
                <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Username" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'username')" />
                <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="User Email" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'useremail')" />
              <?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>
      <fieldset id="payment_fieldset" class="adminform fm_fieldset_deactive">
        <legend style="color:#0B55C4;font-weight: bold;">Payment Options</legend>
        <table class="admintable">
          <tr>
            <td colspan="2">
              <div class="error_fm" style="padding: 5px; font-size: 14px;">Paypal Options are disabled in free version.</div>
            </td>
          </tr>
          <tr valign="top">
            <td class="fm_options_label">
              <label>Turn Paypal On</label>
            </td>
            <td class="fm_options_value">
              <div><input disabled="disabled" type="radio" name="paypal_mode" id="paypal_mode1" value="1" <?php 
        echo $row->paypal_mode == "1" ? "checked" : "";
        ?>
 /><label for="paypal_mode1">On</label></div>
              <div><input disabled="disabled" type="radio" name="paypal_mode" id="paypal_mode2" value="0" <?php 
        echo $row->paypal_mode != "1" ? "checked" : "";
        ?>
 /><label for="paypal_mode2">Off</label></div>
            </td>
          </tr>
          <tr valign="top">
            <td class="fm_options_label">
              <label>Checkout Mode</label>
            </td>
            <td class="fm_options_value">
              <div><input disabled="disabled" type="radio" name="checkout_mode" id="checkout_mode1" value="production" <?php 
        echo $row->checkout_mode == "production" ? "checked" : "";
        ?>
 /><label for="checkout_mode1">Production</label></div>
              <div><input disabled="disabled" type="radio" name="checkout_mode" id="checkout_mode2" value="testmode" <?php 
        echo $row->checkout_mode != "production" ? "checked" : "";
        ?>
 /><label for="checkout_mode2">Testmode</label></div>
            </td>
          </tr>
          <tr valign="top">
            <td class="fm_options_label">
              <label for="paypal_email">Paypal email</label>
            </td>
            <td class="fm_options_value">
              <input disabled="disabled" type="text" name="paypal_email" id="paypal_email" value="<?php 
        echo $row->paypal_email;
        ?>
" class="text_area" style="width:250px">
            </td>
          </tr>
          <tr valign="top">
            <td class="fm_options_label">
              <label for="payment_currency">Payment Currency</label>
            </td>
            <td class="fm_options_value">
              <select disabled="disabled" id="payment_currency" name="payment_currency" style="width:253px">
                <option value="USD" <?php 
        echo $row->payment_currency == 'USD' ? 'selected' : '';
        ?>
>$ &#8226; U.S. Dollar</option>
                <option value="EUR" <?php 
        echo $row->payment_currency == 'EUR' ? 'selected' : '';
        ?>
>&#8364; &#8226; Euro</option>
                <option value="GBP" <?php 
        echo $row->payment_currency == 'GBP' ? 'selected' : '';
        ?>
>&#163; &#8226; Pound Sterling</option>
                <option value="JPY" <?php 
        echo $row->payment_currency == 'JPY' ? 'selected' : '';
        ?>
>&#165; &#8226; Japanese Yen</option>
                <option value="CAD" <?php 
        echo $row->payment_currency == 'CAD' ? 'selected' : '';
        ?>
>C$ &#8226; Canadian Dollar</option>
                <option value="MXN" <?php 
        echo $row->payment_currency == 'MXN' ? 'selected' : '';
        ?>
>Mex$ &#8226; Mexican Peso</option>
                <option value="HKD" <?php 
        echo $row->payment_currency == 'HKD' ? 'selected' : '';
        ?>
>HK$ &#8226; Hong Kong Dollar</option>
                <option value="HUF" <?php 
        echo $row->payment_currency == 'HUF' ? 'selected' : '';
        ?>
>Ft &#8226; Hungarian Forint</option>
                <option value="NOK" <?php 
        echo $row->payment_currency == 'NOK' ? 'selected' : '';
        ?>
>kr &#8226; Norwegian Kroner</option>
                <option value="NZD" <?php 
        echo $row->payment_currency == 'NZD' ? 'selected' : '';
        ?>
>NZ$ &#8226; New Zealand Dollar</option>
                <option value="SGD" <?php 
        echo $row->payment_currency == 'SGD' ? 'selected' : '';
        ?>
>S$ &#8226; Singapore Dollar</option>
                <option value="SEK" <?php 
        echo $row->payment_currency == 'SEK' ? 'selected' : '';
        ?>
>kr &#8226; Swedish Kronor</option>
                <option value="PLN" <?php 
        echo $row->payment_currency == 'PLN' ? 'selected' : '';
        ?>
>zl &#8226; Polish Zloty</option>
                <option value="AUD" <?php 
        echo $row->payment_currency == 'AUD' ? 'selected' : '';
        ?>
>A$ &#8226; Australian Dollar</option>
                <option value="DKK" <?php 
        echo $row->payment_currency == 'DKK' ? 'selected' : '';
        ?>
>kr &#8226; Danish Kroner</option>
                <option value="CHF" <?php 
        echo $row->payment_currency == 'CHF' ? 'selected' : '';
        ?>
>CHF &#8226; Swiss Francs</option>
                <option value="CZK" <?php 
        echo $row->payment_currency == 'CZK' ? 'selected' : '';
        ?>
>Kc &#8226; Czech Koruny</option>
                <option value="ILS" <?php 
        echo $row->payment_currency == 'ILS' ? 'selected' : '';
        ?>
>&#8362; &#8226; Israeli Sheqel</option>
                <option value="BRL" <?php 
        echo $row->payment_currency == 'BRL' ? 'selected' : '';
        ?>
>R$ &#8226; Brazilian Real</option>
                <option value="TWD" <?php 
        echo $row->payment_currency == 'TWD' ? 'selected' : '';
        ?>
>NT$ &#8226; Taiwan New Dollars</option>
                <option value="MYR" <?php 
        echo $row->payment_currency == 'MYR' ? 'selected' : '';
        ?>
>RM &#8226; Malaysian Ringgit</option>
                <option value="PHP" <?php 
        echo $row->payment_currency == 'PHP' ? 'selected' : '';
        ?>
>&#8369; &#8226; Philippine Peso</option>
                <option value="THB" <?php 
        echo $row->payment_currency == 'THB' ? 'selected' : '';
        ?>
>&#xe3f; &#8226; Thai Bahtv</option>
              </select>
            </td>
          </tr>
          <tr valign="top">
            <td class="fm_options_label">
              <label for="tax">Tax</label>
            </td>
            <td class="fm_options_value">
              <input type="text" name="tax" id="tax" value="<?php 
        echo $row->tax;
        ?>
" class="text_area" style="width: 40px;" onKeyPress="return check_isnum_point(event)"> %
            </td>
          </tr>
        </table>
      </fieldset>
      <fieldset id="javascript_fieldset" class="adminform fm_fieldset_deactive">
        <legend style="color:#0B55C4;font-weight: bold;">JavaScript</legend>
        <table class="admintable">
          <tr valign="top">
            <td class="fm_options_label">
              <label for="javascript">Javascript</label>
            </td>
            <td class="fm_options_value" style="width:650px;">
              <textarea style="margin: 0px; height: 400px; width: 600px;" cols="60" rows="30" name="javascript" id="form_javascript"><?php 
        echo $row->javascript;
        ?>
</textarea>
            </td>
          </tr>
        </table>
      </fieldset>
      <fieldset id="conditions_fieldset" class="adminform fm_fieldset_deactive">
				<legend style="color:#0B55C4;font-weight: bold;">Conditional Fields</legend>
				<?php 
        $ids = array();
        $types = array();
        $labels = array();
        $paramss = array();
        $all_ids = array();
        $all_labels = array();
        $select_and_input = array("type_text", "type_password", "type_textarea", "type_name", "type_number", "type_phone", "type_submitter_mail", "type_address", "type_spinner", "type_checkbox", "type_radio", "type_own_select", "type_paypal_price", "type_paypal_select", "type_paypal_checkbox", "type_paypal_radio", "type_paypal_shipping");
        $select_type_fields = array("type_address", "type_checkbox", "type_radio", "type_own_select", "type_paypal_select", "type_paypal_checkbox", "type_paypal_radio", "type_paypal_shipping");
        $fields = explode('*:*new_field*:*', $row->form_fields);
        $fields = array_slice($fields, 0, count($fields) - 1);
        foreach ($fields as $field) {
            $temp = explode('*:*id*:*', $field);
            array_push($ids, $temp[0]);
            array_push($all_ids, $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($all_labels, $temp[0]);
            array_push($paramss, $temp[1]);
        }
        foreach ($types as $key => $value) {
            if (!in_array($types[$key], $select_and_input)) {
                unset($ids[$key]);
                unset($labels[$key]);
                unset($types[$key]);
                unset($paramss[$key]);
            }
        }
        $ids = array_values($ids);
        $labels = array_values($labels);
        $types = array_values($types);
        $paramss = array_values($paramss);
        $chose_ids = implode('@@**@@', $ids);
        $chose_labels = implode('@@**@@', $labels);
        $chose_types = implode('@@**@@', $types);
        $chose_paramss = implode('@@**@@', $paramss);
        $all_ids_cond = implode('@@**@@', $all_ids);
        $all_labels_cond = implode('@@**@@', $all_labels);
        $show_hide = array();
        $field_label = array();
        $all_any = array();
        $condition_params = array();
        $count_of_conditions = 0;
        if ($row->condition != "") {
            $conditions = explode('*:*new_condition*:*', $row->condition);
            $conditions = array_slice($conditions, 0, count($conditions) - 1);
            $count_of_conditions = count($conditions);
            foreach ($conditions as $condition) {
                $temp = explode('*:*show_hide*:*', $condition);
                array_push($show_hide, $temp[0]);
                $temp = explode('*:*field_label*:*', $temp[1]);
                array_push($field_label, $temp[0]);
                $temp = explode('*:*all_any*:*', $temp[1]);
                array_push($all_any, $temp[0]);
                array_push($condition_params, $temp[1]);
            }
        } else {
            $show_hide[0] = 1;
            $all_any[0] = 'and';
            $condition_params[0] = '';
            if ($all_ids) {
                $field_label[0] = $all_ids[0];
            }
        }
        ?>
					<div>
					<span style="font-size:13px;">Add Condition<span/>
					<img src="<?php 
        echo WD_FM_URL . '/images/add_condition.png';
        ?>
" title="add" onclick="add_condition('<?php 
        echo $chose_ids;
        ?>
', '<?php 
        echo htmlspecialchars(addslashes($chose_labels));
        ?>
', '<?php 
        echo $chose_types;
        ?>
', '<?php 
        echo htmlspecialchars(addslashes($chose_paramss));
        ?>
', '<?php 
        echo $all_ids_cond;
        ?>
', '<?php 
        echo htmlspecialchars(addslashes($all_labels_cond));
        ?>
')" style="cursor: pointer; vertical-align: middle; margin-left:15px;">
					</div>
					<?php 
        for ($k = 0; $k < $count_of_conditions; $k++) {
            if (in_array($field_label[$k], $all_ids)) {
                ?>
					<div id="condition<?php 
                echo $k;
                ?>
" >
						<div id="conditional_fileds<?php 
                echo $k;
                ?>
">
							<select id="show_hide<?php 
                echo $k;
                ?>
" name="show_hide<?php 
                echo $k;
                ?>
" style="width:80px; ">
							<option value="1" <?php 
                if ($show_hide[$k] == 1) {
                    echo 'selected="selected"';
                }
                ?>
>show</option>
							<option value="0" <?php 
                if ($show_hide[$k] == 0) {
                    echo 'selected="selected"';
                }
                ?>
>hide</option>
							</select> 
							
							<select id="fields<?php 
                echo $k;
                ?>
" name="fields<?php 
                echo $k;
                ?>
" style="width:400px; " onChange="" >
							<?php 
                foreach ($all_labels as $key => $value) {
                    if ($field_label[$k] == $all_ids[$key]) {
                        $selected = 'selected="selected"';
                    } else {
                        $selected = '';
                    }
                    echo '<option value="' . $all_ids[$key] . '" ' . $selected . '>' . $value . '</option>';
                }
                ?>
							</select> 
							<span>if</span>
							
							<select id="all_any<?php 
                echo $k;
                ?>
" name="all_any<?php 
                echo $k;
                ?>
" style="width:60px; ">
							<option value="and" <?php 
                if ($all_any[$k] == "and") {
                    echo 'selected="selected"';
                }
                ?>
>all</option>
							<option value="or" <?php 
                if ($all_any[$k] == "or") {
                    echo 'selected="selected"';
                }
                ?>
>any</option>
							</select> 
							
							<span>of the following match:</span>	
							<img src="<?php 
                echo WD_FM_URL . '/images/add.png';
                ?>
" title="add" onclick="add_condition_fields(<?php 
                echo $k;
                ?>
,'<?php 
                echo $chose_ids;
                ?>
', '<?php 
                echo htmlspecialchars(addslashes($chose_labels));
                ?>
', '<?php 
                echo $chose_types;
                ?>
', '<?php 
                echo htmlspecialchars(addslashes($chose_paramss));
                ?>
')" style="cursor: pointer; vertical-align: middle;">
							
							<img src="<?php 
                echo WD_FM_URL . '/images/page_delete.png';
                ?>
" onclick="delete_condition('<?php 
                echo $k;
                ?>
')" style="cursor: pointer; vertical-align: middle;">
						</div>
						
						<?php 
                if ($condition_params[$k]) {
                    $_params = explode('*:*next_condition*:*', $condition_params[$k]);
                    $_params = array_slice($_params, 0, count($_params) - 1);
                    foreach ($_params as $key => $_param) {
                        $key_select_or_input = '';
                        $param_values = explode('***', $_param);
                        $multiselect = explode('@@@', $param_values[2]);
                        if (in_array($param_values[0], $ids)) {
                            ?>
								<div id="condition_div<?php 
                            echo $k;
                            ?>
_<?php 
                            echo $key;
                            ?>
">
								<select id="field_labels<?php 
                            echo $k;
                            ?>
_<?php 
                            echo $key;
                            ?>
" onchange="change_choices(this.options[this.selectedIndex].id+'_<?php 
                            echo $key;
                            ?>
','<?php 
                            echo $chose_ids;
                            ?>
', '<?php 
                            echo $chose_types;
                            ?>
', '<?php 
                            echo htmlspecialchars(addslashes($chose_paramss));
                            ?>
')" style="width:350px;"/>
									<?php 
                            foreach ($labels as $key1 => $value) {
                                if ($param_values[0] == $ids[$key1]) {
                                    $selected = 'selected="selected"';
                                    if ($types[$key1] == "type_checkbox" || $types[$key1] == "type_paypal_checkbox") {
                                        $multiple = 'multiple="multiple" class="multiple_select"';
                                    } else {
                                        $multiple = '';
                                    }
                                    $key_select_or_input = $key1;
                                } else {
                                    $selected = '';
                                }
                                if ($field_label[$k] != $ids[$key1]) {
                                    echo '<option id="' . $k . '_' . $key1 . '" value="' . $ids[$key1] . '" ' . $selected . '>' . $value . '</option>';
                                }
                            }
                            ?>
	
								</select>
								
								<select id="is_select<?php 
                            echo $k;
                            ?>
_<?php 
                            echo $key;
                            ?>
" style="vertical-align: top;">
								<option value="==" <?php 
                            if ($param_values[1] == "==") {
                                echo 'selected="selected"';
                            }
                            ?>
>is</option>
								<option value="!=" <?php 
                            if ($param_values[1] == "!=") {
                                echo 'selected="selected"';
                            }
                            ?>
>is not</option>
								<option value="%" <?php 
                            if ($param_values[1] == "%") {
                                echo 'selected="selected"';
                            }
                            ?>
>like</option>

								<option value="!%" <?php 
                            if ($param_values[1] == "!%") {
                                echo 'selected="selected"';
                            }
                            ?>
>not like</option>

								<option value="=" <?php 
                            if ($param_values[1] == "=") {
                                echo 'selected="selected"';
                            }
                            ?>
>empty</option>

								<option value="!" <?php 
                            if ($param_values[1] == "!") {
                                echo 'selected="selected"';
                            }
                            ?>
>not empty</option>

								</select>
								
								<?php 
                            if ($key_select_or_input !== '' && in_array($types[$key_select_or_input], $select_type_fields)) {
                                ?>
								<select id="field_value<?php 
                                echo $k;
                                ?>
_<?php 
                                echo $key;
                                ?>
" <?php 
                                echo $multiple;
                                ?>
 style="vertical-align: top; width: 200px;">
								<?php 
                                switch ($types[$key_select_or_input]) {
                                    case "type_own_select":
                                    case "type_paypal_select":
                                        $w_size = explode('*:*w_size*:*', $paramss[$key_select_or_input]);
                                        break;
                                    case "type_radio":
                                    case "type_checkbox":
                                    case "type_paypal_radio":
                                    case "type_paypal_checkbox":
                                    case "type_paypal_shipping":
                                        $w_size = explode('*:*w_flow*:*', $paramss[$key_select_or_input]);
                                        break;
                                }
                                $w_choices = explode('*:*w_choices*:*', $w_size[1]);
                                $w_choices_array = explode('***', $w_choices[0]);
                                $w_choices_price = explode('*:*w_choices_price*:*', $w_choices[1]);
                                $w_choices_price_array = explode('***', $w_choices_price[0]);
                                for ($m = 0; $m < count($w_choices_array); $m++) {
                                    if ($types[$key_select_or_input] == "type_paypal_checkbox" || $types[$key_select_or_input] == "type_paypal_radio" || $types[$key_select_or_input] == "type_paypal_shipping" || $types[$key_select_or_input] == "type_paypal_select") {
                                        $w_choice = $w_choices_array[$m] . '*:*value*:*' . $w_choices_price_array[$m];
                                    } else {
                                        $w_choice = $w_choices_array[$m];
                                    }
                                    if (in_array(esc_html($w_choice), $multiselect)) {
                                        $selected = 'selected="selected"';
                                    } else {
                                        $selected = '';
                                    }
                                    if (strpos($w_choices_array[$m], '[') === false && strpos($w_choices_array[$m], ']') === false && strpos($w_choices_array[$m], ':') === false) {
                                        echo '<option id="choise_' . $k . '_' . $m . '" value="' . $w_choice . '" ' . $selected . '>' . $w_choices_array[$m] . '</option>';
                                    }
                                }
                                if ($types[$key_select_or_input] == "type_address") {
                                    $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", "Colombia", "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", "Nepal", "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 = '';
                                    foreach ($w_countries as $w_country) {
                                        if (in_array($w_country, $multiselect)) {
                                            $selected = 'selected="selected"';
                                        } else {
                                            $selected = '';
                                        }
                                        echo '<option value="' . $w_country . '" ' . $selected . '>' . $w_country . '</option>';
                                    }
                                }
                                ?>
	
								</select>
								<?php 
                            } else {
                                if ($key_select_or_input != '' && ($types[$key_select_or_input] == "type_number" || $types[$key_select_or_input] == "type_phone")) {
                                    $onkeypress_function = "onkeypress='return check_isnum_space(event)'";
                                } else {
                                    if ($key_select_or_input != '' && $types[$key_select_or_input] == "type_paypal_price") {
                                        $onkeypress_function = "onkeypress='return check_isnum_point(event)'";
                                    } else {
                                        $onkeypress_function = "";
                                    }
                                }
                                ?>
								<input id="field_value<?php 
                                echo $k;
                                ?>
_<?php 
                                echo $key;
                                ?>
" type="text" value="<?php 
                                echo $param_values[2];
                                ?>
" <?php 
                                echo $onkeypress_function;
                                ?>
 style="vertical-align: top; width: 200px;"><?php 
                            }
                            ?>
								
								<img src="<?php 
                            echo WD_FM_URL . '/images/delete.png';
                            ?>
" id="delete_condition<?php 
                            echo $k;
                            ?>
_<?php 
                            echo $key;
                            ?>
" onclick="delete_field_condition('<?php 
                            echo $k;
                            ?>
_<?php 
                            echo $key;
                            ?>
')" style="vertical-align: top;">
								</div>
								<?php 
                        }
                    }
                }
                ?>
					</div>
					<?php 
            }
        }
        ?>
				<input type="hidden" id="condition" name="condition" value="<?php 
        echo $row->condition;
        ?>
" />	
				
			</fieldset>
      
      <fieldset id="mapping_fieldset" class="adminform fm_fieldset_deactive">
        <legend style="color:#0B55C4;font-weight: bold;">MySQL Mapping</legend>
        <div>
          <a href="<?php 
        echo add_query_arg(array('action' => 'FormMakerSQLMapping', 'id' => 0, 'form_id' => $row->id, 'width' => '1000', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php'));
        ?>
" class="button-secondary thickbox thickbox-preview" id="add_query" title="Add Query" onclick="return false;">
            Add Query
          </a>
          <button class="button-primary thickbox thickbox-preview" onclick="if (fm_check_email('mailToAdd') ||
                           fm_check_email('from_mail') ||
                           fm_check_email('reply_to') ||
                           fm_check_email('mail_from_user') ||
                           fm_check_email('reply_to_user') ||
                           fm_check_email('mail_from_other') ||
                           fm_check_email('reply_to_other') ||
                           fm_check_email('paypal_email')) {return false;}; set_condition(); fm_set_input_value('task', 'remove_query')">Delete</button>
        </div>
				<?php 
        if ($queries) {
            ?>
				<table class="wp-list-table widefat fixed posts table_content">
					<thead>
						<tr>
							<th style="width:4%;" class="table_small_col count_col sub-align">#</th>
							<th style="width:4%;" class="table_small_col count_col sub-align">ID</th>
							<th style="width:6%;" class="manage-column column-cb check-column table_small_col sub-align form_check">
                <input id="check_all" type="checkbox" style="margin:0;">
              </th>
							<th style="width:86%;" class="table_large_col">Query</th>
						</tr>
					</thead>
					<?php 
            $k = 0;
            for ($i = 0, $n = count($queries); $i < $n; $i++) {
                $query = $queries[$i];
                $checked = '<input type="checkbox" id="' . $i . '" name="cid[]" value="' . $query->id . '" />';
                $link = add_query_arg(array('action' => 'FormMakerSQLMapping', 'id' => $query->id, 'form_id' => $row->id, 'width' => '1000', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php'));
                ?>
						<tr <?php 
                if ($k) {
                    echo "class=\"alternate\"";
                }
                ?>
>
							<td align="center" class="table_small_col"><?php 
                echo $i + 1;
                ?>
</td>
							<td align="center" class="table_small_col"><?php 
                echo $query->id;
                ?>
</td>
							<td align="center" class="table_small_col check-column"><?php 
                echo $checked;
                ?>
</td>
							<td align="center"><a href="<?php 
                echo $link;
                ?>
" class="thickbox thickbox-preview" onclick="return false;"><?php 
                echo $query->query;
                ?>
</a></td>
						</tr>
						<?php 
                $k = 1 - $k;
            }
            ?>
				</table>
				<?php 
        }
        ?>
			</fieldset>
      <input type="hidden" name="boxchecked" value="0">
      <input type="hidden" name="fieldset_id" id="fieldset_id" value="<?php 
        echo WDW_FM_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());
        fm_popup();
        function hide_email_labels(event) {
          var e = event.toElement || event.relatedTarget;
          if (e.parentNode == this || e == this) {
             return;
          }
          this.style.display="none";
        }
        if(document.getElementById('mail_from_labels')) {
          document.getElementById('mail_from_labels').addEventListener('mouseout',hide_email_labels,true);
        }
        if(document.getElementById('mail_subject_labels')) {
          document.getElementById('mail_subject_labels').addEventListener('mouseout',hide_email_labels,true);
        }
        if(document.getElementById('mail_from_name_user_labels')) {
          document.getElementById('mail_from_name_user_labels').addEventListener('mouseout',hide_email_labels,true);
        }
        if(document.getElementById('mail_subject_user_labels')) {
          document.getElementById('mail_subject_user_labels').addEventListener('mouseout',hide_email_labels,true);
        }
      });
      function wd_fm_apply_options() {
        set_condition();
        fm_set_input_value('task', 'apply_options');
        document.getElementById('adminForm').submit();
      }
    </script>
    <?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;">
        This section allows you to block IPs.
        <a style="color: blue; text-decoration: none;" target="_blank" href="https://web-dorado.com/wordpress-form-maker-guide-2.html">Read More in User Manual</a>
      </div>
      <div style="float: right; text-align: right;">
        <a style="text-decoration: none;" target="_blank" href="https://web-dorado.com/files/fromFormMaker.php">
          <img width="215" border="0" alt="web-dorado.com" src="<?php 
        echo WD_FM_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_fm" style="float: left; width: 99%;">
      <?php 
        wp_nonce_field('nonce_fm', 'nonce_fm');
        ?>
      <span class="block_icon"></span>
      <h2>Blocked IPs</h2>
      <div class="buttons_div">
        <input class="button-primary" type="submit" value="Save" onclick="spider_set_input_value('task', 'save_all');" />
        <input class="button-secondary" type="submit" value="Delete" onclick="if (confirm('Do you want to unblock selected IPs?')) {
                                                                      spider_set_input_value('task', 'delete_all');
                                                                    } else {
                                                                      return false;
                                                                    }" />
      </div>
      <div class="tablenav top">
        <?php 
        WDW_FM_Library::search('IP', $search_value, 'blocked_ips');
        WDW_FM_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">Edit</th>
            <th class="table_big_col">Delete</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="">Add IP</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;
                ?>
)">Edit</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="">Delete</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 
    }
示例#5
0
function form_maker_ajax()
{
    require_once WD_FM_DIR . '/framework/WDW_FM_Library.php';
    $page = WDW_FM_Library::get('action');
    if ($page != 'formmakerwdcaptcha') {
        if (function_exists('current_user_can')) {
            if (!current_user_can('manage_options')) {
                die('Access Denied');
            }
        } else {
            die('Access Denied');
        }
    }
    if ($page != '') {
        require_once WD_FM_DIR . '/admin/controllers/FMController' . ucfirst($page) . '.php';
        $controller_class = 'FMController' . ucfirst($page);
        $controller = new $controller_class();
        $controller->execute();
    }
}
    public function display($form_id)
    {
        global $wpdb;
        $forms = $this->model->get_form_titles();
        $statistics = $this->model->get_statistics($form_id);
        $labels_parameters = $this->model->get_labels_parameters($form_id);
        $sorted_labels_id = $labels_parameters[0];
        $sorted_label_types = $labels_parameters[1];
        $lists = $labels_parameters[2];
        $sorted_label_names = $labels_parameters[3];
        $sorted_label_names_original = $labels_parameters[4];
        $rows = isset($labels_parameters[5]) ? $labels_parameters[5] : NULL;
        $group_ids = isset($labels_parameters[6]) ? $labels_parameters[6] : NULL;
        $where_choices = $labels_parameters[7];
        $order_by = isset($_POST['order_by']) ? esc_html(stripslashes($_POST['order_by'])) : 'group_id';
        $asc_or_desc = isset($_POST['asc_or_desc']) ? esc_html(stripslashes($_POST['asc_or_desc'])) : 'desc';
        $style_id = $this->model->hide_or_not($lists['hide_label_list'], '@submitid@');
        $style_date = $this->model->hide_or_not($lists['hide_label_list'], '@submitdate@');
        $style_ip = $this->model->hide_or_not($lists['hide_label_list'], '@submitterip@');
        $style_username = $this->model->hide_or_not($lists['hide_label_list'], '@submitterusername@');
        $style_useremail = $this->model->hide_or_not($lists['hide_label_list'], '@submitteremail@');
        $oder_class_default = "manage-column column-autor sortable desc";
        $oder_class = "manage-column column-title sorted " . $asc_or_desc;
        $ispaypal = FALSE;
        $temp = array();
        $m = count($sorted_label_names);
        $n = count($rows);
        $group_id_s = array();
        $group_id_s = $this->model->sort_group_ids(count($sorted_label_names), $group_ids);
        $ka_fielderov_search = $lists['ip_search'] || $lists['startdate'] || $lists['enddate'] || $lists['username_search'] || $lists['useremail_search'] ? TRUE : FALSE;
        $is_stats = false;
        $blocked_ips = $this->model->blocked_ips();
        ?>
    <script type="text/javascript">
      function clickLabChBAll(ChBAll) {
        <?php 
        if (isset($sorted_label_names)) {
            $templabels = array_merge(array('submitid', 'submitdate', 'submitterip', 'submitterusername', 'submitteremail'), $sorted_labels_id);
            $sorted_label_names_for_check = array_merge(array('ID', 'Submit date', "Submitter's IP", "Submitter's Username", "Submitter's Email Address"), $sorted_label_names_original);
        } else {
            $templabels = array('submitid', 'submitdate', 'submitterip', 'submitterusername', 'submitteremail');
            $sorted_label_names_for_check = array('ID', 'Submit date', "Submitter's IP", 'Submitter\'s Username', 'Submitter\'s Email Address');
        }
        ?>
        if (ChBAll.checked) {
          document.forms.admin_form.hide_label_list.value = '';
          for (i = 0; i <= ChBAll.form.length; i++) {
            if (typeof(ChBAll.form[i]) != "undefined") {
              if (ChBAll.form[i].type == "checkbox") {
                ChBAll.form[i].checked = true;
              }
            }
          }
        }
        else {
          document.forms.admin_form.hide_label_list.value = '@<?php 
        echo implode($templabels, '@@');
        ?>
@' + '@payment_info@';
          for (i = 0; i <= ChBAll.form.length; i++) {
            if (typeof(ChBAll.form[i]) != "undefined") {
              if (ChBAll.form[i].type == "checkbox") {
                ChBAll.form[i].checked = false;
              }
            }
          }
        }
        renderColumns();
      }
      function remove_all() {
        document.getElementById('startdate').value = '';
        document.getElementById('enddate').value = '';
        document.getElementById('ip_search').value = '';
		document.getElementById('username_search').value='';
		document.getElementById('useremail_search').value='';
        <?php 
        $n = count($rows);
        for ($i = 0; $i < count($sorted_label_names); $i++) {
            if ($sorted_label_types[$i] != "type_mark_map") {
                ?>
            document.getElementById('<?php 
                echo $form_id . '_' . $sorted_labels_id[$i] . '_search';
                ?>
').value='';
            <?php 
            }
        }
        ?>
      }
      function show_hide_filter() {
        if (document.getElementById('fields_filter').style.display == "none") {
          document.getElementById('fields_filter').style.display = '';
          document.getElementById('filter_img').src = '<?php 
        echo WD_FM_URL . '/images/filter_hide.png';
        ?>
';
        }
        else {
          document.getElementById('fields_filter').style.display = "none";
          document.getElementById('filter_img').src = '<?php 
        echo WD_FM_URL . '/images/filter_show.png';
        ?>
';
        }
      }
      jQuery(document).ready(function () { 
        jQuery('.theme-detail').click(function () {
          jQuery(this).siblings('.themedetaildiv').toggle();
          return false;
        });
      });
    </script>
    <div id="sbox-overlay" onclick="toggleChBDiv(false)"
       style="z-index: 65555; position: fixed; top: 0px; left: 0px; visibility: visible; zoom: 1; background-color: #000000; opacity: 0.7; filter: alpha(opacity=70); display: none;">
    </div>
    <div style="background-color: #FFFFFF; width: 350px; max-height: 350px; overflow-y: auto; padding: 20px; position: fixed; top: 100px; display: none; border: 2px solid #AAAAAA;  z-index: 65556;" id="ChBDiv">
      <form action="#">
        <p style="font-weight: bold; font-size: 18px; margin-top: 0px;">Select Columns</p>
        <div class="fm_check_labels"><input type="checkbox" <?php 
        echo $lists['hide_label_list'] === '' ? 'checked="checked"' : '';
        ?>
 onclick="clickLabChBAll(this)" id="ChBAll"/><label for="ChBAll"> All</label></div>
        <?php 
        foreach ($templabels as $key => $curlabel) {
            if (strpos($lists['hide_label_list'], '@' . $curlabel . '@') === FALSE) {
                ?>
        <div class="fm_check_labels"><input type="checkbox" checked="checked" onclick="clickLabChB('<?php 
                echo $curlabel;
                ?>
', this)" id="fm_check_id_<?php 
                echo $curlabel;
                ?>
" /><label for="fm_check_id_<?php 
                echo $curlabel;
                ?>
"> <?php 
                echo stripslashes($sorted_label_names_for_check[$key]);
                ?>
</label></div>
            <?php 
            } else {
                ?>
        <div class="fm_check_labels"><input type="checkbox" onclick="clickLabChB('<?php 
                echo $curlabel;
                ?>
', this)" id="fm_check_id_<?php 
                echo $curlabel;
                ?>
"/><label for="fm_check_id_<?php 
                echo $curlabel;
                ?>
"> <?php 
                echo stripslashes($sorted_label_names_for_check[$key]);
                ?>
</label></div>
            <?php 
            }
        }
        $ispaypal = FALSE;
        for ($i = 0; $i < count($sorted_label_names); $i++) {
            if ($sorted_label_types[$i] == 'type_paypal_payment_status') {
                $ispaypal = TRUE;
            }
        }
        if ($ispaypal) {
            ?>
        <div class="fm_check_labels">
          <input type="checkbox" onclick="clickLabChB('payment_info', this)" id="fm_check_payment_info" <?php 
            echo strpos($lists['hide_label_list'], '@payment_info@') === FALSE ? 'checked="checked"' : '';
            ?>
 />
          <label for="fm_check_payment_info"> Payment Info</label>
        </div>
	        <?php 
        }
        ?>
        <div style="text-align: center; padding: 20px;">
          <input type="button" class="button-secondary" onclick="toggleChBDiv(false);" value="Done" />
        </div>
      </form>
    </div>
    <div style="clear: both; float: left; width: 99%;">
      <div style="float:left; font-size: 14px; font-weight: bold;">
        This section allows you to view and manage form submissions.
        <a style="color: blue; text-decoration: none;" target="_blank" href="http://web-dorado.com/wordpress-form-maker-guide-6.html">Read More in User Manual</a>
      </div>
      <div style="float: right; text-align: right;">
        <a style="text-decoration: none;" target="_blank" href="http://web-dorado.com/files/fromFormMaker.php">
          <img width="215" border="0" alt="web-dorado.com" src="<?php 
        echo WD_FM_URL . '/images/wd_logo.png';
        ?>
" />
        </a>
      </div>
    </div>
    <form action="admin.php?page=submissions_fm" method="post" id="admin_form" name="admin_form">
      <input type="hidden" name="option" value="com_formmaker" />
      <input type="hidden" id="task" name="task" value="" />
      <input type="hidden" id="current_id" name="current_id" value="" />
      <input type="hidden" name="asc_or_desc" id="asc_or_desc" value="<?php 
        echo $asc_or_desc;
        ?>
" />
      <input type="hidden" name="order_by" id="order_by" value="<?php 
        echo $order_by;
        ?>
" />
      <br />
      <table width="99%">
        <tr style="line-height: inherit !important;">
          <td align="left" width="300">
            <select name="form_id" id="form_id" style="width:99%" onchange="document.admin_form.submit();">
              <option value="0" selected="selected"> - Select a Form - </option>
              <?php 
        if ($forms) {
            foreach ($forms as $form) {
                ?>
              <option value="<?php 
                echo $form->id;
                ?>
" <?php 
                if ($form_id == $form->id) {
                    $chosen_form_title = $form->title;
                    echo 'selected="selected"';
                }
                ?>
> <?php 
                echo $form->title;
                ?>
 </option>
                  <?php 
            }
        }
        ?>
            </select>
          </td>
          <?php 
        if ($form_id > 0) {
            ?>
          <td class="reports"><strong>Entries</strong><br /><?php 
            echo $statistics["total_entries"];
            ?>
</td>
          <td class="reports"><strong>Views</strong><br /><?php 
            echo $statistics["total_views"];
            ?>
</td>
          <td class="reports"><strong>Conversion Rate</strong><br/><?php 
            echo $statistics["conversion_rate"];
            ?>
</td>
          <td class="form_title">
            <span class="form_title_cont" title="<?php 
            echo $chosen_form_title;
            ?>
"><?php 
            echo $chosen_form_title;
            ?>
</span>
          </td>
          <td style="text-align: right;" width="300">
            <span class="exp_but_span">Export to</span>
            <input type="button" class="button-secondary" value="CSV" onclick="window.location='<?php 
            echo add_query_arg(array('action' => 'generete_csv', 'form_id' => $form_id), admin_url('admin-ajax.php'));
            ?>
'" />&nbsp;
            <input type="button" class="button-secondary" value="XML" onclick="window.location='<?php 
            echo add_query_arg(array('action' => 'generete_xml', 'form_id' => $form_id), admin_url('admin-ajax.php'));
            ?>
'" />
          </td>			
        </tr>       
        <tr>
          <td align="left" colspan="4">
            <input type="hidden" name="hide_label_list" value="<?php 
            echo $lists['hide_label_list'];
            ?>
" />
            <img src="<?php 
            echo WD_FM_URL . '/images/filter_show.png';
            ?>
" width="40" style="vertical-align: bottom; cursor: pointer;" onclick="show_hide_filter()" title="Search by fields" id="filter_img" />
            <input type="button" class="button-secondary" onclick="spider_form_submit(event, 'admin_form')" value="Go" />
            <input type="button" class="button-secondary" onclick="remove_all(); spider_form_submit(event, 'admin_form')" value="Reset" />
          </td>
          <td align="right" colspan="2">
            <br />
            <?php 
            if (isset($sorted_label_names)) {
                ?>
            <input type="button" class="button-secondary" onclick="toggleChBDiv(true)" value="Add/Remove Columns" />
              <?php 
            }
            ?>
            <input class="button-secondary" type="button" onclick="spider_set_input_value('task', 'block_ip'); spider_form_submit(event, 'admin_form')" value="Block IP" />
            <input class="button-secondary" type="button" onclick="spider_set_input_value('task', 'unblock_ip'); spider_form_submit(event, 'admin_form')" value="Unblock IP" />
            <input class="button-secondary" type="button" onclick="if (confirm('Do you want to delete selected items?')) {
                                                                     spider_set_input_value('task', 'delete_all');
                                                                     spider_form_submit(event, 'admin_form')
                                                                   } else {
                                                                     return false;
                                                                   }" value="Delete"/>
          </td>
        </tr>
          <?php 
        } else {
            ?>
          <td></td>
        </tr>
            <?php 
        }
        ?>
      </table>
      <div class="tablenav top" style="width: 99%;">
        <?php 
        WDW_FM_Library::html_page_nav($lists['total'], $lists['limit'], 'admin_form');
        ?>
      </div>    
      <div class="submit_content" style="width: 99%;">
        <table class="wp-list-table widefat fixed posts table_content">
          <thead>
            <tr>
              <th class="table_small_col count_col sub-align">#</th>
              <th scope="col" id="cb" class="manage-column column-cb check-column table_small_col sub-align form_check"><input id="check_all" type="checkbox"></th>
              <th scope="col" id="submitid_fc" class="table_small_col sub-align submitid_fc <?php 
        if ($order_by == "group_id") {
            echo $oder_class;
        } else {
            echo $oder_class_default;
        }
        ?>
" <?php 
        echo $style_id;
        ?>
>
                <a href="" class="sub_id" onclick="spider_set_input_value('order_by', 'group_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'])) == 'group_id' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc';
        ?>
');
                                                   spider_form_submit(event, 'admin_form')">
                  <span>ID</span>
                  <span class="sorting-indicator" style="margin-top: 8px;"></span>
                </a>
              </th>
              <th class="table_small_col sub-align">Edit</th>
              <th class="table_small_col sub-align">Delete</th>
              <th scope="col" id="submitdate_fc" class="table_large_col submitdate_fc <?php 
        if ($order_by == "date") {
            echo $oder_class;
        } else {
            echo $oder_class_default;
        }
        ?>
" <?php 
        echo $style_date;
        ?>
>
                <a href="" onclick="spider_set_input_value('order_by', 'date');
                                    spider_set_input_value('asc_or_desc', '<?php 
        echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == 'date' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc';
        ?>
');
                                    spider_form_submit(event, 'admin_form')">
                  <span>Submit date</span>
                  <span class="sorting-indicator"></span>
                </a>
              </th>
              <th scope="col" id="submitterip_fc" class="table_medium_col_uncenter submitterip_fc <?php 
        if ($order_by == "ip") {
            echo $oder_class;
        } else {
            echo $oder_class_default;
        }
        ?>
" <?php 
        echo $style_ip;
        ?>
>
                <a href="" onclick="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, 'admin_form')">
                  <span>Submitter's IP</span>
                  <span class="sorting-indicator"></span>
                </a>
              </th>	
			  
			   <th scope="col" id="submitterusername_fc" class="table_medium_col_uncenter submitterusername_fc <?php 
        if ($order_by == "display_name") {
            echo $oder_class;
        } else {
            echo $oder_class_default;
        }
        ?>
" <?php 
        echo $style_username;
        ?>
>
                <a href="" onclick="spider_set_input_value('order_by', 'display_name');
                                    spider_set_input_value('asc_or_desc', '<?php 
        echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == 'display_name' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc';
        ?>
');
                                    spider_form_submit(event, 'admin_form')">
                  <span>Submitter's Username</span>
                  <span class="sorting-indicator"></span>
                </a>
              </th>	
			  
			  <th scope="col" id="submitteremail_fc" class="table_medium_col_uncenter submitteremail_fc <?php 
        if ($order_by == "user_email") {
            echo $oder_class;
        } else {
            echo $oder_class_default;
        }
        ?>
" <?php 
        echo $style_useremail;
        ?>
>
                <a href="" onclick="spider_set_input_value('order_by', 'user_email');
                                    spider_set_input_value('asc_or_desc', '<?php 
        echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == 'user_email' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc';
        ?>
');
                                    spider_form_submit(event, 'admin_form')">
                  <span>Submitter's Email Address</span>
                  <span class="sorting-indicator"></span>
                </a>
              </th>	
			  
			
              <?php 
        for ($i = 0; $i < count($sorted_label_names); $i++) {
            $styleStr = $this->model->hide_or_not($lists['hide_label_list'], $sorted_labels_id[$i]);
            $styleStr2 = $this->model->hide_or_not($lists['hide_label_list'], '@payment_info@');
            $field_title = $this->model->get_type_address($sorted_label_types[$i], $sorted_label_names_original[$i]);
            if ($sorted_label_types[$i] == 'type_paypal_payment_status') {
                $ispaypal = TRUE;
                ?>
              <th <?php 
                echo $styleStr;
                ?>
 id="<?php 
                echo $sorted_labels_id[$i] . '_fc';
                ?>
" class="table_large_col <?php 
                echo $sorted_labels_id[$i] . '_fc';
                if ($order_by == $sorted_labels_id[$i] . "_field") {
                    echo $oder_class . '"';
                } else {
                    echo $oder_class_default . '"';
                }
                ?>
">
                <a href="" onclick="spider_set_input_value('order_by', '<?php 
                echo $sorted_labels_id[$i] . '_field';
                ?>
');
                                    spider_set_input_value('asc_or_desc', '<?php 
                echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == $sorted_labels_id[$i] . '_field' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc';
                ?>
');
                                    spider_form_submit(event, 'admin_form')">	
                  <span><?php 
                echo $field_title;
                ?>
</span>
                  <span class="sorting-indicator"></span>
                </a>
              </th>
              <th class="table_large_col payment_info_fc" <?php 
                echo $styleStr2;
                ?>
>Payment Info</th>
                  <?php 
            } else {
                ?>
              <th <?php 
                echo $styleStr;
                ?>
 id="<?php 
                echo $sorted_labels_id[$i] . '_fc';
                ?>
" class="<?php 
                echo $sorted_label_types[$i] == 'type_mark_map' || $sorted_label_types[$i] == 'type_matrix' ? 'table_large_col ' : '';
                echo $sorted_labels_id[$i] . '_fc';
                if ($order_by == $sorted_labels_id[$i] . "_field") {
                    echo $oder_class . '"';
                } else {
                    echo $oder_class_default . '"';
                }
                ?>
">
                <a href="" onclick="spider_set_input_value('order_by', '<?php 
                echo $sorted_labels_id[$i] . '_field';
                ?>
');
                                    spider_set_input_value('asc_or_desc', '<?php 
                echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == $sorted_labels_id[$i] . '_field' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc';
                ?>
');
                                    spider_form_submit(event, 'admin_form')">
                  <span><?php 
                echo $field_title;
                ?>
</span>
                  <span class="sorting-indicator"></span>
                </a>
              </th>
                  <?php 
            }
        }
        ?>
		           
            </tr>
            <tr id="fields_filter" style="display: none;">
              <th></th>
              <th></th>
              <th></th>
              <th></th>
              <th class="submitid_fc" <?php 
        echo $style_id;
        ?>
 ></th>
              <th width="150" class="submitdate_fc" <?php 
        echo $style_date;
        ?>
>
                <table align="center" style="margin:auto" class="simple_table">
                  <tr class="simple_table">
                    <td class="simple_table" style="text-align: left;">From:</td>
                    <td style="text-align: center;" class="simple_table">
                      <input class="inputbox" type="text" name="startdate" id="startdate" size="10" maxlength="10" value="<?php 
        echo $lists['startdate'];
        ?>
" />
                    </td>
                    <td style="text-align: center;" class="simple_table">
                      <input type="reset" style="width: 22px; border-radius: 3px !important;" class="button" value="..." onclick="return showCalendar('startdate','%Y-%m-%d');" />
                    </td>
                  </tr>
                  <tr class="simple_table">
                    <td style="text-align: left;" class="simple_table">To:</td>
                    <td style="text-align: center;" class="simple_table">
                      <input class="inputbox" type="text" name="enddate" id="enddate" size="10" maxlength="10" value="<?php 
        echo $lists['enddate'];
        ?>
" />
                    </td>
                    <td style="text-align: center;" class="simple_table">
                      <input type="reset" style="width: 22px; border-radius: 3px !important;" class="button" value="..." onclick="return showCalendar('enddate','%Y-%m-%d');" />
                    </td>
                  </tr>
                </table>
              </th>
              <th class="table_medium_col_uncenter submitterip_fc" <?php 
        echo $style_ip;
        ?>
>
                <input type="text" name="ip_search" id="ip_search" value="<?php 
        echo $lists['ip_search'];
        ?>
" onChange="this.form.submit();" />
              </th>
			
			   </th>
              <th class="table_medium_col_uncenter submitterusername_fc" <?php 
        echo $style_username;
        ?>
>
                <input type="text" name="username_search" id="username_search" value="<?php 
        echo $lists['username_search'];
        ?>
" onChange="this.form.submit();" />
              </th>
			  
			  </th>
              <th class="table_medium_col_uncenter submitteremail_fc" <?php 
        echo $style_useremail;
        ?>
>
                <input type="text" name="useremail_search" id="useremail_search" value="<?php 
        echo $lists['useremail_search'];
        ?>
" onChange="this.form.submit();" />
              </th>
			  
              <?php 
        for ($i = 0; $i < count($sorted_label_names); $i++) {
            $styleStr = $this->model->hide_or_not($lists['hide_label_list'], $sorted_labels_id[$i]);
            if (!$ka_fielderov_search) {
                if ($lists[$form_id . '_' . $sorted_labels_id[$i] . '_search']) {
                    $ka_fielderov_search = TRUE;
                }
            }
            switch ($sorted_label_types[$i]) {
                case 'type_mark_map':
                    ?>
                      <th class="table_large_col <?php 
                    echo $sorted_labels_id[$i];
                    ?>
_fc" <?php 
                    echo $styleStr;
                    ?>
></th>
                      <?php 
                    break;
                case 'type_paypal_payment_status':
                    ?>
                      <th class="table_large_col <?php 
                    echo $sorted_labels_id[$i];
                    ?>
_fc" <?php 
                    echo $styleStr;
                    ?>
>
                        <select style="font-size: 11px; margin: 0; padding: 0; height: inherit;" name="<?php 
                    echo $form_id . '_' . $sorted_labels_id[$i];
                    ?>
_search" id="<?php 
                    echo $form_id . '_' . $sorted_labels_id[$i];
                    ?>
_search" onChange="this.form.submit();" value="<?php 
                    echo $lists[$form_id . '_' . $sorted_labels_id[$i] . '_search'];
                    ?>
" >
                          <option value="" ></option>
                          <option value="canceled" >Canceled</option>
                          <option value="cleared" >Cleared</option>
                          <option value="cleared by payment review" >Cleared by payment review</option>
                          <option value="completed" >Completed</option>
                          <option value="denied" >Denied</option>
                          <option value="failed" >Failed</option>
                          <option value="held" >Held</option>
                          <option value="in progress" >In progress</option>
                          <option value="on hold" >On hold</option>
                          <option value="paid" >Paid</option>
                          <option value="partially refunded" >Partially refunded</option>
                          <option value="pending verification" >Pending verification</option>
                          <option value="placed" >Placed</option>
                          <option value="processing" >Processing</option>
                          <option value="refunded" >Refunded</option>
                          <option value="refused" >Refused</option>
                          <option value="removed" >Removed</option>
                          <option value="returned" >Returned</option>
                          <option value="reversed" >Reversed</option>
                          <option value="temporary hold" >Temporary hold</option>
                          <option value="unclaimed" >Unclaimed</option>
                        </select>	
                        <script> 
                          var element = document.getElementById('<?php 
                    echo $form_id . '_' . $sorted_labels_id[$i];
                    ?>
_search');
                          element.value = '<?php 
                    echo $lists[$form_id . '_' . $sorted_labels_id[$i] . '_search'];
                    ?>
';
                        </script>
                      </th>
                      <th class="table_large_col  payment_info_fc" <?php 
                    echo $styleStr2;
                    ?>
></th>
                      <?php 
                    break;
                default:
                    ?>
                      <th class="<?php 
                    echo $sorted_labels_id[$i];
                    ?>
_fc" <?php 
                    echo $styleStr;
                    ?>
>
                        <input name="<?php 
                    echo $form_id . '_' . $sorted_labels_id[$i] . '_search';
                    ?>
" id="<?php 
                    echo $form_id . '_' . $sorted_labels_id[$i] . '_search';
                    ?>
" type="text" value="<?php 
                    echo $lists[$form_id . '_' . $sorted_labels_id[$i] . '_search'];
                    ?>
"  onChange="this.form.submit();" >
                      </th>
                      <?php 
                    break;
            }
        }
        ?>
            </tr>
          </thead>
          <?php 
        $k = 0;
        for ($www = 0, $qqq = count($group_id_s); $www < $qqq; $www++) {
            $i = $group_id_s[$www];
            $alternate = !isset($alternate) || $alternate == 'class="alternate"' ? '' : 'class="alternate"';
            $temp = $this->model->array_for_group_id($group_id_s[$www], $rows);
            $data = $temp[0];
            $userinfo = get_userdata($data->user_id_wd);
            $useremail = $userinfo ? $userinfo->user_email : "";
            $username = $userinfo ? $userinfo->display_name : "";
            ?>
            <tr <?php 
            echo $alternate;
            ?>
>
              <td class="table_small_col count_col sub-align"><?php 
            echo $www + 1;
            ?>
</td>
              <th class="check-column table_small_col sub-align" style="padding: 0;">
                <input type="checkbox" name="post[]" value="<?php 
            echo $data->group_id;
            ?>
">
              </th>   
              <td class="table_small_col sub-align submitid_fc" id="submitid_fc" <?php 
            echo $style_id;
            ?>
>
                <a href="" onclick="spider_set_input_value('task', 'edit');						  
                                    spider_set_input_value('current_id',<?php 
            echo $data->group_id;
            ?>
);
                                    spider_form_submit(event, 'admin_form');" ><?php 
            echo $data->group_id;
            ?>
                </a>
              </td> 
              <td class="table_small_col sub-align">
                <a href="" onclick="spider_set_input_value('task', 'edit');						  
                                    spider_set_input_value('current_id',<?php 
            echo $data->group_id;
            ?>
);
                                    spider_form_submit(event, 'admin_form');">Edit
                </a>
              </td>
              <td class="table_small_col sub-align">
                <a href="" onclick="spider_set_input_value('task', 'delete');						  
                                    spider_set_input_value('current_id',<?php 
            echo $data->group_id;
            ?>
);
                                    spider_form_submit(event, 'admin_form');">Delete
                </a>
              </td>		 
              <td  class="table_large_col submitdate_fc sub-align" id="submitdate_fc" <?php 
            echo $style_date;
            ?>
>
                <a href="" onclick="spider_set_input_value('task', 'edit');						  
                                    spider_set_input_value('current_id',<?php 
            echo $data->group_id;
            ?>
);
                                    spider_form_submit(event, 'admin_form');" ><?php 
            echo $data->date;
            ?>
                </a>
              </td>
              <td class="table_medium_col_uncenter submitterip_fc sub-align" id="submitterip_fc" <?php 
            echo $style_ip;
            ?>
>
                <a class="thickbox-preview" href="<?php 
            echo add_query_arg(array('action' => 'fromipinfoinpopup', 'data_ip' => $data->ip, 'width' => '400', 'height' => '300', 'TB_iframe' => '1'), admin_url('admin-ajax.php'));
            ?>
" title="Show submitter information" <?php 
            echo !in_array($data->ip, $blocked_ips) ? '' : 'style="color: #FF0000;"';
            ?>
><?php 
            echo $data->ip;
            ?>
</a>
              </td>
			  
			  
			  
			  <td  class="table_large_col submitterusername_fc sub-align" id="submitterusername_fc" <?php 
            echo $style_username;
            ?>
>
               <?php 
            echo $username;
            ?>
              </td>
			  
			  <td  class="table_large_col submitteremail_fc sub-align" id="submitteremail_fc" <?php 
            echo $style_useremail;
            ?>
>
                <?php 
            echo $useremail;
            ?>
              </td>
			  
			  
			  
              <?php 
            for ($h = 0; $h < $m; $h++) {
                $not_label = TRUE;
                for ($g = 0; $g < count($temp); $g++) {
                    $styleStr = $this->model->hide_or_not($lists['hide_label_list'], $sorted_labels_id[$h]);
                    if ($temp[$g]->element_label == $sorted_labels_id[$h]) {
                        if (strpos($temp[$g]->element_value, "***map***")) {
                            $map_params = explode('***map***', $temp[$g]->element_value);
                            ?>
              <td class="table_large_col <?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc sub-align" id="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc" <?php 
                            echo $styleStr;
                            ?>
>
                <a class="thickbox-preview" href="<?php 
                            echo add_query_arg(array('action' => 'frommapeditinpopup', 'long' => $map_params[0], 'lat' => $map_params[1], 'width' => '620', 'height' => '550', 'TB_iframe' => '1'), admin_url('admin-ajax.php'));
                            ?>
" title="Show on Map">Show on Map</a>
              </td>
                    <?php 
                        } elseif (strpos($temp[$g]->element_value, "*@@url@@*")) {
                            ?>
              <td class="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc sub-align" id="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc" <?php 
                            echo $styleStr;
                            ?>
>
                      <?php 
                            $new_files = explode("*@@url@@*", $temp[$g]->element_value);
                            foreach ($new_files as $new_file) {
                                if ($new_file) {
                                    $new_filename = explode('/', $new_file);
                                    $new_filename = $new_filename[count($new_filename) - 1];
                                    ?>
                <a target="_blank" class="fm_fancybox" rel="group_<?php 
                                    echo $www;
                                    ?>
" href="<?php 
                                    echo $new_file;
                                    ?>
"><?php 
                                    echo $new_filename;
                                    ?>
</a><br />
                          <?php 
                                }
                            }
                            ?>
              </td>
                      <?php 
                        } elseif (strpos($temp[$g]->element_value, "***star_rating***")) {
                            $view_star_rating_array = $this->model->view_for_star_rating($temp[$g]->element_value, $temp[$g]->element_label);
                            $stars = $view_star_rating_array[0];
                            ?>
              <td align="center" class="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc sub-align" id="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc" <?php 
                            echo $styleStr;
                            ?>
><?php 
                            echo $stars;
                            ?>
</td>
                      <?php 
                        } elseif (strpos($temp[$g]->element_value, "***matrix***")) {
                            ?>
   
              <td class="table_large_col <?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc sub-align" id="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc" <?php 
                            echo $styleStr;
                            ?>
>
                <a class="thickbox-preview" href="<?php 
                            echo add_query_arg(array('action' => 'show_matrix', 'matrix_params' => $temp[$g]->element_value, 'width' => '620', 'height' => '550', 'TB_iframe' => '1'), admin_url('admin-ajax.php'));
                            ?>
" title="Show Matrix">Show Matrix</a>
              </td>
                      <?php 
                        } elseif (strpos($temp[$g]->element_value, "@@@") !== FALSE || $temp[$g]->element_value == "@@@" || $temp[$g]->element_value == "@@@@@@@@@") {
                            ?>
              <td class="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc" <?php 
                            echo $styleStr;
                            ?>
>
                <p><?php 
                            echo str_replace("@@@", " ", $temp[$g]->element_value);
                            ?>
</p>
              </td>
                      <?php 
                        } elseif (strpos($temp[$g]->element_value, "***grading***")) {
                            $view_grading_array = $this->model->view_for_grading($temp[$g]->element_value);
                            $items = $view_grading_array[0];
                            ?>
              <td class="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc sub-align" id="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc" <?php 
                            echo $styleStr;
                            ?>
>
                <p><?php 
                            echo $items;
                            ?>
</p>
              </td>
                      <?php 
                        } else {
                            if (strpos($temp[$g]->element_value, "***quantity***")) {
                                $temp[$g]->element_value = str_replace("***quantity***", " ", $temp[$g]->element_value);
                            }
                            if (strpos($temp[$g]->element_value, "***property***")) {
                                $temp[$g]->element_value = str_replace("***property***", " ", $temp[$g]->element_value);
                            }
                            ?>
              <td class="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc sub-align" id="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc" <?php 
                            echo $styleStr;
                            ?>
>
                <p><?php 
                            echo str_replace("***br***", '<br>', stripslashes($temp[$g]->element_value));
                            ?>
</p>
              </td>
                      <?php 
                        }
                        $not_label = FALSE;
                    }
                }
                if ($not_label) {
                    ?>
              <td class="<?php 
                    echo $sorted_labels_id[$h];
                    ?>
_fc sub-align" id="<?php 
                    echo $sorted_labels_id[$h];
                    ?>
_fc" <?php 
                    echo $styleStr;
                    ?>
><p>&nbsp;</p></td>
                  <?php 
                }
            }
            if ($ispaypal) {
                $styleStr = $this->model->hide_or_not($lists['hide_label_list'], '@payment_info@');
                ?>
              <td class="table_large_col payment_info_fc sub-align" id="payment_info_fc" <?php 
                echo $styleStr;
                ?>
>
                <a class="thickbox-preview" href="<?php 
                echo add_query_arg(array('action' => 'paypal_info', 'id' => $i, 'width' => '600', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php'));
                ?>
">
                  <img src="<?php 
                echo WD_FM_URL . '/images/info.png';
                ?>
" />
                </a>
              </td>
                <?php 
            }
            ?>
            </tr>
            <?php 
            $k = 1 - $k;
        }
        ?>
        </table>
      </div>	 
      <?php 
        if ($sorted_label_types) {
            foreach ($sorted_label_types as $key => $sorted_label_type) {
                if ($this->model->check_radio_type($sorted_label_type)) {
                    $is_stats = true;
                    break;
                }
            }
            if ($is_stats) {
                ?>
		  <br /><br />
		  <h1 style="border-bottom: 1px solid; padding-bottom:7px; width:99%; color: hsl(197, 100%, 32%);">Statistics</h1>		
		  <table class="wp-list-table widefat fixed posts table_content" style="width: 99%;">
		    <tr>
          <td class="key" style="vertical-align: middle;width: 9%">
            <label for="sorted_label_key">Select a Field:</label>
          </td>
          <td width="330">
            <select id="sorted_label_key">
              <option value="">Select a Field</option>
                <?php 
                foreach ($sorted_label_types as $key => $sorted_label_type) {
                    if ($sorted_label_type == "type_checkbox" || $sorted_label_type == "type_radio" || $sorted_label_type == "type_own_select" || $sorted_label_type == "type_country" || $sorted_label_type == "type_paypal_select" || $sorted_label_type == "type_paypal_radio" || $sorted_label_type == "type_paypal_checkbox" || $sorted_label_type == "type_paypal_shipping") {
                        ?>
                    <option value="<?php 
                        echo $key;
                        ?>
"><?php 
                        echo $sorted_label_names_original[$key];
                        ?>
</option>
                    <?php 
                    }
                }
                ?>
            </select>
          </td>
          <td></td>
		    </tr>
		    <tr>
          <td class="key" style="vertical-align: middle;">
            <label>Select a Date:</label>
          </td>
          <td width="330">
            From: <input class="inputbox"  type="text" name="startstats" id="startstats" size="9" maxlength="9" />
                  <input type="reset" class="button" style="width: 22px; border-radius: 3px !important;"  value="..." name="startstats_but" id="startstats_but" onclick="return showCalendar('startstats','%Y-%m-%d');" /> 
                     
            To: <input class="inputbox" type="text" name="endstats" id="endstats" size="9" maxlength="9" />
                <input type="reset" class="button" style="width: 22px; border-radius: 3px !important;"  value="..." name="endstats_but" id="endstats_but" onclick="return showCalendar('endstats','%Y-%m-%d');" />
          </td>
          <td class="key" style="vertical-align: middle;">
            <input type="button" onclick="show_stats()" class="button-secondary" value="Show">
          </td>
		    </tr>
		  </table>
		  <div id="div_stats"></div>	
        <?php 
            }
        }
        ?>
    </form>	
    <script> 
      jQuery(window).load(function() {
        spider_popup();
        if (typeof jQuery().fancybox !== 'undefined' && jQuery.isFunction(jQuery().fancybox)) {
          jQuery(".fm_fancybox").fancybox({
            'maxWidth ' : 600,
            'maxHeight' : 500
          });
        }
      });
	  function show_stats() { 
		jQuery('#div_stats').html('<div id="saving"><div id="saving_text">Loading</div><div id="fadingBarsG"><div id="fadingBarsG_1" class="fadingBarsG"></div><div id="fadingBarsG_2" class="fadingBarsG"></div><div id="fadingBarsG_3" class="fadingBarsG"></div><div id="fadingBarsG_4" class="fadingBarsG"></div><div id="fadingBarsG_5" class="fadingBarsG"></div><div id="fadingBarsG_6" class="fadingBarsG"></div><div id="fadingBarsG_7" class="fadingBarsG"></div><div id="fadingBarsG_8" class="fadingBarsG"></div></div></div>');
		if(jQuery('#sorted_label_key').val()!="") {	 	  
		  jQuery('#div_stats').load('<?php 
        echo add_query_arg(array('action' => 'get_stats', 'page' => 'submissions_fm'), admin_url('admin-ajax.php'));
        ?>
', { 
		    'task': 'show_stats',
		    'form_id' : '<?php 
        echo $form_id;
        ?>
',
		    'sorted_label_key' : jQuery('#sorted_label_key').val(),
			'startdate' : jQuery('#startstats').val(), 
			'enddate' : jQuery('#endstats').val()
		    });
	    }		
		else
		  jQuery('#div_stats').html("Please select the field!")
	  }
      <?php 
        if ($ka_fielderov_search) {
            ?>
 
        document.getElementById('fields_filter').style.display = '';
        <?php 
        }
        ?>
    </script>
    <?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($_POST['search_value']) : '';
        $search_select_value = isset($_POST['search_select_value']) ? (int) $_POST['search_select_value'] : 0;
        $asc_or_desc = isset($_POST['asc_or_desc']) ? esc_html($_POST['asc_or_desc']) : 'asc';
        $order_by = isset($_POST['order_by']) ? esc_html($_POST['order_by']) : 'id';
        $order_class = 'manage-column column-title sorted ' . $asc_or_desc;
        $ids_string = '';
        ?>
    <div style="clear: both; float: left; width: 99%;">
      <div style="float:left; font-size: 14px; font-weight: bold;">
        This section allows you to edit form themes.
        <a style="color: blue; text-decoration: none;" target="_blank" href="http://web-dorado.com/wordpress-form-maker-guide-2.html">Read More in User Manual</a>
      </div>
      <div style="float: right; text-align: right;">
        <a style="text-decoration: none;" target="_blank" href="http://web-dorado.com/files/fromFormMaker.php">
          <img width="215" border="0" alt="web-dorado.com" src="<?php 
        echo WD_FM_URL . '/images/wd_logo.png';
        ?>
" />
        </a>
      </div>
    </div>
    <form class="wrap" id="themes_form" method="post" action="admin.php?page=themes_fm" style="float: left; width: 99%;">
      <span class="theme_icon"></span>
      <h2>
        Themes
        <a href="" class="add-new-h2" onclick="spider_set_input_value('task', 'add');
                                               spider_form_submit(event, 'themes_form')">Add new</a>
      </h2>
      <div class="buttons_div">
        <input class="button-secondary" type="submit" onclick="if (confirm('Do you want to delete selected items?')) {
                                                       spider_set_input_value('task', 'delete_all');
                                                     } else {
                                                       return false;
                                                     }" value="Delete" />
      </div>
      <div class="tablenav top">
        <?php 
        WDW_FM_Library::search('Title', $search_value, 'themes_form');
        WDW_FM_Library::html_page_nav($page_nav['total'], $page_nav['limit'], 'themes_form');
        ?>
      </div>
      <table class="wp-list-table widefat fixed pages">
        <thead>
          <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($_POST['order_by']) == 'id' && esc_html($_POST['asc_or_desc']) == 'asc' ? 'desc' : 'asc';
        ?>
');
              spider_form_submit(event, 'themes_form')" href="">
              <span>ID</span><span class="sorting-indicator"></span></a>
          </th>
          <th class="<?php 
        if ($order_by == 'title') {
            echo $order_class;
        }
        ?>
">
            <a onclick="spider_set_input_value('task', '');
              spider_set_input_value('order_by', 'title');
              spider_set_input_value('asc_or_desc', '<?php 
        echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html($_POST['order_by']) == 'title' && esc_html($_POST['asc_or_desc']) == 'asc' ? 'desc' : 'asc';
        ?>
');
              spider_form_submit(event, 'themes_form')" href="">
              <span>Title</span><span class="sorting-indicator"></span></a>
          </th>
          <th class="table_big_col <?php 
        if ($order_by == 'default') {
            echo $order_class;
        }
        ?>
">
            <a onclick="spider_set_input_value('task', '');
              spider_set_input_value('order_by', 'default');
              spider_set_input_value('asc_or_desc', '<?php 
        echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html($_POST['order_by']) == 'default' && esc_html($_POST['asc_or_desc']) == 'asc' ? 'desc' : 'asc';
        ?>
');
              spider_form_submit(event, 'themes_form')" href="">
              <span>Default</span><span class="sorting-indicator"></span></a>
          </th>
          <th class="table_big_col">Edit</th>
          <th class="table_big_col">Delete</th>
        </thead>
        <tbody id="tbody_arr">
          <?php 
        if ($rows_data) {
            foreach ($rows_data as $row_data) {
                $alternate = !isset($alternate) || $alternate == 'class="alternate"' ? '' : 'class="alternate"';
                $default_image = $row_data->default ? 'default' : 'notdefault';
                $default = $row_data->default ? '' : 'setdefault';
                ?>
              <tr id="tr_<?php 
                echo $row_data->id;
                ?>
" <?php 
                echo $alternate;
                ?>
>
                <td class="table_small_col check-column">
                  <input id="check_<?php 
                echo $row_data->id;
                ?>
" name="check_<?php 
                echo $row_data->id;
                ?>
" type="checkbox"/>
                </td>
                <td class="table_small_col"><?php 
                echo $row_data->id;
                ?>
</td>
                <td>
                  <a onclick="spider_set_input_value('task', 'edit');
                              spider_set_input_value('current_id', '<?php 
                echo $row_data->id;
                ?>
');
                              spider_form_submit(event, 'themes_form')" href="" title="Edit"><?php 
                echo $row_data->title;
                ?>
</a>
                </td>
                <td class="table_big_col">
                  <?php 
                if ($default != '') {
                    ?>
                    <a onclick="spider_set_input_value('task', '<?php 
                    echo $default;
                    ?>
');
                                spider_set_input_value('current_id', '<?php 
                    echo $row_data->id;
                    ?>
');
                                spider_form_submit(event, 'themes_form')" href="">
                    <?php 
                }
                ?>
                  <img src="<?php 
                echo WD_FM_URL . '/images/' . $default_image . '.png';
                ?>
" />
                  <?php 
                if ($default != '') {
                    ?>
                    </a>
                    <?php 
                }
                ?>
                </td>
                <td class="table_big_col">
                  <a onclick="spider_set_input_value('task', 'edit');
                              spider_set_input_value('current_id', '<?php 
                echo $row_data->id;
                ?>
');
                              spider_form_submit(event, 'themes_form')" href="">Edit</a>
                </td>
                <td class="table_big_col">
                  <a onclick="spider_set_input_value('task', 'delete');
                              spider_set_input_value('current_id', '<?php 
                echo $row_data->id;
                ?>
');
                              spider_form_submit(event, 'themes_form')" href="">Delete</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="asc"/>
      <input id="order_by" name="order_by" type="hidden" value="<?php 
        echo $order_by;
        ?>
"/>
    </form>
    <?php 
    }
示例#8
0
    public function display($id)
    {
        $current_url = htmlentities($_SERVER['REQUEST_URI']);
        $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];
        $old = FALSE;
        if (isset($_SESSION['form_submit_type' . $id])) {
            $type_and_id = $_SESSION['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['form_submit_type' . $id] = 0;
            if ($form_get_type == 3) {
                $_SESSION['massage_after_submit' . $id] = "";
                $after_submission_text = $this->model->get_after_submission_text($form_get_id);
                require_once WD_FM_DIR . '/framework/WDW_FM_Library.php';
                $form_maker_front_end .= WDW_FM_Library::message(wpautop(html_entity_decode($after_submission_text)), 'warning', $id);
                return $form_maker_front_end;
            }
        }
        if (isset($_SESSION['redirect_paypal' . $id]) && $_SESSION['redirect_paypal' . $id] == 1) {
            $_SESSION['redirect_paypal' . $id] = 0;
            if (isset($_GET['succes'])) {
                require_once WD_FM_DIR . '/framework/WDW_FM_Library.php';
                if ($_GET['succes'] == 0) {
                    $form_maker_front_end .= WDW_FM_Library::message(__('Error, email was not sent.', 'form_maker'), 'error', $id);
                } else {
                    $form_maker_front_end .= WDW_FM_Library::message(__('Your form was successfully submitted.', 'form_maker'), 'warning', $id);
                }
            }
        } elseif (isset($_SESSION['massage_after_submit' . $id]) && $_SESSION['massage_after_submit' . $id] != "") {
            $message = $_SESSION['massage_after_submit' . $id];
            $_SESSION['massage_after_submit' . $id] = "";
            if ($_SESSION['error_or_no' . $id]) {
                $error = 'error';
            } else {
                $error = 'warning';
            }
            require_once WD_FM_DIR . '/framework/WDW_FM_Library.php';
            $form_maker_front_end .= WDW_FM_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);
        if (isset($row->form)) {
            $old = TRUE;
        }
        $article = $row->article_id;
        $form_maker_front_end .= '<script type="text/javascript">' . $row->javascript . '</script>';
        $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] = ".form" . $id . ' ' . str_replace(',', ", .form" . $id, $body_or_classes[$i][0]);
            } else {
                $body_or_classes[$i][1] = ".form" . $id . ' ' . str_replace(',', ", .form" . $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>' . str_replace('[SITE_ROOT]', WD_FM_URL, $form_theme) . '</style>';
        wp_print_scripts('main' . ($old == false || $old == true && $row->form == '' ? '_div' : '') . '_front_end', WD_FM_URL . '/js/main' . ($old == false || $old == true && $row->form == '' ? '_div' : '') . '_front_end.js?ver=' . get_option("wd_form_maker_version"));
        // $form_maker_front_end .= '<script src="' . WD_FM_URL . '/js/main' . (($old == false || ($old == true && $row->form=='')) ? '_div' : '') . '_front_end.js"></script>';
        $form_currency = '$';
        $check_js = '';
        $onload_js = '';
        $onsubmit_js = '';
        $currency_code = array('USD', 'EUR', 'GBP', 'JPY', 'CAD', 'MXN', 'HKD', 'HUF', 'NOK', 'NZD', 'SGD', 'SEK', 'PLN', 'AUD', 'DKK', 'CHF', 'CZK', 'ILS', 'BRL', 'TWD', 'MYR', 'PHP', 'THB');
        $currency_sign = array('$', '&#8364;', '&#163;', '&#165;', 'C$', 'Mex$', 'HK$', 'Ft', 'kr', 'NZ$', 'S$', 'kr', 'zl', 'A$', 'kr', 'CHF', 'Kc', '&#8362;', 'R$', 'NT$', 'RM', '&#8369;', '&#xe3f;');
        if ($row->payment_currency) {
            $form_currency = $currency_sign[array_search($row->payment_currency, $currency_code)];
        }
        $form_paypal_tax = $row->tax;
        $form_maker_front_end .= '<form name="form' . $id . '" action="' . $current_url . '" method="post" id="form' . $id . '" class="form' . $id . '" enctype="multipart/form-data"  onsubmit="check_required(\'submit\', \'' . $id . '\'); return false;">
      <div id="' . $id . 'pages" class="wdform_page_navigation" show_title="' . $row->show_title . '" show_numbers="' . $row->show_numbers . '" type="' . $row->pagination . '"></div>
      <input type="hidden" id="counter' . $id . '" value="' . $row->counter . '" name="counter' . $id . '" />
      <input type="hidden" id="Itemid' . $id . '" value="" name="Itemid' . $id . '" />';
        if ($old == FALSE || $old == TRUE && $row->form == '') {
            $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);
            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;
            $show_hide = array();
            $field_label = array();
            $all_any = array();
            $condition_params = array();
            $type_and_id = array();
            $condition_js = '';
            if ($row->condition != "") {
                $conditions = explode('*:*new_condition*:*', $row->condition);
                $conditions = array_slice($conditions, 0, count($conditions) - 1);
                $count_of_conditions = count($conditions);
                foreach ($conditions as $condition) {
                    $temp = explode('*:*show_hide*:*', $condition);
                    array_push($show_hide, $temp[0]);
                    $temp = explode('*:*field_label*:*', $temp[1]);
                    array_push($field_label, $temp[0]);
                    $temp = explode('*:*all_any*:*', $temp[1]);
                    array_push($all_any, $temp[0]);
                    array_push($condition_params, $temp[1]);
                }
                foreach ($id1s as $id1s_key => $id1) {
                    $type_and_id[$id1] = $types[$id1s_key];
                }
                for ($k = 0; $k < $count_of_conditions; $k++) {
                    if ($show_hide[$k]) {
                        $display = 'removeAttr("style")';
                        $display_none = 'css("display", "none")';
                    } else {
                        $display = 'css("display", "none")';
                        $display_none = 'removeAttr("style")';
                    }
                    if ($all_any[$k] == "and") {
                        $or_and = '&&';
                    } else {
                        $or_and = '||';
                    }
                    if ($condition_params[$k]) {
                        $cond_params = explode('*:*next_condition*:*', $condition_params[$k]);
                        $cond_params = array_slice($cond_params, 0, count($cond_params) - 1);
                        for ($l = 0; $l < count($cond_params); $l++) {
                            $params_value = explode('***', $cond_params[$l]);
                            if (!isset($type_and_id[$params_value[0]])) {
                                unset($cond_params[$l]);
                            }
                        }
                        $cond_params = array_values($cond_params);
                        $if = '';
                        $keyup = '';
                        $change = '';
                        $click = '';
                        for ($m = 0; $m < count($cond_params); $m++) {
                            $params_value = explode('***', wp_specialchars_decode($cond_params[$m], 'single'));
                            switch ($type_and_id[$params_value[0]]) {
                                case "type_text":
                                case "type_password":
                                case "type_textarea":
                                case "type_number":
                                case "type_submitter_mail":
                                case "type_spinner":
                                    if ($params_value[1] == "%" || $params_value[1] == "!%") {
                                        $like_or_not = $params_value[1] == "%" ? ">" : "==";
                                        $if .= ' jQuery("#wdform_' . $params_value[0] . '_element' . $form_id . '").val().indexOf("' . $params_value[2] . '")' . $like_or_not . '-1 ';
                                    } else {
                                        if ($params_value[1] == "=" || $params_value[1] == "!") {
                                            $params_value[2] = "";
                                            $params_value[1] = $params_value[1] . "=";
                                        }
                                        $if .= ' jQuery("#wdform_' . $params_value[0] . '_element' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" ';
                                    }
                                    $keyup .= '#wdform_' . $params_value[0] . '_element' . $form_id . ', ';
                                    if ($type_and_id[$params_value[0]] == "type_spinner") {
                                        $click .= '#wdform_' . $params_value[0] . '_element' . $form_id . ' ~ a, ';
                                    }
                                    break;
                                case "type_name":
                                    if ($params_value[1] == "%" || $params_value[1] == "!%") {
                                        $extended0 = '';
                                        $extended1 = '';
                                        $extended2 = '';
                                        $extended3 = '';
                                        $normal0 = '';
                                        $normal1 = '';
                                        $normal2 = '';
                                        $normal3 = '';
                                        $like_or_not = $params_value[1] == "%" ? ">" : "==";
                                        $name_fields = explode(' ', $params_value[2]);
                                        if ($name_fields[0] != '') {
                                            $extended0 = 'jQuery("#wdform_' . $params_value[0] . '_element_title' . $form_id . '").val().indexOf("' . $name_fields[0] . '")' . $like_or_not . '-1 ';
                                            $normal0 = 'jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val().indexOf("' . $name_fields[0] . '")' . $like_or_not . '-1 ';
                                        }
                                        if (isset($name_fields[1]) && $name_fields[1] != '') {
                                            $extended1 = 'jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val().indexOf("' . $name_fields[1] . '")' . $like_or_not . '-1 ';
                                            $normal1 = 'jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val().indexOf("' . $name_fields[1] . '")' . $like_or_not . '-1 ';
                                        }
                                        if (isset($name_fields[2]) && $name_fields[2] != '') {
                                            $extended2 = 'jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val().indexOf("' . $name_fields[2] . '")' . $like_or_not . '-1 ';
                                            $normal2 = '';
                                        }
                                        if (isset($name_fields[3]) && $name_fields[3] != '') {
                                            $extended3 = 'jQuery("#wdform_' . $params_value[0] . '_element_middle' . $form_id . '").val().indexOf("' . $name_fields[3] . '")' . $like_or_not . '-1 ';
                                            $normal3 = '';
                                        }
                                        if (isset($name_fields[3])) {
                                            $extended = '';
                                            $normal = '';
                                            if ($extended0) {
                                                $extended = $extended0;
                                                if ($extended1) {
                                                    $extended .= ' && ' . $extended1;
                                                    if ($extended2) {
                                                        $extended .= ' && ' . $extended2;
                                                    }
                                                    if ($extended3) {
                                                        $extended .= ' && ' . $extended3;
                                                    }
                                                } else {
                                                    if ($extended2) {
                                                        $extended .= ' && ' . $extended2;
                                                    }
                                                    if ($extended3) {
                                                        $extended .= ' && ' . $extended3;
                                                    }
                                                }
                                            } else {
                                                if ($extended1) {
                                                    $extended = $extended1;
                                                    if ($extended2) {
                                                        $extended .= ' && ' . $extended2;
                                                    }
                                                    if ($extended3) {
                                                        $extended .= ' && ' . $extended3;
                                                    }
                                                } else {
                                                    if ($extended2) {
                                                        $extended = $extended2;
                                                        if ($extended3) {
                                                            $extended .= ' && ' . $extended3;
                                                        }
                                                    } else {
                                                        if ($extended3) {
                                                            $extended = $extended3;
                                                        }
                                                    }
                                                }
                                            }
                                            if ($normal0) {
                                                $normal = $normal0;
                                                if ($normal1) {
                                                    $normal .= ' && ' . $normal1;
                                                }
                                            } else {
                                                if ($normal1) {
                                                    $normal = $normal1;
                                                }
                                            }
                                        } else {
                                            if (isset($name_fields[2])) {
                                                $extended = "";
                                                $normal = "";
                                                if ($extended0) {
                                                    $extended = $extended0;
                                                    if ($extended1) {
                                                        $extended .= ' && ' . $extended1;
                                                    }
                                                    if ($extended2) {
                                                        $extended .= ' && ' . $extended2;
                                                    }
                                                } else {
                                                    if ($extended1) {
                                                        $extended = $extended1;
                                                        if ($extended2) {
                                                            $extended .= ' && ' . $extended2;
                                                        }
                                                    } else {
                                                        if ($extended2) {
                                                            $extended = $extended2;
                                                        }
                                                    }
                                                }
                                                if ($normal0) {
                                                    $normal = $normal0;
                                                    if ($normal1) {
                                                        $normal .= ' && ' . $normal1;
                                                    }
                                                } else {
                                                    if ($normal1) {
                                                        $normal = $normal1;
                                                    }
                                                }
                                            } else {
                                                if (isset($name_fields[1])) {
                                                    $extended = '';
                                                    $normal = '';
                                                    if ($extended0) {
                                                        if ($extended1) {
                                                            $extended = $extended0 . ' && ' . $extended1;
                                                        } else {
                                                            $extended = $extended0;
                                                        }
                                                    } else {
                                                        if ($extended1) {
                                                            $extended = $extended1;
                                                        }
                                                    }
                                                    if ($normal0) {
                                                        if ($normal1) {
                                                            $normal = $normal0 . ' && ' . $normal1;
                                                        } else {
                                                            $normal = $normal0;
                                                        }
                                                    } else {
                                                        if ($normal1) {
                                                            $normal = $normal1;
                                                        }
                                                    }
                                                } else {
                                                    $extended = $extended0;
                                                    $normal = $normal0;
                                                }
                                            }
                                        }
                                        if ($extended != "" && $normal != "") {
                                            $if .= ' ((jQuery("#wdform_' . $params_value[0] . '_element_title' . $form_id . '").length != 0 || jQuery("#wdform_' . $params_value[0] . '_element_middle' . $form_id . '").length != 0) ?  ' . $extended . ' : ' . $normal . ') ';
                                        } else {
                                            $if .= ' true';
                                        }
                                    } else {
                                        if ($params_value[1] == "=" || $params_value[1] == "!") {
                                            $name_and_or = $params_value[1] == "=" ? "&&" : "||";
                                            $name_empty_or_not = $params_value[1] . "=";
                                            $extended = ' (jQuery("#wdform_' . $params_value[0] . '_element_title' . $form_id . '").val()' . $name_empty_or_not . '"" ' . $name_and_or . ' jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val()' . $name_empty_or_not . '"" ' . $name_and_or . ' jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val()' . $name_empty_or_not . '"" ' . $name_and_or . ' jQuery("#wdform_' . $params_value[0] . '_element_middle' . $form_id . '").val()' . $name_empty_or_not . '"") ';
                                            $normal = ' (jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val()' . $name_empty_or_not . '"" ' . $name_and_or . ' jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val()' . $name_empty_or_not . '"") ';
                                            $if .= ' ((jQuery("#wdform_' . $params_value[0] . '_element_title' . $form_id . '").length != 0 || jQuery("#wdform_' . $params_value[0] . '_element_middle' . $form_id . '").length != 0) ?  ' . $extended . ' : ' . $normal . ') ';
                                        } else {
                                            $extended0 = '';
                                            $extended1 = '';
                                            $extended2 = '';
                                            $extended3 = '';
                                            $normal0 = '';
                                            $normal1 = '';
                                            $normal2 = '';
                                            $normal3 = '';
                                            $name_fields = explode(' ', $params_value[2]);
                                            if ($name_fields[0] != '') {
                                                $extended0 = 'jQuery("#wdform_' . $params_value[0] . '_element_title' . $form_id . '").val()' . $params_value[1] . '"' . $name_fields[0] . '"';
                                                $normal0 = 'jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val()' . $params_value[1] . '"' . $name_fields[0] . '"';
                                            }
                                            if (isset($name_fields[1]) && $name_fields[1] != '') {
                                                $extended1 = 'jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val()' . $params_value[1] . '"' . $name_fields[1] . '"';
                                                $normal1 = 'jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val()' . $params_value[1] . '"' . $name_fields[1] . '"';
                                            }
                                            if (isset($name_fields[2]) && $name_fields[2] != '') {
                                                $extended2 = 'jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val()' . $params_value[1] . '"' . $name_fields[2] . '"';
                                                $normal2 = '';
                                            }
                                            if (isset($name_fields[3]) && $name_fields[3] != '') {
                                                $extended3 = 'jQuery("#wdform_' . $params_value[0] . '_element_middle' . $form_id . '").val()' . $params_value[1] . '"' . $name_fields[3] . '"';
                                                $normal3 = '';
                                            }
                                            if (isset($name_fields[3])) {
                                                $extended = '';
                                                $normal = '';
                                                if ($extended0) {
                                                    $extended = $extended0;
                                                    if ($extended1) {
                                                        $extended .= ' && ' . $extended1;
                                                        if ($extended2) {
                                                            $extended .= ' && ' . $extended2;
                                                        }
                                                        if ($extended3) {
                                                            $extended .= ' && ' . $extended3;
                                                        }
                                                    } else {
                                                        if ($extended2) {
                                                            $extended .= ' && ' . $extended2;
                                                        }
                                                        if ($extended3) {
                                                            $extended .= ' && ' . $extended3;
                                                        }
                                                    }
                                                } else {
                                                    if ($extended1) {
                                                        $extended = $extended1;
                                                        if ($extended2) {
                                                            $extended .= ' && ' . $extended2;
                                                        }
                                                        if ($extended3) {
                                                            $extended .= ' && ' . $extended3;
                                                        }
                                                    } else {
                                                        if ($extended2) {
                                                            $extended = $extended2;
                                                            if ($extended3) {
                                                                $extended .= ' && ' . $extended3;
                                                            }
                                                        } else {
                                                            if ($extended3) {
                                                                $extended = $extended3;
                                                            }
                                                        }
                                                    }
                                                }
                                                if ($normal0) {
                                                    $normal = $normal0;
                                                    if ($normal1) {
                                                        $normal .= ' && ' . $normal1;
                                                    }
                                                } else {
                                                    if ($normal1) {
                                                        $normal = $normal1;
                                                    }
                                                }
                                            } else {
                                                if (isset($name_fields[2])) {
                                                    $extended = "";
                                                    $normal = "";
                                                    if ($extended0) {
                                                        $extended = $extended0;
                                                        if ($extended1) {
                                                            $extended .= ' && ' . $extended1;
                                                        }
                                                        if ($extended2) {
                                                            $extended .= ' && ' . $extended2;
                                                        }
                                                    } else {
                                                        if ($extended1) {
                                                            $extended = $extended1;
                                                            if ($extended2) {
                                                                $extended .= ' && ' . $extended2;
                                                            }
                                                        } else {
                                                            if ($extended2) {
                                                                $extended = $extended2;
                                                            }
                                                        }
                                                    }
                                                    if ($normal0) {
                                                        $normal = $normal0;
                                                        if ($normal1) {
                                                            $normal .= ' && ' . $normal1;
                                                        }
                                                    } else {
                                                        if ($normal1) {
                                                            $normal = $normal1;
                                                        }
                                                    }
                                                } else {
                                                    if (isset($name_fields[1])) {
                                                        $extended = '';
                                                        $normal = '';
                                                        if ($extended0) {
                                                            if ($extended1) {
                                                                $extended = $extended0 . ' && ' . $extended1;
                                                            } else {
                                                                $extended = $extended0;
                                                            }
                                                        } else {
                                                            if ($extended1) {
                                                                $extended = $extended1;
                                                            }
                                                        }
                                                        if ($normal0) {
                                                            if ($normal1) {
                                                                $normal = $normal0 . ' && ' . $normal1;
                                                            } else {
                                                                $normal = $normal0;
                                                            }
                                                        } else {
                                                            if ($normal1) {
                                                                $normal = $normal1;
                                                            }
                                                        }
                                                    } else {
                                                        $extended = $extended0;
                                                        $normal = $normal0;
                                                    }
                                                }
                                            }
                                            if ($extended != "" && $normal != "") {
                                                $if .= ' ((jQuery("#wdform_' . $params_value[0] . '_element_title' . $form_id . '").length != 0 || jQuery("#wdform_' . $params_value[0] . '_element_middle' . $form_id . '").length != 0) ?  ' . $extended . ' : ' . $normal . ') ';
                                            } else {
                                                $if .= ' true';
                                            }
                                        }
                                    }
                                    $keyup .= '#wdform_' . $params_value[0] . '_element_title' . $form_id . ', #wdform_' . $params_value[0] . '_element_first' . $form_id . ', #wdform_' . $params_value[0] . '_element_last' . $form_id . ', #wdform_' . $params_value[0] . '_element_middle' . $form_id . ', ';
                                    break;
                                case "type_phone":
                                    if ($params_value[1] == "==" || $params_value[1] == "!=") {
                                        $phone_fields = explode(' ', $params_value[2]);
                                        if (isset($phone_fields[1])) {
                                            if ($phone_fields[0] != '' && $phone_fields[1] != '') {
                                                $if .= ' (jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val()' . $params_value[1] . '"' . $phone_fields[0] . '" && jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val()' . $params_value[1] . '"' . $phone_fields[1] . '") ';
                                            } else {
                                                if ($phone_fields[0] == '') {
                                                    $if .= ' (jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val()' . $params_value[1] . '"' . $phone_fields[1] . '") ';
                                                } else {
                                                    if ($phone_fields[1] == '') {
                                                        $if .= ' (jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val()' . $params_value[1] . '"' . $phone_fields[1] . '") ';
                                                    }
                                                }
                                            }
                                        } else {
                                            $if .= ' jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" ';
                                        }
                                    }
                                    if ($params_value[1] == "%" || $params_value[1] == "!%") {
                                        $like_or_not = $params_value[1] == "%" ? ">" : "==";
                                        $phone_fields = explode(' ', $params_value[2]);
                                        if (isset($phone_fields[1])) {
                                            if ($phone_fields[0] != '' && $phone_fields[1] != '') {
                                                $if .= ' (jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val().indexOf("' . $phone_fields[0] . '")' . $like_or_not . '-1 && jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val().indexOf("' . $phone_fields[1] . '")' . $like_or_not . '-1)';
                                            } else {
                                                if ($phone_fields[0] == '') {
                                                    $if .= ' (jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val().indexOf("' . $phone_fields[1] . '")' . $like_or_not . '-1) ';
                                                } else {
                                                    if ($phone_fields[1] == '') {
                                                        $if .= ' (jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val().indexOf("' . $phone_fields[0] . '")' . $like_or_not . '-1) ';
                                                    }
                                                }
                                            }
                                        } else {
                                            $if .= ' (jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val().indexOf("' . $phone_fields[0] . '")' . $like_or_not . '-1) ';
                                        }
                                    }
                                    if ($params_value[1] == "=" || $params_value[1] == "!") {
                                        $params_value[2] = "";
                                        $and_or_phone = $params_value[1] == "=" ? "&&" : "||";
                                        $params_value[1] = $params_value[1] . "=";
                                        $if .= ' (jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" ' . $and_or_phone . ' jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '") ';
                                    }
                                    $keyup .= '#wdform_' . $params_value[0] . '_element_first' . $form_id . ', #wdform_' . $params_value[0] . '_element_last' . $form_id . ', ';
                                    break;
                                case "type_paypal_price":
                                    if ($params_value[1] == "==" || $params_value[1] == "!=") {
                                        $if .= ' (jQuery("#wdform_' . $params_value[0] . '_td_name_cents").attr("style")=="display: none;" ? jQuery("#wdform_' . $params_value[0] . '_element_dollars' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" : parseFloat(jQuery("#wdform_' . $params_value[0] . '_element_dollars' . $form_id . '").val()+"."+jQuery("#wdform_' . $params_value[0] . '_element_cents' . $form_id . '").val())' . $params_value[1] . 'parseFloat("' . str_replace('.0', '.', $params_value[2]) . '"))';
                                    }
                                    if ($params_value[1] == "%" || $params_value[1] == "!%") {
                                        $like_or_not = $params_value[1] == "%" ? ">" : "==";
                                        $if .= ' (jQuery("#wdform_' . $params_value[0] . '_td_name_cents").attr("style")=="display: none;" ? jQuery("#wdform_' . $params_value[0] . '_element_dollars' . $form_id . '").val().indexOf("' . $params_value[2] . '")' . $like_or_not . '-1 : (jQuery("#wdform_' . $params_value[0] . '_element_dollars' . $form_id . '").val()+"."+jQuery("#wdform_' . $params_value[0] . '_element_cents' . $form_id . '").val()).indexOf("' . str_replace('.0', '.', $params_value[2]) . '")' . $like_or_not . '-1) ';
                                    }
                                    if ($params_value[1] == "=" || $params_value[1] == "!") {
                                        $params_value[2] = "";
                                        $and_or_price = $params_value[1] == "=" ? "&&" : "||";
                                        $params_value[1] = $params_value[1] . "=";
                                        $if .= ' (jQuery("#wdform_' . $params_value[0] . '_td_name_cents").attr("style")=="display: none;" ? jQuery("#wdform_' . $params_value[0] . '_element_dollars' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" : (jQuery("#wdform_' . $params_value[0] . '_element_dollars' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" ' . $and_or_price . ' jQuery("#wdform_' . $params_value[0] . '_element_cents' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '"))';
                                    }
                                    $keyup .= '#wdform_' . $params_value[0] . '_element_dollars' . $form_id . ', #wdform_' . $params_value[0] . '_element_cents' . $form_id . ', ';
                                    break;
                                case "type_own_select":
                                case "type_paypal_select":
                                    if ($params_value[1] == "%" || $params_value[1] == "!%") {
                                        $like_or_not = $params_value[1] == "%" ? ">" : "==";
                                        $if .= ' jQuery("#wdform_' . $params_value[0] . '_element' . $form_id . '").val().indexOf("' . $params_value[2] . '")' . $like_or_not . '-1 ';
                                    } else {
                                        if ($params_value[1] == "=" || $params_value[1] == "!") {
                                            $params_value[2] = "";
                                            $params_value[1] = $params_value[1] . "=";
                                        }
                                        $if .= ' jQuery("#wdform_' . $params_value[0] . '_element' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" ';
                                    }
                                    $change .= '#wdform_' . $params_value[0] . '_element' . $form_id . ', ';
                                    break;
                                case "type_address":
                                    if ($params_value[1] == "%" || $params_value[1] == "!%") {
                                        $like_or_not = $params_value[1] == "%" ? ">" : "==";
                                        $if .= ' jQuery("#wdform_' . $params_value[0] . '_country' . $form_id . '").val().indexOf("' . $params_value[2] . '")' . $like_or_not . '-1 ';
                                    } else {
                                        if ($params_value[1] == "=" || $params_value[1] == "!") {
                                            $params_value[2] = "";
                                            $params_value[1] = $params_value[1] . "=";
                                        }
                                        $if .= ' jQuery("#wdform_' . $params_value[0] . '_country' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" ';
                                    }
                                    $change .= '#wdform_' . $params_value[0] . '_country' . $form_id . ', ';
                                    break;
                                case "type_country":
                                    if ($params_value[1] == "%" || $params_value[1] == "!%") {
                                        $like_or_not = $params_value[1] == "%" ? ">" : "==";
                                        $if .= ' wdformjQuery("#wdform_' . $params_value[0] . '_element' . $form_id . '").val().indexOf("' . $params_value[2] . '")' . $like_or_not . '-1 ';
                                    } else {
                                        if ($params_value[1] == "=" || $params_value[1] == "!") {
                                            $params_value[2] = "";
                                            $params_value[1] = $params_value[1] . "=";
                                        }
                                        $if .= ' wdformjQuery("#wdform_' . $params_value[0] . '_element' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" ';
                                    }
                                    $change .= '#wdform_' . $params_value[0] . '_element' . $form_id . ', ';
                                    break;
                                case "type_radio":
                                case "type_paypal_radio":
                                case "type_paypal_shipping":
                                    if ($params_value[1] == "==" || $params_value[1] == "!=") {
                                        $if .= ' jQuery("input[name^=\'wdform_' . $params_value[0] . '_element' . $form_id . '\']:checked").val()' . $params_value[1] . '"' . $params_value[2] . '" ';
                                        $click .= 'div[wdid=' . $params_value[0] . '] input[type=\'radio\'], ';
                                    }
                                    if ($params_value[1] == "%" || $params_value[1] == "!%") {
                                        $click .= 'div[wdid=' . $params_value[0] . '] input[type=\'radio\'], ';
                                        $like_or_not = $params_value[1] == "%" ? ">" : "==";
                                        $if .= ' (jQuery("input[name^=\'wdform_' . $params_value[0] . '_element' . $form_id . '\']:checked").val() ? (jQuery("input[name^=\'wdform_' . $params_value[0] . '_element' . $form_id . '\']:checked").attr("other") ? false  : (jQuery("input[name^=\'wdform_' . $params_value[0] . '_element' . $form_id . '\']:checked").val().indexOf("' . $params_value[2] . '")' . $like_or_not . '-1 )) : false) ';
                                    }
                                    if ($params_value[1] == "=" || $params_value[1] == "!") {
                                        $ckecked_or_no = $params_value[1] == "=" ? "!" : "";
                                        $if .= ' ' . $ckecked_or_no . 'jQuery("input[name^=\'wdform_' . $params_value[0] . '_element' . $form_id . '\']:checked").val()';
                                        $click .= 'div[wdid=' . $params_value[0] . '] input[type=\'radio\'], ';
                                    }
                                    break;
                                case "type_checkbox":
                                case "type_paypal_checkbox":
                                    if ($params_value[1] == "==" || $params_value[1] == "!=") {
                                        if ($params_value[2]) {
                                            $choises = explode('@@@', $params_value[2]);
                                            $choises = array_slice($choises, 0, count($choises) - 1);
                                            if ($params_value[1] == "!=") {
                                                $is = "!";
                                            } else {
                                                $is = "";
                                            }
                                            foreach ($choises as $key1 => $choise) {
                                                if ($type_and_id[$params_value[0]] == "type_paypal_checkbox") {
                                                    $choise_and_value = explode("*:*value*:*", $choise);
                                                    $if .= ' ' . $is . '(jQuery("div[wdid=' . $params_value[0] . '] input[value=\\"' . $choise_and_value[1] . '\\"]").is(":checked") && jQuery("div[wdid=' . $params_value[0] . '] input[title=\\"' . $choise_and_value[0] . '\\"]"))';
                                                } else {
                                                    $if .= ' ' . $is . 'jQuery("div[wdid=' . $params_value[0] . '] input[value=\\"' . $choise . '\\"]").is(":checked") ';
                                                }
                                                if ($key1 != count($choises) - 1) {
                                                    $if .= '&&';
                                                }
                                            }
                                            $click .= 'div[wdid=' . $params_value[0] . '] input[type=\'checkbox\'], ';
                                        } else {
                                            if ($or_and == '&&') {
                                                $if .= ' true';
                                            } else {
                                                $if .= ' false';
                                            }
                                        }
                                    }
                                    if ($params_value[1] == "%" || $params_value[1] == "!%") {
                                        $like_or_not = $params_value[1] == "%" ? ">" : "==";
                                        if ($params_value[2]) {
                                            $choises = explode('@@@', $params_value[2]);
                                            $choises = array_slice($choises, 0, count($choises) - 1);
                                            if ($type_and_id[$params_value[0]] == "type_paypal_checkbox") {
                                                foreach ($choises as $key1 => $choise) {
                                                    $choise_and_value = explode("*:*value*:*", $choise);
                                                    $if .= ' jQuery("div[wdid=' . $params_value[0] . ']  input[type=\\"checkbox\\"]:checked").serialize().indexOf("' . $choise_and_value[1] . '")' . $like_or_not . '-1 ';
                                                    if ($key1 != count($choises) - 1) {
                                                        $if .= '&&';
                                                    }
                                                }
                                            } else {
                                                foreach ($choises as $key1 => $choise) {
                                                    $if .= ' jQuery("div[wdid=' . $params_value[0] . ']  input[type=\\"checkbox\\"]:checked").serialize().indexOf("' . str_replace(" ", "+", $choise) . '")' . $like_or_not . '-1 ';
                                                    if ($key1 != count($choises) - 1) {
                                                        $if .= '&&';
                                                    }
                                                }
                                            }
                                            $click .= 'div[wdid=' . $params_value[0] . '] input[type=\'checkbox\'], ';
                                        } else {
                                            if ($or_and == '&&') {
                                                $if .= ' true';
                                            } else {
                                                $if .= ' false';
                                            }
                                        }
                                    }
                                    if ($params_value[1] == "=" || $params_value[1] == "!") {
                                        $ckecked_or_no = $params_value[1] == "=" ? "==" : ">";
                                        $if .= ' jQuery("div[wdid=' . $params_value[0] . '] input[type=\\"checkbox\\"]:checked").length' . $ckecked_or_no . '0 ';
                                        $click .= 'div[wdid=' . $params_value[0] . '] input[type=\'checkbox\'], ';
                                    }
                                    break;
                            }
                            if ($m != count($cond_params) - 1) {
                                $params_value_next = explode('***', $cond_params[$m + 1]);
                                if (isset($type_and_id[$params_value_next[0]])) {
                                    $if .= $or_and;
                                }
                            }
                        }
                        if ($if) {
                            $condition_js .= '
					
							if(' . $if . ')
								jQuery("div[wdid=' . $field_label[$k] . ']").' . $display . ';
							else
								jQuery("div[wdid=' . $field_label[$k] . ']").' . $display_none . ';';
                        }
                        if ($keyup) {
                            $condition_js .= '
							jQuery("' . substr($keyup, 0, -2) . '").keyup(function() { 

								if(' . $if . ')
									jQuery("div[wdid=' . $field_label[$k] . ']").' . $display . ';
								else
									jQuery("div[wdid=' . $field_label[$k] . ']").' . $display_none . '; });';
                        }
                        if ($change) {
                            $condition_js .= '
							jQuery("' . substr($change, 0, -2) . '").change(function() { 
								if(' . $if . ')
									jQuery("div[wdid=' . $field_label[$k] . ']").' . $display . ';
								else
									jQuery("div[wdid=' . $field_label[$k] . ']").' . $display_none . '; });';
                        }
                        if ($click) {
                            $condition_js .= '
							jQuery("' . substr($click, 0, -2) . '").click(function() { 
								if(' . $if . ')
									jQuery("div[wdid=' . $field_label[$k] . ']").' . $display . ';
								else
									jQuery("div[wdid=' . $field_label[$k] . ']").' . $display_none . '; });';
                        }
                    }
                }
            }
            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;
                    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]) ? esc_html($_POST["counter" . $form_id]) : NULL;
                            if (isset($post_value)) {
                                $post_temp = isset($_POST['wdform_' . $id1 . '_element' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element' . $form_id])) : "";
                                $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="' . $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("#form' . $form_id . '");';
                            if ($required) {
                                $check_js .= '
                if(x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
                {
                  if(x.find(jQuery("div[wdid=' . $id1 . '] input:checked")).length == 0)
                  {
                    alert("' . addslashes($label . ' ' . __('field is required.', '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]) ? esc_html(stripslashes($_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 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
                {
                  if(jQuery("#wdform_' . $id1 . '_element' . $form_id . '").val()=="' . $param['w_title'] . '" || jQuery("#wdform_' . $id1 . '_element' . $form_id . '").val()=="")
                  {
                    alert("' . addslashes($label . ' ' . __('field is required.', '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]) ? esc_html(stripslashes($_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 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
                {
                  if(jQuery("#wdform_' . $id1 . '_element' . $form_id . '").val()=="' . $param['w_title'] . '" || jQuery("#wdform_' . $id1 . '_element' . $form_id . '").val()=="")
                  {
                    alert("' . addslashes($label . ' ' . __('field is required.', '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 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
                {
                  if(jQuery("#wdform_' . $id1 . '_element' . $form_id . '").val()=="")
                  {
                    alert("' . addslashes($label . ' ' . __('field is required.', '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]) ? esc_html(stripslashes($_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 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
                {
                  if(jQuery("#wdform_' . $id1 . '_element' . $form_id . '").val()=="' . $param['w_title'] . '" || jQuery("#wdform_' . $id1 . '_element' . $form_id . '").val()=="")
                  {
                    alert("' . addslashes($label . ' ' . __('field is required.', '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 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
                {
                  if(tinyMCE.get("wdform_' . $id1 . '_wd_editor' . $form_id . '").getContent()=="")
                  {
                    alert("' . addslashes($label . ' ' . __('field is required.', '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]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element_first' . $form_id])) : $w_first_val[0]) . '***' . (isset($_POST['wdform_' . $id1 . '_element_last' . $form_id]) ? esc_html(stripslashes($_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 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
                {
                  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.', '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;
                            if (strpos($temp, 'w_name_fields') > -1) {
                                $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', 'w_name_fields');
                            }
                            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']);
                            $param['w_name_fields'] = isset($param['w_name_fields']) ? $param['w_name_fields'] : ($param['w_name_format'] == 'normal' ? 'no***no' : 'yes***yes');
                            $w_name_fields = explode('***', $param['w_name_fields']);
                            $element_title = isset($_POST['wdform_' . $id1 . '_element_title' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element_title' . $form_id])) : NULL;
                            $element_middle = isset($_POST['wdform_' . $id1 . '_element_middle' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element_middle' . $form_id])) : NULL;
                            $element_first = isset($_POST['wdform_' . $id1 . '_element_first' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element_first' . $form_id])) : NULL;
                            if (isset($element_title) || isset($element_middle)) {
                                $param['w_first_val'] = (isset($_POST['wdform_' . $id1 . '_element_first' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element_first' . $form_id])) : $w_first_val[0]) . '***' . (isset($_POST['wdform_' . $id1 . '_element_last' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element_last' . $form_id])) : $w_first_val[1]) . '***' . (isset($_POST['wdform_' . $id1 . '_element_title' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element_title' . $form_id])) : $w_first_val[2]) . '***' . (isset($_POST['wdform_' . $id1 . '_element_middle' . $form_id]) ? esc_html(stripslashes($_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]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element_first' . $form_id])) : $w_first_val[0]) . '***' . (isset($_POST['wdform_' . $id1 . '_element_last' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element_last' . $form_id])) : $w_first_val[1]);
                                }
                            }
                            $required = $param['w_required'] == "yes" ? true : false;
                            $w_first_val = explode('***', $param['w_first_val']);
                            if ($w_name_fields[0] == 'no' && $w_name_fields[1] == 'no') {
                                $w_name_format = '
					<div style="display: table-cell; width:50%">
					  <div><input type="text" class="' . ($w_first_val[0] == $w_title[0] ? "input_deactive" : "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="' . ($w_first_val[1] == $w_title[1] ? "input_deactive" : "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 {
                                $first_last_size = $w_name_fields[0] == 'yes' && $w_name_fields[1] == 'no' ? 45 : 30;
                                $w_name_format = '
					<div style="display: table-cell; width:' . $first_last_size . '%">
					  <div><input type="text" class="' . ($w_first_val[0] == $w_title[0] ? "input_deactive" : "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%;"></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:' . $first_last_size . '%">
					  <div><input type="text" class="' . ($w_first_val[1] == $w_title[1] ? "input_deactive" : "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%;"></div>
					  <div><label class="mini_label">' . $w_mini_labels[2] . '</label></div>
					</div>';
                                $w_size = 2 * $param['w_size'];
                                if ($w_name_fields[0] == 'yes') {
                                    $w_name_format = '
						<div style="display: table-cell;">
						  <div><input type="text" class="' . ($w_first_val[2] == $w_title[2] ? "input_deactive" : "input_active") . '" id="wdform_' . $id1 . '_element_title' . $form_id . '" name="wdform_' . $id1 . '_element_title' . $form_id . '" value="' . $w_first_val[2] . '" title="' . $w_title[2] . '" 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>' . $w_name_format;
                                    $w_size += 80;
                                }
                                if ($w_name_fields[1] == 'yes') {
                                    $w_name_format = $w_name_format . '
						<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="' . ($w_first_val[3] == $w_title[3] ? "input_deactive" : "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 += $param['w_size'];
                                }
                            }
                            $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) {
                                $check_js .= '
                  if(x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
                  {
                    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()=="" || (jQuery("#wdform_' . $id1 . '_element_title' . $form_id . '").length != 0 && (jQuery("#wdform_' . $id1 . '_element_title' . $form_id . '").val()=="' . (isset($w_title[2]) ? $w_title[2] : '') . '" || jQuery("#wdform_' . $id1 . '_element_title' . $form_id . '").val()=="")) || (jQuery("#wdform_' . $id1 . '_element_middle' . $form_id . '").length != 0 && (jQuery("#wdform_' . $id1 . '_element_middle' . $form_id . '").val()=="' . (isset($w_title[3]) ? $w_title[3] : '') . '" || jQuery("#wdform_' . $id1 . '_element_middle' . $form_id . '").val()=="")))
                    {
						alert("' . addslashes($label . ' ' . __('field is required.', '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]) ? esc_html(stripslashes($_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]) ? esc_html(stripslashes($_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]) ? esc_html(stripslashes($_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]) ? esc_html(stripslashes($_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]) ? esc_html(stripslashes($_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]) ? esc_html(stripslashes($_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", "Colombia", "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", "Nepal", "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]) ? esc_html(stripslashes($_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 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
                {
                  if(jQuery("#wdform_' . $id1 . '_street1' . $form_id . '").val()=="" || (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.', '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]) ? esc_html(stripslashes($_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]) ? esc_html(stripslashes($_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().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 . '").attr("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]) ? esc_html(stripslashes($_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]) ? esc_html(stripslashes($_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 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
                {
                  if(jQuery("#wdform_' . $id1 . '_element' . $form_id . '").val()=="' . $param['w_title'] . '" || jQuery("#wdform_' . $id1 . '_element' . $form_id . '").val()=="")
                  {
                    alert("' . addslashes($label . ' ' . __('field is required.', '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 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
              {
              
              if(jQuery("#wdform_' . $id1 . '_element' . $form_id . '").val()!="" && 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.", '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;
                            if (strpos($temp, 'w_field_option_pos') > -1) {
                                $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_field_option_pos', 'w_flow', 'w_choices', 'w_choices_checked', 'w_rowcol', 'w_required', 'w_randomize', 'w_allow_other', 'w_allow_other_num', 'w_value_disabled', 'w_choices_value', 'w_choices_params', 'w_class');
                            }
                            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;
                                }
                            }
                            if (!isset($param['w_value_disabled'])) {
                                $param['w_value_disabled'] = 'no';
                            }
                            if (!isset($param['w_field_option_pos'])) {
                                $param['w_field_option_pos'] = 'left';
                            }
                            $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;";
                            $param['w_field_option_pos1'] = $param['w_field_option_pos'] == "right" ? "style='float: none\n\t\t\t  !important;'" : "";
                            $param['w_field_option_pos2'] = $param['w_field_option_pos'] == "right" ? "style='float: left !important; margin:3px 8px 0 0 !important; display: inline-block !important;'" : "";
                            $required = $param['w_required'] == "yes" ? true : false;
                            $param['w_choices'] = explode('***', $param['w_choices']);
                            $param['w_choices_checked'] = explode('***', $param['w_choices_checked']);
                            if (isset($param['w_choices_value'])) {
                                $param['w_choices_value'] = explode('***', $param['w_choices_value']);
                                $param['w_choices_params'] = explode('***', $param['w_choices_params']);
                            }
                            $post_value = isset($_POST["counter" . $form_id]) ? esc_html($_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]) ? esc_html($_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">';
                            $total_queries = 0;
                            foreach ($param['w_choices'] as $key => $choice) {
                                $key1 = $key + $total_queries;
                                if (isset($param['w_choices_params']) && $param['w_choices_params'][$key]) {
                                    $choices_labels = array();
                                    $choices_values = array();
                                    $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][$key]);
                                    $where = str_replace(array('[', ']'), '', $w_choices_params[0]) ? ' WHERE ' . str_replace(array('[', ']'), '', $w_choices_params[0]) : '';
                                    $w_choices_params = explode('[db_info]', $w_choices_params[1]);
                                    $order_by = str_replace(array('[', ']'), '', $w_choices_params[0]);
                                    $db_info = str_replace(array('[', ']'), '', $w_choices_params[1]);
                                    $label_table_and_column = explode(':', str_replace(array('[', ']'), '', $choice));
                                    $table = $label_table_and_column[0];
                                    $label_column = $label_table_and_column[1];
                                    if ($label_column) {
                                        $choices_labels = $this->model->select_data_from_db_for_labels($db_info, $label_column, $table, $where, $order_by);
                                    }
                                    $value_table_and_column = explode(':', str_replace(array('[', ']'), '', $param['w_choices_value'][$key]));
                                    $value_column = $value_table_and_column[1];
                                    if ($value_column) {
                                        $choices_values = $this->model->select_data_from_db_for_values($db_info, $value_column, $table, $where, $order_by);
                                    }
                                    $columns_count_checkbox = count($choices_labels) > 0 ? count($choices_labels) : count($choices_values);
                                    if (array_filter($choices_labels) || array_filter($choices_values)) {
                                        $total_queries = $total_queries + $columns_count_checkbox - 1;
                                        if (!isset($post_value)) {
                                            $param['w_choices_checked'][$key] = $param['w_choices_checked'][$key] == 'true' ? 'checked="checked"' : '';
                                        }
                                        for ($k = 0; $k < $columns_count_checkbox; $k++) {
                                            $choice_label = isset($choices_labels[$k]) ? $choices_labels[$k] : '';
                                            $choice_value = isset($choices_values[$k]) ? $choices_values[$k] : $choice_label;
                                            if (($key1 + $k) % $param['w_rowcol'] == 0 && $key1 + $k > 0) {
                                                $rep .= '</div><div style="display: ' . ($param['w_flow'] == 'hor' ? 'inline-block' : 'table-row') . ';  vertical-align:top">';
                                            }
                                            if (isset($post_value)) {
                                                $post_valuetemp = $_REQUEST['wdform_' . $id1 . "_element" . $form_id . ($key1 + $k)];
                                                $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 . '' . ($key1 + $k) . '" ' . $param['w_field_option_pos1'] . '>' . $choice_label[0] . '</label><div class="checkbox-div forlabs" ' . $param['w_field_option_pos2'] . '><input type="checkbox" ' . ($param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == $key ? 'other="1"' : '') . ' id="wdform_' . $id1 . '_element' . $form_id . '' . ($key1 + $k) . '" name="wdform_' . $id1 . '_element' . $form_id . '' . ($key1 + $k) . '" value="' . htmlspecialchars($choice_value[0]) . '" ' . ($param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == $key ? 'onclick="if(set_checked(&quot;wdform_' . $id1 . '&quot;,&quot;' . ($key1 + $k) . '&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 . '' . ($key1 + $k) . '"></label></div></div>';
                                        }
                                    }
                                } else {
                                    if ($key1 % $param['w_rowcol'] == 0 && $key1 > 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]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_element" . $form_id . $key])) : NULL;
                                        $param['w_choices_checked'][$key] = isset($post_valuetemp) ? 'checked="checked"' : '';
                                    }
                                    $choice_value = isset($param['w_choices_value']) ? $param['w_choices_value'][$key] : $choice;
                                    $rep .= '<div style="display: ' . ($param['w_flow'] != 'hor' ? 'table-cell' : 'table-row') . ';"><label class="wdform-ch-rad-label" for="wdform_' . $id1 . '_element' . $form_id . '' . $key1 . '" ' . $param['w_field_option_pos1'] . '>' . $choice . '</label><div class="checkbox-div forlabs" ' . $param['w_field_option_pos2'] . '><input type="checkbox" ' . ($param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == $key ? 'other="1"' : '') . ' id="wdform_' . $id1 . '_element' . $form_id . '' . $key1 . '" name="wdform_' . $id1 . '_element' . $form_id . '' . $key1 . '" value="' . htmlspecialchars($choice_value) . '" ' . ($param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == $key ? 'onclick="if(set_checked(&quot;wdform_' . $id1 . '&quot;,&quot;' . $key1 . '&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 . '' . $key1 . '"></label></div></div>';
                                    $param['w_allow_other_num'] = $param['w_allow_other_num'] == $key ? $key1 : $param['w_allow_other_num'];
                                }
                            }
                            $rep .= '</div>';
                            $rep .= '</div></div>';
                            if ($required) {
                                $check_js .= '
                if(x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
                {
                  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.', '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]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_other_input" . $form_id])) : '') . '");';
                            }
                            if ($param['w_randomize'] == 'yes') {
                                $onload_js .= 'jQuery("#form' . $form_id . ' div[wdid=' . $id1 . '] .wdform-element-section> div").shuffle();
                ';
                            }
                            $onsubmit_js .= '
                jQuery("<input type=\\"hidden\\" name=\\"wdform_' . $id1 . '_allow_other' . $form_id . '\\" value = \\"' . $param['w_allow_other'] . '\\" />").appendTo("#form' . $form_id . '");
                jQuery("<input type=\\"hidden\\" name=\\"wdform_' . $id1 . '_allow_other_num' . $form_id . '\\" value = \\"' . $param['w_allow_other_num'] . '\\" />").appendTo("#form' . $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;
                            if (strpos($temp, 'w_field_option_pos') > -1) {
                                $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_field_option_pos', 'w_flow', 'w_choices', 'w_choices_checked', 'w_rowcol', 'w_required', 'w_randomize', 'w_allow_other', 'w_allow_other_num', 'w_value_disabled', 'w_choices_value', 'w_choices_params', 'w_class');
                            }
                            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;
                                }
                            }
                            if (!isset($param['w_value_disabled'])) {
                                $param['w_value_disabled'] = 'no';
                            }
                            if (!isset($param['w_field_option_pos'])) {
                                $param['w_field_option_pos'] = 'left';
                            }
                            $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;";
                            $param['w_field_option_pos1'] = $param['w_field_option_pos'] == "right" ? "style='float: none\n\t\t\t  !important;'" : "";
                            $param['w_field_option_pos2'] = $param['w_field_option_pos'] == "right" ? "style='float: left !important; margin:3px 8px 0 0 !important; display: inline-block !important;'" : "";
                            $required = $param['w_required'] == "yes" ? true : false;
                            $param['w_choices'] = explode('***', $param['w_choices']);
                            $param['w_choices_checked'] = explode('***', $param['w_choices_checked']);
                            if (isset($param['w_choices_value'])) {
                                $param['w_choices_value'] = explode('***', $param['w_choices_value']);
                                $param['w_choices_params'] = explode('***', $param['w_choices_params']);
                            }
                            $post_value = isset($_POST["counter" . $form_id]) ? esc_html($_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]) ? esc_html(stripslashes($_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">';
                            $total_queries = 0;
                            foreach ($param['w_choices'] as $key => $choice) {
                                $key1 = $key + $total_queries;
                                if (isset($param['w_choices_params']) && $param['w_choices_params'][$key]) {
                                    $choices_labels = array();
                                    $choices_values = array();
                                    $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][$key]);
                                    $where = str_replace(array('[', ']'), '', $w_choices_params[0]) ? ' WHERE ' . str_replace(array('[', ']'), '', $w_choices_params[0]) : '';
                                    $w_choices_params = explode('[db_info]', $w_choices_params[1]);
                                    $order_by = str_replace(array('[', ']'), '', $w_choices_params[0]);
                                    $db_info = str_replace(array('[', ']'), '', $w_choices_params[1]);
                                    $label_table_and_column = explode(':', str_replace(array('[', ']'), '', $choice));
                                    $table = $label_table_and_column[0];
                                    $label_column = $label_table_and_column[1];
                                    if ($label_column) {
                                        $choices_labels = $this->model->select_data_from_db_for_labels($db_info, $label_column, $table, $where, $order_by);
                                    }
                                    $value_table_and_column = explode(':', str_replace(array('[', ']'), '', $param['w_choices_value'][$key]));
                                    $value_column = $value_table_and_column[1];
                                    if ($value_column) {
                                        $choices_values = $this->model->select_data_from_db_for_values($db_info, $value_column, $table, $where, $order_by);
                                    }
                                    $columns_count_radio = count($choices_labels) > 0 ? count($choices_labels) : count($choices_values);
                                    if (array_filter($choices_labels) || array_filter($choices_values)) {
                                        $total_queries = $total_queries + $columns_count_radio - 1;
                                        if (!isset($post_value)) {
                                            $param['w_choices_checked'][$key] = $param['w_choices_checked'][$key] == 'true' ? 'checked="checked"' : '';
                                        }
                                        for ($k = 0; $k < $columns_count_radio; $k++) {
                                            $choice_label = isset($choices_labels[$k]) ? $choices_labels[$k] : '';
                                            $choice_value = isset($choices_values[$k]) ? $choices_values[$k] : $choice_label;
                                            if (($key1 + $k) % $param['w_rowcol'] == 0 && $key1 + $k > 0) {
                                                $rep .= '</div><div style="display: ' . ($param['w_flow'] == 'hor' ? 'inline-block' : 'table-row') . ';  vertical-align:top">';
                                            }
                                            if (isset($post_value)) {
                                                $post_valuetemp = $_REQUEST['wdform_' . $id1 . "_element" . $form_id];
                                                $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 . '' . ($key1 + $k) . '" ' . $param['w_field_option_pos1'] . '>' . $choice_label[0] . '</label><div class="radio-div forlabs" ' . $param['w_field_option_pos2'] . '><input type="radio" ' . ($param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == $key ? 'other="1"' : '') . ' id="wdform_' . $id1 . '_element' . $form_id . '' . ($key1 + $k) . '" name="wdform_' . $id1 . '_element' . $form_id . '" value="' . htmlspecialchars($choice_value[0]) . '" onclick="set_default(&quot;wdform_' . $id1 . '&quot;,&quot;' . ($key1 + $k) . '&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 . '' . ($key1 + $k) . '"></label></div></div>';
                                        }
                                    }
                                } else {
                                    if ($key1 % $param['w_rowcol'] == 0 && $key1 > 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]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_element" . $form_id])) : "") ? 'checked="checked"' : '';
                                    }
                                    $choice_value = isset($param['w_choices_value']) ? $param['w_choices_value'][$key] : $choice;
                                    $rep .= '<div style="display: ' . ($param['w_flow'] != 'hor' ? 'table-cell' : 'table-row') . ';"><label class="wdform-ch-rad-label" for="wdform_' . $id1 . '_element' . $form_id . '' . $key1 . '" ' . $param['w_field_option_pos1'] . '>' . $choice . '</label><div class="radio-div forlabs" ' . $param['w_field_option_pos2'] . '><input type="radio" ' . ($param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == $key ? 'other="1"' : '') . ' id="wdform_' . $id1 . '_element' . $form_id . '' . $key1 . '" name="wdform_' . $id1 . '_element' . $form_id . '" value="' . htmlspecialchars($choice_value) . '" onclick="set_default(&quot;wdform_' . $id1 . '&quot;,&quot;' . $key1 . '&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 . '' . $key1 . '"></label></div></div>';
                                    $param['w_allow_other_num'] = $param['w_allow_other_num'] == $key ? $key1 : $param['w_allow_other_num'];
                                }
                            }
                            $rep .= '</div>';
                            $rep .= '</div></div>';
                            if ($required) {
                                $check_js .= '
                if(x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none") {
                  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.', '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]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_other_input" . $form_id])) : '') . '");';
                            }
                            if ($param['w_randomize'] == 'yes') {
                                $onload_js .= 'jQuery("#form' . $form_id . ' div[wdid=' . $id1 . '] .wdform-element-section> div").shuffle();
                ';
                            }
                            $onsubmit_js .= '
                jQuery("<input type=\\"hidden\\" name=\\"wdform_' . $id1 . '_allow_other' . $form_id . '\\" value = \\"' . $param['w_allow_other'] . '\\" />").appendTo("#form' . $form_id . '");
                jQuery("<input type=\\"hidden\\" name=\\"wdform_' . $id1 . '_allow_other_num' . $form_id . '\\" value = \\"' . $param['w_allow_other_num'] . '\\" />").appendTo("#form' . $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;
                            if (strpos($temp, 'w_choices_value') > -1) {
                                $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_choices', 'w_choices_checked', 'w_choices_disabled', 'w_required', 'w_value_disabled', 'w_choices_value', 'w_choices_params', 'w_class');
                            }
                            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']);
                            if (isset($param['w_choices_value'])) {
                                $param['w_choices_value'] = explode('***', $param['w_choices_value']);
                                $param['w_choices_params'] = explode('***', $param['w_choices_params']);
                            }
                            if (!isset($param['w_value_disabled'])) {
                                $param['w_value_disabled'] = 'no';
                            }
                            $post_value = isset($_POST["counter" . $form_id]) ? esc_html($_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($param['w_choices_params']) && $param['w_choices_params'][$key]) {
                                    $choices_labels = array();
                                    $choices_values = array();
                                    $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][$key]);
                                    $where = str_replace(array('[', ']'), '', $w_choices_params[0]) ? ' WHERE ' . str_replace(array('[', ']'), '', $w_choices_params[0]) : '';
                                    $w_choices_params = explode('[db_info]', $w_choices_params[1]);
                                    $order_by = str_replace(array('[', ']'), '', $w_choices_params[0]);
                                    $db_info = str_replace(array('[', ']'), '', $w_choices_params[1]);
                                    $label_table_and_column = explode(':', str_replace(array('[', ']'), '', $choice));
                                    $table = $label_table_and_column[0];
                                    $label_column = $label_table_and_column[1];
                                    if ($label_column) {
                                        $choices_labels = $this->model->select_data_from_db_for_labels($db_info, $label_column, $table, $where, $order_by);
                                    }
                                    $value_table_and_column = explode(':', str_replace(array('[', ']'), '', $param['w_choices_value'][$key]));
                                    $value_column = $param['w_choices_disabled'][$key] == "true" ? '' : $value_table_and_column[1];
                                    if ($value_column) {
                                        $choices_values = $this->model->select_data_from_db_for_values($db_info, $value_column, $table, $where, $order_by);
                                    }
                                    $columns_count = count($choices_labels) > 0 ? count($choices_labels) : count($choices_values);
                                    if (array_filter($choices_labels) || array_filter($choices_values)) {
                                        for ($k = 0; $k < $columns_count; $k++) {
                                            $choice_label = isset($choices_labels[$k]) ? $choices_labels[$k] : '';
                                            $choice_value = isset($choices_values[$k]) ? $choices_values[$k] : ($param['w_choices_disabled'][$key] == "true" ? '' : $choice_label);
                                            if (!isset($post_value)) {
                                                $param['w_choices_checked'][$key] = $param['w_choices_checked'][$key] == 'true' && $k == 0 ? 'selected="selected"' : '';
                                            } else {
                                                $param['w_choices_checked'][$key] = $choice_value == htmlspecialchars($_REQUEST['wdform_' . $id1 . "_element" . $form_id]) ? 'selected="selected"' : '';
                                            }
                                            $rep .= '<option value="' . htmlspecialchars($choice_value[0]) . '" ' . $param['w_choices_checked'][$key] . '>' . $choice_label[0] . '</option>';
                                        }
                                    }
                                } else {
                                    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($_REQUEST['wdform_' . $id1 . "_element" . $form_id]) ? 'selected="selected"' : '';
                                    }
                                    $choice_value = $param['w_choices_disabled'][$key] == "true" ? '' : (isset($param['w_choices_value']) ? $param['w_choices_value'][$key] : $choice);
                                    $rep .= '<option 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 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
                {
                  if( jQuery("#wdform_' . $id1 . '_element' . $form_id . '").val()=="")
                    {
                      alert("' . addslashes($label . ' ' . __('field is required.', '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_country':
                            $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_countries', '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_countries'] = explode('***', $param['w_countries']);
                            $post_value = isset($_POST["counter" . $form_id]) ? esc_html($_POST["counter" . $form_id]) : NULL;
                            $selected = '';
                            $rep = '<div type="type_country" 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_countries'] as $key => $choice) {
                                if (isset($post_value)) {
                                    $selected = htmlspecialchars($choice) == htmlspecialchars(isset($_POST['wdform_' . $id1 . "_element" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_element" . $form_id])) : "") ? 'selected="selected"' : '';
                                }
                                $choice_value = $choice;
                                $rep .= '<option value="' . $choice_value . '" ' . $selected . '>' . $choice . '</option>';
                            }
                            $rep .= '</select></div></div>';
                            if ($required) {
                                $check_js .= '
                if(x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
                {
                  if(jQuery("#wdform_' . $id1 . '_element' . $form_id . '").val()=="")
                    {
                      alert("' . addslashes($label . ' ' . __('field is required.', '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_time':
                            $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_time_type', 'w_am_pm', 'w_sec', 'w_hh', 'w_mm', 'w_ss', 'w_mini_labels', '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;
                                }
                            }
                            $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_sec = '';
                            $w_sec_label = '';
                            if ($param['w_sec'] == '1') {
                                $w_sec = '<div align="center" style="display: table-cell;"><span class="wdform_colon" style="vertical-align: middle;">&nbsp;:&nbsp;</span></div><div style="display: table-cell;"><input type="text" value="' . (isset($_POST['wdform_' . $id1 . "_ss" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_ss" . $form_id])) : $param['w_ss']) . '" class="time_box" id="wdform_' . $id1 . '_ss' . $form_id . '" name="wdform_' . $id1 . '_ss' . $form_id . '" onkeypress="return check_second(event, &quot;wdform_' . $id1 . '_ss' . $form_id . '&quot;)" ' . $param['attributes'] . '></div>';
                                $w_sec_label = '<div style="display: table-cell;"></div><div style="display: table-cell;"><label class="mini_label">' . $w_mini_labels[2] . '</label></div>';
                            }
                            if ($param['w_time_type'] == '12') {
                                if ((isset($_POST['wdform_' . $id1 . "_am_pm" . $form_id]) ? esc_html($_POST['wdform_' . $id1 . "_am_pm" . $form_id]) : $param['w_am_pm']) == 'am') {
                                    $am_ = "selected=\"selected\"";
                                    $pm_ = "";
                                } else {
                                    $am_ = "";
                                    $pm_ = "selected=\"selected\"";
                                }
                                $w_time_type = '<div style="display: table-cell;"><select class="am_pm_select" name="wdform_' . $id1 . '_am_pm' . $form_id . '" id="wdform_' . $id1 . '_am_pm' . $form_id . '" ' . $param['attributes'] . '><option value="am" ' . $am_ . '>AM</option><option value="pm" ' . $pm_ . '>PM</option></select></div>';
                                $w_time_type_label = '<div ><label class="mini_label">' . $w_mini_labels[3] . '</label></div>';
                            } else {
                                $w_time_type = '';
                                $w_time_type_label = '';
                            }
                            $rep = '<div type="type_time" 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'] . ';"><div style="display: table;"><div style="display: table-row;"><div style="display: table-cell;"><input type="text" value="' . (isset($_POST['wdform_' . $id1 . "_hh" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_hh" . $form_id])) : $param['w_hh']) . '" class="time_box" id="wdform_' . $id1 . '_hh' . $form_id . '" name="wdform_' . $id1 . '_hh' . $form_id . '" onkeypress="return check_hour(event, &quot;wdform_' . $id1 . '_hh' . $form_id . '&quot;, &quot;23&quot;)" ' . $param['attributes'] . '></div><div align="center" style="display: table-cell;"><span class="wdform_colon" style="vertical-align: middle;">&nbsp;:&nbsp;</span></div><div style="display: table-cell;"><input type="text" value="' . (isset($_POST['wdform_' . $id1 . "_mm" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_mm" . $form_id])) : $param['w_mm']) . '" class="time_box" id="wdform_' . $id1 . '_mm' . $form_id . '" name="wdform_' . $id1 . '_mm' . $form_id . '" onkeypress="return check_minute(event, &quot;wdform_' . $id1 . '_mm' . $form_id . '&quot;)" ' . $param['attributes'] . '></div>' . $w_sec . $w_time_type . '</div><div style="display: table-row;"><div style="display: table-cell;"><label class="mini_label">' . $w_mini_labels[0] . '</label></div><div style="display: table-cell;"></div><div style="display: table-cell;"><label class="mini_label">' . $w_mini_labels[1] . '</label></div>' . $w_sec_label . $w_time_type_label . '</div></div></div></div>';
                            if ($required) {
                                $check_js .= '
                if(x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
                {
                  if(jQuery("#wdform_' . $id1 . '_mm' . $form_id . '").val()=="" || jQuery("#wdform_' . $id1 . '_hh' . $form_id . '").val()=="" || (jQuery("#wdform_' . $id1 . '_ss' . $form_id . '").length != 0 ? jQuery("#wdform_' . $id1 . '_ss' . $form_id . '").val()=="" : false))
                  {
                    alert("' . addslashes($label . ' ' . __('field is required.', '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 . '_hh' . $form_id . '").focus();
                    return false;
                  }
                }
                ';
                            }
                            break;
                        case 'type_date':
                            $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_date', 'w_required', 'w_class', 'w_format', 'w_but_val');
                            $temp = $params;
                            if (strpos($temp, 'w_disable_past_days') > -1) {
                                $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_date', 'w_required', 'w_class', 'w_format', 'w_but_val', 'w_disable_past_days');
                            }
                            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_disable_past_days'] = isset($param['w_disable_past_days']) ? $param['w_disable_past_days'] : 'no';
                            $disable_past_days = $param['w_disable_past_days'] == 'yes' ? 'true' : 'false';
                            $param['w_date'] = isset($_POST['wdform_' . $id1 . "_element" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_element" . $form_id])) : $param['w_date'];
                            $rep = '<div type="type_date" 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'] . ';"><input type="text" value="' . $param['w_date'] . '" class="wdform-date" id="wdform_' . $id1 . '_element' . $form_id . '" name="wdform_' . $id1 . '_element' . $form_id . '" maxlength="10" ' . $param['attributes'] . '><input id="wdform_' . $id1 . '_button' . $form_id . '" class="wdform-calendar-button" type="reset" value="' . $param['w_but_val'] . '" format="' . $param['w_format'] . '" onclick="return showCalendar(\'wdform_' . $id1 . '_element' . $form_id . '\' , \'' . $param['w_format'] . '\', ' . $disable_past_days . ')" ' . $param['attributes'] . ' ></div></div>';
                            if ($required) {
                                $check_js .= '
                if(x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
                {
                  if(jQuery("#wdform_' . $id1 . '_element' . $form_id . '").val()=="")
                  {
                    alert("' . addslashes($label . ' ' . __('field is required.', '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 ($disable_past_days == 'true') {
                                $check_js .= '
                var currentDate = new Date();
				if( Date.parse(jQuery("#wdform_' . $id1 . '_element' . $form_id . '").val() + " 23:59:59") < currentDate.getTime() ) {
					alert("' . __('You cannot select former dates. Choose a date starting from the current one.', 'form_maker') . '");
					return false;
				}
				';
                            }
                            // $onload_js.= 'Calendar.setup({inputField: "wdform_'.$id1.'_element'.$form_id.'",	ifFormat: "'.$param['w_format'].'",button: "wdform_'.$id1.'_button'.$form_id.'",align: "Tl",singleClick: true,firstDay: 0});';
                            break;
                        case 'type_date_fields':
                            $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_day', 'w_month', 'w_year', 'w_day_type', 'w_month_type', 'w_year_type', 'w_day_label', 'w_month_label', 'w_year_label', 'w_day_size', 'w_month_size', 'w_year_size', 'w_required', 'w_class', 'w_from', 'w_to', 'w_divider');
                            $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_day'] = isset($_POST['wdform_' . $id1 . "_day" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_day" . $form_id])) : $param['w_day'];
                            $param['w_month'] = isset($_POST['wdform_' . $id1 . "_month" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_month" . $form_id])) : $param['w_month'];
                            $param['w_year'] = isset($_POST['wdform_' . $id1 . "_year" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_year" . $form_id])) : $param['w_year'];
                            $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;
                            if ($param['w_day_type'] == "SELECT") {
                                $w_day_type = '<select id="wdform_' . $id1 . '_day' . $form_id . '" name="wdform_' . $id1 . '_day' . $form_id . '" style="width: ' . $param['w_day_size'] . 'px;" ' . $param['attributes'] . '><option value=""></option>';
                                for ($k = 1; $k <= 31; $k++) {
                                    if ($k < 10) {
                                        if ($param['w_day'] == '0' . $k) {
                                            $selected = "selected=\"selected\"";
                                        } else {
                                            $selected = "";
                                        }
                                        $w_day_type .= '<option value="0' . $k . '" ' . $selected . '>0' . $k . '</option>';
                                    } else {
                                        if ($param['w_day'] == '' . $k) {
                                            $selected = "selected=\"selected\"";
                                        } else {
                                            $selected = "";
                                        }
                                        $w_day_type .= '<option value="' . $k . '" ' . $selected . '>' . $k . '</option>';
                                    }
                                }
                                $w_day_type .= '</select>';
                            } else {
                                $w_day_type = '<input type="text" value="' . $param['w_day'] . '" id="wdform_' . $id1 . '_day' . $form_id . '" name="wdform_' . $id1 . '_day' . $form_id . '" style="width: ' . $param['w_day_size'] . 'px;" ' . $param['attributes'] . '>';
                                $onload_js .= 'jQuery("#wdform_' . $id1 . '_day' . $form_id . '").blur(function() {if (jQuery(this).val()=="0") jQuery(this).val(""); else add_0(this)});';
                                $onload_js .= 'jQuery("#wdform_' . $id1 . '_day' . $form_id . '").keypress(function() {return check_day(event, this)});';
                            }
                            if ($param['w_month_type'] == "SELECT") {
                                $w_month_type = '<select id="wdform_' . $id1 . '_month' . $form_id . '" name="wdform_' . $id1 . '_month' . $form_id . '" style="width: ' . $param['w_month_size'] . 'px;" ' . $param['attributes'] . '><option value=""></option><option value="01" ' . ($param['w_month'] == "01" ? "selected=\"selected\"" : "") . '  >' . __("January", 'form_maker') . '</option><option value="02" ' . ($param['w_month'] == "02" ? "selected=\"selected\"" : "") . '>' . __("February", 'form_maker') . '</option><option value="03" ' . ($param['w_month'] == "03" ? "selected=\"selected\"" : "") . '>' . __("March", 'form_maker') . '</option><option value="04" ' . ($param['w_month'] == "04" ? "selected=\"selected\"" : "") . ' >' . __("April", 'form_maker') . '</option><option value="05" ' . ($param['w_month'] == "05" ? "selected=\"selected\"" : "") . ' >' . __("May", 'form_maker') . '</option><option value="06" ' . ($param['w_month'] == "06" ? "selected=\"selected\"" : "") . ' >' . __("June", 'form_maker') . '</option><option value="07" ' . ($param['w_month'] == "07" ? "selected=\"selected\"" : "") . ' >' . __("July", 'form_maker') . '</option><option value="08" ' . ($param['w_month'] == "08" ? "selected=\"selected\"" : "") . ' >' . __("August", 'form_maker') . '</option><option value="09" ' . ($param['w_month'] == "09" ? "selected=\"selected\"" : "") . ' >' . __("September", 'form_maker') . '</option><option value="10" ' . ($param['w_month'] == "10" ? "selected=\"selected\"" : "") . ' >' . __("October", 'form_maker') . '</option><option value="11" ' . ($param['w_month'] == "11" ? "selected=\"selected\"" : "") . '>' . __("November", 'form_maker') . '</option><option value="12" ' . ($param['w_month'] == "12" ? "selected=\"selected\"" : "") . ' >' . __("December", 'form_maker') . '</option></select>';
                            } else {
                                $w_month_type = '<input type="text" value="' . $param['w_month'] . '" id="wdform_' . $id1 . '_month' . $form_id . '" name="wdform_' . $id1 . '_month' . $form_id . '"  style="width: ' . $param['w_day_size'] . 'px;" ' . $param['attributes'] . '>';
                                $onload_js .= 'jQuery("#wdform_' . $id1 . '_month' . $form_id . '").blur(function() {if (jQuery(this).val()=="0") jQuery(this).val(""); else add_0(this)});';
                                $onload_js .= 'jQuery("#wdform_' . $id1 . '_month' . $form_id . '").keypress(function() {return check_month(event, this)});';
                            }
                            if ($param['w_year_type'] == "SELECT") {
                                $w_year_type = '<select id="wdform_' . $id1 . '_year' . $form_id . '" name="wdform_' . $id1 . '_year' . $form_id . '"  from="' . $param['w_from'] . '" to="' . $param['w_to'] . '" style="width: ' . $param['w_year_size'] . 'px;" ' . $param['attributes'] . '><option value=""></option>';
                                for ($k = $param['w_to']; $k >= $param['w_from']; $k--) {
                                    if ($param['w_year'] == $k) {
                                        $selected = "selected=\"selected\"";
                                    } else {
                                        $selected = "";
                                    }
                                    $w_year_type .= '<option value="' . $k . '" ' . $selected . '>' . $k . '</option>';
                                }
                                $w_year_type .= '</select>';
                            } else {
                                $w_year_type = '<input type="text" value="' . $param['w_year'] . '" id="wdform_' . $id1 . '_year' . $form_id . '" name="wdform_' . $id1 . '_year' . $form_id . '" from="' . $param['w_from'] . '" to="' . $param['w_to'] . '" style="width: ' . $param['w_day_size'] . 'px;" ' . $param['attributes'] . '>';
                                $onload_js .= 'jQuery("#wdform_' . $id1 . '_year' . $form_id . '").keypress(function() {return check_year1(event, this)});';
                                $onload_js .= 'jQuery("#wdform_' . $id1 . '_year' . $form_id . '").change(function() {change_year(this)});';
                            }
                            $rep = '<div type="type_date_fields" 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'] . ';"><div style="display: table;"><div style="display: table-row;"><div style="display: table-cell;">' . $w_day_type . '</div><div style="display: table-cell;"><span class="wdform_separator">' . $param['w_divider'] . '</span></div><div style="display: table-cell;">' . $w_month_type . '</div><div style="display: table-cell;"><span class="wdform_separator">' . $param['w_divider'] . '</span></div><div style="display: table-cell;">' . $w_year_type . '</div></div><div style="display: table-row;"><div style="display: table-cell;"><label class="mini_label">' . $param['w_day_label'] . '</label></div><div style="display: table-cell;"></div><div style="display: table-cell;"><label class="mini_label" >' . $param['w_month_label'] . '</label></div><div style="display: table-cell;"></div><div style="display: table-cell;"><label class="mini_label">' . $param['w_year_label'] . '</label></div></div></div></div></div>';
                            if ($required) {
                                $check_js .= '
                if(x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
                {
                  if(jQuery("#wdform_' . $id1 . '_day' . $form_id . '").val()=="" || jQuery("#wdform_' . $id1 . '_month' . $form_id . '").val()=="" || jQuery("#wdform_' . $id1 . '_year' . $form_id . '").val()=="")
                  {
                    alert("' . addslashes($label . ' ' . __('field is required.', '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 . '_day' . $form_id . '").focus();
                    return false;
                  }
                }
                ';
                            }
                            break;
                        case 'type_file_upload':
                            $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_destination', 'w_extension', 'w_max_size', 'w_required', 'w_multiple', 'w_class');
                            $temp = $params;
                            foreach ($params_names as $params_name) {
                                $temp = explode('*:*' . $params_name . '*:*', $temp);
                                $param[$params_name] = $temp[0];
                                if (isset($temp[1])) {
                                    $temp = $temp[1];
                                } else {
                                    $temp = '';
                                }
                            }
                            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;
                            $multiple = $param['w_multiple'] == "yes" ? "multiple='multiple'" : "";
                            $rep = '<div type="type_file_upload" 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'] . ';"><label class="file-upload"><div class="file-picker"></div><input type="file" id="wdform_' . $id1 . '_element' . $form_id . '" name="wdform_' . $id1 . '_file' . $form_id . '[]" ' . $multiple . ' ' . $param['attributes'] . '></label></div></div>';
                            if ($required) {
                                $check_js .= '
                if(x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
                {
                  if(jQuery("#wdform_' . $id1 . '_element' . $form_id . '").val()=="")
                  {
                    alert("' . addslashes($label . ' ' . __('field is required.', '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;
                  }
                }
                ';
                            }
                            $check_js .= '
              if(x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
              {
                ext_available=getfileextension(jQuery("#wdform_' . $id1 . '_element' . $form_id . '").val(),"' . $param['w_extension'] . '");
                if(!ext_available)
                {
                  alert("' . addslashes(__("Sorry, you are not allowed to upload this type of file.", '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_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' => 'formmakerwdcaptcha', '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 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
              {
                if(jQuery("#wd_captcha_input' . $form_id . '").val()=="")
                {
                  alert("' . addslashes($label . ' ' . __('field is required.', '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_FM_DIR . '/recaptchalib.php';
                            $secure_server = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? recaptcha_get_html($publickey, $error, true) : recaptcha_get_html($publickey, $error);
                            $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'] . '>' . $secure_server . '</div></div></div>';
                            break;
                        case 'type_hidden':
                            $params_names = array('w_name', 'w_value');
                            $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;
                                }
                            }
                            $rep = '<div type="type_hidden" class="wdform-field"><div class="wdform-label-section" style="display: table-cell;"></div><div class="wdform-element-section" style="display: table-cell;"><input type="hidden" value="' . $param['w_value'] . '" id="wdform_' . $id1 . '_element' . $form_id . '" name="' . $param['w_name'] . '" ' . $param['attributes'] . '></div></div>';
                            break;
                        case 'type_mark_map':
                            $params_names = array('w_field_label_size', 'w_field_label_pos', '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;
                                }
                            }
                            $wdformfieldsize = $param['w_field_label_pos'] == "left" ? $param['w_field_label_size'] + $param['w_width'] : max($param['w_field_label_size'], $param['w_width']);
                            $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_mark_map" 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></div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ' width: ' . $param['w_width'] . 'px;"><input type="hidden" id="wdform_' . $id1 . '_long' . $form_id . '" name="wdform_' . $id1 . '_long' . $form_id . '" value="' . $param['w_long'] . '"><input type="hidden" id="wdform_' . $id1 . '_lat' . $form_id . '" name="wdform_' . $id1 . '_lat' . $form_id . '" value="' . $param['w_lat'] . '"><div id="wdform_' . $id1 . '_element' . $form_id . '" long0="' . $param['w_long'] . '" lat0="' . $param['w_lat'] . '" zoom="' . $param['w_zoom'] . '" info0="' . str_replace(array("\r\n", "\n", "\r"), '<br />', $param['w_info']) . '" center_x="' . $param['w_center_x'] . '" center_y="' . $param['w_center_y'] . '" style="width: 100%; height: ' . $param['w_height'] . 'px;" ' . $param['attributes'] . '></div></div></div>	';
                            $onload_js .= 'if_gmap_init("wdform_' . $id1 . '", ' . $form_id . ');';
                            $onload_js .= 'add_marker_on_map("wdform_' . $id1 . '", 0, "' . $param['w_long'] . '", "' . $param['w_lat'] . '", "' . str_replace(array("\r\n", "\n", "\r"), '<br />', $param['w_info']) . '", ' . $form_id . ',true);';
                            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_paypal_price':
                            $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_first_val', 'w_title', 'w_mini_labels', 'w_size', 'w_required', 'w_hide_cents', 'w_class', 'w_range_min', 'w_range_max');
                            $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_dollars' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element_dollars' . $form_id])) : $w_first_val[0]) . '***' . (isset($_POST['wdform_' . $id1 . '_element_cents' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element_cents' . $form_id])) : $w_first_val[1]);
                            $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;
                            $hide_cents = $param['w_hide_cents'] == "yes" ? "none;" : "table-cell;";
                            $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_paypal_price" 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'] . ';"><input type="hidden" value="' . $param['w_range_min'] . '" name="wdform_' . $id1 . '_range_min' . $form_id . '" id="wdform_' . $id1 . '_range_min' . $form_id . '"><input type="hidden" value="' . $param['w_range_max'] . '" name="wdform_' . $id1 . '_range_max' . $form_id . '" id="wdform_' . $id1 . '_range_max' . $form_id . '"><div id="wdform_' . $id1 . '_table_price" style="display: table;"><div id="wdform_' . $id1 . '_tr_price1" style="display: table-row;"><div id="wdform_' . $id1 . '_td_name_currency" style="display: table-cell;"><span class="wdform_colon" style="vertical-align: middle;"><!--repstart-->&nbsp;' . $form_currency . '&nbsp;<!--repend--></span></div><div id="wdform_' . $id1 . '_td_name_dollars" style="display: table-cell;"><input type="text" class="' . $input_active . '" id="wdform_' . $id1 . '_element_dollars' . $form_id . '" name="wdform_' . $id1 . '_element_dollars' . $form_id . '" value="' . $w_first_val[0] . '" title="' . $w_title[0] . '" onkeypress="return check_isnum(event)" style="width: ' . $param['w_size'] . 'px;" ' . $param['attributes'] . '></div><div id="wdform_' . $id1 . '_td_name_divider" style="display: ' . $hide_cents . ';"><span class="wdform_colon" style="vertical-align: middle;">&nbsp;.&nbsp;</span></div><div id="wdform_' . $id1 . '_td_name_cents" style="display: ' . $hide_cents . '"><input type="text" class="' . $input_active . '" id="wdform_' . $id1 . '_element_cents' . $form_id . '" name="wdform_' . $id1 . '_element_cents' . $form_id . '" value="' . $w_first_val[1] . '" title="' . $w_title[1] . '" style="width: 30px;" ' . $param['attributes'] . '></div></div><div id="wdform_' . $id1 . '_tr_price2" style="display: table-row;"><div style="display: table-cell;"><label class="mini_label"></label></div><div align="left" style="display: table-cell;"><label class="mini_label">' . $w_mini_labels[0] . '</label></div><div id="wdform_' . $id1 . '_td_name_label_divider" style="display: ' . $hide_cents . '"><label class="mini_label"></label></div><div align="left" id="wdform_' . $id1 . '_td_name_label_cents" style="display: ' . $hide_cents . '"><label class="mini_label">' . $w_mini_labels[1] . '</label></div></div></div></div></div>';
                            $onload_js .= 'jQuery("#wdform_' . $id1 . '_element_cents' . $form_id . '").blur(function() {add_0(this)});';
                            $onload_js .= 'jQuery("#wdform_' . $id1 . '_element_cents' . $form_id . '").keypress(function(event) {return check_isnum_interval(event,this,0,99)});';
                            if ($required) {
                                $check_js .= '
                if(x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
                {
                  if(jQuery("#wdform_' . $id1 . '_element_dollars' . $form_id . '").val()=="' . $w_title[0] . '" || jQuery("#wdform_' . $id1 . '_element_dollars' . $form_id . '").val()=="")
                  {
                    alert("' . addslashes($label . ' ' . __('field is required.', '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_dollars' . $form_id . '").focus();
                    return false;
                  }
                }
                ';
                            }
                            $check_js .= '
              if(x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
              {
                dollars=0;
                cents=0;
              
                if(jQuery("#wdform_' . $id1 . '_element_dollars' . $form_id . '").val()!="' . $w_title[0] . '" || jQuery("#wdform_' . $id1 . '_element_dollars' . $form_id . '").val())
                  dollars =jQuery("#wdform_' . $id1 . '_element_dollars' . $form_id . '").val();
                
                if(jQuery("#wdform_' . $id1 . '_element_cents' . $form_id . '").val()!="' . $w_title[1] . '" || jQuery("#wdform_' . $id1 . '_element_cents' . $form_id . '").val())
                  cents =jQuery("#wdform_' . $id1 . '_element_cents' . $form_id . '").val();

                var price=dollars+"."+cents;

                if(isNaN(price))
                {
                  alert("Invalid value of number field");
                  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_dollars' . $form_id . '").focus();
                  return false;
                }
              
                var range_min=' . ($param['w_range_min'] ? $param['w_range_min'] : 0) . ';
                var range_max=' . ($param['w_range_max'] ? $param['w_range_max'] : -1) . ';

                
                if(' . ($required ? 'true' : 'false') . ' || jQuery("#wdform_' . $id1 . '_element_dollars' . $form_id . '").val()!="' . $w_title[0] . '" || jQuery("#wdform_' . $id1 . '_element_cents' . $form_id . '").val()!="' . $w_title[1] . '")
                  if((range_max!=-1 && parseFloat(price)>range_max) || parseFloat(price)<range_min)
                  {		
                    alert("' . addslashes(__('The', 'form_maker') . $label . __('value must be between', 'form_maker') . ($param['w_range_min'] ? $param['w_range_min'] : 0) . '-' . ($param['w_range_max'] ? $param['w_range_max'] : "any")) . '");

                    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_dollars' . $form_id . '").focus();
                    return false;
                  }
              }
              ';
                            break;
                        case 'type_paypal_select':
                            $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_choices', 'w_choices_price', 'w_choices_checked', 'w_choices_disabled', 'w_required', 'w_quantity', 'w_quantity_value', 'w_class', 'w_property', 'w_property_values');
                            $temp = $params;
                            if (strpos($temp, 'w_choices_params') > -1) {
                                $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_choices', 'w_choices_price', 'w_choices_checked', 'w_choices_disabled', 'w_required', 'w_quantity', 'w_quantity_value', 'w_choices_params', 'w_class', 'w_property', 'w_property_values');
                            }
                            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_price'] = explode('***', $param['w_choices_price']);
                            $param['w_choices_checked'] = explode('***', $param['w_choices_checked']);
                            $param['w_choices_disabled'] = explode('***', $param['w_choices_disabled']);
                            $param['w_property'] = explode('***', $param['w_property']);
                            $param['w_property_values'] = explode('***', $param['w_property_values']);
                            if (isset($param['w_choices_params'])) {
                                $param['w_choices_params'] = explode('***', $param['w_choices_params']);
                            }
                            $post_value = isset($_POST['wdform_' . $id1 . "_element" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_element" . $form_id])) : NULL;
                            $rep = '<div type="type_paypal_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($param['w_choices_params']) && $param['w_choices_params'][$key]) {
                                    $choices_labels = array();
                                    $choices_values = array();
                                    $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][$key]);
                                    $where = str_replace(array('[', ']'), '', $w_choices_params[0]) ? ' WHERE ' . str_replace(array('[', ']'), '', $w_choices_params[0]) : '';
                                    $w_choices_params = explode('[db_info]', $w_choices_params[1]);
                                    $order_by = str_replace(array('[', ']'), '', $w_choices_params[0]);
                                    $db_info = str_replace(array('[', ']'), '', $w_choices_params[1]);
                                    $label_table_and_column = explode(':', str_replace(array('[', ']'), '', $choice));
                                    $table = $label_table_and_column[0];
                                    $label_column = $label_table_and_column[1];
                                    if ($label_column) {
                                        $choices_labels = $this->model->select_data_from_db_for_labels($db_info, $label_column, $table, $where, $order_by);
                                    }
                                    $value_table_and_column = explode(':', str_replace(array('[', ']'), '', $param['w_choices_price'][$key]));
                                    $value_column = $param['w_choices_disabled'][$key] == "true" ? '' : $value_table_and_column[1];
                                    if ($value_column) {
                                        $choices_values = $this->model->select_data_from_db_for_values($db_info, $value_column, $table, $where, $order_by);
                                    }
                                    $columns_count = count($choices_labels) > 0 ? count($choices_labels) : count($choices_values);
                                    for ($k = 0; $k < $columns_count; $k++) {
                                        $choice_label = isset($choices_labels[$k]) ? $choices_labels[$k] : '';
                                        $choice_value = isset($choices_values[$k]) ? (double) $choices_values[$k][0] : '';
                                        if (isset($post_value)) {
                                            if ($post_value == $choice_value && $choice_label == $_REQUEST["wdform_" . $id1 . "_element_label" . $form_id]) {
                                                $param['w_choices_checked'][$key] = 'selected="selected"';
                                            } else {
                                                $param['w_choices_checked'][$key] = '';
                                            }
                                        } else {
                                            $param['w_choices_checked'][$key] = $param['w_choices_checked'][$key] == 'true' && $k == 0 ? 'selected="selected"' : '';
                                        }
                                        $rep .= '<option value="' . $choice_value . '" ' . $param['w_choices_checked'][$key] . '>' . $choice_label[0] . '</option>';
                                    }
                                } else {
                                    $choice_value = $param['w_choices_disabled'][$key] == "true" ? '' : $param['w_choices_price'][$key];
                                    if (isset($post_value)) {
                                        if ($post_value == $choice_value && $choice == $_REQUEST["wdform_" . $id1 . "_element_label" . $form_id]) {
                                            $param['w_choices_checked'][$key] = 'selected="selected"';
                                        } else {
                                            $param['w_choices_checked'][$key] = '';
                                        }
                                    } else {
                                        if ($param['w_choices_checked'][$key] == 'true') {
                                            $param['w_choices_checked'][$key] = 'selected="selected"';
                                        } else {
                                            $param['w_choices_checked'][$key] = '';
                                        }
                                    }
                                    $rep .= '<option value="' . $choice_value . '" ' . $param['w_choices_checked'][$key] . '>' . $choice . '</option>';
                                }
                            }
                            $rep .= '</select><div id="wdform_' . $id1 . '_div' . $form_id . '">';
                            if ($param['w_quantity'] == "yes") {
                                $rep .= '<div class="paypal-property"><label class="mini_label" style="margin: 0px 5px;">' . __("Quantity", 'form_maker') . '</label><input type="text" value="' . (isset($_POST['wdform_' . $id1 . "_element_quantity" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_element_quantity" . $form_id])) : $param['w_quantity_value']) . '" id="wdform_' . $id1 . '_element_quantity' . $form_id . '" name="wdform_' . $id1 . '_element_quantity' . $form_id . '" class="wdform-quantity"></div>';
                            }
                            if ($param['w_property'][0]) {
                                foreach ($param['w_property'] as $key => $property) {
                                    $rep .= '
                  <div id="wdform_' . $id1 . '_property_' . $key . '" class="paypal-property">
                  <div style="width:150px; display:inline-block;">
                  <label class="mini_label" id="wdform_' . $id1 . '_property_label_' . $form_id . '' . $key . '" style="margin-right: 5px;">' . $property . '</label>
                  <select id="wdform_' . $id1 . '_property' . $form_id . '' . $key . '" name="wdform_' . $id1 . '_property' . $form_id . '' . $key . '" style="margin: 2px 0px;">';
                                    $param['w_property_values'][$key] = explode('###', $param['w_property_values'][$key]);
                                    $param['w_property_values'][$key] = array_slice($param['w_property_values'][$key], 1, count($param['w_property_values'][$key]));
                                    foreach ($param['w_property_values'][$key] as $subkey => $property_value) {
                                        $rep .= '<option id="wdform_' . $id1 . '_' . $key . '_option' . $subkey . '" value="' . $property_value . '" ' . (isset($_POST['wdform_' . $id1 . '_property' . $form_id . '' . $key]) && esc_html(stripslashes($_POST['wdform_' . $id1 . '_property' . $form_id . '' . $key])) == $property_value ? 'selected="selected"' : "") . '>' . $property_value . '</option>';
                                    }
                                    $rep .= '</select></div></div>';
                                }
                            }
                            $rep .= '</div></div></div>';
                            if ($required) {
                                $check_js .= '
                if(x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
                {
                  if(jQuery("#wdform_' . $id1 . '_element' . $form_id . '").val()=="")
                  {
                    alert("' . addslashes($label . ' ' . __('field is required.', '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;
                  }
                }
                ';
                            }
                            $onsubmit_js .= '
                jQuery("<input type=\\"hidden\\" name=\\"wdform_' . $id1 . '_element_label' . $form_id . '\\"  />").val(jQuery("#wdform_' . $id1 . '_element' . $form_id . ' option:selected").text()).appendTo("#form' . $form_id . '");
                ';
                            $onsubmit_js .= '
                jQuery("<input type=\\"hidden\\" name=\\"wdform_' . $id1 . '_element_quantity_label' . $form_id . '\\"  />").val("' . __("Quantity", 'form_maker') . '").appendTo("#form' . $form_id . '");
                ';
                            foreach ($param['w_property'] as $key => $property) {
                                $onsubmit_js .= '
                  jQuery("<input type=\\"hidden\\" name=\\"wdform_' . $id1 . '_element_property_label' . $form_id . $key . '\\"  />").val("' . $property . '").appendTo("#form' . $form_id . '");
                  ';
                            }
                            break;
                        case 'type_paypal_checkbox':
                            $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_flow', 'w_choices', 'w_choices_price', 'w_choices_checked', 'w_required', 'w_randomize', 'w_allow_other', 'w_allow_other_num', 'w_class', 'w_property', 'w_property_values', 'w_quantity', 'w_quantity_value');
                            $temp = $params;
                            if (strpos($temp, 'w_field_option_pos') > -1) {
                                $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_field_option_pos', 'w_flow', 'w_choices', 'w_choices_price', 'w_choices_checked', 'w_required', 'w_randomize', 'w_allow_other', 'w_allow_other_num', 'w_choices_params', 'w_class', 'w_property', 'w_property_values', 'w_quantity', 'w_quantity_value');
                            }
                            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;
                                }
                            }
                            if (!isset($param['w_field_option_pos'])) {
                                $param['w_field_option_pos'] = 'left';
                            }
                            $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;";
                            $param['w_field_option_pos1'] = $param['w_field_option_pos'] == "right" ? "style='float: none \n\t\t\t  !important;'" : "";
                            $param['w_field_option_pos2'] = $param['w_field_option_pos'] == "right" ? "style='float: left !important; margin:3px 8px 0 0 !important; display: inline-block !important;'" : "";
                            $required = $param['w_required'] == "yes" ? true : false;
                            $param['w_choices'] = explode('***', $param['w_choices']);
                            $param['w_choices_price'] = explode('***', $param['w_choices_price']);
                            $param['w_choices_checked'] = explode('***', $param['w_choices_checked']);
                            $param['w_property'] = explode('***', $param['w_property']);
                            $param['w_property_values'] = explode('***', $param['w_property_values']);
                            if (isset($param['w_choices_params'])) {
                                $param['w_choices_params'] = explode('***', $param['w_choices_params']);
                            }
                            foreach ($param['w_choices_checked'] as $key => $choices_checked) {
                                $param['w_choices_checked'][$key] = $choices_checked == 'true' ? 'checked="checked"' : '';
                            }
                            $rep = '<div type="type_paypal_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'] . ';">';
                            $total_queries = 0;
                            foreach ($param['w_choices'] as $key => $choice) {
                                $key1 = $key + $total_queries;
                                if (isset($param['w_choices_params']) && $param['w_choices_params'][$key]) {
                                    $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][$key]);
                                    $where = str_replace(array('[', ']'), '', $w_choices_params[0]) ? ' WHERE ' . str_replace(array('[', ']'), '', $w_choices_params[0]) : '';
                                    $w_choices_params = explode('[db_info]', $w_choices_params[1]);
                                    $order_by = str_replace(array('[', ']'), '', $w_choices_params[0]);
                                    $db_info = str_replace(array('[', ']'), '', $w_choices_params[1]);
                                    $label_table_and_column = explode(':', str_replace(array('[', ']'), '', $choice));
                                    $table = $label_table_and_column[0];
                                    $label_column = $label_table_and_column[1];
                                    if ($label_column) {
                                        $choices_labels = $this->model->select_data_from_db_for_labels($db_info, $label_column, $table, $where, $order_by);
                                    }
                                    $value_table_and_column = explode(':', str_replace(array('[', ']'), '', $param['w_choices_price'][$key]));
                                    $value_column = $value_table_and_column[1];
                                    if ($value_column) {
                                        $choices_values = $this->model->select_data_from_db_for_values($db_info, $value_column, $table, $where, $order_by);
                                    }
                                    $columns_count = count($choices_labels) > 0 ? count($choices_labels) : count($choices_values);
                                    if (array_filter($choices_labels) || array_filter($choices_values)) {
                                        $total_queries = $total_queries + $columns_count - 1;
                                        if (!isset($post_value)) {
                                            $param['w_choices_checked'][$key] = $param['w_choices_checked'][$key] == 'true' ? 'checked="checked"' : '';
                                        }
                                        for ($k = 0; $k < $columns_count; $k++) {
                                            $choice_label = isset($choices_labels) ? $choices_labels[$k] : '';
                                            $choice_value = isset($choices_values) ? (double) $choices_values[$k][0] : '';
                                            if (isset($post_value)) {
                                                $param['w_choices_checked'][$key] = "";
                                                $checkedvalue = $_REQUEST['wdform_' . $id1 . "_element" . $form_id . ($key1 + $k)];
                                                if (isset($checkedvalue)) {
                                                    $param['w_choices_checked'][$key] = 'checked="checked"';
                                                }
                                            }
                                            $rep .= '<div style="display: ' . ($param['w_flow'] == 'hor' ? 'inline-block' : 'table-row') . ';"><label class="wdform-ch-rad-label" for="wdform_' . $id1 . '_element' . $form_id . '' . ($key1 + $k) . '" ' . $param['w_field_option_pos1'] . '>' . $choice_label[0] . '</label><div class="checkbox-div forlabs" ' . $param['w_field_option_pos2'] . '><input type="checkbox" id="wdform_' . $id1 . '_element' . $form_id . '' . ($key1 + $k) . '" name="wdform_' . $id1 . '_element' . $form_id . '' . ($key1 + $k) . '" value="' . $choice_value . '" title="' . htmlspecialchars($choice_label[0]) . '" ' . $param['w_choices_checked'][$key] . ' ' . $param['attributes'] . '><label for="wdform_' . $id1 . '_element' . $form_id . '' . ($key1 + $k) . '"></label></div><input type="hidden" name="wdform_' . $id1 . '_element' . $form_id . ($key1 + $k) . '_label" value="' . htmlspecialchars($choice_label[0]) . '" /></div>';
                                        }
                                    }
                                } else {
                                    if (isset($post_value)) {
                                        $param['w_choices_checked'][$key] = "";
                                        $checkedvalue = $_REQUEST['wdform_' . $id1 . "_element" . $form_id . $key1];
                                        if (isset($checkedvalue)) {
                                            $param['w_choices_checked'][$key] = 'checked="checked"';
                                        }
                                    } else {
                                        $param['w_choices_checked'][$key] = $param['w_choices_checked'][$key] == 'true' ? 'checked="checked"' : '';
                                    }
                                    $rep .= '<div style="display: ' . ($param['w_flow'] == 'hor' ? 'inline-block' : 'table-row') . ';"><label class="wdform-ch-rad-label" for="wdform_' . $id1 . '_element' . $form_id . '' . $key1 . '" ' . $param['w_field_option_pos1'] . '>' . $choice . '</label><div class="checkbox-div forlabs" ' . $param['w_field_option_pos2'] . '><input type="checkbox" id="wdform_' . $id1 . '_element' . $form_id . '' . $key1 . '" name="wdform_' . $id1 . '_element' . $form_id . '' . $key1 . '" value="' . $param['w_choices_price'][$key] . '" title="' . htmlspecialchars($choice) . '" ' . $param['w_choices_checked'][$key] . ' ' . $param['attributes'] . '><label for="wdform_' . $id1 . '_element' . $form_id . '' . $key1 . '"></label></div><input type="hidden" name="wdform_' . $id1 . '_element' . $form_id . $key1 . '_label" value="' . htmlspecialchars($choice) . '" /></div>';
                                }
                            }
                            $rep .= '<div id="wdform_' . $id1 . '_div' . $form_id . '">';
                            if ($param['w_quantity'] == "yes") {
                                $rep .= '<div class="paypal-property"><label class="mini_label" style="margin: 0px 5px;">' . __("Quantity", 'form_maker') . '</label><input type="text" value="' . (isset($_POST['wdform_' . $id1 . "_element_quantity" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_element_quantity" . $form_id])) : $param['w_quantity_value']) . '" id="wdform_' . $id1 . '_element_quantity' . $form_id . '" name="wdform_' . $id1 . '_element_quantity' . $form_id . '" class="wdform-quantity"></div>';
                            }
                            if ($param['w_property'][0]) {
                                foreach ($param['w_property'] as $key => $property) {
                                    $rep .= '
                  <div class="paypal-property">
                  <div style="display:inline-block;">
                  <label class="mini_label" id="wdform_' . $id1 . '_property_label_' . $form_id . '' . $key . '" style="margin-right: 5px;">' . $property . '</label>
                  <select id="wdform_' . $id1 . '_property' . $form_id . '' . $key . '" name="wdform_' . $id1 . '_property' . $form_id . '' . $key . '" style="margin: 2px 0px;">';
                                    $param['w_property_values'][$key] = explode('###', $param['w_property_values'][$key]);
                                    $param['w_property_values'][$key] = array_slice($param['w_property_values'][$key], 1, count($param['w_property_values'][$key]));
                                    foreach ($param['w_property_values'][$key] as $subkey => $property_value) {
                                        $rep .= '<option id="wdform_' . $id1 . '_' . $key . '_option' . $subkey . '" value="' . $property_value . '" ' . (isset($_POST['wdform_' . $id1 . '_property' . $form_id . '' . $key]) && esc_html(stripslashes($_POST['wdform_' . $id1 . '_property' . $form_id . '' . $key])) == $property_value ? 'selected="selected"' : "") . '>' . $property_value . '</option>';
                                    }
                                    $rep .= '</select></div></div>';
                                }
                            }
                            $rep .= '</div></div></div>';
                            if ($required) {
                                $check_js .= '
                if(x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
                {
                  if(x.find(jQuery("div[wdid=' . $id1 . '] input:checked")).length == 0)
                  {
                    alert("' . addslashes($label . ' ' . __('field is required.', '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;
                  }						
                }
                ';
                            }
                            $onsubmit_js .= '
                jQuery("<input type=\\"hidden\\" name=\\"wdform_' . $id1 . '_element_label' . $form_id . '\\"  />").val((x.find(jQuery("div[wdid=' . $id1 . '] input:checked")).length != 0) ? jQuery("#"+x.find(jQuery("div[wdid=' . $id1 . '] input:checked")).attr("id").replace("element", "elementlabel_")) : "").appendTo("#form' . $form_id . '");
                ';
                            $onsubmit_js .= '
                jQuery("<input type=\\"hidden\\" name=\\"wdform_' . $id1 . '_element_quantity_label' . $form_id . '\\"  />").val("' . __("Quantity", 'form_maker') . '").appendTo("#form' . $form_id . '");
                ';
                            foreach ($param['w_property'] as $key => $property) {
                                $onsubmit_js .= '
                  jQuery("<input type=\\"hidden\\" name=\\"wdform_' . $id1 . '_element_property_label' . $form_id . $key . '\\"  />").val("' . $property . '").appendTo("#form' . $form_id . '");
                  ';
                            }
                            break;
                        case 'type_paypal_radio':
                            $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_flow', 'w_choices', 'w_choices_price', 'w_choices_checked', 'w_required', 'w_randomize', 'w_allow_other', 'w_allow_other_num', 'w_class', 'w_property', 'w_property_values', 'w_quantity', 'w_quantity_value');
                            $temp = $params;
                            if (strpos($temp, 'w_field_option_pos') > -1) {
                                $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_field_option_pos', 'w_flow', 'w_choices', 'w_choices_price', 'w_choices_checked', 'w_required', 'w_randomize', 'w_allow_other', 'w_allow_other_num', 'w_choices_params', 'w_class', 'w_property', 'w_property_values', 'w_quantity', 'w_quantity_value');
                            }
                            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;
                                }
                            }
                            if (!isset($param['w_field_option_pos'])) {
                                $param['w_field_option_pos'] = 'left';
                            }
                            $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;";
                            $param['w_field_option_pos1'] = $param['w_field_option_pos'] == "right" ? "style='float: none\n\t\t\t  !important;'" : "";
                            $param['w_field_option_pos2'] = $param['w_field_option_pos'] == "right" ? "style='float: left !important; margin-right: 8px !important; display: inline-block !important;'" : "";
                            $required = $param['w_required'] == "yes" ? true : false;
                            $param['w_choices'] = explode('***', $param['w_choices']);
                            $param['w_choices_price'] = explode('***', $param['w_choices_price']);
                            $param['w_choices_checked'] = explode('***', $param['w_choices_checked']);
                            $param['w_property'] = explode('***', $param['w_property']);
                            $param['w_property_values'] = explode('***', $param['w_property_values']);
                            if (isset($param['w_choices_params'])) {
                                $param['w_choices_params'] = explode('***', $param['w_choices_params']);
                            }
                            foreach ($param['w_choices_checked'] as $key => $choices_checked) {
                                $param['w_choices_checked'][$key] = $choices_checked == 'true' ? 'checked="checked"' : '';
                            }
                            $rep = '<div type="type_paypal_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'] . ';">';
                            $total_queries = 0;
                            foreach ($param['w_choices'] as $key => $choice) {
                                $key1 = $key + $total_queries;
                                if (isset($param['w_choices_params']) && $param['w_choices_params'][$key]) {
                                    $choices_labels = array();
                                    $choices_values = array();
                                    $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][$key]);
                                    $where = str_replace(array('[', ']'), '', $w_choices_params[0]) ? ' WHERE ' . str_replace(array('[', ']'), '', $w_choices_params[0]) : '';
                                    $w_choices_params = explode('[db_info]', $w_choices_params[1]);
                                    $order_by = str_replace(array('[', ']'), '', $w_choices_params[0]);
                                    $db_info = str_replace(array('[', ']'), '', $w_choices_params[1]);
                                    $label_table_and_column = explode(':', str_replace(array('[', ']'), '', $choice));
                                    $table = $label_table_and_column[0];
                                    $label_column = $label_table_and_column[1];
                                    if ($label_column) {
                                        $choices_labels = $this->model->select_data_from_db_for_labels($db_info, $label_column, $table, $where, $order_by);
                                    }
                                    $value_table_and_column = explode(':', str_replace(array('[', ']'), '', $param['w_choices_price'][$key]));
                                    $value_column = $value_table_and_column[1];
                                    if ($value_column) {
                                        $choices_values = $this->model->select_data_from_db_for_values($db_info, $value_column, $table, $where, $order_by);
                                    }
                                    $columns_count_radio = count($choices_labels) > 0 ? count($choices_labels) : count($choices_values);
                                    if (array_filter($choices_labels) || array_filter($choices_values)) {
                                        $total_queries = $total_queries + $columns_count_radio - 1;
                                        for ($k = 0; $k < $columns_count_radio; $k++) {
                                            $choice_label = isset($choices_labels) ? $choices_labels[$k] : '';
                                            $choice_value = isset($choices_values) ? (double) $choices_values[$k][0] : '';
                                            if (isset($post_value)) {
                                                $param['w_choices_checked'][$key] = $post_value == $choice_value && htmlspecialchars($choice_label) == htmlspecialchars($_REQUEST['wdform_' . $id1 . "_element_label" . $form_id]) ? 'checked="checked"' : '';
                                            } else {
                                                $param['w_choices_checked'][$key] = $param['w_choices_checked'][$key] == 'true' ? 'checked="checked"' : '';
                                            }
                                            $rep .= '<div style="display: ' . ($param['w_flow'] == 'hor' ? 'inline-block' : 'table-row') . ';"><label class="wdform-ch-rad-label" for="wdform_' . $id1 . '_element' . $form_id . '' . ($key1 + $k) . '" ' . $param['w_field_option_pos1'] . '>' . $choice_label[0] . '</label><div class="radio-div forlabs" ' . $param['w_field_option_pos2'] . '><input type="radio" id="wdform_' . $id1 . '_element' . $form_id . '' . ($key1 + $k) . '" name="wdform_' . $id1 . '_element' . $form_id . '" value="' . $choice_value . '" title="' . htmlspecialchars($choice_label[0]) . '" ' . $param['w_choices_checked'][$key] . ' ' . $param['attributes'] . '><label for="wdform_' . $id1 . '_element' . $form_id . '' . ($key1 + $k) . '"></label></div></div>';
                                        }
                                    }
                                } else {
                                    if (isset($post_value)) {
                                        $param['w_choices_checked'][$key] = $post_value == $param['w_choices_price'][$key] && htmlspecialchars($choice) == htmlspecialchars($_REQUEST['wdform_' . $id1 . "_element_label" . $form_id]) ? 'checked="checked"' : '';
                                    } else {
                                        $param['w_choices_checked'][$key] = $param['w_choices_checked'][$key] == 'true' ? 'checked="checked"' : '';
                                    }
                                    $rep .= '<div style="display: ' . ($param['w_flow'] == 'hor' ? 'inline-block' : 'table-row') . ';"><label class="wdform-ch-rad-label" for="wdform_' . $id1 . '_element' . $form_id . '' . $key1 . '" ' . $param['w_field_option_pos1'] . '>' . $choice . '</label><div class="radio-div forlabs" ' . $param['w_field_option_pos2'] . '><input type="radio" id="wdform_' . $id1 . '_element' . $form_id . '' . $key1 . '" name="wdform_' . $id1 . '_element' . $form_id . '" value="' . $param['w_choices_price'][$key] . '" title="' . htmlspecialchars($choice) . '" ' . $param['w_choices_checked'][$key] . ' ' . $param['attributes'] . '><label for="wdform_' . $id1 . '_element' . $form_id . '' . $key1 . '"></label></div></div>';
                                }
                            }
                            $rep .= '<div id="wdform_' . $id1 . '_div' . $form_id . '">';
                            if ($param['w_quantity'] == "yes") {
                                $rep .= '<div class="paypal-property"><label class="mini_label" style="margin: 0px 5px;">' . __("Quantity", 'form_maker') . '</label><input type="text" value="' . (isset($_POST['wdform_' . $id1 . "_element_quantity" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_element_quantity" . $form_id])) : $param['w_quantity_value']) . '" id="wdform_' . $id1 . '_element_quantity' . $form_id . '" name="wdform_' . $id1 . '_element_quantity' . $form_id . '" class="wdform-quantity"></div>';
                            }
                            if ($param['w_property'][0]) {
                                foreach ($param['w_property'] as $key => $property) {
                                    $rep .= '
                  <div class="paypal-property">
                  <div style="width:150px; display:inline-block;">
                  <label class="mini_label" id="wdform_' . $id1 . '_property_label_' . $form_id . '' . $key . '" style="margin-right: 5px;">' . $property . '</label>
                  <select id="wdform_' . $id1 . '_property' . $form_id . '' . $key . '" name="wdform_' . $id1 . '_property' . $form_id . '' . $key . '" style="margin: 2px 0px;">';
                                    $param['w_property_values'][$key] = explode('###', $param['w_property_values'][$key]);
                                    $param['w_property_values'][$key] = array_slice($param['w_property_values'][$key], 1, count($param['w_property_values'][$key]));
                                    foreach ($param['w_property_values'][$key] as $subkey => $property_value) {
                                        $rep .= '<option id="wdform_' . $id1 . '_' . $key . '_option' . $subkey . '" value="' . $property_value . '" ' . (isset($_POST['wdform_' . $id1 . '_property' . $form_id . '' . $key]) && esc_html(stripslashes($_POST['wdform_' . $id1 . '_property' . $form_id . '' . $key])) == $property_value ? 'selected="selected"' : "") . '>' . $property_value . '</option>';
                                    }
                                    $rep .= '</select></div></div>';
                                }
                            }
                            $rep .= '</div></div></div>';
                            if ($required) {
                                $check_js .= '
                if(x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
                {
                  if(x.find(jQuery("div[wdid=' . $id1 . '] input:checked")).length == 0)
                  {
                    alert("' . addslashes($label . ' ' . __('field is required.', '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;
                  }						
                }
                ';
                            }
                            $onsubmit_js .= '
                jQuery("<input type=\\"hidden\\" name=\\"wdform_' . $id1 . '_element_label' . $form_id . '\\" />").val(
                jQuery("label[for=\'"+jQuery("input[name^=\'wdform_' . $id1 . '_element' . $form_id . '\']:checked").attr("id")+"\']").eq(0).text()
                ).appendTo("#form' . $form_id . '");

                ';
                            $onsubmit_js .= '
                jQuery("<input type=\\"hidden\\" name=\\"wdform_' . $id1 . '_element_quantity_label' . $form_id . '\\"  />").val("' . __("Quantity", 'form_maker') . '").appendTo("#form' . $form_id . '");
                ';
                            foreach ($param['w_property'] as $key => $property) {
                                $onsubmit_js .= '
                  jQuery("<input type=\\"hidden\\" name=\\"wdform_' . $id1 . '_element_property_label' . $form_id . $key . '\\"  />").val("' . $property . '").appendTo("#form' . $form_id . '");
                  ';
                            }
                            break;
                        case 'type_paypal_shipping':
                            $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_flow', 'w_choices', 'w_choices_price', 'w_choices_checked', 'w_required', 'w_randomize', 'w_allow_other', 'w_allow_other_num', 'w_class');
                            $temp = $params;
                            if (strpos($temp, 'w_field_option_pos') > -1) {
                                $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_field_option_pos', 'w_flow', 'w_choices', 'w_choices_price', 'w_choices_checked', 'w_required', 'w_randomize', 'w_allow_other', 'w_allow_other_num', 'w_choices_params', 'w_class');
                            }
                            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;
                                }
                            }
                            if (!isset($param['w_field_option_pos'])) {
                                $param['w_field_option_pos'] = 'left';
                            }
                            $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;";
                            $param['w_field_option_pos1'] = $param['w_field_option_pos'] == "right" ? "style='float: none\n\t\t\t  !important;'" : "";
                            $param['w_field_option_pos2'] = $param['w_field_option_pos'] == "right" ? "style='float: left !important; margin:3px 8px 0 0 !important; display: inline-block !important;'" : "";
                            $required = $param['w_required'] == "yes" ? true : false;
                            $param['w_choices'] = explode('***', $param['w_choices']);
                            $param['w_choices_price'] = explode('***', $param['w_choices_price']);
                            $param['w_choices_checked'] = explode('***', $param['w_choices_checked']);
                            if (isset($param['w_choices_params'])) {
                                $param['w_choices_params'] = explode('***', $param['w_choices_params']);
                            }
                            foreach ($param['w_choices_checked'] as $key => $choices_checked) {
                                $param['w_choices_checked'][$key] = $choices_checked == 'true' ? 'checked="checked"' : '';
                            }
                            $rep = '<div type="type_paypal_shipping" 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'] . ';">';
                            $total_queries = 0;
                            foreach ($param['w_choices'] as $key => $choice) {
                                $key1 = $key + $total_queries;
                                if (isset($param['w_choices_params']) && $param['w_choices_params'][$key]) {
                                    $choices_labels = array();
                                    $choices_values = array();
                                    $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][$key]);
                                    $where = str_replace(array('[', ']'), '', $w_choices_params[0]) ? ' WHERE ' . str_replace(array('[', ']'), '', $w_choices_params[0]) : '';
                                    $w_choices_params = explode('[db_info]', $w_choices_params[1]);
                                    $order_by = str_replace(array('[', ']'), '', $w_choices_params[0]);
                                    $db_info = str_replace(array('[', ']'), '', $w_choices_params[1]);
                                    $label_table_and_column = explode(':', str_replace(array('[', ']'), '', $choice));
                                    $table = $label_table_and_column[0];
                                    $label_column = $label_table_and_column[1];
                                    if ($label_column) {
                                        $choices_labels = $this->model->select_data_from_db_for_labels($db_info, $label_column, $table, $where, $order_by);
                                    }
                                    $value_table_and_column = explode(':', str_replace(array('[', ']'), '', $param['w_choices_price'][$key]));
                                    $value_column = $value_table_and_column[1];
                                    if ($value_column) {
                                        $choices_values = $this->model->select_data_from_db_for_values($db_info, $value_column, $table, $where, $order_by);
                                    }
                                    $columns_count_shipping = count($choices_labels) > 0 ? count($choices_labels) : count($choices_values);
                                    if (array_filter($choices_labels) || array_filter($choices_values)) {
                                        $total_queries = $total_queries + $columns_count_shipping - 1;
                                        for ($k = 0; $k < $columns_count_shipping; $k++) {
                                            $choice_label = isset($choices_labels) ? $choices_labels[$k][0] : '';
                                            $choice_value = isset($choices_values) ? (double) $choices_values[$k][0] : '';
                                            if (isset($post_value)) {
                                                $param['w_choices_checked'][$key] = $post_value == $choice_value && htmlspecialchars($choice_label) == htmlspecialchars($_REQUEST['wdform_' . $id1 . "_element_label" . $form_id]) ? 'checked="checked"' : '';
                                            } else {
                                                $param['w_choices_checked'][$key] = $param['w_choices_checked'][$key] == 'true' ? 'checked="checked"' : '';
                                            }
                                            $rep .= '<div style="display: ' . ($param['w_flow'] == 'hor' ? 'inline-block' : 'table-row') . ';"><label class="wdform-ch-rad-label" for="wdform_' . $id1 . '_element' . $form_id . '' . ($key1 + $k) . '" ' . $param['w_field_option_pos1'] . '>' . $choice_label . '</label><div class="radio-div forlabs" ' . $param['w_field_option_pos2'] . '><input type="radio" id="wdform_' . $id1 . '_element' . $form_id . '' . ($key1 + $k) . '" name="wdform_' . $id1 . '_element' . $form_id . '" value="' . $choice_value . '" title="' . htmlspecialchars($choice_label[0]) . '" ' . $param['w_choices_checked'][$key] . ' ' . $param['attributes'] . '><label for="wdform_' . $id1 . '_element' . $form_id . '' . ($key1 + $k) . '"></label></div></div>';
                                        }
                                    }
                                } else {
                                    if (isset($post_value)) {
                                        $param['w_choices_checked'][$key] = $post_value == $param['w_choices_price'][$key] && htmlspecialchars($choice) == htmlspecialchars($_REQUEST['wdform_' . $id1 . "_element_label" . $form_id]) ? 'checked="checked"' : '';
                                    } else {
                                        $param['w_choices_checked'][$key] = $param['w_choices_checked'][$key] == 'true' ? 'checked="checked"' : '';
                                    }
                                    $rep .= '<div style="display: ' . ($param['w_flow'] == 'hor' ? 'inline-block' : 'table-row') . ';"><label class="wdform-ch-rad-label" for="wdform_' . $id1 . '_element' . $form_id . '' . $key1 . '" ' . $param['w_field_option_pos1'] . '>' . $choice . '</label><div class="radio-div forlabs" ' . $param['w_field_option_pos2'] . '><input type="radio" id="wdform_' . $id1 . '_element' . $form_id . '' . $key1 . '" name="wdform_' . $id1 . '_element' . $form_id . '" value="' . $param['w_choices_price'][$key] . '" title="' . htmlspecialchars($choice) . '" ' . $param['w_choices_checked'][$key] . ' ' . $param['attributes'] . '><label for="wdform_' . $id1 . '_element' . $form_id . '' . $key1 . '"></label></div></div>';
                                }
                            }
                            $rep .= '</div></div>';
                            if ($required) {
                                $check_js .= '
                if(x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
                {
                  if(x.find(jQuery("div[wdid=' . $id1 . '] input:checked")).length == 0)
                  {
                    alert("' . addslashes($label . ' ' . __('field is required.', '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;
                  }						
                }
                ';
                            }
                            $onsubmit_js .= '
                jQuery("<input type=\\"hidden\\" name=\\"wdform_' . $id1 . '_element_label' . $form_id . '\\" />").val(
                jQuery("label[for=\'"+jQuery("input[name^=\'wdform_' . $id1 . '_element' . $form_id . '\']:checked").attr("id")+"\']").eq(0).text()
                ).appendTo("#form' . $form_id . '");
                ';
                            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;
                        case 'type_button':
                            $params_names = array('w_title', 'w_func', '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_title'] = explode('***', $param['w_title']);
                            $param['w_func'] = explode('***', $param['w_func']);
                            $rep .= '<div type="type_button" class="wdform-field"><div class="wdform-label-section" style="display: table-cell;"><span style="display: none;">button_' . $id1 . '</span></div><div class="wdform-element-section ' . $param['w_class'] . '" style="display: table-cell;">';
                            foreach ($param['w_title'] as $key => $title) {
                                $rep .= '<button type="button" name="wdform_' . $id1 . '_element' . $form_id . '' . $key . '" onclick="' . $param['w_func'][$key] . '" ' . $param['attributes'] . '>' . $title . '</button>';
                            }
                            $rep .= '</div></div>';
                            break;
                        case 'type_star_rating':
                            $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_field_label_col', 'w_star_amount', '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;
                                }
                            }
                            $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;
                            $images = '';
                            for ($i = 0; $i < $param['w_star_amount']; $i++) {
                                $images .= '<img id="wdform_' . $id1 . '_star_' . $i . '_' . $form_id . '" src="' . WD_FM_URL . '/images/star.png" >';
                                $onload_js .= 'jQuery("#wdform_' . $id1 . '_star_' . $i . '_' . $form_id . '").mouseover(function() {change_src(' . $i . ',"wdform_' . $id1 . '", ' . $form_id . ', "' . $param['w_field_label_col'] . '");});';
                                $onload_js .= 'jQuery("#wdform_' . $id1 . '_star_' . $i . '_' . $form_id . '").mouseout(function() {reset_src(' . $i . ',"wdform_' . $id1 . '", ' . $form_id . ');});';
                                $onload_js .= 'jQuery("#wdform_' . $id1 . '_star_' . $i . '_' . $form_id . '").click(function() {select_star_rating(' . $i . ',"wdform_' . $id1 . '", ' . $form_id . ',"' . $param['w_field_label_col'] . '", "' . $param['w_star_amount'] . '");});';
                            }
                            $rep = '<div type="type_star_rating" class="wdform-field"><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'] . '"><div id="wdform_' . $id1 . '_element' . $form_id . '" ' . $param['attributes'] . '>' . $images . '</div><input type="hidden" value="" id="wdform_' . $id1 . '_selected_star_amount' . $form_id . '" name="wdform_' . $id1 . '_selected_star_amount' . $form_id . '"></div></div>';
                            if ($required) {
                                $check_js .= '
                if(x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
                {
                  if(jQuery("#wdform_' . $id1 . '_selected_star_amount' . $form_id . '").val()=="")
                  {
                    alert("' . addslashes($label . ' ' . __('field is required.', '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;
                  }
                }
                ';
                            }
                            $post = isset($_POST['wdform_' . $id1 . '_selected_star_amount' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_selected_star_amount' . $form_id])) : NULL;
                            if (isset($post)) {
                                $onload_js .= ' select_star_rating(' . ($post - 1) . ',"wdform_' . $id1 . '", ' . $form_id . ',"' . $param['w_field_label_col'] . '", "' . $param['w_star_amount'] . '");';
                            }
                            $onsubmit_js .= '
                jQuery("<input type=\\"hidden\\" name=\\"wdform_' . $id1 . '_star_amount' . $form_id . '\\" value = \\"' . $param['w_star_amount'] . '\\" />").appendTo("#form' . $form_id . '");
                ';
                            break;
                        case 'type_scale_rating':
                            $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_mini_labels', 'w_scale_amount', '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;
                                }
                            }
                            $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']);
                            $numbers = '';
                            $radio_buttons = '';
                            $to_check = 0;
                            $post_value = isset($_POST['wdform_' . $id1 . '_scale_radio' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_scale_radio' . $form_id])) : NULL;
                            if (isset($post_value)) {
                                $to_check = $post_value;
                            }
                            for ($i = 1; $i <= $param['w_scale_amount']; $i++) {
                                $numbers .= '<div  style="text-align: center; display: table-cell;"><span>' . $i . '</span></div>';
                                $radio_buttons .= '<div style="text-align: center; display: table-cell;"><div class="radio-div"><input id="wdform_' . $id1 . '_scale_radio' . $form_id . '_' . $i . '" name="wdform_' . $id1 . '_scale_radio' . $form_id . '" value="' . $i . '" type="radio" ' . ($to_check == $i ? 'checked="checked"' : '') . '><label for="wdform_' . $id1 . '_scale_radio' . $form_id . '_' . $i . '"></label></div></div>';
                            }
                            $rep = '<div type="type_scale_rating" class="wdform-field"><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'] . '"><div id="wdform_' . $id1 . '_element' . $form_id . '" style="float: left;" ' . $param['attributes'] . '><label class="mini_label">' . $w_mini_labels[0] . '</label><div  style="display: inline-table; vertical-align: middle;border-spacing: 7px;"><div style="display: table-row;">' . $numbers . '</div><div style="display: table-row;">' . $radio_buttons . '</div></div><label class="mini_label" >' . $w_mini_labels[1] . '</label></div></div></div>';
                            if ($required) {
                                $check_js .= '
                if(x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
                {
                  if(x.find(jQuery("div[wdid=' . $id1 . '] input:checked")).length == 0)
                  {
                    alert("' . addslashes($label . ' ' . __('field is required.', '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;
                  }						
                }
                ';
                            }
                            $onsubmit_js .= '
                jQuery("<input type=\\"hidden\\" name=\\"wdform_' . $id1 . '_scale_amount' . $form_id . '\\" value = \\"' . $param['w_scale_amount'] . '\\" />").appendTo("#form' . $form_id . '");
                ';
                            break;
                        case 'type_spinner':
                            $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_field_width', 'w_field_min_value', 'w_field_max_value', 'w_field_step', 'w_field_value', '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;
                                }
                            }
                            $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_field_value'] = isset($_POST['wdform_' . $id1 . '_element' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element' . $form_id])) : $param['w_field_value'];
                            $rep = '<div type="type_spinner" class="wdform-field"><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'] . '"><input type="text" value="' . ($param['w_field_value'] != 'null' ? $param['w_field_value'] : '') . '" name="wdform_' . $id1 . '_element' . $form_id . '" id="wdform_' . $id1 . '_element' . $form_id . '" style="width: ' . $param['w_field_width'] . 'px;" ' . $param['attributes'] . '></div></div>';
                            $onload_js .= '
                jQuery("#form' . $form_id . ' #wdform_' . $id1 . '_element' . $form_id . '")[0].spin = null;
                spinner = jQuery("#form' . $form_id . ' #wdform_' . $id1 . '_element' . $form_id . '").spinner();
                spinner.spinner( "value", "' . ($param['w_field_value'] != 'null' ? $param['w_field_value'] : '') . '");
                jQuery("#form' . $form_id . ' #wdform_' . $id1 . '_element' . $form_id . '").spinner({ min: "' . $param['w_field_min_value'] . '"});    
                jQuery("#form' . $form_id . ' #wdform_' . $id1 . '_element' . $form_id . '").spinner({ max: "' . $param['w_field_max_value'] . '"});
                jQuery("#form' . $form_id . ' #wdform_' . $id1 . '_element' . $form_id . '").spinner({ step: "' . $param['w_field_step'] . '"});
              ';
                            if ($required) {
                                $check_js .= '
                if(x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
                {
                  if(jQuery("#wdform_' . $id1 . '_element' . $form_id . '").val()=="")
                  {
                    alert("' . addslashes($label . ' ' . __('field is required.', '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_slider':
                            $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_field_width', 'w_field_min_value', 'w_field_max_value', 'w_field_value', '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;
                                }
                            }
                            $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_field_value'] = isset($_POST['wdform_' . $id1 . '_slider_value' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_slider_value' . $form_id])) : $param['w_field_value'];
                            $rep = '<div type="type_slider" class="wdform-field"><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'] . '"><input type="hidden" value="' . $param['w_field_value'] . '" id="wdform_' . $id1 . '_slider_value' . $form_id . '" name="wdform_' . $id1 . '_slider_value' . $form_id . '"><div name="' . $id1 . '_element' . $form_id . '" id="wdform_' . $id1 . '_element' . $form_id . '" style="width: ' . $param['w_field_width'] . 'px;" ' . $param['attributes'] . '"></div><div align="left" style="display: inline-block; width: 33.3%; text-align: left;"><span id="wdform_' . $id1 . '_element_min' . $form_id . '" class="label">' . $param['w_field_min_value'] . '</span></div><div align="right" style="display: inline-block; width: 33.3%; text-align: center;"><span id="wdform_' . $id1 . '_element_value' . $form_id . '" class="label">' . $param['w_field_value'] . '</span></div><div align="right" style="display: inline-block; width: 33.3%; text-align: right;"><span id="wdform_' . $id1 . '_element_max' . $form_id . '" class="label">' . $param['w_field_max_value'] . '</span></div></div></div>';
                            $onload_js .= '
                jQuery("#wdform_' . $id1 . '_element' . $form_id . '")[0].slide = null;
                jQuery("#wdform_' . $id1 . '_element' . $form_id . '").slider({
                  range: "min",
                  value: eval(' . $param['w_field_value'] . '),
                  min: eval(' . $param['w_field_min_value'] . '),
                  max: eval(' . $param['w_field_max_value'] . '),
                  slide: function( event, ui ) {	
                  
                    jQuery("#wdform_' . $id1 . '_element_value' . $form_id . '").html("" + ui.value)
                    jQuery("#wdform_' . $id1 . '_slider_value' . $form_id . '").val("" + ui.value)

                  }
                  });
              ';
                            if ($required) {
                                $check_js .= '
                if(x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
                {
                  if(jQuery("#wdform_' . $id1 . '_slider_value' . $form_id . '").val()==' . $param['w_field_min_value'] . ')
                  {
                    alert("' . addslashes($label . ' ' . __('field is required.', '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_range':
                            $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_field_range_width', 'w_field_range_step', 'w_field_value1', 'w_field_value2', 'w_mini_labels', '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;
                                }
                            }
                            $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_field_value1'] = isset($_POST['wdform_' . $id1 . '_element' . $form_id . '0']) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element' . $form_id . '0'])) : $param['w_field_value1'];
                            $param['w_field_value2'] = isset($_POST['wdform_' . $id1 . '_element' . $form_id . '1']) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element' . $form_id . '1'])) : $param['w_field_value2'];
                            $w_mini_labels = explode('***', $param['w_mini_labels']);
                            $rep = '<div type="type_range" class="wdform-field"><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'] . '"><div style="display: table;"><div style="display: table-row;"><div valign="middle" align="left" style="display: table-cell;"><input type="text" value="' . ($param['w_field_value1'] != 'null' ? $param['w_field_value1'] : '') . '" name="wdform_' . $id1 . '_element' . $form_id . '0" id="wdform_' . $id1 . '_element' . $form_id . '0" style="width: ' . $param['w_field_range_width'] . 'px;"  ' . $param['attributes'] . '></div><div valign="middle" align="left" style="display: table-cell; padding-left: 4px;"><input type="text" value="' . ($param['w_field_value2'] != 'null' ? $param['w_field_value2'] : '') . '" name="wdform_' . $id1 . '_element' . $form_id . '1" id="wdform_' . $id1 . '_element' . $form_id . '1" style="width: ' . $param['w_field_range_width'] . 'px;" ' . $param['attributes'] . '></div></div><div style="display: table-row;"><div valign="top" align="left" style="display: table-cell;"><label class="mini_label" id="wdform_' . $id1 . '_mini_label_from">' . $w_mini_labels[0] . '</label></div><div valign="top" align="left" style="display: table-cell;"><label class="mini_label" id="wdform_' . $id1 . '_mini_label_to">' . $w_mini_labels[1] . '</label></div></div></div></div></div>';
                            $onload_js .= '
                jQuery("#form' . $form_id . ' #wdform_' . $id1 . '_element' . $form_id . '0")[0].spin = null;
                jQuery("#form' . $form_id . ' #wdform_' . $id1 . '_element' . $form_id . '1")[0].spin = null;
                
                spinner0 = jQuery("#form' . $form_id . ' #wdform_' . $id1 . '_element' . $form_id . '0").spinner();
                spinner0.spinner( "value", "' . ($param['w_field_value1'] != 'null' ? $param['w_field_value1'] : '') . '");
                jQuery("#form' . $form_id . ' #wdform_' . $id1 . '_element' . $form_id . '").spinner({ step: ' . $param['w_field_range_step'] . '});
                
                spinner1 = jQuery("#form' . $form_id . ' #wdform_' . $id1 . '_element' . $form_id . '1").spinner();
                spinner1.spinner( "value", "' . ($param['w_field_value2'] != 'null' ? $param['w_field_value2'] : '') . '");
                jQuery("#form' . $form_id . ' #wdform_' . $id1 . '_element' . $form_id . '").spinner({ step: ' . $param['w_field_range_step'] . '});
              ';
                            if ($required) {
                                $check_js .= '
                if(x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
                {
                  if(jQuery("#wdform_' . $id1 . '_element' . $form_id . '0").val()=="" || jQuery("#wdform_' . $id1 . '_element' . $form_id . '1").val()=="")
                  {
                    alert("' . addslashes($label . ' ' . __('field is required.', '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 . '0").focus();
                    return false;
                  }
                }
                ';
                            }
                            break;
                        case 'type_grading':
                            $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_items', 'w_total', '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;
                                }
                            }
                            $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_items = explode('***', $param['w_items']);
                            $required_check = 'true';
                            $w_items_labels = implode(':', $w_items);
                            $grading_items = '';
                            for ($i = 0; $i < count($w_items); $i++) {
                                $value = isset($_POST['wdform_' . $id1 . '_element' . $form_id . '_' . $i]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element' . $form_id . '_' . $i])) : '';
                                $grading_items .= '<div class="wdform_grading"><input type="text" id="wdform_' . $id1 . '_element' . $form_id . '_' . $i . '" name="wdform_' . $id1 . '_element' . $form_id . '_' . $i . '"  value="' . $value . '" ' . $param['attributes'] . '><label class="wdform-ch-rad-label" for="wdform_' . $id1 . '_element' . $form_id . '_' . $i . '">' . $w_items[$i] . '</label></div>';
                                $required_check .= ' && jQuery("#wdform_' . $id1 . '_element' . $form_id . '_' . $i . '").val()==""';
                            }
                            $rep = '<div type="type_grading" class="wdform-field"><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'] . '"><input type="hidden" value="' . $param['w_total'] . '" name="wdform_' . $id1 . '_grading_total' . $form_id . '" id="wdform_' . $id1 . '_grading_total' . $form_id . '"><div id="wdform_' . $id1 . '_element' . $form_id . '">' . $grading_items . '<div id="wdform_' . $id1 . '_element_total_div' . $form_id . '" class="grading_div">Total: <span id="wdform_' . $id1 . '_sum_element' . $form_id . '">0</span>/<span id="wdform_' . $id1 . '_total_element' . $form_id . '">' . $param['w_total'] . '</span><span id="wdform_' . $id1 . '_text_element' . $form_id . '"></span></div></div></div></div>';
                            $onload_js .= '
              jQuery("#wdform_' . $id1 . '_element' . $form_id . ' input").change(function() {sum_grading_values("wdform_' . $id1 . '",' . $form_id . ');});';
                            $onload_js .= '
              jQuery("#wdform_' . $id1 . '_element' . $form_id . ' input").keyup(function() {sum_grading_values("wdform_' . $id1 . '",' . $form_id . ');});';
                            $onload_js .= '
              jQuery("#wdform_' . $id1 . '_element' . $form_id . ' input").keyup(function() {sum_grading_values("wdform_' . $id1 . '",' . $form_id . ');});';
                            $onload_js .= '
              sum_grading_values("wdform_' . $id1 . '",' . $form_id . ');';
                            if ($required) {
                                $check_js .= '
                if(x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
                {
                  if(' . $required_check . ')
                  {
                    alert("' . addslashes($label . ' ' . __('field is required.', '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 . '0").focus();
                    return false;
                  }
                }
                ';
                            }
                            $check_js .= '
              if(x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
              {
                if(parseInt(jQuery("#wdform_' . $id1 . '_sum_element' . $form_id . '").html()) > ' . $param['w_total'] . ')
                {
                  alert("' . addslashes(__("Your score should be less than", 'form_maker')) . $param['w_total'] . '");
                  return false;
                }
              }
              ';
                            $onsubmit_js .= '
                jQuery("<input type=\\"hidden\\" name=\\"wdform_' . $id1 . '_hidden_item' . $form_id . '\\" value = \\"' . $w_items_labels . ':' . $param['w_total'] . '\\" />").appendTo("#form' . $form_id . '");
                ';
                            break;
                        case 'type_matrix':
                            $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_field_input_type', 'w_rows', 'w_columns', 'w_required', 'w_class', 'w_textbox_size');
                            $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_textbox_size'] = isset($param['w_textbox_size']) ? $param['w_textbox_size'] : '120';
                            $w_rows = explode('***', $param['w_rows']);
                            $w_columns = explode('***', $param['w_columns']);
                            $column_labels = '';
                            for ($i = 1; $i < count($w_columns); $i++) {
                                $column_labels .= '<div><label class="wdform-ch-rad-label">' . $w_columns[$i] . '</label></div>';
                            }
                            $rows_columns = '';
                            for ($i = 1; $i < count($w_rows); $i++) {
                                $rows_columns .= '<div class="wdform-matrix-row' . $i % 2 . '" row="' . $i . '"><div class="wdform-matrix-column"><label class="wdform-ch-rad-label" >' . $w_rows[$i] . '</label></div>';
                                for ($k = 1; $k < count($w_columns); $k++) {
                                    $rows_columns .= '<div class="wdform-matrix-cell">';
                                    if ($param['w_field_input_type'] == 'radio') {
                                        $to_check = 0;
                                        $post_value = isset($_POST['wdform_' . $id1 . '_input_element' . $form_id . '' . $i]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_input_element' . $form_id . '' . $i])) : NULL;
                                        if (isset($post_value)) {
                                            $to_check = $post_value;
                                        }
                                        $rows_columns .= '<div class="radio-div"><input id="wdform_' . $id1 . '_input_element' . $form_id . '' . $i . '_' . $k . '"  type="radio" name="wdform_' . $id1 . '_input_element' . $form_id . '' . $i . '" value="' . $i . '_' . $k . '" ' . ($to_check == $i . '_' . $k ? 'checked="checked"' : '') . '><label for="wdform_' . $id1 . '_input_element' . $form_id . '' . $i . '_' . $k . '"></label></div>';
                                    } else {
                                        if ($param['w_field_input_type'] == 'checkbox') {
                                            $to_check = 0;
                                            $post_value = isset($_POST['wdform_' . $id1 . '_input_element' . $form_id . '' . $i . '_' . $k]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_input_element' . $form_id . '' . $i . '_' . $k])) : NULL;
                                            if (isset($post_value)) {
                                                $to_check = $post_value;
                                            }
                                            $rows_columns .= '<div class="checkbox-div"><input id="wdform_' . $id1 . '_input_element' . $form_id . '' . $i . '_' . $k . '" type="checkbox" name="wdform_' . $id1 . '_input_element' . $form_id . '' . $i . '_' . $k . '" value="1" ' . ($to_check == "1" ? 'checked="checked"' : '') . '><label for="wdform_' . $id1 . '_input_element' . $form_id . '' . $i . '_' . $k . '"></label></div>';
                                        } else {
                                            if ($param['w_field_input_type'] == 'text') {
                                                $rows_columns .= '<input id="wdform_' . $id1 . '_input_element' . $form_id . '' . $i . '_' . $k . '" type="text" name="wdform_' . $id1 . '_input_element' . $form_id . '' . $i . '_' . $k . '" value="' . (isset($_POST['wdform_' . $id1 . '_input_element' . $form_id . '' . $i . '_' . $k]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_input_element' . $form_id . '' . $i . '_' . $k])) : "") . '" style="width:' . $param['w_textbox_size'] . 'px">';
                                            } else {
                                                if ($param['w_field_input_type'] == 'select') {
                                                    $rows_columns .= '<select id="wdform_' . $id1 . '_select_yes_no' . $form_id . '' . $i . '_' . $k . '" name="wdform_' . $id1 . '_select_yes_no' . $form_id . '' . $i . '_' . $k . '" ><option value="" ' . (isset($_POST['wdform_' . $id1 . '_select_yes_no' . $form_id . '' . $i . '_' . $k]) && esc_html($_POST['wdform_' . $id1 . '_select_yes_no' . $form_id . '' . $i . '_' . $k]) == "" ? "selected=\"selected\"" : "") . '> </option><option value="yes" ' . (isset($_POST['wdform_' . $id1 . '_select_yes_no' . $form_id . '' . $i . '_' . $k]) && esc_html($_POST['wdform_' . $id1 . '_select_yes_no' . $form_id . '' . $i . '_' . $k]) == "yes" ? "selected=\"selected\"" : "") . '>Yes</option><option value="no" ' . (isset($_POST['wdform_' . $id1 . '_select_yes_no' . $form_id . '' . $i . '_' . $k]) && esc_html($_POST['wdform_' . $id1 . '_select_yes_no' . $form_id . '' . $i . '_' . $k]) == "no" ? "selected=\"selected\"" : "") . '>No</option></select>';
                                                }
                                            }
                                        }
                                    }
                                    $rows_columns .= '</div>';
                                }
                                $rows_columns .= '</div>';
                            }
                            $rep = '<div type="type_matrix" class="wdform-field"><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'] . '"><div id="wdform_' . $id1 . '_element' . $form_id . '" class="wdform-matrix-table" ' . $param['attributes'] . '><div style="display: table-row-group;"><div class="wdform-matrix-head"><div style="display: table-cell;"></div>' . $column_labels . '</div>' . $rows_columns . '</div></div></div></div>';
                            $onsubmit_js .= '
                jQuery("<input type=\\"hidden\\" name=\\"wdform_' . $id1 . '_input_type' . $form_id . '\\" value = \\"' . $param['w_field_input_type'] . '\\" /><input type=\\"hidden\\" name=\\"wdform_' . $id1 . '_hidden_row' . $form_id . '\\" value = \\"' . addslashes($param['w_rows']) . '\\" /><input type=\\"hidden\\" name=\\"wdform_' . $id1 . '_hidden_column' . $form_id . '\\" value = \\"' . addslashes($param['w_columns']) . '\\" />").appendTo("#form' . $form_id . '");
                ';
                            if ($required) {
                                if ($param['w_field_input_type'] == 'radio') {
                                    $check_js .= '
                  if(x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
                  {
                    var radio_checked=true;
                    for(var k=1; k<' . count($w_rows) . ';k++)
                    {
                      if(x.find(jQuery("div[wdid=' . $id1 . ']")).find(jQuery("div[row="+k+"]")).find(jQuery("input[type=\'radio\']:checked")).length == 0)
                      {
                        radio_checked=false;
                        break;
                      }
                    }
                    
                    if(radio_checked==false)
                    {
                      alert("' . addslashes($label . ' ' . __('field is required.', '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 ($param['w_field_input_type'] == 'checkbox') {
                                    $check_js .= '
                  if(x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
                  {
                    if(x.find(jQuery("div[wdid=' . $id1 . ']")).find(jQuery("input[type=\'checkbox\']:checked")).length == 0)
                    {
                      alert("' . addslashes($label . ' ' . __('field is required.', '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 ($param['w_field_input_type'] == 'text') {
                                    $check_js .= '
                  if(x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
                  {
                    if(x.find(jQuery("div[wdid=' . $id1 . ']")).find(jQuery("input[type=\'text\']")).filter(function() {return this.value.length !== 0;}).length == 0)
                    {
                      alert("' . addslashes($label . ' ' . __('field is required.', '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 ($param['w_field_input_type'] == 'select') {
                                    $check_js .= '
                  if(x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
                  {
                    if(x.find(jQuery("div[wdid=' . $id1 . ']")).find(jQuery("select")).filter(function() {return this.value.length !== 0;}).length == 0)
                    {
                      alert("' . addslashes($label . ' ' . __('field is required.', '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_paypal_total':
                            $params_names = array('w_field_label_size', 'w_field_label_pos', '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_paypal_total" class="wdform-field"><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>';
                            $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '"  style="' . $param['w_field_label_pos2'] . '"><div id="wdform_' . $id1 . 'paypal_total' . $form_id . '" class="wdform_paypal_total paypal_total' . $form_id . '"><input type="hidden" value="" name="wdform_' . $id1 . '_paypal_total' . $form_id . '" class="input_paypal_total' . $form_id . '"><div id="wdform_' . $id1 . 'div_total' . $form_id . '" class="div_total' . $form_id . '" style="margin-bottom: 10px;"></div><div id="wdform_' . $id1 . 'paypal_products' . $form_id . '" class="paypal_products' . $form_id . '" style="border-spacing: 2px;"><div style="border-spacing: 2px;"></div><div style="border-spacing: 2px;"></div></div><div id="wdform_' . $id1 . 'paypal_tax' . $form_id . '" class="paypal_tax' . $form_id . '" style="border-spacing: 2px; margin-top: 7px;"></div></div></div></div>';
                            $onload_js .= 'set_total_value(' . $form_id . ');';
                            break;
                    }
                    $form = str_replace('%' . $id1 . ' - ' . $labels[$id1s_key] . '%', $rep, $form);
                    $form = str_replace('%' . $id1 . ' -' . $labels[$id1s_key] . '%', $rep, $form);
                }
            }
            $onsubmit_js .= '
        var disabled_fields ="";	
        jQuery("div[wdid]").each(function() {
          if(jQuery(this).css("display")=="none")
          {		
            disabled_fields += jQuery(this).attr("wdid");
            disabled_fields += ",";
          }	

            if(disabled_fields)
            jQuery("<input type=\\"hidden\\" name=\\"disabled_fields' . $form_id . '\\" value =\\""+disabled_fields+"\\" />").appendTo("#form' . $form_id . '");
            
        })';
            $rep1 = array('form_id_temp');
            $rep2 = array($id);
            $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">
      WDF_GRADING_TEXT ='<?php 
            echo addslashes(__("Your score should be less than", 'form_maker'));
            ?>
'; 
      WDF_INVALID_GRADING_<?php 
            echo $id;
            ?>
 	= '<?php 
            echo addslashes(sprintf(__("Your score should be less than", 'form_maker'), '`grading_label`', '`grading_total`'));
            ?>
';
      FormCurrency_<?php 
            echo $id;
            ?>
 = '<?php 
            echo $form_currency;
            ?>
';  
      FormPaypalTax_<?php 
            echo $id;
            ?>
 = '<?php 
            echo $form_paypal_tax;
            ?>
';  

      function formOnload<?php 
            echo $id;
            ?>
() {
        if (navigator.userAgent.toLowerCase().indexOf('msie') != -1 && parseInt(navigator.userAgent.toLowerCase().split('msie')[1]) === 8) {
          jQuery("#form<?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("#form<?php 
            echo $id;
            ?>
").find(jQuery("input[type='radio']:checked+label")).addClass('if-ie-div-label');
          jQuery("#form<?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("#form<?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_paypal_price'] 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, div[type='type_spinner'] input, div[type='type_range'] input, .wdform-quantity").keypress(function(evt) {return check_isnum(evt)});
        
        jQuery("div[type='type_grading'] input").keypress(function(evt) {return check_isnum_or_minus(evt)});
        
        jQuery("div[type='type_paypal_checkbox'] input[type='checkbox'], div[type='type_paypal_radio'] input[type='radio'], div[type='type_paypal_shipping'] input[type='radio']").click(function() {set_total_value(<?php 
            echo $form_id;
            ?>
)});
        jQuery("div[type='type_paypal_select'] select, div[type='type_paypal_price'] input").change(function() {set_total_value(<?php 
            echo $form_id;
            ?>
)});
        jQuery(".wdform-quantity").change(function() {set_total_value(<?php 
            echo $form_id;
            ?>
)});

        jQuery("div[type='type_address'] select").change(function() {set_total_value(<?php 
            echo $form_id;
            ?>
)});
        
        jQuery("div[type='type_time'] input").blur(function() {add_0(this)});

        jQuery('.wdform-element-section').each(function() {
          if(!jQuery(this).parent()[0].style.width && 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 (!jQuery(this).parent()[0].style.width && 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','');
          }
        });
        
        (function(jQuery){
          jQuery.fn.shuffle = function() {
            var allElems = this.get(),
              getRandom = function(max) {
                return Math.floor(Math.random() * max);
              },
              shuffled = jQuery.map(allElems, function(){
                var random = getRandom(allElems.length),
                  randEl = jQuery(allElems[random]).clone(true)[0];
                allElems.splice(random, 1);
                return randEl;
               });
            this.each(function(i){
              jQuery(this).replaceWith(jQuery(shuffled[i]));
            });
            return jQuery(shuffled);
          };
        })(jQuery);
        
        <?php 
            echo $onload_js;
            ?>
        <?php 
            echo $condition_js;
            ?>
        
        if(window.before_load)
        {
          before_load();
        }
      }

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

      form_view_count<?php 
            echo $id;
            ?>
=0;
      jQuery(document).ready(function () {
        for(i=1; i<=30; i++) {
          if (document.getElementById('<?php 
            echo $id;
            ?>
form_view'+i)) {
            form_view_count<?php 
            echo $id;
            ?>
++;
            form_view_max<?php 
            echo $id;
            ?>
 = i;
          }
        }
        if (form_view_count<?php 
            echo $id;
            ?>
 > 1) {
          for (i = 1; i <= form_view_max<?php 
            echo $id;
            ?>
; i++) {
            if (document.getElementById('<?php 
            echo $id;
            ?>
form_view' + i)) {
              first_form_view<?php 
            echo $id;
            ?>
 = i;
              break;
            }
          }
          generate_page_nav(first_form_view<?php 
            echo $id;
            ?>
, '<?php 
            echo $id;
            ?>
', form_view_count<?php 
            echo $id;
            ?>
, form_view_max<?php 
            echo $id;
            ?>
);
        }
        // jQuery('.wdform-element-section select').each(function() { reselect(this,''); });/////why?????????????
      });
      function check_required<?php 
            echo $form_id;
            ?>
(but_type) {
        if (but_type == 'reset') {
          if (window.before_reset) {
            before_reset();
          }
          window.location = "<?php 
            echo $current_url;
            ?>
";
          return;
        }
        if (window.before_submit) {
          before_submit();
        }
        x = jQuery("#form<?php 
            echo $form_id;
            ?>
");
        <?php 
            echo $check_js;
            ?>
;
        var a = [];
        if (typeof a[<?php 
            echo $form_id;
            ?>
] !== 'undefined' && a[<?php 
            echo $form_id;
            ?>
] == 1) {
          return;
        }
        <?php 
            echo $onsubmit_js;
            ?>
;
        a[<?php 
            echo $form_id;
            ?>
] = 1;
        document.getElementById("form"+<?php 
            echo $form_id;
            ?>
).submit();
      }
      function check<?php 
            echo $form_id;
            ?>
(id) {
        x = jQuery("#<?php 
            echo $form_id;
            ?>
form_view"+id);
        <?php 
            echo $check_js;
            ?>
;
        return true;
      }
    </script>
    <?php 
        } else {
            $captcha_url = 'components/com_formmaker/wd_captcha.php?digit=';
            $captcha_rep_url = 'components/com_formmaker/wd_captcha.php?r2=' . mt_rand(0, 1000) . '&digit=';
            $rep1 = array("<!--repstart-->Title<!--repend-->", "<!--repstart-->First<!--repend-->", "<!--repstart-->Last<!--repend-->", "<!--repstart-->Middle<!--repend-->", "<!--repstart-->January<!--repend-->", "<!--repstart-->February<!--repend-->", "<!--repstart-->March<!--repend-->", "<!--repstart-->April<!--repend-->", "<!--repstart-->May<!--repend-->", "<!--repstart-->June<!--repend-->", "<!--repstart-->July<!--repend-->", "<!--repstart-->August<!--repend-->", "<!--repstart-->September<!--repend-->", "<!--repstart-->October<!--repend-->", "<!--repstart-->November<!--repend-->", "<!--repstart-->December<!--repend-->", "<!--repstart-->Street Address<!--repend-->", "<!--repstart-->Street Address Line 2<!--repend-->", "<!--repstart-->City<!--repend-->", "<!--repstart-->State / Province / Region<!--repend-->", "<!--repstart-->Postal / Zip Code<!--repend-->", "<!--repstart-->Country<!--repend-->", "<!--repstart-->Area Code<!--repend-->", "<!--repstart-->Phone Number<!--repend-->", "<!--repstart-->Dollars<!--repend-->", "<!--repstart-->Cents<!--repend-->", "<!--repstart-->&nbsp;\$&nbsp;<!--repend-->", "<!--repstart-->Quantity<!--repend-->", "<!--repstart-->From<!--repend-->", "<!--repstart-->To<!--repend-->", "<!--repstart-->\$300<!--repend-->", "<!--repstart-->product 1 \$100<!--repend-->", "<!--repstart-->product 2 \$200<!--repend-->", $captcha_url, 'class="captcha_img"', plugins_url("images/refresh.png", __FILE__), 'form_id_temp', 'style="padding-right:170px"');
            $rep2 = array(addslashes(__("Title", 'form_maker')), addslashes(__("First", 'form_maker')), addslashes(__("Last", 'form_maker')), addslashes(__("Middle", 'form_maker')), addslashes(__("January", 'form_maker')), addslashes(__("February", 'form_maker')), addslashes(__("March", 'form_maker')), addslashes(__("April", 'form_maker')), addslashes(__("May", 'form_maker')), addslashes(__("June", 'form_maker')), addslashes(__("July", 'form_maker')), addslashes(__("August", 'form_maker')), addslashes(__("September", 'form_maker')), addslashes(__("October", 'form_maker')), addslashes(__("November", 'form_maker')), addslashes(__("December", 'form_maker')), addslashes(__("Street Address", 'form_maker')), addslashes(__("Street Address Line 2", 'form_maker')), addslashes(__("City", 'form_maker')), addslashes(__("State / Province / Region", 'form_maker')), addslashes(__("Postal / Zip Code", 'form_maker')), addslashes(__("Country", 'form_maker')), addslashes(__("Area Code", 'form_maker')), addslashes(__("Phone Number", 'form_maker')), addslashes(__("Dollars", 'form_maker')), addslashes(__("Cents", 'form_maker')), '&nbsp;' . $form_currency . '&nbsp;', addslashes(__("Quantity", 'form_maker')), addslashes(__("From", 'form_maker')), addslashes(__("To", 'form_maker')), '', '', '', $captcha_rep_url, 'class="captcha_img" style="display:none"', plugins_url("images/refresh.png", __FILE__), $id, '');
            $untilupload = str_replace($rep1, $rep2, $row->form_front);
            while (strpos($untilupload, "***destinationskizb") > 0) {
                $pos1 = strpos($untilupload, "***destinationskizb");
                $pos2 = strpos($untilupload, "***destinationverj");
                $untilupload = str_replace(substr($untilupload, $pos1, $pos2 - $pos1 + 22), "", $untilupload);
            }
            $form_maker_front_end .= $untilupload;
            $is_recaptcha = FALSE;
            $form_maker_front_end .= '<script type="text/javascript">';
            $form_maker_front_end .= 'WDF_FILE_TYPE_ERROR = \'' . addslashes(__("Sorry, you are not allowed to upload this type of file.", 'form_maker')) . '\';';
            $form_maker_front_end .= 'WDF_GRADING_TEXT = \'' . addslashes(__("Your score should be less than", 'form_maker')) . '\';';
            $form_maker_front_end .= 'WDF_INVALID_GRADING_' . $id . ' 	= \'' . addslashes(sprintf(__("Your score should be less than", 'form_maker'), '`grading_label`', '`grading_total`')) . '\';';
            $form_maker_front_end .= 'WDF_INVALID_EMAIL = \'' . addslashes(__("This is not a valid email address.", 'form_maker')) . '\';';
            $form_maker_front_end .= 'REQUEST_URI_' . $id . '	= "' . $current_url . '";';
            $form_maker_front_end .= 'ReqFieldMsg_' . $id . '	=\'`FIELDNAME` ' . addslashes(__('field is required.', 'form_maker')) . '\';';
            $form_maker_front_end .= 'RangeFieldMsg_' . $id . '	=\'' . addslashes(__('The', 'form_maker')) . ' `FIELDNAME` ' . addslashes(__('value must be between', 'form_maker')) . ' `FROM` - `TO`\';';
            $form_maker_front_end .= 'FormCurrency_' . $id . ' = "' . $form_currency . '";';
            $form_maker_front_end .= 'FormPaypalTax_' . $id . ' = ' . $form_paypal_tax . ';';
            $form_maker_front_end .= 'function formOnload' . $id . '()
  {';
            foreach ($label_type as $key => $type) {
                switch ($type) {
                    case 'type_map':
                        $form_maker_front_end .= 'if(document.getElementById("' . $label_id[$key] . '_element' . $id . '"))
      {
        if_gmap_init(' . $label_id[$key] . ',' . $id . ');
        for(q=0; q<20; q++)
          if(document.getElementById(' . $label_id[$key] . '+"_element"+' . $id . ').getAttribute("long"+q))
          {
          
            w_long=parseFloat(document.getElementById(' . $label_id[$key] . '+"_element"+' . $id . ').getAttribute("long"+q));
            w_lat=parseFloat(document.getElementById(' . $label_id[$key] . '+"_element"+' . $id . ').getAttribute("lat"+q));
            w_info=parseFloat(document.getElementById(' . $label_id[$key] . '+"_element"+' . $id . ').getAttribute("info"+q));
            add_marker_on_map(' . $label_id[$key] . ',q, w_long, w_lat, w_info,' . $id . ',false);
          }
      }';
                        break;
                    case 'type_mark_map':
                        $form_maker_front_end .= 'if(document.getElementById("' . $label_id[$key] . '_element' . $id . '"))
    if(!document.getElementById("' . $label_id[$key] . '_long' . $id . '"))	
    {      	
    
      var longit = document.createElement(\'input\');
            longit.setAttribute("type", \'hidden\');
            longit.setAttribute("id", \'' . $label_id[$key] . '_long' . $id . '\');
            longit.setAttribute("name", \'' . $label_id[$key] . '_long' . $id . '\');

      var latit = document.createElement(\'input\');
            latit.setAttribute("type", \'hidden\');
            latit.setAttribute("id", \'' . $label_id[$key] . '_lat' . $id . '\');
            latit.setAttribute("name", \'' . $label_id[$key] . '_lat' . $id . '\');

      document.getElementById("' . $label_id[$key] . '_element_section' . $id . '").appendChild(longit);
      document.getElementById("' . $label_id[$key] . '_element_section' . $id . '").appendChild(latit);
    
      if_gmap_init(' . $label_id[$key] . ', ' . $id . ');
      
      w_long=parseFloat(document.getElementById(' . $label_id[$key] . '+"_element"+' . $id . ').getAttribute("long0"));
      w_lat=parseFloat(document.getElementById(' . $label_id[$key] . '+"_element"+' . $id . ').getAttribute("lat0"));
      w_info=parseFloat(document.getElementById(' . $label_id[$key] . '+"_element"+' . $id . ').getAttribute("info0"));
      
      
      longit.value=w_long;
      latit.value=w_lat;
      add_marker_on_map(' . $label_id[$key] . ',0, w_long, w_lat, w_info, ' . $id . ', true);		
    }';
                        break;
                    case 'type_captcha':
                        $form_maker_front_end .= 'if(document.getElementById(\'_wd_captcha' . $id . '\'))
      captcha_refresh(\'_wd_captcha\', \'' . $id . '\');';
                        break;
                    case 'type_recaptcha':
                        $is_recaptcha = TRUE;
                        break;
                    case 'type_radio':
                    case 'type_checkbox':
                        $form_maker_front_end .= 'if(document.getElementById(\'' . $label_id[$key] . '_randomize' . $id . '\'))
      if (document.getElementById(\'' . $label_id[$key] . '_randomize' . $id . '\').value == "yes") {
        choises_randomize(\'' . $label_id[$key] . '\', \'' . $id . '\');}';
                        break;
                    case 'type_spinner':
                        $form_maker_front_end .= '
      if (document.getElementById(\'' . $label_id[$key] . '_element' . $id . '\')) {
        var spinner_value = document.getElementById(\'' . $label_id[$key] . '_element' . $id . '\').getAttribute(\'aria-valuenow\');
      }
      if (document.getElementById(\'' . $label_id[$key] . '_min_value' . $id . '\'))
        var spinner_min_value = document.getElementById(\'' . $label_id[$key] . '_min_value' . $id . '\').value;
      if (document.getElementById(\'' . $label_id[$key] . '_max_value' . $id . '\'))
        var spinner_max_value = document.getElementById(\'' . $label_id[$key] . '_max_value' . $id . '\').value;
      if (document.getElementById(\'' . $label_id[$key] . '_step' . $id . '\'))
        var spinner_step = document.getElementById(\'' . $label_id[$key] . '_step' . $id . '\').value;
      jQuery( \'' . $label_id[$key] . '_element' . $id . '\' ).removeClass( \'ui-spinner-input\')
      .attr( \'disabled\', false )
      .removeAttr( \'autocomplete\' )
      .removeAttr( \'role\' )
      .removeAttr( \'aria-valuemin\' )
      .removeAttr( \'aria-valuemax\' )
      .removeAttr( \'aria-valuenow\' );
      if (document.getElementById(\'' . $label_id[$key] . '_element' . $id . '\')) {
        span_ui= document.getElementById(\'' . $label_id[$key] . '_element' . $id . '\').parentNode;
        span_ui.parentNode.appendChild(document.getElementById(\'' . $label_id[$key] . '_element' . $id . '\'));
        span_ui.parentNode.removeChild(span_ui);
        jQuery(\'#' . $label_id[$key] . '_element' . $id . '\')[0].spin = null;
      }
      spinner = jQuery( \'#' . $label_id[$key] . '_element' . $id . '\' ).spinner();
      spinner.spinner( \'value\', spinner_value );
      jQuery( \'#' . $label_id[$key] . '_element' . $id . '\' ).spinner({ min: spinner_min_value});
      jQuery( \'#' . $label_id[$key] . '_element' . $id . '\' ).spinner({ max: spinner_max_value});
      jQuery( \'#' . $label_id[$key] . '_element' . $id . '\' ).spinner({ step: spinner_step});';
                        break;
                    case 'type_slider':
                        $form_maker_front_end .= '
      if (document.getElementById(\'' . $label_id[$key] . '_slider_value' . $id . '\'))
        var slider_value = document.getElementById(\'' . $label_id[$key] . '_slider_value' . $id . '\').value;
      if (document.getElementById(\'' . $label_id[$key] . '_slider_min_value' . $id . '\'))
        var slider_min_value = document.getElementById(\'' . $label_id[$key] . '_slider_min_value' . $id . '\').value;
      if (document.getElementById(\'' . $label_id[$key] . '_slider_max_value' . $id . '\'))
        var slider_max_value = document.getElementById(\'' . $label_id[$key] . '_slider_max_value' . $id . '\').value;
      if (document.getElementById(\'' . $label_id[$key] . '_element_value' . $id . '\'))
        var slider_element_value = document.getElementById(\'' . $label_id[$key] . '_element_value' . $id . '\' );
      if (document.getElementById(\'' . $label_id[$key] . '_slider_value' . $id . '\'))
        var slider_value_save = document.getElementById( \'' . $label_id[$key] . '_slider_value' . $id . '\' );
      if (document.getElementById(\'' . $label_id[$key] . '_element' . $id . '\')) {
        document.getElementById(\'' . $label_id[$key] . '_element' . $id . '\').innerHTML = \'\';
        document.getElementById(\'' . $label_id[$key] . '_element' . $id . '\').removeAttribute( \'class\' );
        document.getElementById(\'' . $label_id[$key] . '_element' . $id . '\').removeAttribute( \'aria-disabled\' );
      }
      if (document.getElementById(\'' . $label_id[$key] . '_element' . $id . '\'))
        jQuery(\'#' . $label_id[$key] . '_element' . $id . '\')[0].slide = null;
      jQuery( \'#' . $label_id[$key] . '_element' . $id . '\').slider({
        range: \'min\',
        value: eval(slider_value),
        min: eval(slider_min_value),
        max: eval(slider_max_value),	
        slide: function( event, ui ) {
          slider_element_value.innerHTML = \'\' + ui.value;
          slider_value_save.value = \'\' + ui.value;
        }
      });';
                        break;
                    case 'type_range':
                        $form_maker_front_end .= '
      if (document.getElementById(\'' . $label_id[$key] . '_element' . $id . '0\'))
        var spinner_value0 = document.getElementById(\'' . $label_id[$key] . '_element' . $id . '0\').getAttribute( \'aria-valuenow\' );
      if (document.getElementById(\'' . $label_id[$key] . '_element' . $id . '1\'))
        var spinner_value1 = document.getElementById(\'' . $label_id[$key] . '_element' . $id . '1\').getAttribute( \'aria-valuenow\' );
      if (document.getElementById(\'' . $label_id[$key] . '_range_step' . $id . '\'))
        var spinner_step = document.getElementById(\'' . $label_id[$key] . '_range_step' . $id . '\').value;
      jQuery( \'#' . $label_id[$key] . '_element' . $id . '0\' ).removeClass( \'ui-spinner-input\' )
      .attr( \'disabled\', false )	
      .removeAttr( \'autocomplete\' )		
      .removeAttr( \'role\' )			
      .removeAttr( \'aria-valuenow\' );		
      if (document.getElementById(\'' . $label_id[$key] . '_element' . $id . '0\')) {
        span_ui= document.getElementById(\'' . $label_id[$key] . '_element' . $id . '0\').parentNode;
        span_ui.parentNode.appendChild(document.getElementById(\'' . $label_id[$key] . '_element' . $id . '0\'));
        span_ui.parentNode.removeChild(span_ui);
        jQuery(\'#' . $label_id[$key] . '_element' . $id . '0\')[0].spin = null;
      }
      spinner0 = jQuery( \'#' . $label_id[$key] . '_element' . $id . '0\' ).spinner();
      spinner0.spinner( \'value\', spinner_value0 );
      jQuery( \'#' . $label_id[$key] . '_element' . $id . '0\' ).spinner({ step: spinner_step});
      jQuery( \'#' . $label_id[$key] . '_element' . $id . '1\' ).removeClass( \'ui-spinner-input\' )
      .attr( \'disabled\', false )
      .removeAttr( \'autocomplete\' )
      .removeAttr( \'role\' )
      .removeAttr( \'aria-valuenow\' );
      if (document.getElementById(\'' . $label_id[$key] . '_element' . $id . '1\')) {
        span_ui1= document.getElementById(\'' . $label_id[$key] . '_element' . $id . '1\').parentNode;
        span_ui1.parentNode.appendChild(document.getElementById(\'' . $label_id[$key] . '_element' . $id . '1\'));
        span_ui1.parentNode.removeChild(span_ui1);
        jQuery(\'#' . $label_id[$key] . '_element' . $id . '1\')[0].spin = null;
      }
      spinner1 = jQuery( \'#' . $label_id[$key] . '_element' . $id . '1\' ).spinner();
      spinner1.spinner( \'value\', spinner_value1 );
      jQuery( \'#' . $label_id[$key] . '_element' . $id . '1\').spinner({ step: spinner_step});';
                        break;
                    case 'type_paypal_total':
                        $form_maker_front_end .= '
      set_total_value(' . $label_id[$key] . ', ' . $id . ');';
                        break;
                    default:
                        break;
                }
            }
            $form_maker_front_end .= '
       if (window.before_load) {
        before_load();
       }
    }';
            $form_maker_front_end .= '
        jQuery(window).load(function () {
          formOnload' . $id . '();
        });';
            if (isset($_POST["counter" . $id])) {
                $counter = esc_html($_POST["counter" . $id]);
            }
            $old_key = -1;
            if (isset($counter)) {
                foreach ($label_type as $key => $type) {
                    switch ($type) {
                        case "type_text":
                        case "type_number":
                        case "type_submitter_mail":
                            $form_maker_front_end .= "if(document.getElementById('" . $label_id[$key] . "_element" . $id . "'))\n      if(document.getElementById('" . $label_id[$key] . "_element" . $id . "').title!='" . addslashes(isset($_POST[$label_id[$key] . "_element" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_element" . $id])) : "") . "')\n      {\tdocument.getElementById('" . $label_id[$key] . "_element" . $id . "').value='" . addslashes(isset($_POST[$label_id[$key] . "_element" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_element" . $id])) : "") . "';\n        document.getElementById('" . $label_id[$key] . "_element" . $id . "').className='input_active';\n      }\n    ";
                            break;
                        case "type_textarea":
                            $order = array("\r\n", "\n", "\r");
                            $form_maker_front_end .= "if(document.getElementById('" . $label_id[$key] . "_element" . $id . "'))\n      if(document.getElementById('" . $label_id[$key] . "_element" . $id . "').title!='" . str_replace($order, '\\n', addslashes(isset($_POST[$label_id[$key] . "_element" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_element" . $id])) : "")) . "')\n      {\tdocument.getElementById('" . $label_id[$key] . "_element" . $id . "').innerHTML='" . str_replace($order, '\\n', addslashes(isset($_POST[$label_id[$key] . "_element" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_element" . $id])) : "")) . "';\n        document.getElementById('" . $label_id[$key] . "_element" . $id . "').className='input_active';\n      }\n    ";
                            break;
                        case "type_name":
                            $element_title = isset($_POST[$label_id[$key] . "_element_title" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_element_title" . $id])) : "";
                            if (isset($_POST[$label_id[$key] . "_element_title" . $id])) {
                                $form_maker_front_end .= "if(document.getElementById('" . $label_id[$key] . "_element_first" . $id . "'))\n    {\n      if(document.getElementById('" . $label_id[$key] . "_element_title" . $id . "').title!='" . addslashes(isset($_POST[$label_id[$key] . "_element_title" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_element_title" . $id])) : "") . "')\n      {\tdocument.getElementById('" . $label_id[$key] . "_element_title" . $id . "').value='" . addslashes(isset($_POST[$label_id[$key] . "_element_title" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_element_title" . $id])) : "") . "';\n        document.getElementById('" . $label_id[$key] . "_element_title" . $id . "').className='input_active';\n      }\n      \n      if(document.getElementById('" . $label_id[$key] . "_element_first" . $id . "').title!='" . addslashes(isset($_POST[$label_id[$key] . "_element_first" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_element_first" . $id])) : "") . "')\n      {\tdocument.getElementById('" . $label_id[$key] . "_element_first" . $id . "').value='" . addslashes(isset($_POST[$label_id[$key] . "_element_first" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_element_first" . $id])) : "") . "';\n        document.getElementById('" . $label_id[$key] . "_element_first" . $id . "').className='input_active';\n      }\n      \n      if(document.getElementById('" . $label_id[$key] . "_element_last" . $id . "').title!='" . addslashes(isset($_POST[$label_id[$key] . "_element_last" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_element_last" . $id])) : "") . "')\n      {\tdocument.getElementById('" . $label_id[$key] . "_element_last" . $id . "').value='" . addslashes(isset($_POST[$label_id[$key] . "_element_last" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_element_last" . $id])) : "") . "';\n        document.getElementById('" . $label_id[$key] . "_element_last" . $id . "').className='input_active';\n      }\n      \n      if(document.getElementById('" . $label_id[$key] . "_element_middle" . $id . "').title!='" . addslashes(isset($_POST[$label_id[$key] . "_element_middle" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_element_middle" . $id])) : "") . "')\n      {\tdocument.getElementById('" . $label_id[$key] . "_element_middle" . $id . "').value='" . addslashes(isset($_POST[$label_id[$key] . "_element_middle" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_element_middle" . $id])) : "") . "';\n        document.getElementById('" . $label_id[$key] . "_element_middle" . $id . "').className='input_active';\n      }\n      \n    }";
                            } else {
                                $form_maker_front_end .= "if(document.getElementById('" . $label_id[$key] . "_element_first" . $id . "'))\n    {\n      \n      if(document.getElementById('" . $label_id[$key] . "_element_first" . $id . "').title!='" . addslashes(isset($_POST[$label_id[$key] . "_element_first" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_element_first" . $id])) : "") . "')\n      {\tdocument.getElementById('" . $label_id[$key] . "_element_first" . $id . "').value='" . addslashes(isset($_POST[$label_id[$key] . "_element_first" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_element_first" . $id])) : "") . "';\n        document.getElementById('" . $label_id[$key] . "_element_first" . $id . "').className='input_active';\n      }\n      \n      if(document.getElementById('" . $label_id[$key] . "_element_last" . $id . "').title!='" . addslashes(isset($_POST[$label_id[$key] . "_element_last" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_element_last" . $id])) : "") . "')\n      {\tdocument.getElementById('" . $label_id[$key] . "_element_last" . $id . "').value='" . addslashes(isset($_POST[$label_id[$key] . "_element_last" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_element_last" . $id])) : "") . "';\n        document.getElementById('" . $label_id[$key] . "_element_last" . $id . "').className='input_active';\n      }\n      \n    }";
                            }
                            break;
                        case "type_phone":
                            $form_maker_front_end .= "if(document.getElementById('" . $label_id[$key] . "_element_first" . $id . "'))\n    {\n      if(document.getElementById('" . $label_id[$key] . "_element_first" . $id . "').title!='" . addslashes(isset($_POST[$label_id[$key] . "_element_first" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_element_first" . $id])) : "") . "')\n      {\tdocument.getElementById('" . $label_id[$key] . "_element_first" . $id . "').value='" . addslashes(isset($_POST[$label_id[$key] . "_element_first" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_element_first" . $id])) : "") . "';\n        document.getElementById('" . $label_id[$key] . "_element_first" . $id . "').className='input_active';\n      }\n      \n      if(document.getElementById('" . $label_id[$key] . "_element_last" . $id . "').title!='" . addslashes(isset($_POST[$label_id[$key] . "_element_last" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_element_last" . $id])) : "") . "')\n      {\tdocument.getElementById('" . $label_id[$key] . "_element_last" . $id . "').value='" . addslashes(isset($_POST[$label_id[$key] . "_element_last" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_element_last" . $id])) : "") . "';\n        document.getElementById('" . $label_id[$key] . "_element_last" . $id . "').className='input_active';\n      }\n    }";
                            break;
                        case "type_paypal_price":
                            $form_maker_front_end .= "if(document.getElementById('" . $label_id[$key] . "_element_dollars" . $id . "'))\n    {\n      if(document.getElementById('" . $label_id[$key] . "_element_dollars" . $id . "').title!='" . addslashes(isset($_POST[$label_id[$key] . "_element_dollars" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_element_dollars" . $id])) : "") . "')\n      {\tdocument.getElementById('" . $label_id[$key] . "_element_dollars" . $id . "').value='" . addslashes(isset($_POST[$label_id[$key] . "_element_dollars" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_element_dollars" . $id])) : "") . "';\n        document.getElementById('" . $label_id[$key] . "_element_dollars" . $id . "').className='input_active';\n      }\n      \n      if(document.getElementById('" . $label_id[$key] . "_element_cents" . $id . "').title!='" . addslashes(isset($_POST[$label_id[$key] . "_element_cents" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_element_cents" . $id])) : "") . "')\n      {\tdocument.getElementById('" . $label_id[$key] . "_element_cents" . $id . "').value='" . addslashes(isset($_POST[$label_id[$key] . "_element_cents" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_element_cents" . $id])) : "") . "';\n        document.getElementById('" . $label_id[$key] . "_element_cents" . $id . "').className='input_active';\n      }\n    }";
                            break;
                        case "type_paypal_select":
                            $form_maker_front_end .= "if(document.getElementById('" . $label_id[$key] . "_element" . $id . "')){\n      document.getElementById('" . $label_id[$key] . "_element" . $id . "').value='" . addslashes(isset($_POST[$label_id[$key] . "_element" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_element" . $id])) : "") . "';\n    \n    if(document.getElementById('" . $label_id[$key] . "_element_quantity" . $id . "'))\n      document.getElementById('" . $label_id[$key] . "_element_quantity" . $id . "').value='" . (isset($_POST[$label_id[$key] . "_element_quantity" . $id]) && (int) $_POST[$label_id[$key] . "_element_quantity" . $id] >= 1 ? addslashes($_POST[$label_id[$key] . "_element_quantity" . $id]) : 1) . "';\n      ";
                            for ($j = 0; $j < 100; $j++) {
                                $element = isset($_POST[$label_id[$key] . "_property" . $id . $j]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_property" . $id . $j])) : NULL;
                                if (isset($element)) {
                                    $form_maker_front_end .= "document.getElementById('" . $label_id[$key] . "_property" . $id . $j . "').value='" . addslashes($element) . "';\n    ";
                                }
                            }
                            $form_maker_front_end .= "\n      }";
                            break;
                        case "type_paypal_checkbox":
                            $form_maker_front_end .= "\n    for(k=0; k<30; k++)\n      if(document.getElementById('" . $label_id[$key] . "_element" . $id . "'+k))\n        document.getElementById('" . $label_id[$key] . "_element" . $id . "'+k).removeAttribute('checked');\n      else break;\n    ";
                            for ($j = 0; $j < 100; $j++) {
                                $element = isset($_POST[$label_id[$key] . "_element" . $id . $j]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_element" . $id . $j])) : NULL;
                                if (isset($element)) {
                                    $form_maker_front_end .= "document.getElementById('" . $label_id[$key] . "_element" . $id . $j . "').setAttribute('checked', 'checked');\n    ";
                                }
                            }
                            $form_maker_front_end .= "\n    if(document.getElementById('" . $label_id[$key] . "_element_quantity" . $id . "'))\n      document.getElementById('" . $label_id[$key] . "_element_quantity" . $id . "').value='" . (isset($_POST[$label_id[$key] . "_element_quantity" . $id]) ? addslashes($_POST[$label_id[$key] . "_element_quantity" . $id]) : 1) . "';\n      ";
                            for ($j = 0; $j < 100; $j++) {
                                $element = isset($_POST[$label_id[$key] . "_property" . $id . $j]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_property" . $id . $j])) : NULL;
                                if (isset($element)) {
                                    $form_maker_front_end .= "document.getElementById('" . $label_id[$key] . "_property" . $id . $j . "').value='" . addslashes($element) . "';\n    ";
                                }
                            }
                            break;
                        case "type_paypal_radio":
                            $form_maker_front_end .= "\n    for(k=0; k<50; k++)\n      if(document.getElementById('" . $label_id[$key] . "_element" . $id . "'+k))\n      {\n        document.getElementById('" . $label_id[$key] . "_element" . $id . "'+k).removeAttribute('checked');\n        if(document.getElementById('" . $label_id[$key] . "_element" . $id . "'+k).value=='" . addslashes(isset($_POST[$label_id[$key] . "_element" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_element" . $id])) : "") . "')\n        {\n          document.getElementById('" . $label_id[$key] . "_element" . $id . "'+k).setAttribute('checked', 'checked');\n                  \n        }\n      }\n      \n\n    if(document.getElementById('" . $label_id[$key] . "_element_quantity" . $id . "'))\n      document.getElementById('" . $label_id[$key] . "_element_quantity" . $id . "').value='" . (isset($_POST[$label_id[$key] . "_element_quantity" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_element_quantity" . $id])) : 1) . "';\n      ";
                            for ($j = 0; $j < 100; $j++) {
                                $element = isset($_POST[$label_id[$key] . "_property" . $id . $j]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_property" . $id . $j])) : NULL;
                                if (isset($element)) {
                                    $form_maker_front_end .= "document.getElementById('" . $label_id[$key] . "_property" . $id . $j . "').value='" . addslashes($element) . "';\n    ";
                                }
                            }
                            break;
                        case "type_paypal_shipping":
                            $form_maker_front_end .= "\n    for(k=0; k<50; k++)\n      if(document.getElementById('" . $label_id[$key] . "_element" . $id . "'+k))\n      {\n        document.getElementById('" . $label_id[$key] . "_element" . $id . "'+k).removeAttribute('checked');\n        if(document.getElementById('" . $label_id[$key] . "_element" . $id . "'+k).value=='" . addslashes(isset($_POST[$label_id[$key] . "_element" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_element" . $id])) : "") . "')\n        {\n          document.getElementById('" . $label_id[$key] . "_element" . $id . "'+k).setAttribute('checked', 'checked');\n                  \n        }\n      }\n    \n    ";
                            break;
                        case "type_star_rating":
                            $form_maker_front_end .= "if(document.getElementById('" . $label_id[$key] . "_element" . $id . "')) {\n              document.getElementById('" . $label_id[$key] . "_selected_star_amount" . $id . "').value='" . addslashes(isset($_POST[$label_id[$key] . "_selected_star_amount" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_selected_star_amount" . $id])) : "") . "';\t\n              if (document.getElementById('" . $label_id[$key] . "_selected_star_amount" . $id . "').value)\t\n                select_star_rating((document.getElementById('" . $label_id[$key] . "_selected_star_amount" . $id . "').value-1)," . $label_id[$key] . "," . $id . ");\t\n            }";
                            break;
                        case "type_scale_rating":
                            $form_maker_front_end .= "for (k=0; k<100; k++) {\n              if (document.getElementById('" . $label_id[$key] . "_scale_radio" . $id . "_'+k)) {\n                document.getElementById('" . $label_id[$key] . "_scale_radio" . $id . "_'+k).removeAttribute('checked');\n                if (document.getElementById('" . $label_id[$key] . "_scale_radio" . $id . "_'+k).value=='" . (isset($_POST[$label_id[$key] . "_scale_radio" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_scale_radio" . $id])) : "") . "')\n                  document.getElementById('" . $label_id[$key] . "_scale_radio" . $id . "_'+k).setAttribute('checked', 'checked');\n              }\n            }";
                            break;
                        case "type_spinner":
                            $form_maker_front_end .= "if (document.getElementById('" . $label_id[$key] . "_element" . $id . "')) {\n              document.getElementById('" . $label_id[$key] . "_element" . $id . "').setAttribute('aria-valuenow','" . (isset($_POST[$label_id[$key] . "_element" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_element" . $id])) : "") . "');\n            }";
                            break;
                        case "type_slider":
                            $form_maker_front_end .= "if (document.getElementById('" . $label_id[$key] . "_element" . $id . "'))\n              document.getElementById('" . $label_id[$key] . "_element" . $id . "').setAttribute('aria-valuenow','" . (isset($_POST[$label_id[$key] . "_slider_value" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_slider_value" . $id])) : "") . "');\n            if (document.getElementById('" . $label_id[$key] . "_slider_value" . $id . "'))\n              document.getElementById('" . $label_id[$key] . "_slider_value" . $id . "').value='" . (isset($_POST[$label_id[$key] . "_slider_value" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_slider_value" . $id])) : "") . "';\n            if (document.getElementById('" . $label_id[$key] . "_element_value" . $id . "'))\n              document.getElementById('" . $label_id[$key] . "_element_value" . $id . "').innerHTML='" . (isset($_POST[$label_id[$key] . "_slider_value" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_slider_value" . $id])) : "") . "';";
                            break;
                        case "type_range":
                            $form_maker_front_end .= "if (document.getElementById('" . $label_id[$key] . "_element" . $id . "0'))\n                document.getElementById('" . $label_id[$key] . "_element" . $id . "0').setAttribute('aria-valuenow','" . (isset($_POST[$label_id[$key] . "_element" . $id . "0"]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_element" . $id . "0"])) : "") . "');\n              if (document.getElementById('" . $label_id[$key] . "_element" . $id . "1'))\n                document.getElementById('" . $label_id[$key] . "_element" . $id . "1').setAttribute('aria-valuenow','" . (isset($_POST[$label_id[$key] . "_element" . $id . "1"]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_element" . $id . "1"])) : "") . "');";
                            break;
                        case "type_grading":
                            for ($k = 0; $k < 100; $k++) {
                                $form_maker_front_end .= "if (document.getElementById('" . $label_id[$key] . "_element" . $id . $k . "')) {\t\t\n                document.getElementById('" . $label_id[$key] . "_element" . $id . $k . "').value='" . (isset($_POST[$label_id[$key] . "_element" . $id . $k]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_element" . $id . $k])) : "") . "';}";
                            }
                            $form_maker_front_end .= "sum_grading_values(" . $label_id[$key] . "," . $id . ");";
                            break;
                        case "type_matrix":
                            $form_maker_front_end .= "if (document.getElementById('" . $label_id[$key] . "_input_type" . $id . "').value == 'radio') {";
                            for ($k = 1; $k < 40; $k++) {
                                for ($l = 1; $l < 40; $l++) {
                                    $form_maker_front_end .= "if (document.getElementById('" . $label_id[$key] . "_input_element" . $id . $k . "_" . $l . "')) {\n                      document.getElementById('" . $label_id[$key] . "_input_element" . $id . $k . "_" . $l . "').removeAttribute('checked');\n                      if (document.getElementById('" . $label_id[$key] . "_input_element" . $id . $k . "_" . $l . "').value=='" . (isset($_POST[$label_id[$key] . "_input_element" . $id . $k]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_input_element" . $id . $k])) : "") . "')\n                        document.getElementById('" . $label_id[$key] . "_input_element" . $id . $k . "_" . $l . "').setAttribute('checked', 'checked');\n                    }";
                                }
                            }
                            $form_maker_front_end .= "}\t\n            else\t\n              if (document.getElementById('" . $label_id[$key] . "_input_type" . $id . "').value == 'checkbox') {";
                            for ($k = 1; $k < 40; $k++) {
                                for ($l = 1; $l < 40; $l++) {
                                    $form_maker_front_end .= "if (document.getElementById('" . $label_id[$key] . "_input_element" . $id . $k . "_" . $l . "')) {\n                    document.getElementById('" . $label_id[$key] . "_input_element" . $id . $k . "_" . $l . "').removeAttribute('checked');\n                    if (document.getElementById('" . $label_id[$key] . "_input_element" . $id . $k . "_" . $l . "').value=='" . (isset($_POST[$label_id[$key] . "_input_element" . $id . $k . "_" . $l]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_input_element" . $id . $k . "_" . $l])) : "") . "')\t\t\n                      document.getElementById('" . $label_id[$key] . "_input_element" . $id . $k . "_" . $l . "').setAttribute('checked', 'checked');\n                  }";
                                }
                            }
                            $form_maker_front_end .= "}\t\n            else\t\n              if (document.getElementById('" . $label_id[$key] . "_input_type" . $id . "').value == 'text') {";
                            for ($k = 1; $k < 40; $k++) {
                                for ($l = 1; $l < 40; $l++) {
                                    $form_maker_front_end .= "if (document.getElementById('" . $label_id[$key] . "_input_element" . $id . $k . "_" . $l . "'))\n                    document.getElementById('" . $label_id[$key] . "_input_element" . $id . $k . "_" . $l . "').value='" . (isset($_POST[$label_id[$key] . "_input_element" . $id . $k . "_" . $l]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_input_element" . $id . $k . "_" . $l])) : "") . "';";
                                }
                            }
                            $form_maker_front_end .= "\n            }\n            else\n              if (document.getElementById('" . $label_id[$key] . "_input_type" . $id . "').value == 'select') {";
                            for ($k = 1; $k < 40; $k++) {
                                for ($l = 1; $l < 40; $l++) {
                                    $form_maker_front_end .= "if (document.getElementById('" . $label_id[$key] . "_select_yes_no" . $id . $k . "_" . $l . "'))\n                      document.getElementById('" . $label_id[$key] . "_select_yes_no" . $id . $k . "_" . $l . "').value='" . (isset($_POST[$label_id[$key] . "_select_yes_no" . $id . $k . "_" . $l]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_select_yes_no" . $id . $k . "_" . $l])) : "") . "';";
                                }
                            }
                            $form_maker_front_end .= "}";
                            break;
                        case "type_address":
                            if ($key > $old_key) {
                                $form_maker_front_end .= "if(document.getElementById('" . $label_id[$key] . "_street1" . $id . "'))\n    {\n        document.getElementById('" . $label_id[$key] . "_street1" . $id . "').value='" . addslashes(isset($_POST[$label_id[$key] . "_street1" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_street1" . $id])) : "") . "';\n        document.getElementById('" . $label_id[$key] . "_street2" . $id . "').value='" . addslashes(isset($_POST[$label_id[$key + 1] . "_street2" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key + 1] . "_street2" . $id])) : "") . "';\n        document.getElementById('" . $label_id[$key] . "_city" . $id . "').value='" . addslashes(isset($_POST[$label_id[$key + 2] . "_city" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key + 2] . "_city" . $id])) : "") . "';\n        document.getElementById('" . $label_id[$key] . "_state" . $id . "').value='" . addslashes(isset($_POST[$label_id[$key + 3] . "_state" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key + 3] . "_state" . $id])) : "") . "';\n        document.getElementById('" . $label_id[$key] . "_postal" . $id . "').value='" . addslashes(isset($_POST[$label_id[$key + 4] . "_postal" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key + 4] . "_postal" . $id])) : "") . "';\n        document.getElementById('" . $label_id[$key] . "_country" . $id . "').value='" . addslashes(isset($_POST[$label_id[$key + 5] . "_country" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key + 5] . "_country" . $id])) : "") . "';\n      \n    }";
                                $old_key = $key + 5;
                            }
                            break;
                        case "type_checkbox":
                            $is_other = FALSE;
                            if (isset($_POST[$label_id[$key] . "_allow_other" . $id]) && esc_html(stripslashes($_POST[$label_id[$key] . "_allow_other" . $id])) == "yes") {
                                $other_element = isset($_POST[$label_id[$key] . "_other_input" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_other_input" . $id])) : "";
                                $other_element_id = isset($_POST[$label_id[$key] . "_allow_other_num" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_allow_other_num" . $id])) : NULL;
                                if (isset($_POST[$label_id[$key] . "_allow_other_num" . $id])) {
                                    $is_other = TRUE;
                                }
                            }
                            $form_maker_front_end .= "\n    if(document.getElementById('" . $label_id[$key] . "_other_input" . $id . "'))\n    {\n    document.getElementById('" . $label_id[$key] . "_other_input" . $id . "').parentNode.removeChild(document.getElementById('" . $label_id[$key] . "_other_br" . $id . "'));\n    document.getElementById('" . $label_id[$key] . "_other_input" . $id . "').parentNode.removeChild(document.getElementById('" . $label_id[$key] . "_other_input" . $id . "'));\n    }\n    for(k=0; k<30; k++)\n      if(document.getElementById('" . $label_id[$key] . "_element" . $id . "'+k))\n        document.getElementById('" . $label_id[$key] . "_element" . $id . "'+k).removeAttribute('checked');\n      else break;\n    ";
                            for ($j = 0; $j < 100; $j++) {
                                $element = isset($_POST[$label_id[$key] . "_element" . $id . $j]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_element" . $id . $j])) : NULL;
                                if (isset($_POST[$label_id[$key] . "_element" . $id . $j])) {
                                    $form_maker_front_end .= "document.getElementById('" . $label_id[$key] . "_element" . $id . $j . "').setAttribute('checked', 'checked');\n    ";
                                }
                            }
                            if ($is_other) {
                                $form_maker_front_end .= "\n      show_other_input('" . $label_id[$key] . "','" . $id . "');\n      document.getElementById('" . $label_id[$key] . "_other_input" . $id . "').value='" . (isset($_POST[$label_id[$key] . "_other_input" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_other_input" . $id])) : "") . "';\n    ";
                            }
                            break;
                        case "type_radio":
                            $is_other = FALSE;
                            if (isset($_POST[$label_id[$key] . "_allow_other" . $id]) && esc_html(stripslashes($_POST[$label_id[$key] . "_allow_other" . $id])) == "yes") {
                                $other_element = isset($_POST[$label_id[$key] . "_other_input" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_other_input" . $id])) : "";
                                if (isset($_POST[$label_id[$key] . "_other_input" . $id])) {
                                    $is_other = TRUE;
                                }
                            }
                            $form_maker_front_end .= "\n    if(document.getElementById('" . $label_id[$key] . "_other_input" . $id . "'))\n    {\n    document.getElementById('" . $label_id[$key] . "_other_input" . $id . "').parentNode.removeChild(document.getElementById('" . $label_id[$key] . "_other_br" . $id . "'));\n    document.getElementById('" . $label_id[$key] . "_other_input" . $id . "').parentNode.removeChild(document.getElementById('" . $label_id[$key] . "_other_input" . $id . "'));\n    }\n    \n    for(k=0; k<50; k++)\n      if(document.getElementById('" . $label_id[$key] . "_element" . $id . "'+k))\n      {\n        document.getElementById('" . $label_id[$key] . "_element" . $id . "'+k).removeAttribute('checked');\n        if(document.getElementById('" . $label_id[$key] . "_element" . $id . "'+k).value=='" . addslashes(isset($_POST[$label_id[$key] . "_element" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_element" . $id])) : "") . "')\n        {\n          document.getElementById('" . $label_id[$key] . "_element" . $id . "'+k).setAttribute('checked', 'checked');\n                  \n        }\n      }\n      else break;\n    ";
                            if ($is_other) {
                                $form_maker_front_end .= "\n      show_other_input('" . $label_id[$key] . "','" . $id . "');\n      document.getElementById('" . $label_id[$key] . "_other_input" . $id . "').value='" . (isset($_POST[$label_id[$key] . "_other_input" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_other_input" . $id])) : "") . "';\n    ";
                            }
                            break;
                        case "type_time":
                            $ss = isset($_POST[$label_id[$key] . "_ss" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_ss" . $id])) : "";
                            if (isset($_POST[$label_id[$key] . "_ss" . $id])) {
                                $form_maker_front_end .= "if(document.getElementById('" . $label_id[$key] . "_hh" . $id . "'))\n    {\n      document.getElementById('" . $label_id[$key] . "_hh" . $id . "').value='" . (isset($_POST[$label_id[$key] . "_hh" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_hh" . $id])) : "") . "';\n      document.getElementById('" . $label_id[$key] . "_mm" . $id . "').value='" . (isset($_POST[$label_id[$key] . "_mm" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_mm" . $id])) : "") . "';\n      document.getElementById('" . $label_id[$key] . "_ss" . $id . "').value='" . (isset($_POST[$label_id[$key] . "_ss" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_ss" . $id])) : "") . "';\n    }";
                            } else {
                                $form_maker_front_end .= "if(document.getElementById('" . $label_id[$key] . "_hh" . $id . "'))\n    {\n      document.getElementById('" . $label_id[$key] . "_hh" . $id . "').value='" . (isset($_POST[$label_id[$key] . "_hh" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_hh" . $id])) : "") . "';\n      document.getElementById('" . $label_id[$key] . "_mm" . $id . "').value='" . (isset($_POST[$label_id[$key] . "_mm" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_mm" . $id])) : "") . "';\n    }";
                            }
                            $am_pm = isset($_POST[$label_id[$key] . "_am_pm" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_am_pm" . $id])) : NULL;
                            if (isset($am_pm)) {
                                $form_maker_front_end .= "if(document.getElementById('" . $label_id[$key] . "_am_pm" . $id . "'))\n      document.getElementById('" . $label_id[$key] . "_am_pm" . $id . "').value='" . $am_pm . "';\n    ";
                            }
                            break;
                        case "type_date_fields":
                            $form_maker_front_end .= "if(document.getElementById('" . $label_id[$key] . "_day" . $id . "'))\n    {\n      document.getElementById('" . $label_id[$key] . "_day" . $id . "').value='" . (isset($_POST[$label_id[$key] . "_day" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_day" . $id])) : "") . "';\n      document.getElementById('" . $label_id[$key] . "_month" . $id . "').value='" . (isset($_POST[$label_id[$key] . "_month" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_month" . $id])) : "") . "';\n      document.getElementById('" . $label_id[$key] . "_year" . $id . "').value='" . (isset($_POST[$label_id[$key] . "_year" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_year" . $id])) : "") . "';\n    }";
                            break;
                        case "type_date":
                        case "type_own_select":
                        case "type_country":
                            $form_maker_front_end .= "if(document.getElementById('" . $label_id[$key] . "_element" . $id . "'))\n      document.getElementById('" . $label_id[$key] . "_element" . $id . "').value='" . addslashes(isset($_POST[$label_id[$key] . "_element" . $id]) ? esc_html(stripslashes($_POST[$label_id[$key] . "_element" . $id])) : "") . "';\n    ";
                            break;
                        default:
                            break;
                    }
                }
            }
            $form_maker_front_end .= '	form_view_count' . $id . '=0;
    for(i=1; i<=30; i++)
    {
      if(document.getElementById(\'' . $id . 'form_view\'+i))
      {
        form_view_count' . $id . '++;
        form_view_max' . $id . '=i;
        document.getElementById(\'' . $id . 'form_view\'+i).parentNode.removeAttribute(\'style\');
      }
    }	
    if(form_view_count' . $id . '>1)
    {
      for(i=1; i<=form_view_max' . $id . '; i++)
      {
        if(document.getElementById(\'' . $id . 'form_view\'+i))
        {
          first_form_view' . $id . '=i;
          break;
        }
      }		
      generate_page_nav(first_form_view' . $id . ', \'' . $id . '\', form_view_count' . $id . ', form_view_max' . $id . ');
    }
    var RecaptchaOptions = {
  theme: "' . $row->recaptcha_theme . '"
  };
  </script>
  </form>';
            if ($is_recaptcha) {
                $form_maker_front_end .= '<div id="main_recaptcha" style="display:none;">';
                if ($row->public_key) {
                    $publickey = $row->public_key;
                } else {
                    $publickey = '0';
                }
                $error = NULL;
                require_once WD_FM_DIR . '/recaptchalib.php';
                $form_maker_front_end .= recaptcha_get_html($publickey, $error);
                $form_maker_front_end .= '</div>
      <script>
    recaptcha_html = document.getElementById(\'main_recaptcha\').innerHTML.replace(\'Recaptcha.widget = Recaptcha.$("recaptcha_widget_div"); Recaptcha.challenge_callback();\',"");
    document.getElementById(\'main_recaptcha\').innerHTML="";
    if (document.getElementById(\'wd_recaptcha' . $id . '\')) {
      document.getElementById(\'wd_recaptcha' . $id . '\').innerHTML=recaptcha_html;
      Recaptcha.widget = Recaptcha.$("recaptcha_widget_div");
      Recaptcha.challenge_callback();
    }
      </script>';
            }
        }
        return $form_maker_front_end;
    }
    public function display($form_id, $startdate, $enddate, $submit_date, $submitter_ip, $username, $useremail, $form_fields, $csv, $xml, $title, $search, $ordering, $entries, $views, $conversion_rate, $pagination, $stats)
    {
        require_once WD_FM_DIR . '/framework/WDW_FM_Library.php';
        $get_data = $this->model->showsubmissions($form_id, $startdate, $enddate, $submit_date, $submitter_ip, $username, $useremail, $form_fields, $csv, $xml, $title, $search, $ordering, $entries, $views, $conversion_rate, $pagination, $stats);
        if ($get_data === false) {
            echo WDW_FM_Library::message(__('You have no permission to view submissions.', 'form_maker'), 'warning');
            return;
        }
        $rows = $get_data["rows"];
        $lists = $get_data["lists"];
        $pageNav = $get_data["pageNav"];
        $labels = $get_data["sorted_labels"];
        $label_titles = $get_data["label_titles"];
        $group_id_s = $get_data["rows_ord"];
        $labels_id = $get_data["sorted_labels_id"];
        $sorted_labels_type = $get_data["sorted_labels_type"];
        $total_entries = $get_data["total_entries"];
        $total_views = $get_data["total_views"];
        $join_count = $get_data["join_count"];
        $form_title = $get_data["form_title"];
        $checked_ids = $get_data["checked_ids"];
        $stats_fields = $get_data["stats_fields"];
        $current_url = htmlentities($_SERVER['REQUEST_URI']);
        $order_by = isset($_POST['order_by']) ? esc_html(stripslashes($_POST['order_by'])) : 'group_id';
        $asc_or_desc = isset($_POST['asc_or_desc']) ? esc_html(stripslashes($_POST['asc_or_desc'])) : 'desc';
        $oder_class_default = "manage-column column-autor sortable desc";
        $oder_class = "manage-column column-title sorted " . $asc_or_desc;
        $other_fileds = array('submit_id', 'payment_info');
        foreach ($other_fileds as $other_filed) {
            ${$other_filed} = false;
        }
        if ($checked_ids) {
            $checked_ids = explode(',', $checked_ids);
            $checked_ids = array_slice($checked_ids, 0, count($checked_ids) - 1);
        } else {
            $checked_ids = array();
        }
        foreach ($other_fileds as $other_filed) {
            if (!in_array($other_filed, $checked_ids)) {
                ${$other_filed} = true;
            }
        }
        $is_paypal = $this->model->paypal_info($form_id);
        if (!$is_paypal) {
            $payment_info = false;
        }
        $label_titles_copy = $label_titles;
        $export_ids = "";
        if ($form_fields && $submit_id) {
            $export_ids .= "submit_id,";
        }
        if ($submit_date) {
            $export_ids .= "submit_date,";
        }
        if ($submitter_ip) {
            $export_ids .= "submitter_ip,";
        }
        if ($username) {
            $export_ids .= "username,";
        }
        if ($useremail) {
            $export_ids .= "useremail,";
        }
        for ($i = 0; $i < count($labels); $i++) {
            if ($form_fields && !in_array($labels_id[$i], $checked_ids)) {
                $export_ids .= $labels_id[$i] . ",";
            }
        }
        add_thickbox();
        ?>

  <script type="text/javascript">
    function fm_form_submit(event, form_id, task, id) {
      if (document.getElementById(form_id)) {
        document.getElementById(form_id).submit();
      }
      if (event.preventDefault) {
        event.preventDefault();
      }
      else {
        event.returnValue = false;
      }
    }
    function remove_all() {
      if(document.getElementById('startdate'))
        document.getElementById('startdate').value='';
      if(document.getElementById('enddate'))
        document.getElementById('enddate').value='';
      if(document.getElementById('ip_search'))
        document.getElementById('ip_search').value='';
      if(document.getElementById('username_search'))
        document.getElementById('username_search').value='';
      if(document.getElementById('useremail_search'))
        document.getElementById('useremail_search').value='';
      <?php 
        $n = count($rows);
        for ($i = 0; $i < count($labels); $i++) {
            echo "if(document.getElementById('" . $form_id . '_' . $labels_id[$i] . "_search'))\n          document.getElementById('" . $form_id . '_' . $labels_id[$i] . "_search').value='';";
        }
        ?>
    }
    function show_hide_filter() {
      if (document.getElementById('fields_filter').style.display == "none") {
        document.getElementById('fields_filter').style.display = '';
        document.getElementById('filter_img').src = '<?php 
        echo WD_FM_URL . '/images/filter_hide.png';
        ?>
';
      }
      else {
        document.getElementById('fields_filter').style.display = "none";
        document.getElementById('filter_img').src = '<?php 
        echo WD_FM_URL . '/images/filter_show.png';
        ?>
';
      }
    }
  </script>
    
    <form action="<?php 
        echo $current_url;
        ?>
" method="post" name="adminForm" id="adminForm">
      <input type="hidden" name="asc_or_desc" id="asc_or_desc" value="<?php 
        echo $asc_or_desc;
        ?>
" />
      <input type="hidden" name="order_by" id="order_by" value="<?php 
        echo $order_by;
        ?>
" />
      <input type="hidden" id="task" name="task" value="" />
      <div class="submission_params"> 
      <?php 
        if (isset($form_id) and $form_id > 0) {
            ?>
	
      <?php 
            if ($title) {
                ?>
      <div class="form_title"><strong><?php 
                echo $form_title;
                ?>
</strong></div>
      <?php 
            }
            ?>
      <div>
        <?php 
            if ($entries) {
                ?>
          <div class="reports" style="width: 80px;"><strong><?php 
                echo __('Entries', 'form_maker');
                ?>
</strong><br /><?php 
                echo $total_entries;
                ?>
</div>
        <?php 
            }
            if ($views) {
                ?>
          <div class="reports" style="width: 80px;"><strong><?php 
                echo __('Views', 'form_maker');
                ?>
</strong><br /><?php 
                echo $total_views;
                ?>
</div>
        <?php 
            }
            if ($conversion_rate) {
                ?>
          <div class="reports" style="width: 130px;"><strong><?php 
                echo __('Conversion Rate', 'form_maker');
                ?>
</strong><br /><?php 
                if ($total_views) {
                    echo round($total_entries / $total_views * 100, 2) . '%';
                } else {
                    echo '0%';
                }
                ?>
</div>
        <?php 
            }
            if ($csv || $xml) {
                ?>
          <div <?php 
                echo $entries || $views || $conversion_rate ? 'class="csv_xml"' : '';
                ?>
>
          <?php 
                echo __('Export to', 'form_maker');
                ?>
          <?php 
                if ($csv) {
                    ?>
          <input type="button" value="CSV" onclick="window.location='<?php 
                    echo add_query_arg(array('action' => 'frontend_generate_csv', 'page' => 'form_submissions', 'id' => $form_id, 'checked_ids' => $export_ids, 'from' => $startdate, 'to' => $enddate), admin_url('admin-ajax.php'));
                    ?>
'" />&nbsp;
          <?php 
                }
                ?>
          <?php 
                if ($xml) {
                    ?>
          <input type="button" value="XML" onclick="window.location='<?php 
                    echo add_query_arg(array('action' => 'frontend_generate_xml', 'page' => 'form_submissions', 'id' => $form_id, 'checked_ids' => $export_ids, 'from' => $startdate, 'to' => $enddate), admin_url('admin-ajax.php'));
                    ?>
'" />&nbsp;
          <?php 
                }
                ?>
          </div>
        <?php 
            }
            ?>
	
      </div>
      <?php 
            if ($search || $pagination) {
                ?>
      <div class="search_and_pagination">
        <?php 
                if ($search) {
                    ?>
        <div>
          <input type="hidden" name="hide_label_list" value="<?php 
                    echo $lists['hide_label_list'];
                    ?>
" /> 
          <img id="filter_img" src="<?php 
                    echo WD_FM_URL . '/images/filter_show.png';
                    ?>
" width="40" style="vertical-align:middle; cursor:pointer" onclick="show_hide_filter()"  title="Search by fields" />
          <input type="button" onclick="this.form.submit();" style="vertical-align:middle; cursor:pointer" value="<?php 
                    echo __('GO', 'form_maker');
                    ?>
" />	
          <input type="button" onclick="remove_all();this.form.submit();" style="vertical-align:middle; cursor:pointer" value="<?php 
                    echo __('Reset', 'form_maker');
                    ?>
" />
        </div>
        <div>
        <?php 
                    if ($join_count) {
                        echo $total_entries - $join_count . ' ' . __('of', 'form_maker') . ' ' . $total_entries . ' ' . __('submissions are not shown, as the field you sorted by is missing in those submissions.', 'form_maker');
                    }
                    ?>
        </div>
        <?php 
                }
                ?>
        <?php 
                if ($pagination) {
                    ?>
        <div class="tablenav top">
          <?php 
                    WDW_FM_Library::html_page_nav($lists['total'], $lists['limit'], 'adminForm');
                    ?>
        </div>  
        <?php 
                }
                ?>
      </div>
      <?php 
            }
            ?>
      <?php 
        }
        ?>
      </div>

      <div style="overflow-x:scroll;">
        <table class="submissions" width="100%">
        <thead>
          <tr>
            <th width="3%"><?php 
        echo '#';
        ?>
</th>
            <?php 
        if ($form_fields && $submit_id) {
            echo '<th width="4%" class="submitid_fc"';
            if (!(strpos($lists['hide_label_list'], '@submitid@') === false)) {
                echo 'style="display:none;"';
            }
            echo '>';
            if ($ordering) {
                echo '<a href="" onclick="document.getElementById(\'order_by\').value = \'group_id\'; document.getElementById(\'asc_or_desc\').value = \'' . ($order_by == "group_id" && $asc_or_desc == 'asc' ? 'desc' : 'asc') . '\'; fm_form_submit(event, \'adminForm\');">
                  <span>Id</span>
                  <span>' . ($order_by == "group_id" ? $asc_or_desc == "asc" ? "&#x25B2;" : "&#x25BC;" : "") . '</span>
                </a>';
            } else {
                echo 'Id';
            }
            echo '</th>';
        }
        if ($submit_date) {
            echo '<th width="150" align="center" class="submitdate_fc"';
            if (!(strpos($lists['hide_label_list'], '@submitdate@') === false)) {
                echo 'style="display:none;"';
            }
            echo '>';
            if ($ordering) {
                echo '<a href="" onclick="document.getElementById(\'order_by\').value = \'date\'; document.getElementById(\'asc_or_desc\').value = \'' . ($order_by == "date" && $asc_or_desc == 'asc' ? 'desc' : 'asc') . '\'; fm_form_submit(event, \'adminForm\');">
                  <span>Submit date</span>
                  <span>' . ($order_by == "date" ? $asc_or_desc == "asc" ? "&#x25B2;" : "&#x25BC;" : "") . '</span>
                </a>';
            } else {
                echo 'Submit Date';
            }
            echo '</th>';
        }
        if ($submitter_ip) {
            echo '<th width="100" align="center" class="submitterip_fc"';
            if (!(strpos($lists['hide_label_list'], '@submitterip@') === false)) {
                echo 'style="display:none;"';
            }
            echo '>';
            if ($ordering) {
                echo '<a href="" onclick="document.getElementById(\'order_by\').value = \'ip\'; document.getElementById(\'asc_or_desc\').value = \'' . ($order_by == "ip" && $asc_or_desc == 'asc' ? 'desc' : 'asc') . '\'; fm_form_submit(event, \'adminForm\');">
                  <span>Submitter\'s IP Address</span>
                  <span>' . ($order_by == "ip" ? $asc_or_desc == "asc" ? "&#x25B2;" : "&#x25BC;" : "") . '</span>
                </a>';
            } else {
                echo 'Submitter\'s IP Address';
            }
            echo '</th>';
        }
        if ($username) {
            echo '<th width="100" class="submitterusername_fc"';
            if (!(strpos($lists['hide_label_list'], '@submitterusername@') === false)) {
                echo 'style="display:none;"';
            }
            echo '>';
            if ($ordering) {
                echo '<a href="" onclick="document.getElementById(\'order_by\').value = \'display_name\'; document.getElementById(\'asc_or_desc\').value = \'' . ($order_by == "display_name" && $asc_or_desc == 'asc' ? 'desc' : 'asc') . '\'; fm_form_submit(event, \'adminForm\');">
                  <span>Submitter\'s Username</span>
                  <span>' . ($order_by == "display_name" ? $asc_or_desc == "asc" ? "&#x25B2;" : "&#x25BC;" : "") . '</span>
                </a>';
            } else {
                echo 'Submitter\'s Username';
            }
            echo '</th>';
        }
        if ($useremail) {
            echo '<th width="100" class="submitteremail_fc"';
            if (!(strpos($lists['hide_label_list'], '@submitteremail@') === false)) {
                echo 'style="display:none;"';
            }
            echo '>';
            if ($ordering) {
                echo '<a href="" onclick="document.getElementById(\'order_by\').value = \'user_email\'; document.getElementById(\'asc_or_desc\').value = \'' . ($order_by == "user_email" && $asc_or_desc == 'asc' ? 'desc' : 'asc') . '\'; fm_form_submit(event, \'adminForm\');">
                  <span>Submitter\'s Email Address</span>
                  <span>' . ($order_by == "user_email" ? $asc_or_desc == "asc" ? "&#x25B2;" : "&#x25BC;" : "") . '</span>
                </a>';
            } else {
                echo 'Submitter\'s Email Address';
            }
            echo '</th>';
        }
        $n = count($rows);
        $ispaypal = false;
        for ($i = 0; $i < count($labels); $i++) {
            if ($form_fields && !in_array($labels_id[$i], $checked_ids)) {
                if (strpos($lists['hide_label_list'], '@' . $labels_id[$i] . '@') === false) {
                    $styleStr = '';
                } else {
                    $styleStr = 'style="display:none;"';
                }
                $field_title = $label_titles_copy[$i];
                if ($sorted_labels_type[$i] == 'type_paypal_payment_status') {
                    $ispaypal = true;
                }
                echo '<th align="center" class="' . $labels_id[$i] . '_fc" ' . $styleStr . '>';
                if ($ordering) {
                    echo '<a href="" onclick="document.getElementById(\'order_by\').value = \'' . $labels_id[$i] . '_field\'; document.getElementById(\'asc_or_desc\').value = \'' . ($order_by == $labels_id[$i] . '_field' && $asc_or_desc == 'asc' ? 'desc' : 'asc') . '\'; fm_form_submit(event, \'adminForm\');">
                    <span>' . $field_title . '</span>
                    <span>' . ($order_by == $labels_id[$i] . "_field" ? $asc_or_desc == "asc" ? "&#x25B2;" : "&#x25BC;" : "") . '</span>
                  </a>';
                } else {
                    echo $field_title;
                }
                echo '</th>';
            }
        }
        if ($form_fields && $payment_info) {
            if (strpos($lists['hide_label_list'], '@payment_info@') === false) {
                $styleStr2 = 'aa';
            } else {
                $styleStr2 = 'style="display:none;"';
            }
            echo '<th class="payment_info_fc" ' . $styleStr2 . '>Payment Info</th>';
        }
        ?>

          </tr>
          <tr id="fields_filter" style="display:none">
            <th width="3%"></th>
            <?php 
        if ($form_fields && $submit_id) {
            ?>
            <th width="4%" class="submitid_fc" <?php 
            if (!(strpos($lists['hide_label_list'], '@submitid@') === false)) {
                echo 'style="display:none;"';
            }
            ?>
 ></th>
            <?php 
        }
        if ($submit_date) {
            ?>
            <th class="submitdate_fc" style="text-align:left; <?php 
            if (!(strpos($lists['hide_label_list'], '@submitdate@') === false)) {
                echo 'display:none;';
            }
            ?>
" align="center"> 
            <table class="simple_table">
              <tr>
                <td><?php 
            echo __('From', 'form_maker');
            ?>
:</td>
                <td><input class="inputbox" type="text" name="startdate" id="startdate" size="10" maxlength="10" value="<?php 
            echo $lists['startdate'];
            ?>
" /> </td>
                <td><input type="reset" class="button" value="..." name="startdate_but" id="startdate_but" onclick="return showCalendar('startdate','%Y-%m-%d');"/> </td>
              </tr>
              <tr>
                <td><?php 
            echo __('To', 'form_maker');
            ?>
:</td>
                <td><input class="inputbox" type="text" name="enddate" id="enddate" size="10" maxlength="10" value="<?php 
            echo $lists['enddate'];
            ?>
" /> </td>
                <td><input type="reset" class="button" value="..." name="enddate_but" id="enddate_but" onclick="return showCalendar('enddate','%Y-%m-%d');"/></td>
              </tr>
            </table>
            
            </th>
            <?php 
        }
        if ($submitter_ip) {
            ?>
            <th class="submitterip_fc"  <?php 
            if (!(strpos($lists['hide_label_list'], '@submitterip@') === false)) {
                echo 'style="display:none;"';
            }
            ?>
>
             <input class="inputbox" type="text" name="ip_search" id="ip_search" value="<?php 
            echo $lists['ip_search'];
            ?>
" onChange="this.form.submit();" style="width:96%"/>
            </th>
            <?php 
        }
        if ($username) {
            ?>
		
            <th width="100"class="submitterusername_fc"  <?php 
            if (!(strpos($lists['hide_label_list'], '@submitterusername@') === false)) {
                echo 'style="display:none;"';
            }
            ?>
>
               <input class="inputbox" type="text" name="username_search" id="username_search" value="<?php 
            echo $lists['username_search'];
            ?>
" onChange="this.form.submit();" style="width:150px"/>
              </th>
            <?php 
        }
        if ($useremail) {
            ?>
		
              <th width="100"class="submitteremail_fc"  <?php 
            if (!(strpos($lists['hide_label_list'], '@submitteremail@') === false)) {
                echo 'style="display:none;"';
            }
            ?>
>
               <input class="inputbox" type="text" name="useremail_search" id="useremail_search" value="<?php 
            echo $lists['useremail_search'];
            ?>
" onChange="this.form.submit();" style="width:150px"/>
              </th>
            <?php 
        }
        $ka_fielderov_search = false;
        if ($lists['ip_search'] || $lists['startdate'] || $lists['enddate'] || $lists['username_search'] || $lists['useremail_search']) {
            $ka_fielderov_search = true;
        }
        for ($i = 0; $i < count($labels); $i++) {
            if (strpos($lists['hide_label_list'], '@' . $labels_id[$i] . '@') === false) {
                $styleStr = '';
            } else {
                $styleStr = 'style="display:none;"';
            }
            if (!$ka_fielderov_search) {
                if ($lists[$form_id . '_' . $labels_id[$i] . '_search']) {
                    $ka_fielderov_search = true;
                }
            }
            if ($form_fields && !in_array($labels_id[$i], $checked_ids)) {
                switch ($sorted_labels_type[$i]) {
                    case 'type_mark_map':
                        echo '<th class="' . $labels_id[$i] . '_fc" ' . $styleStr . '>' . '</th>';
                        break;
                    case 'type_paypal_payment_status':
                        echo '<th class="' . $labels_id[$i] . '_fc" ' . $styleStr . '>';
                        ?>
                  <select name="<?php 
                        echo $form_id . '_' . $labels_id[$i];
                        ?>
_search" id="<?php 
                        echo $form_id . '_' . $labels_id[$i];
                        ?>
_search" onChange="this.form.submit();" value="<?php 
                        echo $lists[$form_id . '_' . $labels_id[$i] . '_search'];
                        ?>
" >
                    <option value="" ></option>
                    <option value="canceled" ><?php 
                        echo __('Canceled', 'form_maker');
                        ?>
</option>
                    <option value="cleared" ><?php 
                        echo __('Cleared', 'form_maker');
                        ?>
</option>
                    <option value="cleared by payment review" ><?php 
                        echo __('Cleared by payment review', 'form_maker');
                        ?>
</option>
                    <option value="completed" ><?php 
                        echo __('Completed', 'form_maker');
                        ?>
</option>
                    <option value="denied" ><?php 
                        echo __('Denied', 'form_maker');
                        ?>
</option>
                    <option value="failed" ><?php 
                        echo __('Failed', 'form_maker');
                        ?>
</option>
                    <option value="held" ><?php 
                        echo __('Held', 'form_maker');
                        ?>
</option>
                    <option value="in progress" ><?php 
                        echo __('In progress', 'form_maker');
                        ?>
</option>
                    <option value="on hold" ><?php 
                        echo __('On hold', 'form_maker');
                        ?>
</option>
                    <option value="paid" ><?php 
                        echo __('Paid', 'form_maker');
                        ?>
</option>
                    <option value="partially refunded" ><?php 
                        echo __('Partially refunded', 'form_maker');
                        ?>
</option>
                    <option value="pending verification" ><?php 
                        echo __('Pending verification', 'form_maker');
                        ?>
</option>
                    <option value="placed" ><?php 
                        echo __('Placed', 'form_maker');
                        ?>
</option>
                    <option value="processing" ><?php 
                        echo __('Processing', 'form_maker');
                        ?>
</option>
                    <option value="refunded" ><?php 
                        echo __('Refunded', 'form_maker');
                        ?>
</option>
                    <option value="refused" ><?php 
                        echo __('Refused', 'form_maker');
                        ?>
</option>
                    <option value="removed" ><?php 
                        echo __('Removed', 'form_maker');
                        ?>
</option>
                    <option value="returned" ><?php 
                        echo __('Returned', 'form_maker');
                        ?>
</option>
                    <option value="reversed" ><?php 
                        echo __('Reversed', 'form_maker');
                        ?>
</option>
                    <option value="temporary hold" ><?php 
                        echo __('Temporary hold', 'form_maker');
                        ?>
</option>
                    <option value="unclaimed" ><?php 
                        echo __('Unclaimed', 'form_maker');
                        ?>
</option>
                  </select>	
                  <script> 
                    var element = document.getElementById('<?php 
                        echo $form_id . '_' . $labels_id[$i];
                        ?>
_search');
                    element.value = '<?php 
                        echo $lists[$form_id . '_' . $labels_id[$i] . '_search'];
                        ?>
';
                  </script>
                  <?php 
                        echo '</th>';
                        break;
                    default:
                        echo '<th class="' . $labels_id[$i] . '_fc" ' . $styleStr . '>' . '<input name="' . $form_id . '_' . $labels_id[$i] . '_search" id="' . $form_id . '_' . $labels_id[$i] . '_search" class="inputbox" type="text" value="' . $lists[$form_id . '_' . $labels_id[$i] . '_search'] . '"  onChange="this.form.submit();" style="width:96%">' . '</th>';
                        break;
                }
            }
        }
        if ($form_fields && $payment_info) {
            if (strpos($lists['hide_label_list'], '@payment_info@') === false) {
                $styleStr2 = '';
            } else {
                $styleStr2 = 'style="display:none;"';
            }
            echo '<th class="payment_info_fc" ' . $styleStr2 . '></th>';
        }
        ?>
          </tr>
        </thead>
        <?php 
        $k = 0;
        $m = count($labels);
        for ($www = 0, $qqq = count($group_id_s); $www < $qqq; $www++) {
            $i = $group_id_s[$www];
            $temp = array();
            for ($j = 0; $j < $n; $j++) {
                $row =& $rows[$j];
                if ($row->group_id == $i) {
                    array_push($temp, $row);
                }
            }
            $f = $temp[0];
            $date = $f->date;
            $ip = $f->ip;
            $user_id = get_userdata($f->user_id_wd);
            $user_name = $user_id ? $user_id->display_name : "";
            $user_email = $user_id ? $user_id->user_email : "";
            ?>
        
          <tr class="<?php 
            echo "row{$k}";
            ?>
">
            <td align="center"><?php 
            echo $www + 1 + ($lists['limit'] - 1) * 20;
            ?>
</td>		 
            <?php 
            if ($form_fields && $submit_id) {
                if (strpos($lists['hide_label_list'], '@submitid@') === false) {
                    echo '<td align="center" class="submitid_fc">' . $f->group_id . '</td>';
                } else {
                    echo '<td align="center" class="submitid_fc" style="display:none;">' . $f->group_id . '</td>';
                }
            }
            if ($submit_date) {
                if (strpos($lists['hide_label_list'], '@submitdate@') === false) {
                    echo '<td align="center" class="submitdate_fc">' . $date . '</td>';
                } else {
                    echo '<td align="center" class="submitdate_fc" style="display:none;">' . $date . '</td>';
                }
            }
            if ($submitter_ip) {
                if (strpos($lists['hide_label_list'], '@submitterip@') === false) {
                    echo '<td align="center" class="submitterip_fc">' . $ip . '</td>';
                } else {
                    echo '<td align="center" class="submitterip_fc" style="display:none;">' . $ip . '</td>';
                }
            }
            if ($username) {
                if (strpos($lists['hide_label_list'], '@submitterusername@') === false) {
                    echo '<td align="center" class="submitterusername_fc" style="display:table-cell;">' . $user_name . '</td>';
                } else {
                    echo '<td align="center" class="submitterusername_fc" style="display:none;">' . $user_name . '</td>';
                }
            }
            if ($useremail) {
                if (strpos($lists['hide_label_list'], '@submitteremail@') === false) {
                    echo '<td align="center" class="submitteremail_fc" style="display:table-cell;">' . $user_email . '</td>';
                } else {
                    echo '<td align="center" class="submitteremail_fc" style="display:none;">' . $user_email . '</td>';
                }
            }
            $ttt = count($temp);
            for ($h = 0; $h < $m; $h++) {
                if ($form_fields && !in_array($labels_id[$h], $checked_ids)) {
                    $not_label = true;
                    for ($g = 0; $g < $ttt; $g++) {
                        $t = $temp[$g];
                        if (strpos($lists['hide_label_list'], '@' . $labels_id[$h] . '@') === false) {
                            $styleStr = '';
                        } else {
                            $styleStr = 'style="display:none;"';
                        }
                        if ($t->element_label == $labels_id[$h]) {
                            if (strpos($t->element_value, "***map***")) {
                                $map_params = explode('***map***', $t->element_value);
                                $longit = $map_params[0];
                                $latit = $map_params[1];
                                echo '<td align="center" class="' . $labels_id[$h] . '_fc" ' . $styleStr . '><a class="thickbox-preview" href="' . add_query_arg(array('action' => 'frontend_show_map', 'page' => 'form_submissions', 'long' => $longit, 'lat' => $latit, 'width' => '620', 'height' => '550', 'TB_iframe' => '1'), admin_url('admin-ajax.php')) . '" title="' . __('Show on Map', 'form_maker') . '">' . __('Show on Map', 'form_maker') . '</a></td>';
                            } else {
                                if (strpos($t->element_value, "*@@url@@*")) {
                                    echo '<td align="center" class="' . $labels_id[$h] . '_fc" ' . $styleStr . '>';
                                    $new_files = explode("*@@url@@*", $t->element_value);
                                    foreach ($new_files as $new_file) {
                                        if ($new_file) {
                                            $new_filename = explode('/', $new_file);
                                            $new_filename = $new_filename[count($new_filename) - 1];
                                            if (strpos(strtolower($new_filename), 'jpg') !== false or strpos(strtolower($new_filename), 'png') !== false or strpos(strtolower($new_filename), 'gif') !== false or strpos(strtolower($new_filename), 'jpeg') !== false) {
                                                echo '<a href="' . $new_file . '" class="modal">' . $new_filename . "</a></br>";
                                            } else {
                                                echo '<a target="_blank" href="' . $new_file . '">' . $new_filename . "</a></br>";
                                            }
                                        }
                                    }
                                    echo "</td>";
                                } else {
                                    if (strpos($t->element_value, "@@@") > -1 || $t->element_value == "@@@" || $t->element_value == "@@@@@@@@@" || $t->element_value == "::" || $t->element_value == ":" || $t->element_value == "--") {
                                        echo '<td align="center" class="' . $labels_id[$h] . '_fc" ' . $styleStr . '><pre style="font-family:inherit">' . str_replace(array("@@@", ":", "-"), " ", $t->element_value) . '</pre></td>';
                                    } else {
                                        if (strpos($t->element_value, "***grading***")) {
                                            $new_filename = str_replace("***grading***", '', $t->element_value);
                                            $grading = explode(":", $new_filename);
                                            $items_count = sizeof($grading) - 1;
                                            $items = "";
                                            $total = "";
                                            for ($k = 0; $k < $items_count / 2; $k++) {
                                                $items .= $grading[$items_count / 2 + $k] . ": " . $grading[$k] . "</br>";
                                                $total += $grading[$k];
                                            }
                                            $items .= __('Total', 'form_maker') . ": " . $total;
                                            echo '<td align="center" class="' . $labels_id[$h] . '_fc" ' . $styleStr . '><pre style="font-family:inherit">' . $items . '</pre></td>';
                                        } else {
                                            if (strpos($t->element_value, "***matrix***")) {
                                                echo '<td align="center" class="' . $labels_id[$h] . '_fc" ' . $styleStr . '><a class="thickbox-preview" href="' . add_query_arg(array('action' => 'frontend_show_matrix', 'page' => 'form_submissions', 'matrix_params' => $t->element_value, 'width' => '620', 'height' => '550', 'TB_iframe' => '1'), admin_url('admin-ajax.php')) . '" title="' . __('Show Matrix', 'form_maker') . '">' . __('Show Matrix', 'form_maker') . '</a></td>';
                                            } else {
                                                if (strpos($t->element_value, "***quantity***")) {
                                                    $t->element_value = str_replace("***quantity***", " ", $t->element_value);
                                                }
                                                if (strpos($t->element_value, "***property***")) {
                                                    $t->element_value = str_replace("***property***", " ", $t->element_value);
                                                }
                                                echo '<td align="center" class="' . $labels_id[$h] . '_fc" ' . $styleStr . '><pre style="font-family:inherit; white-space: pre;">' . str_replace("***br***", '<br>', $t->element_value) . '</pre></td>';
                                            }
                                        }
                                    }
                                }
                            }
                            $not_label = false;
                        }
                    }
                    if ($not_label) {
                        echo '<td align="center" class="' . $labels_id[$h] . '_fc" ' . $styleStr . '></td>';
                    }
                }
            }
            if ($form_fields && $payment_info) {
                if (strpos($lists['hide_label_list'], '@payment_info@') === false) {
                    $styleStr = '';
                } else {
                    $styleStr = 'style="display:none;"';
                }
                echo '<td align="center" class="payment_info_fc" ' . $styleStr . '>		
              <a class="thickbox-preview" href="' . add_query_arg(array('action' => 'frontend_paypal_info', 'page' => 'form_submissions', 'id' => $i, 'width' => '600', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php')) . '">
                  <img src="' . WD_FM_URL . '/images/info.png" />
                </a></td>';
            }
            ?>
          </tr>
          <?php 
            $k = 1 - $k;
        }
        ?>
        </table>
      </div>
      <?php 
        $is_stats = false;
        if ($stats) {
            foreach ($sorted_labels_type as $key => $label_type) {
                if ($label_type == "type_checkbox" || $label_type == "type_radio" || $label_type == "type_own_select" || $label_type == "type_country" || $label_type == "type_paypal_select" || $label_type == "type_paypal_radio" || $label_type == "type_paypal_checkbox" || $label_type == "type_paypal_shipping") {
                    $is_stats = true;
                    break;
                }
            }
            if ($is_stats) {
                ?>
          <br><br>
          <h1 style="border-bottom: 1px solid; color:#000 !important;"><?php 
                echo __('Statistics', 'form_maker');
                ?>
</h1>
          <table class="stats">
            <tr valign="top">
              <td class="key" style="vertical-align: middle;">
                <label> <?php 
                echo __('Select a Field', 'form_maker');
                ?>
: </label>
              </td>
              <td>
                <select id="stat_id">
                <option value=""><?php 
                echo __('Select a Field', 'form_maker');
                ?>
</option>;
                <?php 
                $stats_fields = explode(',', $stats_fields);
                $stats_fields = array_slice($stats_fields, 0, count($stats_fields) - 1);
                foreach ($sorted_labels_type as $key => $label_type) {
                    if (($label_type == "type_checkbox" || $label_type == "type_radio" || $label_type == "type_own_select" || $label_type == "type_country" || $label_type == "type_paypal_select" || $label_type == "type_paypal_radio" || $label_type == "type_paypal_checkbox" || $label_type == "type_paypal_shipping") && !in_array($labels_id[$key], $stats_fields)) {
                        echo '<option value="' . $labels_id[$key] . '">' . $label_titles_copy[$key] . '</option>';
                    }
                }
                ?>
                </select>
              </td>
            </tr>
            <tr valign="middle">
              <td class="key" style="vertical-align: middle;">
                <label> <?php 
                echo __('Select a Date', 'form_maker');
                ?>
: </label>
              </td>
              <td>
                <?php 
                echo __('From', 'form_maker');
                ?>
:<input class="inputbox" type="text" name="startstats" id="startstats" size="10" maxlength="10" />
                  <input type="reset" class="button" value="..." name="startstats_but" id="startstats_but" onclick="return showCalendar('startstats','%Y-%m-%d');"/> 
                <?php 
                echo __('To', 'form_maker');
                ?>
: <input class="inputbox" type="text" name="endstats" id="endstats" size="10" maxlength="10" />
                  <input type="reset" class="button" value="..." name="endstats_but" id="endstats_but" onclick="return showCalendar('endstats','%Y-%m-%d');"/>
              </td>
            </tr>
            <tr valign="top">
              <td class="key" style="vertical-align: middle;" colspan="2">
              <input type="button" onclick="show_stats()" style="vertical-align:middle; cursor:pointer" value="<?php 
                echo __('Show', 'form_maker');
                ?>
">
              </td>
            </tr>			
          </table>
          <div id="div_stats"></div>
          <?php 
            }
        }
        ?>
    </form>    
    
    <script> 
      jQuery(window).load(function() {
        fm_popup();
        if (typeof jQuery().fancybox !== 'undefined' && jQuery.isFunction(jQuery().fancybox)) {
          jQuery(".fm_fancybox").fancybox({
            'maxWidth ' : 600,
            'maxHeight' : 500
          });
        }
      });
      function show_stats() {
        jQuery('#div_stats').html('<div id="saving"><div id="saving_text">Loading</div><div id="fadingBarsG"><div id="fadingBarsG_1" class="fadingBarsG"></div><div id="fadingBarsG_2" class="fadingBarsG"></div><div id="fadingBarsG_3" class="fadingBarsG"></div><div id="fadingBarsG_4" class="fadingBarsG"></div><div id="fadingBarsG_5" class="fadingBarsG"></div><div id="fadingBarsG_6" class="fadingBarsG"></div><div id="fadingBarsG_7" class="fadingBarsG"></div><div id="fadingBarsG_8" class="fadingBarsG"></div></div></div>');
        if(jQuery('#stat_id').val() != "") {
          jQuery('#div_stats').load('<?php 
        echo add_query_arg(array('action' => 'get_frontend_stats', 'page' => 'form_submissions'), admin_url('admin-ajax.php'));
        ?>
', {
            'form_id' : '<?php 
        echo $form_id;
        ?>
',
            'stat_id' : jQuery('#stat_id').val(),
            'startdate' : jQuery('#startstats').val(), 
            'enddate' : jQuery('#endstats').val()
          });
        }		
        else
          jQuery('#div_stats').html("<?php 
        echo __('Please select the field!', 'form_maker');
        ?>
")
      }
      function fm_popup(id) {
        if (typeof id === 'undefined') {
          var id = '';
        }
        var thickDims, tbWidth, tbHeight;
            thickDims = function() {
              var tbWindow = jQuery('#TB_window'), H = jQuery(window).height(), W = jQuery(window).width(), w, h;
              w = (tbWidth && tbWidth < W - 90) ? tbWidth : W - 40;
              h = (tbHeight && tbHeight < H - 60) ? tbHeight : H - 40;
              if (tbWindow.size()) {
                tbWindow.width(w).height(h);
                jQuery('#TB_iframeContent').width(w).height(h - 27);
                tbWindow.css({'margin-left': '-' + parseInt((w / 2),10) + 'px'});
                if (typeof document.body.style.maxWidth != 'undefined') {
                  tbWindow.css({'top':(H-h)/2,'margin-top':'0'});
                }
              }
            };
        thickDims();
        jQuery(window).resize(function() { thickDims() });
        jQuery('a.thickbox-preview' + id).click( function() {
          tb_click.call(this);
          var alink = jQuery(this).parents('.available-theme').find('.activatelink'), link = '', href = jQuery(this).attr('href'), url, text;
          if (tbWidth = href.match(/&width=[0-9]+/)) {
            tbWidth = parseInt(tbWidth[0].replace(/[^0-9]+/g, ''), 10);
          }
          else {
            tbWidth = jQuery(window).width() - 120;
          }
          
          if (tbHeight = href.match(/&height=[0-9]+/)) {
            tbHeight = parseInt(tbHeight[0].replace(/[^0-9]+/g, ''), 10);
          }
          else {
            tbHeight = jQuery(window).height() - 120;
          }
          if (alink.length) {
            url = alink.attr('href') || '';
            text = alink.attr('title') || '';
            link = '&nbsp; <a href="' + url + '" target="_top" class="tb-theme-preview-link">' + text + '</a>';
          }
          else {
            text = jQuery(this).attr('title') || '';
            link = '&nbsp; <span class="tb-theme-preview-link">' + text + '</span>';
          }
          jQuery('#TB_title').css({'background-color':'#222','color':'#dfdfdf'});
          jQuery('#TB_closeAjaxWindow').css({'float':'right'});
          jQuery('#TB_ajaxWindowTitle').css({'float':'left'}).html(link);
          jQuery('#TB_iframeContent').width('100%');
          thickDims();
          return false;
        });

        jQuery('.theme-detail').click(function () {
          jQuery(this).siblings('.themedetaildiv').toggle();
          return false;
        });
      }
      <?php 
        if ($ka_fielderov_search) {
            ?>
 
        document.getElementById('fields_filter').style.display = '';
        document.getElementById('filter_img').src = '<?php 
            echo WD_FM_URL . '/images/filter_hide.png';
            ?>
';
        <?php 
        }
        ?>
    </script>
    <?php 
    }
示例#10
0
    public function display()
    {
        $rows_data = $this->model->get_rows_data();
        $page_nav = $this->model->page_nav();
        $search_value = isset($_POST['search_value']) ? esc_html($_POST['search_value']) : '';
        $search_select_value = isset($_POST['search_select_value']) ? (int) $_POST['search_select_value'] : 0;
        $asc_or_desc = isset($_POST['asc_or_desc']) && $_POST['asc_or_desc'] == 'desc' ? 'desc' : 'asc';
        $order_by_array = array('id', 'title', 'default');
        $order_by = isset($_POST['order_by']) && in_array(esc_html(stripslashes($_POST['order_by'])), $order_by_array) ? esc_html(stripslashes($_POST['order_by'])) : 'id';
        $order_class = 'manage-column column-title sorted ' . $asc_or_desc;
        $ids_string = '';
        ?>
    <div class="fm-user-manual">
		This section allows you to create, edit form themes.
		<a style="color: blue; text-decoration: none;" target="_blank" href="https://web-dorado.com/wordpress-form-maker-guide-2.html">Read More in User Manual</a>
	</div>
	<div class="fm-upgrade-pro">
		<a target="_blank" href="https://web-dorado.com/files/fromFormMaker.php">
			<div class="fm-upgrade-img">
				UPGRADE TO PRO VERSION 
				<span></span>
			</div>
		</a>
	</div>
	<div class="fm-clear"></div>
    <form class="wrap" id="themes_form" method="post" action="admin.php?page=themes_fm" style="width:99%;">
		<?php 
        wp_nonce_field('nonce_fm', 'nonce_fm');
        ?>
		<div class="fm-page-banner themes-banner">
			<div class="theme_icon">
			</div>
			<div class="fm-logo-title">Themes</div>
			<button class="fm-button add-button medium" style="margin-left: 31px;" onclick="fm_set_input_value('task', 'add'); fm_form_submit(event, 'themes_form');">
				<span></span>
				Add New
			</button>
			<div class="fm-page-actions">
				<button class="fm-button delete-button small" onclick="if (confirm('Do you want to delete selected item(s)?')) { fm_set_input_value('task', 'delete_all'); } else { return false; }">
					<span></span>
					Delete
				</button>
			</div>
		</div>	
		<div class="fm-clear"></div>		
		<div class="tablenav top">
			<?php 
        WDW_FM_Library::search('Title', $search_value, 'themes_form');
        WDW_FM_Library::html_page_nav($page_nav['total'], $page_nav['limit'], 'themes_form');
        ?>
		</div>
		<table class="wp-list-table widefat fixed pages">
			<thead>
				<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="fm_set_input_value('task', ''); fm_set_input_value('order_by', 'id'); fm_set_input_value('asc_or_desc', '<?php 
        echo $order_by == 'id' && $asc_or_desc == 'asc' ? 'desc' : 'asc';
        ?>
'); fm_form_submit(event, 'themes_form')" href="">
					<span>ID</span><span class="sorting-indicator"></span></a>
				</th>
				<th class="<?php 
        if ($order_by == 'title') {
            echo $order_class;
        }
        ?>
">
					<a onclick="fm_set_input_value('task', ''); fm_set_input_value('order_by', 'title'); fm_set_input_value('asc_or_desc', '<?php 
        echo $order_by == 'title' && $asc_or_desc == 'asc' ? 'desc' : 'asc';
        ?>
'); fm_form_submit(event, 'themes_form')" href="">
					<span>Title</span><span class="sorting-indicator"></span></a>
				</th>
				<th class="table_big_col <?php 
        if ($order_by == 'default') {
            echo $order_class;
        }
        ?>
">
					<a onclick="fm_set_input_value('task', ''); fm_set_input_value('order_by', 'default'); fm_set_input_value('asc_or_desc', '<?php 
        echo $order_by == 'default' && $asc_or_desc == 'asc' ? 'desc' : 'asc';
        ?>
'); fm_form_submit(event, 'themes_form')" href="">
					<span>Default</span><span class="sorting-indicator"></span></a>
				</th>
				<th class="table_small_col">Edit</th>
				<th class="table_small_col">Delete</th>
			</thead>
			<tbody id="tbody_arr">
			<?php 
        if ($rows_data) {
            foreach ($rows_data as $row_data) {
                $alternate = !isset($alternate) || $alternate == 'class="alternate"' ? '' : 'class="alternate"';
                $default_image = $row_data->default ? 'default' : 'notdefault';
                $default = $row_data->default ? '' : 'setdefault';
                ?>
						<tr id="tr_<?php 
                echo $row_data->id;
                ?>
" <?php 
                echo $alternate;
                ?>
>
							<td class="table_small_col check-column">
								<input id="check_<?php 
                echo $row_data->id;
                ?>
" name="check_<?php 
                echo $row_data->id;
                ?>
" type="checkbox"/>
							</td>
							<td class="table_small_col"><?php 
                echo $row_data->id;
                ?>
</td>
							<td>
								<a onclick="fm_set_input_value('task', 'edit'); fm_set_input_value('current_id', '<?php 
                echo $row_data->id;
                ?>
'); fm_form_submit(event, 'themes_form')" href="" title="Edit"><?php 
                echo $row_data->title;
                ?>
</a>
							</td>
							<td class="table_big_col">
								<?php 
                if ($default != '') {
                    ?>
									<a onclick="fm_set_input_value('task', '<?php 
                    echo $default;
                    ?>
'); fm_set_input_value('current_id', '<?php 
                    echo $row_data->id;
                    ?>
'); fm_form_submit(event, 'themes_form')" href="">
								<?php 
                }
                ?>
									<img src="<?php 
                echo WD_FM_URL . '/images/' . $default_image . '.png?ver=' . get_option("wd_form_maker_version") . '';
                ?>
" />
								<?php 
                if ($default != '') {
                    ?>
									</a>
								<?php 
                }
                ?>
							</td>
							<td class="table_small_col">
								<button class="fm-icon edit-icon" onclick="fm_set_input_value('task', 'edit'); fm_set_input_value('current_id', '<?php 
                echo $row_data->id;
                ?>
'); fm_form_submit(event, 'themes_form');">
									<span></span>
								</button>
							</td>
							<td class="table_small_col">
								<button class="fm-icon delete-icon" onclick="if (confirm('Do you want to delete selected item(s)?')) { fm_set_input_value('task', 'delete'); fm_set_input_value('current_id', '<?php 
                echo $row_data->id;
                ?>
'); fm_form_submit(event, 'themes_form'); } else {return false;}">
									<span></span>
								</button>
							</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="asc"/>
		<input id="order_by" name="order_by" type="hidden" value="<?php 
        echo $order_by;
        ?>
"/>
    </form>
    <?php 
    }
 public function unblock_ip()
 {
     global $wpdb;
     $flag = FALSE;
     $form_id = isset($_POST['form_id']) && esc_html($_POST['form_id']) != '' ? esc_html($_POST['form_id']) : 0;
     $cid = isset($_POST['post']) && $_POST['post'] != '' ? $_POST['post'] : NULL;
     if (count($cid)) {
         $cids = implode(',', $cid);
         $query = 'SELECT * FROM ' . $wpdb->prefix . 'formmaker_submits WHERE group_id IN ( ' . $cids . ' )';
         $rows = $wpdb->get_results($query);
         foreach ($rows as $row) {
             $flag = TRUE;
             $ips = $wpdb->get_var($wpdb->prepare('SELECT ip FROM ' . $wpdb->prefix . 'formmaker_blocked WHERE ip="%s"', $row->ip));
             if ($ips) {
                 $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'formmaker_blocked WHERE ip="%s"', $ips));
             }
         }
     }
     if ($flag) {
         echo WDW_FM_Library::message('IPs Succesfully Unblocked.', 'updated');
     } else {
         echo WDW_FM_Library::message('You must select at least one item.', 'error');
     }
     $this->display($form_id);
 }
示例#12
0
 public function display($result)
 {
     echo WDW_FM_Library::message($result, 'warning', 0);
 }
    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']) && $_POST['asc_or_desc'] == 'desc' ? 'desc' : 'asc';
        $order_by_array = array('id', 'ip');
        $order_by = isset($_POST['order_by']) && in_array(esc_html(stripslashes($_POST['order_by'])), $order_by_array) ? 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 class="fm-user-manual">
			This section allows you to block IPs.
			<a style="color: blue; text-decoration: none;" target="_blank" href="https://web-dorado.com/wordpress-form-maker-guide-2.html">Read More in User Manual</a>
		</div>
		<div class="fm-upgrade-pro">
			<a target="_blank" href="https://web-dorado.com/files/fromFormMaker.php">
				<div class="fm-upgrade-img">
					UPGRADE TO PRO VERSION 
					<span></span>
				</div>
			</a>
		</div>
		<div class="fm-clear"></div>
		<form onkeypress="fm_doNothing(event)" class="wrap" id="blocked_ips" method="post" action="admin.php?page=blocked_ips_fm" style="width:99%;">
			<?php 
        wp_nonce_field('nonce_fm', 'nonce_fm');
        ?>
			<div class="fm-page-banner blocked-ips-banner">
				<div class="block_icon">
				</div>
				<div class="fm-logo-title">Blocked IPs</div>
				<div class="fm-page-actions">
					<button class="fm-button save-button small" onclick="fm_set_input_value('task', 'save_all');">
						<span></span>
						Save
					</button>
					<button class="fm-button delete-button small" onclick="if (confirm('Do you want to unblock selected IPs?')) { fm_set_input_value('task', 'delete_all'); } else { return false; }">
						<span></span>
						Delete
					</button>
				</div>
			</div>	 
			<div class="fm-clear"></div>
			<div class="tablenav top">
				<?php 
        WDW_FM_Library::search('IP', $search_value, 'blocked_ips');
        WDW_FM_Library::html_page_nav($page_nav['total'], $page_nav['limit'], 'blocked_ips');
        ?>
			</div>
			<table class="wp-list-table widefat fixed pages fm-block-ip">
				<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="fm_set_input_value('task', '');
                          fm_set_input_value('order_by', 'id');
                          fm_set_input_value('asc_or_desc', '<?php 
        echo $order_by == 'id' && $asc_or_desc == 'asc' ? 'desc' : 'asc';
        ?>
');
                          fm_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="fm_set_input_value('task', '');
                          fm_set_input_value('order_by', 'ip');
                          fm_set_input_value('asc_or_desc', '<?php 
        echo $order_by == 'ip' && $asc_or_desc == 'asc' ? 'desc' : 'asc';
        ?>
');
                          fm_form_submit(event, 'blocked_ips')" href="">
							<span>IP</span><span class="sorting-indicator"></span>
							</a>
						</th>
						<th class="table_small_col">Edit</th>
						<th class="table_small_col">Delete</th>
					</tr>		  
					<tr id="tr" style="background-color: #f9f9f9;">
						<th></th>
						<th></th>
						<th>
							<input type="text" class="input_th" id="ip" name="ip" onkeypress="return fm_check_isnum(event)">
							<button class="fm-button add-button small" onclick="if (fm_check_required('ip', 'IP')) {return false;} fm_set_input_value('task', 'save'); fm_set_input_value('current_id', ''); fm_save_ip('blocked_ips');">
								Add IP
								<span></span>
							</button>
						</th>
						<th>
							
						</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="fm_edit_ip(<?php 
                echo $row_data->id;
                ?>
)" 
							 title="Edit"><?php 
                echo $row_data->ip;
                ?>
</a>
							</td>
							<td class="table_small_col" id="td_edit_<?php 
                echo $row_data->id;
                ?>
">
								<button class="fm-icon edit-icon" onclick="fm_edit_ip(<?php 
                echo $row_data->id;
                ?>
);">
									<span></span>
								</button>
							</td>
							<td class="table_small_col" id="td_delete_<?php 
                echo $row_data->id;
                ?>
">
								<button class="fm-icon delete-icon" onclick="if (confirm('Do you want to unblock selected IP?')) { fm_set_input_value('task', 'delete'); fm_set_input_value('current_id', <?php 
                echo $row_data->id;
                ?>
); fm_form_submit(event, 'blocked_ips'); } else {return false;}">
									<span></span>
								</button>
							</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 remove_query()
 {
     global $wpdb;
     $cid = isset($_POST['cid']) && $_POST['cid'] != '' ? $_POST['cid'] : NULL;
     if (count($cid)) {
         array_walk($cid, create_function('&$value', '$value = (int)$value;'));
         $cids = implode(',', $cid);
         $query = 'DELETE FROM ' . $wpdb->prefix . 'formmaker_query WHERE id IN ( ' . $cids . ' )';
         if ($wpdb->query($query)) {
             echo WDW_FM_Library::message('Items Succesfully Deleted.', 'updated');
         } else {
             echo WDW_FM_Library::message('Error. Please install plugin again.', 'error');
         }
     } else {
         echo WDW_FM_Library::message('You must select at least one item.', 'error');
     }
     $this->apply_options();
 }
 public function setdefault($id)
 {
     global $wpdb;
     $wpdb->update($wpdb->prefix . 'formmaker_themes', array('default' => 0), array('default' => 1));
     $save = $wpdb->update($wpdb->prefix . 'formmaker_themes', array('default' => 1), array('id' => $id));
     if ($save !== FALSE) {
         $message = 7;
     } else {
         $message = 2;
     }
     // $this->display();
     $page = WDW_FM_Library::get('page');
     WDW_FM_Library::spider_redirect(add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message), admin_url('admin.php')));
 }
 public function delete_all()
 {
     global $wpdb;
     $flag = FALSE;
     $ips_id_col = $wpdb->get_col('SELECT id FROM ' . $wpdb->prefix . 'formmaker_blocked');
     foreach ($ips_id_col as $ip_id) {
         if (isset($_POST['check_' . $ip_id])) {
             $flag = TRUE;
             $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'formmaker_blocked WHERE id="%d"', $ip_id));
         }
     }
     if ($flag) {
         $message = 5;
     } else {
         $message = 2;
     }
     // $this->display();
     $page = WDW_FM_Library::get('page');
     WDW_FM_Library::fm_redirect(add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message), admin_url('admin.php')));
 }
    public function display($form_id)
    {
        global $wpdb;
        $forms = $this->model->get_form_titles();
        $statistics = $this->model->get_statistics($form_id);
        $labels_parameters = $this->model->get_labels_parameters($form_id);
        $sorted_labels_id = $labels_parameters[0];
        $sorted_label_types = $labels_parameters[1];
        $lists = $labels_parameters[2];
        $sorted_label_names = $labels_parameters[3];
        $sorted_label_names_original = $labels_parameters[4];
        $rows = isset($labels_parameters[5]) ? $labels_parameters[5] : NULL;
        $group_ids = isset($labels_parameters[6]) ? $labels_parameters[6] : NULL;
        $where_choices = $labels_parameters[7];
        $order_by = isset($_POST['order_by']) ? esc_html(stripslashes($_POST['order_by'])) : 'group_id';
        $asc_or_desc = isset($_POST['asc_or_desc']) && $_POST['asc_or_desc'] == 'asc' ? 'asc' : 'desc';
        $style_id = $this->model->hide_or_not($lists['hide_label_list'], '@submitid@');
        $style_date = $this->model->hide_or_not($lists['hide_label_list'], '@submitdate@');
        $style_ip = $this->model->hide_or_not($lists['hide_label_list'], '@submitterip@');
        $style_username = $this->model->hide_or_not($lists['hide_label_list'], '@submitterusername@');
        $style_useremail = $this->model->hide_or_not($lists['hide_label_list'], '@submitteremail@');
        $oder_class_default = "manage-column column-autor sortable desc";
        $oder_class = "manage-column column-title sorted " . $asc_or_desc;
        $ispaypal = FALSE;
        $temp = array();
        $m = count($sorted_label_names);
        $n = count($rows);
        $group_id_s = array();
        $group_id_s = $this->model->sort_group_ids(count($sorted_label_names), $group_ids);
        $ka_fielderov_search = $lists['ip_search'] || $lists['startdate'] || $lists['enddate'] || $lists['username_search'] || $lists['useremail_search'] || $lists['id_search'] ? TRUE : FALSE;
        $is_stats = false;
        $blocked_ips = $this->model->blocked_ips();
        if (defined('WD_FM_PDF') && is_plugin_active(constant('WD_FM_PDF'))) {
            require_once WD_FM_PDF_DIR . '/model.php';
            $pdf_data = WD_FM_PDF_model::get_pdf_data($form_id);
        }
        $subs_count = $this->model->get_subs_count($form_id);
        $chosen_form_title = '';
        if ($forms) {
            foreach ($forms as $form) {
                if ($form_id == $form->id) {
                    $chosen_form_title = $form->title;
                }
            }
        }
        ?>
		<script type="text/javascript">
			function export_submissions(type, limit) {
			var progressbar = jQuery( "#fm-progressbar" );
			var progressLabel = jQuery( ".fm-progress-label" );
		 
			progressbar.progressbar({
				max: <?php 
        echo $subs_count;
        ?>
			});
			
			jQuery.ajax({
			    type: "POST",  
				url:"<?php 
        echo add_query_arg(array('form_id' => $form_id, 'send_header' => 0), admin_url('admin-ajax.php'));
        ?>
&action=generete_"+type+"&limitstart="+limit,
				beforeSend: function() {
					if(<?php 
        echo $subs_count;
        ?>
 >= 1000 )
						jQuery('.fm_modal').show();
			    },
			    success: function(data) {
					if(limit < <?php 
        echo $subs_count;
        ?>
) {
						limit += 1000;
						export_submissions(type, limit);
						progressbar.progressbar( "value",  limit);
						loaded_percent = Math.round((progressbar.progressbar( "value" ) * 100)/ parseInt(<?php 
        echo $subs_count;
        ?>
));
						progressLabel.text( loaded_percent + ' %');
						progressbarValue = progressbar.find( ".fm-progress-label" );
						if( loaded_percent >= 46 ) {
							progressbarValue.css({
								"color": '#fff',
							});
						}
						else {
							progressbarValue.css({
								"color": '#444',
							});
						}
					}
					else{
						jQuery('.fm_modal').hide();
						progressbar.progressbar( "value",  0);
						progressLabel.text( 'Loading ...' );
						progressbarValue = progressbar.find( ".fm-progress-label" );
						progressbarValue.css({
							"color": '#444',
						});
						window.location = "<?php 
        echo add_query_arg(array('form_id' => $form_id, 'send_header' => 1), admin_url('admin-ajax.php'));
        ?>
&action=generete_"+type+"&limitstart="+limit;
					}
			    }
			});
		}
	
			function clickLabChBAll(ChBAll) {
				<?php 
        if (isset($sorted_label_names)) {
            $templabels = array_merge(array('submitid', 'submitdate', 'submitterip', 'submitterusername', 'submitteremail'), $sorted_labels_id);
            $sorted_label_names_for_check = array_merge(array('ID', 'Submit date', "Submitter's IP", "Submitter's Username", "Submitter's Email Address"), $sorted_label_names_original);
        } else {
            $templabels = array('submitid', 'submitdate', 'submitterip', 'submitterusername', 'submitteremail');
            $sorted_label_names_for_check = array('ID', 'Submit date', "Submitter's IP", 'Submitter\'s Username', 'Submitter\'s Email Address');
        }
        ?>
				if (ChBAll.checked) {
					document.forms.admin_form.hide_label_list.value = '';
					for (i = 0; i <= ChBAll.form.length; i++) {
						if (typeof(ChBAll.form[i]) != "undefined") {
							if (ChBAll.form[i].type == "checkbox") {
								ChBAll.form[i].checked = true;
							}
						}
					}
				}
				else {
					document.forms.admin_form.hide_label_list.value = '@<?php 
        echo implode($templabels, '@@');
        ?>
@' + '@payment_info@';
					for (i = 0; i <= ChBAll.form.length; i++) {
						if (typeof(ChBAll.form[i]) != "undefined") {
							if (ChBAll.form[i].type == "checkbox") {
								ChBAll.form[i].checked = false;
							}
						}
					}
				}
				renderColumns();
			}
			
			function remove_all() {
				if(document.getElementById('startdate'))
					document.getElementById('startdate').value='';
				if(document.getElementById('enddate'))
					document.getElementById('enddate').value='';
				if(document.getElementById('id_search'))
					document.getElementById('id_search').value='';
				if(document.getElementById('ip_search'))
					document.getElementById('ip_search').value='';
				if(document.getElementById('username_search'))
					document.getElementById('username_search').value='';
				if(document.getElementById('useremail_search'))
					document.getElementById('useremail_search').value='';
				<?php 
        $n = count($rows);
        for ($i = 0; $i < count($sorted_label_names); $i++) {
            if ($sorted_label_types[$i] != "type_mark_map") {
                ?>
						document.getElementById('<?php 
                echo $form_id . '_' . $sorted_labels_id[$i] . '_search';
                ?>
').value='';
						<?php 
            }
        }
        ?>
			}
			function show_hide_filter() {
				if (document.getElementById('fields_filter').style.display == "none") {
					document.getElementById('fields_filter').style.display = '';
				}
				else {
					document.getElementById('fields_filter').style.display = "none";
				}
				return false;
			}
			jQuery(document).ready(function () { 
				jQuery('.theme-detail').click(function () {
					jQuery(this).siblings('.themedetaildiv').toggle();
					return false;
				});
			});
		</script>
		<div class="fm_modal"> 
			<div id="fm-progressbar" >
				<div class="fm-progress-label">Loading...</div>
			</div> 
		</div> 
		<div class="export_progress">
			<span class="exp_count"><?php 
        echo $subs_count;
        ?>
</span> left from <?php 
        echo $subs_count;
        ?>
		</div> 
		<div id="sbox-overlay" onclick="toggleChBDiv(false);">
		</div>
		<div id="ChBDiv">
			<form action="#">
				<?php 
        wp_nonce_field('nonce_fm', 'nonce_fm');
        ?>
				<p style="font-weight: bold; font-size: 18px; margin-top: 0px;">Select Columns</p>
				<div class="fm_check_labels"><input type="checkbox" <?php 
        echo $lists['hide_label_list'] === '' ? 'checked="checked"' : '';
        ?>
 onclick="clickLabChBAll(this)" id="ChBAll"/><label for="ChBAll"> All</label></div>
				<?php 
        foreach ($templabels as $key => $curlabel) {
            if (strpos($lists['hide_label_list'], '@' . $curlabel . '@') === FALSE) {
                ?>
						<div class="fm_check_labels"><input type="checkbox" checked="checked" onclick="clickLabChB('<?php 
                echo $curlabel;
                ?>
', this)" id="fm_check_id_<?php 
                echo $curlabel;
                ?>
" /><label for="fm_check_id_<?php 
                echo $curlabel;
                ?>
"> <?php 
                echo stripslashes($sorted_label_names_for_check[$key]);
                ?>
</label></div>
						<?php 
            } else {
                ?>
						<div class="fm_check_labels"><input type="checkbox" onclick="clickLabChB('<?php 
                echo $curlabel;
                ?>
', this)" id="fm_check_id_<?php 
                echo $curlabel;
                ?>
"/><label for="fm_check_id_<?php 
                echo $curlabel;
                ?>
"> <?php 
                echo stripslashes($sorted_label_names_for_check[$key]);
                ?>
</label></div>
						<?php 
            }
        }
        $ispaypal = FALSE;
        for ($i = 0; $i < count($sorted_label_names); $i++) {
            if ($sorted_label_types[$i] == 'type_paypal_payment_status') {
                $ispaypal = TRUE;
            }
        }
        if ($ispaypal) {
            ?>
					<div class="fm_check_labels">
						<input type="checkbox" onclick="clickLabChB('payment_info', this)" id="fm_check_payment_info" <?php 
            echo strpos($lists['hide_label_list'], '@payment_info@') === FALSE ? 'checked="checked"' : '';
            ?>
 />
						<label for="fm_check_payment_info"> Payment Info</label>
					</div>
					<?php 
        }
        ?>
				<div style="text-align: center; padding-top: 20px;">
					<button onclick="toggleChBDiv(false); return false;" style="background: #4EC0D9; width: 78px; height: 32px; border: 1px solid #4EC0D9; border-radius: 0px; color: #fff; cursor: pointer;">Done</button>
				</div>
			</form>
		</div>
		<div class="fm-user-manual">
			This section allows you to view and manage form submissions.
			<a style="color: blue; text-decoration: none;" target="_blank" href="https://web-dorado.com/wordpress-form-maker-guide-6.html">Read More in User Manual</a>
		</div>
		<div class="fm-upgrade-pro">
			<a target="_blank" href="https://web-dorado.com/files/fromFormMaker.php">
				<div class="fm-upgrade-img">
					UPGRADE TO PRO VERSION 
					<span></span>
				</div>
			</a>
		</div>
		<div class="fm-clear"></div>
		<form action="admin.php?page=submissions_fm" method="post" id="admin_form" name="admin_form">
			<?php 
        wp_nonce_field('nonce_fm', 'nonce_fm');
        ?>
			<input type="hidden" name="option" value="com_formmaker" />
			<input type="hidden" id="task" name="task" value="" />
			<input type="hidden" id="current_id" name="current_id" value="" />
			<input type="hidden" name="asc_or_desc" id="asc_or_desc" value="<?php 
        echo $asc_or_desc;
        ?>
" />
			<input type="hidden" name="order_by" id="order_by" value="<?php 
        echo $order_by;
        ?>
" />
			
			<div class="fm-submissions-page">
				<div class="submissions-actions">
					<div class="fm-form-title">
						<?php 
        echo $chosen_form_title;
        ?>
	
					</div>
					<div class="fm-page-actions">
						<button class="fm-button block-button small" onclick="fm_set_input_value('task', 'block_ip'); fm_form_submit(event, 'admin_form');">
							<span></span>
							Block IP
						</button>
						<button class="fm-button unblock-button medium" onclick="fm_set_input_value('task', 'unblock_ip'); fm_form_submit(event, 'admin_form');">
							<span></span>
							Unblock IP
						</button>
						<button class="fm-button delete-button small" onclick="if (confirm('Do you want to delete selected items?')) { fm_set_input_value('task', 'delete_all'); fm_form_submit(event, 'admin_form'); } else { return false; }">
							<span></span>
							Delete
						</button>
					</div>
				</div>
				<div class="submissions-toolbar">
					<div class="submissions-tools">
						<select name="form_id" id="form_id" onchange="document.admin_form.submit();">
							<option value="0" selected="selected"> - Select a Form - </option>
							<?php 
        if ($forms) {
            foreach ($forms as $form) {
                ?>
									<option value="<?php 
                echo $form->id;
                ?>
" <?php 
                if ($form_id == $form->id) {
                    echo 'selected="selected"';
                }
                ?>
> <?php 
                echo $form->title;
                ?>
 </option>
									<?php 
            }
        }
        ?>
						</select>
						<div class="fm-reports">
							<div class="fm-tools-button"><div class="fm-total_entries"><?php 
        echo $statistics["total_entries"];
        ?>
</div>Entries</div>
							<div class="fm-tools-button"><div class="fm-total_rate"><?php 
        echo $statistics["conversion_rate"];
        ?>
</div>Conversion Rate</div>
							<div class="fm-tools-button"><div class="fm-total_views"><?php 
        echo $statistics["total_views"] ? $statistics["total_views"] : 0;
        ?>
</div>Views</div>
						</div>
						
						<div class="fm-export-tools">
							<span class="exp_but_span">Export to</span>
							&nbsp;
							<button class="fm-tools-button" onclick="export_submissions('csv', 0); return false;">
								CSV
							</button>
							<button class="fm-tools-button" onclick="export_submissions('xml', 0); return false;">
								XML
							</button>
						</div>
					</div>
				</div>
				<div class="tablenav top">
					<div class="fm-filters">
						<div class="fm-search-tools">
							<input type="hidden" name="hide_label_list" value="<?php 
        echo $lists['hide_label_list'];
        ?>
"> 
							<button class="fm-icon show-filter-icon" onclick="show_hide_filter(); return false;" title="Show Filters">
								<span></span>
							</button>
							<button class="fm-icon search-icon" onclick="fm_form_submit(event, 'admin_form'); return false;" title="Search">
							</button>
							<button class="fm-icon reset-icon" onclick="remove_all(); fm_form_submit(event, 'admin_form'); return false;" title="Reset">
							</button>
						</div>
						<div class="fm-add-remove">
							<?php 
        if (isset($sorted_label_names)) {
            ?>
							<button class="fm-button" onclick="toggleChBDiv(true); return false;">
								Add/Remove Columns
							</button>
							<?php 
            WDW_FM_Library::html_page_nav($lists['total'], $lists['limit'], 'admin_form');
            ?>
							<?php 
        }
        ?>
							<input type="hidden" name="pagination_clicked" id="pagination_clicked" value=""/>
						</div>
					</div>
					<div class="fm-clear"></div>
				</div>
				
				<div class="fm-loading-container" style="display:none;">
					<div class="fm-loading-content">
					</div>
				</div>
				<div class="submit_content" id="fm-scroll" style="width: 100%;">
					<table class="wp-list-table widefat fixed posts table_content">
						<thead>
							<tr>
								<?php 
        if (defined('WD_FM_PDF') && is_plugin_active(constant('WD_FM_PDF'))) {
            ?>
 
								<th class="table_small_col count_col sub-align">PDF</th>
								<?php 
        }
        ?>
								<th class="table_small_col count_col sub-align">#</th>
								<th scope="col" id="cb" class="manage-column column-cb check-column table_small_col sub-align form_check"><input id="check_all" type="checkbox"></th>
								<th scope="col" id="submitid_fc" class="table_small_col sub-align submitid_fc <?php 
        if ($order_by == "group_id") {
            echo $oder_class;
        } else {
            echo $oder_class_default;
        }
        ?>
" <?php 
        echo $style_id;
        ?>
>
									<a href="" class="sub_id" onclick="fm_set_input_value('order_by', 'group_id');
													   fm_set_input_value('asc_or_desc', '<?php 
        echo $order_by == 'group_id' && $asc_or_desc == 'asc' ? 'desc' : 'asc';
        ?>
');
													   fm_form_submit(event, 'admin_form')">
										<span>ID</span>
										<span class="sorting-indicator" style="margin-top: 8px;"></span>
									</a>
								</th>
								<th class="table_small_col sub-align">Edit</th>
								<th class="table_small_col sub-align">Delete</th>
								<th scope="col" id="submitdate_fc" class="table_large_col submitdate_fc <?php 
        if ($order_by == "date") {
            echo $oder_class;
        } else {
            echo $oder_class_default;
        }
        ?>
" <?php 
        echo $style_date;
        ?>
>
									<a href="" onclick="fm_set_input_value('order_by', 'date');
										fm_set_input_value('asc_or_desc', '<?php 
        echo $order_by == 'date' && $asc_or_desc == 'asc' ? 'desc' : 'asc';
        ?>
');
										fm_form_submit(event, 'admin_form')">
										<span>Submit date</span>
										<span class="sorting-indicator"></span>
									</a>
								</th>
								<th scope="col" id="submitterip_fc" class="table_medium_col_uncenter submitterip_fc <?php 
        if ($order_by == "ip") {
            echo $oder_class;
        } else {
            echo $oder_class_default;
        }
        ?>
" <?php 
        echo $style_ip;
        ?>
>
									<a href="" onclick="fm_set_input_value('order_by', 'ip');
										fm_set_input_value('asc_or_desc', '<?php 
        echo $order_by == 'ip' && $asc_or_desc == 'asc' ? 'desc' : 'asc';
        ?>
');
										fm_form_submit(event, 'admin_form')">
										<span>Submitter's IP</span>
										<span class="sorting-indicator"></span>
									</a>
								</th>	
								<th scope="col" id="submitterusername_fc" class="table_medium_col_uncenter submitterusername_fc <?php 
        if ($order_by == "display_name") {
            echo $oder_class;
        } else {
            echo $oder_class_default;
        }
        ?>
" <?php 
        echo $style_username;
        ?>
>
									<a href="" onclick="fm_set_input_value('order_by', 'display_name');
										fm_set_input_value('asc_or_desc', '<?php 
        echo $order_by == 'display_name' && $asc_or_desc == 'asc' ? 'desc' : 'asc';
        ?>
');
										fm_form_submit(event, 'admin_form')">
										<span>Submitter's Username</span>
										<span class="sorting-indicator"></span>
									</a>
								</th>	
								<th scope="col" id="submitteremail_fc" class="table_medium_col_uncenter submitteremail_fc <?php 
        if ($order_by == "user_email") {
            echo $oder_class;
        } else {
            echo $oder_class_default;
        }
        ?>
" <?php 
        echo $style_useremail;
        ?>
>
									<a href="" onclick="fm_set_input_value('order_by', 'user_email');
										fm_set_input_value('asc_or_desc', '<?php 
        echo $order_by == 'user_email' && $asc_or_desc == 'asc' ? 'desc' : 'asc';
        ?>
');
										fm_form_submit(event, 'admin_form')">
										<span>Submitter's Email Address</span>
										<span class="sorting-indicator"></span>
									</a>
								</th>	
								<?php 
        for ($i = 0; $i < count($sorted_label_names); $i++) {
            $styleStr = $this->model->hide_or_not($lists['hide_label_list'], $sorted_labels_id[$i]);
            $styleStr2 = $this->model->hide_or_not($lists['hide_label_list'], '@payment_info@');
            $field_title = $this->model->get_type_address($sorted_label_types[$i], $sorted_label_names_original[$i]);
            if ($sorted_label_types[$i] == 'type_paypal_payment_status') {
                $ispaypal = TRUE;
                ?>
										<th <?php 
                echo $styleStr;
                ?>
 id="<?php 
                echo $sorted_labels_id[$i] . '_fc';
                ?>
" class="table_large_col <?php 
                echo $sorted_labels_id[$i] . '_fc';
                if ($order_by == $sorted_labels_id[$i] . "_field") {
                    echo $oder_class . '"';
                } else {
                    echo $oder_class_default . '"';
                }
                ?>
">
											<a href="" onclick="fm_set_input_value('order_by', '<?php 
                echo $sorted_labels_id[$i] . '_field';
                ?>
'); fm_set_input_value('asc_or_desc', '<?php 
                echo $order_by == $sorted_labels_id[$i] . '_field' && $asc_or_desc == 'asc' ? 'desc' : 'asc';
                ?>
'); fm_form_submit(event, 'admin_form')">	
												<span><?php 
                echo $field_title;
                ?>
</span>
												<span class="sorting-indicator"></span>
											</a>
										</th>
										<th class="table_large_col payment_info_fc" <?php 
                echo $styleStr2;
                ?>
>Payment Info</th>
										<?php 
            } else {
                ?>
										<th <?php 
                echo $styleStr;
                ?>
 id="<?php 
                echo $sorted_labels_id[$i] . '_fc';
                ?>
" class="<?php 
                echo $sorted_label_types[$i] == 'type_mark_map' || $sorted_label_types[$i] == 'type_matrix' ? 'table_large_col ' : '';
                echo $sorted_labels_id[$i] . '_fc';
                if ($order_by == $sorted_labels_id[$i] . "_field") {
                    echo $oder_class . '"';
                } else {
                    echo $oder_class_default . '"';
                }
                ?>
">
											<a href="" onclick="fm_set_input_value('order_by', '<?php 
                echo $sorted_labels_id[$i] . '_field';
                ?>
'); fm_set_input_value('asc_or_desc', '<?php 
                echo $order_by == $sorted_labels_id[$i] . '_field' && $asc_or_desc == 'asc' ? 'desc' : 'asc';
                ?>
'); fm_form_submit(event, 'admin_form')">
												<span><?php 
                echo $field_title;
                ?>
</span>
												<span class="sorting-indicator"></span>
											</a>
										</th>
										<?php 
            }
        }
        ?>
		           
							</tr>
							<tr id="fields_filter" style="display: none;">
								<th></th>
								<th></th> 
								<th class="submitid_fc" <?php 
        echo $style_id;
        ?>
 >
									<input type="text" name="id_search" id="id_search" value="<?php 
        echo $lists['id_search'];
        ?>
" onChange="this.form.submit();" style="width:30px"/>
								</th>
								<th></th>
								<th></th>
								<th width="150" class="submitdate_fc" <?php 
        echo $style_date;
        ?>
>
									<table align="center" style="margin:auto" class="simple_table">
										<tr class="simple_table">
											<td class="simple_table" style="text-align: left;">From:</td>
											<td style="text-align: center;" class="simple_table">
												<input class="inputbox" type="text" name="startdate" id="startdate" size="10" maxlength="10" value="<?php 
        echo $lists['startdate'];
        ?>
" />
											</td>
											<td style="text-align: center;" class="simple_table">
												<input type="reset" style="width: 22px; border-radius: 3px !important;" class="button" value="..." onclick="return showCalendar('startdate','%Y-%m-%d');" />
											</td>
										</tr>
										<tr class="simple_table">
											<td style="text-align: left;" class="simple_table">To:</td>
											<td style="text-align: center;" class="simple_table">
												<input class="inputbox" type="text" name="enddate" id="enddate" size="10" maxlength="10" value="<?php 
        echo $lists['enddate'];
        ?>
" />
											</td>
											<td style="text-align: center;" class="simple_table">
												<input type="reset" style="width: 22px; border-radius: 3px !important;" class="button" value="..." onclick="return showCalendar('enddate','%Y-%m-%d');" />
											</td>
										</tr>
									</table>
								</th>
								<th class="table_medium_col_uncenter submitterip_fc" <?php 
        echo $style_ip;
        ?>
>
									<input type="text" name="ip_search" id="ip_search" value="<?php 
        echo $lists['ip_search'];
        ?>
" onChange="this.form.submit();" />
								</th>
								<th class="table_medium_col_uncenter submitterusername_fc" <?php 
        echo $style_username;
        ?>
>
									<input type="text" name="username_search" id="username_search" value="<?php 
        echo $lists['username_search'];
        ?>
" onChange="this.form.submit();" />
								</th>
								<th class="table_medium_col_uncenter submitteremail_fc" <?php 
        echo $style_useremail;
        ?>
>
									<input type="text" name="useremail_search" id="useremail_search" value="<?php 
        echo $lists['useremail_search'];
        ?>
" onChange="this.form.submit();" />
								</th>
								<?php 
        for ($i = 0; $i < count($sorted_label_names); $i++) {
            $styleStr = $this->model->hide_or_not($lists['hide_label_list'], $sorted_labels_id[$i]);
            if (!$ka_fielderov_search) {
                if ($lists[$form_id . '_' . $sorted_labels_id[$i] . '_search']) {
                    $ka_fielderov_search = TRUE;
                }
            }
            switch ($sorted_label_types[$i]) {
                case 'type_mark_map':
                    ?>
											<th class="table_large_col <?php 
                    echo $sorted_labels_id[$i];
                    ?>
_fc" <?php 
                    echo $styleStr;
                    ?>
></th>
											<?php 
                    break;
                case 'type_paypal_payment_status':
                    ?>
											<th class="table_large_col <?php 
                    echo $sorted_labels_id[$i];
                    ?>
_fc" <?php 
                    echo $styleStr;
                    ?>
>
												<select style="font-size: 11px; margin: 0; padding: 0; height: inherit;" name="<?php 
                    echo $form_id . '_' . $sorted_labels_id[$i];
                    ?>
_search" id="<?php 
                    echo $form_id . '_' . $sorted_labels_id[$i];
                    ?>
_search" onChange="this.form.submit();" value="<?php 
                    echo $lists[$form_id . '_' . $sorted_labels_id[$i] . '_search'];
                    ?>
" >
													<option value="" ></option>
													<option value="canceled" >Canceled</option>
													<option value="cleared" >Cleared</option>
													<option value="cleared by payment review" >Cleared by payment review</option>
													<option value="completed" >Completed</option>
													<option value="denied" >Denied</option>
													<option value="failed" >Failed</option>
													<option value="held" >Held</option>
													<option value="in progress" >In progress</option>
													<option value="on hold" >On hold</option>
													<option value="paid" >Paid</option>
													<option value="partially refunded" >Partially refunded</option>
													<option value="pending verification" >Pending verification</option>
													<option value="placed" >Placed</option>
													<option value="processing" >Processing</option>
													<option value="refunded" >Refunded</option>
													<option value="refused" >Refused</option>
													<option value="removed" >Removed</option>
													<option value="returned" >Returned</option>
													<option value="reversed" >Reversed</option>
													<option value="temporary hold" >Temporary hold</option>
													<option value="unclaimed" >Unclaimed</option>
												</select>	
												<script> 
													var element = document.getElementById('<?php 
                    echo $form_id . '_' . $sorted_labels_id[$i];
                    ?>
_search');
													element.value = '<?php 
                    echo $lists[$form_id . '_' . $sorted_labels_id[$i] . '_search'];
                    ?>
';
												</script>
											</th>
											<th class="table_large_col  payment_info_fc" <?php 
                    echo $styleStr2;
                    ?>
></th>
											<?php 
                    break;
                default:
                    ?>
											<th class="<?php 
                    echo $sorted_labels_id[$i];
                    ?>
_fc" <?php 
                    echo $styleStr;
                    ?>
>
												<input name="<?php 
                    echo $form_id . '_' . $sorted_labels_id[$i] . '_search';
                    ?>
" id="<?php 
                    echo $form_id . '_' . $sorted_labels_id[$i] . '_search';
                    ?>
" type="text" value="<?php 
                    echo $lists[$form_id . '_' . $sorted_labels_id[$i] . '_search'];
                    ?>
"  onChange="this.form.submit();" >
											</th>
											<?php 
                    break;
            }
        }
        ?>
							</tr>
						</thead>
						<?php 
        $k = 0;
        for ($www = 0, $qqq = count($group_id_s); $www < $qqq; $www++) {
            $i = $group_id_s[$www];
            $alternate = !isset($alternate) || $alternate == 'class="alternate"' ? '' : 'class="alternate"';
            $temp = $this->model->array_for_group_id($group_id_s[$www], $rows);
            $data = $temp[0];
            $userinfo = get_userdata($data->user_id_wd);
            $useremail = $userinfo ? $userinfo->user_email : "";
            $username = $userinfo ? $userinfo->display_name : "";
            ?>
							<tr <?php 
            echo $alternate;
            ?>
>
								<?php 
            if (defined('WD_FM_PDF') && is_plugin_active(constant('WD_FM_PDF'))) {
                ?>
 
								<td class="table_small_col pdf_col sub-align">
									<?php 
                if ($pdf_data && isset($pdf_data[$group_id_s[$www]])) {
                    ?>
 
									<a href="<?php 
                    echo site_url() . '/' . $pdf_data[$group_id_s[$www]];
                    ?>
" style="display: block;" download><img src="<?php 
                    echo WD_FM_PDF_URL . '/images/pdf-icon.png';
                    ?>
" /></a>
									<?php 
                }
                ?>
								</td>
								<?php 
            }
            ?>
								<td class="table_small_col count_col sub-align"><?php 
            echo $www + 1;
            ?>
</td>
								<td class="check-column table_small_col sub-align" style="padding: 0;">
									<input type="checkbox" name="post[]" value="<?php 
            echo $data->group_id;
            ?>
">
								</td>   
								<td class="table_small_col sub-align submitid_fc" id="submitid_fc" <?php 
            echo $style_id;
            ?>
>
									<a href="" onclick="fm_set_input_value('task', 'edit');						   fm_set_input_value('current_id',<?php 
            echo $data->group_id;
            ?>
); fm_form_submit(event, 'admin_form');" >
										<?php 
            echo $data->group_id;
            ?>
									</a>
								</td> 
								<td class="table_small_col sub-align">
									<a href="" onclick="fm_set_input_value('task', 'edit');						   fm_set_input_value('current_id',<?php 
            echo $data->group_id;
            ?>
); fm_form_submit(event, 'admin_form');">Edit
									</a>
								</td>
								<td class="table_small_col sub-align">
									<a href="" onclick="if (confirm('Do you want to delete selected item(s)?')) { fm_set_input_value('task', 'delete'); fm_set_input_value('current_id',<?php 
            echo $data->group_id;
            ?>
); fm_form_submit(event, 'admin_form'); } else { return false; }">Delete
									</a>
								</td>		 
								<td  class="table_large_col submitdate_fc sub-align" id="submitdate_fc" <?php 
            echo $style_date;
            ?>
>
									<a href="" onclick="fm_set_input_value('task', 'edit'); fm_set_input_value('current_id',<?php 
            echo $data->group_id;
            ?>
); fm_form_submit(event, 'admin_form');" ><?php 
            echo $data->date;
            ?>
									</a>
								</td>
								<td class="table_medium_col_uncenter submitterip_fc sub-align" id="submitterip_fc" <?php 
            echo $style_ip;
            ?>
>
									<a class="thickbox-preview" href="<?php 
            echo add_query_arg(array('action' => 'fromipinfoinpopup', 'data_ip' => $data->ip, 'width' => '400', 'height' => '300', 'TB_iframe' => '1'), admin_url('admin-ajax.php'));
            ?>
" title="Show submitter information" <?php 
            echo !in_array($data->ip, $blocked_ips) ? '' : 'style="color: #FF0000;"';
            ?>
><?php 
            echo $data->ip;
            ?>
</a>
								</td>
								<td  class="table_large_col submitterusername_fc sub-align" id="submitterusername_fc" <?php 
            echo $style_username;
            ?>
>
									<?php 
            echo $username;
            ?>
								</td>
								<td  class="table_large_col submitteremail_fc sub-align" id="submitteremail_fc" <?php 
            echo $style_useremail;
            ?>
>
									<?php 
            echo $useremail;
            ?>
								</td>
								<?php 
            for ($h = 0; $h < $m; $h++) {
                $not_label = TRUE;
                for ($g = 0; $g < count($temp); $g++) {
                    $styleStr = $this->model->hide_or_not($lists['hide_label_list'], $sorted_labels_id[$h]);
                    if ($temp[$g]->element_label == $sorted_labels_id[$h]) {
                        if (strpos($temp[$g]->element_value, "***map***")) {
                            $map_params = explode('***map***', $temp[$g]->element_value);
                            ?>
												<td class="table_large_col <?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc sub-align" id="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc" <?php 
                            echo $styleStr;
                            ?>
>
													<a class="thickbox-preview" href="<?php 
                            echo add_query_arg(array('action' => 'frommapeditinpopup', 'long' => $map_params[0], 'lat' => $map_params[1], 'width' => '620', 'height' => '550', 'TB_iframe' => '1'), admin_url('admin-ajax.php'));
                            ?>
" title="Show on Map">Show on Map</a>
												</td>
												<?php 
                        } elseif (strpos($temp[$g]->element_value, "*@@url@@*")) {
                            ?>
												<td class="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc sub-align" id="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc" <?php 
                            echo $styleStr;
                            ?>
>
													<?php 
                            $new_files = explode("*@@url@@*", $temp[$g]->element_value);
                            foreach ($new_files as $new_file) {
                                if ($new_file) {
                                    $new_filename = explode('/', $new_file);
                                    $new_filename = $new_filename[count($new_filename) - 1];
                                    ?>
															<a target="_blank" class="fm_fancybox" rel="group_<?php 
                                    echo $www;
                                    ?>
" href="<?php 
                                    echo $new_file;
                                    ?>
"><?php 
                                    echo $new_filename;
                                    ?>
</a><br />
															<?php 
                                }
                            }
                            ?>
												</td>
												<?php 
                        } elseif (strpos($temp[$g]->element_value, "***star_rating***")) {
                            $view_star_rating_array = $this->model->view_for_star_rating($temp[$g]->element_value, $temp[$g]->element_label);
                            $stars = $view_star_rating_array[0];
                            ?>
												<td align="center" class="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc sub-align" id="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc" <?php 
                            echo $styleStr;
                            ?>
><?php 
                            echo $stars;
                            ?>
</td>
												<?php 
                        } elseif (strpos($temp[$g]->element_value, "***matrix***")) {
                            ?>
   
												<td class="table_large_col <?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc sub-align" id="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc" <?php 
                            echo $styleStr;
                            ?>
>
													<a class="thickbox-preview" href="<?php 
                            echo add_query_arg(array('action' => 'show_matrix', 'matrix_params' => $temp[$g]->element_value, 'width' => '620', 'height' => '550', 'TB_iframe' => '1'), admin_url('admin-ajax.php'));
                            ?>
" title="Show Matrix">Show Matrix</a>
												</td>
												<?php 
                        } elseif (strpos($temp[$g]->element_value, "@@@") !== FALSE || $temp[$g]->element_value == "@@@" || $temp[$g]->element_value == "@@@@@@@@@") {
                            ?>
												<td class="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc" <?php 
                            echo $styleStr;
                            ?>
>
													<p><?php 
                            echo str_replace("@@@", " ", $temp[$g]->element_value);
                            ?>
</p>
												</td>
												<?php 
                        } elseif (strpos($temp[$g]->element_value, "***grading***")) {
                            $view_grading_array = $this->model->view_for_grading($temp[$g]->element_value);
                            $items = $view_grading_array[0];
                            ?>
												<td class="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc sub-align" id="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc" <?php 
                            echo $styleStr;
                            ?>
>
													<p><?php 
                            echo $items;
                            ?>
</p>
												</td>
												<?php 
                        } else {
                            if (strpos($temp[$g]->element_value, "***quantity***")) {
                                $temp[$g]->element_value = str_replace("***quantity***", " ", $temp[$g]->element_value);
                            }
                            if (strpos($temp[$g]->element_value, "***property***")) {
                                $temp[$g]->element_value = str_replace("***property***", " ", $temp[$g]->element_value);
                            }
                            if ($sorted_label_types[$h] == "type_submitter_mail") {
                                $query = $wpdb->prepare('SELECT id FROM ' . $wpdb->prefix . 'formmaker_submits WHERE form_id ="%d" AND group_id="%d" AND element_value="verified**%d"', $form_id, $i, $sorted_labels_id[$h]);
                                $isverified = $wpdb->get_var($query);
                                if ($isverified) {
                                    ?>
														<td class="<?php 
                                    echo $sorted_labels_id[$h];
                                    ?>
_fc" id="<?php 
                                    echo $sorted_labels_id[$h];
                                    ?>
_fc" <?php 
                                    echo $styleStr;
                                    ?>
>
															<p><?php 
                                    echo $temp[$g]->element_value;
                                    ?>
 <span style="color:#2DA068;">( Verified <img src="<?php 
                                    echo WD_FM_URL . '/images/verified.png';
                                    ?>
" /> )</span></p>
														</td>
													<?php 
                                } else {
                                    ?>
														<td class="<?php 
                                    echo $sorted_labels_id[$h];
                                    ?>
_fc" id="<?php 
                                    echo $sorted_labels_id[$h];
                                    ?>
_fc" <?php 
                                    echo $styleStr;
                                    ?>
>
															<p><?php 
                                    echo $temp[$g]->element_value;
                                    ?>
</p>
														</td>	
													<?php 
                                }
                            } else {
                                ?>
													<td class="<?php 
                                echo $sorted_labels_id[$h];
                                ?>
_fc sub-align" id="<?php 
                                echo $sorted_labels_id[$h];
                                ?>
_fc" <?php 
                                echo $styleStr;
                                ?>
>
														<p><?php 
                                echo str_replace("***br***", '<br>', stripslashes($temp[$g]->element_value));
                                ?>
</p>
													</td>
													<?php 
                            }
                        }
                        $not_label = FALSE;
                    }
                }
                if ($not_label) {
                    ?>
										<td class="<?php 
                    echo $sorted_labels_id[$h];
                    ?>
_fc sub-align" id="<?php 
                    echo $sorted_labels_id[$h];
                    ?>
_fc" <?php 
                    echo $styleStr;
                    ?>
><p>&nbsp;</p></td>
										<?php 
                }
            }
            if ($ispaypal) {
                $styleStr = $this->model->hide_or_not($lists['hide_label_list'], '@payment_info@');
                ?>
									<td class="table_large_col payment_info_fc sub-align" id="payment_info_fc" <?php 
                echo $styleStr;
                ?>
>
										<a class="thickbox-preview" href="<?php 
                echo add_query_arg(array('action' => 'paypal_info', 'id' => $i, 'width' => '600', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php'));
                ?>
">
											<img src="<?php 
                echo WD_FM_URL . '/images/info.png';
                ?>
" />
										</a>
									</td>
									<?php 
            }
            ?>
							</tr>
							<?php 
            $k = 1 - $k;
        }
        ?>
					</table>
				</div>	 
				<?php 
        if ($sorted_label_types) {
            foreach ($sorted_label_types as $key => $sorted_label_type) {
                if ($this->model->check_radio_type($sorted_label_type)) {
                    $is_stats = true;
                    break;
                }
            }
            if ($is_stats) {
                $ajax_nonce = wp_create_nonce("nonce_fm_ajax");
                ?>
						<br/>
						<div class="fm-statistics">
							<h1>Statistics</h1>		
							<table class="stats">
								<tr>
									<td>
										<label for="sorted_label_key">Select a Field:</label>
									</td>
									<td>
										<select id="sorted_label_key">
											<option value="">Select a Field</option>
											<?php 
                foreach ($sorted_label_types as $key => $sorted_label_type) {
                    if ($sorted_label_type == "type_checkbox" || $sorted_label_type == "type_radio" || $sorted_label_type == "type_own_select" || $sorted_label_type == "type_country" || $sorted_label_type == "type_paypal_select" || $sorted_label_type == "type_paypal_radio" || $sorted_label_type == "type_paypal_checkbox" || $sorted_label_type == "type_paypal_shipping") {
                        ?>
													<option value="<?php 
                        echo $key;
                        ?>
"><?php 
                        echo $sorted_label_names_original[$key];
                        ?>
</option>
													<?php 
                    }
                }
                ?>
										</select>
									</td>
									<td></td>
								</tr>
								<tr>
									<td>
										<label>Select a Date:</label>
									</td>
									<td>
										From: <input class="inputbox"  type="text" name="startstats" id="startstats" size="9" maxlength="9" />
										  <input type="reset" class="button" style="width: 22px;"  value="..." name="startstats_but" id="startstats_but" onclick="return showCalendar('startstats','%Y-%m-%d');" /> 
											 
										To: <input class="inputbox" type="text" name="endstats" id="endstats" size="9" maxlength="9" />
										<input type="reset" class="button" style="width: 22px;"  value="..." name="endstats_but" id="endstats_but" onclick="return showCalendar('endstats','%Y-%m-%d');" />
									</td>
									<td>
										<button onclick="show_stats(); return false;">Show</button>
									</td>
								</tr>
							</table>
							
							<div id="div_stats"></div>	
						</div>
						<script>
						function show_stats() { 
							jQuery('#div_stats').html('<div class="fm-loading-container"><div class="fm-loading-content"></div></div>');
							if(jQuery('#sorted_label_key').val()!="") {	 	  
								jQuery('#div_stats').load('<?php 
                echo add_query_arg(array('action' => 'get_stats', 'page' => 'submissions_fm'), admin_url('admin-ajax.php'));
                ?>
', { 
									'task': 'show_stats',
									'form_id' : '<?php 
                echo $form_id;
                ?>
',
									'sorted_label_key' : jQuery('#sorted_label_key').val(),
									'startdate' : jQuery('#startstats').val(), 
									'enddate' : jQuery('#endstats').val(),
									'nonce_fm_ajax': '<?php 
                echo $ajax_nonce;
                ?>
'
								});
							}		
							else {
								jQuery('#div_stats').html("<div style='padding:10px 5px; color:red; font-size:14px;'>Please select the field!</div>");
							}	
							jQuery("#div_stats").removeClass("fm_loading");
						}
						</script>
						<?php 
            }
        }
        ?>
			</div>	
		</form>	
		<script> 
		function fm_scroll(element) {
			var scrollbar= document.createElement('div');
			scrollbar.appendChild(document.createElement('div'));
			scrollbar.style.overflow= 'auto';
			scrollbar.style.overflowY= 'hidden';
			scrollbar.firstChild.style.width= element.scrollWidth+'px';
			scrollbar.firstChild.style.paddingTop= '1px';
			scrollbar.firstChild.appendChild(document.createTextNode('\xA0'));
			scrollbar.onscroll= function() {
				element.scrollLeft= scrollbar.scrollLeft;
			};
			element.onscroll= function() {
				scrollbar.scrollLeft= element.scrollLeft;
			};
			element.parentNode.insertBefore(scrollbar, element);
		}
		jQuery(window).load(function() {
			fm_popup();
			fm_scroll(document.getElementById('fm-scroll'));
			if (typeof jQuery().fancybox !== 'undefined' && jQuery.isFunction(jQuery().fancybox)) {
				jQuery(".fm_fancybox").fancybox({
					'maxWidth ' : 600,
					'maxHeight' : 500
				});
			}
		});
		<?php 
        if ($ka_fielderov_search) {
            ?>
 
			document.getElementById('fields_filter').style.display = '';
        <?php 
        }
        ?>
		</script>
		<?php 
    }