var spawn;

function popup(file, name, gx, gy, px, py, options) {
	if (name==null) {
		if (this.name=='opener') {
			name = 'microsite';
			gx = 625;	// breite
			gy = 600;	// hoehe
			var x=0, y=0, xm=0, ym=0, woff=0, hoff=0;
			if (window.screenX)    x = window.screenX;
			if (window.screenLeft) x = window.screenLeft;
			if (window.screenY)    y = window.screenY;
			// if (window.screenTop))  y = window.screenTop-20;
			if (window.screenTop)  y = window.screenTop;
			
			
			
	// url-leiste, tabbars etc. rausrechnen
			woff = hoff = 0;
			if (window.outerWidth) {
				woff = window.outerWidth  - window.innerWidth;
				hoff = window.outerHeight - window.innerHeight;
			}

			x = x + woff + 240;		// x-offset
			y = y + hoff + 0;		// y-offset

			
			xm = screen.width;
			ym = screen.height;
			
			if (x > xm-gx) x = xm-gx;
			if (y > ym-gy) y = ym-gx;
			
			options = 'scrollbars=yes,resizable=yes';
			px = x;
			py = y;
			
			
		} else {
			return true;
		}
	}
	spawn = window.open(file, name, 'width=' + gx + ',height=' + gy + ',left=' + px + ',top=' + py + ((options != '') ? ',' + options : ''));
	if (!spawn) {
		if (document.getElementById('seiteninhalt')) {
			merk = document.getElementById('seiteninhalt').innerHTML;
			document.getElementById('seiteninhalt').innerHTML = '<h1>Popup-Blocker detected</h1><div class="text"><p>You have installed a popup-blocker. You have to deactivate it, to use all features of this website.<br><br>Please klick <a href="#" onclick="document.getElementById(\'seiteninhalt\').innerHTML=merk; popup(\''+file+'\',\''+name+'\',\''+gx+'\',\''+gy+'\',\''+px+'\',\''+py+'\',\''+options+'\'); return false;">here</a>, top open your popup manually.</p><div>';
		}
	} else {
		// spawn.resizeTo(gx, gy);
		spawn.moveTo(px, py);
		spawn.focus();
		return false;
	}
}
var merk = '';

function popupModal(pfad, name, gx, gy, px, py, options) {
        if (document.all && !navigator.userAgent.match(/opera/i)) {
                var ausgabe = showModalDialog(pfad, '' ,'resizable:no; scroll:no; center:no; dialogWidth:'+gx+'px; dialogHeight:'+gy+'px; dialogTop:'+py+'px; dialogLeft:'+px+'px; status:no;');
        } else {
                spawn = window.open(pfad, name, 'alwaysRaised=yes,dependent=yes, width=' + gx + ',height=' + gy + ',left=' + px + ',top=' + py + ((options != '') ? ',' + options : ''));
                spawn.resizeTo(gx, gy);
                spawn.moveTo(px, py);
                spawn.focus();
        }
        return;
}

function confirmModal(pfad, name, gx, gy, px, py, options) {
        if (document.all && !navigator.userAgent.match(/opera/i)) {
                var ausgabe = showModalDialog(pfad, '' ,'resizable:no; scroll:no; center:no; dialogWidth:'+gx+'px; dialogHeight:'+gy+'px; dialogTop:'+py+'px; dialogLeft:'+px+'px; status:no;');
                if (ausgabe) {
                        if (ausgabe=='ja') jaclick();
                        else neinclick();
                }
        } else {
                spawn = window.open(pfad, name, 'alwaysRaised=yes,dependent=yes, width=' + gx + ',height=' + gy + ',left=' + px + ',top=' + py + ((options != '') ? ',' + options : ''));
                spawn.resizeTo(gx, gy);
                spawn.moveTo(px, py);
                spawn.focus();
        }
        return;
}


