$(document).ready(function(){
	/* This code is executed after the DOM has been completely loaded */

	/* Changing thedefault easing effect - will affect the slideUp/slideDown methods: */
	$.easing.def = "easeOutBounce";

	/* Binding a click event handler to the links: */
	$('li.button a').click(function(e){
	
		/* Finding the drop down list that corresponds to the current section: */
		var dropDown = $(this).parent().next();
		
		/* Closing all other drop down sections, except the current one */
		$('.dropdown').not(dropDown).slideUp('slow');
		dropDown.slideToggle('slow');
		
		/* Preventing the default event (which would be to navigate the browser to the link's address) */
		e.preventDefault();
		
		
		/* Keep current menu open */
	});
	
	$(function(){
  
		var url = location.pathname;
  
		if(url.indexOf('portfolios') > -1) {
			$(".portfolios").attr("class","show");
		}
		
		if(url.indexOf('production') > -1) {
			$(".production").attr("class","show");
		}
	});

        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        /* Scroll to next article 
        //  Developed by Roshan Bhattarai 
        //  Visit http://roshanbh.com.np for this script and more.
        //  This notice MUST stay intact for legal use
        window.onload = function()
        {
                //adding the event listerner for Mozilla
            if(window.addEventListener) document.addEventListener('DOMMouseScroll', moveObject, false);
                //for IE/OPERA etc
            document.onmousewheel = moveObject;
        } */
        /* Added 
        function recScrollStop() {
                clearTimeout(timeout);
        }
        ///
        function moveObject(event)
        {
            var delta = 0; 
                if (!event) event = window.event;  
                 // normalize the delta
                if (event.wheelDelta)
                {
                        // IE & Opera
                delta = event.wheelDelta / 120;
                }
                else if (event.detail) // W3C
                {
                        delta = -event.detail / 3;
                } */
                
                /* Act if delta != 0 
                if (delta) {
                        if (delta > 0) {
                                direction = recScrollStop();
                                delta = delta;
                        }
                        else {
                              direction = 'right';
                        }
                        pixels = pixelsPerEvent * delta;
                        speed = delta * 5;
                        //alert("Scrolling "+elementId+" "+direction+" by "+pixels);
                        recScrollBy(elementId,direction,delta,speed);
                }
                
           var currPos=document.getElementById('container').offsetLeft;
           //calculating the next position of the object
           currPos=parseInt(currPos)+(delta*40);
           //moving the position of the object 
           document.getElementById('container').style.left=currPos+"px";
        } */
        
        //document.documentElement.style.overflowX = 'hidden';	 // horizontal scrollbar will be hidden
        //document.documentElement.style.overflowY = 'hidden';	 // vertical scrollbar will be hidden

	// Define width of pages based on number of posts
	var width = 0;
        $('.entry').each(function() {
                width += $(this).outerWidth( true );
        });
        $('#container').css('width', width + 150);

});
