<?php 


/*--------------------------------------------------------

FORM PROCESSING HERE

---------------------------------------------------------*/ 

//opt_get_installed_forms();
//Create form
if(isset($_POST['create_form'])) {
	
	$parent_form = $wpdb->get_row('SELECT * FROM '.OPT_DB_PREFIX.'opt_forms WHERE deleted != 1 AND parent_id = 0 AND id = '.$_REQUEST['parent_id']);
				
	$return_form_data_only = 1;
					
	$filename = dirname(__FILE__) . '/../optin_forms/';
					
	include($filename.$parent_form->file_url);

	$return_form_data_only = 0;
	
	
	//Overwrite values in the array
	foreach($_POST as $key => $value) {
		
		$opt_form_data[$key] = stripslashes($value);
		
	}
					
				
	$data = array(
					'id' => NULL,				
					'time_created' => current_time('mysql'),
					'parent_id' => $_POST['parent_id'],
					'name' => $_POST['optin_form_name'],
					'data' => opt_prepnserialize($opt_form_data)
				);
	
	$dwpc->insert(OPT_DB_PREFIX.'opt_forms',$data);	
	
	
	$form_success_text= 'New Custom Form "'.$_POST['optin_form_name'].'" Successfully Created!';
}


//Edit form
if(isset($_POST['edit_form']) && is_numeric($_POST['edit_form'])) {
	
	$parent_form = $wpdb->get_row('SELECT * FROM '.OPT_DB_PREFIX.'opt_forms WHERE deleted != 1 AND parent_id = 0 AND id = '.$_REQUEST['opt_parent_form']);
				
	$return_form_data_only = 1;
					
	$filename = dirname(__FILE__) . '/../optin_forms/';
					
	include($filename.$parent_form->file_url); 

	$return_form_data_only = 0;
	
	
	//Overwrite values in the array
	foreach($_POST as $key => $value) {
		
		$opt_form_data[$key] = stripslashes($value);
		
	}
	
	
				
	$data = array(		
					'time_created' => current_time('mysql'),
					'name' => $_POST['optin_form_name'],
					'data' => opt_prepnserialize($opt_form_data)
				);
	
	$dwpc->update(OPT_DB_PREFIX.'opt_forms',$data,array('id'=>$_POST['edit_form']));	

	$form_edit_success_text= 'Custom Form "'.$_POST['optin_form_name'].'" Successfully Edited!';
 
 
}


//Delete custom form
if(isset($_GET['delete_form']) && is_numeric($_GET['delete_form'])) {

	$form_deleted_text = opt_set_delete_status('opt_forms',$_GET['delete_form']);
		
}

//Handle Global Form Settings
if(isset($_POST['global_form_settings'])) { 

	opt_settings('default_form',$_POST['default_form']);
	opt_settings('opt_form_redirect_time',$_POST['opt_form_redirect_time']);
	opt_settings('form_teaser_delay',$_POST['form_teaser_delay']);
	opt_settings('show_powered_by',(array_key_exists('show_powered_by',$_POST))?'1':'0');
	opt_settings('optinlinks_affiliate_link',$_POST['optinlinks_affiliate_link']);
	opt_settings('passthrough',(array_key_exists('passthrough',$_POST))?'1':'0');
	opt_settings('register_leads',(array_key_exists('register_leads',$_POST))?$_POST['register_leads']:'');
	
	$form_success_text = 'Global Form Settings Successfully Updated!';

}

//GET PLUGIN ADMIN HEADER
include_once dirname(__FILE__) . '/layout/opt_header.php'; 


 
/*--------------------------------------------------------

PAGE CONTENTS SQL BUILDER HERE

---------------------------------------------------------*/ 

function opt_table_array()
{
    global $wpdb;
    global $dwpc;
	
    $date_range_sql  = opt_calculate_date_range();
	$filter_sql      = opt_table_click_filter_sql();
	$unique_sql		 = opt_table_unique_filter_sql();
    $contents        = $wpdb->get_results('SELECT * FROM ' . OPT_DB_PREFIX . 'opt_forms WHERE deleted!=1 AND parent_id=0 ORDER BY name ASC');
    $content_count   = $wpdb->num_rows;
    if ($wpdb->num_rows == 0) {
        return;
    }
	
    $i = 0;	
	
	$return['totals']['subscribers'] = 0;
    foreach ($contents as $content) {
        $i++;
        foreach ($content as $key => $value) {
            $data[$i][$key] = $value;
    	}
		
		//Unique value queries here		
		$data[$i]['forms'] = $wpdb->query('SELECT id FROM ' . OPT_DB_PREFIX . 'opt_forms WHERE deleted!=1 AND parent_id='.$content->id);
		
		$data[$i]['optins'] = $wpdb->query('SELECT id FROM ' . OPT_DB_PREFIX . 'opt_leads WHERE subscription_status = "Subscribed" AND opt_optin_link_form_id = '.$content->id.' AND '.$date_range_sql.' '.$unique_sql);
		
		$data[$i]['views'] = $wpdb->query('SELECT id FROM ' . OPT_DB_PREFIX . 'opt_forms_tracking WHERE tracking_type = "Load" AND opt_form_id = '.$content->id.' AND '.$date_range_sql. ' AND '.$filter_sql.' '.$unique_sql);
			
		if($data[$i]['views']>0) {
			$data[$i]['optin_rate'] = ($data[$i]['optins'] / $data[$i]['views'])*100;
		} else { 
			$data[$i]['optin_rate'] = 0;		
		}
		
		//sec advanced
		$data[$i]['closes'] = $wpdb->query('SELECT id FROM ' . OPT_DB_PREFIX . 'opt_forms_tracking WHERE tracking_type = "Close" AND opt_form_id = '.$content->id.' AND '.$date_range_sql.' AND '.$filter_sql.' '.$unique_sql);		
						
		if($data[$i]['views']>0) {
			$data[$i]['close_rate'] = ($data[$i]['closes'] / $data[$i]['views'])*100;
		} else { 
			$data[$i]['close_rate'] = 0;		
		}
		//esec advanced
		
				
    }
	
    if ($_GET['sort'] != '' && ($_GET['order'] == 'asc' || $_GET['order'] == 'desc')) {
        $data = opt_table_sorter($data);
    }
		
    $return = opt_array_table_paginator($data, 'mailers_page_count');
	
	if($return['totals']['views'] > 0) { $return['totals']['optin_rate'] = ($return['totals']['optins'] / $return['totals']['views'])* 100; $return['has_stats']=1; }
	
    $return['totals']['total_items'] = $content_count;
	
    return $return;
}


$contents = opt_table_array();

function opt_sub_table_array($id)
{
    global $wpdb;
    global $dwpc;
    $date_range_sql  = opt_calculate_date_range();
	$filter_sql      = opt_table_click_filter_sql();
	$unique_sql		 = opt_table_unique_filter_sql();
    $contents        = $wpdb->get_results('SELECT * FROM ' . OPT_DB_PREFIX . 'opt_forms WHERE deleted!=1 AND parent_id='.$id.' ORDER BY name ASC');
    $content_count   = $wpdb->num_rows;
    if ($wpdb->num_rows == 0) {
        return;
    }
	
    $i = 0;	
	
	$return['totals']['subscribers'] = 0;
    foreach ($contents as $content) {
        $i++;
        foreach ($content as $key => $value) {
            $data[$i][$key] = $value;
    	}
		
		//Unique value queries here		
		
		$data[$i]['optins'] = $wpdb->query('SELECT id FROM ' . OPT_DB_PREFIX . 'opt_leads WHERE subscription_status = "Subscribed" AND opt_optin_link_form_id = '.$content->id.' AND '.$date_range_sql.' '.$unique_sql);
		
		$data[$i]['views'] = $wpdb->query('SELECT id FROM ' . OPT_DB_PREFIX . 'opt_forms_tracking WHERE tracking_type = "Load" AND opt_form_id = '.$content->id.' AND '.$date_range_sql. ' AND '.$filter_sql.' '.$unique_sql);
		
		if($data[$i]['views']>0) {
			$data[$i]['optin_rate'] = ($data[$i]['optins'] / $data[$i]['views'])*100;
		} else { 
			$data[$i]['optin_rate'] = 0;		
		}
		
		//sec advanced
		$data[$i]['closes'] = $wpdb->query('SELECT id FROM ' . OPT_DB_PREFIX . 'opt_forms_tracking WHERE tracking_type = "Close" AND opt_form_id = '.$content->id.' AND '.$date_range_sql.' AND '.$filter_sql.' '.$unique_sql);		
						
		if($data[$i]['views']>0) {
			$data[$i]['close_rate'] = ($data[$i]['closes'] / $data[$i]['views'])*100;
		} else { 
			$data[$i]['close_rate'] = 0;		
		}
		//esec advanced
				
    }
	
    if ($_GET['sort'] != '' && ($_GET['order'] == 'asc' || $_GET['order'] == 'desc')) {
        $data = opt_table_sorter($data);
    }
		
    $return = opt_array_table_paginator($data, 'mailers_page_count');
	
	if($return['totals']['views'] > 0) { $return['totals']['optin_rate'] = ($return['totals']['optins'] / $return['totals']['views'])* 100; $return['has_stats']=1; }
	
    $return['totals']['total_items'] = $content_count;
	
    return $return;
}


?>




<?php 
/*--------------------------------------------------------

PAGE TITLE, HELP TEXT, AND ADVANCED SEARCH

---------------------------------------------------------*/ 
?>

<h2 style="margin-bottom:0; padding-bottom:0;">Optin Form Management <?php echo  opt_advanced_button(); ?> <?php echo  opt_help_button(); ?></h2>
<?php opt_help_text('forms'); ?>
<?php echo  opt_advanced_search(); ?>

<?php

if($form_success_text!='') {
	  echo opt_success_box($form_success_text.' <a href="javascript:void(0);" onclick="jQuery(\'#opt_success_box\').fadeOut(300);" style="float:right; position:relative; top:-5px;" class="button">Close</a>',$css='width:600px; padding:10px;',$class='updated below-h2');
		
  }
  
  elseif($form_edit_success_text!='') {
	  echo opt_success_box($form_edit_success_text.' <a href="'.opt_url('form_step_1=&opt_parent_form=&edit_form=').'" style="float:right; position:relative; top:-5px;" class="button">Done Editing</a>',$css='width:600px; padding:10px;',$class='updated below-h2');
		
  }
		
  elseif($form_deleted_text!='') {
	  echo opt_fail_box($form_deleted_text.' <a href="javascript:void(0);" onclick="jQuery(\'#opt_fail_box\').fadeOut(300);" style="float:right; position:relative; top:-5px;" class="button">Close</a>',$css='width:600px; padding:10px;',$class='error below-h2');
  }
  
  
  
  //Show success box for uploaded forms
  if(array_key_exists('form-upload',$_POST)){
	  
	  
	  echo '<div class="updated below-h2" style="width:700px; padding-bottom:10px;" id="opt_upload_success">';
	  
	  echo '<a href="javascript:void(0);" onclick="jQuery(\'#opt_upload_success\').fadeOut(300);" style="float:right; position:relative; top:5px;" class="button">Close</a>';
	  
	  require_once(ABSPATH.'wp-admin/includes/class-wp-upgrader.php');
	  
	  $overrides = array( 'test_form' => false, 'test_type' => false );
	  $file = wp_handle_upload( $_FILES['formzip'], $overrides );	
	  
	  if ( isset( $file['error'] ) ){
		  //ERROROROROROROROROROR!
		  //Haven't seen this yet, so idk what'll cause it. 
		  echo $file['error'];	
	  }else{
		  /*$this->filename = $_FILES[$form]['name'];
		  $this->package = $file['file'];*/
		  $title = 'Installing form(s) from: '.$_FILES['formzip']['name'];
		  $url = '';
		  $type = 'upload';
		  $nonce = 'form-upload';
		  
		  $upgrader = new WP_Upgrader(new WP_Upgrader_Skin( compact('type', 'title', 'nonce', 'url') ));
		  
		  $package = 	$file['file'];
		  $destination = WP_PLUGIN_DIR.'/opt/optin_forms/';
		  $clear_destination = false;
		  $clear_working = false;
		  $abort_if_destination_exists = false;
		  $hook_extra = array();
		  
		  $result = $upgrader->run(compact('package','destination','clear_destination','clear_working','hook_extra','abort_if_destination_exists'));
	  }
	  
	  echo '</div>';
	  
	  //Update available forms
	  opt_get_installed_forms();
	  
  }
			
  
  
?>




<script type="text/javascript">

	/*Function overrides for the preview form - */
	var $current_previewed_form_container = null;
	var $current_previewed_form_overlay = null;
	function opt_preview_form(){
		var id_to_preview = jQuery('#opt_parent_form').val();
		$current_previewed_form_container = jQuery('#optin_link_form_container' + id_to_preview);
		$current_previewed_form_overlay = jQuery('#optin_link_overlay' + id_to_preview);
		
		$current_previewed_form_container.fadeIn();
		$current_previewed_form_overlay.fadeIn();
	}
	
	function opt_form_hover(form_id,split_test_item_id){
	}
	
	function opt_form_click(form_id,split_test_item_id){
	}
	
	function opt_form_close(form_id,split_test_item_id){
		$current_previewed_form_container.fadeOut();
		$current_previewed_form_overlay.fadeOut();
		
		$current_previewed_form_container = null;
		$current_previewed_form_overlay = null;
	}
	
	function opt_form_onload(form_id,split_test_item_id){
	}
	
	function submit_form_editor() {
			
			window.scrollTo(0, 0);
		
			secure_form_error = 0;		
			
			optin_form_name = html_encode(jQuery('#optin_form_name').val());
					
			if(optin_form_name.length < 5) {
			
				secure_form_error = 1;
				error_text = '';
				
				if(optin_form_name.length < 5) { 
					error_text += '<strong>ERROR:</strong> Optin form name is required and must be at least 5 characters<br>';
				}	
				
				jQuery('#optin_form_warning_text').html(error_text);
				jQuery('#optin_form_warning_text').hide().fadeIn(200);
				
				
			} else {			
				
				jQuery('#optin_form_warning_text').fadeOut(200);
				jQuery('#optin_form_form').wrap('<form id="optin_form_form_id" method="post" action=""></form>');
				jQuery('#optin_form_form_id').submit();
							
			}
			
	}
	
	function html_encode(value){
		if (value) {
			return jQuery('<div />').text(value).html();
		} else {
			return '';
		}
	}
	
	function html_decode(value) {
		if (value) {
			return $('<div />').html(value).text();
		} else {
			return '';
		}
	}

</script>


<?php 
/*--------------------------------------------------------

FORMS START HERE

---------------------------------------------------------*/ 




$optin_forms = $wpdb->get_results('SELECT * FROM '.OPT_DB_PREFIX.'opt_forms WHERE deleted != 1');

$j = 0;

if((isset($_GET['edit_form']) && is_numeric($_GET['edit_form']) || isset($_REQUEST['form_step_1']) || isset($_GET['create_form'])) && $form_edit_success_text=='' && $form_success_text=='') { $form_display = ''; } else { $form_display = 'display:none;'; }

$form_settings_display = 'display:none;';


?>


<span id="optin_form_form" style="<?php echo  $form_display; ?>">
<div style="display:inline-block; margin-right:20px; position:relative">


<script type="text/javascript">
function ltrim(str,c){
	while(str.charAt(0) === c){
		str = str.substr(1);	
	}
	return str;
}
function opt_componentToHex(c) {
    var hex = c.toString(16);
    return hex.length == 1 ? "0" + hex : hex;
}

