function vote(voteID)
{
	var value = 0;
	var len = document.voteForm.voteOption.length;
	for (var i=0;i<len;i++)
	{
		if (document.voteForm.voteOption[i].checked)
			value = document.voteForm.voteOption[i].value;
	}
	
	window.open('includes/class/voting.php?vote&answerId='+value+'&lastVoteID='+voteID, 'Voting', 'width=400 height=200');	
}

function vote_results(voteID)
{
	var value = 0;
	var len = document.voteForm.voteOption.length;
	for (var i=0;i<len;i++)
	{
		if (document.voteForm.voteOption[i].checked)
			value = document.voteForm.voteOption[i].value;
	}
	
	window.open('includes/class/voting.php?results&answerId='+value+'&lastVoteID='+voteID, 'Voting', 'width=400 height=200');	
}

function previous_results()
{
	window.location = 'previous_votings.php';	
}

function validnumbersonly(myfield, e, dec)
{
var key;
var keychar;

if (window.event)
   key = window.event.keyCode;
else if (e)
   key = e.which;
else
   return true;
keychar = String.fromCharCode(key);

// control keys
if ((key==null) || (key==0) || (key==8) ||
    (key==9) || (key==13) || (key==27) )
   return true;

// numbers
else if ((("0123456789.").indexOf(keychar) > -1))
   return true;

// decimal point jump
else if (dec && (keychar == "."))
   {
   myfield.form.elements[dec].focus();
   return false;
   }
else
   return false;
}

	function checkRadio(Obj)
	{
	for(var i=0;i<Obj.length;i++)
	{
		if(Obj[i].checked) 
		{
			return true;	
		}
	}
     	return false;
	}
	
function openSendMail(id)
	{
	var blankWin = window.open('send.php?id='+id+'', '', 'width=400,height=470,menubar=no');	
	}
	
function openPrint(id)
	{
	var blankWin = window.open('print.php?id='+id+'', '', 'width=600,height=600,menubar=no,scrollbars=yes');		
	}
	
function validate_subscriber(form)
{
if(form.email.value=="")
   {
     form.email.focus();
     alert('Please make sure that you have entered a valid "Email"');
     return(false);
    }
	else {
		var xx=0;
			xx=form.email.value.indexOf("@",1)
			if (xx==-1)
				{ 	alert("Invalid E-mail");
					form.email.focus();
					return(false);
				}
			xx=form.email.value.indexOf(".",1)
			if (xx==-1)
				{	alert("Invalid E-mail");
					form.email.focus();
					return(false);
				}
	}
	
}