// JavaScript Document

//PopUpMenu.js 
//* This script contains functions for manipulating and creating a pop up menu used for color pickers and linking, with
//* functions for creating code for the menu using less space on the html page.
//*
//* To use this script, you need to set the Menu0, Menu1, Menu2, Menu3, Menu4, Menu5 variables to contain code you want
//* to use for your menus, such as jump menus. Use fnGetLink to add links to these menus, and any help menus you use.
//* To show the menu, call doJump.
//*
//*
//*
//* This documentation is included in this script for reference - if you need more disk space or want your site to load
//* faster, you may remove this documentation section, but the version and copyright section below must remain intact.


//* Version 2.0
//*
//* Copyright 2008 ChaseSpace Corp. All Rights Reserved.
//*
//* Some portions may be copyrighted by other sites, and are labled.


//* --Global Variables--
var hidemen = true;
var prevhidable = true;
var goBack = 1;
//var menuDv = document.getElementById('menuDiv'); //document needs this element added.
var ie;    //used to check the browser version
var iframe;     //done //this global variable will carry the iFrame element code, so creation of a local variable will be unnessaccary.
var iframePrev; //done //this iFrame is just for the preview div, since it will be triggered from other menus.
var menudiv;    //done //this version of this program will create this in this script, the HTML element will be removed.
var colordiv;   //done //seperate DIV for the color picker, speeds up the performance aspect
var helpdiv;    //done //this is the mobile DIV, also supports menus, to show item-speciffic Help.
var previewdiv; //done //this pops up when an image is hovered on an image selecting div.
var imgseldiv;  //done //this is a variable-width div used for displaying lists of images on this site. Also scrolls. Use more links.

var rgbdiv = {"container":null, "R":null, "G":null, "B":null}; //the variable containing the RGB selectors

var frset = false;
var divset = false;
var menutop, menuleft, menuwidth, topoffset;

//public stuff
var ErrString;  //this is set internally to report browser support issues
var UseSliderPicker = false; //set to true to use the slider picker, false to use the standard color block picker
var Menus = new Array(); // menus to be used in the page. Will be set from html and used by dojump.
var UpdateFunct = ""; //set to string containing 
var MenuLineHeight = 15; //int containing the line height of the menu items, used for preview positioning.
var colpickeroutfield; //didn't used to be public, but this field is used when making links for setting output values

//-----------------------  Load Helpers  ------------------------//

//protected
function makeIframes() { //this initalizes the iframes on load.
  if(ie==true || frset!=true) {
	iframe = document.createElement('iframe');
	iframe.id = 'piframe';
	iframe.style.position = 'absolute';
	iframe.style.display = 'none';
	iframe.style.border = '0';
	iframe.style.zIndex = 4;
	iframe.style.width = '158px';
	document.body.appendChild(iframe);
	
	iframePrev = document.createElement('iframe');
	iframePrev.id = 'previframe';
	iframePrev.style.position = 'absolute';
	iframePrev.style.display = 'none';
	iframePrev.style.border = '0';
	iframePrev.style.zIndex = 4;
	iframePrev.style.width = '100px';
	document.body.appendChild(iframePrev);
	
	frset = true; //the new Iframe is still in the global variable
  }
}

//protected
function initalizeColorPicker() { //this initalizes the color picker and speeds up the display time of the picker.
	colordiv = document.createElement('div');
	colordiv.className = "menu";
	colordiv.id = 'colorPicker';
	colordiv.style.display = 'none';
	colordiv.style.position = 'absolute';
	colordiv.style.top = 0;
	colordiv.style.left = 0;
	colordiv.style.width = '158px';
	colordiv.style.height = '17px';
	colordiv.style.zIndex = 5;
	colordiv.innerHTML = GenerateColorPicker();
	document.body.appendChild(colordiv);
	if (colordiv.addEventListener) {
		colordiv.addEventListener ("blur",hideMenu,false);
	} else if (colordiv.attachEvent) {
		colordiv.attachEvent ("onblur",hideMenu);
	} else {
		colordiv.onblur = hideMenu;
	} 

}