function opt_rgbToHex(r, g, b) {
    return "#" + opt_componentToHex(r) + opt_componentToHex(g) + opt_componentToHex(b);
}
function opt_hexToRgb(hex) {
    var bigint = parseInt( ltrim(hex,'#') , 16);
    return { r : (bigint >> 16) & 255, g : (bigint >> 8) & 255, b : bigint & 255}
}
/**
 * Converts an RGB color value to HSL. Conversion formula
 * adapted from http://en.wikipedia.org/wiki/HSL_color_space.
 * Assumes r, g, and b are contained in the set [0, 255] and
 * returns h, s, and l in the set [0, 1].
 *
 * @param   Number  r       The red color value
 * @param   Number  g       The green color value
 * @param   Number  b       The blue color value
 * @return  Array           The HSL representation
 */
function opt_rgbToHsl(r, g, b){
    r /= 255, g /= 255, b /= 255;
    var max = Math.max(r, g, b), min = Math.min(r, g, b);
    var h, s, l = (max + min) / 2;

    if(max == min){
        h = s = 0; // achromatic
    }else{
        var d = max - min;
        s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
        switch(max){
            case r: h = (g - b) / d + (g < b ? 6 : 0); break;
            case g: h = (b - r) / d + 2; break;
            case b: h = (r - g) / d + 4; break;
        }
        h /= 6;
    }

    return {h:h, s:s, l:l};
}
function clamp(min,max,x){
	return Math.min(Math.max(x,min),max);
}
/**
 * Converts an HSL color value to RGB. Conversion formula
 * adapted from http://en.wikipedia.org/wiki/HSL_color_space.
 * Assumes h, s, and l are contained in the set [0, 1] and
 * returns r, g, and b in the set [0, 255].
 *
 * @param   Number  h       The hue
 * @param   Number  s       The saturation
 * @param   Number  l       The lightness
 * @return  Array           The RGB representation
 */
function opt_hslToRgb(h, s, l){
    var r, g, b;

    if(s == 0){
        r = g = b = l; // achromatic
    }else{
        function hue2rgb(p, q, t){
            if(t < 0) t += 1;
            if(t > 1) t -= 1;
            if(t < 1/6) return p + (q - p) * 6 * t;
            if(t < 1/2) return q;
            if(t < 2/3) return p + (q - p) * (2/3 - t) * 6;
            return p;
        }

        var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
        var p = 2 * l - q;
        r = hue2rgb(p, q, h + 1/3);
        g = hue2rgb(p, q, h);
        b = hue2rgb(p, q, h - 1/3);
    }

    return {r:clamp(0,255,Math.round(r * 255)), g: clamp(0,255,Math.round(g * 255)), b: clamp(0,255,Math.round(b * 255))};
}
/*returns obj{color1:str, etc}*/
function opt_pick_colors(hexStr){
	var mainRgb = opt_hexToRgb(hexStr);
	var mainHsl = opt_rgbToHsl(mainRgb.r,mainRgb.g,mainRgb.b);
	
	/*add stuff to this to return it*/
	var retVal = {};
	retVal.main = hexStr;

	return retVal;
}
var opt_selected_color = '<?php echo $opt_form_data['button_color'] ; ?>';
var $gradient_button;
var $3d_button;
var $flat_button;
var $button_border_radius;


