/* wmarks.js */
/* letzte Korrektur: 2005-06-27 */
/* einbauen: DHTML Secondary Windows 105 <<<<<<<< */

var screen_width = screen.width;
var screen_height = screen.height;
var winFeatures = "menubar=yes,resizable=yes,scrollbars=yes,status=yes";

function loadWmarkImg(imgbase,subdir_img,refnr,img_width,img_height) {
	// alert ("imgbase:"+imgbase + " subdir_img:"+subdir_img + " refnr:"+refnr + " img_width:"+img_width + " img_height:"+img_height);
  var newWindow;
	var fileName = refnr;
	// refnr AT5000-134_I* > > fileName AT5000-134_IS
	if (fileName.substr(fileName.length-1) == "*") {
		fileName = fileName.substr(0,fileName.length-1) + "S";
	}
	var docname = imgbase + subdir_img + fileName + ".jpg";
  // alert(docname); exit();
	var win_width = parseInt(img_width)+100;
  var win_height = parseInt(img_height)+350; 
  var winposX = parseInt(screen_width)-parseInt(win_width)-parseInt(img_width);
  var winposY = 30;
  var winSize = "width="+win_width+",height="+win_height;
  var winPos = "screenX="+winposX+",screenY="+winposY;     // NN
  winPos += "left="+winposX+",top="+winposY+"\"";          // MSIE

	newWindow = window.open("","",winFeatures + ", " + winSize + ", " + winPos);
  var destination = "loadWmarkImg.php?refnr_wm=" + refnr + "";
  // alert("destination: " + destination); 
  newWindow.location.href = destination;
  /*
      var newContent = "<html><head><title>" + refnr + "</title></head>\n";
	newContent += "<body><strong>" + refnr + "</strong>\n";
	newContent += "<img src='" + docname + "' name='" + refnr + "'>\n";
	newContent += "</body></html>";
	newWindow.document.write(newContent);
       */
	newWindow.document.close();
	newWindow.focus();
}	

function load_wm(IDwmarks) {
	alert('in Funktion wmarks.js - fc load_wm: Paramter IDwmarks: ' + IDwmarks);
	alert('TEST mit AT5000-448_43');
	//loadWmarkImg('http://www.ksbm.oeaw.ac.at/wzimages/imgjpg/','','AT5000-448_43','313','385')
	var imgbase = 'http://www.ksbm.oeaw.ac.at/wzimages/imgjpg/'
	var subdir_img = '';
	var refnr = 'AT5000-448_43';
	var img_width = '313';
	var img_height = '385';
	
	var newWindow;
	var fileName = refnr;
	// refnr AT5000-134_I* > > fileName AT5000-134_IS
	if (fileName.substr(fileName.length-1) == "*") {
		fileName = fileName.substr(0,fileName.length-1) + "S";
	}
	var docname = imgbase + subdir_img + fileName + ".jpg";
  // alert(docname); exit();
	var win_width = parseInt(img_width)+100;
  var win_height = parseInt(img_height)+350; 
  var winposX = parseInt(screen_width)-parseInt(win_width)-parseInt(img_width);
  var winposY = 30;
  var winSize = "width="+win_width+",height="+win_height;
  var winPos = "screenX="+winposX+",screenY="+winposY;     // NN
  winPos += "left="+winposX+",top="+winposY+"\"";          // MSIE

	newWindow = window.open("","",winFeatures + ", " + winSize + ", " + winPos);
  var destination = "http://www.ksbm.oeaw.ac.at/_scripts/php/load_wm.php?refnr_wm=" + refnr + "";
  // alert("destination: " + destination); 
  newWindow.location.href = destination;
  /*
      var newContent = "<html><head><title>" + refnr + "</title></head>\n";
	newContent += "<body><strong>" + refnr + "</strong>\n";
	newContent += "<img src='" + docname + "' name='" + refnr + "'>\n";
	newContent += "</body></html>";
	newWindow.document.write(newContent);
       */
	newWindow.document.close();
	newWindow.focus();


}




function loadWmarks4Ms(ID_mss) {
	var newWindow;
	var docName = "ID" + ID_mss;
  var win_width = 600;
  var win_height = parseInt(screen_height-150);
  var winposX = parseInt(screen_width-win_width-30);
  var winposY = 30;
  var winSize = "width="+win_width+",height="+win_height;
  var winPos = "screenX="+winposX+",screenY="+winposY;     // NN
  winPos += ", left="+winposX+",top="+winposY+"\"";        // MSIE

	newWindow = window.open("","",winFeatures + ", " + winSize + ", " + winPos);
    /* moveTo(winposX,winposY) funktioniert in Mozilla 1.7.2 nicht korrekt!  */
    
  var destination = "loadRelWmarks4Ms.php?ID_mss=" + ID_mss + "";
	// alert(destination); 
	// setTimeout("",50); Schreiben des Inhalts in eigene Funktion schreiben

	newWindow.location.href = destination;
	// newWindow.location.href="wmarkImg2MainFrame.php?id=" + ID_wmark + "&collName=" + collName + ""; // korrekt
	newWindow.document.close();
	newWindow.focus();
}

