$(function() {
	handlerEvents();
	$('#pressLogos').cycle({
		fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	});
	
   $("#allnavs").jCarouselLite({
        btnNext: ".navright",
        btnPrev: ".navleft",
        speed:1000,
        auto:5000,
		scroll:true,		
        visible:7
    });
    
	$("#btnFeatured").removeClass('btnFeaturedGrey').addClass('btnFeaturedGreen');
    $('#btnFeatured').removeAttr('onmouseover').removeAttr('onmouseout');
	
});

function handlerEvents()
{
	$("#btnFeatured").click(function()
        {
            $("#btnFeatured").unbind('mouseenter');
            $("#btnFeatured").unbind('mouseleave');
            $("#btnGiftunder").removeClass('btnGiftunderGreen').addClass('btnGiftunderGrey');
            $("#btnFeatured").removeClass('btnFeaturedGrey').addClass('btnFeaturedGreen');
            $('#btnFeatured').removeAttr('onmouseover').removeAttr('onmouseout');
            $("#btnGiftunder").hover(
                function () {
                    $(this).removeClass('btnGiftunderGrey').addClass('btnGiftunderGreen');
                },
                function () {
                    $(this).removeClass('btnGiftunderGreen').addClass('btnGiftunderGrey');
                }
            );
            getGiftsForHomepage(3);
        });
	$("#btnGiftunder").click(function()
        {
            $("#btnGiftunder").unbind('mouseenter');
            $("#btnGiftunder").unbind('mouseleave');
            $("#btnFeatured").removeClass('btnFeaturedGreen').addClass('btnFeaturedGrey');
            $("#btnGiftunder").removeClass('btnGiftunderGrey').addClass('btnGiftunderGreen');
            $('#btnGiftunder').removeAttr('onmouseover').removeAttr('onmouseout');
            $("#btnFeatured").hover(
                function(){
                    $(this).removeClass('btnFeaturedGrey').addClass('btnFeaturedGreen');
                },
                function(){
                    $(this).removeClass('btnFeaturedGreen').addClass('btnFeaturedGrey');
                }
            );
            getGiftsForRange(0,15)
        });
	$("#btnSeeall").click(function(){window.location=URL+'gifts/';});
	$("#phraseSearch").keypress(function(e){if(e.which==13) doSearchGifts();});
	$("#SearchSubmit").click(function(){doSearchGifts();});
	$("#phonenumber_third").keypress(function(e){if(e.which==13) goToRedeem();});
	$("#btnReedem").click(function(){goToRedeem();});
}
