function getCookie(c_name)
{
  if (document.cookie.length>0)
  {
    c_start=document.cookie.indexOf(c_name + "=")
    if (c_start!=-1)
    { 
      c_start=c_start + c_name.length+1 
      c_end=document.cookie.indexOf(";",c_start)
      if (c_end==-1) c_end=document.cookie.length
      return unescape(document.cookie.substring(c_start,c_end))
      } 
    }
  return null;
}

function poll_write()
{
  document.write('<h1>What do you think of the recent changes to ancient effigies?</h1>');
  if(getCookie('pollvoted') == '260')
  {
    document.write('<div style="text-align:center; margin: 20px auto;">You have already voted.<br /><a href="?poll_id=260" id="?poll_id=260">View the results here.</a></div>');
  }

  else 
  {
    document.write('<form action="index.php">');
    document.write('<input type="hidden" name="poll" value="vote" />');
    document.write('<input type="hidden" name="poll_id" value="260" />');
    document.write('<table width="100%" cellspacing="1" cellpadding="0">');
	document.write('<tr><td width="10"><input type="radio" name="Answer" value="1" id="p1" /></td><td><label for="p1">I support them!</label></td></tr>'); 
document.write('<tr><td width="10"><input type="radio" name="Answer" value="2" id="p2" /></td><td><label for="p2">I don\'t support them!</label></td></tr>'); 
document.write('<tr><td width="10"><input type="radio" name="Answer" value="3" id="p3" /></td><td><label for="p3">I don\'t mind either way.</label></td></tr>'); 
document.write('<tr><td width="10"><input type="radio" name="Answer" value="4" id="p4" /></td><td><label for="p4">What changes?</label></td></tr>'); 
document.write('</table>');
    document.write('<table width="100%" cellspacing="0" cellpadding="2" style="margin-top: 5px;">');      
    document.write('<tr>');
    document.write('<td align="center"><input type="submit" name="submit" value="Vote" class="button" /></td>');
    document.write('<td align="center"><input type="submit"  name="action" value="Results" class="button" /></td>');
    document.write('</tr>');
    document.write('</table>');
    document.write('</form>');
  }
}
