<?php

//*************************** Images ***************************//

function ghostpool_image($atts, $content = null) {
	extract(shortcode_atts(array(
		'url' => '#',
		'width' => '',
		'height' => '',
		'link' => '',
		'align' => 'none',
		'top' => '0',
		'left' => '0',
		'bottom' => '0',
		'right' => '0',
		'alt' => '',
		'title' => '',
		'lightbox' => 'none',
		'zoom' => '1'
	),$atts));

	require(ghostpool_inc . 'options.php');

	ob_start(); ?>

	<div class="sc-image <?php echo $align; ?>" style="<?php if($top) { ?>margin-top: <?php echo $top; ?>px;<?php } ?> <?php if($right) { ?>margin-right: <?php echo $right; ?>px;<?php } ?> <?php if($bottom) { ?>margin-bottom: <?php echo $bottom; ?>px;<?php } ?> <?php if($left) { ?>margin-left: <?php echo $left; ?>px;<?php } ?> <?php if($width != "") { ?>width: <?php echo $width; ?>px;<?php } ?> <?php if($height != "" && $height != "0") { ?>height: <?php echo $height; ?>px;<?php } ?>">
		
		<?php if($link != '') { ?><a href="<?php echo $link; ?>" title="<?php echo $title; ?>"<?php if($lightbox != "none") { ?> rel="prettyPhoto[<?php echo $title; ?>]<?php } ?>"><?php } ?>
		
			<?php if($lightbox != "none") { ?>
				<span class="overlay" style="<?php if($width !="") { ?>width: <?php echo $width; ?>px;<?php } ?> <?php if($height != "" && $height != "0") { ?>height: <?php echo $height; ?>px;<?php } ?>"></span>
			<?php } else {} ?>	
			
			<img src="<?php if($theme_timthumb == "0" && ($width != "" && $height != "")) { ?><?php echo get_template_directory_uri(); ?>/lib/scripts/timthumb.php?src=<?php echo $url; ?>&amp;h=<?php echo $height; ?>&amp;w=<?php echo $width; ?>&amp;zc=<?php echo $zoom; ?><?php } else { echo $url; } ?>" alt="<?php echo $alt; ?>" title="<?php echo $title; ?>" />
		
		<?php if($link != '') { ?></a><?php } ?>
		
	</div>
	
<?php

$output_string = ob_get_contents();
ob_end_clean(); 

return $output_string;

}

add_shortcode("image", "ghostpool_image");

?>