function initalizeOtherDivs() { //this prepares the menu div and the help div
	menudiv = document.createElement('div');
	menudiv.className = "menu";
	menudiv.id = 'menuDiv';
	menudiv.style.display = 'none';
	menudiv.style.position = 'absolute';
	menudiv.style.top = 0;
	menudiv.style.left = 0;
	menudiv.style.width = '150px';
	menudiv.style.zIndex = 5;
	document.body.appendChild(menudiv);
	if (menudiv.addEventListener) {
		menudiv.addEventListener ("blur",hideMenu,false);
	} else if (menudiv.attachEvent) {
		menudiv.attachEvent ("onblur",hideMenu);
	} else {
		menudiv.onblur = hideMenu;
	} 

	helpdiv = document.createElement('div');
	helpdiv.className = "menu";
	helpdiv.id = 'helpDiv';
	helpdiv.style.display = 'none';
	helpdiv.style.position = 'absolute';
	helpdiv.style.top = 0;
	helpdiv.style.left = 0;
	helpdiv.style.width = '200px';
	helpdiv.style.zIndex = 6;
	document.body.appendChild(helpdiv);
	if (helpdiv.addEventListener) {
		helpdiv.addEventListener ("blur",hideMenu,false);
	} else if (helpdiv.attachEvent) {
		helpdiv.attachEvent ("onblur",hideMenu);
	} else {
		helpdiv.onblur = hideMenu;
	} 
	
	imgseldiv = document.createElement('div');
	imgseldiv.className = "menu";
	imgseldiv.id = "scrollsel";
	imgseldiv.style.display = "none";
	imgseldiv.style.position = "absolute";
	imgseldiv.style.overflow = "auto";
	imgseldiv.style.top = 0;
	imgseldiv.style.left = 0;
	imgseldiv.style.width = "215px"; //defined in CSS file, so dont change
	imgseldiv.style.height = "325px";
	imgseldiv.style.maxHeight = "325px";
	imgseldiv.style.zIndex = 6;
	document.body.appendChild(imgseldiv);
	if (imgseldiv.addEventListener) {
		imgseldiv.addEventListener ("blur",hideMenu,false);
	} else if (imgseldiv.attachEvent) {
		imgseldiv.attachEvent ("onblur",hideMenu);
	} else {
		imgseldiv.onblur = hideMenu;
	}

	previewdiv = document.createElement('div');
	previewdiv.className = "menu";
	previewdiv.id = 'previewDiv';
	previewdiv.style.display = 'none';
	previewdiv.style.position = 'absolute';
	previewdiv.style.top = 0;
	previewdiv.style.left = 0;
	previewdiv.style.width = '204px';
	previewdiv.style.height = "204px";
	previewdiv.style.zIndex = 6;
	document.body.appendChild(previewdiv);
	//this will only hide when the hide function is called

}

//finds browser version, private
function detect() {
var agt = navigator.userAgent.toLowerCase();
//support browsers by adding string checks to this condition
ie = (agt.indexOf("msie") != -1 || agt.indexOf("microsoft") != -1);
//private variables to check for speciffic unsupported browsers.
var moz = (agt.indexOf("firefox") != -1);
var net = (agt.indexOf("netscape") != -1);
var chr = (agt.indexOf("chrome") != -1);
//////////
var browser = (moz==true) ? 'ERROR 105: Firefox Browser does not support '
    + 'color picker or menus!<br><br>' : (chr==true) ? 'ERROR 108: Google Chrome is like Safari and Gecko: Script'
	+ ' and CSS support lack! Use IE!<br><br>' : (moz==false && ie==false && net==false) ? 'ERROR 104:' 
	+ 'Unknown and\/or unsupported browser!<br><br>' : '';
var report = (net==true) ? 'ERROR 106: Netscape DOES NOT automatically update to elements! No menus either!<br><br>' : '';
ErrString = browser + report;
}

