﻿/// <reference path="jquery-vsdoc.js" />
//*************************************************************************************
// File     : pavl-functions.js
// Requires : jquery.js (version 1.3.2+)
// Author   : Kyle Weems (ksw)
// Origin   : mindfly.com
// Created  : Dec 28, 2010
// Modified : Jan 17, 2011
//*************************************************************************************

$(document).ready(function() {
    collapsingBox();
    emailLinks();
    ms_setting = {
        source: {
            type: "selector",
            value: ".mindslide",
            destination: ".mindslide"
        },
        random: false,
        slide: {
            duration: 12000,
            transition: 1000,
            effect: "fade",
            direction: "left",
            autoplay: true
        },
        interface: {
            play: false,
            arrows: false,
            markers: false,
            thumbs: false
        }
    }
    mindslide.load(ms_setting);
    mindslideHeight();
    $(function() {
        $('#gallery a').lightBox();
    });
});

function collapsingBox() {
    if ($('.collapsing-box').length > 0) {
        $('.collapsing-box').append('<button type="button">+</button>');
        $('.collapsing-box button, .collapsing-box h3, .open-box .collapsing-box h4').click(function() {
            if ($(this).parent('.collapsing-box').hasClass('open')) {
                $(this).parent('.collapsing-box').removeClass('open');
                $(this).parent('.collapsing-box').children('button').html('+');
            } else {
                $(this).parent('.collapsing-box').addClass('open');
                $(this).parent('.collapsing-box').children('button').html('-');
            }
        });
    }
}

function emailLinks() {
    $('#contact-list strong').click(function() {
        window.location = $(this).siblings('span').children('a').attr('href');
    });
    $('#contact-list .email').mouseenter(function() {
        $(this).parent().siblings('strong').addClass('hover');
    });
    $('#contact-list .email').mouseleave(function() {
        $(this).parent().siblings('strong').removeClass('hover');
    });

}

function mindslideHeight() {
    var mh = 0;
    for (i = 0; i < $('.mindslide li').length; i++) {
        var h = $('.mindslide li:eq(' + i + ')').outerHeight();
        if (h > mh) mh = h;
    }
    $('.mindslide').css({ height: mh + 'px' });
    $('.mindslide li').css({ height: mh + 'px' });
    $('.mindslide').before($('#job-opportunities'));
}
