/********************************************
(c) 2005-present, uTime Games
Despite the fact that you can see this, 
you may NOT use or copy this code for any reason.
If you'd like to use this code, please contact:
	Geoffrey Benson at
	sales@utimegames.com

Licensing terms are generally reasonable -
ranging from free to cheap - but you MUST
ask and obtain permission first.

Thank you for not being a jerk.
  --The Management
********************************************/

// Class definition
var PQHandlerAdBox = Class.create({
	Handler: function( node )
	{
		// Get the adbox
		var main = $( "adbox" );
		if( !main )
			return;
		
		// Collect the data
		var imagename = node.childNodes[0].getAttribute( 'imagename' );
		var url = node.childNodes[0].getAttribute( 'url' );
		
		// Actually construct the HTML
		var wrapper = new Element( 'div', { 'class': 'ad', 'id': 'adbox_wrapper' } );
		
		var div = new Element( 'div' );
		var link = new Element( 'a', { 'href': "http://" + url, 'target': '_blank' } );
		var img = new Element( 'img', { 'src': "/ads/" + imagename, 'width': 125, 'height': 70, 'alt': "Support PseudoQuest!" } );
		link.insert( img );
		div.insert( link );
		wrapper.insert( div );
		
		var div = new Element( 'div' );
		var link = new Element( 'a', { 'href': "http://" + url, 'target': '_blank' } );
		link.update( "Support PQ!" );
		div.insert( link );
		wrapper.insert( div );
		
		// Kill the previous wrapper, if there
		main.update( wrapper );
	}
});

