// Global variables
var fertig = false
var nn4 = false;	// Netscape Navigator or Communicator
var ie4 = false;
var ie5 = false;
var ie6 = false;
var ie = false;		//IE 5 und IE6
var ns6 = false;    	// Netscape 6
var ns7 = false;   	 // Netscape 7
var moz = false;		// Mozilla Engine
var dom1 = false;	// fully supports DOM1
var dom2 = false;	// fully supports (important bits of) DOM2
var op = false;  		//all opera
var op7 = false;  	//opera 7
var mac = false;		//mac
var safari = false;	//mac Safari
var ff = false;		//Firefox

var old = false;		// very old browser

var browserWarn = false;
var strAgent = window.navigator.userAgent;

function browser_detect()
{
	op = (strAgent.indexOf("Opera") > -1);
	op7 = (strAgent.indexOf("Opera/7") > -1) || (strAgent.indexOf("Opera 7") > -1);	

    // do it the official W3C way
    if ( window.document.implementation != null)
    {
         dom1 = window.document.implementation.hasFeature("HTML","1.0");
         dom2 = window.document.implementation.hasFeature("HTML","2.0") &&
         	window.document.implementation.hasFeature("Events","2.0") &&
         	window.document.implementation.hasFeature("Core","2.0") &&
         	window.document.implementation.hasFeature("CSS2","2.0");
    }
    // Mozilla based browsers contain the Gecko rendering engine
    moz = (window.navigator != null )
		? (strAgent.indexOf("ecko") != -1 )
		: false;
    ff = (strAgent.indexOf("Firefox") != -1);
    nn4 = (window.document.layers != null && !moz);
	ns6 = (moz && !dom2);
	ns7 = (moz && (strAgent.indexOf("Netscape/7") > 0));
	
    // IE has incremental support for the Document Object Model
    ie6 = (window.document.all && dom1);
    ie5 = (window.document.all && (strAgent.indexOf('MSIE 5')>0));		//&& window.document.getElementsByTagName()
	ie  = (ie5 || ie6 && !op);
    ie4 = (window.document.all && !ie6 && !ie5); 
	mac = (strAgent.indexOf('Mac')>0);
	safari = (strAgent.indexOf('Safari')>0)
    // something horrible and old
    old = (!ie && !dom1 && !moz);
	
	// set flag browserWarn true if IE<5 or Netscape < 6
	if (ie == true || moz== true){
		browserWarn = false;
	} 
	else {
		browserWarn = true;
	}
	//alert (browserWarn);
}

browser_detect();	

function popup(w,h,site) {
    x = screen.availWidth/2-w/2;
    y = screen.availHeight/2-h/2;
    var popupWindow = window.open('','','width='+w+',height='+h+',left='+x+',top='+y+',screenX='+x+',screenY='+y);
    popupWindow.document.write(site);
}

function showbigpicture(sBigImage, sPicID) {
	var	sAbzugY = -55;
	if (op7) {
		sAbzugY = 15;
	}
	else if (ff) {
		sAbzugY = -273;
	}
	var sSmallPicture = document.getElementById(sPicID);
	var sSmallPictureYPos = findPosY(sSmallPicture);
	var sPicDiv = document.getElementById("showbigpictureimage");
	//sPicDiv.style.left = 15 + "px";
	sPicDiv.style.top = (sSmallPictureYPos - sAbzugY) + "px";
	//sPicDiv.style.display = "inline";
	sPicDiv.style.display = "block";
	sPicDiv.src = sBigImage;
}	
function closebigpicture(element) {
	var sPicDiv = document.getElementById(element.id);
	sPicDiv.style.display = "none";
	sPicDiv.src = "";
}
function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}


function callMap24()
{
	var sUrl = "http://link2.de.map24.com";
	sUrl += "?lid=8ec75e27";
	sUrl += "&maptype=JAVA";
	sUrl += "&width=1500";
	sUrl += "&action=route";
	sUrl += "&ddescription=" + encodeURIComponent(document.frmForm.ddescription.value);
	sUrl += "&dstreet=" + encodeURIComponent(document.frmForm.dstreet.value);
	sUrl += "&dzip=" + encodeURIComponent(document.frmForm.dzip.value);
	sUrl += "&dcity=" + encodeURIComponent(document.frmForm.dcity.value);
	sUrl += "&dcountry=de";
	sUrl += "&rtype=fast";
	sUrl += "&sstreet=" + encodeURIComponent(document.frmForm.sstreet.value);
	sUrl += "&szip=" + encodeURIComponent(document.frmForm.szip.value);
	sUrl += "&scity=" + encodeURIComponent(document.frmForm.scity.value);
	sUrl += "&scountry=" + encodeURIComponent(document.frmForm.scountry.options[document.frmForm.scountry.selectedIndex].value);

	window.open(sUrl);
}	

