function buildMain_multiTextInput_delete(name,deleted)
{
	layer = document.getElementById(name+'_multiText_'+deleted+'_layer');
	if(layer)
	{
		layer.innerHTML = '';
	}
}

function buildMain_multiTextInput_add(name)
{
	count = document.getElementById(name+'_multiText_count');

	layer = document.getElementById(name+'_layers');

	table = new Array();

	for(i=0;i<count.value;i++)
	{
		if(document.getElementById(name+'_multiText_'+i))
		{
			table[i] = document.getElementById(name+'_multiText_'+i).value;
		}
	}

	reg = new RegExp('#mask#','g');
	code = document.getElementById(name+'_multiText_mask').innerHTML;
	layer.innerHTML += code.replace(reg,count.value);

	for(i=0;i<count.value;i++)
	{
		if(document.getElementById(name+'_multiText_'+i))
		{
			document.getElementById(name+'_multiText_'+i).value = table[i];
		}
	}

	document.getElementById(name+'_multiText_count').value++;
}

function buildMain_numberInput_onChange(id)
{

}

function buildMain_numberInput_increment(id)
{
	input = document.getElementById(id);

	if(input)
	{
		input.value++;
	}
}

function buildMain_numberInput_decrement(id)
{
	input = document.getElementById(id);

	if(input)
	{
		input.value--;
	}
}

function buildMain_iconInput_move(id,direction,start)
{
	eval('max = bldMain_iconInput_'+id+'_maxVar;');
	eval('cursor = bldMain_iconInput_'+id+'_cursorVar;');

	layer = document.getElementById(id+'_part'+cursor);
	layer.style.display = 'none';

	if(direction>0)
	{
		if(start) cursor = max;
		else if(cursor+1 > max) cursor=0;
		else cursor++;
	}
	else
	{
		if(start) cursor = 0;
		else if(cursor-1 < 0) cursor=max;
		else cursor--;
	}

	layer = document.getElementById(id+'_part'+cursor);
	layer.style.display = 'inline';

	eval('bldMain_iconInput_'+id+'_cursorVar = cursor;');
}

function buildMain_iconInput_next(id)
{
	buildMain_iconInput_move(id,1,false)
}

function buildMain_iconInput_prev(id)
{
	buildMain_iconInput_move(id,0,false)
}

function buildMain_iconInput_click(id,icon)
{
	input = document.getElementById(id);
	input.value = icon;
}

function buildMain_changeClass(id,name)
{
	element = document.getElementById(id);
	if(element)
	{
		element.className = name;
	}
}

function buildMain_hideLayer(id)
{
	element = document.getElementById(id);
	if(element)
	{
		element.style.display = 'none';
	}
}

function buildMain_showLayer(id)
{
	element = document.getElementById(id);
	if(element)
	{
		element.style.display = 'block';
	}
}

function buildMain_invertLayer(id)
{
	element = document.getElementById(id);
	if(element)
	{
		if(element.style.display == 'none')
		{
			element.style.display = 'block';
		}
		else element.style.display = 'none';
	}
}

