/**********************/
/* start of Popups.js */

function popups() {
    var pop = new Object;

    //get links
    pop.links = document.getElementsByTagName('a');
    pop.linksLen = pop.links.length;

    //for each link
    for(var i=0; i<pop.linksLen; i++) {
        //if this link has a target attribute set to "_blank"
        if(pop.links[i].target === '_blank' && typeof(pop.links[i].className) === 'string' && !pop.links[i].className.match(/\bnoPopup\b/)) {
				//bind default click handler
				pop.links[i].onclick = function() {
					//open a custom window with link href
					pop.win = open(this.href,'popWin','width=500,height=370,status=yes,scrollbars=yes,scrolling=yes,toolbar=no,menubar=no,location=no,resizable=yes');
					//dont follow the link
					return false;
				}
		}	
        else if(pop.links[i].target === '_blank' && typeof(pop.links[i].className) === 'string' && pop.links[i].className.match(/\bnoPopup\b/)) {
            pop.links[i].onclick = function() {
            //open a custom window with link href
            pop.win = open(this.href,'popWin');
            //dont follow the link
            return false;
            }            
        }
    }
}

/* end of Popups.js */
/********************/

//setup encapsulated event handlers by known browser limitations
var kde = (navigator.vendor == 'KDE');
var op7 = /opera[\/ ]7/i.test(navigator.userAgent);

//konqueror supports addEventListener but in < 3.2 it doesn't work
//otherwise this is the standard condition
if(!kde && typeof window.addEventListener != "undefined")
{
    window.addEventListener('load',onloadFunction,false);
}
//opera supports addEventListener but the load event comes from document
else if(op7)
{
    document.addEventListener('load',onloadFunction,false);
}
//win/ie has a proprietary method
else if(typeof window.attachEvent != "undefined")
{
    window.attachEvent('onload',onloadFunction);
}
//for everyone else
else
{
    //if there's an existing onload function
    if(typeof window.onload == "function")
    {
        //copy it and then call it before our function
        var currentOnload = onload;
        window.onload = function()
        {
            currentOnload();
            onloadFunction();
        };
    }
    else
    {
        //otherwise just call our function
        window.onload = onloadFunction;
    }
    //this method will end up being mac/ie5, konqueror, 
    //and anything else that gets this far
    //this script should come *after* any other scripting on the page
    //to avoid overwriting other onload functions
}


//initialise constructor
function onloadFunction()
{

    popups();
}

