function initialize() {
    var myOptions = {
        zoom: 16,
        center: new google.maps.LatLng(53.794895, -1.540769),
        mapTypeId: google.maps.MapTypeId.ROADMAP
    }
    var map = new google.maps.Map(document.getElementById("map_canvas"),
                                  myOptions);

    var image = 'images/ed_marker.png';
    var myLatLng = new google.maps.LatLng(53.794895, -1.540769);
    var beachMarker = new google.maps.Marker({
        position: myLatLng,
        map: map,
        icon: image
    });
}

$(document).ready(function () {
    $(document).keydown(function (e) {
        if (e.keyCode == 37) {
            $('#coda-nav-left-1 a').trigger('click');
            return false;
        }
        if (e.keyCode == 39) {
            $('#coda-nav-right-1 a').trigger('click');
            return false;
        }
    });

    $('#slideshow').cycle({
        fx: 'scrollHorz',
        prev: '.prev',
        next: '.next',
        speed: "medium",
        timeout: 0,
        easing: 'easeInOutCubic'
    });


    $('a[rel*=external]').click(function () {
        window.open(this.href);
        return false;
    });

    

    // contact form

    $('#successMessage').hide();

    $('#contactform textarea, #contactform input[type=text]').each(function () {
        $(this).focus(clearElementVal);
        $(this).blur(resetElementVal);
    });

    $('#contactform').submit(function () {
        $('#contactform textarea, #contactform input[type=text]').removeClass('error').attr('title', '').each(clearElementVal);
        var ajaxOpts = {
            dataType: 'json',
            data: $(this).serialize(),
            success: contactFormResult,
            type: 'POST'
        };
        $.ajax('/ContactForm/Create', ajaxOpts);
        return false;
    });

    //Caption Sliding (Partially Hidden to Visible)
    $(".projectInfo").each(function (index) {
        $("#caption" + (index + 1)).hover(function () {
            $("#cover" + (index + 1), this).stop().animate({
                top: "0px",
                left: "0px"
            }, {
                queue: false,
                duration: 300
            });
        }, function () {
            $("#cover" + (index + 1), this).stop().animate({
                top: "150px"
            }, {
                queue: false,
                duration: 500
            });
        });
    });

    /*$("div.project").click(function () {
    window.location = $(this).find("a").attr("href");
    return false;
    });*/
    $("#title h1").lettering('lines').children("span").lettering();

});

// functions for contact form
function contactFormResult(jqXHR, textStatus) {
    if (jqXHR.success) {

        $('#contactform').fadeOut(1000, function () {
            $('#successMessage').fadeIn(1000);
        });

    }
    else {
        $('#contactform textarea, #contactform input[type=text]').each(resetElementVal);
        var e = '';
        for (error in jqXHR.errors) {
            $('#' + jqXHR.errors[error].Key).addClass('error').attr('title', jqXHR.errors[error].Errors[0].ErrorMessage);
        }
    }
}

function clearElementVal() {
    if ($(this).val() == $(this).data('defaultValue')) {
        $(this).val('');
    }
}

function resetElementVal() {
    if ($(this).val() == '') {
        $(this).val($(this).data('defaultValue'));
    }
}


var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-5146704-1']);
_gaq.push(['_trackPageview']);

(function () {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

var addthis_config = {
    data_ga_property: 'UA-5146704-1',
    data_track_clickback: true
};


















		
