function uvdrag_attach( element ) {
	/**
	 *	@browser IE
	 *	Dragging behavior is unintutive (mouse down, drag 1px, mouse up, drag, 
	 *	click to release drag).
	 *
	 *	@browser Safari
	 *	Provide positioning styles inline to workaround this "bug": https://mootools.lighthouseapp.com/projects/2706/tickets/462-positioning-in-safarichromewebkit
	 */
/*	if( isIE( ) ) {
		return;
	}*/
	
	var draggables = $$( $pick( element, '.uvDraggable' ) );
	var cookie = new Hash.Cookie( 'uvDraggables', { path: AURI } );
	
	var undo = function( e ) {
		draggables.each( function( node ) {
			node.drag.fireEvent( 'reset', node );
		} );
	}
	var keyboard = new Keyboard( {
		  active: false
		, preventDefault: true
		, events: {
			 'meta+z': undo
			,'ctrl+z': undo
		  }
	} );
	
	draggables.each( function( node ) {
		var origin = node.getPosition( node.getOffsetParent( ) );
		node.store( 'origin', origin );
		node.setPosition( $pick( cookie.get( node.id ), origin ) );
		node.addClass( 'placed' );
		node.setStyles( { right: 'auto', bottom: 'auto' } );
		
		if( node.getPosition( ).x != origin.x || node.getPosition( ).y != origin.y ) {
			keyboard.activate( );
			node.setStyle( 'cursor', 'move' );
		}
		
		node.drag = new Drag(
			  node
			, {
				  snap: 0
				, onStart: function( node ) {
					node.setStyle( 'cursor', 'move' );
				  }
				, onComplete: function( node, event ) {
					keyboard.activate( );
					cookie.set( node.id, node.getPosition( ) );
				  }
				, onReset: function( node ) {
					keyboard.deactivate( );
					var origin = node.retrieve( 'origin' );
					node.morph( { top: origin.y, left: origin.x } );
					cookie.set( node.id, origin );
				  }
			  }
		);
	} );
}

function uvflash_attach( ) {
	if( typeof( flashUpshift ) != "undefined" ) {
		for( var ii = 0; ii < flashUpshift.length; ii++ ) {
			var d			= flashUpshift[ii];
			var hardpoint	= d[0];
			var flashObj	= d[1];
			var version		= d[2];
			var dx			= d[3];
			var dy			= d[4];
			var flashVars	= d[5] ? d[5] : '';
			
			if( getFlashVersion( ) < version )
				return uvflash_prompt();
				
			var obj = getObj( hardpoint );
			
			if( obj ) {
				clearNode( obj );
				
				var params = {
					 allowScriptAccess	: 'sameDomain'
					,movie				: flashObj
					,quality			: 'high'
					,bgcolor			: '#FFFFFF'
					,flashVars			: flashVars
					/**
					 *	@browser IE
					 *	Allows drop-downs to work.
					 */
					,wmode				: 'transparent'
					};
				
/*				This approach doesn't work so well for FF3. Might as well just use innerHTML for everything (even though it's not in the standard).
				
				if( !isIE() && !isOpera() ) {
					var fbase = obj.appendChild(
						document.createElement( 'object' )
					);

					fbase.classid
						= 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000';

					fbase.codebase
						= 'http://fpdownload.macromedia.com/'
						+ 'pub/shockwave/cabs/flash/swflash.cab'
						+ '#version=7,0,0,0'
						;

					fbase.width 	= dx;
					fbase.height	= dy;
					fbase.wmode		= 'transparent';
					
					var p;
					
					for( var k in params ) {
						p = fbase.appendChild(
							document.createElement( 'param' )
							);
						p.name	= k;
						p.value	= params[ k ];
					}
					
					var emb = fbase.appendChild(
						document.createElement( 'embed' )
					);
					
					emb.src			= flashObj;
					emb.quality		= 'high';
					emb.bgcolor		= '#FFFFFF';
					emb.type		= 'application/x-shockwave-flash';
					emb.pluginspage	= 
						'http://www.macromedia.com/go/getflashplayer';
					emb.width		= dx;
					emb.height		= dy;
					emb.wmode		= 'transparent';
				} else {*/
					
					phtml = '';
					for( var k in params ) {
						phtml = phtml + '<param name="' + k
							+ '" value="' + params[k] + '" />'
							;
						}
				
					obj.innerHTML =
'<object	classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' +
'			codebase="http://download.macromedia.com/pub/shockwave/cabs/flash' +
		   '/swflash.cab#version=' + version +',0,0,0"' +
'			width="' + dx + '"' +
'			height="' + dy + '">' +
'	' + phtml +
'	<embed	src="' + flashObj + '"' +
'			quality="high"' +
'			width="' + dx + '"' +
'			height="' + dy + '"' +
'			flashVars="'+ flashVars +'"' +
'			type="application/x-shockwave-flash"' +
'			pluginspage="http://www.macromedia.com/go/getflashplayer"' +
'			wmode="transparent" />' +
'</object>';
//				}
			}
		}
	}
}

