function addbasket(me){

	var productid = me.productid.value;
	var quantity = me.quantity.value;
	var price = me.price.value;
	var size = me.size.value;

	if(size==''){alert('Vælg venligst en størrelse.'); return false;}
	
	var ajaxurl =  '/basket/add.asp'
	    ajaxurl += '?productid='+productid
	    ajaxurl += '&quantity='+quantity
	    ajaxurl += '&price='+price
	    ajaxurl += '&size='+size
	
	$.get(ajaxurl, function(){
				
		document.location = document.location;
		
	});
	
	alert('Produktet er lagt i indkøbskurven.')
	
}

function updatequantity(arrayindex,me){
	
	var quantity = me.value

	if(isNaN(quantity)){
		
		alert("Quantity is not a number"); me.value = 1;
		
	}else{
		
		if (quantity > 0){ 
				
			$.get('/basket/update.asp?index='+arrayindex+'&quantity='+quantity, function(){
		
				document.location = document.location;
				
			});
				
		}else{
			
			$.get('/basket/update.asp?index='+arrayindex+'&quantity=0', function(){
			
				document.location = document.location;
				
			});
			
		}
		
	}

}

function removebasketline(arrayindex){
		
	$.get('/basket/update.asp?index='+arrayindex+'&quantity=0', function(){
		
		document.location = document.location;
				
	});

}

function setshopreturnurl(){
	
	var objCookieMdl = new CookieModule();
	var url = document.location;
	
	objCookieMdl.setValueByCookieAndKeyAndValue('User','ShopReturnUrl',url );
	
}

function getshopreturnurl(){
	
	var objCookieMdl = new CookieModule();
	
	return objCookieMdl.getValueByCookieAndKey('User','ShopReturnUrl');
	
}
