var radios = new Array();
var radioArea = new Array();
function $(objectId)
{
	if (document.getElementById && document.getElementById(objectId))
	{
		return document.getElementById(objectId);
	}else if (document.all && document.all[objectId])
	{
		return document.all[objectId];
	}else if (document.layers && document.layers[objectId])
	{
		return document.layers[objectId];
	}else{
		return false;
	}
}
function show(ObjectId)
{
	$("formItem").style.display = "block";
}
function hidden(ObjectId)
{
	$("formItem").style.display = "none";
}
function prepareInputsForHints(ObjectId) {
	var inputs = $(ObjectId).getElementsByTagName("input");
	for (var i=0; i<inputs.length; i++){
		// test to see if the hint span exists first
		if (inputs[i].type != 'radio')
		{
			if (inputs[i].parentNode.getElementsByTagName("span")[0] && (inputs[i].parentNode.getElementsByTagName("span")[0].className == "hint")) {
				// the span exists!  on focus, show the hint
				inputs[i].onfocus = function () {
					this.style.borderWidth="2px";
					this.style.borderColor="#9DD0EE";
					this.style.background="url(images/bg-09.gif) repeat 0 0;";
					this.parentNode.getElementsByTagName("span")[0].style.display = "inline";
				}
				// when the cursor moves away from the field, hide the hint
				inputs[i].onblur = function () {
					this.style.borderWidth="1px";
					this.style.borderColor="#CCC";
					this.style.background="#FFF";
					this.parentNode.getElementsByTagName("span")[0].style.display = "none";
				}
			}
			else
			{
				inputs[i].onfocus = function () {
					this.style.borderWidth="2px";
					this.style.borderColor="#9DD0EE";
					this.style.background="url(images/bg-09.gif) repeat 0 0;";
				}
				inputs[i].onblur = function () {
					this.style.borderWidth="1px";
					this.style.borderColor="#CCC";
					this.style.background="#FFF";			
				}
			}
		}
	}
	// repeat the same tests as above for selects
	var selects = $(ObjectId).getElementsByTagName("textarea");
	for (var k=0; k<selects.length; k++){
		if (selects[k].parentNode.getElementsByTagName("span")[0]) {
			selects[k].onfocus = function () {
				this.style.borderWidth="2px";
				this.style.borderColor="#9DD0EE";
				this.style.background="url(images/bg-09.gif) repeat 0 0;";
				this.parentNode.getElementsByTagName("span")[0].style.display = "inline";
			}
			selects[k].onblur = function () {
				this.style.borderWidth="1px";
				this.style.borderColor="#CCC";
				this.style.background="#FFF";
				this.parentNode.getElementsByTagName("span")[0].style.display = "none";
			}
		}
	}
}
function radioHovers(ObjectId)
{
	var inputs = $(ObjectId).getElementsByTagName('input');
	var j = 0;
	for(var i=0; i < inputs.length; i++) {
		if(inputs[i].type=='radio') {
			radios[j] = inputs[i];
			++j;
		}
	}
	
	for(var i=0; i <radios.length; i++) {
		radios[i].className = "radioStyle";
		radioArea = $(ObjectId).getElementsByTagName("em");
		if(radios[i].checked) {radioArea.className = "radio-02";}
		else if(!radios[i].checked) {radioArea.className = "radio-01";}
		radios[i].onclick = new Function('checkRadio('+i+')');
	}
}
function checkRadio(g) {
	checkHidden(g);
	if(radios[g].checked) {
		for (var k = 0; k < radios.length; k++)
		{
			if(k != g) {
				radioArea[k].className = "radio-01";
			}
			else if(k == g) {
				radioArea[k].className = "radio-02";
			}
		}
	}
}
function checkHidden(n)
{
	if(n == 0 && radios[0].checked)
	{
		$("hiddenForm").style.display = "block";
	}
	else
	{
		$("hiddenForm").style.display = "none";
	}
}

function buttonHovers(ObjectId) {
	var elements = $(ObjectId).getElementsByTagName('button');
	for (var i5 = 0; i5 < elements.length; i5++) {
		if(elements[i5].className == "btnStyle-01")
		{
			elements[i5].onmouseover = function() {this.className = this.className.replace(/btnStyle-01/g, "Hovered-01");}
			elements[i5].onmouseout = function() {this.className = this.className.replace(/Hovered-01/g, "btnStyle-01");}
		}
		if(elements[i5].className == "btnStyle-02")
		{
			elements[i5].onmouseover = function() {this.className = this.className.replace(/btnStyle-02/g, "Hovered-02");}
			elements[i5].onmouseout = function() {this.className = this.className.replace(/Hovered-02/g, "btnStyle-02");}
		}
	}
}