function uvflash_prompt() {
	obj = getObj( 'uvPromptFlash' )
	
	if( !obj )
		return;
	
	obj.style.display = 'block';
}
	
var _flashVersion = null;
function getFlashVersion( ) {
	if( _flashVersion !== null ) return _flashVersion;
	
	if( navigator.plugins
	&&	navigator.plugins.length ) {
		var p = navigator.plugins;
		for( var ii = 0; ii < p.length; ii++ ) {
			if( p[ ii ].name.indexOf( 'Shockwave Flash' ) != -1 ) {
				_flashVersion = p[ ii ].description.split(
					'Shockwave Flash' )[1];
				break;
				}
			}
		}
	else
	if( window.ActiveXObject ) {
		for( var ii = 12; ii--; ) {
			try {
				if( eval(	
					 'new ActiveXObject('
					+'"ShockwaveFlash.ShockwaveFlash.' + ii + '"'
					+');'
					) ) {
					_flashVersion = ii;
					break;
					}
				}
			catch( e ) { }
			}
		}
		
	_flashVersion = parseInt( _flashVersion );
	return _flashVersion;
	}

function uvqt_attach( video ) {
    if( video ) {
        qtUpshift = video;
    }
    
	if( typeof( qtUpshift ) != 'undefined' ) {
		for( var ii = 0; ii < qtUpshift.length; ii++ ) {
			var d			= qtUpshift[ii];
			var hardpoint	= d[0];
			var qtObj		= d[1];
			var dx			= d[2];
			var dy			= d[3];
			
			var obj = getObj( hardpoint );
			
			if( obj ) {
				classid = ( isIE() ) ? 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"' : '';
				
				obj.innerHTML
					=	'<object	' + classid +
						'			data="' + qtObj + '" ' +
						'			width="' + dx + '" ' +
						'			height="' + dy + '">' + "\n" +
						'	<param	name="src" ' +
						'			value="' + qtObj + '" />' +
						'</object>';
			}
		}
	}
	
}
	

