package custom;
require Exporter;

our @ISA = qw( Exporter );
our @EXPORT = qw( get_custom );

use lib ".";


sub get_custom{

	my $self = shift;
	my $galleryNum = shift;

#----------import pic list from file---------------
$picFile = "custom_pic_gallery_" . $galleryNum;

print "Pic File: " , $picFile, "\n";

chdir "_gallery";
chdir "_custom";

open( LIST, $picFile);
$count = 0;
while( $line = <LIST> ){ 
	chomp( $line );
	@picList[ $count ] = $line;	
	print @picList[ $count ];
	$count++; 
}
#----------------------------------------    

#----- prefix for pictures---------------
$thumbs="raised216x162";
$pics="675x500";
#-----------------------------------------

my $title = $galleryNum;

my $head =<<EOF1;

<script type='text/javascript' src='../../_scripts/cookies.js'></script>

EOF1

my $script =<<EOF2;
EOF2

my $body = <<EOF3;

<!-- MAIN PAGE-->
<td class='bottomRight' align='center' valign='top' >

<table width='550' border='0'>
        <tr align="center"> 
          <td rowspan='2'><font size='6'><strong>
		<h1><u>Custom Grills <br>
		Gallery $galleryNum </u><br>
		<font color='#e5e5ff' size='4'>Click On Photo To Enlarge</font>
	    </h1>
	    </strong></font></td>
          <td align='center' valign='bottom'>
	  <hr />
            <font color='#e5e5ff' size='4'>
	    <a href="#" onClick="window.open('http://grillsbydesign.com/help.htm#checkbox', 'GBDHelp', 'toolbar=no, scrollbars=yes, resizable=yes, width=450, height=600, top=0, left=0, screenX=0, screenY=0')"> 
	    How To Use These Boxes 
            <input name='pic0000' type='checkbox'>
	    </a></font>
	  <hr />
	  </td>
        </tr>
        <tr align='center'>
          <td align='center' valign='top'>
	  <font color='#e5e5ff' size='4'>
	  <a href='#' onClick='myGallery('pics');'>
	  View &quot;My Grill Island&quot; Pictures</a>
	  </font> 
            <hr /></td>
        </tr>
      </table>
      <hr />
  
  <table width='450' border='0' align='center'>
EOF3

	for($picStart = 0 ; $picStart < $count; $picStart++){
	
	#<tilePattern>
	$body .=   "<tr>\n";
	$body .=   "<td width='225' align='left'><div align='left'>\n";
	            
	       for($i=0;$i<7;$i++){
	        	$body .=   "<img src='http://grillsbydesign.com/_graphics/tiles/tumbleStone1small.jpg'"; 
	        	$body .=   "width='27' height='27'>\n";
	        }
	            
	  	$body .=   "</div></td>\n\n";
	     	$body .=   "<td width='225' align='right'><div align='right'>\n";
	           
	      	for($i=0;$i<7;$i++){
	        	$body .=   "<img src='http://grillsbydesign.com/_graphics/tiles/tumbleStone1small.jpg'"; 
	        	$body .=   "width='27' height='27'>\n";
  		}
  		$body .=   "</div></td>\n";
  	#</tilePattern>	
	
	$body .=   "</tr>\n\n\n<tr>\n"; 
	
	#<pictures>         
		$body .=   "<td width='225' align='left'><div align='left'>\n";
      #pop-up   
            $body .=   "<a onClick=\"window.open('', 'jg50599_window',";
		$body .=   "'toolbar=no,scrollbars=yes,resizable=yes,";
		$body .=   "width=675,height=500')\" \n";								
	#picture							
		$body .=    "href='http://grillsbydesign.com/_graphics/_pics/675x500".$picList[ $picStart ].".jpg'\n";
		$body .=    "target=jg50599_window>\n";								

	#thumb								
		$body .=    "<img src='http://grillsbydesign.com/_graphics/_pics/raised216x162".$picList[ $picStart ].".jpg'\n";  
		$body .=    "border='0'></a><br>\n";

	#checkbox
        	$body .=    "<input type='checkbox' name='pic";
        	$body .=    $picList[ $picStart] . "' ";
        	$body .=    "value='" . $picList[ $picStart] . "' ";
          	$body .=    "onClick='checkValue(this);' >\n";

	#label
		$body .=    $picList[ $picStart ].".jpg </div>\n</td>\n\n";	

# Repeat for---------------------	
		$picStart++;
# next picture-------------------


	        $body .= "<td width='225' align='right'><div align='right'>\n";
	#pop-up
		$body .=   "<a onClick=\"window.open('', 'jg50599_window',";
		$body .=   "'toolbar=no,scrollbars=yes,resizable=yes,";
		$body .=   "width=675,height=500')\" \n";		

	#picture							
		$body .=    "href='http://grillsbydesign.com/_graphics/_pics/675x500".$picList[ $picStart ].".jpg'\n";
		$body .=    "target=jg50599_window>\n";		  	

      #thumb								
		$body .=    "<img src='http://grillsbydesign.com/_graphics/_pics/raised216x162".$picList[ $picStart ].".jpg'\n";  
		$body .=    "border='0'></a><br>\n";

	#label
		$body .=    $picList[ $picStart ].".jpg \n";

	#checkbox
        	$body .=    "<input type='checkbox' name='pic";
        	$body .=    $picList[ $picStart] . "' ";
        	$body .=    "value='" . $picList[ $picStart] . "' ";
          	$body .=    "onClick='checkValue(this);' >\n";

		$body .=   "</div>\n </td>\n </tr>\n\n\n";
	#</pictures>	
	}

	#footer tile 
 	$body .=   "<tr>\n";
	$body .=   "<td width='225' align='left'><div align='left'>\n";
		            
	for($i=0;$i<7;$i++){
	
		$body .=   "<img src='http://grillsbydesign.com/_graphics/tiles/tumbleStone1small.jpg'"; 
		$body .=   "width='27' height='27'>\n";
	}
		            
	$body .=   "</div></td>\n\n";
	$body .=   "<td width='225' align='right'><div align='right'>\n";
		           
	for($i=0;$i<7;$i++){
	
		$body .=   "<img src='http://grillsbydesign.com/_graphics/tiles/tumbleStone1small.jpg'"; 
		$body .=   "width='27' height='27'>\n";
	}
  	
  	$body .=   "</div></td>\n";

	# SET INFO TO OBJECT
	$self->setTitle( $title );
	$self->setHead( $head );
	$self->setBody( $body );



}
