/**
* Realization of browser specified layer effects
* @author: dkl
* company: megatel GmbH
* @since: 26.11.2001
*/
/**
* Create an object with specified browser informations
* @info: String name : browser name
* @info: int version : browser version
* @info: boolean cookies : cookies enabled
* @info: boolean javaEnabled: java enabled
* @info: String language : browser language
* @info: String platform : browser platform
*
* @info: booleab isIE : browser is Internet Explorer >= 4.0
* @info: boolean isNav : browser is Netscape Navigator < 6.0 but >= 4.0
* @info: boolean isNav6 : browser is Netscape Navigator >= 6.0
*/
function getBrowserProperties() {
lang = new Object();
lang["de"] = "Deutsch";
lang["en"] = "Englisch";
lang["un"] = "Unbekannt";
stdMsg = 'keine Informationen';
this.language = "un";
this.platform = stdMsg;
with (navigator) {
wbstart = (userAgent.indexOf('(') + 1);
wbend = userAgent.indexOf(')');
browserstring = userAgent.substring(wbstart, wbend);
if (appName.indexOf("Opera") == 0) {
this.name = 'Opera'
sep = browserstring.indexOf(';');
this.platform = browserstring.substring(0, sep);
langstart = (userAgent.indexOf('[') + 1);
langend = userAgent.indexOf(']');
this.language = lang[userAgent.substring(langstart, langend)];
verstart = (userAgent.indexOf('/') + 1);
verend = (userAgent.indexOf('(')-1);
this.version = userAgent.substring(verstart, verend);
this.isOpera = true;
}
if (parseInt(appVersion) >= 4 && appName.indexOf("Opera") != 0) {
if (appName.indexOf("Netscape") != -1) {
this.name = 'Netscape';
if (userAgent.indexOf("Netscape6") > 0) {
ns6start = (userAgent.indexOf("Netscape6") + 10);
ns6end = userAgent.length;
this.version = userAgent.substring(ns6start,ns6end);
stringarray = browserstring.split("; ");
this.platform = stringarray[2];
this.language = lang[language.substring(0,2)];
this.isNav6 = true;
}
else {
nsstring = appVersion;
nsarray = nsstring.split(" ");
this.version = nsarray[0];
stringarray = browserstring.split("; ");
this.platform = stringarray[0];
this.language = lang[language];
this.isNav = true;
}
}
else if (appName.indexOf("Microsoft") != -1) {
this.name = 'Microsoft';
this.isIE = true;
this.language = lang[userLanguage];
start = (appVersion.indexOf('(') + 1);
end = appVersion.indexOf(')');
browserstring = appVersion.substring(start, end);
stringarray = browserstring.split(";");
this.platform = stringarray[2];
ieversion = stringarray[1].split(" ");
this.version = ieversion[2];
}
}
if (this.isNav6) this.cookies = cookieEnabled; else this.cookies = stdMsg;
this.javaEnabled = javaEnabled();
}
}
browser = new getBrowserProperties();
getBrowserProperties.prototype.getBrowserProperties = getBrowserProperties;
/**
* Write a HTML paragraph with the requested browser properties
*/
function printBrowserProperties() {
with (browser) {
document.write('Hersteller: '+name+'
Version: '+version+'
Cookies aktiviert: '+
cookies+'
Java aktiviert: '+javaEnabled+'
Sprache: '+language+'
Platform: '+
platform);
}
}
/**
* Create an object with specified display informations
* @info: int with : whole screen width
* @info: int height : whole screen height
* @info: String res : resolution
* @info: int availableHeight : available screen height
* @info: int availableWidth : available screen width
* @info: int colorDepth : color depth
*/
function getScreenProperties() {
with (screen) {
this.width = width;
this.height = height;
this.res = width+'x'+height;
this.aHeight = availHeight;
this.aWidth = availWidth;
this.colorDepth = 0;//Math.pow(2,colorDepth);
}
}
display = new getScreenProperties();
getScreenProperties.prototype.getScreenProperties = getScreenProperties;
/**
* Write a HTML paragraph with the requested screen properties
*/
function printScreenProperties() {
with (display) {
document.write('Auflösung: '+res+' Pixel
verfügbare Breite: '+aWidth+' Pixel
verfügbare Höhe: '+aHeight+' Pixel
Farbtiefe: '+
colorDepth+' Farben');
}
}
/**
* Create an object with specified display informations
* @info: String menubar : menubar visibility
* @info: String locbar : locationbar visibility
* @info: String persbar : personalbar visibility
* @info: String toolbar : toolbar visibility
* @info: int iWidth : inner width of the window
* @info: int iHeight : inner height of the window
* @info: int oWidth : outer width of the window
* @info: int oHeight : outer width of the window
* @info: int xOffset : window position from the left
* @info: int yOffset : window position from the top
* @info: String name : name of the window
* @info: String status : text from the statusbar
*/
function getWindowProperties() {
prop = new Object();
prop["true"] = 'aktiviert';
prop["false"] = 'deaktiviert';
prop["undefined"] = 'n/a'; // not available
with (window) {
if(browser.isNav || browser.isNav6) {
this.menubar = prop[menubar]; // Netscape 4.0
this.locbar = prop[locationbar]; // Netscape 4.0
this.persbar = prop[personalbar]; // Netscape 4.0
this.toolbar = prop[toolbar]; // Netscape 4.0
this.iWidth = innerWidth; // Netscape 4.0
this.iHeight = innerHeight; // Netscape 4.0
this.oWidth = outerWidth; // Netscape 4.0
this.oHeight = outerHeight; // Netscape 4.0
this.xOffset = pageXOffset; // Netscape 4.0
this.yOffset = pageYOffset; // Netscape 4.0
}
this.name = name; // Netscape 4.0 & IE 4.0
this.status = status; // Netscape 4.0 & IE 4.0
}
}
view = new getWindowProperties();
getWindowProperties.prototype.getWindowProperties = getWindowProperties;
/**
* Capture mouse events from the middle and right mouse button.
* which = Netscape syntax: left mouse button = 1; middle mouse button = 2; right mouse button = 3
* @param: Event mouseevent : mouse event to react
* @param: String text : text to display
* @return : boolean
*/
function capture(mouseEvent,text) {
if ((browser.isNav || browser.isNav6) && (mouseEvent.which == 3 || mouseEvent.which == 2)) return false;
else if (browser.isIE && (event.button == 2 || event.button == 3)) {
alert(text);
return false;
}
return true;
}
/**
* The following paragraph must be insert at the page where the mouse event will be
* executed.
*
* document.onmousedown = capture;
* if (document.layers) window.captureEvents(Event.MOUSEDOWN);
* window.onmousedown = capture;
*/
/**
* Opens an URL in another frame
* @param: String URL: file to load
* @param: String frame = destination frame
*/
function viewInfo(URL,frame) {
parent.frames[frame].location.href = URL;
}
/**
* Open an URL in another window by using the requested window dimensions
* @param: String URL = file to load
* @param: String name = name of the window
* @param: variant posFromLeft = window position from the left of the screen
* @param: variant posFromTop = window position from the top of the screen
* @param: variant width = width of the window
* @param: variant height = height of the window
* @param: int toolbar = window includes a toolbar
* @param: int menubar = window includes a menubar
* @param: int scrollbars = window includes a scrollbar
* @param: int statusbar = window includes a statusbar
* @param: int resizable = window can be resized
* @param: int dependent = if the parent window was closed, this window will be closed automatically
* NOTE: a) Netscape 6 doesn't interpret this attribute !!!
* b) for Netscape 4.x only
* @param: int hotkeys = hotkeys to navigate the window
* NOTE: Netscape 4.x+ only !!!
*/
function openWindow(URL,name,posFromLeft,posFromTop,width,height,toolbar,menubar,scrollbars,statusbar,resizable,dependent,hotkeys) {
if (URL!=''){
if (toolbar == 0 || toolbar == null || toolbar == 'no') toolbar = 'no'; else toolbar = 'yes';
if (menubar == 0 || menubar == null || menubar == 'no') menubar = 'no'; else menubar = 'yes';
if (scrollbars == 0 || scrollbars == null || scrollbars == 'no') scrollbars = 'no'; else scrollbars = 'yes';
if (statusbar == 0 || statusbar == null || statusbar == 'no') statusbar = 'no'; else statusbar = 'yes';
if (resizable == 0 || resizable == null || resizable == 'no') resizable = 'no'; else resizable = 'yes';
if (dependent == 0 || dependent == null || dependent == 'no') dependent = 'no'; else dependent = 'yes';
if (hotkeys == 0 || hotkeys == null || hotkeys == 'no') hotkeys = 'no'; else hotkeys = 'yes';
var args = "left="+posFromLeft+",top="+posFromTop+",width="+width+",height="+height;
args = args + ",toolbar="+toolbar+",menubar="+menubar+",scrollbars="+scrollbars+",status="+statusbar
args = args +",screenX=1,screenY=1,resizable="+resizable+",dependent="+dependent+",hotkeys="+hotkeys;
var win = window.open(URL,name,args);
win.focus();
}
}
/**
* Initialize ticker
*/
var text;
function initializeTicker() {
window.status = text;
text = text.substring(1,text.length) + text.substring(0,1);
}
/**
* Start a ticker in the status bar of the browser window
* @param: mytext : text to show in the status bar
* @param: dealy : text delay
*/
function startTicker(mytext,delay) {
text = mytext;
window.setInterval("initializeTicker()",delay);
}
/**
* Maximize the browser window
*/
function maximizeWindow() {
with (window) {
resizeTo(display.height,display.width);
moveTo(0,0);
}
}
/**
* Move the browser window by using relative coordinates
* @param: int dx : relative x-value;
* @param: int dy : relative y-value;
*/
function moveWindow(dx,dy) {
window.moveBy(parseInt(dx),parseInt(dy));
}
/**
* Resize and move the browser-window to an absolute position
* @param: int posFromLeft: new window position from the left of the screen
* @param: int posFromTop : new window position from the top of the screen
* @param: int width : width to resize to
* @param: int height : height to resize to
*/
function resizeWindow(posFromLeft,posFromTop,width,height) {
with (window) {
resizeTo(parseInt(width),parseInt(height));
moveTo(parseInt(posFromLeft),parseInt(posFromTop));
}
}
/**
* Return the current date
* @return: String : current date
*/
function requestDate() {
var weekday = new Array('Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag')
var months = new Array('Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember');
// Create date-object to activate access
var currentDate = new Date();
day = weekday[currentDate.getDay()];
date = currentDate.getDate();
month = months[currentDate.getMonth()];
year = currentDate.getYear();
// Netscape still returns the number of the year relativ to 1900
if (browser.isNav || browser.isNav6) year += 1900;
newDate = day+', '+date+'. '+month+' '+year;
return newDate;
}
/**
* Returns the current time
* @return: String : current time
*/
function requestTime() {
function normalize(timeObj) {
if (parseInt(timeObj) < 10) return(timeObj = '0'+ timeObj);
else return (timeObj);
}
// Create date-object to activate access
var time = new Date();
hours = time.getHours();
minutes = normalize(time.getMinutes());
seconds = normalize(time.getSeconds());
newTime = hours+':'+minutes+':'+seconds;
return newTime;
}
/**
* Deletes all input fields
* @param: formName : name of the formular
*/
function delAllInputFields() {
for(var i=0; document.forms[i]; i++) {
for(var j=0; document.forms[i].elements[j]; j++) {
if (document.forms[i].elements[j].type == 'text') {
document.forms[i].elements[j].value = "";
}
}
}
}
/**
* Sets all checkboxes
* @param: value : 'on' -> checked, others -> unchecked
*/
function setAllCheckboxes(value) {
for(var i=0; document.forms[i]; i++) {
for(var j=0; document.forms[i].elements[j]; j++) {
if (document.forms[i].elements[j].type == 'checkbox') {
if (value == 'on'){
document.forms[i].elements[j].checked = true;
}
else{
document.forms[i].elements[j].checked = false;
}
}
}
}
}
/**
* Get's the selected item from a listbox
*/
function getFromListbox() {
}
/**
* Get's the filename without extension
*/
function getFilename(filename) {
file = filename.split("/");
if(file[file.length-1].substring(2,3) == "\\") {
file = filename.split("\\");
}
return(file[file.length-1]);
}
/**
* Get's the file extension
*/
function getFileExtension(filename) {
array = filename.split(".");
return(array[array.length-1]);
}
/**
* Zoom-in position or request object informations
*/
var zoomInPos = false;
sleepingMsg = '';
requestMsg = '';
function ResizeInfoZoom() {
window.defaultStatus = sleepingMsg;
}
if (browser.isNav) {
window.captureEvents(Event.RESIZE);
}
/**
* Set the window text
* @param: String sleep : window text if there's no click-event
* @param: String busy : window text if there's an onclick-event
*
*/
function setWindowText(sleep,busy) {
sleepingMsg = sleep;
requestMsg = busy;
window.defaultStatus = sleepingMsg;
}
function coords(e) {
if (browser.isNav) {
myposx = e.pageX - document.map.x;
myposy = e.pageY - document.map.y;
}
if (browser.isNav6) {
myposx = e.clientX - document.map.x;
myposy = e.clientY - document.map.y;
}
if (browser.isIE) {
myposx = window.event.offsetX;
myposy = window.event.offsetY;
}
zoomin(myposx,myposy);
}
function zoomin(x,y) {
if (x >=0 && x<=document.map.width && y >=0 && y<=document.map.height){
document.forms[0].mapClickPosX.value = x;
document.forms[0].mapClickPosY.value = y;
document.forms[0].submit();
return true;
}
}