Cufon.replace('#mnav > li > a, #box_about h2', { fontFamily: 'NeoTech', hover: true });
Cufon.replace('#box_about p, li.day, li.month, #mnav ul a', { fontFamily: 'NeoSans', hover: true });
Cufon.replace('h2, #main_content h3, .timeChange a.link', { fontFamily: 'NeoSansMed', hover: true });


function showNext(ovo) {
	var next = $(ovo).next();
	if(!$(next).hasClass('true')) {
		var next = $('.timeChange li:first-child');
	}
	$(ovo).show();
	$(ovo).animate({
		opacity: 1
	}, 1000, function(){
		$(ovo).animate({
			opacity: 1
		}, 5000, function(){
			$(ovo).animate({
				opacity: 0
			}, 1000, function(){
				$(ovo).hide();
				showNext(next);
			});
		});
	});
}

function CreateBookmarkLink() {
	title = document.title
	url = document.location.href
	if (window.sidebar) {
		window.sidebar.addPanel(title, url, "") }
	else if( window.external ) {
		window.external.AddFavorite(url, title) }
	else if(window.opera && window.print) {
		return true
	}
}

function toggleqtip() {
	$.ajax({
		url: '/index.php?class=Article&method=GetTooltipText',
		success: function(newtext) {
			$('a.qtip_link img').each(function(){ $(this).qtip('api').updateContent(newtext); });
		}
	});
}

$(document).ready(function(){
	
	$('a.qtip_link img').click(function(){
		toggleqtip();
	});
	
	$('a.qtip_link img').qtip({
		show: 'click',
		hide: 'mouseout',
		position: {
			corner: {
				target: 'center',
				tooltip: 'bottomLeft'
			}
		},
		style: {
			width: 200,
			name: 'light'
		}
	});

	$('.timeChange li').addClass('true');
	var ovo = $('.timeChange li:first-child');
	showNext(ovo);

	// Open external links in a new window
	$("a[href^=http]").each(function() {
		if(this.href.indexOf(location.hostname) == -1) {
		$(this).click(function(){window.open(this.href);return false;});
		}
	});

	// Clear search field on focus
	$.fn.search = function() {
		return this.focus(function() {
		if( this.value == this.defaultValue ) {
			this.value = "";
		}
		}).blur(function() {
			if( !this.value.length ) {
				this.value = this.defaultValue;
			}
		});
	};
	
	$('#s').search();	

	$('ul#mnav').superfish({
		autoArrows: false		
	});
});
