//direction right=1, left = 0
//start = 1 , pause = 0

var iconDirection=1 , iconStart=0, iconSpeed=8, iconDelay=30;

    function animateIcon()
    {
        if(iconStart)
        {
            if(iconDirection)
            {
        $('#footer_community_icon_container').children().each(function(){
          var a = $(this);
          var newleft = a.position().left + iconSpeed;
          if (newleft > 816) {
            newleft -= 1088;
          }
          a.css('left', (newleft) + 'px');
        });
            }
            else
            {
        $('#footer_community_icon_container').children().each(function(){
          var a = $(this);
          var newleft = a.position().left - iconSpeed;
          if (newleft < -136) {
            newleft += 1088;
          }
          a.css('left', (newleft) + 'px');
        });
            }
        }
        setTimeout("animateIcon()",iconDelay);
    }
	
animateIcon();

$(document).ready(function(){
	
	$(document).pngFix();
	
	$("#footer_mstv_container").mouseover(
	function(){
		$("#footer_mstv_rightlight").removeClass('footer_mstv_rightlight_normal');
		$("#footer_mstv_leftlight").removeClass('footer_mstv_leftlight_normal');
		$("#footer_mstv_rightlight").addClass('footer_mstv_rightlight_hover');
		$("#footer_mstv_leftlight").addClass('footer_mstv_leftlight_hover');
	});

	$("#footer_mstv_container").mouseout(
	function(){
		$("#footer_mstv_rightlight").addClass('footer_mstv_rightlight_normal');
		$("#footer_mstv_leftlight").addClass('footer_mstv_leftlight_normal');
		$("#footer_mstv_rightlight").removeClass('footer_mstv_rightlight_hover');
		$("#footer_mstv_leftlight").removeClass('footer_mstv_leftlight_hover');
	});
	
	$("#footer_community_arrow_left_container").mouseover(
	function(){
		iconStart=1;
		iconDirection=0;
		$("#footer_community_arrow_left").removeClass('footer_community_arrow_left');
		$("#footer_community_arrow_left").addClass('footer_community_arrow_left_hover');
	});

	$("#footer_community_arrow_left_container").mouseout(
	function(){
		iconStart=0;
		$("#footer_community_arrow_left").addClass('footer_community_arrow_left');
		$("#footer_community_arrow_left").removeClass('footer_community_arrow_left_hover');
	});

	$("#footer_community_arrow_right_container").mouseover(
	function(){
		iconStart=1;
		iconDirection=1;		
		$("#footer_community_arrow_right").removeClass('footer_community_arrow_right');
		$("#footer_community_arrow_right").addClass('footer_community_arrow_right_hover');
	});

	$("#footer_community_arrow_right_container").mouseout(
	function(){
		iconStart=0;
		$("#footer_community_arrow_right").addClass('footer_community_arrow_right');
		$("#footer_community_arrow_right").removeClass('footer_community_arrow_right_hover');
	});
	
	$("div.footer_community_thesummit_icon").click(
		function()
		{
			top.location = 'communities.php?link=thesummit';
		}
	);

	$("div.footer_community_eaglekidz_icon").click(
		function()
		{
			top.location = 'communities.php?link=eaglekidz';
		}
	);
	
	$("div.footer_community_mswomen_icon").click(
		function()
		{
			top.location = 'communities.php?link=mswomen';
		}
	);

	$("div.footer_community_cgpro_icon").click(
		function()
		{
			top.location = 'communities.php?link=prom';
		}
	);

	$("div.footer_community_mssenior_icon").click(
		function()
		{
			top.location = 'communities.php?link=mssenior';
		}
	);
	
	$("div.footer_community_cg_icon").click(
		function()
		{
			top.location = 'communities.php?link=connect';
		}
	);
	
	$("div.footer_community_aog_icon").click(
		function()
		{
			top.location = 'communities.php?link=aog';
		}
	);
	
	$("div.footer_community_decafe_icon").click(
		function()
		{
			top.location = 'communities.php?link=dcafe';
		}
	);
	
	$("div.footer_mstv_container").click(
		function()
		{
			window.open ("http://www.gms.or.id/live","mywindow");
		}
	);
	
	
});
