$(document).ready(function(){


//tweet   
		getTwitters('tweet', { 
			id: 'jakeward', 
			count: 12, 
			enableLinks: true, 
			ignoreReplies: true, 
			clearContents: true,
			template: '"%text%" <a href="http://twitter.com/%user_screen_name%/statuses/%id%/" class="twitterTime" target="_blank">%time%</a>'
		});


  //accordian          
  $('#contact').hide();
  $('#about').hide();
  $('#feed').hide();
  $('#links').hide();


  function toggle_images(element) {
    var open_me = element.attr("href")

    $('#about').slideUp(300);
    $('#contact').slideUp(300);
    $('#feed').slideUp(300);
    $('#links').slideUp(300);
    
    if ($(open_me).is(":visible")) {
      $(open_me).slideUp(300);
    }else {
       $(open_me).delay(305).slideToggle(300);
    }

   

  }

  $("ul#navigation li a").each(function(){
    $(this).click(function(){
      toggle_images($(this))
    });
  })

  $('a.close').click(function() {
    $('#about').slideUp(300);
    $('#contact').slideUp(300);
    $('#feed').slideUp(300);
    $('#links').slideUp(300);
  });


//work
			$(".work").hover(
				function () {
					$(this).find(".work_info").fadeIn(100);
				}, 
				function () {
					$(this).find(".work_info").fadeOut(100);
				}
			);

			$("#workone .images").cycle({ 
				next: "#workone .images, #workone .next",
				prev: '#workone .prev',
				timeout: 0,
				fx: 'scrollHorz',
				easing: 'easeInOutQuad',
				speed:  500
			});

			$("#worktwo .images").cycle({ 
				next: "#worktwo .images, #worktwo .next",
				prev: '#worktwo .prev',
				timeout: 0,
				fx: 'scrollHorz',
				easing: 'easeInOutQuad',
				speed:  500
			});

			$("#workthree .images").cycle({ 
				next: "#workthree .images, #workthree .next",
				prev: '#workthree .prev',
				timeout: 0,
				fx: 'scrollHorz',
				easing: 'easeInOutQuad',
				speed:  500
			});


			$("#workfour .images").cycle({ 
				next: "#workfour .images, #workfour .next",
				prev: '#workfour .prev',
				timeout: 0,
				fx: 'scrollHorz',
				easing: 'easeInOutQuad',
				speed:  500
			});

			$("#workfive .images").cycle({ 
				next: "#workfive .images, #workfive .next",
				prev: '#workfive .prev',
				timeout: 0,
				fx: 'scrollHorz',
				easing: 'easeInOutQuad',
				speed:  500
			});

			$("#worksix .images").cycle({ 
				next: "#worksix .images, #worksix .next",
				prev: '#worksix .prev',
				timeout: 0,
				fx: 'scrollHorz',
				easing: 'easeInOutQuad',
				speed:  500
			});

//test - smooth scroll top


$(function () { // run this code on page load (AKA DOM load)
 
	/* set variables locally for increased performance */
	var scroll_timer;
	var displayed = false;
	var $message = $('a.top_link');
	var $window = $(window);
	var top = $(document.body).children(0).position().top;
 
	/* react to scroll event on window */
	$window.scroll(function () {
		window.clearTimeout(scroll_timer);
		scroll_timer = window.setTimeout(function () { // use a timer for performance
			if($window.scrollTop() <= top) // hide if at the top of the page
			{
				displayed = false;
				$message.fadeOut(500);
			}
			else if(displayed == false) // show if scrolling down
			{
				displayed = true;
				$message.stop(true, true).show().click(function () { $message.fadeOut(500); });
			}
		}, 100);
	});
});


});





