function check_event(element_,event_)
	{
  		if(event_.type=='change')
  		{
    		if(element_.value.length==2)
    		{
    			document.getElementById('save').click();
    		}
    		else element_.value = '';
    	}
 	}
 	function check_reset(action)
 	{
		if(action=='Reset') input_box_ = confirm('Are you sure you want to reset and lose all your changes?');
		else if(action=='New') input_box_ = confirm('Create a new puzzle - Continue?');
		if(input_box_) return true;
		else return false;
 	}
 function ajaxFunction(action,puzzle_id,hint_count)
	{							
		var xmlHttp;
		try
  		{  // Firefox, Opera 8.0+, Safari  
  			xmlHttp=new XMLHttpRequest();  
  		}
		catch (e)
  		{  
  			// Internet Explorer  
  			try
    		{    
    			xmlHttp=new ActiveXObject('Msxml2.XMLHTTP');    
    		}
  			catch (e)
    		{    
    			try
      			{      
      				xmlHttp=new ActiveXObject('Microsoft.XMLHTTP');      
      			}
    			catch (e)
      			{      
					alert('Your browser does not support AJAX!'); 
      				return false;      
      			}    
      		}  
    	} 
    	    	 
    	xmlHttp.onreadystatechange=function()
    	{
    		if(xmlHttp.readyState==4)
      		{
      		//clipboardData.setData("Text",xmlHttp.responseText);
      		document.body.style.cursor = 'auto'; 
      		document.getElementById('left').innerHTML = xmlHttp.responseText;
      		}
    	}
    	
    	var post = true;
    	if (action=='Reset'|action=='New')
    	{
    		post = check_reset(action); 
    	}
    	
    	if(post)
    	{
    		var puzz_string = '';
    		var cellval = '';
    		//var hint_count = 0;   	
    		//var puzzle_id = puzzle_id;

			for (var x = 0; x <= 80; x++)
			{
				cellval = document.sudoku.elements[x].value;
				if(cellval== '') cellval = '..';
				puzz_string = puzz_string+cellval;
			}
			
			if(action=='Solve'||action=='Step'||action=='Hint')
			{
				for (var x = 81; x <= 87; x++)
				{
					document.sudoku.elements[x].disabled = true;
				}
			}
			
    		var post_string = 'puzzle.php?action='+action+'&trans_string='+puzz_string+'&hint_count='+hint_count+'&puzzle_id='+puzzle_id;
  			document.body.style.cursor = 'wait';
  			xmlHttp.open('GET',post_string,true);
  			xmlHttp.send(null);
  		}
  		return false;
   	};