package company;
require Exporter;

our @ISA = qw( Exporter );
our @EXPORT = qw( get_company );

use lib ".";


# START HERE
# If we want the index page, then just call to the index mod
# If we want something else, then open call and close
sub get_company{
  
    my $self = shift;
    my $chpt = shift;
    my $page = shift;
    
    if($chpt ne "index"){
        company_opens( $self );
    }

    company_calls( $self, $chpt, $page );

    if($chpt ne "index"){
        company_closes( $self );
    }
}




#
#
# SETS OPENING PAGE TAGS ETC
sub company_opens{

    my $self = shift;

# INSERT TITLE HERE
    my $title = "Company ";

# INSERT HEADER HTML BETWEEN EOF1'S
my $head =<<EOF1;
EOF1

# INSERT SCRIPT HTML BETWEEN EOF2'S
my $script =<<EOF2;
EOF2
   
# INSERT BODY HTML FROM BETWEEN EOF3'S
my $body=<<EOF3;
<tr>

<!-- SECONDARY MENU BAR -->
    <td class="bottomLeft">
     <p>&nbsp; </p>
       <p> 
         <SCRIPT language="JavaScript" src="../_scripts/contactBar.js"></SCRIPT>
       </p>
    </td>

EOF3
# TO HERE

$self->setTitle( $title );
$self->setHead( $head );
$self->setBody( $body );
}



#
#
# CALLS INNER-PAGE MODULES
sub company_calls{

    my $self = shift;
    my $chpt = shift;
    my $page = shift;

    if( $chpt eq 'index' ){
	use lib ".";
	use company_index;
	print "Index mod\n";
	company_index::get_index( $self );
    }

    elsif( $chpt eq 'form' ){
	use lib ".";
      	use contact_form;
	print "Contact mod\n";
	contact_form::get_contact_form( $self );
    }

    elsif( $chpt eq 'info' ){
	use lib ".";
	use contact_info;
	print "Info mod\n";
	contact_info::get_contact_info( $self );
    }
    else{
	print "\n\n Not a valid section \n";
	break;
    }

}


#
#
# LOAD CLOSING TAGS
sub company_closes{

    my $self = shift;

    my $body =<<EOFCLOSE;

 </tr>

EOFCLOSE

    $self->setBody( $body );

}
