// JavaScript Document


display_row = 'table-row';
if (document.all) { 
	display_row = 'block';
} 

var is_f = 'none';
function toggle(id){
  if(is_f == 'none'){
	$('#'+id).show('slow');
	is_f = '';
  }else{
	$('#'+id).hide('slow');
	is_f = 'none';
  }
}
ibsco_search = {
	ibsco : '',
	current: '',
	value: '',
	id: '',
	other_value: '',
	check_value : function(val,id){
		if(isNaN(val) && val != '.'){
			alert("Please Enter Decimal Values Only");
			$(id).value=val.substring(0,val.length-1);
		}
		if(val == '') return;
		this.value=val;
		this.other_value = (id == 'inner_diameter') ? 'outer_diameter_range' : 'inner_diameter_range';
		this.id=id;
		this.search_ibsco();
	},
	 search_ibsco : function(){
		var url = 'ibsco_ajax.php';
		var meas = $('in').checked ? 'in' : 'mm'; //+ " " + $('mm').checked);
		var pars = this.id + '=' + this.value + '&meas=' + meas;
		var myAjax = new Ajax.Request(
			url, 
			{
				method: 'post', 
				parameters: pars, 
				onComplete: showResponse
			});
	}
}
function showResponse(originalRequest){
	//put returned XML in the textarea
	$(ibsco_search.other_value).innerHTML = originalRequest.responseText;
}
