﻿//
// GENERAL.JS
//
// Concept, Design and Programming by
// stoll & fischbach eBusiness
// SF eBusiness GmbH,
// Herrenberg, Germany
// 
// general.js provides general JavaScript functions 
//
///////////////////////////////////////////////////////////////////////////////
// Reload page in Frameset
function setPageIntoFrameset()
{
 if (parent.frames.length == 0)
 {
  top.location.href = "/default.htm?contenturl=" + self.location.href;
 }
}
// Opens new browser window
var newWin;
function openWindow(url,breite,hoehe,scrolling)
{
 if (typeof scrolling == 'undefined') scrolling = 0;
 if (newWin&&!newWin.closed) newWin.close();
 var posx = (screen.width-breite) / 2;
 var posy = (screen.height-hoehe) / 2;
 newWin = window.open(url,'','Toolbar=0,Location=0,Directories=0,Status=0,Menubar=0,scrollbars='+scrolling+',resizable=0,left='+posx+',top='+posy+',width=' + breite + ',height=' + hoehe + '');
 newWin.focus();
}
// Opens print dialog
var windowprint = (window.print) ? 1 : 0;
function printPage()
{
 if (windowprint)   // NS4, IE5, IE6, NS6
     window.print();
 else if (document.all && !document.getElementById && (agt.indexOf('mac') == -1)) // IE4 (Windows)
  vbPrintPage();
 else      // other browsers
  alert("Ihr Browser unterstützt diese Funktion nicht.\nBitte drücken Sie STRG + P.");
}
if (document.all && !document.getElementById && (agt.indexOf('mac') == -1) && !windowprint) with (document){
 writeln('<OBJECT ID="WB" WIDTH="0" HEIGHT="0" CLASSID="clsid:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>');
 writeln('<' + 'SCRIPT LANGUAGE="VBScript">');
 writeln('Sub window_onunload');
 writeln('  On Error Resume Next');
 writeln('  Set WB = nothing');
 writeln('End Sub');
 writeln('Sub vbPrintPage');
 writeln('  OLECMDID_PRINT = 6');
 writeln('  OLECMDEXECOPT_DONTPROMPTUSER = 2');
 writeln('  OLECMDEXECOPT_PROMPTUSER = 1');
 writeln('  On Error Resume Next');
 writeln('  WB.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER');
 writeln('End Sub');
 writeln('<' + '/SCRIPT>');
}
//Reference: www.webreference.com/js/tips/991029.html
