// <script type="text/javascript">
//-----------------------------
//Author: Gary Morris
//Date  : 1/23/2005
//-----------------------------
var ThumbsPerRow = 4;

var prefix = "";
var thumbCount = 0;

/* BEGIN Suckerfish Dropdowns - see http://www.htmldog.com/articles/suckerfish/dropdowns/ */
sfHover = function() {
	var sfNav = document.getElementById("nav");
	if (sfNav) {
		var sfEls = sfNav.getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
/* END Suckerfish Dropdowns */

function viewCartForm() {
    document.write('<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">');
    document.write('<input type="hidden" name="cmd" value="_cart">');
    document.write('<input type="hidden" name="business" value="orders@morrisphotoart.com">');
    document.write('<input type="hidden" name="display" value="1">');
    document.write('<input type="image" src="' + prefix + 'images/ViewCartButton.gif"');
    document.writeln(' border="0" name="submit" alt="View Shopping Cart"></form>');
}

function mainNavLogo(level) {
  document.write('<td width=200');
  if (level == 0) document.write(' colspan=2');
  document.write('>');

  if (level > 0) document.write('<a href="' + prefix + 'index.html">');
  document.write('<img border=0 src="' + prefix + 'images/MPA_Logo.jpg" alt="MorrisPhotoArt.com">');
  if (level > 0) document.write('</a>');
  document.writeln('</td>');
}

function mainNavLink(directory, title) {
  document.write('<td width=100 align=center>');
  if (directory == 'more') {
	document.write('<ul id="nav"><li>More<br><ul>');
	document.write('<li><a href="' + prefix + 'contact/index.html">Contact Us</a></li>');
	document.write('<li><a href="' + prefix + 'travel/index.html">Travel</a></li>');
	document.write('<li><a href="' + prefix + 'store/index.html">Policies</a></li>');
	document.write('<li><a href="' + prefix + 'store/prints.html">Prints</a></li>');
	document.write('<li>');
	viewCartForm();
	document.write('</li></ul></li></ul>');

  } else {
	document.write('<a href="' + prefix + directory + '/index.html">');
	document.write(title);
	document.write('</a>');
  }
  document.writeln('</td>');
}

function mainNavThumb(jpgFile) {
  document.write('<td><img border=0 alt="" src="thumbs/');
  document.write(jpgFile);
  document.write('"></td>');
}

function mainNavBar(level) {
  prefix = "";
  if (level == 1) {
    prefix = "../";
  } else if (level == 2) {
    prefix = "../../";
  } else if (level == 3) {
    prefix = "../../../";
  }

  document.writeln('<table class="blackbar" width=800 cellspacing=0 cellpadding=0><tr>');
  mainNavLogo(level);
  mainNavLink('photos',    "Photos");
  mainNavLink('galleria',  "Digital<br>Art");
  mainNavLink('calibrate', "Calibrate");
  mainNavLink('search',    "Search");
  mainNavLink('links',     "Links");
  mainNavLink('more',      "more");

  if (level == 0) {
    // do the thumbnails below the navigation bar
    document.writeln('<tr>');
    mainNavThumb("WineBarrels.jpg");
    mainNavThumb("CCA_muertos.jpg");
    mainNavThumb("FallLeaves.jpg" );
    mainNavThumb("Gentleman.jpg"  );
    mainNavThumb("Mirador.jpg"    );
    mainNavThumb("SDMoonrise.jpg" );
    mainNavThumb("Sevilla.jpg"    );
    mainNavThumb("TecateSinger.jpg");
    document.writeln('</tr>');
  }

  document.writeln('</table>');
}

function writeModDate() {
  var lastmod = document.lastModified;
  var lastmoddate = Date.parse(lastmod);

  if(lastmoddate == 0){       // unknown date
    document.writeln("unknown");
  } else {
    var d = new Date(lastmod);
    var year = d.getYear();
    if (year < 40)  year += 2000;
    if (year < 200) year += 1900;
    document.write(year + '-' + (d.getMonth()+1) + '-' + d.getDate());
  }
}

function startThumbs() {
  thumbCount = 0;
  document.writeln('<table border=0 width=800 cellspacing=0 cellpadding=0>');
}

function endThumbs() {
  if (thumbCount > 0) {
    document.write('</tr>');
  }
  document.writeln('</table>');
}

function writeThumb(linkURL,imageFile,thumbHeight,thumbWidth,title,caption) {
  if (thumbCount == 0) {
    document.write('<tr>');
  }
  document.writeln('<td align=center><a href="' + linkURL +
                   '"><img alt="" src="' + imageFile +
                   '" vspace=1 height="' + thumbHeight +
                   '" width="' + thumbWidth +
                   '"><br>' + title + '</a></td>');
  thumbCount++;
  if (thumbCount >= ThumbsPerRow) {
    document.writeln('</tr>');
    thumbCount = 0;  // number of thumbnails on current row
  }
}

function writeMailto(userid,name) {
  document.write('<a href="mailto:' + userid + '@morrisphotoart.com">' + name + '</a>' );
}

function writeAddr(pageName) {
  document.write('<table cellspacing=0 cellpadding=0 width=800 border=0>');
  document.write('<tr height=8><td></td></tr><tr><td><hr><address>');
  document.write(pageName);
  document.write(' / ');
  writeModDate();
  document.write(' / <a href="http://www.morrisphotoart.com">MorrisPhotoArt.com</a>');
  document.write(' / ');
  writeMailto("webmaestro","webmaster");
  document.writeln('</address></td></tr></table>');
}

function writePath(galleryTitle,pageName) {
  document.write('<a href="../../index.html">Home</a> &gt; ');

  if (location.pathname.indexOf("/galleria/") >= 0) {
	document.write('<a href="../index.html">Digital Art</a> &gt; ');
  } else {
	document.write('<a href="../index.html">Photos</a> &gt; ');
  }

  galleryGroupStart = galleryTitle.indexOf(" - ");
  if (galleryGroupStart > 0) {
  	/* title contains a galleryGroup and a galleryTitle */
    galleryGroup = galleryTitle.substr(0, galleryGroupStart);
  	galleryTitle = galleryTitle.substr(galleryGroupStart+3);
  	document.write('<a href="../_' + escape(galleryGroup) + '/index.html">' + galleryGroup + '</a> &gt; ');
  }

  if (pageName.length > 0) {
  	/* link back to parent, the gallery's index page */
    document.write('<a href="index.html">' + galleryTitle + '</a> &gt; ' + pageName);
  } else {
  	/* this is the gallery's index page */
  	document.write(galleryTitle);
  }
}

google_ad_client    = "pub-5874973532568527";
google_ad_width     = 250;
google_ad_height    = 250;
google_ad_format    = "250x250_as";
google_ad_channel   = "";
google_ad_type      = "text_image";
google_color_border = "BABECA";
google_color_bg     = "BABECA";
google_color_link   = "000000";
google_color_url    = "0033FF";
google_color_text   = "000000";

function writeAd(thePlace) {
  if (thePlace == 1) {
	google_ad_width     = 250;
	google_ad_height    = 250;
	google_ad_format    = "250x250_as";
	google_ad_channel   = "";
	google_color_border = "BABECA";
	google_color_bg     = "BABECA";
	google_color_link   = "000000";
	google_color_url    = "0033FF";
	google_color_text   = "000000";

  } else if (thePlace == 2) {
	google_ad_width     = 728;
	google_ad_height    = 90;
	google_ad_format    = "728x90_as";
	google_ad_channel   = "";
	google_color_border = "9999AA";
	google_color_bg     = "BABECA";
	google_color_link   = "000000";
	google_color_url    = "0033FF";
	google_color_text   = "000000";
  }
}

var MINWIDTH = 800;
var MINCOLORS = 16;

function writeScreenCheck() {
	var scrnWidth  = screen.width;
	var colorDepth = screen.colorDepth;

	document.writeln('<h2>Screen Settings Check</h2><ul class="galleries">');

    document.writeln('<li>Your screen is set to ' + scrnWidth + ' pixels wide (' + scrnWidth + 'x' + screen.height + ').');
	if (scrnWidth < MINWIDTH) {
	   document.writeln('</li><p><li class="errmsg">For viewing this web site your screen should be at least ' +
	                    MINWIDTH + ' pixels wide.  We recommend that you increase the resolution of your screen to at least ' +
	                    '800 x 600 using the Display control panel (or Monitors control panel on a Macintosh) for best viewing.');
	} else {
	   document.writeln('  That is fine for viewing this web site (a minimum of ' + MINWIDTH + ' is recommended).');
	}

	document.writeln('</li><p><li>Your color depth is set to ' + colorDepth + ' bits per pixel.');
	if (colorDepth < MINCOLORS) {
	   document.write('</li><p><li class="errmsg">For best viewing of this web site your color depth should be at least ' +
	                  MINCOLORS + ' bits per pixel but it is only ' + colorDepth +
	                  ' bits per pixel.  We recommend that you increase the color depth of your screen to at least ' +
	                  MINCOLORS + ' bits per pixel (thousands of colors) using the Display control panel ' +
	                  '(or Monitors control panel on a Macintosh) for viewing photographs.');
	} else {
	   if (colorDepth == 16) {
	     document.write('   That color depth is usable but you would get better color detail and less banding with 24 or 32 bit color.');
	   } else {
	     document.write('   That color depth is fine for viewing this web site.');
	   }
	}
	document.writeln('</li></ul>');
}

function checkScreen() {
	var narrow    = (screen.width < MINWIDTH);
	var fewColors = (screen.colorDepth < MINCOLORS);

	if (narrow||fewColors) {
		document.write('<ul class="galleries">');
	}
	if (narrow) {
	   document.write('<li class="errmsg"><b>Warning:</b> for viewing this web site your screen should be at least ' +
	                  MINWIDTH + ' pixels wide.  Your actual screen resolution is ' + screen.width + 'x' + screen.height +
	                  '.  We recommend that you increase the resolution to at least ' +
	                  '800x600 using the Display control panel (or Monitors control panel on a Macintosh).</li>');
	}
	if (fewColors) {
	   if (narrow) document.write('<p>');
	   document.write('<li class="errmsg"><b>Warning:</b> for viewing this web site your color depth should be at least ' +
	                  MINCOLORS + ' bits per pixel but it is only ' + screen.colorDepth +
	                  ' bits.  We recommend that you increase the color depth (quality) of your screen to at least ' +
	                  MINCOLORS + ' bits (thousands of colors) using the Display control panel, Settings tab ' +
	                  '(or Monitors control panel on a Macintosh).</li>');
	}
	if (narrow||fewColors) {
		document.writeln('</ul>');
	}
}
// </script>