var gsTpsStartPage = "/hoofdpunten/hoofdpunten.html";

function TpsSignOn(pWindow) {
        if ((top.window.thisWebSite)&&(top.window.thisWebSite.value == "NOS")) {
		top.window.thisWebSite.signOn(pWindow.document.URL);
	}
	else{
		TpsSignOff(pWindow);
	}
}

function TpsSignOff(pWindow) {

	if (!top.window.thisWebSite) {
		var theWebDef = new TpsWebDef(pWindow.document.URL);
		var theNewLocation =	(theWebDef.homePage+"#@"+pWindow.document.URL)
		theNewLocation = theNewLocation.replace(/\\/gi, "/");
		top.window.document.location.replace(theNewLocation);
	}
}

/* ------ TpsWebDef (Global Object ------*/

/* CONSTRUCTOR */
function TpsWebDef(pHref) {this.initWebDef(pHref);}

/* INTERFACE */
TpsWebDef.prototype.initWebDef=TpsWebDef_initWebDef;
TpsWebDef.prototype.getHomePath=TpsWebDef_getHomePath;

function TpsWebDef_initWebDef(pHref) {
	pHref = pHref.replace(/\\/gi, "/");
        this.rootId="nieuws";
	this.index="index.html";
	this.homePath=this.getHomePath(pHref);
	this.homePage=this.homePath+"/"+this.index;
}

function TpsWebDef_getHomePath(pHref) {
	var sRetval
	var theFoundChunk=0; var theHrefTbl=pHref.split("/");
	for (var i=0; i<theHrefTbl.length; i++) {
		if ((theHrefTbl[i])&&(theHrefTbl[i].indexOf(this.rootId)!=-1)) {
			theFoundChunk=i; break;
		}
	}
	theHrefTbl.length=theFoundChunk+1;
	sRetval=theHrefTbl.join("/");
	return sRetval;
}

// function popUp
function popUp(url,width,height,marginTop,marginLeft,scrollBar)
{
newWindow = window.open(url,'newwindow',
'width=' + width +
',height=' + height +
',toolbar=no,directories=no,status=no,resize=no,menubar=no' +
',top=' + marginTop +
',left=' + marginLeft +
',scrollbars=' + scrollBar);
}