var scripts = {

    hideElements : function() {
    
        for(var j=0; j < arguments.length; j++) {
            $(arguments[j]).hide();
        }
        
    },
    
    addFolioId : function() {
    
        $("#portfolio .entry").each(function(i){
            i++;
            $(this).attr("id", "e"+i);
        });
        
    },
    
    addFolioClass : function() {
    
        for(var i=0; i < arguments.length; i++) {
            $(arguments[i]).addClass("left");
        }
    
    },
    
    makeLightbox : function() {
        
        for(var i=0; i < arguments.length; i++) {
            if($(arguments[i])) {
                $(arguments[i]).fancybox();
            }
        }
    },
    
    makeDropdown : function() {

        $("#mainNav li").hover(

              function(){

                    $(this).find(".ddMenu").parent().addClass("ddHover");
                    $(this).find(".ddMenu").show();

              },
              function(){

                    $(this).removeClass("ddHover");
                    $(this).find(".ddMenu").hide();

              }

        );

      },
      
      fadeEntries : function() {
      
        $("#portfolio .entry").hover(
        
            function() {
                $(this).parent().children().stop().fadeTo(500, 0.25);
                $(this).stop().fadeTo(100, 1);
            },
            
            function() {
                $(this).parent().children().stop().fadeTo(500, 1);
            }
            
        );
      
      },
      
      init : function() {
        this.addFolioId();
        this.hideElements("#portfolio .entry .desc");
        this.addFolioClass("#e2", "#e3", "#e6", "#e7");
        this.makeDropdown();
		this.makeLightbox("a.lightbox");
      }
    
}

$(document).ready(function(){
    
    scripts.init();

    
     /*****************/
    /*** scroll To ***/
    $("#mainNav li.scrollTo a").click(function(){
        var $an = jQuery(this).attr("href");
        
        $.scrollTo($an, {duration: 800, axis:"y", onAfter:function() {
                location.hash = $an;     
            }
        });
        
        return false;
        
    });
    /*****************/
    
    $("#portfolio .entry > a").click(function(){
        var $desc = jQuery(this).next(".desc");
        $(this).parent().css('zIndex', 5);
        
        $desc.fadeIn("slow");

        return false;
    });
    
    $(".entry .desc").hover(function(){
               $(this).show();
            }, function() {
                $(this).hide();
                $(this).parent().css('zIndex','');
            }
    );
    /*****************/
    
    $("#portfolio .entry .close").click(function(){
        $(this).parent().hide();
        return false;
    });
	

    
});

$(window).load(function(){
	
		$(function() {
		    $(".flickr_badge_wrapper").jCarouselLite({
    			auto: 3500,
    			speed: 1000,
				visible: 3,
		    });
		});
	
});
