
// mainTop.js. Top of each page
//---------------------------------------------------------------------------------------
function getDirectory()
// Return the name of the directory holding this page.
//---------------------------------------------------------------------------------------
{
	// From the file (page.htm),
	// get the href (.../path/to/buntport.com/.../page.htm)
	// and return the directory name just left of page.htm

	// First, find out where the directory ends
	var endSlash = location.href.lastIndexOf( '/' );
	// Get the substring of href up to the last slash (not including)
	var subHref = location.href.substring( 0, endSlash );
	// Get the position of the last slash in that string, which is now the last slash in it
	var startingSlash = subHref.lastIndexOf( '/' );
	// Increment that position by 1 and get the substring
	var theDirectory = subHref.substring(++startingSlash,endSlash );

	return theDirectory;

} // function getDirectory()

//---------------------------------------------------------------------------------------
function setPublicPath()
// Return the relative path to the top directory public_html/buntport.com
//---------------------------------------------------------------------------------------
{

	var thePath = '../';
	if ( getDirectory() == 'buntport.com' ) {
		thePath = './';
	}

	return thePath;

} // function setPublicPath()

var publicPath = setPublicPath();

//---------------------------------------------------------------------------------------
function goDonate()
// Return the relative path to the top directory public_html/buntport.com
//---------------------------------------------------------------------------------------
{

	var donatePath = publicPath + 'donate/donate.htm'
	document.location.href = donatePath;

} // function goDonate()



// Top layer: Logo with Search PHP under it, Quotes, and Image Slideshow

document.write( '<table align="left" border=0 cellspacing=0 cellpadding=0 width="100%">' + "\n" );
document.write( '<tr align="left" valign="middle">' + "\n" );

document.write( '<td>' + "\n" );
document.write( '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"' + "\n" );
document.write( 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0"' + "\n" );
document.write( 'width="400" height="200" id="BuntportLogoMainPage" align="middle">' + "\n" );
document.write( '<param name="allowScriptAccess" value="sameDomain" />' + "\n" );
document.write( '<param name="allowFullScreen" value="false" />' + "\n" );
document.write( '<param name="movie" value="' + publicPath + 'Swf/BuntportLogoMainPage.swf" />' + "\n" );
document.write( '<param name="quality" value="high" />' + "\n" );
document.write( '<param name="bgcolor" value="#666666" />' + "\n" );
document.write( '<param name="FlashVars" value="publicPath=' + publicPath + '">' + "\n" );
document.write( '<embed src="' + publicPath + 'Swf/BuntportLogoMainPage.swf" quality="high" bgcolor="#666666"' + "\n" );
document.write( 'width="400" height="200" name="BuntportLogoMainPage" align="middle"' + "\n" );
document.write( 'allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash"' + "\n" );
document.write( 'pluginspage="http://www.adobe.com/go/getflashplayer"' + "\n" );
document.write( 'FlashVars="publicPath=' + publicPath + '"' + "\n" );
document.write( '/>' + "\n" );
document.write( '</object>' + "\n" );

// Search form
document.write( '<form method=POST action="' + publicPath + 'Php/Search.php">' + "\n" );
document.write( '<input type="hidden" name="publicPath" value="' + publicPath + '">' );
document.write( '&nbsp;&nbsp;<input type=text name="searchString" size=25>&nbsp;<input type=submit value="Search">' + "\n" );
document.write( '&nbsp;&nbsp;<input type=button value="Donate" ONCLICK="goDonate()">' + "\n" );
document.write( '</form>' + "\n" );


document.write( '</td>' + "\n" );

document.write( '<td>' + "\n" );
document.write( '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"' + "\n" );
document.write( 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0"' + "\n" );
document.write( 'width="280" height="200" id="buntportQuotes" align="middle">' + "\n" );
document.write( '<param name="allowScriptAccess" value="sameDomain" />' + "\n" );
document.write( '<param name="allowFullScreen" value="false" />' + "\n" );
document.write( '<param name="movie" value="' + publicPath + 'Swf/buntportQuotes.swf" />' + "\n" );
document.write( '<param name="quality" value="high" />' + "\n" );
document.write( '<param name="bgcolor" value="#666666" />' + "\n" );
document.write( '<embed src="' + publicPath + 'Swf/buntportQuotes.swf" quality="high" bgcolor="#666666"' + "\n" );
document.write( 'width="280" height="200" name="buntportQuotes" align="middle"' + "\n" );
document.write( 'allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash"' + "\n" );
document.write( 'pluginspage="http://www.adobe.com/go/getflashplayer" />' + "\n" );
document.write( '</object>' + "\n" );
document.write( '</td>' + "\n" );

document.write( '<td>&nbsp;</td>' + "\n" );

document.write( '<td>' + "\n" );
document.write( '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"' + "\n" );
document.write( 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0"' + "\n" );
document.write( 'width="170" height="200" id="buntportImages" align="middle">' + "\n" );
document.write( '<param name="allowScriptAccess" value="sameDomain" />' + "\n" );
document.write( '<param name="allowFullScreen" value="false" />' + "\n" );
document.write( '<param name="movie" value="' + publicPath + 'Swf/buntportImages.swf" />' + "\n" );
document.write( '<param name="quality" value="high" />' + "\n" );
document.write( '<param name="bgcolor" value="#666666" />' + "\n" );
document.write( '<param name="FlashVars" value="publicPath=' + publicPath + '">' + "\n" );
document.write( '<embed src="' + publicPath + 'Swf/buntportImages.swf" quality="high" bgcolor="#666666"' + "\n" );
document.write( 'width="170" height="200"' + "\n" );
document.write( 'name="buntportImages" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false"' + "\n" );
document.write( 'type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer"' + "\n" );
document.write( 'FlashVars="publicPath=' + publicPath + '"' + "\n" );
document.write( '/>' + "\n" );
document.write( '</object>' + "\n" );
document.write( '</td>' + "\n" );

document.write( '</tr>' + "\n" );
document.write( '</table>' + "\n" );


