/****************************************************/
/**********     Nolimitz:  Gallery     **************/
/****************************************************/

var cGalStr = "./pix/gallery/nl_gallery_";
var aGalT1  = ["","","","","","","","","","","","","",""];
var aGalT2  = ["","","","","","","","","","","","","",""];
var aGalT3  = ["","","","","","","","","","","","","",""];

function GalleryObj() {
   this.Path         = "./pix/gallery/";
   this.Root         = "nl_gallery_";
   this.PicInFocus   = 1;
   this.PageCount    = 3;
   this.PageInFocus  = 1;
   this.PopUpFile    = "nl_gallery_popup.htm";
   this.PopUpWidth   = "400";
   this.PopUpHeight  = "464";

   this.PixMax      = 45;
   this.Pages       = 3;
   this.PixPerCol   = 4;
}

GalleryObj.prototype.ShowIntro = function() {
   document.write( '<div class="p1">' );
   document.write( '   Here are some favorites recently added to our photo collection.&nbsp;&nbsp;' );
   document.write( '   Have any Nolimitz pictures you’d like to see here? &nbsp;&nbsp; ' );
   document.write( '   Just send them our way and we’ll check them out.&nbsp;&nbsp;' );  
   document.write( '   See you on the water!  - ');
   document.write( '   <span style="color: #666666;"><i><b>The Nolimitz Crew</b></i></span>' );
   document.write( '</div>');
}

GalleryObj.prototype.ShowPageOptions = function( nPage ) {
   document.write( '<div style="padding: 0px 0px 5px 10px;">' );
   document.write( '<table border="0" width="100%" cellspacing="0" cellpadding="0">' );
   document.write( '<tr>' );
   document.write( '   <td align="left" ><div class="Title2">Gallery Page #' + this.PageInFocus +'</div></td>' );
   document.write( '   <td align="center" width="70">' );
   document.write( this.PageButtonStr(1) );
   document.write( '    </td>' );
   document.write( '   <td align="center" width="10">|</td>' );
   document.write( '   <td align="center" width="70">' );
   document.write( this.PageButtonStr(2) );
   document.write( '    </td>' );
   document.write( '   <td align="center" width="10">|</td>' );
   document.write( '   <td align="center" width="70">' );
   document.write( this.PageButtonStr(3) );
   document.write( '   </td>' );
   document.write( '   <td align="center" width="140" nowrap>' );
   document.write( '       <span style="font-size: 12px; font-family: times;"><i>click images to enlarge</i>' );
   document.write( '   </td>' );
   document.write( '</tr>' );
   document.write( '</table>' );
   document.write( '</div>' );
}

GalleryObj.prototype.PageButtonStr = function( nPage ) {
   var cPage = "" + nPage + "";
   var cStr  = "<b>Page "+ cPage +"</b>";
   if (Gallery.PageInFocus!=nPage) { 
      cStr = '<a class="Links2" href="nl_gallery_p' + cPage +'.html">Page '+ cPage +'</a>'; }
   return cStr; 
}

GalleryObj.prototype.ShowHeader = function( nPage ) {
   document.write( '<div style="padding: 0px 0px 5px 10px;">' );
   document.write( '<table border="0" width="100%" cellspacing="0" cellpadding="0">' );
   document.write( '<tr>' );
   document.write( '  <td>' );
   for(var i=1;i<=this.Pages;i++) { document.write( this.PageNavStr( i, nPage ) ); }
   document.write( '  </td>' );
   document.write( '  <td align="right">' );
   document.write( '       <img src="./images/click_to_enlarge.gif" border="0" alt="Click To Enlarge" hspace="20">' );
   document.write( '  </td>' );
   document.write( '</tr>' );
   document.write( '</table>' );
   document.write( '</div>' );	
}	    

GalleryObj.prototype.PageNavStr = function( i, nPage ) {
   var cStr = "";
   if   (nPage==i) { cStr = '<b>Page ' + nPage + '</b>'; } 
   else { cStr = '<a class="SubMenu" href="stw_gallery_p' + i +'.html">Page ' + i + '</a>'; }
   if (i<this.Pages) { cStr = cStr + " | "; }
   return( cStr );
}

GalleryObj.prototype.ShowRow = function( i, j ) {   
   document.write( '<div style="padding: 0px 0px 4px 0px;">' );  
   document.write( '<table border="0" width="100%" cellspacing="0" cellpadding="0"><tr>' );
   for(x=i;x<=j;x++) { if (x<=this.PixMax) {this.ShowCell( x );} else {this.Show_Blank_Cell();} }  
   document.write( '</tr></table><br>' ); 
   document.write( '</div>' );	
}

GalleryObj.prototype.ShowCell = function( nNum ) {
   var cNum = this.NumToStr( nNum );
   document.write( '<td class="gCellPic">' );
   if (nNum <= this.PixMax) {
      document.write( '<a href="javascript:PopUpGallery(&#39;' + nNum +'&#39;)">' );
      document.write( '<img src="./pix/gallery/nl_gallery_' + cNum +'_sm.jpg" border="0" alt="Click to Enlarge">' );
      document.write( '</a>' );
   } else { document.write( '<img src="./images/spacer.gif" alt="" border="0">' ); }

   document.write( '</td>' );
}
   
GalleryObj.prototype.Show_Blank_Cell = function() {
   document.write( '<td class="gCellPic">' );
   document.write( '</td>' );
}
 
