/*
 * popbox by Boris Popoff (http://gueschla.com)
 *
 * Based on Cody Lindley's Thickbox, MIT License
 *
 * Licensed under the MIT License:
 *   http://www.opensource.org/licenses/mit-license.php
 */

// on page




window.addEvent('domready', POP_init);


// prevent javascript error before the content has loaded
POP_WIDTH = 0;
POP_HEIGHT = 0;
var POP_doneOnce = 0 ;

// add popbox to href elements that have a class of .popbox
function POP_init(){
	$$("a.popbox").each(function(el){el.onclick=POP_bind});
}

function POP_bind(event) {
	var event = new Event(event);
	// stop default behaviour
	event.preventDefault();
	// remove click border
	this.blur();
	// get caption: either title or name attribute
	var caption = this.title || this.name || "";
	// get rel attribute for image groups
	var group = this.rel || false;
	// display the box for the elements href
	POP_show(caption, this.href, group);
	this.onclick=POP_bind;
	return false;
}


// called when the user clicks on a popbox link
function POP_show(caption, url, rel) {
		
		
		
	// create iframe, overlay and box if non-existent

	if ( !$("POP_overlay") )
	{
		new Element('iframe').setProperty('id', 'POP_HideSelect').injectInside(document.body);
		$('POP_HideSelect').setOpacity(0.2) //make it 50% transparent
		new Element('div').setProperty('id', 'POP_overlay').injectInside(document.body);
		$('POP_overlay').setOpacity(0.2) 
