////////////////////////////////////////////////////////////////
//
// lib.js
// JavaScript Standard-Bibliothek für Weblication CMS-Seiten
//
// erstellt durch Andreas Hecht, bochmann. GbR
//
////////////////////////////////////////////////////////////////

var page_frame = "mid";
var frameset_url = "/index.php4";
var popwin;

chkRelocate();

// lädt, falls nicht vorhanden, das komplette Frameset nach
function chkRelocate () {
	var regexp = "http://"+location.hostname;
	if (top.name.substr(0,6) != "weblic") { // nur, wenn nicht innerhalb von Weblication aufgerufen
		if (self.name != page_frame) {
			page = location.href.replace (regexp,'')
			new_location = frameset_url + "?page=" + escape(page);
			regexp = "^(/de/)|(/en/)";
			if (location.pathname.match (regexp)) new_location += '&lang=' + location.pathname.substring(1,3);
			location.replace (new_location);
		}
	}
}

function popup (url,w,h,x,y) {
    a = arguments;
    url = a[0] ? a[0] : "about:blank";
    w = a[1] ? a[1] : 300;
    h = a[2] ? a[2] : 200;
    x = a[3] ? a[3] : screen.width/2 - w/2;
    y = a[4] ? a[4] : screen.height/2 - h/2;
    popwin = window.open (url,"","width="+w+",height="+h+",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes");
    if (popwin) {
    	popwin.resizeTo (w,h);
    	popwin.moveTo (x,y);
    }
    setTimeout ("popwin.focus ()",500);
}
