<!--
document.onselectstart = new Function("return false");

var isCursorOver = new Boolean()
isCursorOver = false

var preSelected = ""
var selId = ''
var selName = ''
var selIsbn = ''

var curRow = '';
var curClassName = '';

function selectRow(row, selectedId, selectedName, selectedIsbn) {
	if (curRow != '') {
		curRow.className = curClassName;
	};
	
	selId = selectedId;
	selName = selectedName;
	selIsbn = selectedIsbn;
	
	curRow = row;
	curClassName = row.className;
	row.className = 'gridrowselected';

	if (document.edit) { document.edit.src = '../img/edit.gif' }
	if (document.del) { document.del.src = '../img/delete.gif' }
	if (document.uitleen) { document.uitleen.src = '../img/uitleen.gif' }
	if (document.image) { 
	  if (selIsbn.length != 0) {
	    document.image.src = '../img/image.gif'
	  } else {
	    document.image.src = '../img/image_disabled.gif'
	  };
  };
};

function openDialog(url, name, width, height) {
  x = (screen.width - width) / 2;
  y = (screen.height - height) / 2;

  window.open(url, name, 'toolbars=0, status=0, resizable=0, scrollbars=0, width=' + width + ', height=' + height + ', screenX=' + x + ', left=' + x + 'screenY=' + y + ', top=' + y);
};

function showImage() {
  if (selIsbn.length != 0) {
    openDialog('http://www.powells.com/cgi-bin/imageDB.cgi?isbn=' + selIsbn, 'dialog', 180, 240);
  }
}

function addBook() {
  openDialog("dialogs/addBook.asp","editor",380,300);
};

function editBook() {
  if (selId.length != 0) {
    openDialog("dialogs/editBook.asp?bookId=" + selId,"editor",380,300);
  };
};

function editDeleted() {
  if (selId.length != 0) {
    openDialog("dialogs/editDeleted.asp?bookId=" + selId,"editor",380,320);
  };
};

function deleteBook() {
  if (selId.length != 0) {
	  if (confirm('Weet je zeker dat je "' + selName + '" wilt verwijderen?')) {
      openDialog("dialogs/delBook.asp?bookId=" + selId,"editor",380,120);
    };
  };
};

function deleteDeleted() {
  if (selId.length != 0) {
	  if (confirm('Weet je zeker dat je "' + selName + '" wilt verwijderen?')) {
      openDialog("dialogs/delDeleted.asp?bookId=" + selId,"editor",380,120);
    };
  };
};

function uitleenBook() {
  if (selId.length != 0) {
    openDialog("dialogs/uitleenBook.asp?bookId=" + selId + '&titel=' + selName,"editor",320,160);
  };
};

function checkUitleenBook() {
  el = document.getElementById('titel');
  if (!(el)) {
    return false;
  };
  
  if ((el) && (el.value == '')) {
    alert('Voer een titel in!');
    return false;
  };

  el = document.getElementById('lener');
  if (!(el)) {
    return false;
  };
  
  if ((el) && (el.value == '')) {
    alert('Selecteer een naam!');
    return false;
  };
}

function addLener() {
  el = document.getElementById('lener');
  if (el) {
    var name = prompt('Voer naam in:', '');
    if (!((name=='')||(name==null))) {
      addToList(el, name, name);
    };
  }
}

function addToList(listField, newText, newValue) {
  if ( ( newValue == "" ) || ( newText == "" ) ) {
    alert("You cannot add blank values!");
  } else {
    var len = listField.length++; // Increase the size of list and return the size
    listField.options[len].value = newValue;
    listField.options[len].text = newText;
    listField.selectedIndex = len; // Highlight the one just entered (shows the user that it was entered)
  } // Ends the check to see if the value entered on the form is empty
}

function addAuteur() {
  openDialog("dialogs/addAuteur.asp","editor",360,120);
}

function editAuteur() {
  if (selId.length != 0) {
    openDialog("dialogs/editAuteur.asp?autId=" + selId,"editor",360,120);
	};
}

function deleteAuteur() {
  if (selId.length != 0) {
	  if (confirm('Weet je zeker dat je "' + selName + '" wilt verwijderen?')) {
      openDialog("dialogs/delAuteur.asp?autId=" + selId,"editor",380,120);
    };
  };
};

function addCat() {
  openDialog("dialogs/addCat.asp","editor",360,120);
}

function editCat() {
  if (selId.length != 0) {
    openDialog("dialogs/editCat.asp?catId=" + selId,"editor",360,120);
	};
}

function deleteCat() {
  if (selId.length != 0) {
	  if (confirm('Weet je zeker dat je "' + selName + '" wilt verwijderen?')) {
      openDialog("dialogs/delCat.asp?catId=" + selId,"editor",380,120);
    };
  };
};

function login(url) {
  openDialog("dialogs/login.asp?url=" + url,"editor",320,160);
};

function logoff() {
  if (confirm('Weet je zeker dat je wilt uitloggen?')) {
	  openDialog("dialogs/logoff.asp","editor",360,150);
	};
};

function closeDialog() {
  try {
    opener.document.location.reload();
  } 
  catch(exception) {
  };
  self.close();
};
//-->
