﻿
        /* $('#slides').slides({
	            preload: true,
	            preloadImage: '../images/slides/loading.gif',
	            play: 15000,
	            pause: 2500,
	            bigTarget: true,
	            hoverPause: true
	        });*/


$(document).ready(function () {

    $("#videolink").fancybox({
        'padding': 20,
        'titleShow': false,
        'hideOnContentClick': false,
        'scrolling': false,
        'width': 420, 'height': 380,

        'transitionOut': 'none'
    });

    $('.homelogoimage').click(function (event) {
        //window.location = "default.aspx";
    });
    $('#groweraboutlink').click(function (event) {
        window.location = "../Portal_Growers/default.aspx";
    });
    $('#buyeraboutlink').click(function (event) {
        window.location = "../Portal_Buyers/default.aspx";
    });

    $('#col1').fancybox({
        'padding': 20,
        'titleShow': false,
        'hideOnContentClick': true,
        'scrolling': false,
        'href': 'PageContent/homePopup1.html',
        'width': 420, 'height': 380,
        'type': 'iframe',
        'transitionOut': 'none'
    });
    $('#col2').fancybox({
        'padding': 20,
        'titleShow': false,
        'hideOnContentClick': true,
        'scrolling': false,
        'href': 'PageContent/homePopup2.html',
        'width': 420, 'height': 380,
        'type': 'iframe',
        'transitionOut': 'none'
    });
    $('#col3').fancybox({
        'padding': 20,
        'titleShow': false,
        'hideOnContentClick': true,
        'scrolling': false,
        'href': 'PageContent/homePopup3.html',
        'width': 420, 'height': 380,
        'type': 'iframe',
        'transitionOut': 'none'
    });
    $('#col4').fancybox({
        'padding': 20,
        'titleShow': false,
        'hideOnContentClick': true,
        'scrolling': false,
        'href': 'PageContent/homePopup4.html',
        'width': 420, 'height': 380,
        'type': 'iframe',
        'transitionOut': 'none'
    });
    $('#col5').fancybox({
        'padding': 20,
        'titleShow': false,
        'hideOnContentClick': true,
        'scrolling': false,
        'href': 'PageContent/homePopup5.html',
        'width': 420, 'height': 380,
        'type': 'iframe',
        'transitionOut': 'none'
    });
    /*
    $('#featured_slider .column').click(function (event) {
   // $('#featured_slider .column').fancybox({
    'padding': 20,
    'titleShow': false,
    'hideOnContentClick': false,
    'scrolling': false,
    'width': 420, 'height': 380,

    'transitionOut': 'none'
    });

    $(this).attr('name');//col1, col2

    */
    


    $("input#name").val("");
    $("input#email").val("");
    $("input#phone").val("");

    ///setup register form
    $('.error').hide();
    $('input.text-input').css({ backgroundColor: "#FFFFFF" });
    $('input.text-input').focus(function () {
        $(this).css({ backgroundColor: "yellow" });
    });
    $('input.text-input').blur(function () {
        $(this).css({ backgroundColor: "#FFFFFF" });
    });
    $('#registerBtn').click(function (event) {
        event.preventDefault();
        // validate and process form
        // first hide any error messages
        $('.error').hide();

        var name = $("input#name").val();
        if (name == "") {
            $("label#name_error").show();
            $("input#name").focus();
            return false;
        }
        var email = $("input#email").val();
        if (email == "") {
            $("label#email_error").show();
            $("input#email").focus();
            return false;
        }
        var phone = $("input#phone").val();
        if (phone == "") {
            $("label#phone_error").show();
            $("input#phone").focus();
            return false;
        }
        var company = $("input#company").val();
        if (company == "") {
            $("label#company_error").show();
            $("input#company").focus();
            return false;
        }
        var buyerapplication = 'false';
        if ($("#checkboxBuyer").attr('checked')) {
            buyerapplication = 'true';
        }

        var growerapplication = 'false';
        if ($("#checkboxGrower").attr('checked')) {
            growerapplication = 'true';
        }
        var dataString = 'name=' + name + '&email=' + email + '&phone=' + phone + '&company=' + company + '&buyerapplication=' + buyerapplication + '&growerapplication=' + growerapplication;
        $('#registerBtn').hide();
        $('.formprogess').html('<img border="0" src="../images/ajax-loader.gif" />');
        $.ajax({
            type: "POST",
            url: "BuyerRegister.aspx",
            data: dataString,
            error: function (XMLHttpRequest, textStatus, errorThrown) { $('#registerBtn').show(); $('.formprogess').html(''); alert("Error: " + errorThrown); },
            success: function () {
                $('.formprogess').html('');
                $('#registerformContent').html("<div id='message'></div>");
                $('#message').html("<BR/><br/><br/><span class=\"PageTitle\">Registration Form Submitted!</span><br/><br/>Thank You! We will be in touch soon.</p><br/><br/> <div class=\"buttonGreen\"><a href=\"#\" onclick=\"closeFancyBox();\" >Close</a></div>")
            }
        });
        return false;
    });

    $("#contactFormLink").fancybox({
        'padding': 20,
        'titleShow': false,
        'transitionOut': 'none'
    });


    //$('body').supersleight();
});
