/* main.js */

/**************************
**** All Color Values *****
****** Author: lbar *******
***************************/

// hexadecimal values a-f
var a = 10;
var b = 11;
var c = 12;
var d = 13;
var e = 14;
var f = 15;


// other variables
var maxNumOfColors = 16777216; // 16 to the 6th power
var decimalNum = 0;
var hexNum = 0;
var num = 5000;


// loops through colors, starting from 0 and ending at 16777216
function loopThroughColors() {
        var i = 0;
        alert('Loading colors...');
        while (i < maxNumOfColors) {
        	for (var j = num - 5000; j < num; j++) {	
			convertToHex(j);
			convertToRGB();
			changeBackgroundColor();
        	}
		var confirmBox = confirm(num + ' colors so far! Continue?');
		if (confirmBox == true) {
			num += 5000;
		} else {
			i = maxNumOfColors;
		}
        }
	allDone(num);
}


// converts a decimal number to a hexadecimal number
function convertToHex(decimalNum) {
	hexNum = decimalNum.toString(16).toUpperCase();
	return hexNum;
}


// converts a hexadecimal number to RGB format
function convertToRGB() {
	var zeroes = "";

	if (hexNum.length < 6) {
		var blankDigits = 6 - hexNum.length;
		for (var i = 0; i < blankDigits; i++) {
			zeroes += "0";
		}
		hexNum = zeroes + hexNum;
	} 
        document.write("\n" + hexNum);
}


// changes the background color of the screen
function changeBackgroundColor() {
	document.bgColor = hexNum;
}


// end of script
function allDone(num) {
	document.write("<p align='center'>A whopping output here of " + num + " color values!</p>");
	document.write("<p align='center'><input type='button' value='Quit' onclick='location.href=\"http://celtruler.com/\"'></p>");
	alert('Done. You may need to click Back on your browser to see the final output of color values.');
}


// skips to final output of values
function skipToEnd() {
        for (var j = maxNumOfColors - 5000; j < maxNumOfColors; j++) {	
		convertToHex(j);
		convertToRGB();
		changeBackgroundColor();
        }
	alert('Showing last 5000 of ' + maxNumOfColors + ' total color values!');
	allDone(num);
}






/**
*** Parse XML Doc - part 1
**/

// basic function for loading an XML file
function loadXML(file) {
 try {
 // firefox, mozilla, opera, IE7/8 etc...     
 var req = new XMLHttpRequest();
 req.open("GET", file, false);
 req.send(null);
 return req.responseXML;
 }
 catch (e) {
 try {
 // internet explorer 4/5/6
 var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
 xmlDoc.async = false;
 xmlDoc.load(file);
 return xmlDoc;
 }
 catch (e) {
 alert(e.message);
 return null;
 }
 }
} 









/**
*** Generated Table
**/

var row;
var numOfRows = 10;
var tableBuilt = false;

function buildTable() {    

 if (tableBuilt) {
  return;
 }
 // write out the table and table header tags
 document.write("<table align='center' border='0'><tr><th style='color:#FFF;'>Some Random Data</th></tr>");

 // make a loop to fill table rows with data
 for (var x = 0; x < numOfRows; x++) {

 // the id's of the table row and span tags
 var span = "randomNum_" + x;
 row = "row_" + x;

 // write out the rows
 document.write("<tr style='background-color:white;' id='" + row + "'  onmouseover='changeRowColor(" + x + ")' onmouseout='changeRowColor(" + x + ")'><td align='center'><span id='" + span + "'></span></td></tr>");

 // make some random number data to put in the rows
 randomNum = Math.floor(Math.random() * 1000000);
 document.getElementById(span).innerHTML = randomNum; 

 }

 document.write("</table>");
 tableBuilt = true;
}

function changeRowColor(rowNum) {

 row = "row_" + rowNum; // example: row_7

 if (document.getElementById(row).style.backgroundColor != "gray") {
 document.getElementById(row).style.backgroundColor = "gray";
 } else {
 document.getElementById(row).style.backgroundColor = "white"; // default color
 }

}







