## Custom perl code for IVT


@layers = (
	"layer00",
	


);

foreach $layer ( @layers )	{

	my $sth = $dbh->prepare( "select id, name from portal_parts where portal = $portal_id and type = 9 and viewer is NULL and name = '$layer'" )
		||die( "$DBI::errstr" );		
	$sth->execute
		||die( "$DBI::errstr" );
	while(( $id, $name ) = $sth->fetchrow ){
		my $sth = $dbh->prepare( "select data from portal_parts where type= 9 and portal = $portal_id and viewer = $viewer_id and name = $id" )
			||die( "$DBI::errstr" );
		$sth->execute
			||die( "$DBI::errstr" );
		$data = $sth->fetchrow;
		$sth->finish;
	
		@caps = split( /,/, $data );
		foreach $cap ( @caps )	{
			if( $cap eq $capture{'id'} )	{
				$current{'layer'} = $layer;
			}
		}
		
	}
	$sth->finish;
}

foreach $layer ( @layers )	{
	if( $current{'layer'} eq $layer )	{
		$current_html =~ s/\!variable{'$layer'}/1/;
	}else	{
		$current_html =~ s/\!variable{'$layer'}/0/;
	}
}

