
// Searches paramaters

function isWindows() {
	return (navigator.appVersion.indexOf("Win") != -1)
}

function isWin95NT() {
	return (isWindows() && (navigator.appVersion.indexOf("Win16") == -1 && navigator.appVersion.indexOf("Windows 3.1") == -1))
}

function isMac() {
	return (navigator.appVersion.indexOf("Mac") != -1)
}

function isMacPPC() {
	return (isMac() && (navigator.appVersion.indexOf("PPC") != -1 || navigator.appVersion.indexOf("PowerPC") != -1))
}

function isUnix() {
	return (navigator.appVersion.indexOf("X11") != -1)
}

function isNav() {
	return (navigator.appName == "Netscape")
}

function isGeneration3() {
	return (navigator.appVersion.charAt(0) == "3")
}

function isGeneration3Min() {
	return (parseInt(navigator.appVersion.charAt(0)) >= 3)
}

function isNav4_02() {
	return (isNav() && (navigator.appVersion.substring(0,4) == "4.02") )
}

function isNav4_05() {
	return (isNav() && (navigator.appVersion.substring(0,4) == "4.05") )
}

function isNav45() {
	
	return (isNav() && (navigator.appVersion.substring(0,3) == "4.5"))
}
function isNav47() {
	return (isNav() && (navigator.appVersion.substring(0,3) == "4.7"))
}
function isMSIE3Min() {
	return (navigator.appVersion.indexOf("MSIE") != -1)
}

function isIE41() {
	return (isMSIE3Min() && (navigator.appVersion.substring(22,25) == "4.0") )
}

function isIE5() {
	return (isMSIE3Min() && (navigator.appVersion.substring(22,25) == "5.5") )
}

if (isNav()){
	if(parseFloat(navigator.appVersion.charAt(0)) > 4){
		isNav6 = true
	} else if (isNav45() || isNav47()) {
		isNav4 = true
		insideWindowWidth = window.innerWidth
	} else {
		var isNav3 = true;
	}
} else {

	if (isIE41())
	{
		var isIE3 = true;
	} else {
		var isIE4 = true
		range = "all."
		styleObj = ".style"	
	}
}

