function objTypeDef(Name, ID)
{
	this.Name = Name;
	this.ID = ID;
	this.aTypeProperties = new Array();
}

objTypeDef.prototype.GetForm = function(sDrawDiv)
{
	var aryHTML = new Array();
	aryHTML.push('<table width="100%" border="0" cellspacing="0" cellpadding="4"><tbody>');
	for(var i = 0; i < this.aTypeProperties.length; i++)
	{
		aryHTML.push(this.aTypeProperties[i].GetForm());
	}
	aryHTML.push('</tbody></table>');

	GetTag(sDrawDiv).innerHTML = aryHTML.join('');
}
objTypeDef.prototype.xmlIze = function()
{
	var aryHTML = new Array();
	aryHTML.push('<properties>');
	for(var i = 0; i < this.aTypeProperties.length; i++)
	{
		aryHTML.push('<property>');
		aryHTML.push('<propertyId>' + this.aTypeProperties[i].propertyId + '</propertyId>');
		aryHTML.push('<propertyName>' + this.aTypeProperties[i].propertyName + '</propertyName>');
		aryHTML.push('<propertyValue>' + this.HTMLEncode(GetTag(this.aTypeProperties[i].propertyName).value) + '</propertyValue>');
		aryHTML.push('</property>');
	}
	aryHTML.push('</properties>');
    return aryHTML.join('');
}

objTypeDef.prototype.HTMLEncode = function(s)
{
    var t = s.toString();
    var h = new Array("&","\"","<",">");
    var e = new Array("&amp;","&quot;","&lt;","&gt;")
    for(var i = 0; i < h.length; i ++)
    {
        t = t.replace(eval('/' + h[i] + '/gi'), e[i]);
    }
    return t;
}

objTypeDef.prototype.loadProperty = function(iPropertyId, sPropertyName, iDataTypeId)
{
	this.aTypeProperties.push(new typeProperty(iPropertyId, sPropertyName, iDataTypeId));
}
function typeProperty(iPropertyId, sPropertyName, iDataTypeId)
{
	this.propertyId = iPropertyId;
	this.propertyName = sPropertyName;
	this.dataTypeId = iDataTypeId;
	this.aListItems = new Array();
	
}

typeProperty.prototype.GetForm = function()
{
	var aryHTML = new Array();

	aryHTML.push('<tr><td style="text-align: right; width: 45%;"><b>' + this.propertyName + ':</b></td><td style="text-align: left; width: 55%;">');
	if(this.aListItems.length > 0)
	{
	    aryHTML.push('<select name="' + this.propertyName + '" id="' + this.propertyName + '">');
	    for(var i=0; i<this.aListItems.length; i++)
	    {
		    aryHTML.push(this.aListItems[i].GetLine());
	    }
	    aryHTML.push('</select>');
    }
    else
    {
        aryHTML.push('<input type="text" class="FormElementInput" name="' + this.propertyName + '" id="' + this.propertyName + '" />');
    }
    aryHTML.push('</td></tr>');
    return aryHTML.join('');
}

typeProperty.prototype.loadListItem = function(iItemId, iDisplayOrder, sDisplayValue)
{
	this.aListItems.push(new listItem(iItemId, iDisplayOrder, sDisplayValue));
}


function listItem(iItemId, iDisplayOrder, sDisplayValue)
{
	this.displayOrder = iDisplayOrder;
	this.displayValue = sDisplayValue;
	this.itemId = iItemId;
}

listItem.prototype.GetLine = function()
{
	var aryHTML = new Array();
	aryHTML.push('<option value="' + this.displayValue + '">' + this.displayValue + '</option>');
	return aryHTML.join('');
}   