/*
 * CVS: $Id: renderforms.js,v 1.3 2003/11/22 00:12:31 dsmith Exp $
 *
 * This file is a part of the Real Networks software library.
 * Copyright (C) 2001 Real Networks, Inc.
 * All rights reserved.
 *
 * Purpose:	Define the form rendering method for all Form Item Objects
 * Method: 	Return the appropriate HTML based on the object definition
 */

function renderFormElement()
{
	var retVal = "element type: " + this.type;
	switch( this.type )
	{
		case "text":
		case "password":
			retVal = "<input onFocus=this.select() onBlur=execCommand(\"Unselect\"); class=\"textfield\" type="+this.type+" style=\"width:"+this.size+"px;\" name=\"" + this.id
				+ "\" value=\"" + ((data[this.id])?data[this.id]:"") + "\""
				+ " tabindex="+(tabIndex++)+" maxlength="+this.maxlength+">";
			break;
		case "select-one":
			retVal = "<select  class=\"selectfield\" style=\"width:" + this.size + "px;\" name=\"" + this.id + "\" tabindex="+(tabIndex++)
			+ "\" >";
			for( var i=0; i<this.data.length; i++ )
			{
				if( !(this.data[i].text) )continue;
				retVal += "<option value=\""+this.data[i].value + "\""
					+ ( ( data[this.id] && (data[this.id] == this.data[i].value))?" selected ":"" )
					+">" + this.data[i].text+"</option>";
			}
			retVal += "</select>";
			break;
		case "checkbox":
			retVal = "<input class=\"textfield\" type=checkbox name=\""+ this.id + "\" value=\"" + this.defaultValue + "\" "
				+ ( this.checked ?" checked ":"" )
				+ " tabindex="+(tabIndex++)+">";
			break;
	}

	return retVal;
}

var off_renderforms_loaded = true;

