/**
* common logic that is fired when buybutton is clicked
*/
function btnBuy_Click(inobjTextBox, inArticleId) {
    var aQty = inobjTextBox.value;
    if (isNaN(aQty)) {
        aQty = 1;
        inobjTextBox.value = 1;
    }
    top.hidden.location = '/shop/cart/cartAction.aspx?action=additems&articleid=' + inArticleId + '&qty=' + aQty;
} // btnBuy_Click
/**
*
*/
function addToPackage(inArticleId, inArticleNumber) {
    var iMyWidth = (window.screen.width / 2) - (122 + 10);
    var iMyHeight = (window.screen.height / 2) - (27 + 50);
    var win2 = window.open("/shop/package/addarticle.aspx?articleid=" + inArticleId + "&articlenumber=" + inArticleNumber, "Hjälp", "status,height=390,width=300,resizable=no,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=no");
    win2.focus();
} // addToPackage
/**
*
*/
function addToStandardlist(inArticleId) {
    var iMyWidth = (window.screen.width / 2) - (122 + 10);
    var iMyHeight = (window.screen.height / 2) - (27 + 50);
    var win2 = window.open("/shop/standardlist/addarticle.aspx?articleid=" + inArticleId, "Hjälp", "status,height=390,width=300,resizable=no,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=no");
    win2.focus();
} // addToStandardlist

var mobjLastQty = null;
/**
*
*/
function Qty_Focus(inobjElement) {
    inobjElement.select();
    //alert(1)
    mobjLastQty = inobjElement.value;
} // Qty_Focus
/**
*
*/
function Qty_Blur(inobjElement) {
    if (isNaN(inobjElement.value))
        inobjElement.value = mobjLastQty;
} // Qty_Blur
// ============================================================================
// manages comparance of products
// ============================================================================
var mstrArticleId = new Array();
/**
*
*/
function chbCmp_Click(inobjChb, instrValue) {
    if (inobjChb.checked) {
        mstrArticleId[mstrArticleId.length] = instrValue;
        return;
    }
    mstrArticleId = pop(instrValue, mstrArticleId);
}
/**
*
*/
function evalCompare() {
    if (mstrArticleId.length == 0) return;
    var strArtIds = "ArticleId=" + mstrArticleId.toString().replace(/,/g, "&ArticleId=");
    var strReturnAddress = encodeURIComponent(this.location.pathname + this.location.search);
    window.location.href = "/shop/prodcompare.aspx?" + strArtIds + "&ref=" + strReturnAddress;
}
/**
* opens a window that displays the qty in stock among all vendors
*/
function openWindow(inURI) {
    var iMyWidth = (window.screen.width / 2) - 132;
    var iMyHeight = (window.screen.height / 2) - 77;
    var win2 = window.open(inURI, "Lagersaldo",
                           "status,height=400,width=500,resizable=no,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=no");
    win2.focus();
} // openWindow
