function write_results() 
{
eid =  $('#eid').val();
qcount =  $('#qcount').val();
result = 0 ;
cookiedata = '{ ';
for (i=1;i<=qcount;i++)
	{
	var vote = $('select[name=r'+eid+'q'+ i +']').val();
	var answer = $('input[name=r'+eid+'a'+ i +']').val();
	
	if (vote == answer)
	{
		$('select[name=r'+eid+'q'+ i +']').css({background:"#129f07"});
		} else{
		$('select[name=r'+eid+'q'+ i +']').css({background:"#d21f1f"});		
	
	}
	if (vote == answer)
		{
		result = Number(result + 1);
		}
	cookiedata = cookiedata + '"q'+ i + '": "'+ vote +'",' ;
	
	}
	
cookiedata = cookiedata + ' } ';
$("#noymero_bathmos").empty();
$("#noymero_bathmos").text(result+'/'+qcount);
window.localStorage['results'+eid] = cookiedata ;
//setScoreResult(result, qcount, document.getElementById("noymero_bathmos"));

}

function read_results() 
{	
eid =  $('#eid').val();
//results = $.cookie('results'+eid); 
results  = window.localStorage['results'+eid]
if (results != null)
	{
	var result = jsonParse(results);
	for (var k in result) 
		{
		if (result[k] != 'undefined')
			{
			$('select:[name=r'+eid+ k +']').val(result[k]);
  			}
		}
	}
}

function resolve() 
{
eid =  $('#eid').val();
qcount =  $('#qcount').val();
for (i=1;i<=qcount;i++)
	{
	var answer = $('input[name=r'+eid+'a'+ i +']').val();
	$('select:[name=r'+eid+'q'+ i +']').val(answer);
	}
}