/*	apre un div tipo popup
	che si chiude cliccandoci sopra
	- il contenuto è l'href del link
	- accetta anche width e height
*/

jQuery.fn.popAlpi = function(style_params, other_params){
	jQuery(this).click(function(e){
		var file = jQuery(this).attr('href');
		var x = e.pageX;
		var y = e.pageY;
		var style = {
			'position': 'absolute',
			'top': y - 70 + 'px',
			'left': x - 150 + 'px',
			'background-color': '#fff',
			'color': '#000',
			'border': '1px solid #999',
			'padding': '10px',
			'cursor': 'pointer'
		}
		var config = {
			'closeOnClick': true,
			'id': 'poalto'
		}
		jQuery.extend(style, style_params);
		jQuery.extend(config, other_params);
		jQuery('#' + config.id).remove();
		jQuery('<div id="' + config.id + '"></div>')
			.css(style)
			.load(file)
			.appendTo('body')
			.click(function(){
				if (config.closeOnClick) {
					jQuery(this).remove();
				}
			});
		jQuery('#poalto').bgiframe();
		return false;
	});
	
};


