// common scripts
			
// slideshow
	
	$(document).ready(function(){
		$('.slideshow').cycle({
			fx: 'fade',
			delay: -2000,
			speed: 2000,
		    next: '.slideshow', 
		    pause: 1,
			timeout: 2000
		});
	});
	
// sidebar slideshow

	$(document).ready(function(){
		if (jQuery.browser.safari && document.readyState != "complete"){
				//console.info('ready...');
				setTimeout( arguments.callee, 100 );
				return;
			}
	
		$('.sidebar-slideshow img').each( function(index){
			var image = new Image();
			image.src = $(this).attr('src');
			
			//alert('-' + $(this).height() / 2 + 'px');
			$(this).fadeIn(10 , function(){
				$(this).css({'marginTop' : '-' + Math.round($(this).height() / 2) + 'px' , 'marginLeft' : '-' + (Math.round($(this).width() / 2) + 1) + 'px'});
			});		
		});
		
		//$('.sidebar-slideshow').fadeIn('fast');
		
		$('.sidebar-slideshow').cycle({
			fx: 'fade',
			delay: -2000,
			speed: 2000, 
		    pause: 1,
			timeout: 2000,
		});
	});
	
// portfolio slideshow
	
	function onAfter(curr, next, opts){
	
	}

	$(document).ready(function(){
		$('.portfolio-slideshow').cycle({
		    fx:     'fade', 
		    speed:  'fast', 
		    nowrap:  1, 
		    next:   '#next', 
		    prev:   '#prev',
		    after:   onAfter, 
    		timeout: 0 
		});		
	});
	

// check slide number	

	$(document).ready(function(){
		$('.arrow').bind("click", function(){
				$(this).parent().find(".port-l-arrow").each(function(){
					$(this).attr("class",this.className.replace('-l-','-left-'));
			})
		});
		// console.log();
	});
		
// add span to twitter header

	$(document).ready(function(){
    	$(".widget_twitter .widgettitle").html('<a href="http://twitter.com/LoyalFamily" title="Follow Loyal Family on Twiter" target="twitter"><span>Follow LF on Twitter</span></a>');
  	});
  	
// fail whale

	$(document).ready(function(){
    	$(".widget_twitter p").html('<img src="http://loyalfamily.com/wp-content/themes/_lf_simplicitybright/images/other/fail_whale.gif" alt="Fail Whale" style="float: right; border: 1px solid #ccc;" />');
  	});


