	// create the jQuery object if it doesn't already exist
	if(typeof(jQuery)=='undefined') jQuery = function(){};

	// create the root classbehaviours object if it doesn't already exist
	if(typeof(jQuery.classBehaviours)=='undefined') jQuery.classBehaviours = function(){};

	// create the handlers child object if it doesn't already exist
	if(typeof(jQuery.classBehaviours.handlers)=='undefined') jQuery.classBehaviours.handlers = function(){}

	// resizes an iframed popup to the document's height
	jQuery.classBehaviours.handlers.popUpLayer = {
		// properties
		name: 'popUpLayer',
		// methods
		start: function(node){
			// cosmetic adjustments for MSIE 6
			if(navigator.userAgent.indexOf('MSIE 6')>-1){
				node.style.height = document.body.offsetHeight + 'px';
			}
		}
	}

	// a (hidden) link for opening a popup layer
	jQuery.classBehaviours.handlers.openPopUpLayer = {
	    // properties
	    name: 'openPopUpLayer',
	    // methods
	    start: function (node) {
	        node.onmouseup = this.open;
	        if (jQuery.classBehaviours.utilities.getClassParameter(node, 'auto', 'no') == 'yes') this.auto(node);
	    },
	    auto: function (node) {
	        var opl = jQuery.classBehaviours.handlers.openPopUpLayer;
	        var acn = jQuery.classBehaviours.handlers.animatedClassName;
	        // if there is an iframe transfer the url
	        if (node.getAttribute('target') != null) {
	            document.getElementById(node.getAttribute('target')).src = node.href;
	            frames[node.getAttribute('target')].location.replace(node.getAttribute('href'));

	        }
	        // trigger the open animation
	        animParameter = jQuery.classBehaviours.utilities.getClassParameter(node, 'click', '0,4,4');
	        jQuery.classBehaviours.utilities.setClassParameter(node, 'load', animParameter);
	        acn.start(node);
	        // trigger the open event
	        opl.open(node);
	    },
	    // events
	    open: function (that) {
	        var node = (typeof (this.nodeName) == 'undefined') ? that : this;
	        // tell the body that a layer is open (to avoid select elements shining through in MSIE 6)
	        jQuery.classBehaviours.utilities.setClassParameter(document.body, 'popup', 'open');
	        // get the target node, if we can't find the ID, we are probably going to find in in the link
	        linkTarget = (node.href != null) ? (node.href.indexOf('#') > -1) ? node.href.split('#')[1] : null : null;
	        linkTarget = jQuery.classBehaviours.utilities.getClassParameter(node, 'id', linkTarget);
	        // transfer the title of the link to the popup
	        if (node.getAttribute('title') != null && node.getAttribute('title') != '') document.getElementById(linkTarget).getElementsByTagName('H1')[0].innerHTML = node.getAttribute('title');
	        // if there is no animation defined, open it the easy way
	        document.getElementById(linkTarget).style.display = 'block';

	    }
	}

	// closes a popup from within an iframe
	jQuery.classBehaviours.handlers.closePopUpLayer = {
	    // properties
	    name: 'closePopUpLayer',
	    // methods
	    start: function (node) {
	        node.onmousedown = (parent != self) ? this.closeInParent : this.closeInSelf;
	    },
	    // events
	    closeInSelf: function (that) {
	        
	        // For stopping VideoPlayer
	        var player = $("#Object1");
	        if (player != null && player != undefined) {
	                player.sendEvent('STOP');
	        }

	        var node = (typeof (this.nodeName) == 'undefined') ? that : this;
	        // get the target node, if we can't find the ID, we are probably going to find in in the link
	        linkTarget = (node.href != null) ? (node.href.indexOf('#') > -1) ? node.href.split('#')[1] : null : null;
	        linkTarget = jQuery.classBehaviours.utilities.getClassParameter(node, 'id', linkTarget);
	        // tell the body that a layer is closed (to avoid select elements shining through in MSIE 6)
	        jQuery.classBehaviours.utilities.setClassParameter(document.body, 'popup', 'close');
	        // trigger the close link of the target
	        targetNode = document.getElementById(linkTarget).getElementsByTagName('A')[0];
	        document.getElementById(linkTarget).style.display = 'none';
	        // When the Href is filled and doesnt contain an hash, set parent location to href
	        if (node.href.indexOf('#') < 0 && node.href.indexOf(':blank') < 0)
	            parent.location = node.href;
	    },
	    closeInParent: function (that) {
	        // For stopping VideoPlayer
	        var player = $("#Object1");
	        if (player != null) {
	            player.sendEvent('STOP');
	        }

	        var node = (typeof (this.nodeName) == 'undefined') ? that : this;
	        // get the target node, if we can't find the ID, we are probably going to find in in the link
	        linkTarget = (node.href != null) ? (node.href.indexOf('#') > -1) ? node.href.split('#')[1] : null : null;
	        linkTarget = jQuery.classBehaviours.utilities.getClassParameter(node, 'id', linkTarget);
	        // if we couldn't find any target
	        if (linkTarget == null) {
	            // close all popups in the parent frame
	            allElements = parent.document.getElementsByTagName('A');
	            for (var a = 0; a < allElements.length; a++) {
	                if (allElements[a].className.indexOf('closePopUpLayer') > -1) {
	                    if (allElements[a].className.indexOf('animatedClassName') < 0) parent.document.getElementById(allElements[a].split('id_')[0].split(' ')[0]).style.display = 'none';
	                    else parent.jQuery.classBehaviours.handlers.animatedClassName.clickToPlay(allElements[a]);
	                }
	            }
	            // else
	        } else {
	            // tell the body that a layer is closed (to avoid select elements shining through in MSIE 6)
	            parent.jQuery.classBehaviours.utilities.setClassParameter(parent.document.body, 'popup', 'close');
	            // trigger the close link of the target
	            targetNode = parent.document.getElementById(linkTarget).getElementsByTagName('A')[0];
	            parent.document.getElementById(linkTarget).style.display = 'none';
	        }
	        // When the Href is filled and doesnt contain an hash, set parent location to href
	        if (node.href.indexOf('#') < 0 && node.href.indexOf(':blank') < 0)
	            parent.location = node.href;
	    }

	}

	// print the contents of the popup layer
	jQuery.classBehaviours.handlers.printPopUpLayer = {
		// properties
		name: 'printPopUpLayer',
		// methods
		start: function(node){
			node.onclick = this.print;
		},
		// events
		print: function(that){
			var node = (typeof(this.nodeName)=='undefined') ? that : this ;
			// get the target node, if we can't find the ID, we are probably going to find in in the link
			linkTarget = (node.href!=null) ? (node.href.indexOf('#')>-1) ? node.href.split('#')[1] : null : null;
			linkTarget = jQuery.classBehaviours.utilities.getClassParameter(node, 'id', linkTarget);
			// if this is an iframe
			iFrames = document.getElementById(linkTarget).getElementsByTagName('IFRAME');
			if(iFrames.length>0){
				// print the contents of the iframe
				frames[iFrames[0].name].focus();
				frames[iFrames[0].name].print();
			// else
			}else{
				// print the page
				window.print();
			}
		}
	}

	// add this addon to the jQuery object
	if(typeof(jQuery.fn)!='undefined'){
		// extend jQuery with this method
		jQuery.fn.popUpLayer = function(){
			return this.each(
				function(){
					jQuery.classBehaviours.handlers.popUpLayer.start(this);
				}
			);
		};
		jQuery.fn.openPopUpLayer = function(){
			return this.each(
				function(){
					jQuery.classBehaviours.handlers.openPopUpLayer.start(this);
				}
			);
		};
		jQuery.fn.closePopUpLayer = function(){
			return this.each(
				function(){
					jQuery.classBehaviours.handlers.closePopUpLayer.start(this);
				}
			);
		};
		jQuery.fn.printPopUpLayer = function(){
			return this.each(
				function(){
					jQuery.classBehaviours.handlers.printPopUpLayer.start(this);
				}
			);
		};
		// set the event handler for this jQuery method
		$(document).ready(
			function(){
				$(".popUpLayer").popUpLayer();
				$(".openPopUpLayer").openPopUpLayer();
				$(".closePopUpLayer").closePopUpLayer();
				$(".printPopUpLayer").printPopUpLayer();
			}
		);
	}