</script>
    
    <div style="margin-top:10px;">
    
        <div id="namediv" class="stuffbox "style="width:550px;">
          <h3 style="padding:10px; margin-top:0" class="opt_form_h3">
            <?php if($edit!='') { ?>Edit<?php } else { ?>Create<?php } ?> Custom Optin Form
            
    
            <?php if(isset($_REQUEST['opt_parent_form'])) { ?>
                <a href="<?php echo  opt_url('form_step_1=&opt_parent_form=&edit_form='); ?>" style="float:right; margin-left:10px; position:relative; top:-5px;" class="button">Cancel Editing</a>
            <?php } else { ?>
                <a href="javascript:void(0)" style="float:right; margin-left:10px; position:relative; top:-5px;" class="button" onclick="jQuery('#optin_form_form').slideToggle(); jQuery('#optin_form_live_preview').hide()">Close</a>
            <?php } ?>
    
           
            </h3>
            <div class="inside" style="padding-left:30px; padding-right:35px;">       
            
            	<?php if(empty($_REQUEST['form_step_1'])) { 
				
																				
					foreach($optin_forms as $optin_form) {
						
						//whatever this html can float around in the middle of stuff since it repositions its self anyways
						opt_preview_form($optin_form->id);
						
					}
									
				
				?>
            
            	<form method="post" action="">
            
            	<input type="hidden" name="form_step_1" value="1" />
                      
                <div id="create_optin_link">
                        
                    <div style="width:100%;" class="opt_form_name">
                    	Choose An Optin Form To Customize
                        <a href="javascript:void(0);" onClick="opt_preview_form();" style="float:right; text-decoration:none;">Preview</a>
                    </div>     
                                                    
					<?php
								echo opt_dropdown_from_table('opt_forms','name','','name','',$class='dropdownNormal','id="opt_parent_form" style="width:100%"','opt_parent_form',' WHERE deleted != 1 AND parent_id = 0');
								
					?>
								                          
                    <div style="margin-top:10px;">  
                    	
                    	After you click the button below you will be able to fully customize all the settings of the selected parent form using our real time form editor.
                    
                    </div>
                                                 
                    <div style="margin-top:10px;">                            
                                                    
                        <input type="submit" class="button-primary" id="optin_form_button" value="Start Form Customization" style="width:200px; text-align:center; margin-top:10px; margin-bottom:15px;">
                    
                    </div>
                
                </div>
                
                </form>
                 
            	<?php 
				
				/*-----------------------------------------------------------
				
				REALTIME FORM EDITOR HERE
				
				------------------------------------------------------------*/
				
				
				} else { 
				
            
				//Include the data from the form
				if(isset($_REQUEST['opt_parent_form']) && is_numeric($_REQUEST['opt_parent_form'])) {
					
					$parent_form = $wpdb->get_row('SELECT * FROM '.OPT_DB_PREFIX.'opt_forms WHERE deleted != 1 AND parent_id = 0 AND id = '.$_REQUEST['opt_parent_form']);
					
					$return_form_data_only = 1;
					
					$filename = dirname(__FILE__) . '/../optin_forms/';
					
					include($filename.$parent_form->file_url);

					$return_form_data_only = 0;
				}
				
				if(isset($_GET['edit_form']) && is_numeric($_GET['edit_form'])) {
					
					$edit = $wpdb->get_row('SELECT * FROM '.OPT_DB_PREFIX.'opt_forms WHERE deleted != 1 AND id = '.$_REQUEST['edit_form']);
					
					$edit_form_data = opt_unserialize($edit->data);
					
					foreach($edit_form_data as $key => $value) {
						
						$opt_form_data[$key] = $value;
						
					}
					
				}
				
				
				?>
                
                <?php if($edit!='') { ?>
                    <input type="hidden" name="edit_form" value="<?php echo  $edit->id ?>" />
                <?php } else { ?>
                    <input type="hidden" name="create_form" value="1" /> 
                <?php } ?>
                
                
                <input type="hidden" name="parent_id" value="<?php echo  $_REQUEST['opt_parent_form'] ?>" />
                
                <div id="optin_form_warning_text" class="error below-h2" style="display:none; background-color:#fff9f9; width:99%; color:#d30000; padding:10px; font-size:14px; line-height:20px; margin-top:10px;"></div>
                
                <div style="width:100%; font-size:12px; line-height:14px; margin-bottom:3px; margin-top:25px;" class="opt_form_name">Optin Form Name</div>     
                                   
                <input id="optin_form_name" type="text" name="optin_form_name" class="input" value="<?php echo  $edit->name ?>"  onfocus="jQuery('#optin_form_name_description').slideDown(80);" onblur=" setTimeout( function () { jQuery('#optin_form_name_description').slideUp(80); },100 )" style="width:100%">
                                          
                <div class="opt_description" id="optin_form_name_description" style="display:none; width:96%; margin-top:10px;">This is a name for your optin form for organizational purposes, it can be anything you want.</div>
      
                                  
            <script>
              jQuery( document ).ready(function() {
                jQuery( "#accordion" ).accordion({
				  heightStyle: "content",
      			  collapsible: true,
				  active: false,
				  icons: null
				});
                jQuery( "#accordion2" ).accordion({
				  heightStyle: "content",
      			  collapsible: true,
				  active: false,
				  icons: null
				});
                jQuery( "#accordion3" ).accordion({
				  heightStyle: "content",
      			  collapsible: true,
				  active: false,
				  icons: null
				});
                jQuery( "#accordion4" ).accordion({
				  heightStyle: "content",
      			  collapsible: true,
				  active: false,
				  icons: null
				});
                jQuery( "#accordion5" ).accordion({
				  heightStyle: "content",
      			  collapsible: true,
				  active: false,
				  icons: null
				});
              });
            </script>
            
            <style type="text/css">
						
				.ui-state-default {
					color:#333;			
				}
						
				.ui-accordion-header {
					border-radius:0 !important;
					background:#f3f3f3 !important;
					color:#333 !important;
					border:none !important;
				}
				
				.ui-accordion-header:hover {
					background:#e9f6f6 !important;
				}
				 				
				.ui-accordion-content {
					
					border-color:#f3f3f3 !important;
					border-radius:0 !important;
					padding:10px !important;
				}
				
				.wp-picker-default {
				
					width:80px !important;	
					
				}	
				
			</style>
            
            <?php
										
				$fonts[0]['name'] = htmlentities('Helvetica Neue');		
				$fonts[0]['value'] = htmlentities('"Helvetica Neue", Helvetica, "Open Sans", Arial');	
				$fonts[1]['name'] = htmlentities('Droid Sans');		
				$fonts[1]['value'] = htmlentities('"Droid Sans", "Open Sans", Arial');			
				$fonts[2]['name'] = htmlentities('Proxima Nova');		
				$fonts[2]['value'] = htmlentities('"Proxima Nova"');			
				$fonts[3]['name'] = htmlentities('Open Sans');		
				$fonts[3]['value'] = htmlentities('"Open Sans"');			
				$fonts[4]['name'] = htmlentities('Helvetica');		
				$fonts[4]['value'] = htmlentities('Helvetica');			
				$fonts[5]['name'] = htmlentities('Courier New');		
				$fonts[5]['value'] = htmlentities('"Courier New"');			
				$fonts[6]['name'] = htmlentities('Georgia');		
				$fonts[6]['value'] = htmlentities('Georgia');			
				$fonts[7]['name'] = htmlentities('Trebuchet');		
				$fonts[7]['value'] = htmlentities('Trebuchet');				
				$fonts[8]['name'] = htmlentities('Arial');		
				$fonts[8]['value'] = htmlentities('Arial');				
				$fonts[9]['name'] = htmlentities('Verdana');		
				$fonts[9]['value'] = htmlentities('Verdana');				
				$fonts[10]['name'] = htmlentities('Times New Roman');		
				$fonts[10]['value'] = htmlentities('"Times New Roman"');				
				$fonts[11]['name'] = htmlentities('Garamond');		
				$fonts[11]['value'] = htmlentities('Garamond');				
				$fonts[12]['name'] = htmlentities('Impact');		
				$fonts[12]['value'] = htmlentities('Impact');				
			
				 
				$alignments[0]['name'] = 'Left';		
				$alignments[0]['value'] = 'left';	
				$alignments[1]['name'] = 'Center';		
				$alignments[1]['value'] = 'center';	
				$alignments[2]['name'] = 'Right';		
				$alignments[2]['value'] = 'right';	
			?>
                                
            <div class="opt_form_subheader" style="margin-top:15px; border:none;'">
            	Form Field Settings
                <span style="float:right;">
                    <a href="javascript:void(0)" id="hide1" onClick="jQuery(this).hide(); jQuery('#show1').show(); jQuery('#accordion').slideUp()" style="text-decoration:none;">Hide</a>
                    <a href="javascript:void(0)" id="show1" onClick="jQuery(this).hide(); jQuery('#hide1').show(); jQuery('#accordion').slideDown()" style="display:none; text-decoration:none;">Show</a>
                </span>
            </div>  
                     
            <div id="accordion">
              <h3>Form Fields</h3>
              <div>                                               
               <table style="border:none;" cellpadding="8" cellspacing="0">                
                   <tr class="opt_table_row_form" onclick="checkbox_toggle('show_name_field','name');">                               
                      <td width="16">
                          <input type="checkbox" <?php if($opt_form_data['show_name_field']==1) { ?>checked="checked"<?php } ?> style="width:16px;" name="show_name_field" id="show_name_field" value="1" onclick="checkbox_toggle('show_name_field','name');" />
                      </td>
                      <td>
                          <strong>Name</strong>
                      </td>
                      <td align="right" style="font-size:12px; color:#777;">
                          Requires the user to submit their name.
                      </td>
                  </tr>         
                  <tr class="opt_table_row_form" id="show_name_field_contents" style="display:none;">
                     <td colspan="3">
                    	<input type="text" name="name-placeholder" class="form_placeholder_text" onkeyup="realtime_edit()" onkeydown="realtime_edit()" onblur="realtime_edit()" value="<?php echo $opt_form_data['name-placeholder'] ?>" style="width:100%;">
                    </td>
                  </tr>        
                   <tr class="opt_table_row_form_alt">                               
                      <td width="16">
                          <input type="checkbox" <?php if($opt_form_data['show_email_field']==1) { ?>checked="checked"<?php } ?> style="width:16px;" name="show_email_field" id="show_email_field" value="1" disabled />
                      </td>
                      <td>
                          <strong>Email Address</strong>
                      </td>
                      <td align="right" style="font-size:12px; color:#777;">
                          Requires the user to submit their email.
                      </td>
                  </tr>          
                  <tr class="opt_table_row_form_alt" id="show_email_field_contents" style="display:none;">
                     <td colspan="3">
                    	<input type="text" name="email-placeholder" class="form_placeholder_text" onkeyup="realtime_edit()" onkeydown="realtime_edit()" onblur="realtime_edit()" value="<?php echo $opt_form_data['email-placeholder'] ?>" style="width:100%;">
                    </td>
                  </tr>                
                   <tr class="opt_table_row_form" onclick="checkbox_toggle('show_phone_field','phone');">                               
                      <td width="16">
                          <input type="checkbox" <?php if($opt_form_data['show_phone_field']==1) { ?>checked="checked"<?php } ?> style="width:16px;" name="show_phone_field" id="show_phone_field" value="1" onclick="checkbox_toggle('show_phone_field','phone');" />
                      </td>
                      <td>
                          <strong>Phone Number</strong>
                      </td>
                      <td align="right" style="font-size:12px; color:#777;">
                          Requires their phone number.
                      </td>
                  </tr>  
                  <tr class="opt_table_row_form" id="show_phone_field_contents" style="display:none;">
                     <td colspan="3">
                    	<input type="text" name="phone-placeholder" class="form_placeholder_text" onkeyup="realtime_edit()" onkeydown="realtime_edit()" onblur="realtime_edit()" value="<?php echo $opt_form_data['phone-placeholder'] ?>" style="width:100%;">
                    </td>
                  </tr>   
                   <tr class="opt_table_row_form_alt" onclick="checkbox_toggle('show_address1_field','address1');">                               
                      <td width="16">
                          <input type="checkbox" <?php if($opt_form_data['show_address1_field']==1) { ?>checked="checked"<?php } ?> style="width:16px;" name="show_address1_field" id="show_address1_field" value="1" onclick="checkbox_toggle('show_address1_field','address1');" />
                      </td>
                      <td>
                          <strong>Address 1</strong>
                      </td>
                      <td align="right" style="font-size:12px; color:#777;">
                          The user's street address.
                      </td>
                  </tr>  
                  <tr class="opt_table_row_form_alt" id="show_address1_field_contents" style="display:none;">
                     <td colspan="3">
                    	<input type="text" name="address1-placeholder" class="form_placeholder_text" onkeyup="realtime_edit()" onkeydown="realtime_edit()" onblur="realtime_edit()" value="<?php echo $opt_form_data['address1-placeholder'] ?>" style="width:100%;">
                    </td>
                  </tr>   
                   <tr class="opt_table_row_form" onclick="checkbox_toggle('show_address2_field','address2');">                               
                      <td width="16">
                          <input type="checkbox" <?php if($opt_form_data['show_address2_field']==1) { ?>checked="checked"<?php } ?> style="width:16px;" name="show_address2_field" id="show_address2_field" value="1" onclick="checkbox_toggle('show_address2_field','address2');" />
                      </td>
                      <td>
                          <strong>Address 2</strong>
                      </td>
                      <td align="right" style="font-size:12px; color:#777;">
                          For apartment/suite numbers etc.
                      </td>
                  </tr>        
                  <tr class="opt_table_row_form" id="show_address2_field_contents" style="display:none;">
                     <td colspan="3">
                    	<input type="text" name="address2-placeholder" class="form_placeholder_text" onkeyup="realtime_edit()" onkeydown="realtime_edit()" onblur="realtime_edit()" value="<?php echo $opt_form_data['address2-placeholder'] ?>" style="width:100%;">
                    </td>
                  </tr>    
                   <tr class="opt_table_row_form_alt" onclick="checkbox_toggle('show_state_field','state');">                               
                      <td width="16">
                          <input type="checkbox" <?php if($opt_form_data['show_state_field']==1) { ?>checked="checked"<?php } ?> style="width:16px;" name="show_state_field" id="show_state_field" value="1" onclick="checkbox_toggle('show_state_field','state');" />
                      </td>
                      <td>
                          <strong>State</strong>
                      </td>
                      <td align="right" style="font-size:12px; color:#777;">
                          The user's state/province.
                      </td>
                  </tr>      
                  <tr class="opt_table_row_form_alt" id="show_state_field_contents" style="display:none;">
                     <td colspan="3">
                    	<input type="text" name="state-placeholder" class="form_placeholder_text" onkeyup="realtime_edit()" onkeydown="realtime_edit()" onblur="realtime_edit()" value="<?php echo $opt_form_data['state-placeholder'] ?>" style="width:100%;">
                    </td>
                  </tr>        
                   <tr class="opt_table_row_form" onclick="checkbox_toggle('show_zip_field','zip');">                               
                      <td width="16">
                          <input type="checkbox" <?php if($opt_form_data['show_zip_field']==1) { ?>checked="checked"<?php } ?> style="width:16px;" name="show_zip_field" id="show_zip_field" value="1" onclick="checkbox_toggle('show_zip_field','zip');" />
                      </td>
                      <td>
                          <strong>Zipcode</strong>
                      </td>
                      <td align="right" style="font-size:12px; color:#777;">
                          The user's mailing code.
                      </td>
                  </tr>        
                  <tr class="opt_table_row_form" id="show_zip_field_contents" style="display:none;">
                     <td colspan="3">
                    	<input type="text" name="zip-placeholder" class="form_placeholder_text" onkeyup="realtime_edit()" onkeydown="realtime_edit()" onblur="realtime_edit()" value="<?php echo $opt_form_data['zip-placeholder'] ?>" style="width:100%;">
                    </td>
                  </tr>      
                   <tr class="opt_table_row_form_alt" onclick="checkbox_toggle('show_country_field','country');">                               
                      <td width="16">
                          <input type="checkbox" <?php if($opt_form_data['show_country_field']==1) { ?>checked="checked"<?php } ?> style="width:16px;" name="show_country_field" id="show_country_field" value="1" onclick="checkbox_toggle('show_country_field','country');" />
                      </td>
                      <td>
                          <strong>Country</strong>
                      </td>
                      <td align="right" style="font-size:12px; color:#777;">
                          The user's country.
                      </td>
                  </tr>   
                  <tr class="opt_table_row_form_alt" id="show_country_field_contents" style="display:none;">
                     <td colspan="3">
                    	<input type="text" name="country-placeholder" class="form_placeholder_text" onkeyup="realtime_edit()" onkeydown="realtime_edit()" onblur="realtime_edit()" value="<?php echo $opt_form_data['country-placeholder'] ?>" style="width:100%;">
                    </td>
                  </tr>          
                   <tr class="opt_table_row_form" onclick="checkbox_toggle('show_custom1_field','custom1');">                               
                      <td width="16">
                          <input type="checkbox" <?php if($opt_form_data['show_custom1_field']==1) { ?>checked="checked"<?php } ?> style="width:16px;" name="show_custom1_field" id="show_custom1_field" value="1" onclick="checkbox_toggle('show_custom1_field','custom1');" />
                      </td>
                      <td>
                          <strong>Custom 1</strong>
                      </td>
                      <td align="right" style="font-size:12px; color:#777;">
                      </td>
                  </tr>    
                  <tr class="opt_table_row_form" id="show_custom1_field_contents" style="display:none;">
                     <td colspan="3">
                    	<input type="text" name="custom1-placeholder" class="form_placeholder_text" onkeyup="realtime_edit()" onkeydown="realtime_edit()" onblur="realtime_edit()" value="<?php echo $opt_form_data['custom1-placeholder'] ?>" style="width:100%;">
                    </td>
                  </tr>   
                   <tr class="opt_table_row_form_alt" onclick="checkbox_toggle('show_custom2_field','custom2');">                               
                      <td width="16">
                          <input type="checkbox" <?php if($opt_form_data['show_custom2_field']==1) { ?>checked="checked"<?php } ?> style="width:16px;" name="show_custom2_field" id="show_custom2_field" value="1" onclick="checkbox_toggle('show_custom2_field','custom2');" />
                      </td>
                      <td>
                          <strong>Custom 2</strong>
                      </td>
                      <td align="right" style="font-size:12px; color:#777;">
                      </td>
                  </tr>      
                  <tr class="opt_table_row_form_alt" id="show_custom2_field_contents" style="display:none;">
                     <td colspan="3">
                    	<input type="text" name="custom2-placeholder" class="form_placeholder_text" onkeyup="realtime_edit()" onkeydown="realtime_edit()" onblur="realtime_edit()" value="<?php echo $opt_form_data['custom2-placeholder'] ?>" style="width:100%;">
                    </td>
                  </tr>       
                   <tr class="opt_table_row_form" onclick="checkbox_toggle('show_custom3_field','custom3');">                               
                      <td width="16">
                          <input type="checkbox" <?php if($opt_form_data['show_custom3_field']==1) { ?>checked="checked"<?php } ?> style="width:16px;" name="show_custom3_field" id="show_custom3_field" value="1" onclick="checkbox_toggle('show_custom3_field','custom3');" />
                      </td>
                      <td>
                          <strong>Custom 3</strong>
                      </td>
                      <td align="right" style="font-size:12px; color:#777;">
                          User defined flexible fields
                      </td>
                  </tr>    
                  <tr class="opt_table_row_form" id="show_custom3_field_contents" style="display:none;">
                     <td colspan="3">
                    	<input type="text" name="custom3-placeholder" class="form_placeholder_text" onkeyup="realtime_edit()" onkeydown="realtime_edit()" onblur="realtime_edit()" value="<?php echo $opt_form_data['custom3-placeholder'] ?>" style="width:100%;">
                    </td>
                  </tr>        
                   <tr class="opt_table_row_form_alt" onclick="checkbox_toggle('show_custom4_field','custom4');">                               
                      <td width="16">
                          <input type="checkbox" <?php if($opt_form_data['show_custom4_field']==1) { ?>checked="checked"<?php } ?> style="width:16px;" name="show_custom4_field" id="show_custom4_field" value="1" onclick="checkbox_toggle('show_custom4_field','custom4');" />
                      </td>
                      <td>
                          <strong>Custom 4</strong>
                      </td>
                      <td align="right" style="font-size:12px; color:#777;">
                      </td>
                  </tr>     
                  <tr class="opt_table_row_form_alt" id="show_custom4_field_contents" style="display:none;">
                     <td colspan="3">
                    	<input type="text" name="custom4-placeholder" class="form_placeholder_text" onkeyup="realtime_edit()" onkeydown="realtime_edit()" onblur="realtime_edit()" value="<?php echo $opt_form_data['custom4-placeholder'] ?>" style="width:100%;">
                    </td>
                  </tr>        
                   <tr class="opt_table_row_form" onclick="checkbox_toggle('show_custom5_field','custom5');">                               
                      <td width="16">
                          <input type="checkbox" <?php if($opt_form_data['show_custom5_field']==1) { ?>checked="checked"<?php } ?> style="width:16px;" name="show_custom5_field" id="show_custom5_field" value="1" onclick="checkbox_toggle('show_custom5_field','custom5');" />
                      </td>
                      <td>
                          <strong>Custom 5</strong>
                      </td>
                      <td align="right" style="font-size:12px; color:#777;">
                      </td>
                  </tr>  
                  <tr class="opt_table_row_form" id="show_custom5_field_contents" style="display:none;">
                     <td colspan="3">
                    	<input type="text" name="custom5-placeholder" class="form_placeholder_text" onkeyup="realtime_edit()" onkeydown="realtime_edit()" onblur="realtime_edit()" onkeyup="realtime_edit()" onkeydown="realtime_edit()" onblur="realtime_edit()" value="<?php echo $opt_form_data['custom5-placeholder'] ?>" style="width:100%;">
                    </td>
                  </tr>                                         
              </table>    
              </div>
              <h3>Form Field Appearance</h3>
              <div>
                <p>
                	Border Color<br>
					<input type="text" name="field-border-color" onClick="realtime_edit()" onChange="realtime_edit()" id="field-border-color" data-default-color="<?php echo $opt_form_data['field-border-color']; ?>" value="<?php echo $opt_form_data['field-border-color']; ?>" style="width:80px;" /><br>
                    <input name="field-vertical-padding" id="field-vertical-padding" value="<?php echo $opt_form_data['field-vertical-padding'] ?>" type="number" style="width:55px;" onkeyup="realtime_edit()" onkeydown="realtime_edit()" onblur="realtime_edit()" onclick="realtime_edit()" onchange="realtime_edit()">px Vertical Padding
                </p>
              </div>        
             </div> 
                                 
            <div class="opt_form_subheader" style="margin-top:15px; border:none;'">
            	Form Layout Settings
                <span style="float:right;">
                    <a href="javascript:void(0)" id="hide2" onClick="jQuery(this).hide(); jQuery('#show2').show(); jQuery('#accordion2').slideUp();" style="text-decoration:none;">Hide</a>
                    <a href="javascript:void(0)" id="show2" onClick="jQuery(this).hide(); jQuery('#hide2').show(); jQuery('#accordion2').slideDown();" style="display:none; text-decoration:none;">Show</a>
                </span>
            </div>
            
            <div id="accordion2">
             <h3>Page Overlay</h3>
              <div>
                <p>
                	
                	Overlay Color<br>
					<input type="text" name="overlay_bg_color" onClick="realtime_edit()" onChange="realtime_edit()" id="overlay_bg_color" data-default-color="<?php echo $opt_form_data['overlay_bg_color']; ?>" value="<?php echo $opt_form_data['overlay_bg_color']; ?>" style="width:80px;" /><br>
                    
                    <input name="overlay_opacity" id="overlay_opacity" value="<?php echo $opt_form_data['overlay_opacity'] ?>" type="number" style="width:55px;" onkeyup="realtime_edit()" onkeydown="realtime_edit()" onblur="realtime_edit()" onclick="realtime_edit()" onchange="realtime_edit()">% Overlay Opacity
                    
                </p>
              </div>   
            </div>
                     
            <div class="opt_form_subheader" style="margin-top:15px; border:none;'">
            	Form Text Settings
                <span style="float:right;">
                    <a href="javascript:void(0)" id="hide3" onClick="jQuery(this).hide(); jQuery('#show3').show(); jQuery('#accordion3').slideUp()" style="text-decoration:none;">Hide</a>
                    <a href="javascript:void(0)" id="show3" onClick="jQuery(this).hide(); jQuery('#hide3').show(); jQuery('#accordion3').slideDown()" style="display:none; text-decoration:none;">Show</a>
                </span>
            </div>
            
            <div id="accordion3">
             
              <h3>Header Text</h3>
              <div>

                <div style="width:100%; font-size:12px; line-height:14px; margin-bottom:3px; margin-top:0px;" class="opt_form_name">Header Text</div>     
                                   
                <input id="header_text" name="header_text" type="text" class="opt_form_editor" onkeyup="realtime_edit()" onkeydown="realtime_edit()" onblur="realtime_edit()" value="<?php echo htmlentities($opt_form_data['header_text']); ?>" style="width:100%">     

                <div style="width:100%; font-size:12px; line-height:14px; margin-bottom:3px; margin-top:10px;" class="opt_form_name">Header Style</div>     
                
				<?php echo opt_dropdown('header_text-font',$fonts,htmlentities($opt_form_data['header_text-font']),$class='opt_form_editor_font',$html='style="width:100%" onChange="realtime_edit()"'); ?>	
                                            
                <div style="width:100%; font-size:12px; line-height:14px; margin-bottom:10px; margin-top:8px;">
                         
                    <table cellpadding="0" cellspacing="0"><tr><td width="35%">     
                                 
                    	Font Size: <input name="header_text-fontsize" value="<?php echo $opt_form_data['header_text-fontsize'] ?>" type="number" style="width:55px;" class="opt_form_editor_font_size" onkeyup="realtime_edit()" onkeydown="realtime_edit()" onblur="realtime_edit()" onclick="realtime_edit()" onchange="realtime_edit()">px 
					
                    </td><td width="35%">
                    
                    	Align: <?php echo opt_dropdown('header_text-align',$alignments, $opt_form_data['header_text-align'],$class='opt_form_editor_font_align',$html='style="width:90px;"  onChange="realtime_edit()"'); ?>	

					</td><td width="17%">
                    
						<input name="header_text-bold" <?php if($opt_form_data['header_text-bold']=='font-weight:bold;') { echo 'checked="checked"'; } ?>  type="checkbox" style="width:16px;" value="font-weight:bold;" class="opt_form_editor_font_bold" onClick="realtime_edit()"> <span style="font-weight:bold;">Bold</span>

					</td><td width="13%">
                    
                		<input name="header_text-italic" <?php if($opt_form_data['header_text-italic']=='font-style:italic;') { echo 'checked="checked"'; } ?> type="checkbox" style="width:16px;" value="font-style:italic" class="opt_form_editor_font_italic" onClick="realtime_edit()"> <em>Italic</em>
                
                	</td></tr></table>
                
                </div>
                    
                <input type="text" name="header_text-color" class="opt_form_editor_font_color" onClick="realtime_edit()" onChange="realtime_edit()" id="color_2" data-default-color="<?php echo $opt_form_data['header_text-color']; ?>" value="<?php echo $opt_form_data['header_text-color']; ?>" style="width:80px;" />
                
                
              </div>
              
              <h3>Body Text</h3>
              <div>
              
                <div style="width:100%; font-size:12px; line-height:14px; margin-bottom:3px; margin-top:0px;" class="opt_form_name">Body Text</div>     
                
                <textarea id="subheader_text" name="subheader_text" class="opt_form_editor" onkeyup="realtime_edit()" onkeydown="realtime_edit()" onblur="realtime_edit()"style="width:100%; height:110px;"><?php echo htmlentities($opt_form_data['subheader_text']); ?></textarea>   
                   
                <div style="width:100%; font-size:12px; line-height:14px; margin-bottom:3px; margin-top:10px;" class="opt_form_name">Body Style</div>                
				<?php echo opt_dropdown('subheader_text-font',$fonts,htmlentities($opt_form_data['subheader_text-font']),$class='opt_form_editor_font',$html='style="width:100%" onChange="realtime_edit()"'); ?>	
                                
                        
                <div style="width:100%; font-size:12px; line-height:14px; margin-bottom:10px; margin-top:8px;">
                         
                    <table cellpadding="0" cellspacing="0"><tr><td width="35%">     
                                 
                    	Font Size: <input name="subheader_text-fontsize" value="<?php echo $opt_form_data['subheader_text-fontsize'] ?>" type="number" style="width:55px;" class="opt_form_editor_font_size" onkeyup="realtime_edit()" onkeydown="realtime_edit()" onblur="realtime_edit()" onclick="realtime_edit()" onchange="realtime_edit()">px 
					
                    </td><td width="35%">
                    
                    	Align: <?php echo opt_dropdown('subheader_text-align',$alignments, $opt_form_data['subheader_text-align'],$class='opt_form_editor_font_align',$html='style="width:90px;"  onChange="realtime_edit()"'); ?>	

					</td><td width="17%">
                    
						<input name="subheader_text-bold" <?php if($opt_form_data['subheader_text-bold']=='font-weight:bold;') { echo 'checked="checked"'; } ?>  type="checkbox" style="width:16px;" value="font-weight:bold;" class="opt_form_editor_font_bold" onClick="realtime_edit()"> <span style="font-weight:bold;">Bold</span>

					</td><td width="13%">
                    
                		<input name="subheader_text-italic" <?php if($opt_form_data['subheader_text-italic']=='font-style:italic;') { echo 'checked="checked"'; } ?> type="checkbox" style="width:16px;" value="font-style:italic" class="opt_form_editor_font_italic" onClick="realtime_edit()"> <em>Italic</em>
                
                	</td></tr></table>
                
                </div>
                
                <input type="text" name="subheader_text-color" class="opt_form_editor_font_color" onClick="realtime_edit()" onChange="realtime_edit()" id="color_3" data-default-color="<?php echo $opt_form_data['subheader_text-color']; ?>" value="<?php echo $opt_form_data['subheader_text-color']; ?>" style="width:80px;" />
                                              
              </div>
              
              <h3>Submit Button</h3>
              <div>
                
                <div style="width:100%; font-size:12px; line-height:14px; margin-bottom:3px; margin-top:0px;" class="opt_form_name">Submit Button Text</div>     
                                   
                <input id="button_text" name="button_text" type="text" class="opt_form_editor" onkeyup="realtime_edit()" onkeydown="realtime_edit()" onblur="realtime_edit()"value="<?php echo htmlentities($opt_form_data['button_text']); ?>"    style="width:100%">
                     
                
                <table><tr><td width="100" valign="top">     
                         
                    <style type="text/css">
						.wp-picker-default {
						
							width:80px !important;	
							
						}					
					</style>     
                         
                    <div style="width:100%; font-size:12px; line-height:14px; margin-bottom:3px; margin-top:10px;" class="opt_form_name">Button Color</div>   
                                    
                    <input type="text" name="button_color" id="color_1" data-default-color="<?php echo $opt_form_data['button_color']; ?>" value="<?php echo  $opt_form_data['button_color']; ?>" style="width:80px;" />         
                    
                </td><td width="250" valign="top">
                
                	<div style="width:100%; font-size:12px; line-height:14px; margin-bottom:3px; margin-top:10px;" class="opt_form_name">Button Border Radius</div>  
                    
                	<input id="button_border_radius" name="button_border_radius" type="number" min="0" max="100" class="opt_form_editor" onkeyup="realtime_edit()" onkeydown="realtime_edit()"  onclick="realtime_edit()" onblur="realtime_edit()"value="<?php echo  $opt_form_data['button_border_radius']; ?>" style="width:50px;"> 
                    <span style="vertical-align:middle; padding-bottom:3px;">Pixels</span>
                        
                
                </td></tr></table>
                
                
                
                <div style="width:100%; font-size:12px; line-height:14px; margin-bottom:3px; margin-top:0px;" class="opt_form_name">Button Type</div>
                                    
                    <div style="display:inline-block; padding:2px; margin-right:2px;" onclick="jQuery('#button_type-1').prop('checked', true); realtime_edit();change_style();">
                    
                    	<input name="button_type" id="button_type-1" value="gradient" type="radio" onchange="realtime_edit();change_style();" style="width:16px;" <?php if($opt_form_data['button_type']=='gradient') { ?>checked="checked"<?php } ?> /> 
						<?php echo  opt_button_generator('gradient','optinlink',$opt_form_data['button_color'],$opt_form_data['button_border_radius'],'1392','Gradient','style="font-size:12px; padding:4px 20px;"'); ?>
                                   
                    </div>  
                    
                    <div style="display:inline-block; padding:2px; margin-right:2px;" onclick="jQuery('#button_type-2').prop('checked', true); realtime_edit();change_style();">             
                               
                		<input name="button_type" id="button_type-2" value="3d" type="radio" onchange="realtime_edit();change_style();" style="width:16px;" <?php if($opt_form_data['button_type']=='3d') { ?>checked="checked"<?php } ?>   /> 
						<?php echo  opt_button_generator('3d','optinlink',$opt_form_data['button_color'],$opt_form_data['button_border_radius'],'2587','Basic 3d','style="font-size:12px; padding:4px 20px;"'); ?>
                	
                    </div>
                	
                    <div style="display:inline-block; padding:2px;" onclick="jQuery('#button_type-3').prop('checked', true); realtime_edit();change_style();">
                
                		<input name="button_type" id="button_type-3" value="flat" type="radio" onchange="realtime_edit();change_style();" style="width:16px;" <?php if($opt_form_data['button_type']=='flat') { ?>checked="checked"<?php } ?>   /> 
						<?php echo  opt_button_generator('flat','optinlink',$opt_form_data['button_color'],$opt_form_data['button_border_radius'],'3287','Flat','style="font-size:12px; padding:4px 20px;"'); ?>
                        
                    </div>
                   
                        
                                    
                <?php /*
                <div style="width:100%; font-size:12px; line-height:14px; margin-bottom:3px; margin-top:0px;" class="opt_form_name">Submit Button Color</div>     
                        */ ?> 
                        
              </div>
              
              <h3>Footer Text</h3>
              <div>
                              
                <div style="width:100%; font-size:12px; line-height:14px; margin-bottom:3px; margin-top:0px;" class="opt_form_name">Privacy Text</div>     
                                   
                <input id="finetext_text" name="finetext_text" type="text" class="opt_form_editor" onkeyup="realtime_edit()" onkeydown="realtime_edit()" onblur="realtime_edit()"value="<?php echo htmlentities($opt_form_data['finetext_text']); ?>" style="width:100%">                
                
                <div style="width:100%; font-size:12px; line-height:14px; margin-bottom:3px; margin-top:10px;" class="opt_form_name">Footer Style</div>                
				<?php echo opt_dropdown('finetext_text-font',$fonts,htmlentities($opt_form_data['finetext_text-font']),$class='opt_form_editor_font',$html='style="width:100%" onChange="realtime_edit()"'); ?>	                                
                        
                <div style="width:100%; font-size:12px; line-height:14px; margin-bottom:10px; margin-top:8px;">
                         
                    <table cellpadding="0" cellspacing="0"><tr><td width="35%">     
                                 
                    	Font Size: <input name="finetext_text-fontsize" value="<?php echo $opt_form_data['finetext_text-fontsize'] ?>" type="number" style="width:55px;" class="opt_form_editor_font_size" onkeyup="realtime_edit()" onkeydown="realtime_edit()" onblur="realtime_edit()" onclick="realtime_edit()" onchange="realtime_edit()">px 
					
                    </td><td width="35%">
                    
                    	Align: <?php echo opt_dropdown('finetext_text-align',$alignments, $opt_form_data['finetext_text-align'],$class='opt_form_editor_font_align',$html='style="width:90px;"  onChange="realtime_edit()"'); ?>	

					</td><td width="17%">
                    
						<input name="finetext_text-bold" <?php if($opt_form_data['finetext_text-bold']=='font-weight:bold;') { echo 'checked="checked"'; } ?>  type="checkbox" style="width:16px;" value="font-weight:bold;" class="opt_form_editor_font_bold" onClick="realtime_edit()"> <span style="font-weight:bold;">Bold</span>

					</td><td width="13%">
                    
                		<input name="finetext_text-italic" <?php if($opt_form_data['finetext_text-italic']=='font-style:italic;') { echo 'checked="checked"'; } ?> type="checkbox" style="width:16px;" value="font-style:italic" class="opt_form_editor_font_italic" onClick="realtime_edit()"> <em>Italic</em>
                
                	</td></tr></table>
                
                </div>
                
                <input type="text" name="finetext_text-color" class="opt_form_editor_font_color" onClick="realtime_edit()" onChange="realtime_edit()" id="color_4" data-default-color="<?php echo $opt_form_data['finetext_text-color']; ?>" value="<?php echo $opt_form_data['finetext_text-color']; ?>" style="width:80px;" />
                
              </div>
            </div>
                     
            <div class="opt_form_subheader" style="margin-top:15px; border:none;'">
            	Waiting Text Settings
                <span style="float:right;">
                    <a href="javascript:void(0)" id="hide4" onClick="jQuery(this).hide(); jQuery('#show4').show(); jQuery('#accordion4').slideUp()" style="text-decoration:none;">Hide</a>
                    <a href="javascript:void(0)" id="show4" onClick="jQuery(this).hide(); jQuery('#hide4').show(); jQuery('#accordion4').slideDown()" style="display:none; text-decoration:none;">Show</a>
                </span>
            </div>
            
            <div id="accordion4">
              <h3>Header Text</h3>
              <div>
                              
                <div style="width:100%; font-size:12px; line-height:14px; margin-bottom:3px; margin-top:0px;" class="opt_form_name">Header Text</div>     
                                   
                <input id="header_waiting_text" name="header_waiting_text" type="text" class="opt_form_editor" onkeyup="realtime_edit()" onkeydown="realtime_edit()" onblur="realtime_edit()"value="<?php echo htmlentities($opt_form_data['header_waiting_text']); ?>"   style="width:100%">
                
                <div style="width:100%; font-size:12px; line-height:14px; margin-bottom:3px; margin-top:10px;" class="opt_form_name">Header Style</div>                
				<?php echo opt_dropdown('header_waiting_text-font',$fonts,htmlentities($opt_form_data['header_waiting_text-font']),$class='opt_form_editor_font',$html='style="width:100%" onChange="realtime_edit()"'); ?>	 
                        
                <div style="width:100%; font-size:12px; line-height:14px; margin-bottom:10px; margin-top:8px;">
                         
                    <table cellpadding="0" cellspacing="0"><tr><td width="35%">     
                                 
                    	Font Size: <input name="header_waiting_text-fontsize" value="<?php echo $opt_form_data['header_waiting_text-fontsize'] ?>" type="number" style="width:55px;" class="opt_form_editor_font_size" onkeyup="realtime_edit()" onkeydown="realtime_edit()" onblur="realtime_edit()" onclick="realtime_edit()" onchange="realtime_edit()">px 
					
                    </td><td width="35%">
                    
                    	Align: <?php echo opt_dropdown('header_waiting_text-align',$alignments, $opt_form_data['header_waiting_text-align'],$class='opt_form_editor_font_align',$html='style="width:90px;"  onChange="realtime_edit()"'); ?>	

					</td><td width="17%">
                    
						<input name="header_waiting_text-bold" <?php if($opt_form_data['header_waiting_text-bold']=='font-weight:bold;') { echo 'checked="checked"'; } ?>  type="checkbox" style="width:16px;" value="font-weight:bold;" class="opt_form_editor_font_bold" onClick="realtime_edit()"> <span style="font-weight:bold;">Bold</span>

					</td><td width="13%">
                    
                		<input name="header_waiting_text-italic" <?php if($opt_form_data['header_waiting_text-italic']=='font-style:italic;') { echo 'checked="checked"'; } ?> type="checkbox" style="width:16px;" value="font-style:italic" class="opt_form_editor_font_italic" onClick="realtime_edit()"> <em>Italic</em>
                
                	</td></tr></table>
                
                </div>
                
                <input type="text" name="header_waiting_text-color" class="opt_form_editor_font_color" onClick="realtime_edit()" onChange="realtime_edit()" id="color_5" data-default-color="<?php echo $opt_form_data['header_waiting_text-color']; ?>" value="<?php echo $opt_form_data['header_waiting_text-color']; ?>" style="width:80px;" />
                
              </div>
              
              <h3>Body Text</h3>
              <div>
                <div style="width:100%; font-size:12px; line-height:14px; margin-bottom:3px; margin-top:0px;" class="opt_form_name">Body Text</div>     
                                   
                <textarea id="subheader_waiting_text" name="subheader_waiting_text" class="opt_form_editor" onkeyup="realtime_edit()" onkeydown="realtime_edit()" onblur="realtime_edit()"style="width:100%; height:110px;"><?php echo htmlentities($opt_form_data['subheader_waiting_text']); ?></textarea>
                
                <div style="width:100%; font-size:12px; line-height:14px; margin-bottom:3px; margin-top:10px;" class="opt_form_name">Body Style</div>                
				<?php echo opt_dropdown('subheader_waiting_text-font',$fonts,htmlentities($opt_form_data['subheader_waiting_text-font']),$class='opt_form_editor_font',$html='style="width:100%" onChange="realtime_edit()"'); ?>	 
                        
                <div style="width:100%; font-size:12px; line-height:14px; margin-bottom:10px; margin-top:8px;">
                         
                    <table cellpadding="0" cellspacing="0"><tr><td width="35%">     
                                 
                    	Font Size: <input name="subheader_waiting_text-fontsize" value="<?php echo $opt_form_data['subheader_waiting_text-fontsize'] ?>" type="number" style="width:55px;" class="opt_form_editor_font_size" onkeyup="realtime_edit()" onkeydown="realtime_edit()" onblur="realtime_edit()" onclick="realtime_edit()" onchange="realtime_edit()">px 
					
                    </td><td width="35%">
                    
                    	Align: <?php echo opt_dropdown('subheader_waiting_text-align',$alignments, $opt_form_data['subheader_waiting_text-align'],$class='opt_form_editor_font_align',$html='style="width:90px;"  onChange="realtime_edit()"'); ?>	

					</td><td width="17%">
                    
						<input name="subheader_waiting_text-bold" <?php if($opt_form_data['subheader_waiting_text-bold']=='font-weight:bold;') { echo 'checked="checked"'; } ?>  type="checkbox" style="width:16px;" value="font-weight:bold;" class="opt_form_editor_font_bold" onClick="realtime_edit()"> <span style="font-weight:bold;">Bold</span>

					</td><td width="13%">
                    
                		<input name="subheader_waiting_text-italic" <?php if($opt_form_data['subheader_waiting_text-italic']=='font-style:italic;') { echo 'checked="checked"'; } ?> type="checkbox" style="width:16px;" value="font-style:italic" class="opt_form_editor_font_italic" onClick="realtime_edit()"> <em>Italic</em>
                
                	</td></tr></table>
                
                </div>
                
                <input type="text" name="subheader_waiting_text-color" class="opt_form_editor_font_color" onClick="realtime_edit()" onChange="realtime_edit()" id="color_6" data-default-color="<?php echo $opt_form_data['subheader_waiting_text-color']; ?>" value="<?php echo $opt_form_data['subheader_waiting_text-color']; ?>" style="width:80px;" />
                
                               
              </div>
              
              <h3>Footer Text</h3>
              <div>
                <div style="width:100%; font-size:12px; line-height:14px; margin-bottom:3px; margin-top:0px;" class="opt_form_name">Redirect Text</div>     
                                   
                <input id="waiting_text" name="waiting_text" type="text" class="opt_form_editor" onkeyup="realtime_edit()" onkeydown="realtime_edit()" onblur="realtime_edit()"value="<?php echo htmlentities($opt_form_data['waiting_text']); ?>"   style="width:100%">
                    
                <div style="width:100%; font-size:12px; line-height:14px; margin-bottom:3px; margin-top:10px;" class="opt_form_name">Redirect Text Style</div>                
				<?php echo opt_dropdown('waiting_text-font',$fonts,htmlentities($opt_form_data['waiting_text-font']),$class='opt_form_editor_font',$html='style="width:100%" onChange="realtime_edit()"'); ?>	 
                        
                <div style="width:100%; font-size:12px; line-height:14px; margin-bottom:10px; margin-top:8px;">
                         
                    <table cellpadding="0" cellspacing="0"><tr><td width="35%">     
                                 
                    	Font Size: <input name="waiting_text-fontsize" value="<?php echo $opt_form_data['waiting_text-fontsize'] ?>" type="number" style="width:55px;" class="opt_form_editor_font_size" onkeyup="realtime_edit()" onkeydown="realtime_edit()" onblur="realtime_edit()" onclick="realtime_edit()" onchange="realtime_edit()">px 
					
                    </td><td width="35%">
                    
                    	Align: <?php echo opt_dropdown('waiting_text-align',$alignments, $opt_form_data['waiting_text-align'],$class='opt_form_editor_font_align',$html='style="width:90px;"  onChange="realtime_edit()"'); ?>	

					</td><td width="17%">
                    
						<input name="waiting_text-bold" <?php if($opt_form_data['waiting_text-bold']=='font-weight:bold;') { echo 'checked="checked"'; } ?>  type="checkbox" style="width:16px;" value="font-weight:bold;" class="opt_form_editor_font_bold" onClick="realtime_edit()"> <span style="font-weight:bold;">Bold</span>

					</td><td width="13%">
                    
                		<input name="waiting_text-italic" <?php if($opt_form_data['waiting_text-italic']=='font-style:italic;') { echo 'checked="checked"'; } ?> type="checkbox" style="width:16px;" value="font-style:italic" class="opt_form_editor_font_italic" onClick="realtime_edit()"> <em>Italic</em>
                
                	</td></tr></table>
                
                </div>
                
                <input type="text" name="waiting_text-color" class="opt_form_editor_font_color" onClick="realtime_edit()" onChange="realtime_edit()" id="color_7" data-default-color="<?php echo $opt_form_data['waiting_text-color']; ?>" value="<?php echo $opt_form_data['waiting_text-color']; ?>" style="width:80px;" />
                      
              </div>
            </div>
                     
            <div class="opt_form_subheader" style="margin-top:15px; border:none;'">
            	Success Text Settings
                <span style="float:right;">
                    <a href="javascript:void(0)" id="hide5" onClick="jQuery(this).hide(); jQuery('#show5').show(); jQuery('#accordion5').slideUp()" style="text-decoration:none;">Hide</a>
                    <a href="javascript:void(0)" id="show5" onClick="jQuery(this).hide(); jQuery('#hide5').show(); jQuery('#accordion5').slideDown()" style="display:none; text-decoration:none;">Show</a>
                </span>
            </div>
            
            <div id="accordion5">
              <h3>Header Text</h3>
              <div>
              
                <div style="width:100%; font-size:12px; line-height:14px; margin-bottom:3px; margin-top:0px;" class="opt_form_name">Header Text</div>     
                                   
                <input id="header_success_text" name="header_success_text" type="text" class="opt_form_editor" onkeyup="realtime_edit()" onkeydown="realtime_edit()" onblur="realtime_edit()"value="<?php echo htmlentities($opt_form_data['header_success_text']); ?>"   style="width:100%">
                
                    
                <div style="width:100%; font-size:12px; line-height:14px; margin-bottom:3px; margin-top:10px;" class="opt_form_name">Header Text Style</div>                
				<?php echo opt_dropdown('header_success_text-font',$fonts,htmlentities($opt_form_data['header_success_text-font']),$class='opt_form_editor_font',$html='style="width:100%" onChange="realtime_edit()"'); ?>	 
                        
                <div style="width:100%; font-size:12px; line-height:14px; margin-bottom:10px; margin-top:8px;">
                         
                    <table cellpadding="0" cellspacing="0"><tr><td width="35%">     
                                 
                    	Font Size: <input name="header_success_text-fontsize" value="<?php echo $opt_form_data['header_success_text-fontsize'] ?>" type="number" style="width:55px;" class="opt_form_editor_font_size" onkeyup="realtime_edit()" onkeydown="realtime_edit()" onblur="realtime_edit()" onclick="realtime_edit()" onchange="realtime_edit()">px 
					
                    </td><td width="35%">
                    
                    	Align: <?php echo opt_dropdown('header_success_text-align',$alignments, $opt_form_data['header_success_text-align'],$class='opt_form_editor_font_align',$html='style="width:90px;"  onChange="realtime_edit()"'); ?>	

					</td><td width="17%">
                    
						<input name="header_success_text-bold" <?php if($opt_form_data['header_success_text-bold']=='font-weight:bold;') { echo 'checked="checked"'; } ?>  type="checkbox" style="width:16px;" value="font-weight:bold;" class="opt_form_editor_font_bold" onClick="realtime_edit()"> <span style="font-weight:bold;">Bold</span>

					</td><td width="13%">
                    
                		<input name="header_success_text-italic" <?php if($opt_form_data['header_success_text-italic']=='font-style:italic;') { echo 'checked="checked"'; } ?> type="checkbox" style="width:16px;" value="font-style:italic" class="opt_form_editor_font_italic" onClick="realtime_edit()"> <em>Italic</em>
                
                	</td></tr></table>
                
                </div>
                
                <input type="text" name="header_success_text-color" class="opt_form_editor_font_color" onClick="realtime_edit()" onChange="realtime_edit()" id="color_8" data-default-color="<?php echo $opt_form_data['header_success_text-color']; ?>" value="<?php echo $opt_form_data['header_success_text-color']; ?>" style="width:80px;" />
                
              </div>
              
              <h3>Body Text</h3>
              <div>
                                          
                <div style="width:100%; font-size:12px; line-height:14px; margin-bottom:3px; margin-top:0px;" class="opt_form_name">Body Text</div>     
                                   
                <textarea id="subheader_success_text" name="subheader_success_text" class="opt_form_editor" onkeyup="realtime_edit()" onkeydown="realtime_edit()" onblur="realtime_edit()"style="width:100%; height:60px;"><?php echo htmlentities($opt_form_data['subheader_success_text']); ?></textarea>
                       
                    
                <div style="width:100%; font-size:12px; line-height:14px; margin-bottom:3px; margin-top:10px;" class="opt_form_name">Header Text Style</div>                
				<?php echo opt_dropdown('subheader_success_text-font',$fonts,htmlentities($opt_form_data['subheader_success_text-font']),$class='opt_form_editor_font',$html='style="width:100%" onChange="realtime_edit()"'); ?>	 
                        
                <div style="width:100%; font-size:12px; line-height:14px; margin-bottom:10px; margin-top:8px;">
                         
                    <table cellpadding="0" cellspacing="0"><tr><td width="35%">     
                                 
                    	Font Size: <input name="subheader_success_text-fontsize" value="<?php echo $opt_form_data['subheader_success_text-fontsize'] ?>" type="number" style="width:55px;" class="opt_form_editor_font_size" onkeyup="realtime_edit()" onkeydown="realtime_edit()" onblur="realtime_edit()" onclick="realtime_edit()" onchange="realtime_edit()">px 
					
                    </td><td width="35%">
                    
                    	Align: <?php echo opt_dropdown('subheader_success_text-align',$alignments, $opt_form_data['subheader_success_text-align'],$class='opt_form_editor_font_align',$html='style="width:90px;"  onChange="realtime_edit()"'); ?>	

					</td><td width="17%">
                    
						<input name="subheader_success_text-bold" <?php if($opt_form_data['subheader_success_text-bold']=='font-weight:bold;') { echo 'checked="checked"'; } ?>  type="checkbox" style="width:16px;" value="font-weight:bold;" class="opt_form_editor_font_bold" onClick="realtime_edit()"> <span style="font-weight:bold;">Bold</span>

					</td><td width="13%">
                    
                		<input name="subheader_success_text-italic" <?php if($opt_form_data['subheader_success_text-italic']=='font-style:italic;') { echo 'checked="checked"'; } ?> type="checkbox" style="width:16px;" value="font-style:italic" class="opt_form_editor_font_italic" onClick="realtime_edit()"> <em>Italic</em>
                
                	</td></tr></table>
                
                </div>
                
                <input type="text" name="subheader_success_text-color" class="opt_form_editor_font_color" onClick="realtime_edit()" onChange="realtime_edit()" id="color_9" data-default-color="<?php echo $opt_form_data['subheader_success_text-color']; ?>" value="<?php echo $opt_form_data['subheader_success_text-color']; ?>" style="width:80px;" />
                                 
              </div>
              
              <h3>Footer Text</h3>
              <div>
                
                <div style="width:100%; font-size:12px; line-height:14px; margin-bottom:3px; margin-top:0px;" class="opt_form_name">Redirect Text</div>     
                                   
                <input id="redirect_text" name="redirect_text" type="text" class="opt_form_editor" onkeyup="realtime_edit()" onkeydown="realtime_edit()" onblur="realtime_edit()"value="<?php echo htmlentities($opt_form_data['redirect_text']); ?>"   style="width:100%">
                       
                    
                <div style="width:100%; font-size:12px; line-height:14px; margin-bottom:3px; margin-top:10px;" class="opt_form_name">Redirect Text Style</div>                
				<?php echo opt_dropdown('redirect_text-font',$fonts,htmlentities($opt_form_data['redirect_text-font']),$class='opt_form_editor_font',$html='style="width:100%" onChange="realtime_edit()"'); ?>	 
                        
                <div style="width:100%; font-size:12px; line-height:14px; margin-bottom:10px; margin-top:8px;">
                         
                    <table cellpadding="0" cellspacing="0"><tr><td width="35%">     
                                 
                    	Font Size: <input name="redirect_text-fontsize" value="<?php echo $opt_form_data['redirect_text-fontsize'] ?>" type="number" style="width:55px;" class="opt_form_editor_font_size" onkeyup="realtime_edit()" onkeydown="realtime_edit()" onblur="realtime_edit()" onclick="realtime_edit()" onchange="realtime_edit()">px 
					
                    </td><td width="35%">
                    
                    	Align: <?php echo opt_dropdown('redirect_text-align',$alignments, $opt_form_data['redirect_text-align'],$class='opt_form_editor_font_align',$html='style="width:90px;"  onChange="realtime_edit()"'); ?>	

					</td><td width="17%">
                    
						<input name="redirect_text-bold" <?php if($opt_form_data['redirect_text-bold']=='font-weight:bold;') { echo 'checked="checked"'; } ?>  type="checkbox" style="width:16px;" value="font-weight:bold;" class="opt_form_editor_font_bold" onClick="realtime_edit()"> <span style="font-weight:bold;">Bold</span>

					</td><td width="13%">
                    
                		<input name="redirect_text-italic" <?php if($opt_form_data['redirect_text-italic']=='font-style:italic;') { echo 'checked="checked"'; } ?> type="checkbox" style="width:16px;" value="font-style:italic" class="opt_form_editor_font_italic" onClick="realtime_edit()"> <em>Italic</em>
                
                	</td></tr></table>
                
                </div>
                
                <input type="text" name="redirect_text-color" class="opt_form_editor_font_color" onClick="realtime_edit()" onChange="realtime_edit()" id="color_10" data-default-color="<?php echo $opt_form_data['redirect_text-color']; ?>" value="<?php echo $opt_form_data['redirect_text-color']; ?>" style="width:80px;" />
                
              </div>
          	</div>
      
                 
                                          
                <div style="margin-top:10px;">                            
                                                
                    <input type="button" class="button-primary" id="optin_form_submit" value="Submit Customization" style="width:200px; text-align:center; margin-top:10px; margin-bottom:15px;" onclick="submit_form_editor()">
                
                </div>
                
                <?php } ?>          
                          
                
            </div>
        </div>
    </div>

