 function trim(str) {
     	str = str.replace(/^\s*/, '').replace(/\s*$/, '');
     	return str; 
 }
 function viewItemDetail(contextPath, itemId) {
 		document.body.style.cursor='wait';
		document.forms[0].action = contextPath + "/itemDetailInfo.do";
		document.getElementById("item").value = itemId;
		document.forms[0].submit();
}

function goToBagaMcMeal(contextPath){
	
	document.forms[0].action= contextPath + "/bagMeal.do";
	document.forms[0].submit();
}

function goToNutritionExchange(contextPath){
	document.body.style.cursor='wait';
	document.forms[0].action= contextPath + "/nutritionexchange.do";
	document.forms[0].submit();
}

function downloadNutritrion(contextPath){
	document.body.style.cursor='wait';
	window.open(contextPath + "/nutritionfacts.pdf");
	document.body.style.cursor='default';
}

function reload(){
	var e=document.forms[0].refreshed;
	if(e.value=="no")e.value="yes";
	else{e.value="no";location.reload();}
}

function gotoDetailPage(indexId) {
	ctrl = document.getElementsByName("itemIdSelected")[indexId]
	document.getElementsByName("item")[indexId].value = ctrl.options[ctrl.selectedIndex].value
	document.forms[indexId].submit()
}

function gotoChooseCustomize(contextPath) {
		document.forms[0].action = contextPath + "/chooseCustomize.do"
		document.forms[0].submit()
}

function gotoBagaMcMealResults(contextPath){
	document.body.style.cursor='wait';
	document.getElementById('eventFlag').value = 'moreDetailPage';
	document.forms[0].action= contextPath + "/nutritionInfo.do";	
	document.forms[0].submit();
}