/**
 * Product Title:		(IM) Pip Popup
 * Product Version:		1.0.1
 * Author:				Michael McCune
 * Website:				Coders Refuge
 * Website URL:			http://forums.codersrefuge.com/
 * Email:				michael.mccune@gmail.com
 */

var _pippopup = window.IPBoard;

_pippopup.prototype.pippopup = {
	init: function()
	{
		Debug.write("Initializing pippopup.js");
		
		document.observe("dom:loaded", function()
		{
			$$( ".group_icon" ).each( function( elem )
			{
				$( elem ).childElements().each( function( el )
				{
					$( el ).setStyle( {cursor: 'pointer'} );
					$( el ).observe( 'click', ipb.pippopup.showPipPopup );
				});
			});
		});
	},
	
	showPipPopup: function(e, elem)
	{
		if ( $('pip_popup') )
		{
			$('pip_popup').remove();
		}
		
		new ipb.Popup
		(
			'pip',
			{
				w: '500px',
				h: '600px',
				ajaxURL: ipb.vars['base_url'] + "&app=forums&module=ajax&section=pippopup&secure_key=" + ipb.vars['secure_hash'],
				hideAtStart: false
			}
		);
	}
}

ipb.pippopup.init();
