$(document).ready(function() {
  $('#announce').click(function(){
    $(this).hide();
  });
});


// 2. animate puppy logo bottom on hover
$(document).ready(function(){
  $('#logobottom img').hover(function(){
    $(this).animate({paddingLeft: '+=160px'}, 800);
  }, function(){
    $(this).animate({paddingLeft: '-=160px'}, 800);
  });
});


// 3. animate icon on top navigation
$(document).ready(function(){
  $('#homeBtn').hover(function(){
    $('#homeIcon .jump')
            // first jump  
            .animate({top:"-10px"}, 200).animate({top:"0px"}, 100)
            // second jump
            .animate({top:"-6px"}, 100).animate({top:"0px"}, 80)
            // final jump
            .animate({top:"-3px"}, 80).animate({top:"0px"}, 30);
	}, function(){			
    });
});



// 1. give highlight for every div with class high
$(document).ready(function(){
	$('div.high').hover(function() {
	$(this).addClass('highme');
	}, function() {
	$(this).removeClass('highme');
	});	
});

// 1. give highlight for every tr with class high
$(document).ready(function(){
	$('tr.high').hover(function() {
	$(this).addClass('highmeB');
	}, function() {
	$(this).removeClass('highmeB');
	});	
});

$(document).ready(function(){
  $('#productBtn').hover(function(){
    $('#productIcon .jump')
            // first jump  
            .animate({top:"-10px"}, 200).animate({top:"0px"}, 100)
            // second jump
            .animate({top:"-6px"}, 100).animate({top:"0px"}, 80)
            // final jump
            .animate({top:"-3px"}, 80).animate({top:"0px"}, 30);
	}, function(){			
    });
});



$(document).ready(function(){
  $('#supportBtn').hover(function(){
    $('#supportIcon .jump')
            // first jump  
            .animate({top:"-10px"}, 200).animate({top:"0px"}, 100)
            // second jump
            .animate({top:"-6px"}, 100).animate({top:"0px"}, 80)
            // final jump
            .animate({top:"-3px"}, 80).animate({top:"0px"}, 30);
	}, function(){			
    });
});

$(document).ready(function(){
  $('#accountBtn').hover(function(){
    $('#accountIcon .jump')
            // first jump  
            .animate({top:"-10px"}, 200).animate({top:"0px"}, 100)
            // second jump
            .animate({top:"-6px"}, 100).animate({top:"0px"}, 80)
            // final jump
            .animate({top:"-3px"}, 80).animate({top:"0px"}, 30);
	}, function(){			
    });
});

$(document).ready(function(){
  $('#eClubBtn').hover(function(){
    $('#eClubIcon .jump')
            // first jump  
            .animate({top:"-10px"}, 200).animate({top:"0px"}, 100)
            // second jump
            .animate({top:"-6px"}, 100).animate({top:"0px"}, 80)
            // final jump
            .animate({top:"-3px"}, 80).animate({top:"0px"}, 30);
	}, function(){			
    });
});


$(document).ready(function(){
   getGoogleBuzz('etel.good', 8, $('#buzzwidget')); //change username here
});

function getGoogleBuzz(username,n, div){
   // params for Google Feed API proxy : Buzz Feed URL, Number of Entries 
   var data = {q:'http://buzz.googleapis.com/feeds/'+username+'/public/posted' 
            ,num:n
            ,output:'json'
            ,v:'1.0'};
   // call Google Feed API
   $.ajax({
      url:'http://ajax.googleapis.com/ajax/services/feed/load'
      ,data:data
      ,dataType:'jsonp'
      ,success:function(json){
         // json from Google Feed API was returned successfully..

         // error with Google Buzz feed ?
         if(json.responseStatus!=200) {
            div.html('<b style="color:red">'+ json.responseDetails +'</b>');
            return; 
         };
         // Buzz entries array
         var entries= json.responseData.feed.entries;
         var length= entries.length;
         // no entries!
         if(length==0) return; 

         // start output by appendding a hidden unordered list
         var ul = $('<ul class="gb" style="display:none"></ul>').appendTo(div.html(''));

         // loop buzz entries
         for(var i=0; i<length; i++){
            // parse published-date string
            var pDate = new Date(entries[i].publishedDate);
            // using entry snippet version
            var snippet = entries[i].contentSnippet;
            // convert links that start with http to hyperlinks using regular expression
            snippet = snippet.replace(/\b(https?\:\/\/\S+)/gi,' <a href="$1">$1</a>');
            // append buzz to UL
            ul.append('<li>'
               +'<span class="gb-content">'+ snippet +'</span>'
               +'<span class="gb-meta">'
                  + '<a href="'+ entries[i].link +'">'+ pDate.toLocaleString() +'</a>'
               +'</span>'
            +'</li>');
         };

         // now show-in the unordered list
         ul.show('slow');
      }
   });
}



// 5. Simple Tips
$(document).ready(function(){						   
	$('.location').hover(function(e) {				  
		// Hover over code
		var titleText = $(this).attr('title');
		$(this)
		.data('tipText', titleText)
		.removeAttr('title');
		$('<p class="tooltip"></p>')
		.text(titleText)
		.appendTo('body')
		.css('top', (e.pageY - 10) + 'px')
		.css('left', (e.pageX + 20) + 'px')
		.fadeIn('slow');		
		}, function() {	
		// Hover out code
		$(this).attr('title', $(this).data('tipText'));
		$('.tooltip').remove();
		}).mousemove(function(e) {
		// Mouse move code
		$('.tooltip')
		.css('top', (e.pageY - 10) + 'px')
		.css('left', (e.pageX + 20) + 'px');	
	});
});

// 4. banner fade
$(document).ready(function(){
		$('#bannerfade').innerfade({
			speed: 'slow',
			timeout: 2000,
			type: 'sequence',
			containerheight: '110px'
		});	
});

// news ticker
$(document).ready(function(){
		$('.newsticker').innerfade({
			animationtype: 'slide',
			speed: 'slow',
			timeout: 4500,
			type: 'sequence',
			containerheight: '12px'
		});	
});