// JavaScript Document

RibbonStack = new Array;
F = new Array;

SectionName = new Array;
SectionText = new Array;
SectionColour = new Array;
var I = 0;
SectionName[I] = "..";
SectionText[I] = "Home";
SectionColour[I] = "#0000CC";
I++;
SectionName[I] = "books";
SectionText[I] = "Books";
SectionColour[I] = "#0000CC";
I++;
SectionName[I] = "news";
SectionText[I] = "News";
SectionColour[I] = "#0000CC";
I++;
SectionName[I] = "events";
SectionText[I] = "Events";
SectionColour[I] = "#0000CC";
I++;
SectionName[I] = "faq";
SectionText[I] = "FAQs";
SectionColour[I] = "#0000CC";
I++;
SectionName[I] = "qaf";
SectionText[I] = "QAFs";
SectionColour[I] = "#0000CC";
I++;
SectionName[I] = "about";
SectionText[I] = "About";
SectionColour[I] = "#0000CC";
I++;
SectionName[I] = "stories";
SectionText[I] = "Stories";
SectionColour[I] = "#0000CC";
I++;
SectionName[I] = "articles";
SectionText[I] = "Articles and Interviews";
SectionColour[I] = "#0000CC";
I++;
SectionName[I] = "coverart";
SectionText[I] = "Cover Art";
SectionColour[I] = "#0000CC";
I++;
SectionName[I] = "nab";
SectionText[I] = "How To ......";
SectionColour[I] = "#0000CC";
I++;
SectionName[I] = "sav";
SectionText[I] = "Sound and Vision";
SectionColour[I] = "#0000CC";
I++;
SectionName[I] = "gallery";
SectionText[I] = "Gallery";
SectionColour[I] = "#0000CC";
I++;
SectionName[I] = "fans";
SectionText[I] = "FanArt &amp; FanFic";
SectionColour[I] = "#0000CC";
I++;
SectionName[I] = "links";
SectionText[I] = "Links";
SectionColour[I] = "#0000CC";
I++;
SectionName[I] = "contact";
SectionText[I] = "Contacts";
SectionColour[I] = "#0000CC";
I++;
SectionName[I] = "message";
SectionText[I] = "Message Board";
SectionColour[I] = "#0000CC";

var dirs=window.location.href.split('/');



function CreatePageHeading(PageCode) {
// Randomise the image ribbon	
var J = 0;
var IND = 0;
X = new Array();
if  (F.length < 1)
    {J = 15;}
while (J < 15)
      {IND = Math.floor(Math.random()*F.length);
	   if  (X[IND] != "1")
		   {RibbonStack[J] = F[IND];
			J++;
			X[IND] = "1";}}
			
// Level 1 was originally a transparent space along the top to contain the website name		
// document.write('<div class="ST-Level1Div"></div>');	

// Level 2 was originally the top row of the border frame. The background has been removed but the div left there as a spacer			
document.write('<div class="ST-Level2Div"></div>');	

document.write('<div class="ST-PageBorder">');	

// Level 3 is the ribbon of images
document.write('<div class="ST-Level3Div">');
document.write('<img src="/v3thumbnails/covers/' + RibbonStack[0] + '.jpg" width="54" height="81" style="border-bottom:1px solid #999999;">');
for (var i = 1; i < 15; i++)
    {document.write('<img src="/v3thumbnails/covers/' + RibbonStack[i] + '.jpg" width="54" height="81" style="border-bottom:1px solid #999999;">');}
document.write('</div>');

// Levele 4 is the main body of the page
document.write('<div class="ST-Level4Div">');

// This menu div lies within the main doby of the page, but is floated to the right
// It contains several divs ... this is an outer wrapper
document.write('<div class="ST-MenuPanelDiv">');

// This is the actual menu div
document.write('<div class="ST-MenuDiv">');
for (var i = 0; i < SectionName.length; i++)
    {if   (SectionName[i] == dirs[4])
	      {document.write('<p class="ST-MenuP"><a href="/v3site/' + SectionName[i] + '/index.html" class="ST-MenuAThis">' + SectionText[i] + '</a></p>');}
     else {if   (SectionName[i].match('http'))
	            {document.write('<p class="ST-MenuP"><a href="' + SectionName[i] + '" class="ST-MenuA" target="_blank" style="color:' + SectionColour[i] + '">' + SectionText[i] + '</a></p>');}
		   else {document.write('<p class="ST-MenuP"><a href="/v3site/' + SectionName[i] + '/index.html" class="ST-MenuA" style="color:' + SectionColour[i] + '">' + SectionText[i] + '</a></p>');}
  	      }
	}
document.write('</div>');
// End of actual menu div

// Special extra bit for Rune related pages which have the Rune generator on them
if  (dirs[5] == "runemarks")
    {document.write('<div style="margin:20px auto 0px auto;background-color:#000000;padding:10px 5px 2px 5px;" id="runeplace" onClick="Recast();">');	
     document.write('<div style="height:110px;"><script>');
     document.write('var X = RuneCast(5);');
     document.write('document.write(X);');
     document.write('</script>');
     document.write('</div><p style="font-size:12px;color:#FFFFFF;">click to recast the runes</p>');
     document.write('</div>');	}

// End of outer wrappper for menu div
document.write('</div>');	

// End of function ... note that the main body div (level 4) is still open
}

