function checkNames(obj, name){
	if (obj.value.length>0 && obj.value.search('^ +$')==-1)
		return true;
	else{
		alert('Value of '+name+' must be filled.');
		obj.focus();
		return false;
	}
}
function checkArea(charnum, areaName){
	if (areaName.value.length>charnum){
		var str='';
		for(var i=0; i<charnum; i++)
			str+=areaName.value.charAt(i);
		areaName.value=str;
	}
};
function checkDecimal(obj,name) {
	pos=obj.value.search('^[0-9]+[\.]?[0-9]*$');
	if (pos<0){
		alert('Value of '+name+' must be decimal: '+obj.value);
		obj.focus();
		return false;
	}
	return true;
};
function checkInteger(obj,name) {
	pos=obj.value.search('^[0-9]*$');
	if (pos<0){
		alert('Value of '+name+' must be integer: '+obj.value);
		obj.focus();
		return false;
	}
	return true;
};
function yesno(message,destination){
	if (confirm(message)){ self.location.href = destination; }
};
function yesnosubmit(message,form){
	if (confirm(message)){form.submit();}
};
function popup(n,w,h){
	if (!n) n="popup";
	if (!w) w=560;
	if (!h) h=550;
	var win=window.open("",n,"width="+w+",height="+h+",toolbar=no,location=no,scrollbars=yes,menubar=no,status=no,resizable=yes");
	var dx = 20;//(win.outerWidth);
	var dy = 20;//(win.outerHeight);
//	alert("dx="+dx);
//	alert("dy="+dy);	
	win.resizeTo(w+dx,h+dy);
//	alert("new height="+w);
//	alert("new width="+h);	
//	win.moveTo(100,0);
	win.focus();
	return win;
}

function clear_search(f) {
	var e = f.elements;
	e.author.value='';
	e.title.value='';
	e.publisher.value='';
	e.datePublishedStart.value='';
	e.datePublishedEnd.value='';
	e.keyword.value='';
	e.hardback.checked=false;
	e.firstEdition.checked=false;
	e.signed.checked=false;
	e.dustjacket.checked=false;
	e.priceStart.value='';
	e.priceEnd.value='';
}

function clear_enquiry(f) {
	var e = f.elements;
	e.request.value='';
	e.customerSalutation.value='';
	e.postalCountry.value='';
	e.email.value='';
	e.customerFirstName.value='';
	e.customerLastName.value='';
	e.postalAddress.value='';
	e.postalCity.value='';
	e.postalState.value='';
	e.postalCode.value='';
	e.phoneNumber.value='';
	e.faxNumber.value='';
}

function minimize(wnd) {
	wnd.blur();
}
