﻿$(document).ready(function() {
    //$('.poweredBySitefinityLogo').remove();

    $('#header-bottom-nav li.horiz').mouseover(function() {
        $(this).find('ul.vert').show();
    });

    $('#header-bottom-nav li.horiz').mouseleave(function() {
        $(this).find('ul.vert').hide();
    });

    $('.slide-show .slides').cycle({
        containerResize: 0,
        fx: 'fade',
        timeout: 5000,
        pause: 1,
        before: function(currSlideElement, nextSlideElement, options, forwardFlag) {
            var captionElement = $(currSlideElement).parents('.slide-show').find('.caption');
            var imgElement = null;

            if (nextSlideElement.tagName.toLowerCase() == 'img')
                imgElement = $(nextSlideElement);
            else
                imgElement = $(nextSlideElement).find('img');

            captionElement.html(imgElement.attr('alt'));
        }
    });

    $('.accordion').accordion({
        event: 'click',
        autoHeight: false,
        header: '.accordion-header'
    });

    // Jumping accordion fix
    /*$('.accordion').each(function() {
        $(this).css('height', $(this).height() + 'px');
    });*/

    $('a.pretty-photo').prettyPhoto({ theme: 'light_rounded' });

    $('input.hint-text').focus(function() {
        if ($(this).val() == $(this).attr('title'))
            $(this).val('');
    });

    $('input.hint-text').blur(function() {
        if ($(this).val() == '')
            $(this).val($(this).attr('title'));
    });
});

function validateNotHint(sender, args) {
    var validator = document.getElementById(sender.id);
    var control = document.getElementById(validator.controltovalidate);

    if (args.Value == $(control).attr('title'))
        args.IsValid = false;
    else
        args.IsValid = true;
}