function _loadPDF(imgbase,subdir_img,refnr_wm,img_width,img_height) {
  var newWindow;
	var destination = imgbase + subdir_img + refnr_wm + ".pdf";
    // alert("  > > destination: " + destination);
    // winFeatures = "width="+w+",height="+h+",menubar='no',resizable=yes,scrollbars='no'";
    // winName = fileName; // --> Fenster (unterschiedliche Namen!) bleiben auf dem Desktop!
    // winName = '' // --> jeder PDF-Aufruf öffnet neues Fenster !
    // ACHTUNG: MSIE: akzeptiert kein - und _ im Windows-Namen !
    // winName = "XXX"; // --> alle pdf-Bilder werden in DEMSELBEN Fenster ("XXX") angezeigt!
    
  newWindow = window.open('','',winFeatures);
    
    // destination = "file:///d:/wz/imgjpg/AT/5000/00/42/AT5000-42_122.jpg";#
    // destination = "AT5000-42_122.pdf";
    // destination = "file:///c:/test.htm"; wird NICHT geladen
    // alert("destination: " + destination);
  newWindow.location.href = destination;
  newWindow.document.close();
    // newWin.moveTo(20,20);
  newWindow.focus();
}

 
// ==================================================================
// die folgenden Funktionen werden NICHT mehr gebraucht (??)

	function loadRelWMark(imgbase,subdir_img,refnr,img_width,img_height) {
        var newWindow;
		var docname = imgbase + subdir_img + refnr + ".jpg";
		
        var win_width = parseInt(img_width)+50;
        // var win_height = parseInt(img_height)+40;
        // alert(win_width + " x " + win_height); exit();
        // 500 = Breite des Fensters für loadRelWmarks4Ms.php
        var winposX = parseInt(screen_width)-500-parseInt(win_width);
        var winposY = 30;
        var winSize = "width="+win_width; ////
        // var winSize = "width="+win_width+",height="+win_height; 
        var winPos = "screenX="+winposX+",screenY="+winposY;     // NN
        winPos += "left="+winposX+",top="+winposY+"\"";               // MSIE

		newWindow = window.open("","",winFeatures + ", " + winSize + ", " + winPos);
        
        var destination = "loadWZMAimg.php?refnr_wm=" + refnr + "";
        // alert("destination: " + destination); ///
        newWindow.location.href = destination;
        /*
        var newContent = "<html><head><title>" + refnr + "</title></head>\n";
		newContent += "<body><strong>" + refnr + "</strong>\n";
		newContent += "<img src='" + docname + "' name='" + refnr + "'>\n";
		newContent += "</body></html>";
		newWindow.document.write(newContent);
        */
		newWindow.document.close();
		newWindow.focus();
}	


// ' file:///d:/wz/imgpdf/','AT/5000/00/42/','AT5000-42_122', 339, 343
	function loadWmarkImgPDF(imgbase,subdir_img,refnr,img_width,img_height) {
        var newWindow;
		var docname = imgbase + subdir_img + refnr + ".pdf";
        var win_width = parseInt(img_width)+60;
        // var win_height = parseInt(img_height)+40;
        // alert(win_width + " x " + win_height); exit();
        var winposX = parseInt(screen_width)-parseInt(win_width)-parseInt(img_width);
        var winposY = 30;
        var winSize = "width="+win_width; ////
        // var winSize = "width="+win_width+",height="+win_height; 
        var winPos = "screenX="+winposX+",screenY="+winposY;     // NN
        winPos += "left="+winposX+",top="+winposY+"\"";               // MSIE

		newWindow = window.open("","",winFeatures + ", " + winSize + ", " + winPos);
        
        var destination = "loadWmarkImgPDF.php?docname=" + docname + "";
        // alert("destination: " + destination); 
        newWindow.location.href = destination;
        /*
        var newContent = "<html><head><title>" + refnr + "</title></head>\n";
		newContent += "<body><strong>" + refnr + "</strong>\n";
		newContent += "<img src='" + docname + "' name='" + refnr + "'>\n";
		newContent += "</body></html>";
		newWindow.document.write(newContent);
        */
		newWindow.document.close();
		newWindow.focus();
}	

