{*
//// NATYS ////
TEMPLATE FOR VIEWING PNG IMAGE WITH TRANSPARENCY
params:
		localimgsrc : the local path of the image (path+filename)
		imgsrc : the image, same '<IMG SRC=' value	
	optional:
		border
		width
		height
		ahref (0/1 -> indicate if the cursor must be an hand)
'		
*}

{if $border==""} 
	{assign var="border" value=0} 
{/if}

{if $width==""} 
	{php}
	$a = $this->get_template_vars();
	if (!isset($a['localimgsrc'])) {
		$ini_ok = ini_set("allow_url_fopen","1")===FALSE ? "err" : "ok";
		if ($ini_ok=="ok") {
			$size = getimagesize($a['imgsrc']);
			$width= $size[0];
			$this->assign("width",$width);
		}
		$this->assign("ini_ok",$ini_ok);
	}
	else {
		$size = getimagesize($a['localimgsrc']);
		$width= $size[0];
		$this->assign("width",$width);
	}
	{/php} 
{/if}

{if $height==""} 
	{php}
	$a = $this->get_template_vars();
	if (!isset($a['localimgsrc'])) {
		$ini_ok = isset($a['ini_ok']) && $a['ini_ok']=="ok" ? TRUE : FALSE;
		$ini_ok = $ini_ok && !ini_set("allow_url_fopen","1")===FALSE;
		$ini_ok = $ini_ok ? "ok" : "err";
		if ($ini_ok=="ok") {
			$size = getimagesize($a['imgsrc']);
			$height = $size[1];
			$this->assign("height",$height);
		}
		$this->assign("ini_ok",$ini_ok);
	}
	else {
		$size = getimagesize($a['localimgsrc']);
		$height = $size[1];
		$this->assign("height",$height);
	}
	{/php} 
{/if}


{if $ahref==1}
	{assign var="cursor" value="hand"}
{else}
 	{assign var="cursor" value=""}
{/if}

<SCRIPT LANGUAGE="javascript">
{literal}
var V=navigator.appVersion;
if(document.all && document.getElementById) { // it's ie5+ but which version ?
	ver=V.substring(V.indexOf("MSIE",0)+5,V.indexOf(";",V.indexOf("MSIE",0)));
}
else ver="";
//sorry : for ie 5.01, there's NO solution for displaying PNG correctly
if(document.all && document.getElementById && ver!="5.01" && "{/literal}{$ini_ok}{literal}"=="ok") { //it's ie5.5+
<!-- damn you MSFT and your incompatible hacks!! :( -->
{/literal}
document.write("<div title=\"{$alt}\" align=\"{$align}\" style=\"cursor:{$cursor}; border-style:solid;  border-width: {$border}px; width: {$width}px; height: {$height}px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'{$imgsrc}\', sizingMethod=\'scale\');\"></div>");
{literal}
}
else{ //all other browsers
{/literal}
document.write("<img src=\"{$imgsrc}\" width=\"{$width}\" height=\"{$height}\" alt=\"{$alt}\" title=\"{$alt}\" border=\"{$border}\" >");
{literal}
}
{/literal}
</SCRIPT>