var maxOptions = 10;
var minOptions = 10;
var curOptions = 2;

function addOption()
{
	if (curOptions >= maxOptions)
	{
		alert("You can't add any more answers.");
	}
	else
	{
		curOptions++;
		createField()
	}
}

function createField()
{
	var loc = document.getElementById('options');
	var inputNode = document.createElement('input');
	var statusNode = document.createElement('div');

	statusNode.setAttribute('id', 'status_question_' + curOptions);
	inputNode.setAttribute('name', 'question_' + curOptions);
	inputNode.setAttribute('id', 'question_' + curOptions);
	inputNode.setAttribute('maxlength', '100');
	loc.appendChild(inputNode);
	loc.appendChild(statusNode);
}

function removeOption()
{
	if (curOptions <= 2)
	{
		alert('You need at least two answers.');	
	}
	else
	{
		var loc = document.getElementById('options');
		loc.removeChild(loc.lastChild);
		loc.removeChild(loc.lastChild);
		curOptions--;
	}
}

function getSuggestions(question)
{
	$('#pollSuggestion').html('Suggestions go here');
}

function setPollType()
{
	if (document.create_form.poll_type.checked)
	{
		document.getElementById('polltype').setAttribute('value', '1');
	}
	else
	{
		document.getElementById('polltype').setAttribute('value', '0');

	}
		
}
