function IsEmpty (txt){ var c,i; if (txt == "") return true; for (i=0; i<txt.length; i++) { c = txt.charAt(i);  if ( c!=" " && c!="\n" && c!="\t" && c!="\r") return false; } return true; }

function openWindow(theURL, winName, features) {
   new_window = window.open(theURL,winName,features);
}

function runOnLoad(){
   //restoreFields();
}

function getCookie(Name){
    var search = Name + "=";
    if (document.cookie.length > 0) {
        offset = document.cookie.indexOf(search);
        if (offset != -1) {
            offset += search.length;
            end = document.cookie.indexOf(";", offset);
            if (end == -1) { end = document.cookie.length; }
            return unescape(document.cookie.substring(offset, end));
        }
    }
    return null;
}

function restoreFields(){
    var eles=new Array("login","name","organisation","address","phone","www","email");

    for(z=0;z<document.forms.length;z++){
      for(i=0;i<eles.length;i++){
         if (document.forms[z].elements[eles[i]]){
            if (document.forms[z].elements[eles[i]].value != "") continue;
            lastVal = getCookie(eles[i]);
            if (typeof(lastVal) == "string") {
               val = lastVal.substr(lastVal.indexOf(",") + 1);
               document.forms[z].elements[eles[i]].value = val;
            }
         }

      }
    }
}
