﻿$(function() {
    //$.preloadCssImages(); 
});

/*-----------------------------------------------------------------------
Form Default Values
------------------------------------------------------------------------*/

$(function() {
    $('input[title!=""], select[title!=""], textarea[title!=""]').hint('focus');
});

/*-----------------------------------------------------------------------
Featured Clients
------------------------------------------------------------------------*/

$(function() {

    $('#feature-clients').cycle({
        fx: 'scrollLeft',
        timeout: 5000,
        //pause: true,
        next: '#fn-next a',
        prev: '#fn-prev a',
        speed: 1100,
        startingSlide: 6
    });

});

/*-----------------------------------------------------------------------
Showcase Clients
------------------------------------------------------------------------*/

$(function() {

    $.fn.cycle.updateActivePagerLink = function(pager, currSlideIndex) {

        $(pager).find('a').removeClass('active')
        .filter('a:eq(' + currSlideIndex + ')').addClass('active');
    };

    $('#showcase-clients').cycle({
        fx: 'scrollLeft',
        timeout: 5000,
        pause: true,
        next: '#pn-next a',
        prev: '#pn-prev a',
        height: '400px',
        pager: '#pager-numbers',
        speed: 1100,
        startingSlide: 0
    });

    $('#pn-one a').click(function() { $('#showcase-clients').cycle(0); return false; });
    $('#pn-two a').click(function() { $('#showcase-clients').cycle(1); return false; });
    $('#pn-three a').click(function() { $('#showcase-clients').cycle(2); return false; });
    $('#pn-four a').click(function() { $('#showcase-clients').cycle(3); return false; });
    $('#pn-five a').click(function() { $('#showcase-clients').cycle(4); return false; });
    $('#pn-six a').click(function() { $('#showcase-clients').cycle(5); return false; });
    $('#pn-seven a').click(function() { $('#showcase-clients').cycle(6); return false; });
    $('#pn-eight a').click(function() { $('#showcase-clients').cycle(7); return false; });
    $('#pn-nine a').click(function() { $('#showcase-clients').cycle(8); return false; });
    $('#pn-ten a').click(function() { $('#showcase-clients').cycle(9); return false; });

    $('#pn-a a').click(function() { $('#showcase-clients').cycle(0); return false; });
    $('#pn-b a').click(function() { $('#showcase-clients').cycle(1); return false; });
    $('#pn-c a').click(function() { $('#showcase-clients').cycle(2); return false; });
    $('#pn-d a').click(function() { $('#showcase-clients').cycle(3); return false; });
    $('#pn-e a').click(function() { $('#showcase-clients').cycle(4); return false; });
    $('#pn-f a').click(function() { $('#showcase-clients').cycle(5); return false; });
    $('#pn-g a').click(function() { $('#showcase-clients').cycle(6); return false; });
    $('#pn-h a').click(function() { $('#showcase-clients').cycle(7); return false; });
    $('#pn-i a').click(function() { $('#showcase-clients').cycle(8); return false; });
    $('#pn-j a').click(function() { $('#showcase-clients').cycle(9); return false; });

    $('#li-1 a').click(function() { $('#showcase-clients').cycle(0); return false; });
    $('#li-2 a').click(function() { $('#showcase-clients').cycle(1); return false; });
    $('#li-3 a').click(function() { $('#showcase-clients').cycle(2); return false; });
    $('#li-4 a').click(function() { $('#showcase-clients').cycle(3); return false; });

});

/*-----------------------------------------------------------------------
Selected Client
------------------------------------------------------------------------*/