/**
*** Scramble Text
**/

var text = "";

function scrambleText(element) {

	var elementName = element.id;

	text = document.getElementById(elementName).innerHTML;
	var elementNameLength = text.length;

	var codeArr = new Array();
	for (var x = 0; x < elementNameLength; x++) {
		codeArr[x] = document.getElementById(elementName).innerHTML.substr(x,1);
	}

	var randomNum;
	var listArr = new Array();

        for (x = 0; x < elementNameLength; x++) {
		randomNum = Math.floor(Math.random() * codeArr.length); 
		listArr[x] = codeArr.splice(randomNum,1);
		if (listArr[x] == " ") {
			listArr[x] = "&#160;"; // prevents blank member
		}
    	}

	var val = "";
  	for (x in listArr) {
		val += listArr[x];
	}

	document.getElementById(elementName).innerHTML = val;
}

function normalizeText(element) {

	var elementName = element.id;
	document.getElementById(elementName).innerHTML = text;
}


function fortune() {

	var randNum = Math.floor(Math.random() * 50); 

	if (randNum == 0) {
		document.getElementById("mystery").innerHTML = "Someday you will win a million bucks ";
	} else if (randNum == 1) {
		document.getElementById("mystery").innerHTML = "You will greatly enjoy the next meal ";
	} else if (randNum == 2) {
		document.getElementById("mystery").innerHTML = "There is nothing wrong with this code";
	}

}






/**
*** next functions change some text color to random colors
**/

var timer = "";
var randCol = "";
var isColorChanging = false;
var colorizedText = "CeltRuler.com";
var textColorChange = "";
var colorCounter = 1;

function doRandomColorFunctions() {

    for (var i = 1; i < colorizedText.length + 1; i++) {
        textColorChange = "textColorChange" + i;
	document.getElementById(textColorChange).style.color = "#FFF";
        if (colorCounter == 1) {
            isColorChanging = true;
            turnRandomColor(i);
        } else {
            if (i == 1) {
                clearTimeout(timer);
                isColorChanging = false;
                colorCounter = 0;
            }        
        }
    }
    colorCounter++;
}

function turnRandomColor(value) {

    var val = value;
    if (isColorChanging == true) {
        switch (val) {
	    case 1:
	        timer = setTimeout("turnRandomColor(1)", 100); 
                break;		
            case 2:
                timer = setTimeout("turnRandomColor(2)", 150); 
	        break;
	    case 3:
                timer = setTimeout("turnRandomColor(3)", 200); 
	        break;
	    case 4:
                timer = setTimeout("turnRandomColor(4)", 250); 
	        break;
            case 5:
                timer = setTimeout("turnRandomColor(5)", 300); 
	        break;
            case 6:
                timer = setTimeout("turnRandomColor(6)", 350); 
	        break;
            case 7:
                timer = setTimeout("turnRandomColor(7)", 400); 
	        break;
            case 8:
                timer = setTimeout("turnRandomColor(8)", 450); 
	        break;
            case 9:
                timer = setTimeout("turnRandomColor(9)", 500); 
	        break;	
            case 10:
                timer = setTimeout("turnRandomColor(10)", 550); 
	        break;
            case 11:
                timer = setTimeout("turnRandomColor(11)", 600); 
	        break;
            case 12:
                timer = setTimeout("turnRandomColor(12)", 650); 
	        break;
            case 13:
                timer = setTimeout("turnRandomColor(13)", 700); 
	        break;
        }
	randCol = randomColorValue();
	textColorChange = "textColorChange" + val;
        document.getElementById(textColorChange).style.color = "#" + randCol; 
    }  
}

function randomColorValue() {

        // array to hold hexadecimal numbers
        var hexNum = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'];

        var digit = [5]; // array to hold 6 digits
        var randomColor = "";

        // loop through array 6 times, storing each digit's value in digit[i]
        for (var i = 0; i < 6; i++) {
            digit[i] = Math.floor(Math.random() * 16); 
            randomColor = randomColor + hexNum[digit[i]];  
        }  

        return randomColor;
}

