// JavaScript Document


function get_updir (uplevel) {
var updir = '';

  if (uplevel == "0") updir='';
  if (uplevel == "1") updir='../';
  if (uplevel == "2") updir='../../';
  if (uplevel == "3") updir='../../../';
  return (updir);	

}


function put_identity(level) {
	
	// insert logo here 
	//document.write (' <div id=\"head\">MCCUDDY&#39;S MARINA</div>' );

}

// use index for photo number - index 0=default  banner should be 960 x 120 px
// 0=file   1=category(people/cows/crops/land/equip/misc    2=caption
var BannerPhoto = new Array(

["head1.jpg",          "people",           ""],   // 0
["head2.jpg",          "people",           ""],   // 0
["head3.jpg",          "people",           ""],   // 0
["head4.jpg",          "people",           ""],   // 0
["head5.jpg",          "people",           ""],   // 0
["head6.jpg",          "people",           ""]

);

function get_header_num() {
   var idx = Math.floor(Math.random() * BannerPhoto.length);
   return(idx); 
}
   
   
function get_category (cat) {
	   
   var i=1;
   var idx = get_header_num();
   if (BannerPhoto[idx][1] == cat) {
		return(idx);
   	}

	while (i < BannerPhoto.length) {
	// start with the first photo;
	 	idx++;
		if (idx == BannerPhoto.length) {
			idx=0;
		}
		if (BannerPhoto[idx][1] == cat) {
			return(idx);
		}
		i++;
	}
	   // did not find anything return the original
    return(idx);
}


// pass in the index number of the header photo;
function put_header_photo(level, photo, cat){
	
var updir = get_updir (level);

	if (photo == "r") {// test for random header   //
			idx = get_header_num();
	}
	document.write('<h1>');
	document.write('<img src="' + updir +'photos/'+BannerPhoto[idx][0]+'" usemap="#hmap" />');
    document.write('<map name="hmap" id="hmap"><area shape="rect" coords="286,0,747,80" href="'+ updir +'index.html" target="_self" alt="MCCUDDYS MARINA" /></map>');
	document.write('</h1>');
}


//0=section name 1=href  2=title 3=secondary nav bar
var Nav = new Array(
												 
["home",     "index.html",        "Home",         "n"],
["about",     "about.html",       "About Us",     "n"],
["marinas",   "marinas/overview.html",  "Marinas","n"],

["contacts",  "contacts.html",    "Contacts",     "n"],
["links",     "links.html",       "Links",        "n"]
//["photos",    "photos.html",      "Photos",       "n"]
);


function put_nav_bar(current, level){
    var updir = get_updir (level);
    document.write('   <div id="navigation"><ul>'  );
	var i=0;
	for (i=0; i<Nav.length; i++) {
		// highlight the current sections by ussing class=current
		if (current == Nav[i][0])
		{
		    document.write('  <li class="current">'  ); 
	  		document.write('  <a class="current"  href="'+ updir + Nav[i][1] + '">' );
			document.write(Nav[i][2]);
			document.write('</a></li>'  );
		}
        else
		{
			
		    document.write('   <li>'  );
			document.write('  <a  href="'+ updir + Nav[i][1] + '">' );
			document.write(Nav[i][2]);
			document.write('</a></li>'  );
		}
	}
	document.write('  </ul></div>'  );
}

function testing() 
{
      document.write('<p>xxx</p>'  );
}

function put_nav_bar_old(current, level){
    var updir = get_updir (level);
    document.write('   <div id="navigation"><ul>'  );
	var i=0;
	for (i=0; i<Nav.length; i++) {
		// highlight the current sections by ussing class=current
		if (current == Nav[i][0]) {
		      document.write('  <li class="current">'  ); 
			  document.write('  <a class="current">' + Nav[i][2] + '</a></li>'  );
			  }
        else {
		      document.write('   <li>'  );
			  document.write('  <a href="'+ updir + Nav[i][1] + '">' + Nav[i][2] + '</a></li>'  );
		}
	}
	document.write('  </lu></div>'  );
}

function put_header_old(level, current, photo_idx){
	
	document.write(' <div id="header">'  );
	put_header_photo(level, photo_idx);
	put_nav_bar(current, level);
	document.write('   </div>'  );
	//document.write('<div id="awmAnchor-menu"></div>');
}
function put_header(level, current, photo_idx){
	
	document.write('<br /><div id="header">'  );
	put_header_photo(level, photo_idx);	
	document.write(' <div id="awmAnchor-menu" class="menubar"></div>');
	document.write('   </div>'  );
	
}


function put_footer_with_hit_counter(idx) {
	document.write('  <div id="footer"><div id="footer-content">  ');
	document.write('  <div style="float:right"><a href="http://www.website-hit-counters.com" target="_blank"> ');
	document.write('  <img src="http://www.website-hit-counters.com/cgi-bin/image.pl?URL=' + HitCounterList[idx][1] + '" alt="" border="0" >' );
	document.write('  </a>&nbsp;&nbsp;&nbsp;Visitors since mm/dd/yy ');
    document.write('  </div> ');
	document.write('  <div>&copy;2009 <a href="http://www.mccuddysmarina.com/">McCuddy&#39;s Marina</a></div>  ');
	document.write('</div> ');
}	

function put_footer(level) {
	var updir = get_updir (level);
	document.write('   <div id="footer">  ');
	document.write('   <div id="footer-content">');
	document.write('   <table width="1022px"><tr><td width="1%"></td> ');
	document.write('   <td width="30%">&copy;2010 <a href="http://www.mccuddysmarina.com/">McCuddy&#39;s Marina</a>. All rights reserved.</td>');
	document.write('	<td width="30%" align="center"><a href="'+updir+'sitemap.html">Sitemap</a></td>');
	document.write('	<td width="30%" align="right">Site by: <a href="http://www.s2softwaredesign.com" target="_blank">s2SoftwareDesign.com</a></td><td width="1%"></td></tr></table>');
	document.write('</div></div>  ');
}


function put_download_pdf (){

	document.write('   <div class="refs">  ');
	document.write('  These articles are in pdf format and can be accessed using Adobe&#39;s Reader. Adobe Reader is free and is available for download. ');
	document.write('  <a href="http://www.adobe.com/products/acrobat/readstep2.html">   ');
	document.write('  <img src="../images/adobe_reader.jpg" alt="" align="absmiddle" />');
	document.write('   </a></div>   ');
	
	}
	
function put_download_excel_viewer (){

	document.write('   <div class="refs">  ');
	document.write('(data files require Microsoft Excel [Mac or Windows] or ' );
	document.write('<a href="http://www.microsoft.com/downloads/details.aspx?familyid=1CD6ACF9-CE06-4E1C-8DCF-F33F669DBC3A&displaylang=en"> ');
	document.write(' Excel Viewer</a> [Windows]). ');
	document.write('  </div>   ');
	
	}
	
function put_secondary_logo() {

	document.write('   <div class="secondary-section">    ');
	document.write('   <img src="../images/logos/newlogo.jpg" alt="" style="margin-left:10px"/> ');
	document.write('   </div> ');
}

function marine_drive()
{
document.write ("<p>McCuddy's Marine Drive Marina<br />2901 NE Marine Drive, Portland, Oregon  97211<br />Oregon: (503) 289-7879 Washington:<br />(888) 887-7699 Fax: (503) 283-1308<br />");
}