GalleryObj.prototype.NumToStr = function(n) {
   var cNum = "" ;
   if (n<10) { cNum = "00" + n;  }
   if ((n>9)&&(n<100)) { cNum = "0" + n; }
   if (n>99) { cNum = "" + n + ""; }
   return cNum ;
}

function PopUpGallery( nNum ) {
   Gallery.PicInFocus = nNum;
   cHTML = Gallery.PopUpFile + '?p1=' + Gallery.PicInFocus;
   cWidth = 'width=' + Gallery.PopUpWidth +',';
   cHeight = 'height=' + Gallery.PopUpHeight +',';
   cPanel = 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,' + 
            cWidth + cHeight;
   day = new Date();
   id = day.getTime();
   eval( "page" + id + " = window.open( cHTML, '" + id + "', cPanel );" );
}

var Gallery = new GalleryObj;

function RandomPicture( nMax, cPath ) {
   var ran_number = Math.round( Math.random() * ( nMax-1) ); 
   var cNum       = ran_number + 1;
   if (ran_number < 10)  { cNum = "0" + cNum; } 
   if (ran_number < 100) { cNum = "0" + cNum; }
   document.write( '<center><img src="' + cPath + cNum + '_sm.jpg" border="0" alt="Pic"></center>' );
}

/******************************/
/****   Gallery PopUp  ********/
/******************************/

var p1  = "";       /* Gallery Picture In Focus   */
var np1 = 1;

function GalleryPop_Object() {
   this.Path         = "./pix/gallery/";
   this.Root         = "nl_gallery_";
   this.PicInFocus   = 1;
   this.PopUpFile    = "nl_gallery_popup.htm";
   this.PicMax       = 45;
}

GalleryPop_Object.prototype.GetParameters = function() {
   var ParamStr  = window.location.href.split("?");
   var params    = new Array();     

   if (ParamStr[1]) {
     var pairs= ParamStr[1].split("&")
     for (var i=0; i<pairs.length; i++) {
        nameVal = pairs[i].split('=');
        params[nameVal[0]] = nameVal[1];
     } 
     p1  = unescape(params["p1"]?params["p1"]:"");
     np1 = parseInt( p1, 10 ); 
   }
} 

GalleryPop_Object.prototype.ShowParameters = function() {
   if(p1||p2||p3||p4)document.write("Parameters detected:");
   if(p1) document.write("<BR>P1="+p1);
}

GalleryPop_Object.prototype.GoNext = function() {
   this.PicInFocus++;
   if (this.PicInFocus>this.PicMax) { this.PicInFocus=1; }
   this.SetPic();
}

GalleryPop_Object.prototype.GoPrevious = function() {
   this.PicInFocus--;
   if (this.PicInFocus<1) { this.PicInFocus = this.PicMax; }
   this.SetPic();
}

GalleryPop_Object.prototype.Show = function() {
   document.write('<center>' );

   document.write('<table width="100%" height="34" cellpadding="0" cellspacing="0" border="0">');
   document.write('<tr>');
   document.write('<td valign="top" align="left">');
   document.write('<img src="./images/logos/nl_logo_letters_185.jpg" alt="" border="0" space="10">');
   document.write('</td>');
   document.write('<td style="font-size: 22px; font-weight: bold; ">');
   document.write('<div style="line-height: 1.1em; vertical-align: middle; font-style: italic;">' );
   document.write( ' Gallery ');
   document.write( ' </div></td>');
   document.write('</tr>' );
   document.write('<table>');

   document.write('<table width="100%" height="400" cellpadding="0" cellspacing="0" border="0">' );
   document.write('<tr>' );
   document.write('   <td height="100%" colspan="2" align="center" valign="middle">' );
   document.write('   <img src="' + this.PicStr() +'" name="gallerypopup" alt="" border="0">' );  
   document.write('   </td>' ); 
   document.write('</tr>' );
   document.write('<table>');

   document.write('<table width="100%" height="20" cellpadding="0" cellspacing="0" border="0">' );
   document.write('<tr bgcolor="#ffffff">' );
   document.write('    <td height="18" align="left" valign="middle">&nbsp;&nbsp;' );
   document.write('    <a class="GallerySlideShow" href="javascript:GalleryPopUp.GoPrevious();">' );
   document.write('      <img src="./images/arrow_bwd.gif" alt="" border="0">' );
   document.write('    </a>' );
   document.write('   </td>')
   document.write('   <td height="18" align="right" valign="middle">' );
   document.write('      <a class="GallerySlideShow" href="javascript:GalleryPopUp.GoNext();">' );
   document.write('         <img src="./images/arrow_fwd.gif" alt="" border="0"></a>&nbsp;&nbsp;' );
   document.write('    </td>');
   document.write('</tr>' );
   document.write('</table>' );
   document.write('</center>' );
}

GalleryPop_Object.prototype.SetPic = function() {
   document.images.gallerypopup.src = this.Path + this.Root + ZeroFill( this.PicInFocus) + '_lg.jpg';
}

GalleryPop_Object.prototype.PicStr = function() {
    return this.Path + this.Root + ZeroFill( this.PicInFocus ) + '_lg.jpg';
}

GalleryPopUp = new GalleryPop_Object();

/******************************************************************/
/*********************        End of Document     ******************/
/******************************************************************/