﻿function Cover(bottom, top, ignoreSize) {
    var location = Sys.UI.DomElement.getLocation(bottom);
    top.style.position = 'absolute';
    top.style.top = location.y + 'px';
    top.style.left = location.x + 'px';
    if (!ignoreSize) {
        top.style.height = bottom.offsetHeight + 'px';
        top.style.width = bottom.offsetWidth + 'px';
    }
}

function clientSearchSubmit(e) {
    e = (e) ? e : window.event;
    var charCode = (e.which) ? e.which : e.keyCode
    if (charCode == 13) {
        WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$searchAutoCompleteControl1$LinkButtonSearch", "", true, "search_SACC", "", false, true));
    }
}

function clientLoginSubmit(e) {
    if (window.event) { e = window.event };
    if (e.keyCode == 13) {
        WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ContentPlaceHolder1$AccordionPane1_content$Login1$LoginButton", "", true, "Login1", "", false, true));
    }
}

function clientPasswordReminder(e) {
    if (window.event) { e = window.event };
    if (e.keyCode == 13) {
        WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ContentPlaceHolder1$_content$ImageButtonSendPassword", "", true, "PasswordRemind", "", false, true));
    }
}

function showItemPreview(itemId, mode) {
    iprv = document.getElementById("itemPreview");
    if (mode == 1) {
        iprv.style.visibility = "visible";
        iprv.innerHTML = "<div style='padding:10px;background-color:#FFFFFF; border:1px solid #8F8F8F;'><img alt='' src='/fotos/fb_" + itemId + "_1.jpg' />";
    } else {
        iprv.style.visibility = "hidden";
    }
}

function showItemPreviewEmpty(itemId, mode) {
    iprv = document.getElementById("itemPreview");
    if (mode == 1) {
        iprv.style.visibility = "visible";
        iprv.innerHTML = "<div style='padding:10px; background-color:#FFFFFF; border:1px solid #8F8F8F;'><img alt='' src='/img/noImage.png' />";
    } else {
        iprv.style.visibility = "hidden";
    }
}


function postAIG(akcja, kwota) {
    if (akcja == 1) 
    {
        window.open("/aigPost.asp?c=" + kwota, "aigCalcWindow", "location=0,status=0,scrollbars=1,width=800,height=600");
    }
    else if (akcja == 2)
    {
        window.open("/aigPost2.asp", "aigCalcWindow", "location=0,status=0,scrollbars=1,width=800,height=600");
    }
}

function chkVal2(e) {
    e = (e) ? e : window.event;
    var charCode = (e.which) ? e.which : e.keyCode
    if (charCode > 31 && (charCode < 48 || charCode > 57)) {
        return false;
    }
    return true;
}

function prn4product(par) {
    var posleft = 50; //(window.screen.width/2)-200;
    var link_ = par;
    var postop = 50;
    var pars = "height=450,width=750,left=" + posleft + ",top=" + postop + ",toolbar=no,menubar=no,status=no,location=no,directories=no"
    window.open(link_, "import", pars);
}
