﻿$(function () {


    if ($.browser.msie && $.browser.version == 8) {
        $("#technicalcallouts").css({ 'top': '0px' });
    }
    if ($.browser.msie && $.browser.version == 7) {
        $('#divsearchtxt').css({ 'top': '-5px', 'left': '20px' });
        $('#divsearchbackground h3').css({ 'top': '-18px', 'left': '20px' });
        $('#divstartdate').css({ 'top': '-33px', 'left': '20px' });
        $('#divenddate').css({ 'top': '-60px', 'left': '145px' });
        $('#divsearchbutton').css({ 'top': '-88px', 'left': '260px' });
        $('#technicalcallouts').css({ 'top': '0px', 'left': '0px' });
        $('#divbusines_pro').css({ 'top': '-25px', 'left': '23px' });
        $('#divjob_seeker').css({ 'top': '-25px', 'left': '23px' });
        $('#divgov_employee').css({ 'top': '-25px', 'left': '23px' });
        $('#divsearchsubtitle').css({ 'top': '-20px', 'left': '0px' });
        $('#divcurrentspecials').css({ 'top': '560px', 'left': '35px' });
    }


    $('#divsearchbutton input').hover(
    function () {
        $(this).attr({ 'src': '/_layouts/images/DirectionsTraining.Images/home/search_button_ro.png' });
    },
    function () {
        $(this).attr({ 'src': '/_layouts/images/DirectionsTraining.Images/home/search_button.png' });
    });

    $('#slider1').aviaSlider({
        animationSpeed: 600,
        betweenBlockDelay: 10000
    });

    $('#imgcurrentspecials').hover(function () {
        $(this).attr({ 'src': '/_layouts/images/DirectionsTraining.Images/home/currentspecials_rollover.png' });
    }, function () {
        $(this).attr({ 'src': '/_layouts/images/DirectionsTraining.Images/home/currentspecials.png' });
    });
    $('#divsearchtxt input').val('Enter Keyword or Course Number').change(function () { if (this.value == "") { this.value = "Enter Keyword or Course Number"; } }).focus(function () { if (this.value == 'Enter Keyword or Course Number') { this.value = ''; } });

    $('#divsearchbutton').click(function () {
        $('#diverrormsg').css({ 'display': 'none' }).html('');
        var date1 = $('#divstartdate input').val();
        var date2 = $('#divenddate input').val();
        var searchtext = $('#divsearchtxt input').val();
        var isvalid = true;
        var msg = '';
        if (!Date.parse(date1) || !Date.parse(date2)) {
            msg += 'There must be 2 valid dates. ex (00/00/0000)<br />';
            isvalid = false;
        }
        if (searchtext.indexOf('Enter Keyword') != -1) {
            msg += 'There must be a search term.';
            isvalid = false;
        }
        if (!isvalid) {
            $('#diverrormsg').css({ 'display': 'inline' }).html(msg);
            return false;
        }

        return true;
    });
});




