/**
 * @author leon
 */
$(document).ready(init);



function init(){
	
	var tempTitleInfoBox = $(this).attr('title');
	
	//
	//	hoverInfo
	//
	$('body').prepend('<div id="infobox" class="dialog"></div>');
	$(".infoicon").hover(function(){
		//onmouseover
		
		tempTitleInfoBox = $(this).attr('title');
		$("#infobox").html($(this).attr('title')).show();
		$(this).attr('title','');
		
	},function(){
		//onmouseout
		$(this).attr('title',tempTitleInfoBox);
		$("#infobox").hide();
	});
	
	$('.infoicon').mousemove(function(event) {
		$('#infobox').css('top',event.pageY+0);
		$('#infobox').css('left',event.pageX+15);
	});

}

function removeDialog() {
	$('#dialog').fadeOut(1000,function(){
		$('#dialog').replaceWith('');
	});
}

jQuery.fn.center = function () {
	this.css("position","absolute");
	this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
	this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");
	return this;
}