//private
function GenerateColorPicker() {
		var colCode = '';
		var b;
		for(var i = 0; i < 156; i++) {
			switch(i) {
			  case 0:  b='222222'; break; case 1:  b='3C3C3C'; break; case 2:  b='555555'; break; case 3:  b='666666'; break; case 4:  b='777777'; break;
			  case 5:  b='888888'; break; case 6:  b='999999'; break; case 7:  b='AAAAAA'; break; case 8:  b='BBBBBB'; break; case 9:  b='CCCCCC'; break;
			  case 10: b='DDDDDD'; break; case 11: b='EEEEEE'; break; case 12: b='000000'; break; case 13: b='330000'; break; case 14: b='660000'; break;
			  case 15: b='990000'; break; case 16: b='CC0000'; break; case 17: b='FF0000'; break; case 18: b='000000'; break; case 19: b='003300'; break;
			  case 20: b='006600'; break; case 21: b='009900'; break; case 22: b='00CC00'; break; case 23: b='00FF00'; break; case 24: b='003300'; break;
			  case 25: b='333300'; break; case 26: b='663300'; break; case 27: b='993300'; break; case 28: b='CC3300'; break; case 29: b='FF3300'; break;
			  case 30: b='000033'; break; case 31: b='003333'; break; case 32: b='006633'; break; case 33: b='009933'; break; case 34: b='00CC33'; break;
			  case 35: b='00FF33'; break; case 36: b='006600'; break; case 37: b='336600'; break; case 38: b='666600'; break; case 39: b='996600'; break;
			  case 40: b='CC6600'; break; case 41: b='FF6600'; break; case 42: b='000066'; break; case 43: b='003366'; break; case 44: b='006666'; break;
			  case 45: b='009966'; break; case 46: b='00CC66'; break; case 47: b='00FF66'; break; case 48: b='009900'; break; case 49: b='339900'; break;
			  case 50: b='669900'; break; case 51: b='999900'; break; case 52: b='CC9900'; break; case 53: b='FF9900'; break; case 54: b='000099'; break;
			  case 55: b='003399'; break; case 56: b='006699'; break; case 57: b='009999'; break; case 58: b='00CC99'; break; case 59: b='00FF99'; break;
			  case 60: b='00CC00'; break; case 61: b='33CC00'; break; case 62: b='66CC00'; break; case 63: b='99CC00'; break; case 64: b='CCCC00'; break;
			  case 65: b='FFCC00'; break; case 66: b='0000CC'; break; case 67: b='0033CC'; break; case 68: b='0066CC'; break; case 69: b='0099CC'; break;
			  case 70: b='00CCCC'; break; case 71: b='00FFCC'; break; case 72: b='00FF00'; break; case 73: b='33FF00'; break; case 74: b='66FF00'; break;
			  case 75: b='99FF00'; break; case 76: b='CCFF00'; break; case 77: b='FFFF00'; break; case 78: b='0000FF'; break; case 79: b='0033FF'; break;
			  case 80: b='0066FF'; break; case 81: b='0099FF'; break; case 82: b='00CCFF'; break; case 83: b='00FFFF'; break; case 84: b='000000'; break;
			  case 85: b='000033'; break; case 86: b='000066'; break; case 87: b='000099'; break; case 88: b='0000CC'; break; case 89: b='0000FF'; break;
			  case 90: b='FF0000'; break; case 91: b='FF3333'; break; case 92: b='FF6666'; break; case 93: b='FF9999'; break; case 94: b='FFCCCC'; break;
			  case 95: b='FFFFFF'; break; case 96: b='330000'; break; case 97: b='330033'; break; case 98: b='330066'; break; case 99: b='330099'; break;
			  case 100:b='3300CC'; break; case 101:b='3300FF'; break; case 102:b='FF9900'; break; case 103:b='FFAA33'; break; case 104:b='FFBB66'; break;
			  case 105:b='FFCC99'; break; case 106:b='FFDDCC'; break; case 107:b='FFFFFF'; break; case 108:b='660000'; break; case 109:b='660033'; break;
			  case 110:b='660066'; break; case 111:b='660099'; break; case 112:b='6600CC'; break; case 113:b='6600FF'; break; case 114:b='FFFF00'; break;
			  case 115:b='FFFF33'; break; case 116:b='FFFF66'; break; case 117:b='FFFF99'; break; case 118:b='FFFFCC'; break; case 119:b='FFFFFF'; break;
			  case 120:b='990000'; break; case 121:b='990033'; break; case 122:b='990066'; break; case 123:b='990099'; break; case 124:b='9900CC'; break;
			  case 125:b='9900FF'; break; case 126:b='00FF00'; break; case 127:b='33FF33'; break; case 128:b='66FF66'; break; case 129:b='99FF99'; break;
			  case 130:b='CCFFCC'; break; case 131:b='FFFFFF'; break; case 132:b='CC0000'; break; case 133:b='CC0033'; break; case 134:b='CC0066'; break;
			  case 135:b='CC0099'; break; case 136:b='CC00CC'; break; case 137:b='CC00FF'; break; case 138:b='0000FF'; break; case 139:b='3333FF'; break;
			  case 140:b='6666FF'; break; case 141:b='9999FF'; break; case 142:b='CCCCFF'; break; case 143:b='FFFFFF'; break; case 144:b='FF0000'; break;
			  case 145:b='FF0033'; break; case 146:b='FF0066'; break; case 147:b='FF0099'; break; case 148:b='FF00CC'; break; case 149:b='FF00FF'; break;
			  case 150:b='BB00BB'; break; case 151:b='CC33CC'; break; case 152:b='DD66DD'; break; case 153:b='EE99EE'; break; case 154:b='FFCCFF'; break;
			  case 155:b='FFFFFF'; break;
			  default:b='000000';
			}
			colCode += makeLBox("getElementById(\'cpcodeforselitem\')",b);
		}
		colCode += makeMultiFuncItem('document.getElementById(\'cpcodeforselitem\').innerHTML=\'&nbsp;\';', 'colpickeroutfield.value=\'\'; eval(UpdateFunct);', 
			'No Value', true);
		colCode += makeMultiFuncItem('', /*'document.colpickeroutfield=\'\';'*/'', 'Cancel', true);
		colCode += "<sp" + "an id=\"cpcodeforselitem\">&nbsp;<\/sp" + "an>";
		return colCode;
}