/* printing words script */

var runScript = "true";
var outMsg = "";
var ii = 0;
var lineNo = 1;
var timerDM = null;
var msg = "";

function araVob() {}
var ScreenLine = new araVob();
ScreenLine[1]  = "CeltRuler.com";
	
var msgNum = 1;          // set to first message to display
var msgCnt = 1;          // set to number of last message "page" to display.
var typeSpeed = 200;     // the typing rate, in milliseconds. (Higher number is slower)
var pageLen = 1;         // set to page size, usually number of ROWS in TEXTAREA
var delay=typeSpeed;
var r = 0;
var cr = "\r\n"

msg = ScreenLine[1];

function DisplayMsg() {
  if (runScript == "true") { 
    if (msg.length <= ii || msg.charAt(ii) == "\f") {
        r = ii;
        ii = 0;
    }
    outMsg = outMsg + msg.charAt(ii);
    ii++;
    if (msg.charAt(ii) == "\f" || (lineNo == pageLen && ii== msg.length)) {
        delay = 4000; }
    else {
        if (msg.charAt(ii) == cr && msg != " " + cr) {
            delay = 2000;
        } else {
            delay = typeSpeed;
        }
    }
    document.getElementById("msgform").innerHTML = outMsg;
    if (outMsg.length < 13) {
        timerDM = setTimeout("DisplayMsg()",delay);
    } else {
        runScript = "false";
        setTimeout("shrinkLetters()", 500);
    }
  }
}

/* shrinks letters */

var fontSize = 30;

function shrinkLetters() {
     
    fontSize -= 1;

    if (fontSize < 0) { // a negative -1px fontSize in IE is a non-critical bug
        return; 
    }
    
    document.getElementById("msgform").style.fontSize = fontSize;
    if (fontSize == "0") {
        document.getElementById("msgform").style.visibility = "hidden";
        setTimeout("restoreHeaderSize()", 500);
    }

    setTimeout("shrinkLetters()", 50)        
}

var fontColor = "black";
var fontColorCounter = 1;

function changeHeaderColor() {

    fontColorCounter += 5;

    if (fontColor == "black") {
        fontColor = "white";
        document.getElementById("msgform").style.color = fontColor;
    } else if (fontColor == "white") {
        fontColor = "black";
        document.getElementById("msgform").style.color = fontColor;
    }

    if (fontColorCounter >= 150) {
        document.getElementById("msgform").style.color = "white";
        setTimeout("makeSubheaderVisible()", 500);
        return;   
    }

    setTimeout("changeHeaderColor()", fontColorCounter);     
}

function restoreHeaderSize() {
    document.getElementById("msgform").style.visibility = "visible";
    document.getElementById("msgform").style.fontSize = 30;
    //changeHeaderColor();
    setTimeout("makeSubheaderVisible()", 1000);
}

/* scrolling background */

var offset = 0;

function scrollBackground() {
    offset -= .5;   

    document.getElementById("mid").style.backgroundPosition = offset;
    
    if (offset <= -6356) {
        offset = 0;
    }
}

function makeSubheaderVisible() {
    document.getElementById("header2").style.visibility = "visible";
}

/* body onload function */

function doLoadingStuff() {
    document.getElementById('pageLoading').style.display = 'none';
    scrollBackground();
    DisplayMsg();
}

