/* prototype.js includen */
document.write('<'+'script type="text/javascript" src="/admin/js/scriptaculous/prototype.js"><'+'/'+'script'+'>');

function addToList(id, titel) {
  new Ajax.Request('/maschinen/ajax.php', { method: 'post',
                                            parameters:
                                            {
                                              action: 'add',
                                              id: id,
                                              titel: titel
                                            },
                                            onComplete: function(t)
                                            {
                                              //$('merkliste'+id).innerHTML = 'auf Merkliste';
                                              //$('merkliste'+id).style.background = '#ffffff';
                                              //$('merkliste-count').innerHTML = t.responseText;
                                              window.location.reload();
                                            }
                                          } );
  return false;
}

function delFromList(id) {
  var id = id;
  new Ajax.Request('/maschinen/ajax.php', { method: 'post',
                                            parameters:
                                            {
                                              action: 'del',
                                              id: id
                                            },
                                            onComplete: function(t)
                                            {
                                              window.location.reload();
                                            }
                                          } );
  return false;
}

function htmlPopup(imageloc, width, height, scroll, title) {
  if(width != null && height != null && scroll != null) {
    HTML = "<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>\n"+
           "<html><head>"+
           "<meta http-equiv='content-type' content='text/html; charset=UTF-8'>\n"+
           "<title>"+title+"</title>\n"+
           "<style>body,html{margin:0;padding:0;background-color:#FFFFFF;}</style></head>"+
           "<body><img src='"+ imageloc +"' alt='' border='0' /><br /></body>\n"+
           "</html>";

    if (typeof(popupImage) != "undefined") {
      /*
      if (self.innerHeight && popupImage.innerHeight) {
        popupImage.innerWidth=width;
        popupImage.innerHeight=height;
      }
      else {
        popupImage.close();
      }
      */
      popupImage.close();
    }

    popupImage = window.open("",'htmlpopup','width='+width+',height='+height+',screenX=25,screenY=25,left=25,top=25,toolbar=no,scrollbars='+scroll+',resizable=yes,status=no,menubar=no,directories=no,location=no,dependent=yes');
    popupImage.document.open();
    popupImage.document.write(HTML);
    popupImage.document.close();
    popupImage.focus();
  }
}

function addToListMerkliste(id, titel) {
  new Ajax.Request('/maschinen/ajax.php', { method: 'post',
                                            parameters:
                                            {
                                              action: 'add',
                                              id: id,
                                              titel: titel
                                            },
                                            onComplete: function(t)
                                            {
                                              //window.location.reload();
                                            }
                                          } );
  return false;
}
