﻿$(document).ready(function () {

    $('#content-head .logo').mouseover(function () { $(this).css("cursor", "pointer") });
    $('#content-head .logo').click(function () {
        window.location = '/';
        return false;
    });

    $('#slider')
        .cycle({
            fx: 'fade',
            speed: 1000,
            timeout: 10000,
            pager: '#slider_nav'
        });

     $('#slider2')
        .cycle({
            fx: 'fade',
            speed: 1000,
            timeout: 4000,
            pager: '#slider_nav'
        });

     $('#steps')
        .cycle({
            fx: 'scrollLeft',
            speed: 500,
            timeout: 10000,
            pager: '#steps_nav'
        });

    $('#content-head div.nav li').mouseover(function () {
        $(this).removeClass().addClass("alt");
    }).mouseout(function () {
        $(this).removeClass("alt").addClass();
    });

    $('#content-head div.nav li').click(function () {
        window.location = $(this).find("a").attr("href");
        return false;
    });

    $('#clientlist li').mouseover(function () {
        $(this).removeClass().addClass("alt");
    }).mouseout(function () {
        $(this).removeClass("alt").addClass();
    });

    $('#clientlist li').click(function () {
        window.location = $(this).find("a").attr("href");
        return false;
    });

    $('#logos div.ui-logo div').mouseover(function () {
        $(this).removeClass('img').addClass("alt");
    }).mouseout(function () {
        $(this).removeClass("alt").addClass('img');
    });

    $('#logos div.ui-logo div').click(function () {
        window.location = $(this).find("a").attr("href");
        return false;
    });

    $("#ContactForm").validate({
        errorPlacement: function (error, element) {
            error.appendTo(element.siblings("label"));
        },
        errorClass: "field-validation-error",
        errorElement: "span",
        rules: {
            FirstName: "required",
            LastName: "required",
            Email: {
                required: true,
                email: true
            },
            Comments: "required"
        },
        messages: {
            FirstName: "Required",
            LastName: "Required",
            Email: {
                required: "Required",
                email: " Enter valid email"
            },
            Comments: "Required"
        },
        submitHandler: function (form) {
            jQuery(form).ajaxSubmit({
                beforeSubmit: function () { $('#formwrapper').showLoading(); },
                target: "#formwrapper",
                success: function () { $('#formwrapper').hideLoading(); }
            });
        }
    });

});
