/*

CUSTOM FORM ELEMENTS

Created by Ryan Fait
www.ryanfait.com

The only thing you need to change in this file is the following
variables: checkboxHeight, radioHeight and selectWidth.

Replace the first two numbers with the height of the checkbox and
radio button. The actual height of both the checkbox and radio
images should be 4 times the height of these two variables. The
selectWidth value should be the width of your select list image.

You may need to adjust your images a bit if there is a slight
vertical movement during the different stages of the button
activation.

Visit http://ryanfait.com/ for more information.

*/


	// ONLY USE THIS IF ie7, mozilla, safari, opera 9
if (window.XMLHttpRequest) {


	var selectWidth = "250";
	var scoochMenu = "8";

		// ADDED 'top: 8px' TO SCOOCH THE DROP MENU DOWN A BIT
	document.write('<style type="text/css">select.styled { position: relative; top: ' + scoochMenu + 'px; width: ' + selectWidth + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; }</style>');

	var Custom = {
		init: function() {
			var inputs = document.getElementsByTagName("input"), span = Array(), textnode, option, active;
			inputs = document.getElementsByTagName("select");
			for(a = 0; a < inputs.length; a++) {
				if(inputs[a].className == "styled") {
					option = inputs[a].getElementsByTagName("option");
					active = option[0].childNodes[0].nodeValue;
					textnode = document.createTextNode(active);
					for(b = 0; b < option.length; b++) {
						if(option[b].selected == true) {
							textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
						}
					}
					span[a] = document.createElement("span");
					span[a].className = "select";
					span[a].id = "select" + inputs[a].name;
					span[a].appendChild(textnode);
					inputs[a].parentNode.insertBefore(span[a], inputs[a]);
					inputs[a].onchange = Custom.choose;
				}
			}
		},

		choose: function() {
			option = this.getElementsByTagName("option");
			for(d = 0; d < option.length; d++) {
				if(option[d].selected == true) {

						// CALL FUNCTION IN index.php TO SWITCH PAGES
					if (option[d].value != "") {
						Switch_Page(option[d].value)
					}
					//document.getElementById("select" + this.name).childNodes[0].nodeValue = option[d].childNodes[0].nodeValue;
				}
			}
		}
	}

	window.onload = Custom.init;

}






