// --==--==--==--==--==--==--==--==--==--==--==--==--==--==--
//
//   Color Skins Javascript Copyright © 2001 cti | webdesign
//   coded by Daniel K. Bergey
//
// --==--==--==--==--==--==--==--==--==--==--==--==--==--==--

// --==--==--==--==--==--==--==--==--==--==--==--==--==--==--
// This scriptlet chooses a color based on what day it is,
// thereby keeping the same color all day long, and,
// more importantly, all throughout the site. (Except,
// of course, if the date changes while they are viewing
// it, in which case they should be asleep in bed anyway.)
// --==--==--==--==--==--==--==--==--==--==--==--==--==--==--
// To add a new color, create the files and add it's
// folder's name to the Array in the first line of the
// script. The second line contains the hex equivalents
// and MUST correspond exactly with the first line.
// --==--==--==--==--==--==--==--==--==--==--==--==--==--==--

var colorsArray = new Array('tan','yellow','teal','black','blue','strawberry','orange','forest','purple','gray');
var hexColorsArray = new Array('#CE9760','#CCCC33','#009966','##000453','#333366','#CC3333','#E53300','#006600','#6633FF','#BBBBBB');

var numOfColors = colorsArray.length;
var now = new Date();
whichColor = (now.getDate() / (numOfColors));
whichColor = Math.round((whichColor - Math.floor(whichColor)) * (numOfColors));
var colorName = (colorsArray[whichColor]);
var hexColorName = (hexColorsArray[whichColor]);


// --==--==--==--==--==--==--==--==--==--==--==--==--==--==--
// This scriptlet chooses a color randomly upon page loading.
// It is commented out because I want the user to have color
// continuity between pages.
// --==--==--==--==--==--==--==--==--==--==--==--==--==--==--

// var numOfColors = 6;
// numOfColors--;
// var colorsArray = new Array('tan','yellow','teal','black','purple','blue');
// whichColor = Math.round(Math.random() * numOfColors);
// var colorName = (colorsArray[whichColor]);


// --==--==--==--==--==--==--==--==--==--==--==--==--==--==--
// this function inserts var colorName into "xColorNameX" in
// the passed string and writes the result to the page.
// --==--==--==--==--==--==--==--==--==--==--==--==--==--==--

function insertColor(theHTML) {
splitText = theHTML.split("xColorNameX")
document.write(splitText[0])
document.write(colorName)
document.write(splitText[1])
}

// --==--==--==--==--==--==--==--==--==--==--==--==--==--==--
// This function inserts var hexColorName into the string
// passed to it and writes the result to the page.
// --==--==--==--==--==--==--==--==--==--==--==--==--==--==--

function insertHexColor(theHTML) {
splitText = theHTML.split("xHexColorX")
document.write(splitText[0])
document.write(hexColorName)
document.write(splitText[1])
}

// --==--==--==--==--==--==--==--==--==--==--==--==--==--==--
// these functions insert an appropriate <font color=> tag
// to correspond with the color skin of the website. The
// second function could be done with a simple </font> tag,
// but WYSIWYG editors like to see both sides of a tag
// or none at all. We go for the latter.
// --==--==--==--==--==--==--==--==--==--==--==--==--==--==--

function beginFontColor() {
document.write('<font color="')
document.write(hexColorName)
document.write('">')
}

function endFontColor() {
document.write("</font>")
}