//protected
function makeMultiFuncItem(mof, clf, txt, ctr) {
	var cen = (ctr==true) ? 'style=\"text-align:center;\" ' : '';
	return '<a href=\"javascript:void(0);\" onMouseOver=\"' + mof + '\" onMouseDown=\"' + clf + '\" ' + cen + '>' + txt + '<\/a>';
}

//private
function makeLBox(ara , col) {
	return string = '<a href=\"javascript:void(0);\" onMouseOver=\"document.' + ara + '.innerHTML = \'' + col + '\';\"' +
		' style=\"width:13px;height:13px!important;background-color:' + col + ';border:1px solid;cursor:arrow;\" class=\"colorbox\"' +
		' onMouseDown=\"colpickeroutfield.value=\'' + col + '\'; eval(UpdateFunct);\" \/>' ;
}

//----------------- Initalization Load Method -------------------//
function InitMenus() {
	detect();
	makeIframes();          //creates the iframe for use in this class
	initalizeColorPicker(); //creates and inits the Color Picker, for instant display when called.
	initalizeOtherDivs();   //creates the help and menu divs for use.
}



//-----------------------  End Section  -------------------------//

//* --Static Methods for this class--

//gets the distance between the top and obj.
//Copyright 2006 http://www.mygen.co.uk/
function getAbsoluteOffsetTop(obj)
{
	var top = obj.offsetTop;
	var parent = obj.offsetParent;
	while (parent != document.body) {
		top += parent.offsetTop;
		parent = parent.offsetParent;
	}
	return top;
}

//gets the distance between left and obj.
//Copyright 2006 http://www.mygen.co.uk/
function getAbsoluteOffsetLeft(obj)
{
	var left = obj.offsetLeft;
	var parent = obj.offsetParent;
	while (parent != document.body) {
		left += parent.offsetLeft;
		parent = parent.offsetParent;
	}
	return left;
}