function uvhoverable_attach( imgs ) {
	var imgArr	= imgs ? imgs : document.getElementsByTagName( 'img' );
	var inptArr	= imgs ? [] : document.getElementsByTagName( 'input' );
	
	arr = new Array( imgArr, inptArr );
	
	if( arr ) {
		for( var ii = 0; ii < arr.length; ii++ ) {
			
			for( var kk = 0; kk < arr[ ii ].length; kk++ ) {
				if( arr[ ii ][ kk ].className
				&&	arr[ ii ][ kk ].className.indexOf( 'uvHoverable' ) != -1 ) {
	
					var p = arr[ ii ][ kk ].src.split( '.' );
					if( p.length > 1 ) {
						p[ p.length - 2 ] += '_h';
						}
					l = p.join( '.' );
	
					arr[ ii ][ kk ].uvhoverable_off	= arr[ ii ][ kk ].src;
					arr[ ii ][ kk ].uvhoverable_on	= l;
					
					arr[ ii ][ kk ]._preload			= new Image( );
					var _t = arr[ ii ][ kk ]._preload;

					arr[ ii ][ kk ]._preload.onerror	= bind(
						 null
						,function( _t ) {
							uv_error(
								'Unable to load image: ' + _t.src
								);
							}
						,arr[ ii ][ kk ]
						);
					
					arr[ ii ][ kk ]._preload.src 	= l;
	
					arr[ ii ][ kk ].onmouseover =
						chainHandlers(
							 uvhoverable_activate
							,arr[ ii ][ kk ].onmouseover
							);
	
					arr[ ii ][ kk ].onmouseout =
						chainHandlers(
							 uvhoverable_deactivate
							,arr[ ii ][ kk ].onmouseout
							);
	
					arr[ ii ][ kk ].onfocus =
						chainHandlers(
							 uvhoverable_activate
							,arr[ ii ][ kk ].onfocus
							);
	
					arr[ ii ][ kk ].onblur =
						chainHandlers(
							 uvhoverable_deactivate
							,arr[ ii ][ kk ].onblur
							);
					}
				}
			}
		}
	}
	
function uvhoverable_activate( ) {
	this.src = this.uvhoverable_on;
	}
	
function uvhoverable_deactivate( ) {
	this.src = this.uvhoverable_off;
	}
	
function uv_error( err ) {
/*	uv_log(
		 'error'
		,err
		,window.location
		);
*/	}

function uv_log( what, which, where ) {
	if( typeof( uvUniq ) == "undefined" ) {
		uvUniq = null;
		}
	
	if( typeof( uvWho ) == 'undefined' )
		uvWho = null;
	
	(new Image()).src = s = auri(
		 'resource/ultraviolet/'
		+ Math.random( )+'.gif'
		+'?who='+escape( uvWho )
		+'&which='+escape( which )
		+'&what='+escape( what )
		+'&where='+escape( where )
		+'&referrer='+escape( document.referrer )
		+'&uniq='+escape( uvUniq )
		);
	
	setCookie( '_uv', uvUniq );
	}
	
