/**
  * Generates custom content for preview tab.
  */
 protected function generate_preview()
 {
     wp_enqueue_style('cf_css_base');
     wp_enqueue_script('jquery-ui-resizable');
     echo '<h3>' . __('Before submit preview:', 'contestfriend') . '</h3>';
     echo '<div id="preview_before" class="cf_widget_preview"><p>' . __('Resize this block to preview various widget sizes.', 'contestfriend') . '</p>';
     $url = add_query_arg('contestfriend_preview', $this->contest->ID, get_site_url());
     echo cf_Widget::html(array('contest' => $this->contest->ID, 'preview' => 'before_submit'));
     echo '</div>';
     $widget = cf_Widget::current_widget();
     $widget_id_before = $widget->widget_id;
     echo '<h3>' . __('After submit preview:', 'contestfriend') . '</h3>';
     echo '<div id="preview_after" class="cf_widget_preview"><p>' . __('Resize this block to preview various widget sizes.', 'contestfriend') . '</p>';
     $url = add_query_arg('contestfriend_preview', $this->contest->ID, get_site_url());
     echo cf_Widget::html(array('contest' => $this->contest->ID, 'preview' => 'after_submit'));
     echo '</div>';
     $widget = cf_Widget::current_widget();
     $widget_id_after = $widget->widget_id;
     if ($this->contest->cf_double_optin == '1') {
         echo '<div id="preview_doubleoptin" class="cf_widget_preview"><p>' . __('Resize this block to preview various widget sizes.', 'contestfriend') . '</p>';
         $url = add_query_arg('contestfriend_preview', $this->contest->ID, get_site_url());
         echo cf_Widget::html(array('contest' => $this->contest->ID, 'preview' => 'doubleoptin'));
         echo '</div>';
         $widget = cf_Widget::current_widget();
         $widget_id_doubleoptin = $widget->widget_id;
     }
     echo '<script type="text/javascript">jQuery(document).ready(function() { 
     jQuery(\'#preview_before\').resizable({ resize: function(event, ui) { ui.size.height = jQuery(\'#' . $widget_id_before . '\').height()+50; } }); 
     jQuery(\'#preview_after\').resizable({ resize: function(event, ui) { ui.size.height = jQuery(\'#' . $widget_id_after . '\').height()+50; } });';
     if ($this->contest->cf_double_optin == '1') {
         echo 'jQuery(\'#preview_doubleoptin\').resizable({ resize: function(event, ui) { ui.size.height = jQuery(\'#' . $widget_id_doubleoptin . '\').height()+50; } });';
     }
     echo '});</script>';
 }
 /**
  * Widget presentation method. Calls the main <i>cf_Widget::html()</i> presentation class.
  * @param mixed $args
  * @param mixed $instance
  */
 public function widget($args, $instance)
 {
     echo $args['before_widget'];
     echo cf_Widget::html(array('contest' => $instance['contest_id']));
     echo $args['after_widget'];
 }