﻿function pageLoad() {
    null;
}
function GetBasketCount() {
    Basket.GetBasketCount(OnBasketCountComplete, OnError);
}
function OnBasketCountComplete(result) {
    $get("lblCount").innerHTML = result;
}

function add2basket(prod_ID, prod_bez, prod_stufe, prod_preis, term_ID,term_start) {
    Basket.AddProduct(prod_ID, prod_bez, prod_stufe, prod_preis,term_ID, term_start, OnAddProductComplete, OnError);
}
function OnAddProductComplete(result) {
    showpopup(result); 
    $get("ctl00_einkaufswagen").className = "shop";
// alert('prodid ' + result + ' zum warenkorb addiert');   
//    iHoehe = (screen.height - 200) / 2;
//    iBreite = (screen.width - 300) / 2;
//    oWin1 = window.open("/shop/add2basket.aspx?prodid=" + result, "Basket", "dependent=yes, width=300, height=200, left=" + iBreite + ", top=" + iHoehe)
//    oWin1.focus();
}
function OnError(result) {
    alert(result.get_message());
}

function showpopup(sResult) {
    $get("shoppopup").style.left = (document.body.clientWidth / 2 - 170) + 'px';
    $get("shoppopup").style.top = (document.body.clientHeight / 2 - 300) + 'px';
    $get("shoppopup").style.visibility = "";
    $get("shopmessage").innerHTML = sResult;
    // window.setTimeout("hidepopup()", 3000);
}
function hidepopup() {
    $get("shoppopup").style.visibility = "hidden";
}


