﻿// Java functions

//Strech box height

function StrechProducts(){
    var oSpan = document.getElementsByTagName("span");
    var maxHeight = 0;
    for(var i = 0; i < oSpan.length; i++){
        if (oSpan[i].className == "Product" || oSpan[i].className == "OnDiscount"){
            if (oSpan[i].clientHeight - 10 > maxHeight){
                maxHeight = oSpan[i].clientHeight - 10
            }
        }
    }
    for(var i = 0; i < oSpan.length; i++){
        if (oSpan[i].className == "Product" || oSpan[i].className == "OnDiscount") {
            oSpan[i].style.height = maxHeight + "px";
        }
    }
}

// Show big product image

function ShowImage(img){
    document.getElementById("imgBig").src = img.replace("tn_", "");
    document.getElementById("divBig").style.display = "block";
    
    var selectedPosX = 0;
    var selectedPosY = 0;

    selectedPosX += document.getElementById("divBig").offsetLeft;
    selectedPosY += document.getElementById("divBig").offsetTop;
    document.getElementById("divBig") == document.getElementById("divBig").offsetParent;           		      
    window.scrollTo(selectedPosX,selectedPosY);
}

//Hide big image

function HideImage(){
    document.getElementById("divBig").style.display = "none";
}

//Confirm record delete

function DeleteRecord(){
	return confirm("Ovom akcijom trajno brisete zapis!\nOK za nastavak.\nCancel za ponistavanje akcije.");
}