</div>
</span>


<?php if(isset($_REQUEST['form_step_1'])) { ?>

<span style="display:inline-block; vertical-align:top;">
<div id="optin_form_live_preview" style="<?php echo  $form_display; ?>;">
    
    <div style="margin-top:10px;">
    
        <div id="namediv" class="stuffbox "style="width:650px;">
          <h3 style="padding:10px; margin-top:0; margin-bottom:0;" class="opt_form_h3">
				
                Live Optin Form Preview
           
            </h3>
            <div class="inside" style="padding:60px 30px; background-color:#444; background-image:url(<?php echo  plugins_url('/opt/images/'); ?>editor_bg.png); background-position:center top; background-repeat:repeat-y;">   
            	<script type="text/javascript">
				
				<?php
				
				if($edit!='') {
				
					$form_id = $parent_form->id; 					
					
				} else {
				
					$form_id = $parent_form->id; 
					
				}
				
				?>
					var $button;
					var default_style_attrs = '';
					var GRADIENT_CLASS = 'optin_link_button1392';
					var FLAT_CLASS = 'optin_link_button3287';
					var _3D_CLASS = 'optin_link_button2587';
					jQuery( document ).ready(function() {
										
						jQuery('#optin_link_form_container<?php echo  $form_id ; ?>').css( "position", "inherit" );
						jQuery('#optin_link_form_success<?php echo  $form_id ; ?>').css( "margin-top", "45px" );
						jQuery('#optin_link_form_waiting<?php echo  $form_id ; ?>').css( "margin-top", "45px" );
						jQuery('#optin_link_form_container<?php echo  $form_id ; ?>').show();
						jQuery('#optin_link_form_waiting<?php echo  $form_id ; ?>').show();
						jQuery('#optin_link_form_success<?php echo  $form_id ; ?>').show();
						
						$button = jQuery('.optin_link_button<?php echo $form_id ; ?>');
						$button.removeClass();
						default_style_attrs = $button.attr('style');
						<?php if($opt_form_data['button_type']=='3d') { ?>$button.addClass(_3D_CLASS);<?php } ?>
						<?php if($opt_form_data['button_type']=='flat') { ?>$button.addClass(FLAT_CLASS);<?php } ?>
						<?php if($opt_form_data['button_type']=='gradient') { ?>$button.addClass(GRADIENT_CLASS);<?php } ?>
						
											/*docs here: http://automattic.github.io/Iris/*/
						$gradient_button = jQuery('.'+GRADIENT_CLASS);
						$3d_button = jQuery('.'+_3D_CLASS);
						$flat_button = jQuery('.'+FLAT_CLASS);
						$button_border_radius = jQuery('#button_border_radius');
						
						prev_grad_button_inline = $gradient_button.attr('style');
						prev_3d_button_inline = $3d_button.attr('style');
						prev_flat_button_inline = $flat_button.attr('style');
						
						opt_selected_color = '<?php echo $opt_form_data['button_color'] ; ?>'
						
						if(opt_selected_color === ''){
							opt_selected_color = '#0088cc';	
						}
						
						$button_border_radius.keydown(function(){
							change_border_radius();
						});
						$button_border_radius.keyup(function(){
							change_border_radius();
						});
						$button_border_radius.change(function(){
							change_border_radius();
						});
						
						jQuery('#color_1').wpColorPicker({
								hide : true,
								width : 500,
								palettes: ['<?php echo $opt_form_data['button_color'] ; ?>','#dd3d36','#ffaa00','#64bb38','#34ada5','#0088cc','#7d3ac4','#ce40bd'],
								change : function(event,ui){
									opt_selected_color = ui.color.toString();
									realtime_edit();
									
									change_colors();
										
								}
							});
						
						jQuery('#color_2').wpColorPicker({
								hide : true,
								width : 500,
								palettes: ['<?php echo $opt_form_data['header_color'] ; ?>','#dd3d36','#ffaa00','#64bb38','#34ada5','#0088cc','#7d3ac4','#ce40bd'],
								change : function(event,ui){
									realtime_edit();										
								}
							});
							
						jQuery('#color_3').wpColorPicker({
								hide : true,
								width : 500,
								palettes: ['<?php echo $opt_form_data['header_color'] ; ?>','#dd3d36','#ffaa00','#64bb38','#34ada5','#0088cc','#7d3ac4','#ce40bd'],
								change : function(event,ui){
									realtime_edit();										
								}
							});
							
						jQuery('#color_4').wpColorPicker({
								hide : true,
								width : 500,
								palettes: ['<?php echo $opt_form_data['header_color'] ; ?>','#dd3d36','#ffaa00','#64bb38','#34ada5','#0088cc','#7d3ac4','#ce40bd'],
								change : function(event,ui){
									realtime_edit();										
								}
							});
							
						jQuery('#color_5').wpColorPicker({
								hide : true,
								width : 500,
								palettes: ['<?php echo $opt_form_data['header_color'] ; ?>','#dd3d36','#ffaa00','#64bb38','#34ada5','#0088cc','#7d3ac4','#ce40bd'],
								change : function(event,ui){
									realtime_edit();										
								}
							});
							
						jQuery('#color_6').wpColorPicker({
								hide : true,
								width : 500,
								palettes: ['<?php echo $opt_form_data['header_color'] ; ?>','#dd3d36','#ffaa00','#64bb38','#34ada5','#0088cc','#7d3ac4','#ce40bd'],
								change : function(event,ui){
									realtime_edit();										
								}
							});
							
						jQuery('#color_7').wpColorPicker({
								hide : true,
								width : 500,
								palettes: ['<?php echo $opt_form_data['header_color'] ; ?>','#dd3d36','#ffaa00','#64bb38','#34ada5','#0088cc','#7d3ac4','#ce40bd'],
								change : function(event,ui){
									realtime_edit();										
								}
							});
							
						jQuery('#color_8').wpColorPicker({
								hide : true,
								width : 500,
								palettes: ['<?php echo $opt_form_data['header_color'] ; ?>','#dd3d36','#ffaa00','#64bb38','#34ada5','#0088cc','#7d3ac4','#ce40bd'],
								change : function(event,ui){
									realtime_edit();										
								}
							});
							
						jQuery('#color_9').wpColorPicker({
								hide : true,
								width : 500,
								palettes: ['<?php echo $opt_form_data['header_color'] ; ?>','#dd3d36','#ffaa00','#64bb38','#34ada5','#0088cc','#7d3ac4','#ce40bd'],
								change : function(event,ui){
									realtime_edit();										
								}
							});
							
						jQuery('#color_10').wpColorPicker({
								hide : true,
								width : 500,
								palettes: ['<?php echo $opt_form_data['header_color'] ; ?>','#dd3d36','#ffaa00','#64bb38','#34ada5','#0088cc','#7d3ac4','#ce40bd'],
								change : function(event,ui){
									realtime_edit();										
								}
							});
							
						jQuery('#field-border-color').wpColorPicker({
								hide : true,
								width : 500,
								palettes: ['<?php echo $opt_form_data['header_color'] ; ?>','#dd3d36','#ffaa00','#64bb38','#34ada5','#0088cc','#7d3ac4','#ce40bd'],
								change : function(event,ui){
									realtime_edit();										
								}
							});
							
						jQuery('#overlay_bg_color').wpColorPicker({
								hide : true,
								width : 500,
								palettes: ['<?php echo $opt_form_data['header_color'] ; ?>','#dd3d36','#ffaa00','#64bb38','#34ada5','#0088cc','#7d3ac4','#ce40bd'],
								change : function(event,ui){
									realtime_edit();										
								}
							});
						
						
						dwpc_impression_id = 'aaa';
						
					});
					
					
					function change_style(){
						
						if(jQuery('#button_type-1').prop('checked') ){
							$button.removeClass();
							$button.addClass(GRADIENT_CLASS);
						}
						if(jQuery('#button_type-2').prop('checked') ){
							$button.removeClass();
							$button.addClass(_3D_CLASS);
						}
						if(jQuery('#button_type-3').prop('checked') ){
							$button.removeClass();
							$button.addClass(FLAT_CLASS);
						}
						change_colors();
					}
					
					jQuery(document).ready(function($) {
						realtime_edit();
					});
					
					function realtime_edit() {
						
						opacity = jQuery('#overlay_opacity').val();
						opacity = opacity / 100;
						
						jQuery('#optin_link_overlay<?php echo  $form_id ; ?>').css("background",jQuery('#overlay_bg_color').val());
						jQuery('#optin_link_overlay<?php echo  $form_id ; ?>').css("opacity",opacity);
										 
						jQuery('.opt_form_editor').each(function(index, obj){
							jQuery('#optin_link_'+jQuery(this).attr('name')+'<?php echo  $form_id ; ?>').html(jQuery(this).val());
							
							jQuery(this).blur(function(){
								
								jQuery(this).val(jQuery('#optin_link_'+jQuery(this).attr('name')+'<?php echo  $form_id ; ?>').html());
								
							});
									
							if(jQuery(this).val().length===0) {
								jQuery('#optin_link_'+jQuery(this).attr('name')+'<?php echo $form_id; ?>').fadeOut(800);
							} else {	
								jQuery('#optin_link_'+jQuery(this).attr('name')+'<?php echo $form_id; ?>').show();
							}
						});
						
						jQuery('.opt_form_editor_font').each(function(index, obj){
							
							element_name = jQuery(this).attr('name').split("-");							
							jQuery('#optin_link_'+element_name[0]+'<?php echo $form_id; ?>').css("font-family", jQuery(this).val());
							
							
						});
						
						jQuery('.opt_form_editor_font_size').each(function(index, obj){
							
							element_name = jQuery(this).attr('name').split("-");																		
							jQuery('#optin_link_'+element_name[0]+'<?php echo $form_id; ?>').css("font-size", jQuery(this).val()+"px");
							
						});
						
						jQuery('.opt_form_editor_font_color').each(function(index, obj){
							
							element_name = jQuery(this).attr('name').split("-");				
							jQuery('#optin_link_'+element_name[0]+'<?php echo $form_id; ?>').css("color", jQuery(this).val());
							
						});
						
						jQuery('.opt_form_editor_font_align').each(function(index, obj){
							
							element_name = jQuery(this).attr('name').split("-");
							jQuery('#optin_link_'+element_name[0]+'<?php echo $form_id; ?>').css("text-align", jQuery(this).val());
							
						});
						
						jQuery('.opt_form_editor_font_bold').each(function(index, obj){
							
							element_name = jQuery(this).attr('name').split("-");					
							if(jQuery(this).prop('checked')) {									
								jQuery('#optin_link_'+element_name[0]+'<?php echo $form_id; ?>').css("font-weight", "bold");
							} else {				
								jQuery('#optin_link_'+element_name[0]+'<?php echo $form_id; ?>').css("font-weight", "");							
							}
							
						});
						
						jQuery('.opt_form_editor_font_italic').each(function(index, obj){
							
							element_name = jQuery(this).attr('name').split("-");				
							if(jQuery(this).prop('checked')) {																				
								jQuery('#optin_link_'+element_name[0]+'<?php echo $form_id; ?>').css("font-style", "italic");
							} else {				
								jQuery('#optin_link_'+element_name[0]+'<?php echo $form_id; ?>').css("font-style", "");								
							}
							
							
						});
									
						
						if(jQuery('#show_name_field').prop('checked')) {
									
      						jQuery('#optin_link_name_field_container<?php echo $form_id; ?>').html('<input type="text" name="name" placeholder="'+jQuery('[name="name-placeholder"]').val()+'" class="optin_link_form_field<?php echo $form_id; ?>" id="optin_link_form_name<?php echo $form_id; ?>">');
							jQuery('#show_name_field_contents').show();
							jQuery('#optin_link_form_name<?php echo $form_id; ?>').css("cssText","padding-top: "+jQuery('#field-vertical-padding').val()+"px !important;padding-bottom: "+jQuery('#field-vertical-padding').val()+"px !important; border-color: "+jQuery('#field-border-color').val()+" !important;");	
							
						} else {
							
      						jQuery('#optin_link_name_field_container<?php echo $form_id; ?>').html('');
							jQuery('#show_name_field_contents').hide();
							
						}
						
						if(jQuery('#show_email_field').prop('checked')) {
									
      						jQuery('#optin_link_email_field_container<?php echo $form_id; ?>').html('<input type="text" name="email" placeholder="'+jQuery('[name="email-placeholder"]').val()+'" class="optin_link_form_field<?php echo $form_id; ?>" id="optin_link_form_email<?php echo $form_id; ?>">');
							jQuery('#show_email_field_contents').show();
							jQuery('#optin_link_form_email<?php echo $form_id; ?>').css("cssText","padding-top: "+jQuery('#field-vertical-padding').val()+"px !important;padding-bottom: "+jQuery('#field-vertical-padding').val()+"px !important; border-color: "+jQuery('#field-border-color').val()+" !important;");	
							
						} else {
							
      						jQuery('#optin_link_email_field_container<?php echo $form_id; ?>').html('');
							jQuery('#show_email_field_contents').hide();
							
						}
						
						if(jQuery('#show_phone_field').prop('checked')) {
									
      						jQuery('#optin_link_phone_field_container<?php echo $form_id; ?>').html('<input type="text" name="phone" placeholder="'+jQuery('[name="phone-placeholder"]').val()+'" class="optin_link_form_field<?php echo $form_id; ?>" id="optin_link_form_phone<?php echo $form_id; ?>">');
							jQuery('#show_phone_field_contents').show();
							jQuery('#optin_link_form_phone<?php echo $form_id; ?>').css("cssText","padding-top: "+jQuery('#field-vertical-padding').val()+"px !important;padding-bottom: "+jQuery('#field-vertical-padding').val()+"px !important; border-color: "+jQuery('#field-border-color').val()+" !important;");	
							
						} else {
							
      						jQuery('#optin_link_phone_field_container<?php echo $form_id; ?>').html('');
							jQuery('#show_phone_field_contents').hide();
							
						}
						
						if(jQuery('#show_address1_field').prop('checked')) {
									
      						jQuery('#optin_link_address1_field_container<?php echo $form_id; ?>').html('<input type="text" name="address1" placeholder="'+jQuery('[name="address1-placeholder"]').val()+'" class="optin_link_form_field<?php echo $form_id; ?>" id="optin_link_form_address1<?php echo $form_id; ?>">');
							jQuery('#show_address1_field_contents').show();
							jQuery('#optin_link_form_address1<?php echo $form_id; ?>').css("cssText","padding-top: "+jQuery('#field-vertical-padding').val()+"px !important;padding-bottom: "+jQuery('#field-vertical-padding').val()+"px !important; border-color: "+jQuery('#field-border-color').val()+" !important;");	
							
						} else {
							
      						jQuery('#optin_link_address1_field_container<?php echo $form_id; ?>').html('');
							jQuery('#show_address1_field_contents').hide();
							
						}
						
						if(jQuery('#show_address2_field').prop('checked')) {
									
      						jQuery('#optin_link_address2_field_container<?php echo $form_id; ?>').html('<input type="text" name="address2" placeholder="'+jQuery('[name="address2-placeholder"]').val()+'" class="optin_link_form_field<?php echo $form_id; ?>" id="optin_link_form_address2<?php echo $form_id; ?>">');
							jQuery('#show_address2_field_contents').show();
							jQuery('#optin_link_form_address2<?php echo $form_id; ?>').css("cssText","padding-top: "+jQuery('#field-vertical-padding').val()+"px !important;padding-bottom: "+jQuery('#field-vertical-padding').val()+"px !important; border-color: "+jQuery('#field-border-color').val()+" !important;");	
							
						} else {
							
      						jQuery('#optin_link_address2_field_container<?php echo $form_id; ?>').html('');
							jQuery('#show_address2_field_contents').hide();
							
						}
						
						if(jQuery('#show_state_field').prop('checked')) {
									
      						jQuery('#optin_link_state_field_container<?php echo $form_id; ?>').html('<input type="text" name="state" placeholder="'+jQuery('[name="state-placeholder"]').val()+'" class="optin_link_form_field<?php echo $form_id; ?>" id="optin_link_form_state<?php echo $form_id; ?>">');
							jQuery('#show_state_field_contents').show();
							jQuery('#optin_link_form_state<?php echo $form_id; ?>').css("cssText","padding-top: "+jQuery('#field-vertical-padding').val()+"px !important;padding-bottom: "+jQuery('#field-vertical-padding').val()+"px !important; border-color: "+jQuery('#field-border-color').val()+" !important;");	
							
						} else {
							
      						jQuery('#optin_link_state_field_container<?php echo $form_id; ?>').html('');
							jQuery('#show_state_field_contents').hide();
							
						}
						
						if(jQuery('#show_zip_field').prop('checked')) {
									
      						jQuery('#optin_link_zip_field_container<?php echo $form_id; ?>').html('<input type="text" name="zip" placeholder="'+jQuery('[name="zip-placeholder"]').val()+'" class="optin_link_form_field<?php echo $form_id; ?>" id="optin_link_form_zip<?php echo $form_id; ?>">');
							jQuery('#show_zip_field_contents').show();
							jQuery('#optin_link_form_zip<?php echo $form_id; ?>').css("cssText","padding-top: "+jQuery('#field-vertical-padding').val()+"px !important;padding-bottom: "+jQuery('#field-vertical-padding').val()+"px !important; border-color: "+jQuery('#field-border-color').val()+" !important;");	
							
						} else {
							
      						jQuery('#optin_link_zip_field_container<?php echo $form_id; ?>').html('');
							jQuery('#show_zip_field_contents').hide();
							
						}
						
						if(jQuery('#show_country_field').prop('checked')) {
									
      						jQuery('#optin_link_country_field_container<?php echo $form_id; ?>').html('<input type="text" name="country" placeholder="'+jQuery('[name="country-placeholder"]').val()+'" class="optin_link_form_field<?php echo $form_id; ?>" id="optin_link_form_country<?php echo $form_id; ?>">');
							jQuery('#show_country_field_contents').show();
							jQuery('#optin_link_form_country<?php echo $form_id; ?>').css("cssText","padding-top: "+jQuery('#field-vertical-padding').val()+"px !important;padding-bottom: "+jQuery('#field-vertical-padding').val()+"px !important; border-color: "+jQuery('#field-border-color').val()+" !important;");	
							
						} else {
							
      						jQuery('#optin_link_country_field_container<?php echo $form_id; ?>').html('');
							jQuery('#show_country_field_contents').hide();
							
						}
						
						if(jQuery('#show_custom1_field').prop('checked')) {
									
      						jQuery('#optin_link_custom1_field_container<?php echo $form_id; ?>').html('<input type="text" name="custom1" placeholder="'+jQuery('[name="custom1-placeholder"]').val()+'" class="optin_link_form_field<?php echo $form_id; ?>" id="optin_link_form_custom1<?php echo $form_id; ?>">');
							jQuery('#show_custom1_field_contents').show();
							jQuery('#optin_link_form_custom1<?php echo $form_id; ?>').css("cssText","padding-top: "+jQuery('#field-vertical-padding').val()+"px !important;padding-bottom: "+jQuery('#field-vertical-padding').val()+"px !important; border-color: "+jQuery('#field-border-color').val()+" !important;");	
							
						} else {
							
      						jQuery('#optin_link_custom1_field_container<?php echo $form_id; ?>').html('');
							jQuery('#show_custom1_field_contents').hide();
							
						}
						
						if(jQuery('#show_custom2_field').prop('checked')) {
									
      						jQuery('#optin_link_custom2_field_container<?php echo $form_id; ?>').html('<input type="text" name="custom2" placeholder="'+jQuery('[name="custom2-placeholder"]').val()+'" class="optin_link_form_field<?php echo $form_id; ?>" id="optin_link_form_custom2<?php echo $form_id; ?>">');
							jQuery('#show_custom2_field_contents').show();
							jQuery('#optin_link_form_custom2<?php echo $form_id; ?>').css("cssText","padding-top: "+jQuery('#field-vertical-padding').val()+"px !important;padding-bottom: "+jQuery('#field-vertical-padding').val()+"px !important; border-color: "+jQuery('#field-border-color').val()+" !important;");	
							
						} else {
							
      						jQuery('#optin_link_custom2_field_container<?php echo $form_id; ?>').html('');
							jQuery('#show_custom2_field_contents').hide();
							
						}
						
						if(jQuery('#show_custom3_field').prop('checked')) {
									
      						jQuery('#optin_link_custom3_field_container<?php echo $form_id; ?>').html('<input type="text" name="custom3" placeholder="'+jQuery('[name="custom3-placeholder"]').val()+'" class="optin_link_form_field<?php echo $form_id; ?>" id="optin_link_form_custom3<?php echo $form_id; ?>">');
							jQuery('#show_custom3_field_contents').show();
							jQuery('#optin_link_form_custom3<?php echo $form_id; ?>').css("cssText","padding-top: "+jQuery('#field-vertical-padding').val()+"px !important;padding-bottom: "+jQuery('#field-vertical-padding').val()+"px !important; border-color: "+jQuery('#field-border-color').val()+" !important;");	
							
						} else {
							
      						jQuery('#optin_link_custom3_field_container<?php echo $form_id; ?>').html('');
							jQuery('#show_custom3_field_contents').hide();
							
						}
						
						if(jQuery('#show_custom4_field').prop('checked')) {
									
      						jQuery('#optin_link_custom4_field_container<?php echo $form_id; ?>').html('<input type="text" name="custom4" placeholder="'+jQuery('[name="custom4-placeholder"]').val()+'" class="optin_link_form_field<?php echo $form_id; ?>" id="optin_link_form_custom4<?php echo $form_id; ?>">');
							jQuery('#show_custom4_field_contents').show();
							jQuery('#optin_link_form_custom4<?php echo $form_id; ?>').css("cssText","padding-top: "+jQuery('#field-vertical-padding').val()+"px !important;padding-bottom: "+jQuery('#field-vertical-padding').val()+"px !important; border-color: "+jQuery('#field-border-color').val()+" !important;");	
							
						} else {
							
      						jQuery('#optin_link_custom4_field_container<?php echo $form_id; ?>').html('');
							jQuery('#show_custom4_field_contents').hide();
							
						}
						
						if(jQuery('#show_custom5_field').prop('checked')) {
									
      						jQuery('#optin_link_custom5_field_container<?php echo $form_id; ?>').html('<input type="text" name="custom5" placeholder="'+jQuery('[name="custom5-placeholder"]').val()+'" class="optin_link_form_field<?php echo $form_id; ?>" id="optin_link_form_custom5<?php echo $form_id; ?>">');
							jQuery('#show_custom5_field_contents').show();
							jQuery('#optin_link_form_custom5<?php echo $form_id; ?>').css("cssText","padding-top: "+jQuery('#field-vertical-padding').val()+"px !important;padding-bottom: "+jQuery('#field-vertical-padding').val()+"px !important; border-color: "+jQuery('#field-border-color').val()+" !important;");	
							
						} else {
							
      						jQuery('#optin_link_custom5_field_container<?php echo $form_id; ?>').html('');
							jQuery('#show_custom5_field_contents').hide();
							
						}
						
						
					}
					function change_colors(){
						var hex = opt_selected_color;
						
						var main_color = opt_hexToRgb(hex);
						var main_hsl = opt_rgbToHsl(main_color.r,main_color.g,main_color.b);
						
						$button.removeAttr('style');
						
						/*flat*/
						$flat_button.attr('style','background:'+hex+';'+prev_flat_button_inline);
						
						
						
						/*gradient*/
						var color2_rgb = opt_hslToRgb(main_hsl.h,main_hsl.s*1.1,main_hsl.l*0.85);
						var color2_hex = opt_rgbToHex(color2_rgb.r,color2_rgb.g,color2_rgb.b);
						
						var color3_rgb = opt_hslToRgb(main_hsl.h,main_hsl.s*1.2,main_hsl.l*0.55);
						var color3_hex = opt_rgbToHex(color2_rgb.r,color2_rgb.g,color2_rgb.b);
						
						
				
				   
						$gradient_button.attr('style','background-image : -moz-linear-gradient(top, '+hex+', '+color2_hex+');background-image : -ms-linear-gradient(top, '+hex+', '+color2_hex+');background-image : -webkit-gradient(linear, '+hex+', '+color2_hex+');background-image : -webkit-linear-gradient(top, '+hex+', '+color2_hex+');background-image : -o-linear-gradient(top, '+hex+', '+color2_hex+');background-image : linear-gradient(top, '+hex+', '+color2_hex+');filter : progid:DXImageTransform.Microsoft.gradient(startColorstr="'+hex+'", endColorstr="'+color2_hex+'", GradientType=0);border-color : +'+hex + ' ' + color2_hex + ' ' + color3_hex+';background-color : '+hex+';'+prev_grad_button_inline);
						
						
					  
						/*3d*/
						var color4_rgb = opt_hslToRgb(main_hsl.h,main_hsl.s*1.1,main_hsl.l*0.7);
						var color4_hex = opt_rgbToHex(color2_rgb.r,color2_rgb.g,color2_rgb.b);
						
						$3d_button.attr('style','background:'+hex+';border-bottom-color:'+color4_hex+';-webkit-box-shadow:inset 0 -2px '+color4_hex+';box-shadow:inset 0 -2px '+color4_hex+';'+prev_3d_button_inline);
						
						if($button.hasClass(FLAT_CLASS)){
							
							$button.attr('style','background:'+hex+';' + default_style_attrs);
						}else if($button.hasClass(GRADIENT_CLASS)){
							
							$button.attr('style','background-image : -moz-linear-gradient(top, '+hex+', '+color2_hex+');background-image : -ms-linear-gradient(top, '+hex+', '+color2_hex+');background-image : -webkit-gradient(linear, '+hex+', '+color2_hex+');background-image : -webkit-linear-gradient(top, '+hex+', '+color2_hex+');background-image : -o-linear-gradient(top, '+hex+', '+color2_hex+');background-image : linear-gradient(top, '+hex+', '+color2_hex+');filter : progid:DXImageTransform.Microsoft.gradient(startColorstr="'+hex+'", endColorstr="'+color2_hex+'", GradientType=0);border-color : +'+hex + ' ' + color2_hex + ' ' + color3_hex+';background-color : '+hex+';' + default_style_attrs);
						}else if($button.hasClass(_3D_CLASS)){
							
							$button.attr('style','background:'+hex+';border-bottom-color:'+color4_hex+';-webkit-box-shadow:inset 0 -2px '+color4_hex+';box-shadow:inset 0 -2px '+color4_hex+';' + default_style_attrs);
							
						}
				
					}
					function change_border_radius(){
						var val = $button_border_radius.val();
        
						$flat_button.css('-webkit-border-radius',val+'px');
						$flat_button.css('-moz-border-radius',val+'px');
						$flat_button.css('border-radius',val+'px');
						
						$gradient_button.css('-webkit-border-radius',val+'px');
						$gradient_button.css('-moz-border-radius',val+'px');
						$gradient_button.css('border-radius',val+'px');
						
						
						$3d_button.css('-webkit-border-radius',val+'px');
						$3d_button.css('-moz-border-radius',val+'px');
						$3d_button.css('border-radius',val+'px');
						
						$button.css('-webkit-border-radius',val+'px');
						$button.css('-moz-border-radius',val+'px');
						$button.css('border-radius',val+'px');
					}
		
					function checkbox_toggle(checkbox_id,field_name) {
						
						if(document.getElementById(checkbox_id).checked) {
							
							jQuery('#'+checkbox_id).removeAttr('checked');	
							jQuery('#'+checkbox_id+"_contents").hide();
							
						} else {
							
							jQuery('#'+checkbox_id).attr('checked','checked');	
							jQuery('#'+checkbox_id+"_contents").show();
							
						}
												
						realtime_edit();
					}
					
				</script>
            	<?php 
					
					opt_preview_form($form_id); 					
					
				
				
				?>            
            </div>
            
       </div>
       
    </div>
</div>
</span>
            

<?php } ?>


