//* This replaces spaces with underscores for directory anmimg purposes
//* Pass the String to replace and a hidden form value to pass the new value to
	function replaceSpaces(tmpVar, newVar){
		var tmpString = tmpVar.value
		
		if (tmpString == " " || tmpString == ""){
			alert("You must enter a Category Name.")
			tmpVar.focus()
			return false
		}else{
			var tmpString = tmpVar.value
			var strArray = tmpString.split(" ")
			var newString = strArray.join("_")
			newVar.value = newString
			return true
		}
	return false
	}
	
//* Determines if which checkboxes are checked and gets their value
//* Just do an onClick return checkSelected()
	function checkSelected(){
	
		var form = document.forms[0]
		var checkBoxSelected = false
		
		for (var i = 0; i < form.elements.length -3; i++){
			if (form.elements[i].type = "checkbox"){
				if (form.elements[i].checked){
					checkBoxSelected = true
					return true
				}
			}
		}
		if (checkBoxSelected == false){
			alert("You have to make at least one selection")
			return false	
		} 	
	}

//* Jumps to a URL from a ListBox
	function jumpTo(URLToken,cat_ID){
	alert(cat_ID)
	alert(URLToken)
		if (cat_ID != 0){
			location.href="default.cfm?cat_ID=" + cat_ID + "&" + URLToken
		} else {
			alert("You must make a Selection.")
			orderProducts.selCategory.focus()
		}
		
	}

//* Open Window
	function OpenWindow (URL, WinName, URLToken, tableName, field1, field2, field3) {
		queryWin = window.open(URL, WinName, 'width=450,height=300, left=0,top=0,screenX=0,screenY=0,outerwidth=500,outerheight=230,resizable,status,toolbar=no,scrollbars');
		queryWin.location.href="queryList.cfm?" + URLToken + "&tableName=" + tableName + "&field1=" + field1 + "&field2=" + field2 + "&field3=" + field3;
	}
	

//* This confirms the refund before submiting to QuickCommerce
	function confirmRefund(URLToken, trans_ID, refund_Amount){			
		if(confirm("Are you sure you want to refund $" + refund_Amount + "?\n\nThis process is IRREVERSIBLE.")){
			return true
		} else {
			alert("Operation Canceled.")
			return false
		}
	}