function uv_attach_links( ) {
	regloc	= new RegExp( '^(javascript:|http(s)?://'+window.location.host+')', 'i' );
	regtyp	= new RegExp( 'uvt_([a-z_]+)', 'i' );
//	regkey	= new RegExp( 'uvk_([a-z0-9]+)', 'i' );
	
	/**
	 *	@browser IE6: Perform additional selector check here to filter out internal-pointing links added programmatically and were not auto-prepended with `http://www.visitmaine.com/'.
	 */
	$$( 'a[href^=http://]' ).each( function( _t, i ) {
		var category	= '';
		var action		= '';
		var label		= '';
		var metric		= 0;
		
		// Exit links
		if( !regloc.test( _t.href ) ) {
			if( !_t.hasClass( 'ignore_external' ) ) {
				_t.set( 'title', 'Opens in a new window' );
				_t.set( 'target', '_blank' );
				
				// Insert `external' icon
				if( _t.childNodes.length == 1
				&&  _t.childNodes[ 0 ].nodeType == Node.TEXT_NODE ) {
					/* Special case this out because IE is incapable of 
					 * correctly positioning an inline bg image.
					 * The fix is to insert the icon img at the end of link.
					 */
					if( isIE( ) ) {
						if( _t.currentStyle.backgroundImage == 'none' ) {
							var extIcon = new Image( );
							extIcon.src = auri( 'resource/image/layout/external.gif' );
							
	//						var extLink = cloneNode( _t, false );
							var extLink = new Element( 'a', { href:_t.href } );
							extLink.appendChild( extIcon );
							
							appendSibling( _t, extLink );
							addClass( extLink, 'ieExternal' );
						}
					}
					else {
						addClass( _t, 'external' );
					}
				}
			}
			
			category = 'Exit';
			action = 'interior';
			
			var sourceLoc = project_uri( document.location.pathname );
			if( sourceLoc === '' ) {
				sourceLoc = '/';
			}
			
			var targetLoc = _t.href.replace( /http:\/\/(www\.)?/i, '' );
			
			label = targetLoc+' < '+sourceLoc;
			
			// Special links
			if( what = _t.className.match( regtyp ) ) {
				switch( what[1] ) {
					case 'eweb':	action = 'event';					break;
					case 'oweb':	action = 'organization';			break;
					case 'pweb':	action = 'package';					break;
					case 'sweb':	action = 'special';					break;
					case 'relweb':	action = 'related sites';			break;
					default:
						action = what[1].replace( /_/, ' ', '' );	
						break;
				}
			}
		}
		
		if( category && action ) {
			_t.addEvent(
				 'click'
				, function( ) {
					_gaq.push( [
						 '_trackEvent'
						, category
						, category+' > '+action
						, label
						, metric
					] );
				  }
			);
			
			_t.addEvent( 'keypress', function( e ) { fireClickOnEnterKeyPress( this, e ); } );
		}
		
	} );
	
	return;
	
/*	if( typeof( uvUniq ) == "undefined" ) {
		uv_error( 'No uvUniq.' );
		}
		
	if( typeof( auri ) == "undefined" ) {
		uv_error( 'No AURI.' );
		}
	
	var formArr = document.getElementsByTagName( 'form' );
	if( formArr ) {
		
		for( var ii = 0; ii < formArr.length; ii++ ) {
			var _f = formArr[ ii ];
			
			_uvf = new Object();
			
			_uvf.what = 'form';
			
			_uvf.which = _f.name
			if( !_uvf.which )
				_uvf.which = 'form[ ' + ii + ' ]';
			
			_uvf.where = _f.action;
			
			_f.onsubmit = chainHandlers(
				 bind(
				 	 null
				 	,function( _uvf ) {
				 	 	uv_log(
				 	 		 _uvf.what
				 	 		,_uvf.which
				 	 		,_uvf.where
				 	 		)
				 	 	}
				 	,_uvf
				 	)
				,_f.onsubmit
			);
		}
		
	}
	
	var linkArr = document.getElementsByTagName( 'a' );
	if( linkArr ) {
		
		server	= window.location.toString().split( '/' )[2];
		regtyp	= new RegExp( 'uvt_([a-z]+)', 'i' );
		regkey	= new RegExp( 'uvk_([a-z0-9]+)', 'i' );
		regloc	= new RegExp( '^(javascript:|http(s)?://'+server+')', 'i' );
		regclass = new RegExp( 'ignore_external', 'i' );
		
		for( var ii = 0; ii < linkArr.length; ii++ ) {
			var _t = linkArr[ii];
			
			// External links
			if( _t.className == 'external'
			||  (_t.href && !regloc.test( _t.href ) && !regclass.test( _t.className )) ) {
				_t.title = 'Opens in a new window';
				_t.target = '_blank';
				
				if( _t.childNodes.length == 1
				&&  _t.childNodes[ 0 ].nodeType == Node.TEXT_NODE ) {
					/* Special case this out because IE is incapable of 
					 * correctly positioning an inline bg image.
					 * The fix is to insert the icon img at the end of link.
					 * /
					if( isIE( ) ) {
						if( _t.currentStyle.backgroundImage == 'none' ) {
							var extIcon = new Image( );
							extIcon.src = auri( 'resource/image/layout/external.gif' );
							
//							var extLink = cloneNode( _t, false );
							var extLink = document.createElement( 'a' );
							extLink.href = _t.href;
							extLink.appendChild( extIcon );
							
							appendSibling( _t, extLink );
							addClass( extLink, 'ieExternal' );
						}
					}
					else {
						addClass( _t, 'external' );
					}
				}
			}
			
			if( linkArr[ii].href && !linkArr[ii].onclick ) {
				
				if( what = _t.className.match( regtyp ) ) {
					what = what[1];
					}
				else {
					what = regloc.test( _t.href )
						? 'link'
						: 'exit'
						;
					}
					
				where = _t.href;
				
				_t.uv_log = uv_log;
				_t.uv_what = what;
				_t.uv_where = where;
				
				if( what == 'eweb' || what == 'oweb' ) {
					_t.target = '_blank';
					}
				
				if( which = _t.className.match( regkey ) ) {
					_t.uv_which = which[1];
					}
				else
				if( !_t.innerText || !(_t.uv_which = _t.innerText.trim( )) ) {

					if( n = _t.firstChild ) {
						do {
							if( n.alt ) {
								_t.uv_which = n.alt;
								break;
								}
							else
							if( n.nodeType == 3 ) {
								if( n.nodeValue ) {
									if( x = n.nodeValue.toString().trim( ) ) {
										_t.uv_which = x;
										break;
										}
									}
								}
							} while( n = n.nextSibling );
						}
					
					if( !_t.uv_which ) {
						_t.uv_which = '?';
						}

					}
				
				// Stop logging these
				if( what == 'link' ) {
//					continue;
				}
				
				_t.onclick = bind(
					 null
					,function( _t ) {
					 	return _t.uv_log(
					 		 _t.uv_what
					 		,_t.uv_which
					 		,_t.uv_where
					 		);
					 	}
					,_t
					);
				}
			}
		}*/
	}
