﻿
function instantStockPopup(select, itemCode, publicationCode) {
    var selectedSize = select.value;
    
    var json = '{ "itemCode":"' + itemCode + '", "publicationCode":"' + publicationCode + '", "sizeCode":"' + selectedSize + '", "quantity":1}';

    $.ajax({
        type: "POST",
        data: json,
        url: "/Services/ItemService.svc/GetSizeAvailability",
        contentType: "application/json",
        dataType: "json",
        success: function(msg) {
            for (var i = 0; i < msg.GetSizeAvailabilityResult.length; i++) {
                if (msg.GetSizeAvailabilityResult[i].DisplayOptions.HighLight == true) {
                    for (var j = 0; j < select.options.length; j++)
                        if (select.options[j].value == msg.GetSizeAvailabilityResult[i].SizeCode)
                        $(select.options[j]).css({ 'background-color': 'Red' });
                }
            }
        }
    });
}


//Show the full size version of the thumbnail of the Linked Item
function viewLinkedItemImage(imagename, book, page, shot, item, ImageHeight, ImageWidth, countryCode, langCode) {
	window.open('/' + countryCode + '/' + langCode + '/ViewItemImage.aspx?b=' + book + '&p=' + page + '&i=' + item + '&s=' + shot + '&imagename=' + imagename, 'itemview', 'height=' + String(parseInt(ImageHeight) + 20) + ',width=' + ImageWidth + ', top=10, left=10, scrollbars=no');
}

function ViewItemImage(book, page, item, shot, ImageHeight, ImageWidth, countryCode, langCode) {
	window.open('/' + countryCode + '/' + langCode + '/viewItemImage.aspx?b=' + book + '&p=' + page + '&i=' + item + '&s=' + shot + '&imagename=&country=' + countryCode + '&lang=' + langCode, 'itemview', 'height=' + String(parseInt(ImageHeight) + 20) + ',width=' + ImageWidth + ', top=10, left=10, scrollbars=no');
}
