// JavaScript Document

$(function() {

    /*
    =====================================================================						
    //jquery media plugin for playing files like flv,mov and etc
    =====================================================================
    */


    /*
    =====================================================================						
    //Script for gallery effect
    =====================================================================
    */
    $(".projectItemWrapper").hover(function() {

        ///$("div.projectinfo", $(this)).addClass("show").slideUp(0).slideDown("slow"); 
        $("div.projectinfo", $(this)).css("top", "-137px");
        $("div.projectinfo", $(this)).animate({ top: '0px' }, { queue: false, duration: 500 });
    }, function() {
        //$("div.projectinfo",$(this)).removeClass("show").slideUp("slow");
        $("div.projectinfo", $(this)).animate({ top: '274px' }, { queue: false, duration: 500 });

    });


    /*
    =====================================================================						
    //Navigation show hide on mouse over on main list items
    =====================================================================
    */

    $("#MainNavigation>li").hover(function() {
        //

        var childlist = $("ul.child", $(this));
        $("div#childNav").empty();
        $(childlist).clone().prependTo("div#childNav"); // check prepend() examples
        $("div#childNav ul.child").css("display", "block");

    });

    $("#childNav").mouseenter(function() {
        // $("p:first",this).text("mouse enter");
    }).mouseleave(function() {

        $("#childNav").animate({ background: "black" }, 5000, function() {
            $("div#childNav").empty();
            //alert("hey");
        });
    }
		);


    /*
    ==============================================						
    //Featured Projects
    ==============================================
    */
    $(".projectLinkPic").hover(function() {
        //$($(this) span).css({'display','none'}).html("oye");									
        $(this).nextAll("span").addClass("highlight");
        //console.log("shit");
    }, function() {
        $(this).nextAll("span.highlight").removeClass();
    });


    /*
    ==============================================						
    //Featured Projects
    ==============================================
    */
    var loc = window.location.toString();
    var response = loc.match(/[^/]+.aspx/gi).toString();
    //console.log(response);
    var items = {
        "Default.aspx": 'Home',
        "ProjectGallary.aspx": 'Our Work',
        "Services.aspx": 'Services',
        "Clients.aspx": 'Clients',
        "ProjectGallary.aspx": 'Our Work',
        "ProjectDetails.aspx": 'Our Work',
        "About.aspx": 'About'
    };
    for (var index in items) {
        //document.write(index + " : " + items[index] + "<br />");
        if(index == response)
        {
            //console.log(index + ":" + items[index]);
            $("#MainNavigation > li").removeClass("currentPage");
            $("#MainNavigation > li a:contains('"+items[index]+"')").parent().addClass("currentPage");
            //console.log(len);
        }
    }



});