// JavaScript Document
// Updated 8/23/2008 by Bob Dupre
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_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];}
}

function MM_displayStatusMsg(msgStr) { //v1.0
  status=msgStr;
  document.MM_returnValue = true;
}

function MM_openBrWindow(theURL,winName,features, myWidth, myHeight, isCenter) { //v3.0
  if(window.screen)if(isCenter)if(isCenter=="true"){
    var myLeft = (screen.width-myWidth)/2;
    var myTop = (screen.height-myHeight)/2;
    features+=(features!='')?',':'';
    features+=',left='+myLeft+',top='+myTop;
  }
  window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

MM_reloadPage(true);

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 formWindow(theURL, winName, myWidth, myHeight) { //v2.0
	MM_openBrWindow(theURL,winName,'toolbar=yes,menubar=no,resizable=yes,scrollbars=yes', myWidth, myHeight, 'true');
}

function windsRblowing(d, a, e, b, f, c){
	var w,z,y,z
	w='lto:'; w='mai'+w; w='<a href=\"'+w;
	x=d+e+'.'+f; x='@'+x; x=a+b+c+x
	y='\">'
	z='</a>'
	document.write(w+x+y+x+z);
}

function noBarWindow(theURL, winName, myWidth, myHeight) { //v2.0
	MM_openBrWindow(theURL,winName,'toolbar=no,menubar=no,resizable=yes', myWidth, myHeight, 'true');
}

function imageWindow(theURL) { //v2.0
	noBarWindow(theURL,'imgWin', '610', '510');
}

function lrgWindow(theURL) { //v2.0
	noBarWindow(theURL,'lrgWin', '800', '650');
	self.close();
}

function medWindow(theURL) { //v2.0
	imageWindow(theURL);
	self.close();
}

function displayLarger(newLoc) { //v2.0
	document.writeln(' larger image');
	document.write(' <a href="#" onclick="javascript:lrgWindow(' + "'" + newLoc + "'" + ')" onMouseOut="MM_swapImgRestore();MM_displayStatusMsg(' + "''" + ')"');
	document.write(' onMouseOver="MM_swapImage(' + "'" + 'top_up_butn' + "','','" + 'butns/hdr_up_on.gif' + "'" + ',1);');
	document.writeln('MM_displayStatusMsg(' + "'" + 'View larger image' + "'" + ');return document.MM_returnValue" onFocus="this.blur()">');
	document.writeln(' <img name="top_up_butn" src="butns/hdr_up_off.gif" width="12" height="15" border="0" align="absmiddle"></a>');
}

function displaySmaller(newLoc) { //v2.0
	document.writeln('smaller image');
	document.write(' <a href="#" onclick="javascript:medWindow(' + "'" + newLoc + "'" + ')" onMouseOut="MM_swapImgRestore();MM_displayStatusMsg(' + "''" + ')"');
	document.write(' onMouseOver="MM_swapImage(' + "'" + 'top_down_butn' + "','','" + 'butns/hdr_down_on.gif' + "'" + ',1);');
	document.writeln('MM_displayStatusMsg(' + "'" + 'View smaller image' + "'" + ');return document.MM_returnValue" onFocus="this.blur()">');
	document.writeln(' <img name="top_down_butn" src="butns/hdr_down_off.gif" width="12" height="15" border="0" align="absmiddle"></a>');
}

function displayPrevious(newLoc) { //v2.0
	if( newLoc.length==0 ) {
		document.write(' <img src="butns/butn_prev_gray.gif" width="12" height="15" border="0" align="absmiddle">');
	} 
	else {
		if( newLoc=='space' ) {
			document.write(' <img src="butns/butn_spacer.gif" width="12" height="15" border="0" align="absmiddle">');
		}
		else {
			document.write(' <a href="' + newLoc + '" onMouseOut="MM_swapImgRestore();MM_displayStatusMsg(' + "''" + ')"');
			document.write(' onMouseOver="MM_swapImage(' + "'prev_butn','','butns/butn_prev_on.gif',1);MM_displayStatusMsg('Go to the previous page');return document.MM_returnValue" + '" onFocus="this.blur()">');
			document.write(' <img name="prev_butn" src="butns/butn_prev_off.gif" width="12" height="15" border="0" align="absmiddle"></a>');
		}
	}
}

function displayNext(newLoc) { //v2.0
	if( newLoc.length==0 ) {
		document.write(' <img src="butns/butn_next_gray.gif" width="12" height="15" border="0" align="absmiddle">');
	}
	else {
		if( newLoc=='space' ) {
			document.write(' <img src="butns/butn_spacer.gif" width="12" height="15" border="0" align="absmiddle">');
		}
		else {
			document.write(' <a href="' + newLoc + '" onMouseOut="MM_swapImgRestore();MM_displayStatusMsg(' + "''" + ')"');
			document.write(' onMouseOver="MM_swapImage(' + "'top_next_butn','','butns/butn_next_on.gif',1);MM_displayStatusMsg('Go to the next page');return document.MM_returnValue" + '" onFocus="this.blur()">');
			document.write(' <img name="top_next_butn" src="butns/butn_next_off.gif" width="12" height="15" border="0" align="absmiddle"></a>');
		}
	}
}

function displayFirst(newLoc) { //v2.0
	if( newLoc.length==0 ) {
		document.write(' <img src="butns/butn_first_gray.gif" width="14" height="15" border="0" align="absmiddle">');
	}
	else {
		if( newLoc=='space' ) {
			document.write(' <img src="butns/butn_spacer.gif" width="12" height="15" border="0" align="absmiddle">');
		}
		else {
			document.write(' <a href="' + newLoc + '" onMouseOut="MM_swapImgRestore();MM_displayStatusMsg(' + "''" + ')"');
			document.write(' onMouseOver="MM_swapImage(' + "'first_butn','','butns/butn_first_on.gif',1);MM_displayStatusMsg('Go to the first page');return document.MM_returnValue" + '" onFocus="this.blur()">');
			document.write(' <img name="first_butn" src="butns/butn_first_off.gif" width="14" height="15" border="0" align="absmiddle"></a>');
		}
	}
}

function displayLast(newLoc) { //v2.0
	if( newLoc.length==0 ) {
		document.write(' <img src="butns/butn_last_gray.gif" width="14" height="15" border="0" align="absmiddle">');
	}
	else {
		if( newLoc=='space' ) {
			document.write(' <img src="butns/butn_spacer.gif" width="12" height="15" border="0" align="absmiddle">');
		}
		else {
			document.write(' <a href="' + newLoc + '" onMouseOut="MM_swapImgRestore();MM_displayStatusMsg(' + "''" + ')"');
			document.write(' onMouseOver="MM_swapImage(' + "'last_butn','','butns/butn_last_on.gif',1);MM_displayStatusMsg('Go to the last page');return document.MM_returnValue" + '" onFocus="this.blur()">');
			document.write(' <img name="last_butn" src="butns/butn_last_off.gif" width="14" height="15" border="0" align="absmiddle"></a>');
		}
	}
}

function displayImage(winTitle, imgName, imgWidth, imgHeight, iSpace, imgAuthor, imgSize, newLoc, imgCaption, prevLoc, nextLoc) { //v2.0
	document.writeln('<table cellpadding="0" cellspacing="3" align="center" width="100%" class="header">');
	document.writeln('  <tr>');
	document.writeln('    <td align="left" valign="top" width="33%">');
	if ( imgSize=='L' ) { displaySmaller(newLoc); } else { displayLarger(newLoc); }
	document.writeln('  <td><img src="buttons/hdr_spacer.gif" width="1" height="' + iSpace + '" border="0"></td>');
	document.writeln('    <td align="center" width="34%">');
	document.writeln('      <strong>' + winTitle + '</strong>');
	document.writeln('    </td>');
	document.writeln('    <td align="right" valign="top" width="33%">');
	if ( prevLoc=='0' ) { document.write('&nbsp;'); } else { displayPrevious(prevLoc); }
	document.write('&nbsp;<a href="index')
	if ( imgSize=='L' ) { document.write('L'); }
	document.write('.htm">top</a>')
	if ( nextLoc=='0' ) { document.write('&nbsp;'); } else { displayNext(nextLoc); }
	document.writeln('    </td>');
	document.writeln('  </tr>');
	document.writeln('</table>');
	document.writeln('<table cellpadding="0" cellspacing="0" align="center" width="100%" class="header">');
	document.writeln('  <tr>');
	document.writeln('    <td width="100%" align="center" valign="top">');
	document.writeln('      <img src="images/' + imgName + '" width="' + imgWidth + '" height="' + imgHeight + '" border="0" align="absmiddle"><br>');
	document.writeln('    </td>');
	document.writeln('  </tr>');
	document.writeln('  <tr>');
	document.writeln('    <td align="right" valign="top"><font size="-1"> ' + imgAuthor + '</font></td>');
	document.writeln('  </tr>');
	document.writeln('  <tr>');
	document.writeln('    <td align="center">');
	document.writeln('      <strong>' + imgCaption + '</strong>&nbsp;&nbsp;');
	document.writeln('    </td>');
	document.writeln('  </tr>');
	document.writeln('</table>');
}

function numFile(num,suffix) { //v2.0
	var strNum = new String;
	strNum = '000' + num;
	strNum = 'image' + strNum.substring(strNum.length-2,strNum.length) + suffix + '.htm';
	return strNum;
}

function suffixFile(fileName,suffix) { //v2.0
	var strName = new String;
	var len, locDot;
	strName = fileName;
	len = strName.length;
	locDot = strName.lastIndexOf('.');
	strName = strName.substring(0,locDot) + suffix + strName.substring(locDot,len);
	return strName;
}

function displayImageNum(winTitle, imgNum, imgName, imgWidth, imgHeight, imgAuthor, imgSize, imgCaption, prevLoc, nextLoc) { //v2.0
	var wTitle = winTitle;
	var iName = suffixFile(imgName,imgSize);
	var newSize = '';
	var newPage = '';
	var iWidth  = imgWidth;
	var iHeight = imgHeight;
	var iSpace  = 5;
	var prevPage = prevLoc;
	var nextPage = nextLoc;
	if (imgSize == 'M') {
		newSize = 'L';
		if ( imgWidth == 0 ) iWidth = 570;
		if ( imgHeight == 0 ) iHeight = 407;
		iSpace  = (460 - iHeight)/2;
	}
	else  {
		newSize = 'M';
		if ( imgWidth == 0 ) iWidth = 760;
		if ( imgHeight == 0 ) iHeight = 543;
		iSpace  = (600 - iHeight)/2;
	}
	newPage = numFile(imgNum,newSize);
	if ( prevPage == '' ) prevPage = numFile(imgNum-1,imgSize);
	if ( nextPage == '' ) nextPage = numFile(imgNum+1,imgSize);
	displayImage(wTitle, iName, iWidth, iHeight, iSpace, imgAuthor, imgSize, newPage, imgCaption, prevPage, nextPage);
}

