// 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] = "howto";
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] = "FanCrazy";
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>');	}
	 
if  (dirs[5] == "runelight")
    {DTG(2011,10,3);}
	 

// 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/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>';
}

function DTG(y,m0,d) {
Today = new Date();
Target = new Date(y, m0, d);
Diff = Math.abs(Target.getTime() - Today.getTime());
Days = Math.ceil(Diff/(1000*60*60*24));
document.write ('<p style="font-family:Verdana, Arial, Helvetica, sans-serif;margin:10px auto 10px auto;border:2px solid #800080;font-size:26px;text-align:center;width:140px;padding:10px;"><i>Runelight</i><br><span style="font-size:80px;font-weight:bold;color:#800000;">');
document.write (Days);
if  (Days == 1) {DD = "Day";} else {DD = "Days";}
document.write ('</span><br><span style="font-size:20px;">' + DD + ' To Go!</span></p>');
}

function DTG1(y,m0,d) {
Today = new Date();
Target = new Date(y, m0, d);
Diff = Math.abs(Target.getTime() - Today.getTime());
Days = Math.ceil(Diff/(1000*60*60*24));
document.write ('<div style="font-family:Verdana, Arial, Helvetica, sans-serif;margin:0px 0px 0px auto;border:2px solid #800080;text-align:center;width:120px;padding:5px;">');
document.write ('<p style="font-size:20px;padding:0px;margin:8px auto 0px auto;"><i>Runelight</i>');
document.write ('<p style="font-size:80px;font-weight:bold;color:#800000;padding:0px;margin:2px auto 6px auto;">');
document.write (Days);
if  (Days == 1) {DD = "Day";} else {DD = "Days";}
document.write ('</p>');
document.write ('<p style="font-size:16px;color:#000000;font-weight:normal;padding:0px;margin:0px auto 5px auto;">' + DD + ' To Go!</p>');
document.write ('</div>');
}

function DTG2(y,m0,d) {
Today = new Date();
Target = new Date(y, m0, d);
Diff = Math.abs(Target.getTime() - Today.getTime());
Days = Math.ceil(Diff/(1000*60*60*24));
document.write ('<b>' + Days);
if  (Days == 1) {DD = " day to go!";} else {DD = " days to go!";}
document.write (DD + '</b>');
}

function DTG3(y,m0,d) {
Today = new Date();
Target = new Date(y, m0, d);
Diff = Math.abs(Target.getTime() - Today.getTime());
Days = Math.ceil(Diff/(1000*60*60*24));
document.write ('<div style="font-family:Verdana, Arial, Helvetica, sans-serif;margin:0px 0px 0px 0px;border:2px solid #800080;text-align:center;width:100px;padding:5px;background-color:#EEEEEE;">');
document.write ('<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:18px;color:#000000;padding:0px;margin:5px auto 0px auto;"><i>Runelight</i>');
document.write ('<p style="font-size:56px;font-weight:bold;color:#800000;padding:0px;margin:1px auto 3px auto;">');
document.write (Days);
if  (Days == 1) {DD = "Day";} else {DD = "Days";}
document.write ('</p>');
document.write ('<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:14px;color:#000000;font-weight:normal;padding:0px;margin:0px auto 3px auto;">' + DD + ' To Go!</p>');
document.write ('</div>');
}


	


