// *************************************************************************************
// Horizontal Links Navigation Javascript
// Usage: In the head of your document put this script. (you knew that, right?)
//        In the body of your document put: <SCRIPT Language="JavaScript">HNav()</script>
//      * Change the BaseURL1 to your base URL.
//      * Though not necessary, if using a betatest site or two hosts or any form of second host,
//        change the BaseURL2 to that URL. BaseURL2 can be left blank.
//      * This script draws on your folder names... good names = good navigation. Bad names = bad navigation.
//      * In lieu of spaces in folder names, you can use the underscore character.
//      * the var 'IndexFile' is used if you want to use something other than 'index.htm' in your folder
//        structure. For example, I like 'Home.htm'. If you do use index.htm or index.html (or whatever your
//        server automatically dishes up), blank out IndexFile to ''.
//
// Version: 0.92
// Date: 30JAN2003
// Author: Eric Zander (eric_zander@yahoo.com)
//
// NOTE: This script is free... please send me an email letting me know you're using it and what you think.
//
// *************************************************************************************
//
// The value of HTMLString2 has been replaced from > (greater than sign) to » (double greater than
// sign). In production, change BaseURL1 to its domain and BaseURL2 to empty. -hcs 12/4/2003
//
// The statement: LinkURL = LinkURLSpacer + DocURLSplit[i] + '/'+ IndexFile
// has been replaced by statement: LinkURL = LinkURLSpacer + DocURLSplit[i] + '/'+ DocURLSplit[i] + ".htm"
// so that html files will not be all home.htm but will name as whatever folder it is under. -hcs 12/5/2003

function HNav() {

// though all variables are here, the only three you'll need to worry about are the first 3,
// HTMLString1, and HTMLString2.
// BaseURL1 and BaseURL2 are explained above. You can change the look of your navigation text by
// modifying HTMLString1. HTMLString2 is the character used as a seperator.

var BaseURL1 = "fa.ucf.edu/"
var BaseURL2 = ""
var IndexFile = "home.cfm"

var DocURLRef = document.URL
var DocURL = DocURLRef
var DocURLSplit = ''

var HomeURL = ''
var TextURL = ''
var LinkURL = ''
var LinkURLSpacer = ''
var HTMLString = ''
var HTMLString1 = '<table width="95%" border="0" cellspacing="0" bgcolor="#ffffff" cellpadding="1"><tr><td><table width="100%" border="0" cellspacing="0" bgcolor="#ffffff" cellpadding="2"><tr><td><font color="#666666" size="1" face="Verdana, Arial, Helvetica, sans-serif">  '
var HTMLString2 = ' > '
var HTMLString3 = '</div></td><td align="right"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"></div></td></tr></table></td></tr></table>'

// Check for which URL is used. BaseURL1 is the default.

if (BaseURL1 || BaseURL2 !='') {
	if (DocURL.search(BaseURL1)!= -1){
		DocURL=DocURL.slice(DocURL.indexOf(BaseURL1) + BaseURL1.length)
		HomeURL = DocURLRef.slice(0, DocURLRef.indexOf(BaseURL1) + BaseURL1.length) + 'home.cfm'
		}
	if (DocURL.search(BaseURL2)!= -1 && BaseURL2 !='') {
		DocURL=DocURL.slice(DocURL.indexOf(BaseURL2) + BaseURL2.length)
		HomeURL = DocURLRef.slice(0, DocURLRef.indexOf(BaseURL2) + BaseURL2.length) + 'home.cfm'
		}
	}


// split your string into an array. Each folder will get it's own array value

DocURLSplit = DocURL.split('/')

// build the relative paths

for (var i=0; i<(DocURLSplit.length-1); i++) {
	LinkURLSpacer+='../'
	}

// build the actual string from right to left (reverse of how you'd read it) using relative links.

for (var i=0; i<(DocURLSplit.length-1); i++) {
	LinkURL = LinkURLSpacer + DocURLSplit[i] + '/'+ DocURLSplit[i] + ".cfm"
	TextURL = DocURLSplit[i].replace(/_/g, " ")
	
	//------------------
	// I inserted the ff codes to make each word or folder name uppercase - hcs 12/8/03
	TextURL = TextURL.substring(0,1).toUpperCase() + TextURL.substring(1,TextURL.length);
	spacepos = 0;
	while (TextURL.indexOf(" ",spacepos+1) != -1) {
		spacepos = TextURL.indexOf(" ", spacepos+1);
		beforechg = " " + TextURL.substr(spacepos+1,1);
		afterchg = " " + TextURL.substr(spacepos+1,1).toUpperCase();
		TextURL = TextURL.replace(beforechg, afterchg);
	}
	//------------------
	
	// I inserted the ff to convert ' N ' to amphersand and the word ' And' to small ' and ' - hcs 6/8/04
	TextURL = TextURL.replace(" N "," &amp; ")
	TextURL = TextURL.replace(" And "," and ")	

	if(i==(DocURLSplit.length-2)){ // the far right folder is not a link.
		HTMLString += HTMLString2 + TextURL
		LinkURLSpacer = LinkURLSpacer.slice(0,-3)
	}
	else{ // but every other folder is. Slightly modified by hcs 2/20/04
		HTMLString += HTMLString2 + '<a href="' + LinkURL + '" class="bcrumbs" target="_parent">'+TextURL+'</a>'
		LinkURLSpacer = LinkURLSpacer.slice(0,-3)
	}
}

// now add the home link and output it to your HTML document.
// The code below was slightly modified so that the Home link will not show up on the homepage and
// will display the word Welcome instead. - hcs 12/8/03
// The code again was modified to handle CSS. - hcs 2/20/04
if(HTMLString != "") {
	HomeString = '<a href="' + HomeURL + '" class="bcrumbs" target="_parent">Home</a>'
	HTMLString = HTMLString1.concat(HomeString, HTMLString, HTMLString3)
	document.writeln(HTMLString)  }
else document.writeln("Welcome !!!")

}


