/*
* Author:      Marco Kuiper (http://www.marcofolio.net/)
*/
google.load("jquery", "1.3.2");
google.load("jqueryui", "1.7.2");
google.setOnLoadCallback(function()
{
	/* View the code - not part of the demo's */
	$(".viewcode").hover(function() {
		$(this).css({ backgroundColor : '#eee' });
	}, function() {
		$("pre", this).fadeOut();
		$(this).css({ backgroundColor : 'transparent' });
	});
	
	$(".viewcode").click(function() {
		$("pre", this).fadeIn();
	});
	
	
	/* Fade */
	$(".jquery_fadeimg").hover(function() {
		$(this).stop().animate({ opacity: 0.5 }, 1000, function() {
			$(this).stop().animate({ opacity: 1.0 }, 0);
		});
	}, function() {
		$(this).stop().animate({ opacity: 1.0 }, 0);
	});
	
	/* Bounce */
	$(".jquery_bounce").mouseenter(function(){
		$("img", this).animate({ marginLeft : '250px' } , {
				duration: 1000,
				easing: 'easeOutCubic',
				complete:function() {
					$(this).animate({ marginLeft : '0px' } , {
					duration: 1000,
					easing: 'easeInCubic'});	
				}
			});
	}).mouseleave(function() {
		$("img", this).stop().css({ marginLeft : '0px' });
	});
	
		
	/* Pulsate */
	$(".jquery_pulsate").hover(function() {
		$(this).stop().animate({ width: '150px', left:'-25px' }, 150, function(){
			$(this).animate({ width: '100px', left:'0px' }, 150, function() {
				$(this).animate({ width: '150px', left:'-25px' }, 150, function() {
					$(this).animate({ width: '100px', left:'0px' }, 150, function() {
						$(this).animate({ backgroundColor: '#38374A' }, 600, function() {
							$(this).animate({ width: '150px', left:'-25px' }, 150, function(){
								$(this).animate({ width: '100px', left:'0px' }, 150, function() {
									$(this).animate({ width: '150px', left:'-25px' }, 150, function() {
										$(this).animate({ width: '100px', left:'0px' }, 150, function() {
											$(this).animate({ backgroundColor: '#45002D' }, 600, function() {
												// No actual animation (backgroundColor is already set), but need it to
												// set the delay before changing back.
												$(this).animate({ backgroundColor: '#45002D' }, 600, function() {
													$(this).animate({ width: '100px', backgroundColor: '#6CAB6C' }, 1);
												});
											});
										});
									});
								});
							});
						});
					});
				});
			});
		});
	}, function() {
		$(this).stop().animate({ width: '100px', backgroundColor: '#6CAB6C' }, 1);
	});
	
	/* Link nudge */
	$(".jquery_nudge ul li a").hover(function(){
		$(this).stop().animate({ paddingLeft: '0px', backgroundColor: '#ffffff', color : '#000' }, 380);	
	}, function() {
		$(this).stop().animate({ paddingLeft: '0px', backgroundColor: '#ffffff', color : '#707070' }, 480);
	});
	
	/* Accordion */
	$(".jquery_accordion").accordion({ header: 'a' });

});
