var bugRiddenCrashPronePieceOfJunk = (
    navigator.userAgent.indexOf('MSIE 5') != -1
    &&
    navigator.userAgent.indexOf('Mac') != -1
);

var W3CDOM = (!bugRiddenCrashPronePieceOfJunk && 
    document.getElementsByTagName && document.createElement);

if ((top != self.parent) && !self.disabled)
    top.location.href = '/index.html';

if (top.navi && top.navi.setNav) top.navi.setNav(location.href,'currentPage');
top.setNav = location.href;


window.onload = initialize; 

/* Why no window.onload = function () {} ? Because NN3 doesn't support the function
    constructor and gives an error message. This site must be accessible to NN3 */

function initialize () {

    
/* Hide nifty stuff from old browsers */

    if (W3CDOM)
    
    {

/* Go through all links. If any has a type="popup" write the popup function into its onclick
   Any external link gets a target='ppk'. */
    
    var x = document.getElementsByTagName('a');
    for (var i=0;i<x.length;i++)
    {
        if (x[i].getAttribute('type') == 'popup')
        {
            x[i].onclick = function () {
                return pop(this.href)
            }
            x[i].innerHTML += '<span class="smaller"> (popup)</span>';
        }
        if (x[i].className == 'external')
            x[i].target = 'ppk';
        if (x[i].className == 'outoforder')
        {
            x[i].title = 'OUT OF ORDER';
            x[i].target = 'ppk';
            x[i].onclick = function ()
            {
                return confirm('This link is out of order. Continue anyway?');
            }
        }
    }
    

/* Add breadcrumb of current page to logo frame */
        
    if (top.logo && top.logo.addBreadCrumb)
        top.logo.addBreadCrumb(document.title,location.href);

/* Add IE version to page title */

    var browser = '';
    
    if (document.all)
    {
        detect = navigator.userAgent.toLowerCase();

        if (checkItLocal('msie')) 
        {
            browser = "IE "
            browser += detect.substr(placeOfDetect + thestring.length,3);
            document.title = document.title;
        }
    }

    }

    
    if (self.init) self.init();
}

window.onunload = remove;

function remove () {
    if (top.navi && top.navi.setNav) top.navi.setNav(location.href,'');
    top.setNav = '';
    if (self.exit) self.exit();
}





// Cookies

function createCookie(name,value,days)
{
    if (days)
    {
        var date = new Date();
        date.setTime(date.getTime()+(days*24*60*60*1000));
        var expires = "; expires="+date.toGMTString();
    }
    else var expires = "";
    document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name)
{
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for(var i=0;i < ca.length;i++)
    {
        var c = ca[i];
        while (c.charAt(0)==' ') c = c.substring(1,c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    }
    return null;
}

function eraseCookie(name)
{
    createCookie(name,"",-1);
}

function checkItLocal(string)
{
    placeOfDetect = detect.indexOf(string) + 1;
    thestring = string;
    return placeOfDetect;
}


// push and shift for IE5

function Array_push() {
    var A_p = 0
    for (A_p = 0; A_p < arguments.length; A_p++) {
        this[this.length] = arguments[A_p]
    }
    return this.length
}

if (typeof Array.prototype.push == "undefined") {
    Array.prototype.push = Array_push
}

function Array_shift() {
    var A_s = 0
    var response = this[0]
    for (A_s = 0; A_s < this.length-1; A_s++) {
        this[A_s] = this[A_s + 1]
    }
    this.length--
    return response
}

if (typeof Array.prototype.shift == "undefined") {
    Array.prototype.shift = Array_shift
}
