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 "";
}
function setCookie(c_name,value,expiredays)
{
		var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);
		document.cookie=c_name+ "=" +escape(value)+ ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
} 

function back_poll(id)
	{
			window.location.reload();	
	}
function result(id)
	{
			var focus_content=id;
			var theform=window.document.getElementById('poll_en' + focus_content );
			window.document.getElementById('poll_content' + focus_content).innerHTML="<img src=http://media.impaqmsn.com/engine/load.gif border=0>"
			window.document.getElementById('bu_poll' + focus_content).style.display='none';		
			window.document.getElementById('bu_back' + focus_content).style.display='';		
			window.document.getElementById('bu_re' + focus_content).style.display='none';	
			
			get_nochoice(focus_content);
		}
function checka(id)
{ 
		
		var news=false;
		var select_ch=1;
		var focus_content=id;
		var theform=window.document.getElementById('poll_en' + focus_content );
		for (i=0; i<theform.elements.length; i++){
				for (i=0; i<theform.elements.length; i++){
						if (theform.elements[i].type=="radio")
							{
									if (theform.elements[i].checked==true)
										{
												news=true;
												select_ch=theform.elements[i].value;
										}
							}
				}						
		}	
	if (news)
		{
						window.document.getElementById('poll_content' + focus_content).innerHTML="<img src=http://media.impaqmsn.com/engine/load.gif border=0>"
						window.document.getElementById('bu_poll' + focus_content).disabled=true;		
						window.document.getElementById('bu_re' + focus_content).disabled=true;	
						get(select_ch,focus_content);
						setCookie('main_poll',focus_content,1);
			}
	else
		{ 
						alert('Select  ?');
			}
} 

 var httpRequest = false;
   function makePOSTRequest(url, parameters) {
									if (window.XMLHttpRequest) { 
											httpRequest = new XMLHttpRequest();
										} 
									else if (window.ActiveXObject) { 
											try {
												httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
												} 
												catch (e) {
																   try {
																		httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
																	   } 
																	 catch (e) {
																		 }
															}
											}
										if (!httpRequest) {
											alert('Giving up :( Cannot create an XMLHTTP instance');
											return false;
										}
		
					httpRequest.onreadystatechange = alertContents;
					httpRequest.open('GET',url + '?' + parameters , true);
					httpRequest.send(null);

   }

   function alertContents() {
	  var message;
	  var message_other;
      if (httpRequest.readyState == 4) {
         if (httpRequest.status == 200) {
         
            
			result = httpRequest.responseText;
			
			if (result.match("0")=="0")
				{
					 new_a=result.split(':0:');
					 window.document.getElementById('poll_content' + new_a[0]).innerHTML =new_a[1];  
					 window.document.getElementById('bu_poll' + new_a[0]).style.display='none';		
					 window.document.getElementById('bu_re' + new_a[0]).style.display='none';
				}          
         } else {
            alert('There was a problem with the request.');
         }
      }
   } 
   
   function get(choice,focus_content) {
	  var rnd = Math.random();
      var poststr = "id=" + encodeURI( focus_content ) +
                    "&choice=" + encodeURI( choice) + "&rnd=" + rnd;
	  makePOSTRequest('http://media.impaqmsn.com/engine/poll.aspx', poststr);
   }
     function get_nochoice(focus_content) {
	  var rnd = Math.random();
      var poststr = "id=" + encodeURI( focus_content ) + "&rnd=" + rnd;
	  makePOSTRequest('http://media.impaqmsn.com/engine/poll.aspx', poststr);
   }
var chk=getCookie('main_poll');
if (!(isNaN(chk)))
	{
			if (chk!='')
			{
				get_nochoice(chk);	
			}
	}