  jQuery(document).ready(function($){
    //$('li.page-item-18 a').attr('href', '#').attr('title', 'Coming Soon!');
    //$('li.page-item-140, li.page-item-142').hide();
    //var username='Limelight_tweet';
    //var format='json';
    //var url='http://api.twitter.com/1/statuses/user_timeline/'+username+'.'+format+'?callback=?';
	//$.getJSON(url,function(tweet){
		//$("#last_tweet").html(tweet[0].text);
	//});
  	
  	  $('.portfolio_image').css('background-position','center 0');
  	  $('.portfolio_image').css('background-repeat','no-repeat');
  	  
  	  $(".portfolio_image img").load(function() {
            var imageHeight = $($(".portfolio_image img")[0]).height();
            

            $(this).css('height', imageHeight);
            //$(this).css('background','url()');

        });

  	  
  	  $(".seperatorplus").fancybox({
        'transitionIn': 'elastic',
        'transitionOut': 'elastic',
        'easingIn': 'easeOutBack',
        'easingOut': 'easeInBack',
        'speedIn': 500,
        'speedOut': 500,
        'padding': 0,
        'margin': 0,
        'autoDimensions': false,
        'width': 870,
        'height': 448,
        'overlayColor': '#000',
        'overlayOpacity': 0.3,
        'scrolling': 'no',
        'onComplete': function () {
            $("#fancybox-content").css('height', '448px');
            $("#fancybox-content").css('width', '870px');
        }
    });
       
    
    $('.slidebar').click(function(){
    	if($('.funitems').hasClass("showing")) {
    		$('.refresh').hide();
    		$('.funitems').stop().animate({height:'0px'}, {duration: 500, easing: "easeOutBack"});
	    	$('.funitems').removeClass('showing');    	
    	} else {
    		$('.funitems').show();
    		$('.funitems').stop().animate({height:'448px'}, {duration: 500, easing: "easeOutBack"});
	    	$('.funitems').addClass('showing');
	    	$('.refresh').show();
    	}
    })
    
   /*
    $('.funitems').click(function(){
    	$('.refresh').hide();
    	$(this).stop().animate({height:'0px'}, {duration: 500, easing: "easeOutBack"});
	    $(this).removeClass('showing');
    })
    */
    
  	  //Contact Us Plus Animation
		  $("#ctab").click(function(){
		  	  if($(this).hasClass("cplus")) {
	  	  	$("#contactform").fadeOut('fast');
	  	  	$("#formwrapper").animate({height: "5px"}, 300 );
	  	  	$(".pinktip").removeClass('whitetip');
			$(this).removeClass("cplus");
		  } else {
		  	$("#contactform").fadeIn('slow');
			$("#formwrapper").animate({height: "305px"}, 300 );
			$(".pinktip").addClass('whitetip');
			//$(this).css('backgroundPosition', '0 -20px');
			$(this).addClass("cplus");
		  }
	  });

	  
  	  //Portfolio Item Plus Animation
	  $(".plusbutton").click(function(){
	  	  if($(this).hasClass("plus")) {
	  	  	$(".expandcontent").fadeOut('fast');
	  	  	$(".slidepane").animate({height: "44px"}, 300 );
	  	  	$(this).css('backgroundPosition', '0 0');
			$(this).removeClass("plus");
		  } else {
		  	$(".expandcontent").fadeIn('slow');
		  	var slideHeight = $('.projdescription').outerHeight(true) + 20;
			$(".slidepane").animate({height: slideHeight + 'px'}, 300 );
			$(this).css('backgroundPosition', '0 -20px');
			$(this).addClass("plus");
		  }
	  });
	  
	  //Portfolio Page Filter Animation
	  $(".filtertitle").click(function(){
	  	if($(this).hasClass("open")) {
	  	  $('#filters').slideToggle(200);
	  	  $(this).css('-moz-border-bottom-left-radius', '3px');
		  $(this).css('border-bottom-left-radius', '3px');
		  $(this).css('-webkit-border-bottom-left-radius', '3px');
		  $(this).css('-moz-border-bottom-right-radius', '3px');
		  $(this).css('border-bottom-right-radius', '3px');
		  $(this).css('-webkit-border-bottom-right-radius', '3px');
	  	  $(this).delay(300).animate({width: "140px"}, 200);
	  	  $(this).removeClass("open");
	  	} else {
	  	  $(this).animate({width: "350px"}, 200);
	  	  $(this).css('-moz-border-bottom-left-radius', '0px');
		  $(this).css('border-bottom-left-radius', '0px');
		  $(this).css('-webkit-border-bottom-left-radius', '0px');
		  $(this).css('-moz-border-bottom-right-radius', '0px');
		  $(this).css('border-bottom-right-radius', '0px');
		  $(this).css('-webkit-border-bottom-right-radius', '0px');
	  	  $('#filters').delay(300).slideToggle(200);
	  	  $(this).addClass("open");
	  	}

	  });
	  		
	  
	  //Team Member Page Filter Animation
	  $(".memberfiltertitle").click(function(){
	  	if($(this).hasClass("open")) {
	  	  $('#memberfilters').slideToggle(200);
	  	  $(this).css('-moz-border-bottom-left-radius', '3px');
		  $(this).css('border-bottom-left-radius', '3px');
		  $(this).css('-webkit-border-bottom-left-radius', '3px');
		  $(this).css('-moz-border-bottom-right-radius', '3px');
		  $(this).css('border-bottom-right-radius', '3px');
		  $(this).css('-webkit-border-bottom-right-radius', '3px');
	  	  $(this).delay(300).animate({width: "200px"}, 200);
	  	  $(this).removeClass("open");
	  	} else {
	  	  $(this).animate({width: "437px"}, 200);
	  	  $(this).css('-moz-border-bottom-left-radius', '0px');
		  $(this).css('border-bottom-left-radius', '0px');
		  $(this).css('-webkit-border-bottom-left-radius', '0px');
		  $(this).css('-moz-border-bottom-right-radius', '0px');
		  $(this).css('border-bottom-right-radius', '0px');
		  $(this).css('-webkit-border-bottom-right-radius', '0px');
	  	  $('#memberfilters').delay(300).slideToggle(200);
	  	  $(this).addClass("open");
	  	}

	  });
	

	  //Member Grid Hover
	  $(".teamblock").hover(  	
		  function () {
		  	hoverteamimg = $(this).css('background-image');
		  	$(this).css('background-image', 'none');
		  	$(this).stop().animate({ backgroundColor: "#6cc069" }, 1500);
		  	//$(this).animate({backgroundColor:'#6cc069'}, {duration: 500, easing: "easeOutBack"});
		    //$(this).css('background', '#6cc069');
		    $(this).children().css('display', 'block');
		  }, 
		  function () {
		  	$(this).stop().animate({ backgroundColor: "#ffffff" }, 1500);
			$(this).css('background', hoverteamimg);
		    $(this).children().css('display', 'none');
		  }
		);
	  
	  
	  //Capture current page colour
	  var headerborder = $('header').css('border-bottom');  
	  
	  //Home Page
	  $("nav ul #menu-item-152 a").hover(
		  function () {
		  	menucolour = $(this).css('color');
		    $(this).css('color', '#f25eb2');
		    $('header').fadeIn(400).css('border-bottom', '3px solid #f25eb2');
		  }, 
		  function () {
		    $(this).css('color', menucolour);
		    $('header').fadeIn(400).css('border-bottom', headerborder);
		  }
		);
	  
	  //Portfolio Page
	  $("nav ul #menu-item-157 a").hover(
		  function () {
		  	menucolour = $(this).css('color');
		    $(this).css('color', '#4f9a9d');
		    $('header').fadeIn(400).css('border-bottom', '3px solid #4f9a9d');
		  }, 
		  function () {
		    $(this).css('color', menucolour);
		    $('header').fadeIn(400).css('border-bottom', headerborder);
		  }
		);
		
	  //Team Page
	  $("nav ul #menu-item-151 a").hover(
		  function () {
		  	menucolour = $(this).css('color');
		    $(this).css('color', '#6cc069');
		    $('header').fadeIn(400).css('border-bottom', '3px solid #6cc069');
		  }, 
		  function () {
		    $(this).css('color', menucolour);
		    $('header').fadeIn(400).css('border-bottom', headerborder);
		  }
		);
		
	  //Services Page
	  $("nav ul #menu-item-149 a").hover(
		  function () {
		  	menucolour = $(this).css('color');
		    $(this).css('color', '#17aadc');
		    $('header').fadeIn(400).css('border-bottom', '3px solid #17aadc');
		  }, 
		  function () {
		    $(this).css('color', menucolour);
		    $('header').fadeIn(400).css('border-bottom', headerborder);
		  }
		);
	  
	  //Contact Page
	  $("nav ul #menu-item-148 a").hover(
		  function () {
		  	menucolour = $(this).css('color');
		    $(this).css('color', '#eb2192');
		    $('header').fadeIn(400).css('border-bottom', '3px solid #eb2192');
		  }, 
		  function () {
		    $(this).css('color', menucolour);
		    $('header').fadeIn(400).css('border-bottom', headerborder);
		  }
		);
		
		$('li.gfield').each(function(i, obj){
			$(this).children(".gfield_description").insertAfter($(this).children(".gfield_label"));
		});
	   
});