function doMenu(menuItem) {

    var menuID = menuItem.id.slice(8); 
    menuID = parseInt(menuID);
    
    switch(menuID) {
        case 1:
            document.getElementById('subMenu2').style.display='none';
            document.getElementById('subMenu3').style.display='none'; 
            document.getElementById('subMenu4').style.display='none';
            document.getElementById('subSubMenu2').style.display='none'; 
            document.getElementById('subSubMenu3').style.display='none';
            makeDiv(menuID);
            break;

        case 2:
            document.getElementById('subMenu2').style.display='';
            document.getElementById('subMenu3').style.display='none';
            document.getElementById('subMenu4').style.display='none';
            document.getElementById('subSubMenu2').style.display='none';
            document.getElementById('subSubMenu3').style.display='none';
            makeDiv(menuID);
            break; 

        case 3:
            document.getElementById('subMenu3').style.display='';
            document.getElementById('subMenu4').style.display='none';
            makeDiv(menuID);
            break;   

        case 4:
            document.getElementById('subMenu4').style.display='';
            makeDiv(menuID);
            break; 

        case 200:
            document.getElementById('subSubMenu2').style.display='';
            document.getElementById('subSubMenu3').style.display='none';
            makeDiv(menuID);
            break;  

        case 201:
            document.getElementById('subSubMenu3').style.display='';
            makeDiv(menuID);
            break;   

        case 300:
            document.getElementById('subMenu3').style.display='';
            makeDiv(3);
            break;  

        case 301:
            document.getElementById('subMenu3').style.display='';
            makeDiv(3);
            break;  

        case 302:
            document.getElementById('subMenu3').style.display='';
            makeDiv(3);
            break;  

        case 303:
            document.getElementById('subMenu3').style.display='';
            makeDiv(3);
            break; 

        case 400:
            document.getElementById('subMenu4').style.display='';
            makeDiv(4);
            break; 

        case 401:
            document.getElementById('subMenu4').style.display='';
            makeDiv(4);
            break; 

        case 402:
            document.getElementById('subMenu4').style.display='';
            makeDiv(4);
            break; 

        case 403:
            document.getElementById('subMenu4').style.display='';
            makeDiv(4);
            break; 

        case 404:
            document.getElementById('subMenu4').style.display='';
            makeDiv(4);
            break; 

        case 2000:
            makeDiv(menuID);
            break;   
       
        case 2001:
            makeDiv(menuID);
            break; 

        case 2002:
            makeDiv(menuID);
            break;   
        
        case 2003:
            makeDiv(menuID);
            break;  

        case 2004:
            makeDiv(menuID);
            break;

        case 3000:
            makeDiv(menuID);
            break;
    }
      
}

function headerSwitcheroo() {

    document.getElementById("msgform").innerHTML = "<span id=\"textColorChange1\">C</span><span id=\"textColorChange2\">e</span><span id=\"textColorChange3\">l</span><span id=\"textColorChange4\">t</span><span id=\"textColorChange5\">R</span><span id=\"textColorChange6\">u</span><span id=\"textColorChange7\">l</span><span id=\"textColorChange8\">e</span><span id=\"textColorChange9\">r</span><span id=\"textColorChange10\">.</span><span id=\"textColorChange11\">c</span><span id=\"textColorChange12\">o</span><span id=\"textColorChange13\">m</span>";

}

function clearContainer() {
    document.getElementById("contentMid").innerHTML = "";    
    document.getElementById("contentMid").style.visibility = "hidden";    
}

