<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
  /* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */

  // load viewer library
  $libraryPath = 'cmsAdmin/lib/viewer_functions.php';
  $dirsToCheck = array('/home/masselsm/public_html/','','../','../../','../../../');
  foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
  if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }

  // load records
  list($about_usRecords, $about_usMetaData) = getRecords(array(
    'tableName'   => 'about_us',
    'where'       => whereRecordNumberInUrl(1),
    'limit'       => '1',
  ));
  $about_usRecord = @$about_usRecords[0]; // get first record

  // show error message if no matching record is found
  if (!$about_usRecord) {
    header("HTTP/1.0 404 Not Found");
    print "Record not found!";
    exit;
  }

  // load records
  list($about_us_personnelRecords, $about_us_personnelMetaData) = getRecords(array(
    'tableName'   => 'about_us_personnel',
  ));

  // load records
  list($panel_logosRecords, $panel_logosMetaData) = getRecords(array(
    'tableName'   => 'panel_logos',
    'where'       => whereRecordNumberInUrl(1),
    'limit'       => '1',
  ));
  $panel_logosRecord = @$panel_logosRecords[0]; // get first record

  // show error message if no matching record is found
  if (!$panel_logosRecord) {
    header("HTTP/1.0 404 Not Found");
    print "Record not found!";
    exit;
  }

  // load records
  list($panel_snowmobile_logosRecords, $panel_snowmobile_logosMetaData) = getRecords(array(
    'tableName'   => 'panel_snowmobile_logos',
    'where'       => whereRecordNumberInUrl(1),
    'limit'       => '1',
  ));
  $panel_snowmobile_logosRecord = @$panel_snowmobile_logosRecords[0]; // get first record

  // show error message if no matching record is found
  if (!$panel_snowmobile_logosRecord) {
    header("HTTP/1.0 404 Not Found");
    print "Record not found!";
    exit;
  }

  // load records
  list($homepageRecords, $homepageMetaData) = getRecords(array(
    'tableName'   => 'homepage',
    'where'       => whereRecordNumberInUrl(1),
    'limit'       => '1',
  ));
  $homepageRecord = @$homepageRecords[0]; // get first record

  // show error message if no matching record is found
  if (!$homepageRecord) {
    header("HTTP/1.0 404 Not Found");
    print "Record not found!";
    exit;
  }

  list($newsRecords, $newsMetaData) = getRecords(array(
    'tableName'   => 'news',
    'perPage'     => '3',
	'orderBy'     => 'date DESC',

  ));

  // load records
  list($marine_categoriesRecords, $marine_categoriesMetaData) = getRecords(array(
    'tableName'   => 'marine_categories',
  ));

  // load records
  list($marineRecords, $marineMetaData) = getRecords(array(
    'tableName'   => 'marine',
	    'perPage'     => '3',

  ));

  // load records
  list($articlesRecords, $articlesMetaData) = getRecords(array(
    'tableName'   => 'articles',
    'perPage'     => '3',
  ));

  list($slideshowRecords, $slideshowMetaData) = getRecords(array(
    'tableName'   => 'slideshow',
    'where'       => whereRecordNumberInUrl(1),
    'limit'       => '1',
  ));
  $slideshowRecord = @$slideshowRecords[0]; // get first record

  // show error message if no matching record is found
  if (!$slideshowRecord) {
    header("HTTP/1.0 404 Not Found");
    print "Record not found!";
    exit;
  }

?>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>Welcome to Massel's Marine</TITLE>
<STYLE TYPE="text/css">
<!--
body { text-align:center; }
#container { text-align:center; width:999px; margin:0 auto;position:relative;
 }
-->
</STYLE>
<LINK HREF="styles.css" REL="stylesheet" TYPE="text/css">
<SCRIPT TYPE="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</SCRIPT>
<LINK REL="stylesheet" TYPE="text/css" HREF="anylinkmenu.css" />

<SCRIPT TYPE="text/javascript" SRC="menucontents.js"></SCRIPT>

<SCRIPT TYPE="text/javascript" SRC="anylinkmenu.js">

