<div class="wrap" style="width: 600px;">
  <h2>Your HTML Code</h2>
  <?php
    $gallery = trim($_POST['gallery']);
	$dropdown = $_POST['dropdown'] == null ? 0 : $_POST['dropdown'];
	$divider = $_POST['divider'] == null ? 0 : $_POST['divider'];
	$showTitle = $options['show_title'] == null ? 0 : $options['show_title'];
	$slideTitle = $_POST['slide_title'] == null ? 0 : $_POST['slide_title'];
	$prettyphoto_image_resize = $_POST['prettyphoto_image_resize'] == null ? 0 : $_POST['prettyphoto_image_resize'];
	$prettyphoto_overlay_gallery = $_POST['prettyphoto_overlay'] == null ? 0 : $_POST['prettyphoto_overlay'];
	$prettyphoto_autoplay_slideshow = $_POST['prettyphoto_slideshow'] == null ? 0 : $_POST['prettyphoto_slideshow'];
	$prettyphoto_deeplinking = $_POST['prettyphoto_deeplinking'] == null ? 0 : $_POST['prettyphoto_deeplinking'];
		
    //get albums of the gallery corresponding to the ID
	$albums = $this->wpdb->get_results("SELECT * FROM " . $this->album_table_name . " WHERE gallery='" . $gallery . "' ORDER BY sort ASC");
	
  ?>
  <h3 style="margin-bottom: 0px;">Copy this code and paste in your head tag:</h3>
  <textarea cols="120" rows="14" style="font-size:11px;"><?php
    echo "<link rel='stylesheet' href='" . plugins_url('/radykal-fancy-gallery/css/prettyPhoto.css') . "' />\n";
	echo "<link rel='stylesheet' href='" . plugins_url('/radykal-fancy-gallery/css/jquery.fancygallery.css') . "' />\n";
	echo "<link rel='stylesheet' href='" . plugins_url('/radykal-fancy-gallery/css/uniform.'. $_POST['dropdown_theme'] . '.css') . "' />\n";
	echo "\n";
    echo "<script src='http://code.jquery.com/jquery-latest.min.js' type='text/javascript'></script>\n";
    echo "<script src='". plugins_url('/radykal-fancy-gallery/js/jquery.fancygallery.js') ."' type='text/javascript'></script>\n";
	echo "<script src='". plugins_url('/radykal-fancy-gallery/js/jquery.prettyPhoto.js') ."' type='text/javascript'></script>\n";
	echo "<script src='". plugins_url('/radykal-fancy-gallery/js/jquery.uniform.min.js') ."' type='text/javascript'></script>\n";
	echo "\n";
	echo "<script type='text/javascript'>
  jQuery(document).ready(function(){
    jQuery('#fancygallery-" . preg_replace("/[^a-zA-Z0-9s]/", "", $gallery) ."').fancygallery({ backgroundColor: '" . $_POST['background_color'] . "', titleColor: '" . $_POST['title_color'] . "', thumbWidth: " . $_POST['thumbnail_width'] . ", thumbHeight: " . $_POST['thumbnail_height'] . ",
		    thumbOpacity: " . $_POST['thumbnail_opacity'] . ", imagesPerPage: " . $_POST['thumbnails_per_page'] . ", titleHeight: " . $_POST['title_height'] . ", borderThickness: " . $_POST['border_thickness'] . ",
			rowOffset: " . $_POST['row_offset'] . ", columnOffset: " . $_POST['column_offset'] . ", shadowOffset: " . $_POST['shadow_offset'] . ", textFadeDirection: '" . $_POST['text_fade_direction'] . "', 
		    scaleMode: '" . $_POST['thumbnail_scalemode'] . "', shadowImage: '" . $_POST['shadow_image'] . "', dropdown: " . $dropdown . ", divider: " . $divider . ", showTitle: " . $showTitle . ", slideTitle: " . $slideTitle . ",
			boxOptions: {theme: '" . $_POST['prettyphoto_theme'] . "', allow_resize: " . $prettyphoto_image_resize . " , overlay_gallery: " . $prettyphoto_overlay_gallery . ", 
				         autoplay_slideshow: " . $prettyphoto_autoplay_slideshow . ", deeplinking: " . $prettyphoto_deeplinking . " }});
  });
 </script>";
  ?>
  </textarea>
  <h3 style="margin-bottom: 0px;">Copy this code and paste it in your body tag:</h3>
  <textarea cols="120" rows="25" style="font-size:11px;"><?php
    echo "<div id='fancygallery-" . str_replace(' ', '', $gallery) ."'>\n";
			
	foreach($albums as $album) {
		echo "  <div id='" . preg_replace("/[^a-zA-Z0-9s]/", "", $album->title) . "' title='" . $album->title . "'>\n";
		
		$album_files = $this->wpdb->get_results("SELECT * FROM " . $this->images_table_name . " WHERE album='" . trim($album->title) . "' ORDER BY sort ASC");
		foreach($album_files as $album_file) {
			echo '    <a href="' . $album_file->file . '" ><img src="' . $album_file->thumbnail . '" title="' . $album_file->title . '" /><span>' . $album_file->description . '</span></a>';
			echo "\n";
		}
			
		echo "  </div>\n";
	}
	echo "</div>";
  ?>
  </textarea>
</div>