function makeDiv(num) {

    var newdiv = "";
    var container = ""; 
    document.getElementById("contentMid").style.visibility = "visible"; 
    document.getElementById("contentMid").style.marginBottom = "15px"; 
    document.getElementById("contentMid").innerHTML = "";
    newdiv = document.createElement("div");

    var clearScreenCode = "<div class='clearScreen'><span onmouseover=\"this.style.cursor='pointer'\" onclick=\"clearContainer()\">[CLS]</span></div>";

    document.getElementById("contentMid").style.overflowY = "scroll";
    document.getElementById("contentMid").style.height = "600px";

    switch(num) {
        case 1:
            newdiv.innerHTML = "<div>" + clearScreenCode + "<h3>About</h3><div class='subheadings'>Survey...</div><p>CeltRuler.com is all about writing the kind of code that will help make your website come alive. If you already have a design, but need your web pages to produce special effects (Javascript), store information (SQL) or run powerful applications (PHP), you have come to the right place.</p><div class='subheadings'>Strategize...</div><p>Use the contact link at the bottom of this page to describe your project. Whether you already have a design or are still working out your ideas, describe in as much detail as possible how you want your application to function. Oftentimes, it's as simple as adding a little Javascript to spice up your existing HTML layouts. If you're running a business online, you'll probably need a database to store information and some server-side code to process transactions.</p><div class='subheadings'>Construct...</div><p>Once we've ironed out the details of your project, an estimate will be given and the work will begin. Every project is broken up into two or three portions, and as a portion is completed it will be reviewed by you, and when satisfactory, paid for. Once the entire project is complete and everything is just how you like it, the keys will be turned over to you and the project will be yours.</p><div class='subheadings'>Oversee...</div><p>Of course, after you own the project you might still have questions about how something works, or you might want to make adjustments to the application. Before you start tinkering with your new code too much, swing by and drop a message so that you will get the expertise you need to help you manage your project.</p></div>";
            break;

        case 2:
            newdiv.innerHTML = "<div id='main'>" + clearScreenCode + "<h3>Code</h3><p>When you code for work as well as for fun, chances are you will have some scraps of code lying around that someone might find interesting. Most of these scripts are pretty old, but should still be functional so feel free to use them in your own projects.</p><p class='overview'>The following is a brief overview of just a few of the scripts:</p><table align='center'><tr><td><ul><li><a href='javascript:makeDiv(2000)'>All Color Values</a></li></ul></td><td>Have you ever wondered just how many HTML color values there are? This simple Javascript might give you an idea.</td></tr><tr><td><ul><li><a href='javascript:makeDiv(2002)'>Parse XML Doc</a></li></ul></td><td>Here is a way to read the contents of an XML file with Javascript, displaying the information dynamically onto an HTML page.</td></tr><tr><td><ul><li><a href='javascript:makeDiv(3000)'>Upload Image</a></li></ul></td><td>This is a simple PHP script for allowing users to upload an image (or images) to your site.</td></tr></table></div>";
            break;  

        case 3:
            newdiv.innerHTML = "<div id='main'>" + clearScreenCode + "<h3>Games</h3><p>Programmers often write very complex pieces of software that can do many amazing things. Writing a web game is really not that much different, but to write a really good game... well, that is always the goal. Still, many of the coding techniques used to make things happen in a game are the very same ones used in everyday web development, so if nothing else is accomplished in attempting to create that next great game, at least some programming skills have been sharpened a bit in the effort.</p><p class='overview'>The following is an overview of the current games:</p><table align='center'><tr><td><ul><li><a href='/games/bards/'>Bards</a></li></ul></td><td>This is a multi-player game written in PHP, using MySQL. Gameplay style is similar to Rock-Paper-Scissors.</td></tr><tr><td><ul><li><a href='/games/flash/game.html'>Flash Shooter</a></li></ul></td><td>A demonstration of a Flash shoot-em-up game. This sample was created on a Linux box, using the tools: MTASC and swfmill.</td></tr><tr><td><ul><li><a href='/games/goldensword/'>Golden Sword</a></li></ul></td><td>A PHP old-style adventure game that never actually got coded more than a few screens into the game.</td></tr><tr><td><ul><li><a href='/games/test/'>Man</a></li></ul></td><td>A multi-player game of stick figures that can throw discs and teleport. Currently unfinished.</td></tr><tr><td><ul><li><a href='/games/thegrid/'>The Grid</a></li></ul></td><td>A multi-player game made up of row upon seemingly endless row of players stacked one on top of another like squares, fighting for survival and for conquest.</td></tr></table></div>";
            break; 

        case 4:
            newdiv.innerHTML = "<div id='main'>" + clearScreenCode + "<h3>Samples</h3><p>Here you will find a small collection of various samples that are themselves attached to larger projects, or in some cases just prototypes that were used for the purpose of fleshing out abstract ideas.</p><p class='overview'>The following is an overview of the samples:</p><table align='center'><tr><td><ul><li><a href='http://ozpearlman.com/photos.php' target='_blank'>Photo Gallery 1</a></li></ul></td><td>An image gallery content management system created for a non-technical administrator to host a photo gallery on his own website by simply selecting the images to be uploaded, displayed, and removed. The back-end was built with PHP & MySQL for storing, organizing, and editing images, and the front-end uses Lightbox and jQuery for displaying the images. Only the front-end (the viewing of the images themselves) may be seen in this sample.</td></tr><tr><td><ul><li><a href='http://72.9.151.113/~westcoast/gallery/index.php' target='_blank'>Photo Gallery 2</a></li></ul></td><td>Same interface used as the one above, however the administrator of this photo gallery is much more photo-happy. There is a slight difference also in the way the images are initially displayed; a slight tweaking of some Javascript code to manipulate the image descriptions.</td></tr><tr><td><ul><li><a href='/webdesign/'>Product Menu</a></li></ul></td><td>You\'re a successful owner of a local coffee and tea distributing company. You\'d like to extend your wares to the online world, but you need an interface to accomplish this. Here is the original design used to create the menu.</td></tr><tr><td><ul><li><a href='/restaurants/samurai_sams.php'>Restaurant Menu</a></li></ul></td><td>The beginnings of a prototype for a Japanese teriyaki restaurant menu.</td></tr><tr><td><ul><li><a href='/webdesign/foobar.html'>Simple Layout</a></li></ul></td><td>This is an example of a very basic page for the purpose of describing a web service or product.</td></tr></table></div>";
            break;

        case 200:
            newdiv.innerHTML = "<div id='main'>" + clearScreenCode + "<h3>Javascript</h3><table align='center'><tr><td><ul><li><a href='javascript:makeDiv(2000)'>All Color Values</a></li></ul></td><td>Have you ever wondered just how many HTML color values there are? This simple Javascript might give you an idea.</td></tr><tr><td><ul><li><a href='javascript:makeDiv(2001)'>Generated Table</a></li></ul></td><td>Here is a way to change the row color of a Javascript generated HTML table on mouse-over. The table rows could have been filled with anything, but in this example they\'re just filled with random numbers.</td></tr><tr><td><ul><li><a href='javascript:makeDiv(2002)'>Parse XML Doc</a></li></ul></td><td>Here is a way to read the contents of an XML file with Javascript, displaying the information dynamically onto an HTML page.</td></tr><tr><td><ul><li><a href='javascript:makeDiv(2003)'>Random Colors</a></li></ul></td><td>This script is only good if you have a small piece of text that you\'d like to randomly colorize. It was written on the fly, and for larger amounts of text, the code would need to be rewritten with better abstraction. Still, it can add a nice effect to the page. </td></tr><tr><td><ul><li><a href='javascript:makeDiv(2004)'>Scramble Text</a></li></ul></td><td>Some people have looked for meaning in the random settling of tea leaves after a hot cup of Earl Grey, but now-a-days there is a more advanced method.</td></tr></table></div>";
            break;   

        case 201:
            newdiv.innerHTML = "<div id='main'>" + clearScreenCode + "<h3>PHP</h3><table align='center'><tr><td><ul><li><a href='javascript:makeDiv(3000)'>Upload Image</a></li></ul></td><td>This is a simple PHP script for allowing users to upload an image (or images) to your site.</td></tr></table></div>";
            break;    

        case 2000:
            newdiv.innerHTML = "<div id='main'>" + clearScreenCode + "<h3>All Color Values</h3><p>This script will write out every single color value that exists, changing the background color of the screen as it hits every 5,000th color until it reaches a grand total of 16,777,216 colors. To begin, click Start.</p><table align='center'><tr><td align='center'><ul><li><a href='#' onclick='loopThroughColors()'>Start</a></li></ul></td></tr></table><p class='centered'>To skip to the end of the script, click Skip.</p><table align='center'><tr><td align='center'><ul><li><a href='#' onclick='skipToEnd()'>Skip</a></li></ul></td></tr></table>";
            newdiv.innerHTML += document.getElementById("allColorValuesTextarea").innerHTML + "</div>";
            break;

        case 2001:
            newdiv.innerHTML = "<div id='main'>" + clearScreenCode + "<h3>Generated Table</h3><p>Here is a way to change the row color of a Javascript generated HTML table on mouse-over. The table rows could have been filled with anything, but in this example they\'re just filled with random numbers, which were generated when the page was loaded.</p>";
            newdiv.innerHTML += document.getElementById("generatedTableTextarea").innerHTML + "</div>";
            break;

        case 2002:
            newdiv.innerHTML = "<div id='main'>" + clearScreenCode + "<h3>Parse XML Doc</h3><p>Here is a way to read the contents of an XML file with Javascript, displaying the information dynamically onto an HTML page. In this demonstration there is a menu of product categories, which when moused-over, will cause a list to be displayed with a range of items relevant to the product category selected. There are 2 files shown below that will have to be copied and pasted in order to run the program.</p><br><div style='height:350px;'><div style='float:left'><table align='center'><tr><td align='center'><ul><li><a name='A' id='A' href='#' onmouseover='showSelectedCategory(this)'>List of Products in Category A</a></li></ul><br><ul><li><a name='B' id='B' href='#' onmouseover='showSelectedCategory(this)'>List of Products in Category B</a></li></ul><br><ul><li><a name='C' id='C' href='#' onmouseover='showSelectedCategory(this)'>List of Products in Category C</a></li></ul></td></tr></table></div><div style='float:right;margin-right:120px;'><div name='item0' id='item0'></div><div name='price0' id='price0'></div><div name='id0' id='id0'></div><br><div name='item1' id='item1'></div><div name='price1' id='price1'></div><div name='id1' id='id1'></div><br><div name='item2' id='item2'></div><div name='price2' id='price2'></div><div name='id2' id='id2'></div><br><div name='item3' id='item3'></div><div name='price3' id='price3'></div><div name='id3' id='id3'></div><div style='clear:both;'></div></div>";
            newdiv.innerHTML += document.getElementById("parseXmlDocTextarea").innerHTML + "</div>";
            break;

        case 2003:
            headerSwitcheroo();
            newdiv.innerHTML = "<div id='main'>" + clearScreenCode + "<h3>Random Colors</h3><p>This script is only good if you have a small piece of text that you\'d like to randomly colorize. It was written on the fly, and for larger amounts of text, the code would need to be rewritten with better abstraction. Still, it can add a nice effect to the page. Push the button below to see the code in action.</p><table align='center'><tr><td align='center'><ul><li><a href='#' onclick='doRandomColorFunctions()'>Start / Stop</a></li></ul></td></tr></table>";
            newdiv.innerHTML += document.getElementById("randomColorsTextarea").innerHTML + "</div>";
            break;

        case 2004:
            newdiv.innerHTML = "<div id='main'>" + clearScreenCode + "<h3>Scramble Text</h3><p>Some people have looked for meaning in the random settling of tea leaves after a hot cup of Earl Grey, but now-a-days there is a more advanced method. Have fun! (Note: <i>Tolkien's Elvish Language Translator</i> might come in handy here</i>)</p><div align='center' style='font-size:34px;'><span><strong>\"</strong></span><span id='mystery' name='mystery' onmouseover='scrambleText(this);fortune()' onmouseout='normalizeText(this)'>Future mysteries my code shall reveal</span><span><strong>\"</strong></span></div><br><br>";
            newdiv.innerHTML += document.getElementById("scrambleTextTextarea").innerHTML + "</div>";
            break;

        case 3000:
            newdiv.innerHTML = "<div id='main'>" + clearScreenCode + "<h3>Upload Image</h3><p>This is a PHP script for allowing users to upload an image (or images) to your site. If you get an error that looks something like this:</p><p class='centered'><i>\"Warning: copy(./myImage.gif) [function.copy]: failed to open stream: Permission denied in /var/www/php/uploadImage.php...\"</i></p><p>you will need to change the permissions of the directory.</p><br><form action='' method='post' enctype='multipart/form-data'><br><input type='file' name='image'><br><br><input name='submit' type='submit' value='Upload Image'></form><br>";
            newdiv.innerHTML += document.getElementById("uploadImageTextarea").innerHTML + "</div>";
            break;
    }  
 
    container = document.getElementById("contentMid");
    container.appendChild(newdiv);
}


