function ch_open_window(win_name,winheight,winwidth,url) {  if (win_name==null) win_name='pic';  if (winheight==null) winheight='400';  if (winwidth==null) winwidth='550';  if (url==null) url='';  var things_to_show = 'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width='+winwidth+',height='+winheight;  window.open(url,win_name,things_to_show);}function ch_field_focus(theform,thefield) {  if (document.forms[theform].elements[thefield]) {    document.forms[theform].elements[thefield].focus();  }}function ch_toggle_visibility(element_id,display_value) {	if (display_value == null ) display_value = 'block' ;	if (document.getElementById) {		current_value = document.getElementById(element_id).style.display;		document.getElementById(element_id).style.display = (current_value == 'none' ? display_value : 'none');	}}function ch_disable_submit(form_name,button_name,msg) {	button_ref = document.forms[form_name].elements[button_name];	button_ref.disabled = true;	if (msg != null) {		// button_ref.value = msg;		button_ref.value = 'Please wait ...';	}	return true;}function ch_set_image_width_class() {	if (document.getElementById && document.getElementById('ch_lot_main_img')) {		element_ref = document.getElementById('ch_lot_main_img');		the_width = element_ref.getElementsByTagName('img')[0].offsetWidth;		if (the_width < 200 ) {			element_ref.className='ch_lot_img_sub_200';		} else if (the_width < 300) {			element_ref.className='ch_lot_img_sub_300';		} else if (the_width < 400) {			element_ref.className='ch_lot_img_sub_400';		} else if (the_width < 500) {			element_ref.className='ch_lot_img_sub_500';		} else {			element_ref.className='ch_lot_img_500_plus';		}	}}function ch_field_select(theform,thefield) {  if (document.forms[theform].elements[thefield]) {    document.forms[theform].elements[thefield].select();  }}function ch_set_fi(my_lot) {	document.getElementById('ch_my_lots_update').action += ('#ch_lot_' + my_lot) ;	return true;}function ch_check_bid_values() {	form_ref = document.forms.ch_bid_form;	some_bids = false;	missing_bids = 0;	for (i = 0; i < form_ref.elements.length; i++) {		this_input = form_ref.elements[i];		if ( this_input.name.match(/^lot_\d+[a-z]?$/) ) {			if ( this_input.value == '0' || this_input.value == '' || this_input.value == null ) {				missing_bids += 1;			} else if ( this_input.value.match(/^\s*\d+\s*$/) ) {				some_bids = true;			} else {				alert('Bid values must be entered as round numbers without any punctuation. For example "1500", but not "1,500" or "1500.0".');				this_input.focus();				this_input.select();				return false;			}		}	}	if (! some_bids) {		alert('You have not entered any bids.');		return false;	}	if (missing_bids) {		return confirm('You have not entered any bid for ' + missing_bids + ' of your lots. Are you sure you wish to continue?');	} else {		form_ref.elements.javascript_on.value = '1';		return true;	}}function ch_check_bid_contact_info() {	var form_ref = document.forms.ch_bid_form;	return true;}function email_link(email_id,char_numbers) {	eval('addr = String.fromCharCode(' + char_numbers + ')');	email_link = document.createElement('a');	email_link.href=('mai' + 'lto:' + addr);	email_link.appendChild(document.createTextNode(addr));	document.getElementById(email_id).replaceChild( email_link, document.getElementById(email_id).childNodes[0] );}function ch_ml_ajax_init() {	jQuery(document).ready(function(){			jQuery("#ch_my_lots_update input[type='submit']").bind("click",			function(){				var input_ref = this;				var postdata = ("update_my_lots=1&" + input_ref.name + "=" + escape(input_ref.value));				var original_value = input_ref.value ;				var lot_no = input_ref.name.match(/\d+[a-z]?/) ;				input_ref.value="Updating - please wait";				input_ref.disabled=true;				jQuery.ajaxQueue({					type: "POST",					url: "ajax",					data: postdata,					timeout: 3000,					dataType: "json",					success: function(result){						input_ref.value = original_value.replace( /^\w+ \w+/g, (result[0].my_lots=="true"?"Remove from":"Add to") );						input_ref.disabled=false;						// jQuery("#ch_page_my_lots #ch_lot_" + lot_no).fadeOut("slow");					},					error: function(xhr,textStatus){						var orig_val_arr = original_value.split(/\s+/) ;						alert( "Sorry, it was not possible to " + orig_val_arr[0].toLowerCase() + " lot " + lot_no + " " + orig_val_arr[1] + " your 'my lots' list because an error occurred on the server." + (textStatus!=null?("\n\n("+textStatus+")"):"") );						input_ref.value = original_value;						input_ref.disabled=false;					}				});				return false;			}		);		});}