function StartNeapoljs(site,lang,group,resol,args)
{
	if (isNav3)
	{
		alert('Diese Applikation benötigt Netscape 4.5 oder höher');
		return;
	}

	if (isIE3)
	{
		alert('Diese Applikation benötigt Internet Explorer 5.0 oder höher');
		return;
	}
	
	// check screen resolution
	
	var winWidth = new Array();
	var winHeight = new Array();
	var myResol = new Array();
	var i_resol = 0;
	
	myResol[0] = '800x600';
	winWidth[0] = 700;
	winHeight[0] = 530;
	
	myResol[1] = '1024x768';
	winWidth[1] = 940;
	winHeight[1] = 700;
	
	myResol[2] = '1280x1024';
	winWidth[2] = 1200;
	winHeight[2] = 950;
	
	switch(resol.toLowerCase())
	{
		case '800x600':
			i_resol = 0;
		break;
		case '1024x768':
			i_resol = 1;
		break;
		case '1280x1024':
			i_resol = 2;				
		break;
		default:
			i_resol = 1;
	}		
	
	while ((screen.availHeight <= winHeight[i_resol] && screen.availWidth <= winWidth[i_resol]) || (i_resol == 0))
	{
		i_resol--;
	}
	if (i_resol < 0) i_resol = 0;
	
	resol = myResol[i_resol];

	// end of check screen resolution
	
	var myargs = '?site='+site+'&lang='+lang+'&group='+group+'&resol='+resol;

	if (typeof args != 'undefined' && args != "") myargs += args;
	
	if (sVirtualDir != "") sVirtualDir = sVirtualDir + "/";
	
	if (group == "public")
	{
		NeapoljsWin=window.open(shostname+"/"+sVirtualDir+"frame.php"+myargs,"", "width="+winWidth[i_resol]+",height="+winHeight[i_resol]+",top=0,left=0,resizable=no,menubar=no,location=no,statusbar=no,alwaysraised=yes,scrollbars=no");
	} else {
		NeapoljsWin=window.open(shostname+"/"+sVirtualDir+"login.php"+myargs,"", "width="+winWidth[i_resol]+",height="+winHeight[i_resol]+",top=0,left=0,resizable=no,menubar=no,location=no,statusbar=no,alwaysraised=yes,scrollbars=no");
	}
	return NeapoljsWin;
}
function StartPublicNeapoljs(site,lang,resol,args)
{
	if (isNav3)
	{
		alert('Diese Applikation benötigt Netscape 4.5 oder höher');
		return;
	}

	if (isIE3)
	{
		alert('Diese Applikation benötigt Internet Explorer 5.0 oder höher');
		return;
	}
	
	// check screen resolution
	
	var winWidth = new Array();
	var winHeight = new Array();
	var myResol = new Array();
	var i_resol = 0;
	var group = "public";
	
	myResol[0] = '800x600';
	winWidth[0] = 700;
	winHeight[0] = 530;
	
	myResol[1] = '1024x768';
	winWidth[1] = 960;
	winHeight[1] = 620;
	
	myResol[2] = '1280x1024';
	winWidth[2] = 1200;
	winHeight[2] = 950;
	
	//new: rba20061010
	switch(resol.toLowerCase())
	{
		case '800x600':
			i_resol = 0;
		break;
		case '1024x768':
			i_resol = 1;
		break;
		case '1280x1024':
			i_resol = 2;				
		break;
		default:
			i_resol = resol.toLowerCase();
	}		
	
	while ((screen.availHeight <= winHeight[i_resol] && screen.availWidth <= winWidth[i_resol]) || (i_resol == 0))
	{
		i_resol--;
	}
	if (i_resol < 0) i_resol = 0;
	
	resol = myResol[i_resol];

	// end of check screen resolution
	
	var myargs = '?site='+site+'&lang='+lang+'&group='+group+'&resol='+(i_resol+1);

	if (typeof args != 'undefined' && args != "") myargs += args;
	if (typeof sVirtualDir == 'undefined') sVirtualDir = 'Stadtplan2004';
	if (typeof shostname == 'undefined') shostname = 'http://www.bad-homburg.de';
	
	if (sVirtualDir != "") sVirtualDir = sVirtualDir + "/";
	
	if (group == "public")
	{
		NeapoljsWin=window.open(shostname+"/"+sVirtualDir+"frame.php"+myargs,"", "width="+winWidth[i_resol]+",height="+winHeight[i_resol]+",top=0,left=0,resizable=no,menubar=no,location=no,statusbar=no,alwaysraised=yes,scrollbars=no");
	} else {
		NeapoljsWin=window.open(shostname+"/"+sVirtualDir+"login.php"+myargs,"", "width="+winWidth[i_resol]+",height="+winHeight[i_resol]+",top=0,left=0,resizable=no,menubar=no,location=no,statusbar=no,alwaysraised=yes,scrollbars=no");
	}
	return NeapoljsWin;
}
function StartCustomNeapoljs(site,lang,group,resol,args)
{
	if (isNav3)
	{
		alert('Diese Applikation benötigt Netscape 4.5 oder höher');
		return;
	}

	if (isIE3)
	{
		alert('Diese Applikation benötigt Internet Explorer 5.0 oder höher');
		return;
	}
	
	// check screen resolution
	
	var winWidth = new Array();
	var winHeight = new Array();
	var myResol = new Array();
	var i_resol = 0;
	
	myResol[0] = '800x600';
	winWidth[0] = 700;
	winHeight[0] = 530;
	
	myResol[1] = '1024x768';
	winWidth[1] = 940;
	winHeight[1] = 700;
	
	myResol[2] = '1280x1024';
	winWidth[2] = 1200;
	winHeight[2] = 950;
	
	
	//new: rba20061010
	switch(resol.toLowerCase())
	{
		case '800x600':
			i_resol = 1;
		break;
		case '1024x768':
			i_resol = 2;
		break;
		case '1280x1024':
			i_resol = 3;				
		break;
		default:
			i_resol = resol.toLowerCase();
	}		
	
	while ((screen.availHeight <= winHeight[i_resol] && screen.availWidth <= winWidth[i_resol]) || (i_resol == 0))
	{
		i_resol--;
	}
	if (i_resol < 0) i_resol = 0;
	
	var resol = myResol[i_resol];

	// end of check screen resolution
	
	//if (group == "" || typeof group == 'undefined') group = "public";

	var base_args = '?site='+site+'&lang='+lang+'&group='+group+'&resol='+i_resol;

	if (typeof layer != 'undefined' && layer != "") args += '&layers='+layer;
	
	if (sVirtualDir != "") sVirtualDir = sVirtualDir + "/";
		
	if (group == "public")
	{
		NeapoljsWin=window.open(shostname+"/"+sVirtualDir+"bh_frame.php"+base_args+args,"", "width="+winWidth[i_resol]+",height="+winHeight[i_resol]+",top=0,left=0,resizable=no,menubar=no,location=no,statusbar=no,alwaysraised=yes,scrollbars=no");
	} else {
		NeapoljsWin=window.open(shostname+"/"+sVirtualDir+"login.php"+args,"", "width="+winWidth[i_resol]+",height="+winHeight[i_resol]+",top=0,left=0,resizable=no,menubar=no,location=no,statusbar=no,alwaysraised=yes,scrollbars=no");
	}
	return NeapoljsWin;
}

