// JavaScript Document
function addClickHandlerOnSwitches() {
    $("#switches li").click(function () {
        var $this = $(this);
        // Don't show/hide divs if clicked menu item is active - is redundant
        // Don't show/hide divs if they are links - not necessary to show an empty black div
        if (!$this.hasClass('active') && (!$this.hasClass('linkmenu'))) {
            $("#switches li").css('color', '#7e7e7e');
            $("#switches li").removeClass('active');
            $this.css('color', '#fff');
            $this.addClass('active');
            $("#slides div").hide();
            // Get slide ID
            var $slideID = "#slide" + $this.attr("id").replace(/switch/, "");
            $($slideID).show();

            // Take care of the special cases:
            if ($this.attr("id") == "switch2") {
                // If the menu item clicked is "Our work", load the our work carousel
                // hide all child divs
                $($slideID + " div").hide();
                // show main projects carousel
                $("#mainprojects").show();
                // show all carousel items
                $("#mainprojects div").show();
                loadCarousel("mycarousel");
            }
            else if ($this.attr("id") == "switch4") {
                // If the menu item clicked is "Partners", load the partners carousel
                // hide all child divs
                $($slideID + " div").hide();
                // show partners carousel
                $("#partners").show();
                // show all carousel items
                $("#partners div").show();
                loadCarousel("carouselpartners");
            }
            else {
                // show all child divs
                $($slideID + " div").show();
                // If the menu item clicked is home, load the slideshow
                if ($this.attr("id") == "switch0") {
                    // load slideshow for home
                    loadSlideShow("#showCase");
                }
            }
        }
    });
}

function addClickHandlerOnCloseButton() {
	// Handles the click on the close button - comes back to the main projects
	$(".close").click(function () {
		var $this = $(this);
		// hide all divs
		$("#slide2 div").hide();
		// show carousel and child divs
		$("#mainprojects").show();
		$("#mainprojects div").show();
	});
}

/* function addClickHandlerOnCarouselItems() {
	// Handles the click on each item of the carousel - shows the slideshow of sub-projects
	$("#mycarousel li").click(function () {
		var $this = $(this);
		// hide carousel
		$("#mainprojects").hide();
		// show subprojects
		$("#projects").show();
		// get id of the project div
		var $projectID = "#projects" + $this.attr("id").replace(/carousel/, "");
		// show assigned project list
		$($projectID).show();
		// show all child divs
		$($projectID + " div").show();
		// create slideshow for the current main project
		loadSlideShow($projectID);
	});
} */

function addClickHandlerOnVisitButton() {
// Handles the click on each item of the carousel - shows the slideshow of sub-projects
$("#b1").click(function () {
var $this = $(this);
// hide carousel
$("#mainprojects").hide();
$("#projects1").show(); 
$("#close1").show();
});

$("#b2").click(function () {
var $this = $(this);
// hide carousel
$("#mainprojects").hide();
$("#projects2").show(); 
$("#close2").show();
});

$("#b3").click(function () {
var $this = $(this);
// hide carousel
$("#mainprojects").hide();
$("#projects3").show(); 
$("#close3").show();
});

$("#b4").click(function () {
var $this = $(this);
// hide carousel
$("#mainprojects").hide();
$("#projects4").show(); 
$("#close4").show();
});

$("#b5").click(function () {
var $this = $(this);
// hide carousel
$("#mainprojects").hide();
$("#projects5").show(); 
$("#close5").show();
});
}

function addClickHandlerOnVisitButtons() {
    // This function stops the propagation of the click event on the visit button the parent container.
    // This will only take you to the link and not show all the sub-projects of the project you've clicked to visit
    $("#button1").click(function (event) {
        event.stopPropagation();
        window.open("http://www.42thefloor.ro");
    });
    $("#button2").click(function (event) {
        event.stopPropagation();
        window.open("http://www.big-fm.ro");
    });
	$("#button3").click(function (event) {
        event.stopPropagation();
        window.open("http://www.biomedia.ro");
    });
	$("#button4").click(function (event) {
        event.stopPropagation();
        window.open("http://www.devaforum.ro");
    });
	$("#button5").click(function (event) {
        event.stopPropagation();
        window.open("http://www.fashionablearmoire.blogspot.com/");
    });
	$("#button6").click(function (event) {
        event.stopPropagation();
        window.open("http://cirsteadaniel.blogspot.com/");
    });
	$("#button7").click(function (event) {
        event.stopPropagation();
        window.open("http://www.onlinebeats.tk");
    });
	$("#button8").click(function (event) {
        event.stopPropagation();
        window.open("http://www.plictis.ro");
    });
	$("#button9").click(function (event) {
        event.stopPropagation();
        window.open("http://myspace.com/destiny_show");
    });
	$("#sounddesign").click(function (event) {
        event.stopPropagation();
        window.open("http://www.istockphoto.com/file_search.php?action=file&userID=4090017&order=6&fileTypeSizePrice=[{%22type%22:%22Image%22,%22size%22:%22All%22,%22priceOption%22:%221%22},{%22type%22:%22Illustration%20[Vector]%22,%22size%22:%22Vector%20Image%22,%22priceOpt");
    });
}

