// 
//  «rabe-2.0.js»
//  «rabe.li 2.0»
//  
//  Created by Willem Rabe on 2010-07-22.
//  Copyright 2010 rabe.li. All rights reserved.
// 
                           
$(document).ready(function(){
         
	$('a').tooltip({ 
	    track: true, 
	    delay: 0, 
	    showURL: false, 
	    showBody: " - ", 
	    fade: 250 
	});

  $('div#preview a').hover(function(){

			$(this).parent().animate({
				borderTopColor: '#c00',
				borderBottomColor: '#c00'
			},400);

		}, 	function(){

			$(this).parent().animate({
				borderTopColor: '#d9d9d9',
				borderBottomColor: '#d9d9d9'
			},400);

		});

  $('ul#subnav li').not('.current_page_item').hover(function(){

			$(this).animate({
				backgroundColor: '#d8d8d8'
			},400);

		}, 	function(){

			$(this).animate({
				backgroundColor: '#bcbcbc'
			},400);

		});        
	
  $('ul#navigation li a').not('.current_page_item a,.current_page_ancestor a,.current_page_parent a').hover(function(){
		
		$(this).animate({
			backgroundColor: '#fff'
		},400);
	
	}, 	function(){

		$(this).animate({
			backgroundColor: '#ededed'
		},400);

	});                   

  $('ul#sidenav li a').hover(function(){
              
        
		$teaser = 'url("http://www.rabe.li/img/teaser/'+$(this).attr('href').split("/")[4]+'X'+$(this).attr('href').split("/")[5]+'.gif")';
		$('#showcase').css({
			'background-color' : '#141414',
			'background-image' : $teaser,
			'background-repeat' : 'no-repeat'
		 });

			       
        $headline = $(this).text().split("(")[0];
		$('#showcase h1').html($headline);

		$(this).parent().animate({
			backgroundColor: '#a1a1a1',
			opacity: '1'
		},150);       
		
	}, 	function(){

		$(this).parent().animate({
			backgroundColor: '#111',
			opacity: '0.8'
		},150);

	});                   

      
  $('a').not('ul#navigation a, ul#subnav a, #back a,#post-previous a,#post-next a, ul#sidenav a').hover(function(){
              
		 $color = $(this).css("color");

		$(this).animate({
			color: '#cc0000'
		},400);

	}, 	function(){

		$(this).animate({
			color: $color  
		},400);

	});                 
	

  $('#back a,#post-previous a,#post-next a').hover(function(){

		$(this).animate({
			backgroundColor: '#d8d8d8'
		},400);

	}, 	function(){

		$(this).animate({
			backgroundColor: '#a1a1a1'  
		},400);

	});

	$('img.aligncenter').each(function(index) {

	    var title = $(this).attr("title");

		$(this).parent().prepend('<span class="subline">'+title+'</span>');

	});
   
 
 $('div#footer div.grid_6 p').hover(function(){

		$('div#footer div.grid_6 p')
		.animate({
			color: '#505050',
		   	fontSize: '24px'
		},200);
        $('div#footer div.grid_6 span')
		.animate({
			opacity: 1
		},200);

	}, 	function(){

		$('div#footer div.grid_6 p')
 		.animate({
			color: '#b8b8b8',
			fontSize: '14px'
		},400);   
         $('div#footer div.grid_6 span')
		.animate({
			opacity: 0
		},400);   	
		
	});      

    $('#overlay').hover(function(){

		$(this).animate({
			opacity:1
		},200);

	}, 	function(){

		$(this).animate({
			opacity:0
		},200);

	});
   
	$('.slider').easySlider({
		auto: true,
		continuous: true,
		numeric: true,
		nextId: "slider1next",
		prevId: "slider1prev"
	});
   
    if($.browser.msie){ $('.home .content:first').append('<p class="intro" style="color:#d0490d;"><b>A quick note:</b> It looks like you are using the Internet Explorer.<br>For the best possible experience I recommend using a modern<br>browser like Safari or Firefox.</p>'); }


});