/***********************************************
* AnyLink JS Drop Down Menu v2.0- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Project Page at http://www.dynamicdrive.com/dynamicindex1/dropmenuindex.htm for full source code
***********************************************/

</SCRIPT>

<SCRIPT TYPE="text/javascript">

//anylinkmenu.init("menu_anchors_class") //Pass in the CSS class of anchor links (that contain a sub menu)
anylinkmenu.init("menuanchorclass")

</SCRIPT>
<STYLE TYPE="text/css">
<!--
#Layer1 {
	position:absolute;
	width:1000px;
	height:626px;
	z-index:1;
}
#Main {
	position:absolute;
	width:1000;
	height:115px;
	z-index:1;
	left: 0px;
	top: 452px;
	overflow: visible;
	visibility: visible;
}
-->
</STYLE>
</HEAD>

<BODY onLoad="MM_preloadImages('images/Home-over.gif','images/Marine-over.gif','images/Snowmobiles-over.gif','images/Store-over.gif','images/Service-over.gif','images/Customers-over.gif','images/About-over.gif','images/News-over.gif','images/Links-over.gif')">
<TABLE WIDTH="1000" BORDER="0" ALIGN="CENTER" CELLPADDING="0" CELLSPACING="0">
  <TR>
    <TD CLASS="tdMastheadBG"><TABLE WIDTH="1000" BORDER="0" CELLSPACING="0" CELLPADDING="0">
      <TR>
        <TD><IMG SRC="images/single-pixel.gif" WIDTH="20" HEIGHT="34"></TD>
        <TD COLSPAN="2" CLASS="tdMiddle"><?php require_once('_include-top-links.php'); ?></TD>
        <TD><IMG SRC="images/single-pixel.gif" WIDTH="20" HEIGHT="34"></TD>
      </TR>
      <TR>
        <TD><IMG SRC="images/single-pixel.gif" WIDTH="20" HEIGHT="88"></TD>
        <TD CLASS="tdMastheadLogoCell"><A HREF="index.php"><IMG SRC="images/logo-massels.png" WIDTH="331" HEIGHT="56" BORDER="0"></A></TD>
        <TD CLASS="tdMastheadTaglineCell"><H1 CLASS="h1Tagline">Over 75 years of service excellence</H1></TD>
        <TD><IMG SRC="images/single-pixel.gif" WIDTH="20" HEIGHT="20"></TD>
      </TR>
      <TR>
        <TD COLSPAN="4"></TD>
        </TR>
      <TR>
        <TD COLSPAN="4" CLASS="tdNavbarBG"><TABLE ID="Navbar" HEIGHT="43" BORDER="0" CELLPADDING="0" CELLSPACING="0">
          <TR>
            <TD><IMG SRC="images/Spacer-Left.gif" WIDTH="20" HEIGHT="43" ALT="" /></TD>
            <TD><A HREF="index.php" onMouseOver="MM_swapImage('Home','','images/Home-over.gif',1)" onMouseOut="MM_swapImgRestore()"> <IMG NAME="Home" SRC="images/Home-over.gif" WIDTH="61" HEIGHT="43" BORDER="0" ALT="" /></A></TD>
            <TD><A HREF="marine.php" CLASS="menuanchorclass" REL="anylinkmenu1" onMouseOver="MM_swapImage('Marine','','images/Marine-over.gif',1)" onMouseOut="MM_swapImgRestore()"> <IMG NAME="Marine" SRC="images/Marine.gif" WIDTH="67" HEIGHT="43" BORDER="0" ALT="" /></A></TD>
            <TD><A HREF="snowmobiles.php" CLASS="menuanchorclass" REL="anylinkmenu2" onMouseOver="MM_swapImage('Snowmobiles','','images/Snowmobiles-over.gif',1)" onMouseOut="MM_swapImgRestore()"> <IMG NAME="Snowmobiles" SRC="images/Snowmobiles.gif" WIDTH="109" HEIGHT="43" BORDER="0" ALT="" /></A></TD>
            <TD><A HREF="http://viewer.zmags.com/publication/0ce03be7#/0ce03be7/1" TARGET="_blank" onMouseOver="MM_swapImage('Store','','images/Store-over.gif',1)" onMouseOut="MM_swapImgRestore()"> <IMG NAME="Store" SRC="images/Store.gif" WIDTH="235" HEIGHT="43" BORDER="0" ALT="" /></A></TD>
            <TD><A HREF="service.php" onMouseOver="MM_swapImage('Service','','images/Service-over.gif',1)" onMouseOut="MM_swapImgRestore()"> <IMG NAME="Service" SRC="images/Service.gif" WIDTH="71" HEIGHT="43" BORDER="0" ALT="" /></A></TD>
            <TD><A HREF="customers.php" onMouseOver="MM_swapImage('Customers','','images/Customers-over.gif',1)" onMouseOut="MM_swapImgRestore()"> <IMG NAME="Customers" SRC="images/Customers.gif" WIDTH="107" HEIGHT="43" BORDER="0" ALT="" /></A></TD>
            <TD><A HREF="about-boating.php" onMouseOver="MM_swapImage('About','','images/About-over.gif',1)" onMouseOut="MM_swapImgRestore()"> <IMG NAME="About" SRC="images/About.gif" WIDTH="101" HEIGHT="43" BORDER="0" ALT="" /></A></TD>
            <TD><A HREF="news.php" onMouseOver="MM_swapImage('News','','images/News-over.gif',1)" onMouseOut="MM_swapImgRestore()"> <IMG NAME="News" SRC="images/News.gif" WIDTH="55" HEIGHT="43" BORDER="0" ALT="" /></A></TD>
            <TD><A HREF="links.php" onMouseOver="MM_swapImage('Links','','images/Links-over.gif',1)" onMouseOut="MM_swapImgRestore()"> <IMG NAME="Links" SRC="images/Links.gif" WIDTH="91" HEIGHT="43" BORDER="0" ALT="" /></A></TD>
            </TR>
        </TABLE></TD>
        </TR>
    </TABLE></TD>
  </TR>
  <TR>
    <TD CLASS="tdWhite"><TABLE WIDTH="1000" HEIGHT="100" BORDER="0" CELLPADDING="0" CELLSPACING="0">
      <TR>
        <TD>
