function checkNames(obj, name){
	if (obj.value.length>0 && obj.value.search('^\\s+$')==-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('^\\s*[0-9]+[\\.]?[0-9]*\\s*$');
	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('^\\s*[0-9]*\\s*$');
	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 popup2(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=yes,resizable=yes");
    var dx = 20;
    var dy = 20;
    win.resizeTo(w+dx,h+dy);
    win.focus();
    return win;
}


function clear_search(f) {
	var e = f.elements;
	if (e.author) e.author.value='';
	if (e.title) e.title.value='';
	if (e.publisher) e.publisher.value='';
	if (e.datePublishedStart) e.datePublishedStart.value='';
	if (e.datePublishedEnd) e.datePublishedEnd.value='';
	if (e.keyword) e.keyword.value='';
	if (e.hardback) e.hardback.checked=false;
	if (e.firstEdition) e.firstEdition.checked=false;
	if (e.signed) e.signed.checked=false;
	if (e.dustjacket) e.dustjacket.checked=false;
	if (e.priceStart) e.priceStart.value='';
	if (e.priceEnd) 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 clear_enquiry2(f) {
	var e = f.elements;
	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();
}

