<!--
//initialisiere Menü und Titelleiste

function init()
{
	testTopURL(1);	
	if (top.frames.length != 0) {
		parent.initMenue();
		parent.document.title=parent.maintitle+' :: '+document.title;
	}
}


function initFrame()
{
	testTopURL(1);
	if (top.frames.length != 0) {
		parent.parent.initMenue();
		parent.parent.document.title=parent.parent.maintitle+' :: '+document.title;
	}
}


/**
 * Sets a Cookie with the given name and value.
 *
 * name       Name of the cookie
 * value      Value of the cookie
 * [expires]  Expiration date of the cookie (default: end of current session)
 * [path]     Path where the cookie is valid (default: path of calling document)
 * [domain]   Domain where the cookie is valid
 *              (default: domain of calling document)
 * [secure]   Boolean value indicating if the cookie transmission requires a
 *              secure transmission
 */
function setCookie(name, value, expires, path, domain, secure) {
	/*var expdate = new Date();
	if (expires) {
		expdate.setTime(expdate.getTime() + expires*24*60*60*1000);
		//alert(expires + " : Cookie \"" +name + "\" expires " + expdate.toGMTString());
	}
    
	document.cookie= name + "=" + escape(value) +
        	((expires) ? "; expires=" + expdate.toGMTString() : "") +
	        ((path) ? "; path=" + path : "") +
	        ((domain) ? "; domain=" + domain : "") +
	        ((secure) ? "; secure" : "");    */
}

/**
 * Gets the value of the specified cookie.
 *
 * name  Name of the desired cookie.
 *
 * Returns a string containing value of specified cookie,
 *   or null if cookie does not exist.
 */
function getCookie(name) {
    /*var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1) {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    } else {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1) {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));  */
}

/**
 * Deletes the specified cookie.
 *
 * name      name of the cookie
 * [path]    path of the cookie (must be same as path used to create cookie)
 * [domain]  domain of the cookie (must be same as domain used to create cookie)
 */
function deleteCookie(name, path, domain) {
   /* if (getCookie(name)) {
        document.cookie = name + "=" +
            ((path) ? "; path=" + path : "") +
            ((domain) ? "; domain=" + domain : "") +
            "; expires=Thu, 01-Jan-70 00:00:01 GMT";
    }             */
}

// tested, ob die URL des Haupt-Framsets (top.document.URL) von einer bestimmten domain kommt
// erlaubt sind die Domain (z.B. ccvossel.de) bzw. www.domain (z.B. www.ccvossel.de)
// useCookie	Soll - so möglich - die Weiterleitung via Cookies realisiert werden? (1: Cookies; 0: über parameterangabe in der URL)
// tested, ob die URL des Haupt-Framsets (top.document.URL) von einer bestimmten domain kommt
// erlaubt sind die Domain (z.B. ccvossel.de) bzw. www.domain (z.B. www.ccvossel.de)
// useCookie	Soll - so möglich - die Weiterleitung via Cookies realisiert werden? (1: Cookies; 0: über parameterangabe in der URL)
function testTopURL(useCookie) {

  var topURL=unescape(top.document.URL);
  var startpage="/";
  var newPage;
  var bIndex = false;
//alert(topURL);
  // für locale dateien automatische weiterleitung ignorieren
  if (topURL.substr(0,5)=="file:" && document.URL.substr(0,5)=="file:" ) {
	return true;
  }

  // ein par mögliche aber irrelevante unterschiede eleminieren

  // erst ein mal die protokolle
  if (topURL.substr(0,5)=="http:") {
     topURL=topURL.substring(6);
  }else if (topURL.substr(0,6)=="https:") {
     topURL=topURL.substring(7) ;
  }


  // der ie kennt ja auch noch \ anstat /
  while (topURL.indexOf("\\")>=0){
    topURL=topURL.replace(/\\/,"/");
  }

  // alle "/" am anfang
  while (topURL.substr(0,1)=="/"){
    topURL=topURL.substring(1);
  }

  // eventuelle Parameter entfernen
  if (topURL.indexOf("?")>=0) {
	  topURL=topURL.substr(0,topURL.indexOf("?"));
  }
  // und auf die domain kürzen
  if (topURL.indexOf("/")>=0) {
	  topURL=topURL.substr(0,topURL.indexOf("/"));
  }

  //alert("top.document.URL = " + top.document.URL +"\ndocument.URL = "+ document.URL);
  
  if ((document.URL.toLowerCase() == "http://pbbc.de/index.html") || (document.URL.toLowerCase() == "http://pbbc.de/")){
	  bIndex = true;
  }

  // und testen ob wir neu laden muessen
  if (((topURL.toLowerCase() != "pbbc.de") && (topURL.toLowerCase() != "www.pbbc.de") && // weder eine der de-domains
 	(topURL.toLowerCase() != "pbbc.de/principal.htm") && (topURL.toLowerCase() != "www.pbbc.de/principal.htm")) // noch eine der com domains
	|| (top.document.URL == document.URL)){ // oder einfach gar kein frameset
    /*alert("Have to reload the original frame");
	alert("top" + topURL.toLowerCase());*/
    
    // für google: wenn wir auf einer gültigen domain sind bleiben wir da 
    if ((topURL.toLowerCase() == "pbbc.de") || (topURL.toLowerCase() == "www.pbbc.de") || 
 	(topURL.toLowerCase() == "pbbc.de/principal.html") || (topURL.toLowerCase() == "www.pbbc.de/principal.html")) {
	newPage="http://" + topURL.toLowerCase() + startpage;
    } else {
	newPage="http://www.pbbc.de/principal.html" + startpage;
    }
    //alert("going to reload with frameset from: " + newPage);

    
	// versuche die eigentliche URL als cookie zu übergeben
    /*if (useCookie){
	setCookie ("newURL", location.pathname,1,"/");
    }
    
    //Test ob die URL als cookie übergeben wurde
    if (getCookie('newURL')!=location.pathname) { 
	//nein - also als Parameter in der URL der startseite
	newPage = newPage + "?" + location.pathname;
    }*/
	//alert("newPage: "+ newPage + "|"+bIndex);
	if (bIndex){
		newPage = "http://pbbc.de/index.htm";
		return true;
	}else{
		//alert("passa");
		newPage = "http://pbbc.de/principal.htm"
		ver = parseInt(navigator.appVersion, 10);
		if ( ((navigator.appName == "Netscape") && (ver >= 3)) ||
		   ((navigator.appName == "Microsoft Internet Explorer") && (ver >= 4)) ){
		  top.location.replace(newPage);
		}else {
		  top.location = newPage;
		}
	}
  }
}


-->