<?php 
  list($randomImageRecord, $randomImageMetaData) = getRecords(array( 
         'tableName'   =>  'slideshow', 
	 'limit'       =>  1, 
	 'allowSearch' => false, 
       )); 
   
  $images = array(); 
   
  if ($randomImageRecord) { 
    $images = $randomImageRecord[0]['images']; 
  } 
?>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"><!--  
  
var image = new Array();  
 
<?php $counter = 0; ?> 
<?php foreach ($images as $image): ?> 
  image[<?php echo $counter++; ?>] = '<?php echo $image['urlPath'];?>' ;  
<?php endforeach ?> 
  
var index = Math.floor(Math.random() * image.length);  
document.write('<style type="text/css"> td.title { background-image: url('+ image[index] +') } </style>');  
//-->  
</SCRIPT><DIV CLASS="divCentred" ID="container">
          <TABLE WIDTH="999" HEIGHT="100" BORDER="0" CELLPADDING="0" CELLSPACING="0">
            <TR>
              <TD><IMG SRC="images/single-pixel.gif" WIDTH="20" HEIGHT="280"></TD>
              <TD><IMG SRC="images/single-pixel.gif" WIDTH="176" HEIGHT="20"></TD>
              <TD><IMG SRC="images/single-pixel.gif" WIDTH="20" HEIGHT="20"></TD>
              <TD><IMG SRC="images/single-pixel.gif" WIDTH="502" HEIGHT="20"></TD>
              <TD><IMG SRC="images/single-pixel.gif" WIDTH="20" HEIGHT="20"></TD>
              <TD><TABLE WIDTH="241" BORDER="0" CELLSPACING="0" CELLPADDING="0">
                <TR>
                  <TD><IMG SRC="images/single-pixel.gif" WIDTH="241" HEIGHT="20"></TD>
                </TR>
                <TR>
                  <TD><DIV ALIGN="RIGHT"><A HREF="newsletter.php"></A></DIV></TD>
                </TR>
              </TABLE></TD>
              <TD><IMG SRC="images/single-pixel.gif" WIDTH="19" HEIGHT="20"></TD>
            </TR>
            <TR>
              <TD>&nbsp;</TD>
              <TD>&nbsp;</TD>
              <TD>&nbsp;</TD>
              <TD COLSPAN="3"><H1 CLASS="h1White">Welcome to Massel's Marine</H1></TD>
              <TD>&nbsp;</TD>
            </TR>
            <TR>
              <TD>&nbsp;</TD>
              <TD COLSPAN="5"><HR>
                <IMG SRC="images/single-pixel.gif" WIDTH="20" HEIGHT="10"></TD>
              <TD>&nbsp;</TD>
            </TR>
            
            <TR>
              <TD ROWSPAN="3">&nbsp;</TD>
              <TD ROWSPAN="3"><IMG SRC="images/single-pixel.gif" WIDTH="20" HEIGHT="4">
                <?php require_once('_include-logos.php'); ?></TD>
              <TD ROWSPAN="3">&nbsp;</TD>
              <TD COLSPAN="3"><P CLASS="pHomeIntro"><?php echo $homepageRecord['main_intro'] ?></P></TD>
              <TD ROWSPAN="3">&nbsp;</TD>
            </TR>
            <TR>
              <TD COLSPAN="3"><TABLE WIDTH="763" BORDER="0" CELLSPACING="0" CELLPADDING="0">
                <TR>
                  <TD><IMG SRC="images/single-pixel.gif" WIDTH="372" HEIGHT="1"></TD>
                  <TD><IMG SRC="images/single-pixel.gif" WIDTH="19" HEIGHT="6"></TD>
                  <TD><IMG SRC="images/single-pixel.gif" WIDTH="372" HEIGHT="1"></TD>
                </TR>
                <TR>
                  <TD CLASS="tdMission"><TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
                    <TR>
                      <TD><H2 CLASS="h2Padded"><A HREF="marine.php">Marine</A></H2></TD>
                    </TR>
                    <TR>
                      <TD>      <!-- STEP 2a: Display Uploads for field 'marine_photo' (Paste this anywhere inside STEP2 to display uploads) -->
        <!-- Upload Fields: num, createdTime, tableName, fieldName, recordNum, preSaveTempId, filePath, filename, extension, thumbFilePath, isImage, hasThumbnail, urlPath, width, height, thumbUrlPath, thumbWidth, thumbHeight, info1, info2, info3, info4, info5 -->
        <?php foreach ($homepageRecord['marine_photo'] as $upload): ?>
          <?php if ($upload['hasThumbnail']): ?>
            <A HREF="marine.php"><IMG SRC="<?php echo $upload['urlPath'] ?>" ALT="" WIDTH="<?php echo $upload['width'] ?>" HEIGHT="<?php echo $upload['height'] ?>" BORDER="0" /></A>

          <?php elseif ($upload['isImage']): ?>
            <A HREF="marine.php"><IMG SRC="<?php echo $upload['urlPath'] ?>" ALT="" WIDTH="<?php echo $upload['width'] ?>" HEIGHT="<?php echo $upload['height'] ?>" BORDER="0" /></A>

          <?php else: ?><?php endif ?>
        <?php endforeach ?>
      <!-- STEP2a: /Display Uploads --></TD>
                    </TR>
                    <TR>
                      <TD><IMG SRC="images/single-pixel.gif" WIDTH="19" HEIGHT="6"></TD>
                    </TR>
                    <TR>
                      <TD><?php echo $homepageRecord['content'] ?></TD>
                    </TR>
                  </TABLE></TD>
                  <TD>&nbsp;</TD>
                  <TD CLASS="tdMission"><TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
                    <TR>
                      <TD><H2 CLASS="h2Padded"><A HREF="snowmobiles.php">Snowmobiles</A></H2></TD>
                    </TR>
                    <TR>
                      <TD>      <!-- STEP 2a: Display Uploads for field 'snowmobile_photo' (Paste this anywhere inside STEP2 to display uploads) -->
        <!-- Upload Fields: num, createdTime, tableName, fieldName, recordNum, preSaveTempId, filePath, filename, extension, thumbFilePath, isImage, hasThumbnail, urlPath, width, height, thumbUrlPath, thumbWidth, thumbHeight, info1, info2, info3, info4, info5 -->
        <?php foreach ($homepageRecord['snowmobile_photo'] as $upload): ?>
          <?php if ($upload['hasThumbnail']): ?>
            <A HREF="snowmobiles.php"><IMG SRC="<?php echo $upload['urlPath'] ?>" ALT="" WIDTH="<?php echo $upload['width'] ?>" HEIGHT="<?php echo $upload['height'] ?>" BORDER="0" /></A>

          <?php elseif ($upload['isImage']): ?>
            <A HREF="snowmobiles.php"><IMG SRC="<?php echo $upload['urlPath'] ?>" ALT="" WIDTH="<?php echo $upload['width'] ?>" HEIGHT="<?php echo $upload['height'] ?>" BORDER="0" /></A>

          <?php else: ?><?php endif ?>
        <?php endforeach ?>
      <!-- STEP2a: /Display Uploads --></TD>
                    </TR>
                    <TR>
                      <TD><IMG SRC="images/single-pixel.gif" WIDTH="19" HEIGHT="6"></TD>
                    </TR>
                    <TR>
                      <TD><?php echo $homepageRecord['snowmobile_intro'] ?></TD>
                    </TR>
                  </TABLE></TD>
                </TR>
                <TR>
                  <TD><IMG SRC="images/single-pixel.gif" WIDTH="372" HEIGHT="1"></TD>
                  <TD><IMG SRC="images/single-pixel.gif" WIDTH="19" HEIGHT="10"></TD>
                  <TD><IMG SRC="images/single-pixel.gif" WIDTH="372" HEIGHT="1"></TD>
                </TR>
                <TR>
                  <TD COLSPAN="3"><DIV ALIGN="CENTER"><?php echo $homepageRecord['video_or_image_centred'] ?><IMG SRC="images/single-pixel.gif" WIDTH="19" HEIGHT="10"></DIV></TD>
                  </TR>
              </TABLE>
              <?php if (!$homepageRecord): ?><?php endif ?></TD>
              </TR>
            <TR>
              <TD><H2 CLASS="h2Padded">What's New?</H2>
                <?php foreach ($newsRecords as $record): ?>
      
      <H3><A HREF="<?php echo $record['_link'] ?>"><?php echo $record['title'] ?></A></H3>
      <P CLASS="pNoPad"><EM><?php echo date("l, F jS, Y g:i a", strtotime($record['date'])) ?></EM></P>
      <!-- For date formatting codes see: http://www.php.net/date -->
      <?php echo $record['summary'] ?>
	  <HR>

    <?php endforeach ?>
	
	                <?php foreach ($articlesRecords as $record): ?>
      
      <H3><A HREF="<?php echo $record['_link'] ?>"><?php echo $record['title'] ?></A></H3>
      <?php echo $record['summary'] ?>
	  <HR>

    <?php endforeach ?></TD>
              <TD>&nbsp;</TD>
              <TD><SCRIPT TYPE="text/javascript" SRC="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/en_GB"></SCRIPT>
                  <SCRIPT TYPE="text/javascript">FB.init("18228367198abc0583da219472a38ec1");</SCRIPT>
                  <fb:fan profile_id="233397831677" stream="1" connections="0" logobar="1" width="241" height="390"></fb:fan>
                  <DIV STYLE="font-size:8px; padding-left:10px"></DIV></TD>
              </TR>
            <TR>
              <TD COLSPAN="7"><IMG SRC="images/single-pixel.gif" WIDTH="20" HEIGHT="10"></TD>
            </TR>
            <TR>
              <TD>&nbsp;</TD>
              <TD COLSPAN="5" CLASS="tdRuleTop"><?php require_once('_include-footer.php'); ?></TD>
              <TD>&nbsp;</TD>
            </TR>
          </TABLE>
        </DIV></TD>
        </TR>
    </TABLE>    
    <?php if (!$about_usRecord): ?>
    <?php endif ?></TD>
  </TR>
</TABLE>
</BODY>
</HTML>