//commonly used, shows or hides an object using the class name. Use with a file defining these classes as hidden or visible.
function shHd(id) {
 if(document.getElementById(id).className=='hide') {
  document.getElementById(id).className = 'show';
 } else {
  document.getElementById(id).className = 'hide';
 }
}

//converts a RGB value to a hex value
function RGBToHex(R,G,B) {
	return (toHex(R)+toHex(G)+toHex(B));
}

//used by RGBToHex, not to be called directly
function toHex(N) {
	if (N==null) {
		return "00";
	}
	N=parseInt(N);
 	if (N==0 || isNaN(N)) {
 		return "00";
	}
	N=Math.max(0,N);
 	N=Math.min(N,255);
 	N=Math.round(N);
	var R = "0123456789ABCDEF";
	return R.charAt((N-N%16)/16) + R.charAt(N%16);
}

//converts a Hex value to RGB
function HexToRGB(H) {
	var rgb = new Array();
	var hexR = H.substr(0,2);
	rgb['red'] = parseInt((hexR).substring(0,2),16);
	var hexG = H.substr(2,2);
	rgb['green'] = parseInt((hexG).substring(0,2),16);
	var hexB = H.substr(4,2);
	rgb['blue'] = parseInt((hexB).substring(0,2),16);
	return rgb;
}

//* --Static CSO functions, may need editing--

//Constructs & returns a link based on passed arguments
function fnGetLink(fn,txt,inc,hr,ctr, updarg) {
	var cen = (ctr==true) ? 'style=\"text-align:center;\" ' : '';
	if(inc=='anc') {
		var link = '<a href=\"' + fn + '\" onMouseDown=\"this.click()\" onClick=\"goBack++\" ' + cen + '>' + txt + '<\/a>';
	} else if(inc=='jso') {
		var link = '<a href=\"javascript:void(0);\" onMouseDown=\"this.click()\" onClick=\"' + fn + '\" ' + cen + '>' + txt + '<\/a>';
	} else if(inc=='omo') {
		var link = '<a href=\"javascript:void(0);\" onMouseOver=\"' + fn + '\"  ' + cen + '>' + txt + '<\/a>';
	} else if(inc=='out') {
		var link = '<a href=\"javascript:void(0);\" onClick=\"colpickeroutfield.value = \'' + fn + '\';' + updarg + '\"  ' +
		cen + ' onMouseDown=\"this.click();\">' + txt + '<\/a>';
	} else {
		var link = '<a href=\"' + fn + '\" onMouseDown=\"this.click()\" ' + cen + '>' + txt + '<\/a>';
	}
	if(hr==true) {
		link = '<hr>'+link;
	}
	return link;
}

function fnGetPLink(fn, txt, inc, hr, ctr, index, url, sizex, sizey, updarg) {
	var cen = (ctr==true) ? 'style=\"text-align:center;\" ' : '';
	cen += " onMouseOver=\"doPreview(\'" + url + "\', " + index + ", " + sizex + ", " + sizey + ");\" onMouseOut=\"clearPreview();\"";
	if(inc=='anc') {
		var link = '<a href=\"' + fn + '\" onMouseDown=\"this.click();\" onClick=\"\" ' + cen + '>' + txt + '<\/a>';
	} else if(inc=='jso') {
		var link = '<a href=\"javascript:void(0);\" onMouseDown=\"this.click();\" onClick=\"' + fn + ';\" ' + cen + '>' + txt + '<\/a>';
	} else if(inc=='out') {
		var link = '<a href=\"javascript:void(0);\" onClick=\"colpickeroutfield.value = \'' + fn + '\';' + updarg + '\"  ' +
		cen + ' onMouseDown=\"this.click();\">' + txt + '<\/a>';
	} else {
		var link = '<a href=\"' + fn + '\" onMouseDown=\"this.click();\" ' + cen + '>' + txt + '<\/a>';
	}
	if(hr==true) {
		link = '<hr>'+link;
	}
	return link;
}

//Constructs & returns an image based on a URL
function fnGetImage(url) {
	return "<img src=\"" + url + "\">"
}

