$(document).ready(function() {
  
  // comming soon: vork hoverings
	/*$('#work li')
		.hover(function(e) {
			$(this).hoverFlow(e.type, { height: 298 }, 600);
			$(this).find('img').hoverFlow(e.type, { top: 0 }, 550);

		}, function(e) {
			$(this).hoverFlow(e.type, { height: 100 }, 'fast');
			$(this).find('img').hoverFlow(e.type, { top: -115 }, 'fast');
	});
  */

	// portfolio slides
  $('#portfolio li a').colorbox({
    rel:'group1'
  }).parent().hover(
    function () {
      $(this).siblings().stop().animate({
        opacity: .4
      }, 300)

      console.log($(this).attr(alt))
    }, function () {
      $(this).siblings().stop().animate({
        opacity: 1
      }, 500)
    }
  );


 	// Wufoo Contact form
	$(".open-lightbox").colorbox({
		"inline" : true,
		"href": "#wufoo-form iframe",
    	"width": 700,
		"innerHeight": $("#wufoo-form iframe").height(),   // Only deals with initial load
	});
	

  // todo: fix er up
  // services hype
  $('#services .first.service').click(function() {
    //$(this).trigger('click');
    //console.log("hello")
    //HYPE.documents['design'].playTimelineNamed('Main Timeline')
    //HYPE.documents['design'].showSceneNamed("Main", this.kSceneTransitionCrossfade)
  });




	// tool tips
	var $processesLi = $('#process li:not(.note)'),
  		$processesBg = $processesLi.css('backgroundColor'),
  		$processesText = $processesLi.find('p').css('color');

  $('#process li:not(.note)').each(function(i){
  	$(this).qtip({
      content: {
          text: $(this).find('.content').clone()
      },
      position: {
          my: 'bottom center',
          at: 'top center', 
          adjust: {
          	y: -15
          }
      },
      show: {
	    effect: function() {
	      //$(this).fadeIn(400).animate({top: "-10"}); // "this" refers to the tooltip
	      $(this).fadeIn(400);
	    }
	  },
	  style: { tip: {width: 25, height: 10} }
    })
  }).hover(function(e) {
		$(this).hoverFlow(e.type, { backgroundColor: $processesText }, 400);
	}, function(e) {
		$(this).hoverFlow(e.type, { backgroundColor: $processesBg }, 200);
	}).parent().hover(function(e) {
		$('header, #services, #copyright, #social, #portfolio, .thanks-note').hoverFlow(e.type, { opacity: .35 }, 400);
	}, function(e) {
		$('header, #services, #copyright, #social, #portfolio, .thanks-note').hoverFlow(e.type, { opacity: 1 }, 300);
	});

	
  // IE hack-a-rama
  if ( $.browser.msie && $.browser.version < 9 ) {
    $('body').addClass('ie')
  }


  /*
  // todo: would be cool to make something that counts 
  //       how many seconds people stay on each process (if they read the content)
  var hiConfig = {
      sensitivity: 3, // number = sensitivity threshold (must be 1 or higher)
      interval: 3000, // number = milliseconds for onMouseOver polling interval
      timeout: 200, // number = milliseconds delay before onMouseOut
      over: function() {
          console.log("3 second passes on hover")
          _gaq.push(['_trackEvent', 'Process Views', 'Hover', $(this).find('h4').text(), .25]);
      }, // function = onMouseOver callback (REQUIRED)
      out: function() { console.log("im out")  } // function = onMouseOut callback (REQUIRED)
  }
  $('#process li').hoverIntent(hiConfig);
  */ 
  $('#thankyou a.social').click(function(){
    _gaq.push(['_trackEvent', 'Thank You Social Links', 'Click', $(this).attr('href'), 5]);
  });





});