/*
function uvAttachReports( ) {
	var linkArr = document.getElementsByTagName( 'a' );
	if( linkArr ) {
		for( var ii = 0; ii < linkArr.length; ii++ ) {
			var div = document.createElement( 'div' );
			div.className = 'uvLinkReport';
			div.style.left = (getObjWidth( linkArr[ ii ] ) + 5) + 'px';
			
			var key = 'h_' + hex_md5( linkArr[ii].href );
			var N = 0;
			var P = 0;
			
			if( uvExit
			&&	uvExit[ key ] ) {
				var N = uvExit[ key ][ 0 ];
				var P = parseInt((parseFloat( uvExit[ key ][ 1 ] ) * 100));
				}
			
			setHTML( div, '&laquo; (' + N + '; ' + P + '%)' );
			linkArr[ii].insertBefore( div, linkArr[ii].firstChild );
			linkArr[ii].style.position = 'relative';
			}
		}
	}
*/

// Set default submit button
function uv_attach_submitter( ) {
    var forms = document.forms;
    for( var i = 0; i < forms.length; i++ ) {
        
        var form        = forms[ i ];
        var elements    = form.getElementsByTagName( 'input' );  // inputs of type image are mysteriously missing from forms.elements
        var element;
        for( var j = 0; j < elements.length; j++ ) {
            
            element = elements[ j ];
            if( element.className.search( /uvSubmitter/ ) != -1 ) {
                
                form._viSubmitter   = element;
                form.onkeypress     = function( e ) {
                    e = getEvent( e );
                    if( getKeyPressed( e ) == 13 ) {  /* "\r" */
                        if( isIE( ) ) {
                            var clone = cloneNode( this._viSubmitter );
                            clone.style.position    = 'absolute';
                            clone.style.width		= '1px';
                            clone.style.left        = '-500px';
                            insertBefore( clone, form.firstChild );
                        }
                        else {
                            return this._viSubmitter.click( );
                        }
                    }
                    return true;
                }
                
                // But not for textareas
                var nonSubmitters = new Array(
                	  form.getElementsByTagName( 'textarea' )
                	, form.getElementsByTagName( 'option' )  // Safari discriminates correctly here.
                	, ( isFirefox( ) )
                	  ? form.getElementsByTagName( 'select' )
                	  : new Array( )
                );
                for( var k = 0; k < nonSubmitters.length; k++ ) {
					for( var kk = 0; kk < nonSubmitters[ k ].length; kk++ ) {
						nonSubmitters[ k ][ kk ].onkeypress = function( e ) {
							e = getEvent( e );
							if( getKeyPressed( e ) == 13 ) {
								abortEvent( e );
							}
						}
					}
				}
            }
        }
    }
}

