﻿//Add visual styles to input elements

//$(document).ready(function () { $('.butRetrieveDet').append('<span class="hover"></span>').each(function () { var $span = $('> span.hover', this).css('opacity', 0); $(this).hover(function () { $span.stop().fadeTo(500, 1); }, function () { $span.stop().fadeTo(500, 0); }); }); });
//var parent = $('body').attr("class"); var subStr = parent.split(" "); $(parent[0].val() + " .pageContainer").css("min-height", function () { return $('.cQuote1').height() + "px"; });
//$('.pageContainer').css("min-height", function () { var minHeight = $('.header').height() + $('.menuContentFooter').height(); return minHeight; }); $('.pageContainer').css("height", function () { var pageHeight = ($(window).height() - $('body').height()) + $('.header').height() + $('.menuContentFooter').height(); return pageHeight; });

//Keep jQuery functionality on UpdatePanel refresh

function pageLoad(sender, args) {
    if (args.get_isPartialLoad()) {

        //Footer positioning

        $('body').css("min-height", function () { return $('.header').height() + $('.mainBody').height() + $('.extra').height() + 20; });
        $('body').css("height", "auto !important");
        $('body').css("height", function () { return $(document).height(); });
        $('.pageContainer').css("min-height", function () { return $('body').height(); });
        $('.pageContainer').css("height", "auto !important");
        $('.pageContainer').css("height", function () { return $('body').height(); });

        //Animated Recall and Get Quote buttons - Static and Hover

        $('input#btnSubmit,.getQuoteNowButton2').addClass("jqueryEnabled");
        $('input#btnSubmit,.getQuoteNowButton2').hover(function () {
            $(this).stop().animate({
                'opacity': 0.01
            }, 500);
        }, function () {
            $(this).stop().animate({
                'opacity': 1
            }, 500);
        });

        //Animated Recall and Get Quote buttons - Action

        $('input#btnSubmit,.getQuoteNowButton2').click(function () {
            $(this).parent().addClass("recallClicked");
        });

        //Alernative row Background color

        $('.row:odd').addClass("rowOdd");

        //Add-Remove onFocus input class

        $('input[type="text"],.holder select').focusin(function () {
            $(this).addClass("activeControl");
        });
        $('input[type="text"],.holder select').focusout(function () {
            $(this).removeClass("activeControl");
        });

        //Add specific input class on errors

        $('.rowError .holder input[type="text"],.rowError .holder select,.rowError #txtReferenceNumber,.rowError #txtEmailAddress').addClass("highlightError");
        $('.agreeerror ~ input').addClass("highlightError");

        //Special Offers

        var specialOffers = $('.specialOfferComment');
        var SpecialOffersPosition = specialOffers.position();
        specialOffers.css("margin-top", function () {
            return -($(this).height() + 20);
        });
    }
}

$(window).resize(function () {
    //Footer positioning

    $('body').css("min-height", function () { return $('.header').height() + $('.mainBody').height() + $('.extra').height() + 20; });
    $('body').css("height", "auto !important");
    $('body').css("height", function () { return $(window).height(); });
    $('.pageContainer').css("min-height", function () { return $('body').height(); });
    $('.pageContainer').css("height", "auto !important");
    $('.pageContainer').css("height", function () { return $('body').height(); });
});

$(document).ready(function () {

    //Footer positioning

    $('body').css("min-height", function () { return $('.header').height() + $('.mainBody').height() + $('.extra').height() + 20; });
    $('body').css("height", "auto !important");
    $('body').css("height", function () { return $(document).height(); });
    $('.pageContainer').css("min-height", function () { return $('body').height(); });
    $('.pageContainer').css("height", "auto !important");
    $('.pageContainer').css("height", function () { return $('body').height(); });

//    var headerH = $('.header').height() + $('.header').attr("border-top", function () { return $(this).val(); }) + $('.header').attr("border-bottom", function () { return $(this).val(); });
//    var contentH = $('.menuContentFooter').height();
//    //$('body').css("min-height", function () { return headerH + $('.mainBody').height(); });
//    $('body').css("min-height", function () { return headerH + contentH; });
//    $('body').css("height", "auto !important");
//    $('body').css("height", function () { return $(document).height(); });
//    //$('.pageContainer').css("min-height", function () { return headerH + $('.menuContentFooter').height() + $('.extra').height(); });
//    $('.pageContainer').css("min-height", function () { return headerH + contentH; });
//    $('.pageContainer').css("height", "auto !important");
//    $('.pageContainer').css("height", function () { return $(document).height() - headerH; });
//    //    $('.menuContentFooter').css("min-height", function () { return $('.mainBody').height() + $('.extra').height(); });
//    //    $('.menuContentFooter').css("height", "auto !important");
//    //    $('.menuContentFooter').css("height", function () { return $(window).height() - headerH; });

    //Animated Recall and Get Quote buttons - Static and Hover

    $('input#btnSubmit,.getQuoteNowButton2').wrap('<div class="hover"></div>');
    $('input#btnSubmit,.getQuoteNowButton2').addClass("jqueryEnabled");
    $('input#btnSubmit,.getQuoteNowButton2').hover(function () {
        $(this).stop().animate({
            'opacity': 0.01
        }, 500);
    }, function () {
        $(this).stop().animate({
            'opacity': 1
        }, 500);
    });

    //Animated Recall and Get Quote buttons - Action

    $('input#btnSubmit,.getQuoteNowButton2').click(function () {
        $(this).parent().addClass("recallClicked");
    });

    //Alernative row Background color

    $('.row:odd').addClass("rowOdd");

    //Add-Remove onFocus input class

    $('input[type="text"],.holder select').focusin(function () {
        $(this).addClass("activeControl");
    });
    $('input[type="text"],.holder select').focusout(function () {
        $(this).removeClass("activeControl");
    });

    //Add specific input class on errors

    $('.rowError .holder input[type="text"],.rowError .holder select,.rowError #txtReferenceNumber,.rowError #txtEmailAddress').addClass("highlightError");
    $('.agreeerror ~ input').addClass("highlightError");
});
