var arr_cells_busy  = new Array(36,37,38,39,46,47,48,49,56,57,58,59,66,67,68,69);
var arr_cells = new Array();

	function celle_selected(t){
		t.className='td_selected';
		if (!is_uniq(t.id))return 0;
		if (is_neighbour(t.id)){
			$('register').appear();
		}
		else
		{
			alert('Please select contiguous pixel');
			//alert(t.id)
			//debug();
			t.className='td';
			return 0;
		}
		c = arr_cells.length;
		arr_cells[c] =t.id ;
		$('pixel').innerHTML = (c+1)*100 + 'euros';
		
		//alert(arr_cells.length); $('ap ear_demo').hide()
	}
	
	function celle_selected_busy(t)
	{
		//parent.window.location.href = "http://superkopf.com/";
		window.open('http://superkopf.com/','mywindow','width=900,height=690');
	}
	
	function arrToStr()
	{
		result = '';
		for (var i = 0; i < arr_cells.length; ++i)
		{
					result =result + arr_cells[i]+';';	
		}
		return result;
	}
	
	function in_array(v,arr)
	{
		result = false;
		for (var i = 0; i < arr.length; ++i)
		{
			if (arr[i] == v) {result = true; break;}
		}
		return result;
	}
	
	function is_neighbour(id)
	{
		result = false;
		if (arr_cells.length == 0)result = true;
		for (var i = 0; i < arr_cells.length; ++i)
		{
			if ( Math.abs(arr_cells[i] - id) == 1  || Math.abs(arr_cells[i] - id) == 10 || Math.abs(arr_cells[i] - id) == 100)
			{
					result = true;
			}	
		}
		return result;
	}
	
	function is_uniq(id)
	{
		result = true;
		for (var i = 0; i < arr_cells.length; ++i)
		{
			if (arr_cells[i] == id)
			{
					result = false;
			}	
		}
		return result;
	}
	
	function res()
	{
		for (var i = 0; i < arr_cells.length; ++i){
			$(arr_cells[i]).className = 'td';
		}
		arr_cells = new Array();
		$('pixel').innerHTML = '';
		Element.hide('form_inquiry');
	}
	
	function send()
	{
		  var d = document;
		  if (d.getElementById('agb').checked == false)
		  {
		    alert ('ATTENTION!Please read the General Service Conditions of Super.Info Pixel Advertisement and agree to it.');
		  	return false;
		  }	
		document.getElementById('pixel_ids').value = arrToStr();
		document.f1.submit();
	}