il_img = 1;
il_properties = 1;

function addimage()
{
	if (il_img < 3)
	{
		il_img++;
		el_input = document.createElement("input");
		el_input.setAttribute('type',"file");
		el_input.setAttribute('name','newimgs[]');
		el_br = document.createElement("br");
		document.getElementById('addnewfiles').appendChild(el_input);
		document.getElementById('addnewfiles').appendChild(el_br);
	}
	else
	{
		alert('Too many pictures in one time.');
	}
}
function addseealso()
{
		el_sel = document.getElementById('newseealso');
		el_td = document.getElementById('addnewseealso');
		if (el_sel && el_td)
		{
			new_sel = el_sel.cloneNode(true);
			new_sel.removeAttribute('id');
			el_br = document.createElement("br");
			el_td.appendChild(new_sel);
			el_td.appendChild(el_br);
		}
}

function addseealso2()
{
		el_sel = document.getElementById('newseealso2');
		el_td = document.getElementById('addnewseealso2');
		if (el_sel && el_td)
		{
			new_sel = el_sel.cloneNode(true);
			new_sel.removeAttribute('id');
			el_br = document.createElement("br");
			el_td.appendChild(new_sel);
			el_td.appendChild(el_br);
		}
}

function addproperties()
{
	il_properties++;
	
	el_tr = document.createElement("tr");
	el_th = document.createElement("th");
	el_input = document.createElement("input");
	el_input.setAttribute('type',"text");
	el_input.setAttribute('name','newtech['+il_properties+'][name]');
	el_th.appendChild(el_input);
	el_tr.appendChild(el_th);
	
	el_td = document.createElement("td");
	el_input2 = document.createElement("input");
	el_input2.setAttribute('type',"text");
	el_input2.setAttribute('name','newtech['+il_properties+'][value]');
	el_td.appendChild(el_input2);
	el_tr.appendChild(el_td);
	
	el_td2 = document.createElement("td");
	el_tr.appendChild(el_td2);
	
	document.getElementById('addnewproperties').appendChild(el_tr);
}

function redirect(addr, timer)
{
	if (addr != '' && timer != undefined)
	{
		setTimeout("proceedRedirect('"+addr+"')",10);
	}
}

function proceedRedirect(addr)
{
	document.location = addr;
}