$(document).ready(function() {
	$('ul.menu').superfish({ 
            delay:       0,
            speed:       'normal',
			animation:   {opacity:'show',height:'show'},
			dropShadows:   false,  
   			disableHI:     true
		});  
		var expanded = false;
		$('#bt-expander').click(function() {
			if (expanded == false) {
				$(this).addClass('expanded');
				$('#other-posts ul').slideDown({ speed: 700, easing: 'easeOutExpo'});
				expanded = true;
			} else {
				expanded = false;
				$(this).removeClass('expanded');
				$('#other-posts ul').slideUp({ speed: 700, easing: 'easeOutExpo' });
			}
		});
		$('#other-posts *').tooltip({
			track: true,
			delay: 0,
			showURL: false,
			fade: 250							
		});
	Cufon.replace('.postheader h3, #right h3, #commentsarea h3, #popular-related h3', {
	hover: true
	});  
	Cufon.replace('.headertop h1', {
	color: '-linear-gradient(#fff, #cdd0d2)'
	}); 
	Cufon.replace('#footer h3', {
	color: '-linear-gradient(#fff, #cdd0d2)',
	textShadow: '#000 -1px -1px'
	}); 
	$(".post img").lazyload({ 
		threshold : 300,
		effect : "fadeIn"
	});
	// New Departments
	$('#featuredPosts li').hover(function(){
		$(this).addClass('hover');
	}, function(){
		$(this).removeClass('hover');
	});
	if(jQuery.fn.cycle){
		
		var newSlides = $('#featuredImages .slide img').length;
		var html = ' ';

		// New
		
		if (newSlides > 1) {
			$('#featuredImages .slide').after(html).cycle({
				fx: 'scrollHorz,scrollHorz,scrollHorz,scrollHorz,scrollHorz',
				easing: 'easeOutCubic',
				timeout: 0,
				speed: 750,
				cleartypeNoBg: true,
				pager:  '#featuredPosts ul',
				pagerAnchorBuilder: function(idx, slide) { 
					return '#featuredPosts ul li:eq(' + idx + ')'; 
					
				}
			});
			
			$('#featuredPosts ul li').click(function(){
				if( $(this).hasClass('active') ) {
					window.location.href = $(this).find('h3 a').attr('href');
					$(this).addClass('redirecting');
				}
			});
		}	
		$('#featuredPosts ul li').click(function(){
			if ($(this).hasClass('active')) {
				$(this).removeClass('active');
			} else {
				$(this).siblings('.active').removeClass('active').end()
				.addClass('active');
			}
		});
		$('#featuredPosts ul li:first').trigger('click');
	}
	// Testimonials
	$('#twitter_update_list').cycle({
        fx:     'scrollVert',
        speed:  'normal',
        timeout: 0,
        prev:    '#prev',
        next:    '#next'
    	});						   
	//Search
	var searchBox = $("#s");
	var searchBoxDefault = "Search Our Site";
	
	searchBox.focus(function(){
		if($(this).attr("value") == searchBoxDefault) $(this).attr("value", "");
	});
	searchBox.blur(function(){
		if($(this).attr("value") == "") $(this).attr("value", searchBoxDefault);
	});
	
	//Prettyphoto
	$("#pagewrapper a[rel^='prettyPhoto']").prettyPhoto();
});
