function getCheckedValue(radioObj) {
    if(!radioObj)
        return "";
    var radioLength = radioObj.length;
    if(radioLength == undefined)
        if(radioObj.checked)
            return radioObj.value;
        else
            return "";
    for(var i = 0; i < radioLength; i++) {
        if(radioObj[i].checked) {
            return radioObj[i].value;
        }
    }
    return "";   
}


function send_to_backet(menu_id,priceAndVolume,selectedCategory,lang) {
    
    var url = '?id='+menu_id+'&add_product_id='+priceAndVolume+'&cat='+selectedCategory+'&lang='+lang; 
    
    var color = document.forms["for_color"].elements["color"];
    var color_value = getCheckedValue(color);
    if (color_value) {
        url = url + '&color=' + color_value;    
    }

    document.location.href=url;
}

function send_to_backet_url(url,id) {
    
    var url = url + '?add_product_id='+id; 

    var color = document.forms["for_color"].elements["color"];
    var color_value = getCheckedValue(color);
    if (color_value) {
        url = url + '&color=' + color_value;    
    }
    
    document.location.href=url;
}

function MakeRating(rating) {
    
    document.getElementById('current-rating').style.width = rating*25+'px';
    
    document.getElementById('rating').value = rating; 
}

function ChangeHide(h,d) {
    if (document.getElementById(h).style.display == '') {
        a='none';
        b='+';
    } else {
        a='';
        b='-';
    }
    document.getElementById(h).style.display = a;
    document.getElementById(d).innerHTML = b;
}

