//
// ADElib.js V1.2c Copyright(c)2000 /A/D/E/ A. Dombi Engineering CH-8712 Staefa
//
// General JavaScript-Library for: projecting AG
//
// hintergrund( red-dec, green-dec, blue-dec)   ->  sets BackgroundColor
// browsertype()                                ->  Returns "IE", "NN" or "UN"kown
// rCl()                                        ->  Captures RightClick with Copyright
// WinSize( x, y )                              ->  Adjust Window Size to Users Screen
// Bookmark()                                   ->  Add a Bookmark - or asks for MSIE-Download
// calcpop(curl)                                ->  PopUp a Calculator
//

adelibloaded=true;


function hintergrund (r, g, b) {
	hexadezimal = "0123456789abcdef";
	farbe = hexadezimal.charAt (Math.floor (r / 16));
	farbe = farbe + hexadezimal.charAt (r % 16);
	farbe = farbe + hexadezimal.charAt (Math.floor (g / 16));
	farbe = farbe + hexadezimal.charAt (g % 16);
	farbe = farbe + hexadezimal.charAt (Math.floor (b / 16));
	farbe = farbe + hexadezimal.charAt (b % 16);
	document.bgColor = farbe
}

      
function browsertype () {
        var browser="UN"
	if(navigator.appName=="Netscape")  {
		var browser = "NN";
	};
	if(navigator.appVersion.indexOf("MSIE")!= -1)  {
		var browser = "IE";
	};
	return browser
}


var nMs="Copyright©2000 /A/D/E/\nA. Dombi Engineering\nCH-8712 Stäfa\nPhone: +411 926 85 00";
function rCl(keyp) {
	if( browsertype()=="NN" && keyp.which==3)  {
		alert(nMs + "\n\nBest View with MS-Internet Explorer 5.5");
		return false
	};
		if(browsertype()=="IE" && event.button==2)  {
		alert(nMs + "\n\nCongratulations: You use MS-Internet Explorer!" );
		return false
	};
}
document.onmousedown=rCl;


function WinSize( sx, sy)  {
	if(browsertype()=="NN" && sy > 120)  {
		sy -= 120;
	}
	if(screen.availHeight > 0 && screen.availHeight < sy) {
		sy = screen.availHeight - 5
	}
	if(screen.availWidth > 0 && screen.availWidth < sx) {
		sx = screen.availWidth - 5
	}
	window.resizeTo (sx, sy) ;
}


function Bookmark (bmURL, bmLabel)  {
	if(browsertype()=="NN")  {
		runtobilly = confirm( "Sorry!\nBookmarken geht nur beim MS-Internet Explorer.\nBookmarking works only with MS-Internet Explorer.\n\nExplorer jetzt herunterladen?\nDownload Explorer now?"); 
		if(runtobilly)  {
			window.open("http://www.microsoft.com/windows/ie/default.htm","_blank");
		};
	};

	if(browsertype()=="IE")  {
		window.external.AddFavorite( bmURL, bmLabel);
	};
}


var curl = "jscalc.htm"
function calcpop ( curl )	
	{
        var cpx = '280' ;
	var cpy = '160' ;

	if(browsertype () == "NN")  {
	        var cpx = '310' ;
		var cpy = '170' ;
	};

	var cwopt = 'dependent=no,' +
		'toolbar=no,' +
		'location=no,' +
		'directories=no,' +
		'status=no,' +
		'menubar=no,' +
		'scrollbars=no,' +
		'resizable=no,' +
		'width=' + cpx + ',' +
		'height=' + cpy + ',' +
		'top=10,' +
		'left=10';

	popcalc = window.open (curl, 'calcwin', cwopt);
}

