Cufon.replace('div.block_menu ul.nav', {fontFamily: 'Calibri'});
Cufon.replace('div#right div.menu ul', {fontFamily: 'PF BeauSans Pro'});

this.tooltip = function()
{
	xOffset = 10;
	yOffset = 20;
	$(".tooltip").click(function(e){
		this.title = this.t; $("#tooltip").remove();
	});
	$(".tooltip").hover(function(e) {
		this.t = this.title;
		this.title = "";
		if(this.t!="undefined") {
			$("body").append("<p id='tooltip'>"+ this.t +"</p>");
			$("#tooltip").css("top",(e.pageY - xOffset) + "px").css("left",(e.pageX + yOffset) + "px").fadeIn("fast"); } }, function(){ this.title = this.t; $("#tooltip").remove();
	});
		$(".tooltip").mousemove(function(e){ $("#tooltip").css("top",(e.pageY - xOffset) + "px").css("left",(e.pageX + yOffset) + "px");
	});
};

function share() {
	var list,html='',box;
	list = [
	{icon: 'digg.png', url: 'http://digg.com/submit?url=', title: 'Digg'},
	{icon: 'reddit.png', url: 'http://reddit.com/submit?url=', title: 'Reddit'},
	{icon: 'delicious.png', url: 'http://del.icio.us/post?url=', title: 'Del.icio.us' },
	{icon: 'magnolia.png', url: 'http://ma.gnolia.com/bookmarklet/add?url=', title: 'Ma.gnolia'},
	{icon: 'stumbleupon.png', url: 'http://www.stumbleupon.com/submit?url=', title: 'Stumble Upon'},
	{icon: 'facebook.png', url: 'http://www.facebook.com/sharer.php?u=', title: 'Facebook'},
	{icon: 'twitter.png', url: 'http://twitter.com/home?status=', title: 'Twitter'},
	{icon: 'google.png', url: 'http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=',title: 'Google'},
	{icon: 'myweb.png', url: 'http://myweb2.search.yahoo.com/myresults/bookmarklet?u=', title: 'Yahoo! MyWeb'},
	{icon: 'furl.png', url: 'http://furl.net/storeIt.jsp?u=', title: 'Furl'},
	{icon: 'blinklist.png', url: 'http://blinklist.com/index.php?Action=Blink/addblink.php&amp;Url=', title: 'BlinkList'},
	{icon: 'mixx.png', url: 'http://www.mixx.com/submit?page_url=', title: 'Technorati'},
	{icon: 'technorati.png', url: 'http://www.technorati.com/faves?add=', title: 'Mixx'},
	{icon: 'windowslive.png', url: 'https://favorites.live.com/quickadd.aspx?marklet=1&amp;mkt=en-us&amp;url=', title: 'Windows Live'}
	];
	
	var list2
	list2 = [
	{icon: 'digg.png', url: 'http://digg.com/submit?url=', title: 'Digg'},
	{icon: 'reddit.png', url: 'http://reddit.com/submit?url=', title: 'Reddit'},
	{icon: 'delicious.png', url: 'http://del.icio.us/post?url=', title: 'Del.icio.us' },
	{icon: 'facebook.png', url: 'http://www.facebook.com/sharer.php?u=', title: 'Facebook'},
	{icon: 'twitter.png', url: 'http://twitter.com/home?status=', title: 'Twitter'},
	{icon: 'google.png', url: 'http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=',title: 'Google'},
	{icon: 'technorati.png', url: 'http://www.technorati.com/faves?add=', title: 'Technorati'},
	{icon: 'm.png', url: 'http://www.mixx.com/submit?page_url=', title: 'Mixx'},

	];

	var listsel = list;
	for (i in listsel) {
		box=listsel[i];
		html+='<a href="'+box.url+document.location+'&amp;='+document.title+'" target="_blank"><img class="tooltip" title="'+box.title+'" src="'+baseURL+'styles/images/'+(listsel==list2?'sharebig':'share')+'/'+box.icon+'"></a>';
	}

	var style = '<style>'
	+ 'div#share {} div#share img {float:left; border:1px solid #CCC; width:16px; height:16px; margin:2px; padding:2px;}'
	 + '</style>';

	document.write('<style>'+style+'</style>');
	document.write('<div id="share">' + html + ' <div class="clear"></div></div>');
}