<?php //GLOBAL FORM SETTINGS

//Optin form previews
$optin_forms = $wpdb->get_results('SELECT * FROM '.OPT_DB_PREFIX.'opt_forms WHERE parent_id = 0 AND deleted != 1');

$j = 0;
														
foreach($optin_forms as $optin_form) {
	$form_options[$j]['name'] = stripslashes($optin_form->name);		
	$form_options[$j]['value'] = $optin_form->id;									
	
	$custom_optin_forms = $wpdb->get_results('SELECT * FROM '.OPT_DB_PREFIX.'opt_forms WHERE parent_id = '.$optin_form->id.' AND deleted != 1 ORDER BY name ASC');
	$j++;
	
	//whatever this html can float around in the middle of stuff since it repositions its self anyways
	opt_preview_form($optin_form->id);
	if($wpdb->num_rows > 0) {
	
		foreach($custom_optin_forms as $custom_optin_form) {
		
			$form_options[$j]['name'] = '&nbsp; - '.stripslashes($custom_optin_form->name);		
			$form_options[$j]['value'] = $custom_optin_form->id;	
			
			$j++;
			opt_preview_form($custom_optin_form->id);										
		}									
		
	}								
	
}

//sec advanced
//Split Tests
$split_tests = $wpdb->get_results('SELECT * FROM '.OPT_DB_PREFIX.'opt_split_tests WHERE deleted != 1 ORDER BY name ASC');