function uvattach_alpha_bg( alphas, sizingMethod ) {
	if (sizingMethod == null) {
		sizingMethod = 'scale';
	}
	if( !isIE( ) || !isAtMostVersion( 6 ) ) {
		return;
	}
	
	if( !alphas ) {
		error( 'No alpha backgrounds to filter!' );
	}
	
	for( var id in alphas ) {
		alpha = document.getElementById( id );

		if( alpha == null ) {
			warn( 'No element found for alpha id: ' + id );
			continue;
		}
		alpha.style.filter = 
			 'progid:DXImageTransform.Microsoft.AlphaImageLoader( '
				+'  src="' + auri( alphas[ id ] ) + '"'
				+', sizingMethod="'+sizingMethod+'"'
			+' )';
		if ( alpha.href ) {
			alpha.style.cursor = 'pointer';
		}
	}
}

// Remember: set a css style for .uvTransparent such that visibility = 'hidden'
function uvattach_alpha_img( in_img ) {

	if( !isIE( ) || isAtLeastVersion( 7 ) ) {
		return;
	}
	
	var imgs	= ( in_img ) ? new Array( in_img ) : document.images;
	var alpha	= new Array( );
	var links	= new Array( );
	
	if( !imgs ) {
		return;
	}
	
	for( var i = 0; i < imgs.length; i++ ) {
		img = imgs[ i ];
		
		if( img.className
		&&  img.className.indexOf( 'uvTransparent' ) != -1 ) {
			
			img._s = document.createElement( 'span' );
			
			var keys = new Array(
				 'id'
				,'className'
				,'title'
				,'src'
				,'style'
				,'currentStyle'
				,'alt'
			);
			
			for( var j = 0; j <= keys.length; j++ ) {
				key = keys[ j ];
				
				switch( key ) {
					case 'src':
						img._s.style.filter =
							'progid:DXImageTransform.Microsoft.AlphaImageLoader('
								+'  src="' + img.src + '"'
								+', sizingMethod="image"'
							+' )';
						break;
					case 'style':
						img._s.style.visibility = 'visible';
						img._s.style.display = 'inline-block';
						
						var width	= getObjWidth( img );
						var height	= getObjHeight( img );
						img._s.style.width = ( width ) ? width : getStyle( img, 'width' );
						img._s.style.height = ( height ) ? height : getStyle( img, 'height' );
						
						if( img.parentNode.href ) {
							img._s.style.cursor = 'pointer';
						}
						break;
					case 'alt':
						if( !img[ 'title' ] ) {
							img._s[ 'title' ] = img[ key ];
						}
						break;
					case 'currentStyle':
						for( style in img.currentStyle ) {
							if( in_array( style, [ 'filter', 'display' ] ) ) {
								continue;
							}
							img._s.style[ style ] = img.currentStyle[ style ];
						}
						break;
					default:
						if( img[ key ] ) {
							img._s[ key ] = img[ key ];
						}
					break;
				}
			}
			
			if( img.parentNode.href ) {
				links.push( img );
			}
			else {
				alpha.push( img );
			}
		}
	}
	
	if( isAtLeastVersion( 7 ) ) {
		return;
	}
	
	for( var i = 0; i < alpha.length; i++ ) {
		img = alpha[ i ];
		replaceNode( img, img._s );
	}
	
	var pad;
	for( var i = 0; i < links.length; i++ ) {
		img				= links[ i ];
		pad				= document.createElement( 'div' );
		pad.style.width	= getStyle( img._s, 'width' );
		
		pad.appendChild( img._s );
		img.parentNode.appendChild( pad );
		removeNode( img );
	}
}
				
				

