$(function () {
    var baseURL = "";
    var currentURL = window.location;
/*
    $("#menu-main-navigation li").each(function () {
        $(this).hover(function () {
            $(".sub-menu", this).fadeIn(200);
            $(this).addClass("selected");
        }, function () {
            $(".sub-menu", this).fadeOut(200);
            $(this).removeClass("selected");
        });
    });
	*/
	$(".category-4 .sub-menu").css("display", "block");
$(".category-7 .sub-menu").css("display", "block");
$(".category-8 .sub-menu").css("display", "block");

$("a[href='#contact']").click(function() {
  $("html").animate({ scrollTop: $(document).height() }, "slow");
  return false;
});

/*$(".portfolio_container").each(function () {
        $(this).hover(function () {
            $(".portfolio_content", this).fadeIn(200);
        });
		$("#close", this).click(function () { 
			$(this).parent().fadeOut(200);
		});
    });*/
	
	$(".portfolio_container").each(function () {        
		$("#close", this).click(function () { 
			$(this).parent().fadeOut(200);
			$(this).parent().parent().find("#open").fadeIn(200);
		});
		$("#open", this).click(function () { 
			$(".portfolio_content").fadeIn(200);
			$(this).fadeOut(200);
		});
    });
   
    $(".blog_post_container").each(function () {
        var pagingItems1 = Math.ceil(eval($(".blog_feed_post").length - 3) / 3);
        var countItems = 1;
        while (countItems <= pagingItems1 + 1) {
            $(".paging").append("<span id=\"" + countItems + "\">" + countItems + "</span>");
            countItems++;
        }
        $(".paging span:first").addClass("active");
        $(".paging span").click(function () {
            $(".paging span").removeClass("active");
            $(this).addClass("active");
            var pageNumber = $(this).attr("id") - 1;
            $(".blogs").animate({ "top": "-" + eval(pageNumber * 442) + "px" });
        });
    });

    
});
