﻿


$(document).ready(function () {
    //       Open and close the compose box for user to create a message:
    $('#btnContactOwners').live('click', function () {
        $('#modal').dialog({
            title: 'Contact Owners ',
            height: 475,
            width: 675,
            modal: true,
            close: CloseDialog,
            open: OpenDialog
        });

        //To bring back the postback to "Close" control in the end.
        $('#modal').parent().appendTo($('form:first'));
    });
});
function OpenDialog() {
    validator.resetForm();
}
function CloseDialog() {
}









//function SetDatePickers() {
//    $("#txtArrival").datepicker({
//        showOn: "button",
//        dateFormat: "d MM yy",
//        buttonImage: "images/Icons/Calender_Blue.png",
//        buttonImageOnly: true
//    });
//    $("#txtDeparture").datepicker({
//        showOn: "button",
//        dateFormat: "d MM yy",
//        buttonImage: "images/Icons/Calender_Blue.png",
//        buttonImageOnly: true
//    });
//}


//function validateMessage() {
//    $('form').validate({
//        rules: {
//            txtEmail: {
//                required: true,
//                email: true
//            },
//            txtArrival: "required",
//            txtDeparture: "required",
//            txtMessage: "required"

//        },
//        messages: {
//            txtEmail: "Please enter a valid email address",
//            txtArrival: "*",
//            txtDeparture: "*",
//            txtMessage: "Please write your message"
//        }

//    });
//}




function transferEffect(itemTotransfer, target) {
    options = { to: $(target), className: "transferItemEffect" };
    $(itemTotransfer).effect('transfer', options, 300)
}



function setStatusIcon() {
    switch (itemStatus) {
        case "NotInList":
            $('.wishListIconItem').attr('src', srcNotInList);
            $('.wishListIconItem').attr('title', titleNotInList);
            break;
        case "Inlist":
            $('.wishListIconItem').attr('src', srcInlist);
            $('.wishListIconItem').attr('title', titleInList);
            break;
        case "AlreadySent":
            $('.wishListIconItem').attr('src', srcAlreadySent);
            $('.wishListIconItem').attr('title', titleAlreadySent);
            break;
        default:

    }
}

function removeFromWishListEffect(btn) {

    options = { to: $(".wishListIconItem"), className: "transferItemEffect" };
    $('.cartIcon').effect('transfer', options, 300);
    var img = $(btn).parent().prev();
    $('#divRemoveFromCart').fadeOut('slow');
    $(img).attr('src', srcNotInList);
    $(img).attr('title', titleNotInList);

    $('#btnAdd').css('display', 'block');
    $('#btnRemove').css('display', 'none');
}
function addToWishListEffect(btn) {
    //Effects
    options = { to: $(".cartIcon"), className: "transferItemEffect" };
//    $(btn).effect('transfer', options, 300);
//    var img = $(btn).parent().prev();
////    $('#divSaveToCart').fadeOut('slow');
//    $(img).attr('src', srcInlist);
//    $(img).attr('title', titleInList);


    $('#btnAdd').css('display', 'none');
    $('#btnRemove').css('display', 'block');
}



//    $('#trigerRemoveDiv').parent().effect('slide', { direction: 'right', mode: 'hide' }, 600, function () {
//        $('#trigerAddDiv').fadeIn('slow');
//    });

//    $(triger).fadeOut('slow');
//    $('#trigerAddDiv').fadeIn('slow');







    //$(triger).hide();
    //$('#xxx').show();

   // var x = $(triger).parent().next();
    //debugger;
//    $('#divShopingCart').fadeIn('fast');

//    //Effects
//    options = { to: $(".cartIcon"), className: "transferItemEffect" };
//    $(btn).effect('transfer', options, 300);
//    var img = $(btn).parent().prev();
//    $('#divSaveToCart').fadeOut('slow');
//    $(img).attr('src', srcInlist);
//    $(img).attr('title', titleInList);


//    $('#btnAdd').css('display', 'none');
//    $('#btnRemove').css('display', 'block');

