<?
class flash
{//DigiHex Systems\\


	function init() {}


	function get($id, $file, $width, $height, $wmode_trans=false, $flash_vars=false, $version=10, $allow_fs=false) {
		global $X;
		$X->JS['swfac'] = JS.'/swfac.js';

		if($width=='auto' || $height=='auto' || $width==false || $height==false) {
			$size=$this->get_info($file);
			$width=$size['width'];
			$height=$size['height'];
		}

		if(@is_array($flash_vars) && count($flash_vars)>0) foreach($flash_vars as $fl_name => $fl_val) {
			if(++$lp==1 && !stristr($plik,'?')) $sep='?'; else $sep='&';
			$file.=$sep.$fl_name.'='.$fl_val;
		}

		return "<script type=\"text/javascript\">AC_FL_RunContent('codebase','http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=".$version.",0,0,0','movie','".$file."',".($wmode_trans==true ? "'wmode','transparent',":"")."'width','".$width."','height','".$height."',".($allow_fs==true ? "'allowfullscreen','true',":"")."'src','top','quality','best','menu','false','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','".$file."');</script>";
	}


	function get_ob($id, $file, $width, $height, $wmode_trans=false, $flash_vars=false, $version=10) {
		global $X;
		$X->JS[]=JS.'/swfobject.js';

		if($width=='auto' || $height=='auto' || $width==false || $height==false) {
			$size=$this->get_info($file);
			$width=$size['width'];
			$height=$size['height'];
		}

		if(@is_array($flash_vars) && count($flash_vars)>0) foreach($flash_vars as $fl_name => $fl_val) {
			$vars.='fo.addVariable("'.$fl_name.'", "'.$fl_val.'"); ';
		}

		return '
			<div id="div_swf_'.$id.'"></div>
			<script type="text/javascript">
			   var fo = new FlashObject("'.$file.'", "'.$id.'", "'.$width.'", "'.$height.'", "'.$version.'");
				'.(!empty($wmode_trans) ? 'fo.addParam("wmode", "transparent");':'').'
				fo.addParam("menu", "false");
				'.$vars.'
			   fo.write("div_swf_'.$id.'");
			</script>
		';
	}


	function get_info($file) {
		require_once($this->PATH.'/header.php');
		$FLASH=new FlashHeader($file);
		return $FLASH->getimagesize();
	}


}//DigiHex Systems\\
?>