// JavaScript for PHPMaker 3.2+
// (C) 2001-2006 e.World Technology Ltd.

function EWLOGIN_submitForm(EWLOGIN_this) {	
	if (EWLOGIN_HTMLArea) {			
		for (var i=0; i<EWLOGIN_HTMLArea.length; i++) {
			var html = EWLOGIN_HTMLArea[i].getHTML();
			if (html == "<p />" || html == "<br />\n" || html == "&nbsp;") html = "";
			EWLOGIN_HTMLArea[i]._textArea.value = html;
		}
	}	
	if (EWLOGIN_checkMyForm(EWLOGIN_this))
		EWLOGIN_this.submit();
}

function EWLOGIN_isHTMLArea(input_object, object_type) {
	return (object_type == "TEXTAREA" && EWLOGIN_HTMLArea && input_object.style && input_object.style.display && input_object.style.display == "none");
}

function EWLOGIN_onError(form_object, input_object, object_type, error_message) {
	alert(error_message);									
	if (object_type == "RADIO" || object_type == "CHECKBOX") {
		if (input_object[0])
			input_object[0].focus();
		else
			input_object.focus();
	}	else if (!EWLOGIN_isHTMLArea(input_object, object_type)) { 
		input_object.focus();  
	}  
	if (object_type == "TEXT" || object_type == "PASSWORD" || object_type == "TEXTAREA" || object_type == "FILE") {
		if (!EWLOGIN_isHTMLArea(input_object, object_type))
			input_object.select();
	}
	return false;	
}

function EWLOGIN_hasValue(obj, obj_type) {
	if (obj_type == "TEXT" || obj_type == "PASSWORD" || obj_type == "TEXTAREA" || obj_type == "FILE")	{
		if (obj.value.length == 0) 
			return false;		
		else 
			return true;
	}	else if (obj_type == "SELECT") {
		if (obj.type != "select-multiple" && obj.selectedIndex == 0)
			return false;
		else if (obj.type == "select-multiple" && obj.selectedIndex == -1)
			return false;
		else
			return true;
	}	else if (obj_type == "RADIO" || obj_type == "CHECKBOX")	{
		if (obj[0]) {
			for (i=0; i < obj.length; i++) {
				if (obj[i].checked)
					return true;
			}
		} else {
			return (obj.checked);
		}
		return false;	
	}
}