// Separate version of the menu for the home page only
function CreateMenu() {
document.write('<div class="ST-MenuDiv">');
for (var i = 0; i < SectionName.length; i++)
    {if   (SectionName[i] == dirs[4])
	      {document.write('<p class="ST-MenuP"><a href="/v3site/' + SectionName[i] + '/index.html" class="ST-MenuAThis">' + SectionText[i] + '</a></p>');}
     else {if   (SectionName[i].match('http'))
	            {document.write('<p class="ST-MenuP"><a href="' + SectionName[i] + '" class="ST-MenuA" target="_blank" style="color:' + SectionColour[i] + '">' + SectionText[i] + '</a></p>');}
		   else {document.write('<p class="ST-MenuP"><a href="/v3site/' + SectionName[i] + '/index.html" class="ST-MenuA" style="color:' + SectionColour[i] + '">' + SectionText[i] + '</a></p>');}
  	      }
	}
document.write('</div>');
}

function CreatePageFooter() {
// First we close off level 4
document.write('</div>');	
document.write('</div>');	


// Level 5 is simply a page footer
document.write('<div class="ST-Level5Div"></div>');	

// This is just a filler to ensure the page exceeds the height of the screen, forcing a right side scroll bar on every page
document.write('<div style="height:200px;">&nbsp;</div>');	
}

function RuneCast(counter) {
var CAST = '';	
N=new Array;
R=new Array;
U=new Array;
R[0] = 'Fehu'; N[0] = '01';
R[1] = 'Uruz'; N[1] = '02';
R[2] = 'Thorn'; N[2] = '03';
R[3] = 'Os'; N[3] = '04';
R[4] = 'Rad'; N[4] = '05';
R[5] = 'Ken'; N[5] = '06';
R[6] = 'Gyfu'; N[6] = '07';
R[7] = 'Wyn'; N[7] = '08';
R[8] = 'Hagall'; N[8] = '09';
R[9] = 'Nyd'; N[9] = '10';
R[10] = 'Ice'; N[10] = '11';
R[11] = 'Ger'; N[11] = '12';
R[12] = 'Ehwaz'; N[12] = '13';
R[13] = 'Eoh'; N[13] = '14';
R[14] = 'Peord'; N[14] = '15';
R[15] = 'Sigel'; N[15] = '16';
R[16] = 'Tyr'; N[16] = '17';
R[17] = 'Beorc'; N[17] = '18';
R[18] = 'Eh'; N[18] = '19';
R[19] = 'Man'; N[19] = '20';
R[20] = 'Laguz'; N[20] = '21';
R[21] = 'Ing'; N[21] = '22';
R[22] = 'Daeg'; N[22] = '23';
R[23] = 'Ethel'; N[23] = '24';
var K = 0;
while (K < counter)
      {J = Math.ceil(24*Math.random()) -1;
	   if  (U[J] != 1)
	       {CAST = CAST + '<img src="runemarks_runes/runemarks_runes_' + N[J] + '_' + R[J] + 'X.jpg" alt="' + R[J] + '" title="' + R[J] + '">';
	        K++;
			U[J]=1;}}
return CAST;			
}

function Recast() {
var X = RuneCast(5);
document.getElementById('runeplace').innerHTML = '<div style="height:110px;">' + X + '</div><p style="font-size:12px;color:#FFFFFF;">click to recast the runes</p>';
}

	

