function goToCart(productId, cartLocation){
//function goToCart(productId, cartLocation, productDetail){
	setProductToAdd('', '');
	if(productId!=null){
		var el = document.getElementById('p_' + productId);
    	if ((el.value == null) || (el.value==''))
        	return;
	    else
    		setProductToAdd(productId, el.value);
	}
	
	if (cartLocation!=window.location)
		setBackUrl(window.location);    	
	//clickToGo(cartLocation, productDetail);
	clickToGo(cartLocation);
}

function clickToGo(cartLocation){     
//function clickToGo(cartLocation, productDetail){     
//    var cartLocationUrl = document.getElementById("bodySubview:hiddenForm:cartLocationUrl");
//    cartLocationUrl.value = cartLocation
//    var productDetailUrl = document.getElementById("bodySubview:hiddenForm:productDetailUrl");
//    productDetailUrl.value = productDetail
    var button = document.getElementById("bodySubview:hiddenForm:goToCartButton");
    clickOnThis(button);
}


function setBackUrl(currentUrl){     
    var hdnBackUrl = document.getElementById("bodySubview:hiddenForm:backUrl");
    hdnBackUrl.value = currentUrl;
}

function setProductToAdd(productId, qty){     
    var productToAdd = document.getElementById("bodySubview:hiddenForm:productToAdd");
    productToAdd.value = productId;

    var productToAddQty = document.getElementById("bodySubview:hiddenForm:productToAddQty");
    productToAddQty.value = qty;
}


function selectAll(el){
    if ((el.value == null) || (el.value==''))
        return;
    else{      
        el.focus();
        el.select();
    }

}