﻿//function addSimpleToCart(name, productId, variationId, qnt) {
//    qnt = $("#" + qnt).val();
//    if (isNaN(qnt) || Number(qnt) < 1) {
//        alert("Please select at least 1 quantity to add to cart.");
//        return false;
//    }
//    addToCart(productId, variationId, name, Number(qnt));
//    return false;
//};

//function addToCart(productId, variationId, name, quantity) {
//    OrderWebService.AddItemToBasket(productId, variationId, quantity, function(res) {
//        //updateItemsInBasket(res);  //methods of top_basket.ascx
//        //window.location = "/checkout/basket.aspx";
//    }, function(error) {
//        alert("Error when adding your product to basket: " + error.get_message());
//    });
//};

var dropDownIdCurrent = null;
var dropDownSpeed = "fast";
var imageCrossFadeSpeed = "normal";

function dropDownSelect(name, url, dropDownId) {
    $("#dropDownSelected_" + dropDownId).get(0).innerHTML = name;
    eval(dropDownId + " = url");
    dropDownClose(dropDownId);
}

function dropDownToggle(dropDownId) {
    if (dropDownId == dropDownIdCurrent) {
        dropDownClose(dropDownId);
        return;
    }
    if ((dropDownIdCurrent != null)) {
        dropDownClose(dropDownIdCurrent);
    }
    dropDownOpen(dropDownId);
}

function dropDownOpen(dropDownId) {
    $("#dropDown_" + dropDownId).slideDown(dropDownSpeed);
    dropDownIdCurrent = dropDownId;
}

function dropDownClose(dropDownId) {
    $("#dropDown_" + dropDownId).slideUp(dropDownSpeed);
    dropDownIdCurrent = null;
}

function dropDownNavigate(dropDownId) {
    window.location = eval(dropDownId);
}

function imageLoad() {
    $(this).fadeIn(imageCrossFadeSpeed);
    $(this).unbind("load", imageLoad);
}

function swapImage(placeHolder, imageUrl) {
    if ($("#" + placeHolder)[0].src != imageUrl) {
        $("#" + placeHolder).fadeOut(imageCrossFadeSpeed, function() {
            $(this).load(imageLoad);
            this.src = imageUrl;
        });
    }
};

function modalPopupOpen(popupId) {
    $("#" + popupId).show();
}

function modalPopupClose(popupId) {
    $("#" + popupId).hide();
}

function celebPress(img, title, date) {
		
}