//* End Static Methods
//* --Section containing code for the DIV, may not be static--


//this is the menu code
//lots of work needed
//*- Only call this from the HTML page, should not be called internally -*
function doJump(y , ar , sp , dpdisabled) {
  if(ie==true) {
	colpickeroutfield = y; // this is now global cause any function generating a menu should know what field generated it.
	menutop = getAbsoluteOffsetTop(y);
	menuleft = getAbsoluteOffsetLeft(y);
	hidemen = true;
	hideMenu();   //hides the menu if it's visible elsewhere, should not be placed here.
	switch(ar) {
	  case 'section':
	  case 'generator section':
	  case 'sect':
	  case "menu":
	    menudiv.style.top = getAbsoluteOffsetTop(y) + 15; //place this right where the button is.
		menudiv.style.left = getAbsoluteOffsetLeft(y);
	  	menudiv.innerHTML = Menus[sp];
		menudiv.style.display = 'block';
		menudiv.focus();
		//this needs the iframe to be displayed
		
		menuwidth = 150;
		topoffset = 15;
		prevhidable = true;
		break;
	  case "image select":
	  case "imgsel":
	  case "scrollsel":
	  case "scroll":
	    imgseldiv.style.top = getAbsoluteOffsetTop(y) + 20;
		imgseldiv.style.left = getAbsoluteOffsetLeft(y);
		imgseldiv.innerHTML = Menus[sp];
		iframe.style.height = imgseldiv.style.height;
		iframe.style.width = imgseldiv.style.width;
		iframe.style.top = imgseldiv.style.top;
		iframe.style.left = imgseldiv.style.left;
		iframe.style.display = "block";
		imgseldiv.style.display = 'block';
		imgseldiv.focus();
		
		menuwidth = 215;
		topoffset = 20;
		prevhidable = true;
	    break;
	  case 'help':
	  case '?':
	    helpdiv.style.top = getAbsoluteOffsetTop(y); //place this right where the button is.
		helpdiv.style.left = getAbsoluteOffsetLeft(y);
		helpdiv.innerHTML = sp;
		helpdiv.style.display = 'block'; //the iframe is not used for help
		helpdiv.focus();
		
		menuwidth = 200;
		topoffset = 0;
		break;
	  case 'color':
		if(UseSliderPicker) {
		} else {
			colordiv.style.top = getAbsoluteOffsetTop(y);      //get location y
			colordiv.style.left = getAbsoluteOffsetLeft(y);    //get location x
			colordiv.style.left = getAbsoluteOffsetLeft(y);
			colordiv.style.top = getAbsoluteOffsetTop(y) + 20;
			iframe.style.height = '233px';
			iframe.style.width = colordiv.style.width;
			iframe.style.top = colordiv.style.top;
			iframe.style.left = colordiv.style.left;
			iframe.style.display = 'block';
			colordiv.style.display = 'block';
			colordiv.focus();
			
			menuwidth = 158;
			topoffset = 20;
		}
  		break;
	  default:;
	}
  } else {
	alert('Incompatible CSS and JS browser functions. Try Internet Explorer.')
  }
}

function doPreview(url, index, sizex, sizey) { //i am ignoring index for now
	previewdiv.style.filter = "none";
	previewdiv.style.left = menuleft + menuwidth + 2 + "px";
	previewdiv.style.width = (sizex + 4) + "px";
	previewdiv.style.height = (sizey + 4) + "px"; 
	if(menudiv.style.display=="block") {
		previewdiv.style.top = (menutop + topoffset + (MenuLineHeight * index)) + "px";
	} else { 
		previewdiv.style.top = menutop + topoffset + "px";
	}  
	iframePrev.style.left = previewdiv.style.left;
	iframePrev.style.top = previewdiv.style.top;
	iframePrev.style.width = previewdiv.style.width;
	iframePrev.style.height = previewdiv.style.height;
	previewdiv.innerHTML = "<img src=\"" + url + "\" height=" + sizex + " width=" + sizey + " \/>";
	previewdiv.style.display = "block";
	iframePrev.style.display = "block";  
}

