function update_carname(url)
  {
	var option = document.getElementById('maker').value;
	
	if (url.indexOf("?") == -1) url = url + '?maker_id=' + option;
	new Ajax.Request(
		url, {
			asynchronous    : false,
			onComplete: function handle(transport)
			{
				var populate = $('carname');
				populate.update(transport.responseText);
				var populate = $('model');
				populate.update('');
//				var populate = $('submit');
//				populate.update('<input type="submit" name="submit" value="SEARCH" disabled />');
				carname_loaded = 1;
			}
			
					
		}
	);
    
  }
  
function update_model(url)
  {
	var option_1 = document.getElementById('maker').value;
	var option_2 = document.getElementById('carname').value;
	
	if (url.indexOf("?") == -1) url = url + '?maker_id=' + option_1 + '&carname_id=' + option_2;
	else $ok = 1;
	new Ajax.Request(
		url, {
			onComplete: function handle(transport)
			{
				var populate = $('model');
				populate.update(transport.responseText);
//				var populate = $('submit');
//				if (url.indexOf("model_id") != -1 || (option_1 != "" && option_2 != "")) {
//					populate.update('<input type="submit" name="submit" value="SEARCH" />');
//				}
//				else
//				{
//					populate.update('<input type="submit" name="submit" value="SEARCH" disabled />');
//				}
			}
			
					
		}
	);
    
  }

function open_newwin(set_url,xx,yy){
	window.open(set_url, 'subwindow','width='+xx+',height='+yy+
				',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,favorites=no,resizable=yes');
}

function input_budget(id, deposit, s_price, b_price) {
//	if (deposit < 10000) {
//		alert("Sorry.\nYour deposit is not enough.");
//		return;
//	}
	
	balance = deposit * 5;
	if (balance < b_price) {
		alert("Sorry.\nYour deposit is not enough.");
		return;
	}
	
	if (b_price < s_price) {
		alert("Please input the amount above start price(" + s_price + "JPY).");
		return;
	}
	
	location.href = 'a_detail.php?fnc=bid&id=' + id + '&bid=' + b_price;
}

function remove_fav(id)
{
	if(window.confirm('Do you remove ID:' + id + ' from favorite list?')){

		location.href = 'a_search.php?id=' + id + '&fnc=remfav';

	}
}

function cancel_bid(id)
{
	if(window.confirm('Do you cancel ID:' + id + ' from bid list?')){

		location.href = 'a_search.php?id=' + id + '&fnc=cancelbid';

	}
}

function request_trans(id)
{
	if(window.confirm('Do you request transration ID:' + id + ' ? (Yen 1000/car)')){

		location.href = 'a_detail.php?id=' + id + '&fnc=reqtrans';

	}
}

function remove_alert(id)
{
	if(window.confirm('Do you remove Alert ID:' + id + ' from My Auction Alerts List?')){

		location.href = 'a_alert.php?id=' + id + '&fnc=del';

	}
}
