/**
 * クイックサーチ
 *
 */
function q_registed( n ){

	var obj = document.quick_registed;
	
	obj.registed_from.value = n;
	obj.submit();
	return;
}
function q_rent( n ){

	var obj = document.quick_rent;
	
	if( n == 0 ){
	
		obj.rent_from.value = "";
		obj.rent_to.value   = "20";
	}
	else if( n == 20 ){
	
		obj.rent_from.value = "20";
		obj.rent_to.value   = "30";
	}
	else if( n == 30 ){
	
		obj.rent_from.value = "30";
		obj.rent_to.value   = "40";
	}
	else if( n == 40 ){
	
		obj.rent_from.value = "40";
		obj.rent_to.value   = "50";
	}
	else if( n == 50 ){
	
		obj.rent_from.value = "50";
		obj.rent_to.value   = "100";
	}
	else if( n == 100 ){
	
		obj.rent_from.value = "100";
		obj.rent_to.value   = "";
	}

	obj.submit();
	return;
}
function q_initial_cost( n ){

	var obj = document.quick_initial_cost;
	
	if( n == 0 ){
	
		obj.initial_cost_from.value = "";
		obj.initial_cost_to.value   = "500";
	}
	else if( n == 500 ){
	
		obj.initial_cost_from.value = "500";
		obj.initial_cost_to.value   = "700";
	}
	else if( n == 750 ){
	
		obj.initial_cost_from.value = "700";
		obj.initial_cost_to.value   = "1000";
	}
	else if( n == 1000 ){
	
		obj.initial_cost_from.value = "1000";
		obj.initial_cost_to.value   = "";
	}
	
	obj.submit();
	return;
}
function q_tsubo_unit( n ){

	var obj = document.quick_tsubo_unit;
	
	if( n == 0 ){
	
		obj.tsubo_unit_from.value = "";
		obj.tsubo_unit_to.value   = "15";
	}
	else if( n == 15 ){
	
		obj.tsubo_unit_from.value = "15";
		obj.tsubo_unit_to.value   = "25";
	}
	else if( n == 25 ){
	
		obj.tsubo_unit_from.value = "25";
		obj.tsubo_unit_to.value   = "40";
	}
	else if( n == 40 ){
	
		obj.tsubo_unit_from.value = "40";
		obj.tsubo_unit_to.value   = "";
	}
	
	obj.submit();
	return;
}
function q_area( id ){

	var obj = document.quick_area;
	
	var checkbox = obj.getElementsByTagName( "input" );
	var cache_line = new Array();
	
	for( var i=0; i<checkbox.length; i++ ){
	
		if( checkbox[i].name == "area" && checkbox[i].id == id ){
				
			var stations = checkbox[i].value.split( "," );
					
			for( var j=0; j<stations.length; j++ ){
					
				var params = stations[j].split( ":" );

				if( cache_line[ params[1] ] == undefined || cache_line[ params[1] ] == null ){
						
					cache_line[ params[1] ] = params[0];
							
					var hidden = document.createElement( "input" );
					hidden.setAttribute( "type", "hidden" );
					hidden.setAttribute( "name", "line_" + params[0] + "[]" );
					hidden.setAttribute( "value", params[1] );
					obj.appendChild( hidden );
				}
						
				var hidden = document.createElement( "input" );
				hidden.setAttribute( "type", "hidden" );
				hidden.setAttribute( "name", "station[" + params[1] + "][]" );
				hidden.setAttribute( "value", params[2] );
				obj.appendChild( hidden );
			}
		}
		else if( checkbox[i].type == "checkbox" ){
		
			checkbox[i].checked = false;
		}
	}
	
	document.getElementById( id ).checked = true;
	obj.submit();
	return;
}
function q_search_all(){

	var input = document.getElementById( "quick_search" ).getElementsByTagName( "input" );
	var obj   = document.quick_all;

	var cache_line = new Array();
	
	for( var i=0; i<input.length; i++ ){
	
		if( input[i].type == "checkbox" ){
		
			if( input[i].checked ){

				if( input[i].name == "area" ){
				
					var stations = input[i].value.split( "," );
					
					for( var j=0; j<stations.length; j++ ){
					
						var params = stations[j].split( ":" );

						if( cache_line[ params[1] ] == undefined || cache_line[ params[1] ] == null ){
						
							cache_line[ params[1] ] = params[0];
							
							var hidden = document.createElement( "input" );
							hidden.setAttribute( "type", "hidden" );
							hidden.setAttribute( "name", "line_" + params[0] + "[]" );
							hidden.setAttribute( "value", params[1] );
							obj.appendChild( hidden );
						}
						
						var hidden = document.createElement( "input" );
						hidden.setAttribute( "type", "hidden" );
						hidden.setAttribute( "name", "station[" + params[1] + "][]" );
						hidden.setAttribute( "value", params[2] );
						obj.appendChild( hidden );
					}
				}
				else{

					var hidden = document.createElement( "input" );
					hidden.setAttribute( "type", "hidden" );
					hidden.setAttribute( "name", input[i].name );
					hidden.setAttribute( "value", input[i].value );
					obj.appendChild( hidden );
				}
			}
		}
		else if( input[i].type == "radio" && input[i].checked && input[i].getAttribute("onClick") != undefined ){

			eval( input[i].getAttribute("onClick") );		
		}
		else if( input[i].name != "mode" && input[i].value != "" ){
		
			var hidden = document.createElement( "input" );
			hidden.setAttribute( "type", "hidden" );
			hidden.setAttribute( "name", input[i].name );
			hidden.setAttribute( "value", input[i].value );
			obj.appendChild( hidden );
		}
	}

	obj.submit();
	return;
}



