$(function() {
// TABS ON USER PROFILE
	$("#user-info > ul").tabs();
});



$(document).ready(function() {

	// SMOGS
	$('h4#send-video').click(function(){
		$('form#send-video-form').slideDown();
		return false;
	});


	if($('#search-box input#keywords').val() ==  ''){
		$('#search-box input#keywords').addClass('focused');
	}
	
	$('#search-box input#keywords').focus(function(){
		$(this).removeClass('focused');
	}).blur(function(){
		if(this.value == ''){
			$(this).addClass('focused');
		}	
	});


// SHOW COMMENT FORM
	$('a.show-comment-form').click(function() {
		$('#comment-form').slideDown('slow');
		return false;
	});	

// SHOW SPOTCZECH PHOTO FORM
	$('p#add-spot-foto a').click(function() {
		$('p#add-spot-foto a').hide('fast');						  
		$('.spotczech-foto-form').slideDown('slow');
		return false;
	});	

// OPEN LINK IN NEW WINDOW
	$('a.new-window, .clanek .clanek-content a').click(function(){
		window.open(this.href);
		return false;
	});

// TABLE COLORING
	$('table.forum tr:odd').addClass("odd");	

// SHOW & HIDE RATING
	$('.comment a.show-rating').click(function() {
		$('a.show-rating', $(this).parent().parent()).hide();					
		$('a.hide-rating', $(this).parent().parent()).show();
		$('.rating-list', $(this).parent().parent()).slideDown('slow');		
		return false;
	});	
	$('a.hide-rating').click(function() {
		$('a.show-rating', $(this).parent().parent()).show();					
		$('a.hide-rating', $(this).parent().parent()).hide();
		$('.rating-list', $(this).parent().parent()).slideUp('slow');		
		return false;
	});	

// REGISTRATION FORM
	$('#registation form p').hover(function () {
		$('#registation form p span').show();	
      }, 
      function () {
        $('span', $(this).parent().parent()).hide();
      }
    );


// TOOLTIP
     $('.thumb, .article-gallery a, .user-bigico a, #updates a.thumbnail').mouseover(function(e) {  
									
         //Grab the title attribute's value and assign it to a variable  
         var tip = $(this).attr('title');      
           
         //Remove the title attribute's to avoid the native tooltip from the browser  
         $(this).attr('title','');  
           
         //Append the tooltip template and its value  
         $("body").append('<div id="tooltip"><div id="tooltip-top"></div><div id="tooltip-content">' + tip + '</div></div>');       
           
         //Set the X and Y axis of the tooltip  
         $('#tooltip').css('top', e.pageY + 10 );  
         $('#tooltip').css('left', e.pageX + 20 );  
           
         //Show the tooltip with faceIn effect  
         $('#tooltip').fadeIn('500');  
         //$('#tooltip').fadeTo('10',0.8);  
           
     }).mousemove(function(e) {  
       
         //Keep changing the X and Y axis for the tooltip, thus, the tooltip move along with the mouse  
         $('#tooltip').css('top', e.pageY + 15 );  
         $('#tooltip').css('left', e.pageX - 5 );  
           
     }).mouseout(function() {  
       
         //Put back the title attribute's value  
         $(this).attr('title',$('#tooltip-content').html());  
       
         //Remove the appended tooltip template  
         $('div#tooltip').remove();  
           
     });  



});