function cufff(){
	this.config = function(){
		$('.cuff .tabs li a').click(function(){
			$('.cuff .tabs li').removeClass('current');
			$(this).parent().addClass('current');
			cuff.load('', this.href);
			return false;
		});
	}
	this.load = function(id, url){
		var loadurl;
			if (url)
				loadurl=url;
			else
				loadurl=$($('.cuff .tabs li')[id]).find('a').attr('href');		
		$.ajax({type: 'GET', url: loadurl+'&rand='+Math.random(), success: function(response){
			$('.cuff .rightColumn').html(response);
			$('.cuff .rightColumn div.pager a').click(function(){
				cuff.load(id, this.href);
				return false;
			})
			$($('.cuff .rightColumn .articles li')[0]).each(function(){
				$('.cuff .leftColumn img').attr('src', $(this).find('img').attr('src'));
				$('.cuff .leftColumn .description').html($(this).find('div').html());
			});
			$('.cuff .rightColumn .articles li').hover(function(){
				$('.cuff .leftColumn .description').html($(this).find('div').html());
				$('.cuff .leftColumn img').attr('src', $(this).find('img').attr('src'));
			});
		}});
	}
}

var cuff = new cufff();

	(function($) {
	$.fn.slider = function(options){

	// default configuration properties
	var defaults = {
		prevId: 		'prevBtn',
		prevText: 		'Previous',
		nextId: 		'nextBtn',	
		nextText: 		'Next',
		orientation:	'vertical', //  'vertical' is optional;
		speed: 			400			
	}; 
	
	var options = $.extend(defaults, options); 	
		
	return this.each(function(){
	var obj, objs, objw, objts, objt, vertical;
	obj = $(this);
	objs = $('li', obj).length;
	objw = obj.width();
	objh = $('li', obj).height() + 2;
	objts = objs-1;
	objt = 0;
	if (objs<5) return false;
	vertical = (options.orientation == 'vertical');
	$('ul', obj).css('width', objs*objw);
	if (!vertical) $('li', obj).css('float', 'left');
	$('a', '#'+options.prevId).hide();
	$('a', '#'+options.nextId).hide();
	$('a', '#'+options.nextId).click(function(){
	animate('next');
	if (objt>=objts) $(this).fadeOut();
	$('a', '#'+options.prevId).fadeIn();
	return false;
	});
	
	$('a', '#'+options.prevId).click(function(){
	animate('prev');
	if (objt<=0) $(this).fadeOut();
	$('a', '#'+options.nextId).fadeIn();
	return false;
	});
	
	if (objs>1) $('a', '#'+options.nextId).fadeIn();
	
	function animate(type){
	if (type == 'next')
	objt = (objt>=objts) ? objts : objt+1;
	else
	objt = (objt<=0) ? 0 : objt-1;
	
		if (!vertical) {
			p = (objt*objw*-1);
			$('ul', obj).animate(
				{ marginLeft: p },
				options.speed
			);
		} else {
			p = (objt*objh*-1);
			$('ul', obj).animate(
				{ marginTop: p },
				options.speed
			);
		}
	}
	});
	}
})(jQuery);


$(document).ready(function(){	
	// block author
	$('div.block_author div.inner ul li').hover(function(){
		$('div.authorTitles div').css('display', 'none');
		$('div.authorImage').find('img').attr('src', $(this).find('img').attr('src'));
		$($('div.authorTitles div')[this.value]).css('display', 'block');
	});
	
	// tooltip
	tooltip();
	
	// tabs
	$('div.block ul.tabs li a').click(function(){
		$($(this).parent().parent()).find('li').removeClass('current');
		$($(this).parent()).addClass('current');
		var parent = $($(this).parent().parent().parent()).find('.ajaxbody');
		$.ajax({
			type:'GET',
			url:this.href+'&rand='+Math.random(),
			success:function(response){
				parent.html(response);
			}
		});
		return false;
	});
	
	$('div.postCommentsForm a.commentFormSend').click(function(){
		$.post('?path=content/comment&self=1', $('div.postCommentsForm form').serialize(), function(response){
				$('div.postCommentsForm').html('<div class="postCommentsNote">'+response+'</div>');
		});
		return false;
	});
	
	$('div.postRates input').click(function(){
			$.post(baseURL + '?path=content/rate&self=1', $('div.postRates form').serialize(), function(data){
				$('div.postRates').html(data);				
			});							 
	});
	
	$('div.pictureRates input').click(function(){
			$.post(baseURL + '?interface=gallery&path=image/rate&self=1', $('div.pictureRates form').serialize(), function(data){
				$('div.pictureRates').html(data);				
			});							 
	});
	
	$('a#textSizeUp').click(function(){
		if ( parseInt($('#content').css('font-size')) < 25 )
			$('#content').css('font-size', parseInt($('#content').css('font-size'))+2);
		return false;
	});
	
	$('a#textSizeDown').click(function(){
		if ( parseInt($('#content').css('font-size')) > 10 )
			$('#content').css('font-size', parseInt($('#content').css('font-size'))-2);
		return false;
	});
	
	



	
});
