// JavaScript Document
$(function() {

		   //TABS
    $("#tab1").click(function() {
            $("#tabs-3").css("display", "none");
            $("#tabs-2").css("display", "none");
            $("#tabs-1").css("display", "block");
            $("#tab1").attr('class', 'on');
            $("#tab2").attr('class', 'off_twitter');
            $("#tab3").attr('class', 'off_twitter');

    });

    $("#tab2").click(function() {
            $("#tabs-3").css("display", "none");
            $("#tabs-1").css("display", "none");
            $("#tabs-2").css("display", "block");
            $("#tab1").attr('class', 'off_fb');
            $("#tab2").attr('class', 'on ');
            $("#tab3").attr('class', 'off_fb');
	});

    $("#tab3").click(function() {
            $("#tabs-1").css("display", "none");
            $("#tabs-2").css("display", "none");
            $("#tabs-3").css("display", "block");
            $("#tab1").attr('class', 'off_news');
            $("#tab2").attr('class', 'off_news');
            $("#tab3").attr('class', 'on');
    });


	 $("#two-tab_tab1").click(function() {
            $("#tabs-2").css("display", "none");
            $("#tabs-1").css("display", "block");
            $("#two-tab_tab1").attr('class', 'on');
            $("#two-tab_tab2").attr('class', 'off');

    });


	  $("#two-tab_tab2").click(function() {
            $("#tabs-1").css("display", "none");
            $("#tabs-2").css("display", "block");
            $("#two-tab_tab2").attr('class', 'on');
            $("#two-tab_tab1").attr('class', 'off');

    });



/** TWITTER FUNCTIONS **/

	$("#twitNav .arrowDown").hover(function() {
			var th = $("#tweets").height();
			var position = $("#tweets").position();

		if(position.top >= (-th)+120) {
			$("#tweets").animate({top: (-th)+50}, 10000);
		}

		},
		  function () {
			$("#tweets").stop();
		  }
		);

    /*$("#newsNav .arrowDown").hover(function() {
            var th = $("#news").height();
            var position = $("#news").position();

        if(position.top >= (-th)+120) {
            $("#news").animate({top: (-th)+50}, 10000);
        }

        },
          function () {
            $("#news").stop();
          }
        );*/

	$("#twitNav .arrowDown").click(function() {
		$("#tweets").stop();
		var th = $("#tweets").height();
			var position = $("#tweets").position();

		if(position.top >= (-th)+120) {
			$("#tweets").animate({top: position.top-120}, 500);
		}
										  });

    /*$("#newsNav .arrowDown").click(function() {
        $("#news").stop();
        var th = $("#news").height();
            var position = $("#tweets").position();

        if(position.top >= (-th)+120) {
            $("#news").animate({top: position.top-120}, 500);
        }
                                          });*/



	$("#twitNav .arrowUp").hover(function() {
			var th = $("#tweets").height();
			var position = $("#tweets").position();

		if(position.top <= 0) {
			$("#tweets").animate({top: -25}, 10000);
		}

		},
		  function () {
			$("#tweets").stop();
		  }
		);



    /*$("#newsNav .arrowUp").hover(function() {
            var th = $("#news").height();
            var position = $("#news").position();

        if(position.top <= 0) {
            $("#news").animate({top: -25}, 10000);
        }

        },
          function () {
            $("#news").stop();
          }
        );*/



	$("#twitNav .arrowUp").click(function() {
		$("#tweets").stop();
		var th = $("#tweets").height();
			var position = $("#tweets").position();

		if(position.top <= -25) {
			$("#tweets").animate({top: position.top+120}, 500);
		}
										  });



    /*$("#newsNav .arrowUp").click(function() {
        $("#news").stop();
        var th = $("#news").height();
            var position = $("#tweets").position();

        if(position.top <= -25) {
            $("#news").animate({top: position.top+120}, 500);
        }
                                          });*/

   });
