// <!- RandomTypeFace Javascript source

/* This script, if placed above the <body> tag, will randomly set the type face.
     R Scott  9-Jul-2003
 */
 
var FontCount = 11;
var RndFont;
//               alert("Start");

function WeightedRandom()
  {
	var FC = FontCount - 1;	
	// Weight each number, 0 thru 10.
	var Weight = new Array(FontCount)
		Weight[0] = 8
		Weight[1] = 5
		Weight[2] = 3
		Weight[3] = 5
		Weight[4] = 3
		Weight[5] = 3
		Weight[6] = 5
		Weight[7] = 5
		Weight[8] = 5
		Weight[9] = 2
		Weight[10] = 5
		
	// Add up the weights.
		var TotalWeight = 0
		for(Loop1=0 ; Loop1<FontCount; Loop1++) TotalWeight = TotalWeight + Weight[Loop1];
		
	// Choose a random number between 1 and the total weight.
		var RandNum=Math.floor(Math.random()* TotalWeight);
			
		
	// Figure out which value this number corresponds to, using the weights.
		for(Loop2=0 ; Loop2<FontCount; Loop2++) 
		{
		  if (Weight[Loop2] > RandNum) return Loop2;
		  RandNum = RandNum - Weight[Loop2];
		  }
   }

	// Create array of fonts
	var TypeFace = new Array(FontCount)
 	TypeFace[0] = "Comic Sans MS"
	TypeFace[1] = "dauphin"
	TypeFace[2] = "Cooper Black"
	TypeFace[3] = "bernhardfashion bt"
 	TypeFace[4] = "harrington"
	TypeFace[5] = "goudy old style"
	TypeFace[6] = "lucida sans unicode"
	TypeFace[7] = "Arial Narrow"
 	TypeFace[8] = "avantgarde bk bt"
	TypeFace[9] = "Times New Roman"
	TypeFace[10] = "kabel bk bt"

 	TypeFace[0] = "Verdana"
 	TypeFace[1] = "Verdana"
 	TypeFace[2] = "Verdana"
 	TypeFace[3] = "Verdana"
 	TypeFace[4] = "Verdana"
 	TypeFace[5] = "Verdana"
 	TypeFace[6] = "Verdana"
 	TypeFace[7] = "Verdana"
 	TypeFace[8] = "Verdana"
 	TypeFace[9] = "Verdana"
 	TypeFace[10] = "Verdana"
	// Define RndFont for type face
	RndFont = TypeFace[WeightedRandom()]
	
     // Specify style for Headings and Text details
	 document.write('<style type="text/css">')
     document.write("P { font-family: '" + RndFont + "' }")
     document.write("TD { font-family: '" + RndFont + "' }")
     document.write('<\/style>')
     // document.write('Font ' + RndFont)

	//  End of RandomTypeFace Javascript source ->
