﻿$(document).ready(function () {

    // home banner tabs
    $("div.home-banner-inner").tabs();

    var featureBaseLink = "http://www.pedrera.com/portfolio/";
    //featureLink = featureBaseLink + $("div.home-featured-project ul li").attr('id');

    // home feature cycler
    $("div.home-featured-project ul").cycle({
        fx: 'fade',
        speed: 'fast',
        next: '.next',
        prev: '.prev',
        pager: '.pager',
        containerResize: 0,
        fit: 1,
        after: onAfter
    });

    function onAfter() {
        featureLink = featureBaseLink + $(this).attr('id');
        var theTitle = "<a href='" + featureLink + "'>" + $(this).find('img').attr('alt'); +"</a>";
        $("div.featured-project-nav p.title").html(theTitle);
    }

    $("div.featured-project-link, div.featured-project-nav p.title").click(function () {
        document.location = featureLink;
    });

    // fix webkit background bug
    if ($.browser.webkit) {
        $('#container').css('background', 'url(http://www.pedrera.com/images/BG_container_webkit.png) center repeat-y');
        $('#footer').css('background', 'url(http://www.pedrera.com/images/BG_footer_webkit.png) bottom center no-repeat');
    }


});
