function copyBillingToDelivery() {
	var forma = document.forms.viewCartForm;
	if(forma.sameAddress.checked) {
		forma.shipping_name.value = forma.customer_name.value;
		forma.shipping_company.value = forma.customer_company.value;
		forma.shipping_street_address.value = forma.customer_street_address.value;
		forma.shipping_zip.value = forma.customer_zip.value;
		forma.shipping_city.value = forma.customer_city.value;
		forma.shipping_country_id.value = forma.customer_country_id.value;
	}
	else {
	}

}


function sendComment(ID)
{
	var ime = $('comm_ime').value;
	var email = $('comm_email').value;
	var komentar = $('komentar').value;
	
	goAddComment('/comment_article.php?product_id=' + ID + '&ime=' + ime + '&email=' + email + '&komentar=' + komentar, 'GET');
}


function scoreArticle(articleID, score)
{	
	goScoreArticle('/score_article.php?product_id=' + articleID + '&score=' + score, 'GET');
}

function goAddComment(where, method)
{
	new Ajax.Request(where, {
		method: method,
        parameters: '',
        onSuccess: function(req) {
        	var json = req.responseText.evalJSON();
        	
        	if (json.result)
				{
					Effect.Fade('send_comment');		
				}
				else
				{
					
				}
        },
        onFailure: function(req) {
            
        },
        onLoading : function(req) {
            Effect.Appear('loading');
        }
        ,
        onComplete : function(req) {
           Effect.Fade('loading');
        }
    });
}

function goScoreArticle(where, method)
{
	new Ajax.Request(where, {
		method: method,
        parameters: '',
        onSuccess: function(req) {
        	var json = req.responseText.evalJSON();
        },
        onFailure: function(req) {
            
        },
        onLoading : function(req) {
            Effect.Appear('loading');
        }
        ,
        onComplete : function(req) {
           Effect.Fade('loading');
        }
    });
}