function redirect( url, replace ){
	if( "undefined" == typeof url )return false;
	if( replace )
		document.location.replace( url );
	else
		document.location.href = url;	
}

$( function(){
	
	$('a[@rel="external"]').each( function(){
		this.target = '_blank';
	});

	
	var frame_width = $('#contentFrame').width();

	$('#contentFrame').prepend('<p class="notice" id="tooltip"></p>');
	
	var li = $('#menu li[title]');
	li.each( function(){
		var t = $(this);
		t.data('tooltip', t.attr('title') ).removeAttr('title');
	} );
	
	li.hover(
		function(){
			var menu_item = $(this);
			var pos = menu_item.position();
			var tip = $('#tooltip').text( menu_item.data('tooltip') ).css('left','auto').css('right','auto');
			var h = tip.outerHeight();
			var w = tip.outerWidth();
		
			if( pos.left + w < frame_width ){
				tip.css('left', pos.left +'px' );
			} else {
				tip.css('right', frame_width - pos.left - menu_item.width() +'px' );
			}	

			tip.css('top', pos.top - h - 5 +'px').show();

		},
		function(){
			$('#tooltip').hide();
		}
	);
} );