<?php
	
function get_piecemaker_slider_results($atts) {
	
	extract(cloudfw_make_var(array(
		'id'				=> NULL,
	), $atts));	
	
	
	global $wp_query;
	$post_id = $wp_query->queried_object->ID;
	
	$slider_options = cloudfw_get_slider_options($id);
	
	if ($slider_options["source"] == 'gallery' && is_numeric( $post_id ) && !empty( $post_id ))
		$slider_data = cloudfw_get_post_gallery_source( $post_id );
	else
		$slider_data = cloudfw_get_slider($id);
	
	ob_start();	

	if (is_array($slider_data)):

		$unique_id = 'piecemaker-slider-'.cloudfw_randomizer(4);
		
		echo '
	    <script type="text/javascript">

	    jQuery(document).ready(function(){

	      var flashvars = {};
	      flashvars.cssSource = "'.(TMP_URL.'/includes/sliders/piecemaker.css').'";
	      flashvars.xmlSource = "'.(TMP_URL.'/includes/sliders/piecemaker.xml.php?id='.$id.'&post_id='.$post_id.'&nocache='.$unique_id).'";
			
	      var params = {};
	      params.play = "true";
	      params.menu = "false";
	      params.scale = "showall";
	      params.quality = "high";
	      params.wmode = "transparent";
	      params.bgcolor = "#F4F4F4";
	      params.allowfullscreen = "true";
	      params.allowscriptaccess = "always";
	      params.allownetworking = "all";
		  
	      swfobject.embedSWF("'.TMP_URL.'/lib/swf/piecemaker.swf", "'.$unique_id.'", "'.floor($slider_options["width"] + 160).'", "'.floor($slider_options["height"] + 60).'", "10", null, flashvars, params, null);
   
		});
	    </script>
		<style>#wide-container { overflow: visible !important; }</style>

		<div style="position: relative; margin: -10px 0 20px -80px; width: '.floor( $slider_options["width"] + 160 ).'px; height: '.floor( $slider_options["height"] + 60 ).'px; background: none; z-index: 0;">
				<div id="'.$unique_id.'" style=" height: '.floor( $slider_options["height"] + 60 ).'px;"></div>
		</div>
		';

		?>
		

	<?php
	endif;
	
	ob_end_flush;
	$out = ob_get_contents();
	ob_end_clean();
	
	return $out;
			
}
	
?>