function openShowProduct(lien,w,h,lang, langId, productId) {
 	
	var h2 = (h + 20);
	var wClose = (w - 20);
	newWindow = window.open("/webapp/wcs/stores/servlet/rona/showproduct.jsp?link=" + lien + "&closingWidth=" + wClose + "&width=" + w + "&lang=" + lang + "&langId=" + langId + "&height=" + h + "&productId=" + productId, "newWindow", "toolbar=0,location=0,scrollbars=0,resizable=1,width=" + w + ",height=" + h2 + ",top=20,left=10");
	newWindow.focus();
	newWindow.document.close();
}

function Add2ShopCartAndSubmit(form, msg)
{
	if(form.attrValue2) form.attrValue.value = form.attrValue2.value;	
	if(Add2ShopCart(form, msg)) {		
		form.submit();
	}
}

function Add2ShopCart(form, msg, langId)
{
      if (langId==-1) {
	 form.action='https://shop.rona.ca/rona/servlet/OrderItemAdd'
	 form.URL.value='https://shop.rona.ca/rona/servlet/OrderItemDisplay'
      } else {
         form.action='https://magasinez.rona.ca/rona/servlet/OrderItemAdd'
	 form.URL.value='https://magasinez.rona.ca/rona/servlet/OrderItemDisplay'
      }
	
	if (form.quantity.value == 0){
		alert(msg);
		form.quantity.focus();
		return false;
	}else{
		return true;
	}
}

function ChangeQuantity(qty, msg)
{
	if (qty.value < 1){
		alert(msg);
		qty.focus();
	}
}

function changeProduct(context, menuIds, keywords) {

	var temp = "";
	
	if (menuIds != 'undefined') {
	   temp+= "&menuId=" + menuIds;
	} 
	
	if (keywords != 'undefined' && keywords.length > 0) {
	   temp+= "&keywords=" + keywords;
	}

	var selectedItemId = document.Form.attrValue2.options[document.Form.attrValue2.selectedIndex].id;
	var productId = document.Form.catEntryId.value;
	var langId = document.Form.langId.value;
	
	window.location = context+"?storeId=10001&productId=" + productId + "&langId=" + langId + "&catalogId=10051" + temp + "&selectItemId=" + selectedItemId;
}
