		<div class="popup_domination_check_updates_link">
				<a href="#check_updates">Check for Updates</a>
		</div>
		</div>
	    <form action="<?php echo $this->opts_url?>" method="post" id="popup_domination_form">
		    <div style="display:none" id="popup_domination_hdn_div"><?php echo $fields?></div>
		    <?php
			$text = '<img src="'.$this->plugin_url.'/images/off.png" alt="off" width="6" height="6" />'; $class = 'inactive'; $text2 = '<img src="'.$this->plugin_url.'/images/on.png" alt="on" width="6" height="6" />'; $class2 = 'turn-on';$text3 = 'Inactive';$text4 = 'Active';$text5 = 'TURN ON';$text6 = 'TURN OFF';
			if($this->is_enabled()){
				$text = '<img src="'.$this->plugin_url.'/images/on.png" alt="on" width="6" height="6" />';
				$text2 = '<img src="'.$this->plugin_url.'/images/off.png" alt="off" width="6" height="6" />';
				$text3 = 'Active';
				$text4 = 'Inactive';
				$text5 = 'TURN OFF';
				$text6 = 'TURN ON';
				$class = 'active';
				$class2 = 'turn-off';
			}
			?>
			<div id="popup_domination_active"><span class="wording"><span class="<?php echo $class ?>"><?php echo $text ?>PopUp Domination is</span>  <?php echo $text3 ?></span><div class="popup_domination_activate_button"><div class="border"><?php echo $text2 ?><a href="#activation" class="<?php echo $class2 ?>"><? echo $text5; ?></a></div> <img class="waiting" style="display:none;" src="images/wpspin_light.gif" alt="" /></div></div>
			<div class="clear"></div>
        <div id="popup_domination_container" class="has-left-sidebar">
            <div style="display:none" id="popup_domination_hdn_div2"></div>

                
            	<p id="popup_domination_tabs">
                	<a class="icon feel" href="#look_and_feel">Look and feel</a>
                    <a class="icon html" href="#newsletter_form">Mailing List HTML</a>
                    <a class="icon fields" href="#template_fields">Template Fields</a>
                    <a class="icon list" href="#list_items">List Points</a>
                    <a class="icon schedule" href="#schedule">Schedule</a>
                    <a class="icon prev" href="#preview">Preview</a>
                    <a class="icon promote" href="#promote">Promote PopUp Domination</a>
                    <a class="icon advanced" href="#advanced_view">Advanced</a>
                </p>
                
                <div class="notices" style="display:none;">
                	<p class="message"><? if(!isset($update_msg)){$update_msg = ' ';}else{ echo $update_msg;} ?></p>
                </div>
                
            	<div class="mainbox" id="popup_domination_tab_look_and_feel">
                    <h3 class="title topbar icon feel"><span>Look and feel</span></h3>
                    <div class="inside twodivs">
                    	<div class="popdom-inner-sidebar">
                        	<div class="postbox">
                            	<h3 class="hndle"><span>Choose a template</span></h3>
                                <div class="sidebar-inside">
                                    <p>
                                        <label for="popup_domination_template"><strong>Template:</strong></label>
                                        <select id="popup_domination_template" name="popup_domination[template]"><?php echo $opts?></select>
                                    </p>
                                </div>
                            </div>
                        	<div class="postbox"<?php echo ((!isset($cur_theme['button_colors']))?'':' style="display:none"') ?> id="popup_domination_btns_container">
                            	<h3 class="hndle"><span>Choose a button color</span></h3>
                                <div class="sidebar-inside">
									<?php
                                        $btns = '';
                                        $button_color = $this->option('button_color');
                                        if(isset($cur_theme['button_colors'])){
                                            foreach($cur_theme['button_colors'] as $c){
                                                $btns .= '<option value="'.$c['color_id'].'"'.(($c['color_id']==$button_color)?' selected="selected"':'').'>'.$c['name'].'</option>';
                                            }
                                        }
                                    ?>
									<p>
                                    	<label for="popup_domination_btn_color"><strong>Button Color:</strong></label>
                                        <select id="popup_domination_btn_color" name="popup_domination[button_color]"><?php echo $btns ?></select>
                                        <input type="hidden" id="popup_domination_btn_color_selected" value="<?php echo $button_color ?>" />
                                    </p>
                                </div>
                            </div>
                        	<div class="postbox"<?php echo ((!empty($opts2))?'':' style="display:none"') ?> id="popup_domination_colors_container">
                            	<h3 class="hndle"><span>Color Options</span></h3>
                                <div class="sidebar-inside">
                                	<ul><?php print_r($opts2) ?></ul>
                                    <input type="hidden" id="popup_domination_color_selected" name="popup_domination[color]" value="<?php echo $this->option('color')?>" />
                                    <div class="clear"></div>
                                </div>
                            </div>
                        </div>
                        <div id="normal-sortables">
                        	<div id="popup_domination_preview">
                            	<p class="msg">Theme &amp; Color Preview</p>
                                <?php 
									$style = '';
									if($cur_preview!=''){
										$style .= 'background-image:url(\''.$this->theme_url.$cur_preview.'\')';
										if(count($cur_size) == 2)
											$style .= ';width:'.$cur_size[0].'px;height:'.$cur_size[1].'px';
										$style = ' style="'.$style.'"';
									}
								?>
                                <div class="preview"<?php echo $style ?>></div>
                            </div>
                        </div>
                        <div class="clear"></div>
                    </div>
                    <div class="clear"></div>
                </div>
            	<div class="mainbox" id="popup_domination_tab_newsletter_form">
                    <h3 class="title topbar icon html"><span>Mailing list html</span></h3>
                    <div class="inside twomaindivs">
                    	<div class="popdom_contentbox the_content_box">
                    		<h3>Form Configuration</h3>
                    		<div class="popdom_contentbox_inside">
		                        <div class="col">
		                            <p class="msg">Enter your html opt-in code below and we'll hook up your form to the template:</p>
		                            <p><textarea cols="60" rows="10" id="popup_domination_formhtml" name="popup_domination[formhtml]"><?php echo $formhtml?></textarea></p>
		                    	<p><input type="checkbox" name="popup_domination[new_window]" id="popup_domination_new_window" value="Y"<?php 
									$new_window = $this->option('new_window'); 
									echo ($new_window && $new_window=='Y')?' checked="checked"':''; ?> /> <label for="popup_domination_new_window">Submit the form to a new window</label></p>
		                            <p><input type="checkbox" name="popup_domination[disable_name]" id="popup_domination_disable_name" value="Y"<?php 
									$disable_name = $this->option('disable_name'); 
									echo ($disable_name && $disable_name=='Y')?' checked="checked"':''; ?> /> <label for="popup_domination_disable_name">Disable name box?</label></p>
		                            <p>
		                                <label for="popup_domination_name_box"><strong>Name:</strong></label>
		                                <select id="popup_domination_name_box" name="popup_domination[name_box]"<?php echo ($disable_name && $disable_name=='Y')?' disabled="disabled"':''; ?>></select>
		                                <input type="hidden" id="popup_domination_name_box_selected" value="<?php echo $name_box?>"<?php echo ($disable_name && $disable_name=='Y')?' disabled="disabled"':''; ?> />
		                            </p>
		                            <p>
		                                <label for="popup_domination_email_box"><strong>Email:</strong></label>
		                                <select id="popup_domination_email_box" name="popup_domination[email_box]"></select>
		                                <input type="hidden" id="popup_domination_email_box_selected" value="<?php echo $email_box?>" />
		                            </p>
		                            <div class="popup_domination_custom_inputs">
		                            <? $number = $this->option('custom_fields'); ?>
		                            <? if(isset($number) && $number != 0): ?>
		                            <input type="hidden" id="popup_domination_inputs_num" name="popup_domination[custom_fields]" value="<? echo $number; ?>" />
		                            
		                            	<? for($i=1;$i<=$number;$i++): ?>
		                      
		                            	<?php $str = 'custom'.$i.'_box'; ?>
				                            <p>
				                                <label for="popup_domination_custom<? echo $i; ?>_box"><strong>Custom Field <? echo $i; ?>:</strong></label>
				                                <select id="popup_domination_custom<? echo $i; ?>_box" name="popup_domination[custom<? echo $i; ?>_box]"></select>
				                                <input type="hidden" id="popup_domination_custom<? echo $i; ?>_box_selected" value="<?php echo $$str; ?>"/>
				                            </p>
			                            <? endfor; ?>
		                            <? endif; ?>
		                            </div>
		                            <p>
		                                <label for="popup_domination_action"><strong>Form URL:</strong></label>
		                                <input size="60" type="text" id="popup_domination_action" name="popup_domination[action]" value="<?php echo $this->input_val($this->option('action'))?>" />
		                            </p>
		                        </div>
		                        <div class="clear"></div>
	                        </div>
	                        <div class="clear"></div>
                        </div>
                        <div class="popdom_contentbox the_help_box">
                        	<h3>Help</h3>
                        	<div class="popdom_contentbox_inside">
	                        	<h2 style="color:#bd0a0a;">Read this before inputting your HTML</h2>
			                            <p>You need to make sure the opt-in code that you have been provided contains the HTML &lt;form&gt; tag. Also make sure that it has both Name and Email address fields.</p>
			                            <p>Example:</p>
			                            <blockquote>&#60;form action="http://somewebsite.com/mail.php"&#62;<br/>
			                            	&#60;label for="name"&#62;Your Name&#60;/label&#62;<br/>
			                            	&#60;input type="text" id="name" name="name" /&#62;<br/>
			                            	&#60;label for="email"&#62;Your Email&#60;/label&#62;<br/>
			                            	&#60;input type="text" id="email" name="email" /&#62;<br/>
			                            	&#60;input type="submit" name="Submit" value="submit" /&#62;<br/>
			                            &#60;/form&#62;<br/></blockquote>
			                            <p>The boxes below the HTML input box should automagically detect the Name and Email address field. If they don't select the correct fields, simply choose the correct name and email address fields from the dropdown. <strong>If these are left blank, PopUp Domination's optin process will not work.</strong></p>
			                            <p>Example:</p>
			                            <p>(Using the code from the above example) </p><br/>
			                            <img src="<? echo $this->plugin_url;?>images/dropdowns.png" height="125" width="287" alt="" /><br/><br/>
			                            <p><em>"Submit the form to a new window"</em> Will result in a new window being open when the user hits submit on the form.</p>
			                            <p><em>"Disable name box?"</em> This will hide the name input box so visitors won't have to enter their name to opt in.</p>
			                            <br/>
			                            <p>Make sure to head over to you support area if you have any problems</p>
                   						<p><a href="https://popdom.assistly.com/">Click Here to get there</a></p>
                   						<p>You can also contact us directly there too.</p>
                        	</div>
                        </div>
                        <div class="clear"></div>
                    </div>
                </div>
                <div class="mainbox" id="popup_domination_tab_template_fields">
                    <h3 class="title topbar icon fields"><span>Template Text</span></h3>
                    <div class="inside twomaindivs">
                    	<div class="popdom_contentbox the_content_box">
                    		<h3>Template Options</h3>
                    		<div class="popdom_contentbox_inside">
		                    	<p class="msg"><strong>You're using template: <span class="tpl_name"><?php echo $cur_theme['name'] ?></span></strong></p>
		                    	<div class="elements">
								<?php echo $field_str ?>
		                        </div>
		                    </div>
		                    <div class="clear"></div>
		                </div>
		                <div class="popdom_contentbox the_help_box">
                        	<h3>Help</h3>
                        	<div class="popdom_contentbox_inside">
                        		<p><strong>IMPORTANT:</strong> We've outlined some guideline character lengths below which will help you get the best conversion rates and more importantly, help it to look great.</p><br/>
                        		<p><strong>Uploading Images:</strong> When uploading images, please make sure their extensions are in lower case. E.g: <em><strong>.jpg</strong></em> rather than <em><strong>.JPG</strong>.</em></p><br/>
                        		<p><strong>Video Template:</strong></p>
                        		<p><em>"Video Url" - </em> You need to enter a complete url to a <strong>.flv</strong> file. This file will be streamed and played through the internal player.</p>
                        		<p><em>"Video Embed Code" - </em> Here you can paste in any embed code from any online video streamer/player.</p>
                        		<br/>
                        		<p>Make sure to head over to you support area if you have any problems</p>
                   				<p><a href="https://popdom.assistly.com/">Click Here to get there</a></p>
                   				<p>You can also contact us directly there too.</p>
                        		
                        	</div>
                        </div>
                        <div class="clear"></div>
                    </div>
                </div>
                <div class="mainbox" id="popup_domination_tab_list_items">
                    <h3 class="title topbar icon list"><span>List points</span></h3>
                    <div class="inside twomaindivs" id="popup_domination_listitems">
                    	<div class="popdom_contentbox the_content_box">
                    		<h3>Tick List</h3>
                    		<div class="popdom_contentbox_inside">
		                    	<p id="list_allowed_size" class="msg"><strong>This theme has a limit of <span><?php echo $cur_theme['list_count'] ?></span> check boxes.</strong><br />Why is there a limit? We want to help you get the best out of your lightbox. Imposing a limit means that the design will remain beautiful and result in high conversions.</p>
		                    	<ul><?php echo $listitems?></ul>
		   	                    <a href="#addnew" class="button addnew">Add Another</a>
	   	                   	</div>
	   	                   	<div class="clear"></div>
	   	                </div>
	   	                <div class="popdom_contentbox the_help_box">
                        	<h3>Help</h3>
                        	<div class="popdom_contentbox_inside">
                        		<p>Use the bullets to the left to create a list of points which make your point, argument or product more convincing.</p>
                        		<p>We have outlined the recommended amount of bullet points per template. Any bullets over this amount, will not be shown on the template.</p>
                        		<br/>
                        		<p>Example:</p>
                        		<br/>
                        		<img src="<? echo $this->plugin_url;?>images/bullets.png" height="193" width="383" alt="" /><br/>
                        		<br/>
                        		<p>Make sure to head over to you support area if you have any problems</p>
                   				<p><a href="https://popdom.assistly.com/">Click Here to get there</a></p>
                   				<p>You can also contact us directly there too.</p>
                        	</div>
                        </div>
                        <div class="clear"></div>
                    </div>
                </div>
                <div class="mainbox" id="popup_domination_tab_schedule">
                	<h3 class="title topbar icon schedule"><span>Schedule</span></h3>
                    <div class="inside twomaindivs">
	                    <div class="the_content_box">
	                    	<div class="popdom_contentbox" style="margin-left:0px;">
	                    		<h3>When is PopUp Domination Displayed?</h3>
	                    		<div class="popdom_contentbox_inside">
			                    	<p><strong>When the close button is clicked, how long should it be before the lightbox is shown again? </strong><input type="text" name="popup_domination[cookie_time]" value="<?php echo intval($this->option('cookie_time')) ?>" /> (recommended 7 days)</p>
			                        <p><strong>How often should PopUp Domination appear?</strong></p>
			                        <p>How many times must the page(s) be visited before the popup appears? <input type="text" name="popup_domination[impression_count]" value="<?php echo $this->input_val($this->option('impression_count'))?>" /></p>
			                        <ul style="margin-left:30px">
			                        	<li class="show_opts opt_open">
			                            	<p><input type="radio" name="popup_domination[show_opt]" value="open" id="show_opt_open"<?php echo $show_opt == 'open' ? ' checked="checked"':'';?> /> <label for="show_opt_open">On Website page load</label></p>
			                                <p style="margin-left:25px; <?php echo $show_opt == 'open' ? '':'display:none';?>" class="show_opt_open toggle"  >How Long should the delay be before the popup appears?<input type="text" name="popup_domination[delay]" value="<?php echo floatval($this->option('delay')) ?>"<?php echo $show_opt == 'open' ? '':' disabled="disabled"';?> /></p>
			                            </li>
			                            <li class="show_opts opt_mouselave">
			                            	<p><input type="radio" name="popup_domination[show_opt]" value="mouseleave" id="show_opt_mouseleave"<?php echo $show_opt == 'mouseleave' ? ' checked="checked"':'';?> /> <label for="show_opt_mouseleave">When mouse leaves the browser viewport. (up towards the address bar)</label></p>
			                            </li>
			                            <li class="show_opts opt_unload">
			                            	<p><input type="radio" name="popup_domination[show_opt]" value="unload" id="show_opt_unload"<?php echo $show_opt == 'unload' ? ' checked="checked"':'';?> /> <label for="show_opt_unload">When the user tries to leave the page (This option requires a javascript alert box).</label></p>
			                                <p style="margin-left:25px; <?php echo $show_opt == 'unload' ? '':'display:none';?>" class="show_opt_unload toggle">Javascript alert box text <input type="text" name="popup_domination[unload_msg]" id="popup_domination_unload_msg" value="<?php echo $this->input_val($this->option('unload_msg')) ?>"<?php echo $show_opt == 'unload' ? '' : ' disabled="disabled"';?> /></p>
			                            </li>
			                        </ul>
			                     </div>
			                 </div>
			                 <div class="popdom_contentbox" style="margin-top:20px; margin-left:0px;">
			                 	<h3>What pages do you wish to display PopUp Domination?</h3>
			                      <div class="popdom_contentbox_inside">
			                        <p><strong>Please choose where you want the lightbox to display</strong></p>
			                        <?php echo $this->page_list() ?>
			                      </div>
			                 </div>
			                 <div class="clear"></div>
		                </div>
		                <div class="popdom_contentbox the_help_box">
                        	<h3>Help</h3>
                        	<div class="popdom_contentbox_inside">
                        		<p><strong>Reset Your Cookies to test the popup on your live website again.</strong></p>
                        		<p><br /><a href="#clear" class="button">Clear my cookie</a> <img class="waiting" style="display:none;" src="images/wpspin_light.gif" alt="" /></p><br/>
                        		<p><strong>On Website Load:</strong> The popup will appear as soon as the webpage has been fully loaded by the user's browser.</p>
                        		<p><strong>When mouse leaves the browser viewport:</strong> The popup will appear when the user's mouse enters the address back area. This option in great for when you want the popup to appear when the user tried to leave your website, but won't appear when they click on links on your website.</p>
                        		<p style="margin-right:15px;"><strong>When the user tries to leave the page:</strong> The popup will appear when ever the user clicks on a link or attempts to leave the page. If you have many links to different parts of your site, we don't recommend this setting.<br/>
                        		This setting also makes an alert box appear before the popup appears. The user will have to click the "Stay On Page" option in the alert box <strong>before</strong> the popup will appear.
                        		</p>
                        		<br/><p><strong>Example:</strong></p>
                        		<img src="<? echo $this->plugin_url;?>images/alert.png" height="178" width="582" alt="" />
                        		<br/><br/>
                        		<p>If you are experiencing problems with your popup, please have a look at our help articles at:</p>
                        		<p><a href="https://popdom.assistly.com/">our Assistly Help Area.</a></p>
                        	</div>
                        </div>
                        <div class="clear"></div>
                    </div>
                </div>
	            <div class="mainbox" id="popup_domination_tab_check_updates">
	                <h3 class="title topbar"><span>Check for Updates</span></h3>
	                <div class="inside">
	                	<div class="popdom_contentbox the_content_box">
	                		<h3>Get the Latest Version</h3>
                    		<div class="popdom_contentbox_inside">
	                			<?php echo $this->check_updates() ?>
	                		</div>
	                	</div>
	                	<div class="clear"></div>
	                </div>
            	</div>
                <div class="mainbox" id="popup_domination_tab_promote">
                	<h3 class="title topbar icon promote"><span>Promote PopUp Domination</span></h3>
                    <div class="inside twomaindivs">
                    	<div class="popdom_contentbox the_content_box">
                    		<h3>Earn Money for PopUp Domination</h3>
                    		<div class="popdom_contentbox_inside">
		                    	<p><input type="checkbox" name="popup_domination[promote]" id="popup_domination_promote" value="Y"<?php 
									$promote = $this->option('promote'); 
									echo ($promote && $promote=='Y')?' checked="checked"':''; ?> /> <label for="popup_domination_promote">Promote PopUp Domination</label></p>
		                    	<p><label for="popup_domination_clickbank">Clickbank nick name:</label>
		                           <input type="text" name="popup_domination[clickbank]" id="popup_domination_clickbank" value="<?php echo $this->input_val($this->option('clickbank')) ?>"<?php echo ($promote && $promote=='Y')?'':' disabled="disabled"'; ?> />
		                        </p>
		                    </div>
		                    <div class="clear"></div>
		                </div>
		                
		                <div class="popdom_contentbox the_help_box">
                        	<h3>Help</h3>
                        	<div class="popdom_contentbox_inside">
                        		<p>The tick-box option will turn off the "Powered by PopUp Domination" as seen below:</p><br/>
                        		<img src="<? echo $this->plugin_url;?>images/powered.png" height="37" width="231" alt="" />
                        		<br/><br/>
                        		<p>If you would to earn money promoting PopUp Domination through your clickbank account, just simply enter your clickbank user name in the box on the left and we will connected your account to the "Powered By PopUp Domination" link to earn you money straight away.</p><br/>
                        		<p>Make sure to head over to you support area if you have any problems</p>
                   				<p><a href="https://popdom.assistly.com/">Click Here to get there</a></p>
                   				<p>You can also contact us directly there too.</p>
                        	</div>
                        </div>
                    <div class="clear"></div>
                    </div>
                </div>
                <div class="mainbox" id="popup_domination_tab_advanced_view" style="display:none;">
                	<h3 class="title topbar icon advanced"><span>Advanced Editor</span></h3>
                	<div class="inside">
          
                				<?php echo $this->get_theme_editor() ?>
       
                	</div>
            	</div>
            	</div>
				<div id="popup_domination_form_submit">
					<p class="submit">
						<?php wp_nonce_field('update-options'); ?>
						<input type="submit" name="update" value="<?php _e('Update options', 'popup_domination'); ?>" />
                        <span><strong>Remember:</strong> When you update, you're changes go live right away if your lightbox is Active</span>
					</p>
									<div id="popup_domination_current_version">
					<p>You are currently running <strong>version <? echo $this->version; ?></strong></p>
				</div>
				</div>
				

				<div class="clearfix"></div>
            </form>
        </div>
        
        <script type="text/javascript">
		var popup_domination_tpl_info = <?php echo $js?>, popup_domination_admin_ajax = '<?php echo admin_url('admin-ajax.php') ?>', popup_domination_theme_url = '<?php echo $this->theme_url ?>', popup_domination_form_url = '<?php echo $this->opts_url ?>', popup_domination_url = '<?php echo $this->plugin_url ?>';
		</script>