/**
 * @author giulio
 */
$(document).ready(function(){
	$('<div id="tips_window_hotspot"></div><div id="tips_window"><div id="tips_window_wrapper"><div id="tips_window_close"><a href="#"><span>Close</span></a></div><div id="tips_window_content"></div></div></div>').insertAfter('#container');
	$('div#tips_window').css('display', 'none');
	$('div#tips_window_hotspot').css('display','none');
	// FF2 on OS X requires hacking
	var ffversion = /Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent) ? new Number(RegExp.$1) : -1;
	
	if( ffversion > -1 && ffversion < 3 && navigator.platform.indexOf("Mac")> -1 ) {
		$('div#tips_window_hotspot').css({
		"opacity": "1",
		"background":"url(/files/gfx/opacity.png) repeat 0 0 transparent"
		});
	} else {
		$('div#tips_window_hotspot').css('opacity', '0.7');
	}
	$('.popup_container div').hide();
	$('.popup_container a').click(function(){
		$(this).next('div').clone().show().appendTo('div#tips_window_content');
		// Start showing generated box
		$('div#tips_window_hotspot').fadeIn(250);
		$('div#tips_window').fadeIn(250);
		return false;
	});
	
	
	/* close tips when "blurred" */
	$('#tips_window_close').click(tips_out); 
	$('#tips_window_hotspot').click(tips_out);

});

// functions

function tips_out(){
	$('div#tips_window_hotspot').fadeOut(250);
	$('#tips_window_content').empty();
	$('#tips_window').slideUp(125);
	return false;
}
