/* ### WIN OPEN ### */
function showPic (filename, headline) {  
  window.open (filename, headline, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=600, height=600, left=10, top=10')
}

/* ### PRINT ### */
function print_view (query) {
  window.open ('print.php?'+query, 'Druckansicht', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=568, height=800, left=5, top=5');
}

/* ### OPEN CHAT WINDOW ### */
function openChat (filename, headline) {  
  window.open (filename, headline, 'toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=700, height=600')
}

/* ### PRELOAD IMAGES ### */
function preLoadImages () {
  document.Preload = new Array();
  if (document.images) {
    for (var i=0; i<preLoadImages.arguments.length; i++) {
      document.Preload[i] = new Image();
      document.Preload[i].src = preLoadImages.arguments[i];
    }
  }
}

/* ### CHECK ACCESS ### */
function checkAccess (zustand, sendForm) {
  if (zustand.checked == true)
    sendForm.disabled = false;
  else
    sendForm.disabled = true;
}

/* ALERT INFO */
function alertInfo (page, title, target) {
 	var antwort = confirm(title);
	if (antwort == true) {
    if (target == '_blank')
      newWin = window.open(page, "Bestätigung", "left=100,top=100,width=100,height=100,scrollbars=no");
    else
 		  location.href = page;
  }
}

/* CHECK CONTENT */
function checkInhalt () {
  var data = document.forms['form'];   
  if (data.elements['title'].value == '') {
    alert('Bitte geben Sie einen Titel ein!');
    data.elements['title'].focus();
    return false;
  }
  for (i=1; i<=20; i++) {
    if (((data.elements['link'+i+'_name'].value == '') || (data.elements['link'+i+'_type'].value == '') || (data.elements['link'+i+'_link'].value == ''))) {
      alert('Bitte geben Sie einen vollständigen Link ein!');
      data.elements['link'+i+'_name'].focus();
      return false;
    }
  }
}

/* REMAINING CHARS */
function RemainingChars (maxLength, field, lengthField) {
  var temp = document.getElementById(field);
  len = temp.value.length;
  if (len > maxLength) {
    temp.value = temp.value.substring(0,maxLength);
    left = 0;
  }
  else
    left = maxLength - len;
  myLenField = document.getElementById(lengthField);
  myLenField.value=left;
}