if($wpdb->num_rows > 0) {
								
	foreach($split_tests as $split_test) {
		
		$form_options[$j]['name'] = 'Split Test: '.stripslashes($split_test->name);		
		$form_options[$j]['value'] = 'split_test-'.$split_test->id;
			
		$j++;
	
	}

}	
//esec advanced


 ?>
<div id="optin_form_settings" style="display:none;">
    
    <div style="margin-top:10px;">
    
    	<form method="post" action="">
    
        <input type="hidden" name="global_form_settings" value="1" />       
    
        <div id="namediv" class="stuffbox "style="width:550px;">
        
          <h3 style="padding:10px; margin-top:0" class="opt_form_h3">
    
    			OptinLinks Global Form Settings
                <a href="javascript:void(0)" style="float:right; margin-left:10px; position:relative; top:-5px;" class="button" onclick="jQuery('#optin_form_settings').slideToggle();">Close</a>

            </h3>
            
            <div class="inside" style="padding-left:30px; padding-right:35px;">                 
                <div id="global_form_settings">
  
                  <div id="secure_link_warning_text" class="error below-h2" style="display:none; background-color:#fff9f9; width:660px; color:#d30000; padding:10px; font-size:14px; line-height:20px; margin-top:10px;"></div>
                  
                  <div style="width:100%;" class="opt_form_name">Default Form To Show On Secure Pages</div>     
                  
				<?php		
				  echo opt_dropdown('default_form',$form_options, opt_settings('default_form'),$class='',$html='style="width:100%"');
				?>			
							
                 
                  
                  <div style="width:100%;" class="opt_form_name">  
                                     
                  <input id="opt_form_redirect_time" type="text" name="opt_form_redirect_time" class="input" value="<?php echo  opt_settings('opt_form_redirect_time'); ?>" onfocus="jQuery('#opt_form_redirect_time_description').slideDown(80);" onblur=" setTimeout( function () { jQuery('#opt_form_redirect_time_description').slideUp(80); },100 )" style="width:80px;">
                  
                  Form Redirect Delay (In Seconds)
                  
                  </div>  
                  
                  <div class="opt_description" id="opt_form_redirect_time_description" style="display:none; width:98%; margin-top:10px;">
                      This is how long the "Successful Redirection" message will display after a user has successfully submitted their email address.
                  </div>
  
                  
                  <div style="width:100%;" class="opt_form_name">  
                                     
                  <input id="form_teaser_delay" type="text" name="form_teaser_delay" class="input" value="<?php echo  opt_settings('form_teaser_delay'); ?>" onfocus="jQuery('#form_teaser_delay_description').slideDown(80);" onblur=" setTimeout( function () { jQuery('#form_teaser_delay_description').slideUp(80); },100 )" style="width:80px;">
                  
                  Form Fade In Delay On Secure Pages (In Seconds)
                  
                  </div>  
                  
                  <div class="opt_description" id="form_teaser_delay_description" style="display:none; width:98%; margin-top:10px;">
                      This is how long the software will wait before displaying the form when a visitor goes directly to a secure page. You can use this setting to define an amount of 'teaser' time in which the visitor can see the page before you ask for their email.
                  </div>
                  
                  
                  
                  <div style="width:100%;" class="opt_form_name">  
                                     
                  OptinLinks Affiliate Link<br />                                    
                  <input id="optinlinks_affiliate_link" type="text" name="optinlinks_affiliate_link" class="input" value="<?php echo  opt_settings('optinlinks_affiliate_link'); ?>" onfocus="jQuery('#optinlinks_affiliate_link_description').slideDown(80);" onblur=" setTimeout( function () { jQuery('#optinlinks_affiliate_link_description').slideUp(80); },100 )" style="width:100%;">
                 
                   <div style="padding-top:10px; padding-left:2px;">
                 
                  <input type="checkbox" name="show_powered_by" value="1" <?php if(opt_settings('show_powered_by')==1) { ?>checked="checked"<?php } ?> style="width:16px;" /> Show OptinLinks Affiliate Link

                  </div>
                  
                  </div>  
                  
                  <div class="opt_description" id="optinlinks_affiliate_link_description" style="display:none; width:98%; margin-top:10px;">
                      Change this link to your affiliate link for OptinLinks and get commissions by referring new customers to us!
                  </div>
      
                  <div class="opt_description">
                     Sign up for our affiliate program at <a href="http://www.optinlinks.com/jv/" target="new">http://www.optinlinks.com/jv/</a><br />
                     Use code "olcustomer" to get approval for instant commisions.
                  </div>
    
    			
                  <div style="padding-top:10px; padding-left:2px;" class="opt_form_name">
                 
                  <input type="checkbox" name="passthrough" value="1" <?php if(opt_settings('passthrough')==1) { ?>checked="checked"<?php } ?> style="width:16px;" /> Pass Email and Name to the secure page after optin.
                  
                  </div>
                  
                  <div class="opt_description">
                  	This feature will add the email of the lead to the URL variables on your secure page like this: http://www.yoursite.com/securepage/?optinlinks_email=email&amp;name=name
                  </div>
                  

                  
                  <div style="padding-top:10px; padding-left:2px;" class="opt_form_name">
                 
                  <input type="checkbox" name="register_leads" value="1" <?php if(opt_settings('register_leads')!='') { ?>checked="checked"<?php } ?> style="width:16px;" /> Register leads as accounts on your Wordpress site.                  

                  </div>
                  
                  <div class="opt_description">
                  	This will register the leads from OptinLinks as users on your wordpress site.
                  </div>
                  
                  <div style="margin-top:10px;">                            
                                                  
                      <input type="submit" class="button-primary" id="secure_link_button" value="Save Global Form Settings" onclick="secure_link_form()" style="width:200px; text-align:center; margin-top:10px; margin-bottom:15px;">
                  
                  </div>
                    
            </div>
        </div>
        </div>
        
        </form>
        
    </div>
