// Draw a styled box around around any contents
function openPrettyBox(width) {
	if (width != null) {
		width = 'width="'+ width+ '"';
	}
	document.writeln('<table cellspacing="0" cellpadding="0" border="0" class="pbox" '+ width+ '>'+
						'<tr><td class="tl"></td><td class="t"></td><td class="tr"></td></tr>'+
						'<tr><td class="l"></td><td class="c">');
}
function closePrettyBox() {
	document.writeln(	'</td><td class="r"></td></tr>'+
						'<tr><td class="bl"></td><td class="b"></td><td class="br"></td></tr>'+
					'</table>');
}

// Draw a styled button
function drawGelButton(text, link, color, target, onclick) {
	var code = '<a href="'+ link+ '" '+
				'class="'+ color+ '_button" ';
	if (target != null) {
		code += 'target="'+ target+ '"';
	}
	if (onclick != null) {
		code += 'onclick="'+ onclick+ '"';
	}
	code += '><img src="/img/buttons/'+ color+ '_l.gif" />' +
			'<div>'+ text+ '</div>' +
			'<img src="/img/buttons/'+ color+ '_r.gif" /></a>';
	document.write(code);
}
function drawGelSubmit(text, color) {
	var code = '<a href="#" class="'+ color+ '_button" onclick="submitForm(this);return false;">';
	code += '<input type="image" src="/img/buttons/black_l.gif" style="float:left;" />';
	code += '<div>'+ text+ '</div><img src="/img/buttons/black_r.gif" /></a>';
	document.write(code);
}
function submitForm(control) {
	while (control != null) {
		if (control.nodeName.toUpperCase() == 'FORM') {
			if (control.onsubmit == null || control.onsubmit()) {
				control.submit();
			}
			return;
		}
		control = control.parentNode;
	}
}
function drawButtonSpacer(width) {
	var code = '<div style="display:block; float:left; width:';
	if (width != null) {
		code += width;
	} else {
		code += '10px';
	}
	code += ';">&nbsp;</div>';
	document.write(code);
}

function showId(id) {
	Effect.SlideDown(id, {duration: 0.25});
}
function hideId(id) {
	Effect.SlideUp(id, {duration: 0.25});
}
function showHide(id) {
	if (document.getElementById(id).style.display != 'none') {
		hide(id);
	} else {
		show(id);
	}
}


/**************************************************************************
 ******************************************** FORM VERIFICATION FUNCTIONS *
 **************************************************************************/
function requireTextField(id, message) {
	var x = document.getElementById(id);
	if (x.value == '') {
		alert(message);
		x.focus();
		return false;
	}
	return true;
}

