function printPoll(iPollID, iTotalVotes, aQuestions)
{
	var bVoted = readCookie('VotedPoll_' + iPollID) != '';
	var sHTMLCode =
		'<div id="banner">' +
		'<img src="img/tituloencuesta.jpg" />' +
		'<div id="polls">' +
		'<table width="98%" border="0" cellspacing="5" cellpadding="0">' +
		'<tr>' +
		'<td>' + sTitle + '</td>' +
		'</tr>' +
		'<tr>' +
		'<td>' +
		'<table width="100%" border="0" cellspacing="0" cellpadding="0">';

	if(iTotalVotes == 0) iTotalVotes = 1;

	for(var i = 0; i < aQuestions.length; i++)
		sHTMLCode += 
			bVoted ?
				'<tr>' +
				'<td align="left" colspan="2">' + aQuestions[i][1] + '</td>' +
				'</tr>' +
				'<tr>' +
				'<td width="68" height="15" style="' +
				'background-image:url(http://lamp02.entravision.com/Tools/PollsModule/img/bg-barrita-porc.jpg)">' +
				'<img src="http://lamp02.entravision.com/Tools/PollsModule/img/barra_porcentaje' +
				((i % 6) + 1) +
				'.gif" ' +
				'height="15" ' +
				'width="' +
				round((aQuestions[i][2] / iTotalVotes) * 68) +
				'"/></td>' +
				'<td align="right">' + Math.round(aQuestions[i][2] * 100 / iTotalVotes) + ' %</td>' +
				'</tr>' :
				'<tr>' +
				'<td width="10">&nbsp;</td>' +
				'<td width="20">' +
				'<input name="PollOption" type="radio" ' +
				'value="' + aQuestions[i][0] + '" ' +
				'onClick="this.form.submit();"/>' +
				'</td>' +
				'<td align="left">' + aQuestions[i][1] + '</td>' +
				'</tr>';

	sHTMLCode +=
		'</table>' +
		'</td>' +
		'</tr>' +
		'<tr>' +
		'<td>&nbsp;</td>' +
		'</tr>' +
		'</table>' +
		'</div> <!-- polls -->' +
		'</div>';

	document.write(sHTMLCode);
}

function round(dValue)
{
	var iValue = Math.round(dValue);

	if(iValue < 1)
		iValue = 1;

	return iValue;
}

