package gbd;
require Exporter;

our @ISA = qw( Exporter );
our @EXPORT = qw( get_gbd );

use lib ".";


# DRIVER
sub get_gbd{
  
    my $self = shift;
    my $sect = shift;
    my $chpt = shift;
    my $page = shift;

    
    # Begin
    gbd_opens( $self );
 
    # Recurse through inner elements
    gbd_calls( $self, $sect, $chpt, $page );

    # Finish what you began
    gbd_close( $self );

}



# SETS GBD SPECIFIC CONTENT
sub gbd_opens{

    my $self = shift;


# INSERT TITLE HERE
    my $title = "Grills By Design -- ";


# INSERT HEADER HTML BETWEEN EOF1's
my $head =<<EOF1;     

<!-- STYLESHEET -->
<link rel='stylesheet' type='text/css'                                                                          
      href='http://GrillsByDesign.com/_scripts/CSSMain.css' />                                                  

<!-- META TAGS -->
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>                                        
<meta name='keywords' content='grill design custom outdoor kitchen backyard summer'>                            
<meta name='description' content=' Grills By Design-- Home Page Custom Outdoor Kitchen And Grill Designer'>   

EOF1


# INSERT SCRIPT HTML BETWEEN EOF2's
my $script=<<EOF2;

EOF2


# INSERT BODY HTML BETWEEN EOF3's
my $body=<<EOF3;

<table width='750' border='0' align='left'>                                                              
<tr>            

<!-- LOGO PANE-->                                                                                        
    <td class='topLeft'><div align='center'>                                                                            
      <SCRIPT language='JavaScript' src='http://GrillsByDesign.com/_scripts/topLeft.js'></SCRIPT>         
    </td>                                                                                                  

<!-- PRIMARY MENUBAR -->
    <td class='topRight' width='575' nowrap>                                                              
      <div align='center'>                                                                               
        <SCRIPT language='JavaScript' src='http://GrillsByDesign.com/_scripts/topRight.js'></SCRIPT>   
      </div>                                                                                                
    </td>               
                                                                                     
</tr>
EOF3

$self->setTitle( $title);
$self->setHead( $head);
$self->setBody( $body );

}



# CALLS INNER-PAGE MODULES
sub gbd_calls{

    my $self = shift;
    my $sect = shift;
    my $chpt = shift;
    my $page = shift;

    if( $sect eq 'company' ){
	use lib "_company";
	use company;
	print "Company mod\n";
	get_company( $self, $chpt, $page );
    }

    elsif( $sect eq 'product' ){
        use lib "_product";
	use product;
	print "Product mod\n";
	get_product( $self, $chpt, $page );
    }

    elsif( $sect eq 'gallery' ){
	use lib "_gallery";
        use gallery;
      	print "Gallery mod\n";
        get_gallery( $self, $chpt, $page );
    }

    elsif( $sect eq 'index' ){

	print "Index mod\n";
	gbd::get_index( $self );
    }

    else{
	print "\n\n Not a valid section \n";
	break;
    }

}


# PRINTS THE INDEX PAGE
sub get_index{

    my $self = shift;

    my $title = 
"";
    my $head = 
"";
    my $script = 
"";
    my $body = 
"";

    $self->addTitle( $title );
    $self->addHead( $head );
    $self->addScript( $script );
    $self->addBody( $body );

}


# LOAD CLOSING TAGS
sub gbd_close{

    my $self = shift;

# INSERT HTML FROM HERE
my $body =<<EOFCLOSE;

</table>       
<p>&nbsp;</p> 

EOFCLOSE
# TO HERE
    $self->setBody( $body );

}


