﻿String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };

$(document).ready(function() {

    $("#masthead div.search input.text").val("Search");

    $("#masthead div.search input.text").click(function() {
        if ($(this).val() == "Search")
            $(this).val("");
    });

    $("#masthead div.search input.text").blur(function() {
        if ($(this).val() == "")
            $(this).val("Search");
    });

    // meet the team thumbnail hover
    $("div.team-thumb").hover(function() {
        $(this).find("div.caption").show();
    },
        function() {
            $(this).find("div.caption").hide();
        });

    $("div.team-thumb").click(function() {
        window.location = $(this).find("a").attr("href");
    });

    // portfolio scroller
    var requestedSlide = jQuery.url.param("project");
    var startSlide = "";
    if (requestedSlide != "") {
        startSlide = requestedSlide - 1;
    } else {
        startSlide = 0;
    }
    var rotator = $('#body-content-center div.portfolio-banner ul');
    $(rotator).cycle({
        fx: 'scrollHorz',
        timeout: 20000,
        pause: true,
        speed: 750,
        startingSlide: startSlide,
        prev: '#body-content-center div.portfolio-banner div.portfolio-nav a#portfolio-previous',
        next: '#body-content-center div.portfolio-banner div.portfolio-nav a#portfolio-next',
        pager: '#body-content-center div.portfolio-banner div.portfolio-nav-inner'
    });

    //alert(requestedSlide);

});