</div>

<?php //UPLOAD FORM ?>
<div id="optin_form_upload" style="display:none;">
    
    <div style="margin-top:10px;">
    
        <input type="hidden" name="form_settings" value="1" />       
    
        <div id="namediv" class="stuffbox" style="width:550px;">
          <h3 style="padding:10px; margin-top:0" class="opt_form_h3">
    
    			OptinLinks Form Template Uploader
                <a href="javascript:void(0)" style="float:right; margin-left:10px; position:relative; top:-5px;" class="button" onclick="jQuery('#optin_form_upload').slideToggle();">Close</a>

            </h3>
            <div class="inside" style="padding-left:30px; padding-right:35px;">       
            
            		<div style="background-color:#e9f6ff; padding:15px; padding-bottom:25px; margin-bottom:10px;">
            
                    <form method="post" enctype="multipart/form-data" class="wp-upload-form" action="">
                    
                        <?php wp_nonce_field( '','form-upload'); ?>
                        <input type="file" id="pluginzip" name="formzip" />
                        
                        <div style="width:300px;">
                        
                            <?php submit_button( 'Upload OptinLinks Form Template', 'button-primary', 'upload_form', false ); ?>
                        
                        </div>
                        
                    </form>
                    
                    </div>
                    
                    <div class="opt_description" style="margin-bottom:10px;">
                
                	Use this form to upload new custom templates you've received from OptinLinks. The upload must be the zip file that you downloaded directly from OptinLinks.com. Click "Choose File," navigate to the folder you downloaded the zip file to, select it, and click the upload button to the left.
                
                	</div>

                
            </div>
        </div>
    </div>
