package V07;
require Exporter;


our @ISA = qw(Exporter);
our @EXPORT = qw(addHotspot addHotsptIcons);
our @EXPORT_OK = qw();
our $VERSION = 1.00;


sub addHotspot
{ 
	my $hs = $_[0];
	my $jj = $_[1];
	my $html = $_[2];
	my $descrdef = $_[3];

	my $mainLevel = 0;
	my $visibilityflag = 0;
	my $deleted = 1;
	my $icon_invisible = 2;
	my $photo_invisible = 4;
	my $no_enlargement = 8;
	my $generic_image = 16;
	my $retval = 1;

	$ind = $hs->{index};
print $html "HotSpot[$ind] = new HotSpotObj($ind, \"".$hs->{caption}."\", ";
$descr = $hs->{descr};
if (!$descr){
	$descr = $descrdef;
}
print $html "\"$descr\", ";
my $ex=$hs->{ex} - 8;
my $ey=$hs->{ey} - 8;
print $html $ex.", ";
print $html $ey.", ";
print $html $jj.", ";
if ($hs->{deleted}=~/yes/i){
	$visibilityflag = $visibilityflag | $deleted;
	$retval = 0;
}
if ($hs->{icon_invisible}=~/yes/i){
	$visibilityflag = $visibilityflag | $icon_invisible;
}
if ($hs->{photo_invisible}=~/yes/i){
	$visibilityflag = $visibilityflag | $photo_invisible;
	$retval = 0;
}

if ($hs->{generic_image}){
	$retval = 0;
	$visibilityflag = $visibilityflag | $no_enlargement;
	$visibilityflag = $visibilityflag | $generic_image;
	print $html $visibilityflag .", ";
	print $html "\'".$hs->{generic_image}."\', 0";
} else {
	print $html $visibilityflag .", ";
	print $html "\'".$hs->{image}."\',";
	}
print $html $hs->{dir}.");\n";
return $retval;
}
sub addHotsptIcons
{
		my $hsico = $_[0];
		my $fh = $_[1];
		my $supportwebpath = $_[2];
		my $mainLevel = $_[3];
		my $activehs = $_[4];
		my $isEditor =  $_[5];
		my $displaystyle = "display:block";
		if ($hsico->{icon_invisible}=~/yes/i){
			$displaystyle = "display:none";
		}
		$ind = $hsico->{index};
		$dir = $hsico->{dir};
		$xx = $hsico->{nx} - 8;
		$yy = $hsico->{ny} - 8;
		if($hsico->{deleted}=~/yes/i){
			$dir='D';
			$xact = $hsico->{nx} - 70;
			$yact = $hsico->{ny} - 70;
		} else 	{
			$xact = $hsico->{nx} - 86;
			$yact = $hsico->{ny} - 86;
			
		}

		$xenl = $hsico->{nx} - 15;
		$yenl = $hsico->{ny} - 15;
		if (!$mainLevel){
	print $fh "<img src=\"".$supportwebpath."/redhotspot".$dir.".gif\"  id=\"r".$ind."\" class=\"hotspot\" style=\"left:".$xx."px; top:".$yy."px; display:none\"OnClick=\"OpenCam(".$ind.")\" OnMouseOut=\"BlinkOff(".$ind.")\" OnMouseOver=\"BlinkOn(".$ind.")\"  >\n";
	print $fh "<img src=\"".$supportwebpath."/greenhotspot".$dir.".gif\"  id=\"g".$ind."\" class=\"hotspot\" style=\"left:".$xx."px; top:".$yy."px; display:none\" OnClick=\"OpenCam(".$ind.")\" OnMouseOut=\"BlinkOff(".$ind.")\" OnMouseOver=\"BlinkOn(".$ind.")\"  >\n";
	print $fh "<img src=\"".$supportwebpath."/sector".$dir.".gif\"  id=\"s".$ind."\" class=\"activehotspot\" style=\"left:".$xact."px; top:".$yact."px; display:none\"   >\n";
	unless ($isEditor){
		print $fh "<img src=\"".$supportwebpath."/enlargespot.gif\"  id=\"e".$ind."\" class=\"activehotspot\" style=\"left:".$xenl."px; top:".$yenl."px; display:none\" >\n";
	}
		} else { 
			if ($activehs){
	print $fh "<img src=\"".$supportwebpath."/redhotspot".$dir.".gif\"  id=\"r".$ind."\" class=\"hotspot\" style=\"left:".$xx."px; top:".$yy."px; display:none\" OnClick=\"OpenCam(".$ind.")\" OnMouseOut=\"BlinkOff(".$ind.")\" OnMouseOver=\"BlinkOn(".$ind.")\" >\n";
	print $fh "<img src=\"".$supportwebpath."/greenhotspot".$dir.".gif\"  id=\"g".$ind."\" class=\"hotspot\" style=\"left:".$xx."px; top:".$yy."px; display:none\" OnClick=\"OpenCam(".$ind.")\" OnMouseOut=\"BlinkOff(".$ind.")\" OnMouseOver=\"BlinkOn(".$ind.")\"  >\n";
	print $fh "<img src=\"".$supportwebpath."/sector".$dir.".gif\"  id=\"s".$ind."\" class=\"activehotspot\" style=\"left:".$xact."px; top:".$yact."px; $displaystyle\"   >\n";
	unless ($isEditor){
	print $fh "<img src=\"".$supportwebpath."/enlargespot.gif\"  id=\"e".$ind."\" class=\"activehotspot\" style=\"left:".$xenl."px; top:".$yenl."px; display:none\"    >\n";
	}

			} else {	
	print $fh "<img src=\"".$supportwebpath."/redhotspot".$dir.".gif\"  id=\"r".$ind."\" class=\"hotspot\" style=\"left:".$xx."px; top:".$yy."px;\" OnClick=\"OpenCam(".$ind.")\" OnMouseOut=\"BlinkOff(".$ind.")\" OnMouseOver=\"BlinkOn(".$ind.")\"  >\n";
	print $fh "<img src=\"".$supportwebpath."/greenhotspot".$dir.".gif\"  id=\"g".$ind."\" class=\"hotspot\" style=\"left:".$xx."px; top:".$yy."px; display:none\" OnClick=\"OpenCam(".$ind.")\" OnMouseOut=\"BlinkOff(".$ind.")\" OnMouseOver=\"BlinkOn(".$ind.")\"  >\n";
	print $fh "<img src=\"".$supportwebpath."/sector".$dir.".gif\"  id=\"s".$ind."\" class=\"activehotspot\" style=\"left:".$xact."px; top:".$yact."px; display:none\"   >\n";
	unless ($isEditor){
	print $fh "<img src=\"".$supportwebpath."/enlargespot.gif\"  id=\"e".$ind."\" class=\"activehotspot\" style=\"left:".$xenl."px; top:".$yenl."px; display:none\"    >\n";
	}
			}
			}
}




