function disp_buy_confirm(game,field,price,is_game_member){
	if (is_game_member){
		var r=confirm("Do you wish to buy this cell? This will cost to you "+price+"$");
		if (r==true){
			document.location.href="buy_field.php?game="+game+"&field="+field;
		}
	}else{
		alert('You must be a game member to buy cells');
	}
}

function disp_cancel_confirm(game,field){
	var r=confirm("Do you wish to cancel this cell?");
	if (r==true){
		document.location.href="cancel_field.php?game="+game+"&field="+field;
	}
}

function onUserCosts(){
	var uc = document.getElementsByName('user_costs');
	var box = document.getElementsByName('box_costs'); 
	
	if (box[0].value == -1){
		$('us_cost').style.display = 'block';
	}else{
		$('us_cost').style.display = 'none';
	}
}

function getDates (){
	var obj; 
	obj = document.getElementsByName('teams[1]'); 
	var schedule_id = obj[0].value;

	$('schedule').innerHTML = 'Please wait few seconds ...';
    $('schedule').style.color = '#009'; 
	
	var url = root+'/ajax/get_schedules.php?schedule_id='+schedule_id;
	new Ajax.Request(url, {
  		method: 'get',
	  	onSuccess: onSuccessGetDates 
	});	
	return false;
}

function onSuccessGetDates(response, data){
	$('schedule').innerHTML = response.responseText;
}