$(function() {

    $.fn.cycle.updateActivePagerLink = function(pager, currSlideIndex) {

        $(pager).find('a').removeClass('active')
        .filter('a:eq(' + currSlideIndex + ')').addClass('active');
    };

    $('#featured-client').cycle({
        fx: 'scrollLeft',
        timeout: 5000,
        pause: true,
        next: '#pn-next a',
        prev: '#pn-prev a',
        height: '400px',
        pager: '#pager-numbers',
        speed: 1100,
        startingSlide: 0
    });

    $('#pn-one a').click(function() { $('#featured-client').cycle(0); return false; });
    $('#pn-two a').click(function() { $('#featured-client').cycle(1); return false; });
    $('#pn-three a').click(function() { $('#featured-client').cycle(2); return false; });
    $('#pn-four a').click(function() { $('#featured-client').cycle(3); return false; });
    $('#pn-five a').click(function() { $('#featured-client').cycle(4); return false; });
    $('#pn-six a').click(function() { $('#featured-client').cycle(5); return false; });
    $('#pn-seven a').click(function() { $('#featured-client').cycle(6); return false; });
    $('#pn-eight a').click(function() { $('#featured-client').cycle(7); return false; });
    $('#pn-nine a').click(function() { $('#featured-client').cycle(8); return false; });
    $('#pn-ten a').click(function() { $('#featured-client').cycle(9); return false; });


    $('#pn-a a').click(function() { $('#featured-client').cycle(0); return false; });
    $('#pn-b a').click(function() { $('#featured-client').cycle(1); return false; });
    $('#pn-c a').click(function() { $('#featured-client').cycle(2); return false; });
    $('#pn-d a').click(function() { $('#featured-client').cycle(3); return false; });
    $('#pn-e a').click(function() { $('#featured-client').cycle(4); return false; });
    $('#pn-f a').click(function() { $('#featured-client').cycle(5); return false; });
    $('#pn-g a').click(function() { $('#featured-client').cycle(6); return false; });
    $('#pn-h a').click(function() { $('#featured-client').cycle(7); return false; });
    $('#pn-i a').click(function() { $('#featured-client').cycle(8); return false; });
    $('#pn-j a').click(function() { $('#featured-client').cycle(9); return false; });

    $('#li-1 a').click(function() { $('#featured-client').cycle(0); return false; });
    $('#li-2 a').click(function() { $('#featured-client').cycle(1); return false; });
    $('#li-3 a').click(function() { $('#featured-client').cycle(2); return false; });
    $('#li-4 a').click(function() { $('#featured-client').cycle(3); return false; });

});



/*-----------------------------------------------------------------------
Tabbing System
------------------------------------------------------------------------*/

$(function() {

    $(".tab li a").click(function() {

        $(".tab li a.active").removeClass("active");
        $(this).addClass("active");

        $("#content-wrapper div").hide();

        var content_show = $(this).attr("rel");
        $("#" + content_show).show();

        return false;

    });

});

/*-----------------------------------------------------------------------
External Website
------------------------------------------------------------------------*/

$(function() {
    $('a.external').click(function() {
        window.open(this.href);
        return false;
    });
});

/*-----------------------------------------------------------------
Spam Protection
------------------------------------------------------------------*/

jQuery.fn.nospam = function(settings) {
    settings = jQuery.extend({
        replaceText: false, 	// optional, accepts true or false
        filterLevel: 'normal' 	// optional, accepts 'low' or 'normal'
    }, settings);

    return this.each(function() {
        e = null;
        if (settings.filterLevel == 'low') { // Can be a switch() if more levels added
            if ($(this).is('a[rel]')) {
                e = $(this).attr('rel').replace('/', '@').replace('/', '.');
            } else {
                e = $(this).text().replace('/', '@').replace('/', '.');
            }
        } else { // 'normal'
            if ($(this).is('a[rel]')) {
                e = $(this).attr('rel').split('').reverse().join('').replace('/', '@').replace('/', '.');
            } else {
                e = $(this).text().split('').reverse().join('').replace('/', '@').replace('/', '.');
            }
        }
        if (e) {
            if ($(this).is('a[rel]')) {
                $(this).attr('href', 'mailto:' + e);
                if (settings.replaceText) {
                    $(this).text(e);
                }
            } else {
                $(this).text(e);
            }
        }
    });
};

$(function() { $('a.email').nospam(); });