function uvbootstrap( ) {
	if( isIE( )
	&& isAtMostVersion( 6 ) ) {
		try {
			document.execCommand( 'BackgroundImageCache', false, true );	
		}
		catch( e ) { }
	}
	
	// Add auto-clear function to search
	if( getObj( 'searchInput' ) ) {
		var go		= getObj( 'GlobalSearchGo' );
		var search	= getObj( 'searchInput' );
		var def		= { 'text': search.value, 'color': search.style.color };
		
		search.value	= def.text;
		search.onfocus	= bind(
			  search
			, function( ) {
				if( this.value == def.text ) {
					this.style.color = '#333333';
					this.value = '';
				}
			  }
		);
		search.onblur	= bind(
			  search
			, function( ) {
				if( this.value == '' ) {
					this.style.color = def.color;
					this.value = def.text;
				}
			  }
		);
		
		go.onclick		= bind(
			  search
			, function( ) {
				if( this.value == def.text ) {
					this.value = '';
				}
			  }
		);
	}
}

function uvgateway_attach( ) {
	// Gateway expand/collapse toggles
	var gateways = $$( '.gateways' );
	if( gateways ) {
		var Expander = new Class( {
			  node: null
			, control: null
			, state: ''
			, height: 0
			
			, initialize: function( control, node ) {
				this.node = node;
				this.control = control;
				this.state = 'collapsed';
				this.height = node.getSize( ).y;
			  }
			
			, hide: function( ) {
				this.node.setStyle( 'height', 0 );
				return this;
			  }
			
			, isCollapsed: function( ) {
				return this.state == 'collapsed';
			  }
			, isExpanded: function( ) {
				return this.state == 'expanded';
			  }
			
			, collapse: function( ) {
//				this.state = 'collapsing';
				this.node.tween( 'height', 0 );
				this.control.set( 'text', 'Expand' );
				this.control.removeClass( 'expanded' );
				this.state = 'collapsed';
				this.control.getParent( ).setStyle( 'margin-top', '0' );
			  }
			, expand: function( ) {
//				this.state = 'expanding';
				this.node.tween( 'height', this.height );
				this.control.set( 'text', 'Collapse' );
				this.control.addClass( 'expanded' );
				this.state = 'expanded';
				this.control.getParent( ).setStyle( 'margin-top', '1em' );
			  }
			
			, toggle: function( ) {
			  	if( this.isCollapsed( ) ) {
			  		this.expand( );
			  	}
			  	else
			  	if( this.isExpanded( ) ) {
			  		this.collapse( );
			  	}
			  }
		} );
		
		gateways.each( function( n ) {
			var collapse = n.getElement( '.collapsable' );
			var toggler = n.getElement( '.toggler a' );
			
			if( collapse && toggler ) {
				n.gateway = new Expander(
					  toggler
					, n.getElement( '.collapsable' )
				).hide( );
				
				toggler.getParent( ).setStyle( 'display', 'block' );
				toggler.addEvent(
					 'click'
					, function( e ) {
						this.gateway.toggle( );
						e.stop( );
					  }.bindWithEvent( n )
				)
			}
		} );
	}
}

window.addEvent( 'domready', uvbootstrap );
window.addEvent( 'domready', uvdrag_attach );
window.addEvent( 'domready', uvgateway_attach );
window.addEvent( 'domready', uvattach_alpha_img );
window.addEvent( 'domready', uvflash_attach );
window.addEvent( 'domready', uvqt_attach );
window.addEvent( 'domready', uvhoverable_attach );
window.addEvent( 'domready', uv_attach_links );
window.addEvent( 'domready', uv_attach_submitter );
