// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
$(document).ready(function() {

    $("a.safemail").each(function(){
        $(this).attr('href', 'mailto:' + $(this).attr('href').replace(/ at /,"@").replace(/ dot /g,"."));
    });

    $('a[rel=product_images]').colorbox();

    $('.trigger-mail').colorbox({
        inline: true,
        href: '#prompt-mail'
    });
    
    $('.trigger-enquire').click(function(){
        $("#enquiry_product_id").val("Enquiry for " + $(this).attr("title"));
        $("#enquiry_product_name").html("Product: " + $(this).attr("title"));
    }).colorbox({
        inline: true,
        href: '#prompt-enquire'
    });

    $('.trigger-map').colorbox({
        inline: true,
        href: '#prompt-map'
    });

    //    var enquireTrigger = $(".trigger-enquiry").click(function(){
    //        $("#enquiry_product_id").val("Enquiry for " + $(this).attr("title"));
    //        $("#enquiry_product_name").html("Product " + $(this).attr("title"));
    //    }).overlay({
    //        expose: {
    //            color: '#333',
    //            loadSpeed: 200,
    //            opacity: 0.9
    //        },
    //        closeOnClick: false
    //    /*onBeforeLoad: function() {
    //            alert($(this).attr("id"));
    //        }*/
    //
    //    });


    $(document).ready(function() {
        $('#banner ul').cycle({
            });
    });

//Live validation
//$(document).ready(function() {
//    var m_email = new LiveValidation('mailing_list_email');
//    m_email.add(Validate.Email );
//
//    var m_name = new LiveValidation('mailing_list_name');
//    m_name.add( Validate.Length, {
//        minimum: 2
//    } );
});

