var popwin=null;
var searchready=false;

function trim(s) {return s.replace(/^\s+|\s+$/g,'');};

function picpop(id,x,y) {
 if (popwin && !popwin.closed) {popwin.close();};
 popwin=window.open('picpop.php?id='+id+'&x='+x+'&y='+y,'','width='+x+',height='+y+',scrollbars=no,resizable=no,menubar=no,status=no,directories=no,location=no,toolbar=no');
 };

function initsearch(txt) {
 o=document.hakulomake.haku;
 o.style.color='#AAAAAA';
 o.value=txt;
 o.blur();
 };

function clearsearch() {
 o=document.hakulomake.haku;
 o.style.color='#000000';
 o.value='';
 return true;
 };

function checkfields(a) {
 for (var x=0; x<a.length; x++) {
  var i=document.getElementsByName(a[x]);
  if (i.length) {
   i[0].value=trim(i[0].value);
   if (i[0].value=='') {
    i[0].select();
    return i[0].title;
    };
   };
  };
 return true;
 };
