
function toBas(id, count, alertText){
    count = Number(count);
    if (count <= 0) {
        alert('Počet kusů musí být větší než 0');
        return (false);
    }
    if (isNaN(count)){
        alert('Počet kusů musí být číslo');
        return (false);
    }
	var url = "/ajax/toBasket/" + count + "/" + id + '/1/shop_basket';
	return ajax_request(url, "GET", bas, alertText);
}
function toBasket(count,id,cid, alertText) {
	var url = "/ajax/toBasket/" + count + "/" + id + '/' + cid + '/shop_basket';
	return ajax_request(url, "GET", bas, alertText);
}

function bas(odpoved, alertText) {
    if ((alertText != '') && (alertText != undefined)){
        //alert(alertText);
    }
    if ((odpoved != '') && (odpoved != undefined)){
        //alert(odpoved);
    }
    window.location.reload();
    return true;
}

function limit(element,max) {
	if(parseInt(element.value)>parseInt(max)) element.value=parseInt(max);
}

function getSvoz(id) {
	var url = "/ajax/getSvoz/" + id;
	return ajax_request(url, "GET", getSvozProcess);
}

function getSvozProcess(odpoved) {
	document.getElementById('svoz').innerHTML = odpoved;
}



/**
 * set_discount_unique();
 * Author: Josef Traxler
 * Date: 2011-09-30
 * Description:
 *      Nastaveni slev po vlozeni unikatniho kodu pro slevu    
 */ 
function set_discount_unique(){
    var hash = prompt('Zadejte slevový kód:');
    if (hash === null) return false;
    
    window.location.href = '/show_basket/set_discount_unique/'+hash;
}
