

sub timeCanadaHandler
{
    $html = shift;
    my( @rValue ) = ();
    my( $title );
    my( $link );
    my( $desc );
    my( $element );
    my( $story );
    my( $done );
    my( $count );
    my( $cElement );

    # Strip out commented html
    $html =~ s/\<\!\-\-.*?\-\-\>//gsi;

#    print "-------------------- time canada ---------------------\n";
#    print "$html";


    ## Table 2 is the "top headline"
    $cElement = zUtil::getNthItem( 2, $html, "<table", "</table>" );

    ## 2nd entry
    $cElement = zUtil::getNthItem( 2, $cElement, "<td", "</td>" );

    if( $cElement=~ /.*<font class\=\"HEADLINE\"\>(.*?)<\/font>/i )
    {
	$title = $1;
    }
    if( $cElement =~ /.*<font class\=\'COVERTEXT\'\>(.*?)<\/font>/si )
    {
	$desc = $1;
    }
    if( $cElement =~ /<a.*?class\=\'STORYLINK\'.*?href='(.*?)'>/si )
    {
	$link = $1;
    }

    push @rValue, { 'title' => $title,
		    'link' => $link,
		    'desc' => $desc
		    };

    ## 3rd table has the rest of the stories ...
    $cElement = zUtil::getNthItem( 3, $html, "<table", "</table>" );

#    print "read: $cElement\n\n\n";
    
    while( $cElement =~ s/\<font.*?PROMOTITLE.*?>(.*?)<\/font>.*?<font.*?MAINTEXT.*?>(.*?)<\/font>.*?<a.*?STORYLINK.*?href\=\'(.*?)\'.*?>//si )
    {
#	print "\nStory!: $1, $2, $3\n";

	$title = $1;
	$desc = $2;
	$link = $3;

	$title =~ s/\n|\r//gs;
	$title =~ s/^\s*//gs;

	$desc =~ s/\n|\r//gs;

	print "Title: $title\n";		
	print "Desc: $desc\n";
	print "Link: $link\n";

	if( length( $title ) > 0 )
	{
	    push @rValue, { 'title' => $title,
			    'link' => $link,
			    'desc' => $desc
			    };
	}
    }

    return @rValue;
}

1;