</div>
<?php 
/*--------------------------------------------------------

PAGE, CONTENT, AND GROUPING CONTROLS

---------------------------------------------------------*/ 
?>

<table width="100%" style="margin:0; padding:0;"><tr style="padding-left:0;"><td style="padding-left:0;">   
    
    
      <a href="javascript:void(0);" onclick="jQuery('#optin_form_form').slideToggle(); jQuery('#optin_form_upload').hide(); jQuery('#optin_form_live_preview').slideToggle();jQuery('#optin_form_settings').hide();" class="button">Create Custom Form</a>
      
	  <a href="javascript:void(0);" onclick="jQuery('#optin_form_settings').slideToggle(); jQuery('#optin_form_upload').hide(); jQuery('#optin_form_live_preview').hide();jQuery('#optin_form_form').hide();" class="button">Global Form Settings</a> 
     
	  <a href="javascript:void(0);" onclick="jQuery('#optin_form_upload').slideToggle(); jQuery('#optin_form_settings').hide(); jQuery('#optin_form_live_preview').hide();jQuery('#optin_form_form').hide();" class="button">Upload Templates</a> 
     
      <?php if($contents['totals']['total_items']>1) { ?>
         
          <?php if (isset($_GET['show_all']) && $_GET['show_all'] == 1) { ?>
                <a href="<?php echo  opt_url('show_all=&campaign='); ?>" class="button" style="text-decoration:none;">Hide All Custom Forms</a> 
          <?php } else { ?>
                <a href="<?php echo  opt_url('show_all=1&campaign='); ?>" class="button">Show All Custom Forms</a> 
          <?php } ?>	  
      
      <?php } ?>
      
	  <?php if ((isset($_GET['order']) && $_GET['order'] != '') || (isset($_GET['sort']) && $_GET['sort'] != '')) { ?>      
      <a href="<?php echo  opt_url('sort=&order=', ''); ?>" class="button">Clear Sorting</a>  
      <?php } ?> 
  
</td><td>  
  
  <div class="alignright actions" style="margin:10px 0 0 0; text-align:right;">
    <?php echo  opt_date_range_form(); ?>
  </div>

</td></tr></table>


<div class="opt_info_box" style="margin-bottom:6px;">
  <table width="100%" style="margin:0px; padding:0px;">
    <tr>
      <td style="margin:0px; padding:0px;"><?php
$page_info = opt_page_info($contents['totals']['total_items'], 'forms_page_count')?>
        Showing Optin Forms
        <?php echo  number_format($page_info['start_item'], 0); ?>
        -
        <?php echo  number_format($page_info['end_item'], 0); ?>
        of
        <?php echo  number_format($contents['totals']['total_items'], 0); ?>
        on Page
        <?php echo  number_format($page_info['page'], 0); ?>
        of
        <?php echo  number_format($page_info['total_pages'], 0); ?></td>
      <td align="right" style="margin:0px; padding:0px;">
            <?php echo  ucwords(opt_pagination($contents['totals']['total_items'], 'forms_page_count', 1)); ?>
   	  </td>
    </tr>
  </table>
</div>  

<?php 
/*--------------------------------------------------------

GRAPHING GOES HERE

---------------------------------------------------------*/ 

$show_graph = opt_bar_graph('form_graph');
	
?>


<div style="margin-bottom:6px;">

<table class="widefat" width="100%">
    <thead>
        <tr>
            <th>
                <div style="display:inline-block; margin-right:20px; font-weight:bold;">
                    Optin Form Performance Graph
                </div>
				<?php if($show_graph==1 && $contents!='') { ?>
                	<a href="<?php echo  opt_url('hide_graph=1&show_graph='); ?>" style="text-decoration:none;">Hide Graph</a>
                <?php } else { ?>
                	<a href="<?php echo  opt_url('hide_graph=2&show_graph=1'); ?>">Show Graph</a>                
                <?php } ?>
  				<div id="choices" style="display:inline-block; line-height:10px; margin-top:3px; vertical-align:baseline; float:right; vertical-align:text-bottom"></div>
            </th>
        </tr>
    </thead>
	<?php if($show_graph==1 && $contents['has_stats']==1) { ?>
        <tbody>
            <tr>
                <td>
                    <div id="placeholder" style="width:99%; height:200px;"></div>
                </td>
            </tr>
        </tbody>
	<?php } ?>
</table>

</div>


<?php 
/*--------------------------------------------------------

TABULATED CONTENT HERE

---------------------------------------------------------*/ 
?>

<table class="widefat" width="100%">
  <?php
for ($i = 1; $i <= 2; $i++) {
    if ($i == 1) {
        $th = 'thead';
    } elseif ($i == 2) {
        $th = 'tfoot';
    } ?>
  <?php echo  '<' . $th . '>' ?>
  <tr>
    <?php if($opt_mode==1) { ?><th width="30"><?php echo  opt_table_sort_link('ID', 'id', ''); ?></th><?php } ?>
    <th width="45"><?php echo  opt_table_sort_link('Forms', 'forms', 'The amount of custom forms derived from this parent form'); ?></th>
    <th><?php echo  opt_table_sort_link('Form Name', 'name', 'The internal name for this form'); ?></th>
    <th width="135"><?php echo  opt_table_sort_link('File Name', 'file_url', 'The file name for this form (parent forms only)'); ?></th>
    <th width="60"><?php echo  opt_table_sort_link('Optins', 'optins', 'Total optins on this form'); ?></th>
    <th width="60"><?php echo  opt_table_sort_link('Views', 'views', 'Total times this form was viewed'); ?></th>
    <th width="85"><?php echo  opt_table_sort_link('Optin Rate', 'optin_rate', 'Ratio of optins to form views'); ?></th>
    
    <?php if($opt_mode==1) { ?>
    <th width="60"><?php echo  opt_table_sort_link('Closes', 'closes', 'Total times this form has been closed'); ?></th>
    <th width="80"><?php echo  opt_table_sort_link('Close Rate', 'close_rate', 'Ratio of form closes to form views'); ?></th>
    <?php } ?>
    
    <th width="60"><?php echo  opt_table_sort_link('Date', 'time_created', 'The date this form was created'); ?></th>    
    <th width="145"> Actions </th>
  </tr>
  
  <?php echo  '</' . $th . '>' ?>
  
  <?php } ?>
  
  <tbody>
    <?php if ($contents == '') { ?>
    <tr>
      <td colspan="20" bgcolor="#FFFFCC"><h3>No optin forms found! <a href="javascript:void(0);" onclick="jQuery('#optin_form_form').slideToggle();" >Click here to create an optin form</a></h3></td>
    </tr>
    <?php
	
		} else {
			$row_int = 0;
			$sub_row_total = 0;
			
			
			 //Graphing Variables
			 $graph_ticks = '';
			 $graph_optins = '';
			 $graph_views = '';
			 $graph_closes = '';
			 
			 //List all split tests		
             foreach ( $contents['data'] as $key => $content) 	{		
			 
			 
			 if($row_int<=9 && empty($_GET['form']) && empty($_GET['show_all']) && $contents['totals']['total_items']!=1) {
				 
				 //Graphing stuff goes here
				 $graph_ticks .= '['.$row_int.',\''.substr($content['name'],0,40).'\'],';
				 $graph_optins .= '['.$row_int.',\''.$content['optins'].'\'],';
				 $graph_views .= '['.$row_int.',\''.$content['views'].'\'],';
				 
				 //sec advanced
				 if($opt_mode==1) {
				 $graph_closes .= '['.$row_int.',\''.$content['closes'].'\'],';
				 }
				 //esec advanced
				 
				 $graph_items = $row_int;
			 
			 
			 } 		 
			 
        	$row_int++;			
	?>
    <?php if ($row_int % 2 == 0 || isset($_GET['show_all'])) { ?>
    <tr class="opt_table_row_alt">
      <?php } else { ?>
    <tr class="opt_table_row">
      <?php } ?>
    	
	<?php $url = ''; ?>
    
      <?php if($opt_mode==1) { ?><td><?php echo  $content['id']; ?></td><?php } ?>
      <td align="right"><?php echo  number_format($content['forms']); ?></td>    
      <td><a href="<?php echo  opt_url('form=' . $content['id']); ?>" style="font-weight:bold; display:block;"><?php echo  $content['name']; ?></a></td>    
      <td><?php echo  $content['file_url']; ?></td>    
      <td align="right"><?php echo  number_format($content['optins']); ?></td>    
      <td align="right"><?php echo  number_format($content['views']); ?></td>    
      <td align="right"><?php echo  number_format($content['optin_rate'],2); ?>%</td> 
      
      <?php if($opt_mode==1) { ?>
      <td align="right"><?php echo  number_format($sub_content['closes']); ?></td>    
      <td align="right"><?php echo  number_format($sub_content['close_rate'],2); ?>%</td> 
      <?php } ?>
      
      <td align="right"><?php echo  date('m/d/y',strtotime($content['time_created'])); ?></td>
      <td align="right"><a href="<?php echo  opt_url('form_step_1=1&edit_form=&opt_parent_form=' . $content['id']); ?>">Create Custom Form</a></td>
    </tr>
    <?php
	
//SUB CONTENT HERE	
if((isset($_GET['form']) && $_GET['form'] == $content['id']) || $contents['totals']['total_items']==1 || (isset($_GET['show_all']) && $_GET['show_all'] == 1)) {
		
    $sub_contents = opt_sub_table_array($content['id']);
	
	if($sub_contents!='') { ?>
    
    <tr>
    	<td colspan="20" class="opt_subcontent_border" style="padding:0;"></td>
    </tr>
    
    <?php
	
	$sub_row_int = 0;
	foreach ($sub_contents['data'] as $key => $sub_content) {
	$sub_row_int++;	
	
			if($sub_row_total<=9 && (isset($_GET['form']) || isset($_GET['show_all']) || $contents['totals']['total_items']==1)) {
					 
					 //Graphing stuff goes here
					 $graph_ticks .= '['.$sub_row_total.',\''.substr($sub_content['name'],0,40).'\'],';
					 $graph_optins .= '['.$sub_row_total.',\''.$sub_content['optins'].'\'],';
					 $graph_views .= '['.$sub_row_total.',\''.$sub_content['views'].'\'],';
					 
					 //sec advanced
					 if($opt_mode==1) {
					 $graph_closes .= '['.$sub_row_total.',\''.$sub_content['closes'].'\'],';
					 }
					 //esec advanced
					 
					 $graph_items = $sub_row_total;
					 
					 
			}
			
	$sub_row_total++;
						 
			 
					
	?>
    <?php if ($sub_row_int % 2 == 0) { ?>
    <tr class="opt_sub_table_row_alt">
      <?php } else { ?>
    <tr class="opt_sub_table_row">
      <?php } ?>
      
      <?php if($opt_mode==1) { ?><td><?php echo  $sub_content['id']; ?></td><?php } ?>
      <td align="right"></td>    
      <td style="padding-left:20px;"><?php echo  $sub_content['name']; ?></td>    
      <td></td>    
      <td align="right"><?php echo  number_format($sub_content['optins']); ?></td>    
      <td align="right"><?php echo  number_format($sub_content['views']); ?></td>    
      <td align="right"><?php echo  number_format($sub_content['optin_rate'],2); ?>%</td> 
      
      <?php if($opt_mode==1) { ?>
      <td align="right"><?php echo  number_format($sub_content['closes']); ?></td>    
      <td align="right"><?php echo  number_format($sub_content['close_rate'],2); ?>%</td> 
      <?php } ?>
      
      <td align="right"><?php echo  date('m/d/y',strtotime($sub_content['time_created'])); ?></td>
      <td align="right"><a href="<?php echo  opt_url('form_step_1=1&opt_parent_form='.$sub_content['parent_id'].'&edit_form=' . $sub_content['id']); ?>">Edit Form</a>
      					 <a href="<?php echo  opt_url('delete_form=' . $sub_content['id']); ?>" class="opt_trash" >Trash</a></td>
    </tr> 
    <?php } }  ?>
    
    <tr>
    	<td colspan="20" class="opt_subcontent_border" style="padding:0;"></td>
    </tr>
    
    <?php } ?>
    	
	
<?php	
	
    }
?>
    <tr class="opt_total_row">
      <?php if($opt_mode==1) { ?><td></td><?php } ?>
      <td align="right"></td>
      <td><?php echo  $row_int; ?> Forms</td>
      <td align="right"></td>    
      <td align="right"><?php echo  number_format($contents['totals']['optins']); ?></td>    
      <td align="right"><?php echo  number_format($contents['totals']['views']); ?></td> 
      <td align="right"><?php echo  number_format($contents['totals']['optin_rate'],2); ?>%</td> 
      
      <?php if($opt_mode==1) { ?>
      <td align="right"><?php echo  number_format($contents['totals']['closes']); ?></td>    
      <td align="right"><?php echo  number_format($contents['totals']['close_rate'],2); ?>%</td> 
      <?php } ?>
       
      <td></td>   
      <td></td>
    </tr>
    <?php 
}
?>
</table>

<div style="text-align:right; width:100%; margin-top:6px;" align="right">
  <?php echo  opt_pagination($contents['totals']['total_items'], 'forms_page_count'); ?>
</div>

<?php 

//EXECUTE GRAPHING JS
if($contents!='' && $contents['has_stats']==1) { opt_bar_graph_js('form_graph',$graph_items,$graph_ticks,$graph_optins,$graph_clicks,$graph_views,$graph_closes,$graph_impressions,$graph_income,$graph_expense); } 

//GET PLUGIN ADMIN FOOTER
include_once dirname(__FILE__) . '/layout/opt_footer.php'; 

?>