function clearPreview() {
	if(prevhidable==true) {
		previewdiv.style.display = "none";
		iframePrev.style.display = "none";
	}
}

function resetHideMen() {
	hidemen = true;
}

var fadetimeout;
var fadeprog = 0;

function hideMenu() { //determines if the menu needs to be hidden
	if(hidemen) { //true if the menu is visible
		iframe.style.display = 'none';
		if(colordiv.style.display=='block') {
			colordiv.style.display = 'none';
		}
		iframePrev.style.display = 'none'; 
		menudiv.style.display = 'none';    
		colordiv.style.display = 'none';   
		helpdiv.style.display = 'none'; 
		if(previewdiv.style.display=='block' && previewdiv.style.filter=="none") {
			//previewdiv.style.display = 'none';
			fadeprog = 100;
			prevhidable = false;
			fadetimeout = setInterval("fadePreview()", 20);
		}
		imgseldiv.style.display = "none";
	//	rgbdiv.container.style.display = 'none';	
	}
}

function fadePreview() {
	if(fadeprog<=5) {
		previewdiv.style.display = 'none';
		previewdiv.style.filter = "none";
		clearInterval(fadetimeout);
		return;
	}
	fadeprog = fadeprog - 5;
	previewdiv.style.filter = "alpha(Opacity=" + fadeprog + ")";
}

//* ------- This region will have the code for the slider pickers  -------

function InitalizeSliderPicker() {
	
}

//* ------- This region has a lot of old unused code to be updated -------
//now uses variables to reference the objects
function getColorFields(y,sp) { //needs to be edited
	rgbdiv.container.style.top = getAbsoluteOffsetTop(y) + 20;
	
	rgbdiv.container.innerHTML = 'R: <input type=\"text\" size=\"3\" maxlength=\"3\" name=\"redval\" value=\"\" onKeyUp=\"' +
		'getHex(\''+sp+'\');\">' +
		'<br>G: <input type=\"text\" size=\"3\" maxlength=\"3\" name=\"greenval\" value=\"\" onKeyUp=\"' +
		'getHex(\''+sp+'\');\"><br>B: <in' +
		'put type=\"text\" size=\"3\" maxlength=\"3\" name=\"blueval\" value=\"\" onKeyUp=\"getHex(\''+sp+'\')\">' + 
		'<br>Colors are numbers 0 to 255' +
		fnGetLink('pg.'+sp+'.value=\'\'; resetHideMen(); hideMenu();','Clear','jso',false,true)+
		fnGetLink('resetHideMen(); hideMenu();','Close','jso',true,true);
	iframe.style.top = menudiv.style.top;
	iframe.style.left = menudiv.style.left;
	iframe.style.height = '133px';
	fillValues(eval('pg.'+sp+'.value'));
	iframe.style.display = 'block';
	hidemen=false;
}

//--------------- refrences a nonexistent object ---------------//
function getHex(sp) {
	checkRGBValue();
	var hex = RGBToHex(pg.redval.value,pg.greenval.value,pg.blueval.value);
	eval('pg.'+sp+'.value = hex');
	updatePg();
}

function checkRGBValue() {
	if(isNaN(pg.redval.value)) pg.redval.value = 0;
	if(pg.redval.value > 255) pg.redval.value = 255;
	if(isNaN(pg.greenval.value)) pg.greenval.value = 0;
	if(pg.greenval.value > 255) pg.greenval.value = 255;
	if(isNaN(pg.blueval.value)) pg.blueval.value = 0;
	if(pg.blueval.value > 255) pg.blueval.value = 255;
}

function fillValues(H) {
	if(H=='') H = '000000';
	var rgb = HexToRGB(H);
	if(pg.redval != null) pg.redval.value = rgb['red'];
	if(pg.greenval != null) pg.greenval.value = rgb['green'];
	if(pg.blueval != null) pg.blueval.value = rgb['blue'];
}

if (document.addEventListener) {
	document.addEventListener ("load",InitMenus,false);
} else if (document.attachEvent) {
	document.attachEvent ("onload",InitMenus);
} else {
	document.onload = InitMenus;
} 