function printPoll(iPollID, iTotalVotes, aQuestions)
{
	var bVoted = readCookie('VotedPoll_' + iPollID) != '';
	var sHTMLCode =
		'<div id="banner">' +
		'<table width="300" border="0" cellspacing="0" cellpadding="0">' +
		'<tr>' +
		'<td><img src="img/tituloencuesta.jpg" width="300" height="54" /></td>' +
		'</tr>' +
		'<tr>' +
		'<td bgcolor="#429639" style="padding: 10px;">' +
		'<table width="280" border="0" cellspacing="0" cellpadding="0">' +
		'<tr>' +
		'<td colspan="2"><font color="#FFFFFF"><b>' + sTitle + '</b></font></td>' +
		'</tr>';

	if(iTotalVotes == 0) iTotalVotes = 1;

	for(var i = 0; i < aQuestions.length; i++)
		sHTMLCode += 
			bVoted ?
				(i != 0 ? '<tr><td height="2"></td></tr>' : '') +
				'<tr>' +
				'<td align="left">' + aQuestions[i][1] + '</td>' +
				'<td width="68" height="15" style="' +
				'background-image:url(http://lamp02.entravision.com/Tools/PollsModule/img/bg-barrita-porc.jpg);background-repeat:no-repeat";>' +
				'<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="center">' + Math.round(aQuestions[i][2] * 100 / iTotalVotes) + ' %</td>' +
				'</tr>' : //OR
				'<tr>' +
				'<td width="255">' +
				'<font color="#FFF#">' + aQuestions[i][1] + '</font>' +
				'</td>' +
				'<td width="25">' +
				'<label>' +
				'<input name="PollOption" type="radio" ' +
				'value="' + aQuestions[i][0] + '" ' +
				'onClick="this.form.submit();"/>' +
				'</label>' +
				'</td>' +
				'</tr>';

	sHTMLCode +=
		'</table>' +
		'</td>' +
		'</tr>' +
		'<tr>' +
		'<td bgcolor="#3B8435"><img src="img/bottomencuesta.jpg" width="13" height="14" /></td>' +
		'</tr>' +
		'</table>' +
		'</div>';

	document.write(sHTMLCode);
}

function round(dValue)
{
	var iValue = Math.round(dValue);

	if(iValue < 1)
		iValue = 1;

	return iValue;
}
