var isNS4 = false;
var isNS = false;
var isIE4 = false;
var isIE5 = false;
var isIE = false;
var isOP = false;
/*
 * check differents browsers
 */
function checkBrowser () {
        var browser = navigator.appName;
		var version = navigator.appVersion;

        var isNav = (browser.indexOf("Netscape")>=0);
        if (isNav) {
	        if (parseFloat(version)<5) {  isNS4=true; }
	        else { isNS = true; }
        }
        if (browser.indexOf("Microsoft") >=0){
	        if ((version.indexOf("MSIE 5")>0) || (version.indexOf("MSIE 6")>0) || (version.indexOf("MSIE 7")>0)) { 
	            if ((version.indexOf("MSIE 5")>0)) { isIE5 = true; }
	            isIE = true; }
	        else { isIE4 = true; }
        }
        if (isIE4 || isNS4 ){ return false; }
    	else { return true; }
}
/*
 * write the an alpha frame
 */
function writeAlphaFrame (theDocument, theContent, theCSS) {
    var imgBaseURL = "http://" + hostName + "/"+ top.VirtualDir;
    theDocument.close();
    theDocument.open();
    theDocument.writeln ('<html><head><title>aplha frame</title>');
    if (theCSS){
         theDocument.writeln ('<style type="text/css">');
         theDocument.writeln (theCSS);
         theDocument.writeln ('</style>');
    }
    writeCSS (theDocument);
    theDocument.writeln ('</head>');
    theDocument.writeln ('<body style="margin:0;padding:0px;height:100%;">')
    theDocument.writeln ('<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="3"><tr><td valign="top" align="center">');
    theDocument.writeln ('<TABLE border="0" cellpadding="0" cellspacing="0" bgcolor="#E9E9E9" width="100%" height="100%" background="'+ imgBaseURL +'/img/skin/back.gif">');
    theDocument.writeln ('<TR><TD height="1"><IMG src="'+ imgBaseURL +'/img/skin/lo.gif" width="6" height="6"></TD><TD align="center" background="'+ imgBaseURL +'/img/skin/oben.gif">');
    theDocument.writeln ('<IMG src="'+ imgBaseURL +'/img/skin/dummypixel.gif" height="6" width="1"></TD><TD><IMG src="'+ imgBaseURL +'/img/skin/ro.gif" width="6" height="6"></TD></TR>');
    theDocument.writeln ('<TR><TD width="6" background="'+ imgBaseURL +'/img/skin/links.gif">&nbsp;</TD><TD align="left" valign="top">');
    // the content
    theDocument.writeln (theContent);
    theDocument.writeln ('</TD><TD width="6" background="'+ imgBaseURL +'/img/skin/rechts.gif">&nbsp;</TD></TR><TR><TD height="1"><IMG src="'+ imgBaseURL +'/img/skin/lu.gif" width="6" height="6"></TD>')
    theDocument.writeln ('<TD align="center" background="'+ imgBaseURL +'/img/skin/unten.gif"><IMG src="'+ imgBaseURL +'/img/skin/dummypixel.gif" height="6" width="1"></TD><TD><IMG src="'+ imgBaseURL +'/img/skin/ru.gif" width="6" height="6"></TD></TR>');
    theDocument.writeln ('</table></td></tr></table></body>');
    theDocument.writeln ('</html>');
    theDocument.close();
}
/* 
 * display pin on map
 */
function displayPin(xCenter, yCenter){
    // move the pin to the coord
    var thePoint = getPixelXY(xCenter, yCenter);
    // display pin
    thePin = MapFrame.document.getElementById("pin").style;
    thePin.left = parseInt(thePoint[0]- (getWidth(thePin)/2));
    thePin.top = parseInt(thePoint[1] - (getHeight(thePin)/2));
    thePin.visibility="visible";
}
/*
 * hide the pin
 */
function hidePin(){
    MapFrame.document.getElementById("pin").style.visibility="hidden";
}
/*
 * display tip for map-panning
 */
function displayTip () {
    var theTip =  MapFrame.document.getElementById("tip").style;
    theTip.left =  0; //parseInt(mWidth/2 - 80);
    theTip.top = 0; //parseInt(mHeight/2);
    theTip.visibility = 'visible';
}
/*
 * hide panning-tip
 */
function hideTip () {
    MapFrame.document.getElementById("tip").style.visibility = 'hidden';
}
/*
 * get width of a div
 */
function getWidth (theDiv) {    
    return parseInt(theDiv.width);
}
/*
 * get height of a div
 */
function getHeight (theDiv) {
    return parseInt(theDiv.height);
}
/*
 * set window status 
 */
function setStatus (theText) {
    window.status = theText;
    return true;
}