function StartBHNeapoljs(site,lang,bh_uid,resol,sessID,args)
{
	if (isNav3)
	{
		alert('Diese Applikation benötigt Netscape 4.5 oder höher');
		return;
	}

	if (isIE3)
	{
		alert('Diese Applikation benötigt Internet Explorer 5.0 oder höher');
		return;
	}
	
	// check screen resolution
	
	var winWidth = new Array();
	var winHeight = new Array();
	var myResol = new Array();
	var i_resol = 0;
	
	myResol[1] = '700x530'; //rba20061129
	winWidth[1] = 700;
	winHeight[1] = 530;
	
	myResol[2] = '980x620'; //rba20061129
	winWidth[2] = 980;
	winHeight[2] = 620;
	
	//new: rba20061010

	switch(resol.toLowerCase())
	{
		case '800x600':
			i_resol = 1;
		break;
		case '1024x768':
			i_resol = 2;
		break;
		case '1280x1024':
			i_resol = 3;				
		break;
		default:
			i_resol = resol.toLowerCase();
	}		
	
	/* adapted for new neapoljs resol support: rba20061129 */

	while ((screen.availHeight <= winHeight[i_resol] && screen.availWidth <= winWidth[i_resol]) || (i_resol == 1))
	{
		i_resol--;
	}
	if (i_resol < 1) i_resol = 1;
	
	resol = myResol[i_resol];

	// end of check screen resolution
	
	var start_args = '?site='+site+'&lang='+lang+'&bh_uid='+bh_uid+'&resol='+i_resol+'&bh_sessID='+sessID;

	if (typeof args != 'undefined' && args != "") start_args += args;
		
	if (sVirtualDir != "") sVirtualDir = sVirtualDir + "/";

	NeapoljsWin=window.open(shostname+"/"+sVirtualDir+"bh_frame.php"+start_args,"", "width="+winWidth[i_resol]+",height="+winHeight[i_resol]+",top=0,left=0,resizable=no,menubar=no,location=no,statusbar=no,alwaysraised=yes,scrollbars=no");

	return NeapoljsWin;
}