$(document).ready(function() {
    sildeshow();
});

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

function sildeshow() {

    $('#slideshow').cycle({
        fx: 'fade',
        speed: 3000,
        timeout: 2000,
        next: 'img',
        pager: '#nav'
    }); 
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

function CallCurvycorners() {

    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

    var curvyCornersVerbose = true;

    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

    var oSettings1 = {
        tl: { radius: 0 },
        tr: { radius: 0 },
        bl: { radius: 10 },
        br: { radius: 10 },
        antiAlias: true
    }

    curvyCorners(oSettings1, "#content");
    curvyCorners(oSettings1, "#footer");

    // curvyCorners messes up our double borded at the base so we have a wee
    // cleanup and put right what once went wrong
    $("#footer").css('position', 'relative'); // TODO - chain these
    $("#footer").css('top', '-1px'); // TODO - chain these
    $("#footer ul").css('position', 'relative'); // TODO - chain these
    $("#footer ul").css('top', '1px'); // TODO - chain these

    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

    var oSettings3 = {
        tl: { radius: 10 },
        tr: { radius: 0 },
        bl: { radius: 0 },
        br: { radius: 0 },
        antiAlias: true
    }

    curvyCorners(oSettings3, "#larch");

    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

    var oSettings4 = {
        tl: { radius: 0 },
        tr: { radius: 10 },
        bl: { radius: 0 },
        br: { radius: 0 },
        antiAlias: true
    }

    curvyCorners(oSettings4, "#rarch");

    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

    var oSettings5 = {
        tl: { radius: 10 },
        tr: { radius: 10 },
        bl: { radius: 10 },
        br: { radius: 10 },
        antiAlias: true
    }

    if (document.getElementById("#block-b"))
        curvyCorners(oSettings5, "#block-b");

    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

    var oSettings6 = {
        tl: { radius: 10 },
        tr: { radius: 10 },
        bl: { radius: 0 },
        br: { radius: 0 },
        antiAlias: true
    }

    if (document.getElementById("#block-b h2"))
        curvyCorners(oSettings6, "#block-b h2");


    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

    var oSettings7 = {
        tl: { radius: 0 },
        tr: { radius: 0 },
        bl: { radius: 9 },
        br: { radius: 9 },
        antiAlias: true
    }

    if (document.getElementById("#articles"))
        curvyCorners(oSettings7, "#articles");
    if (document.getElementById("#articles dt"))
        curvyCorners(oSettings5, "#articles dt");

    // curvyCorners messes up our double borded at the base so we have a wee
    // cleanup and put right what once went wrong
    $("#articles").css('position', 'relative'); // TODO - chain these
    $("#articles").css('top', '1px'); // TODO - chain these

    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

    var oSettings8 = {
        tl: { radius: 3 },
        tr: { radius: 3 },
        bl: { radius: 3 },
        br: { radius: 3 },
        antiAlias: true
    }

    if ($('.chunky li').length > 0)
        curvyCorners(oSettings8, ".chunky li");
        
        $("#articles .article-heading").corner("8px");
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

$.fn.vAlign = function() {
    return this.each(function(i) {
        var ah = $(this).height();
        var ph = $(this).parent().height();
        var mh = (ph - ah) / 2;
        $(this).css('padding-top', mh);
    });
};

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

