function TrackOrder(TrackingID)
{	
	var TrackUrl1 = 'http://wwwapps.ups.com/WebTracking/processInputRequest?HTMLVersion=5.0&loc=en_US&Requester=UPSHome&tracknum='
	var TrackURL2 = '&track.x=20&track.y=6'
	//window.open('TrackOrder.htm','','width=300,height=200')
	window.open(TrackUrl1 + TrackingID + TrackURL2,'','width=800,height=500')
}
//===prompt user before deleting records
function fConfirmDeletion() {
	if (!(confirm("This record will be permanently removed from the database. \n\n Are you sure you wish to delete this record?"))) {
		return(false)
	}
}

function fValidate(vThisForm){
    alert("test");
    if (document[vThisForm].user.selectedIndex < 1) 
    {
		alert("Please select a user from the list.")
		document[vThisForm].user.focus()
		return(false)
	}	
}

function fValidate(vThisForm){
	if (vThisForm == "frmSearchCatalog") {
		if (document[vThisForm].partnumber.value == "") {
			if (document[vThisForm].unspsc.value == "") {
				if (document[vThisForm].manufacturer.selectedIndex < 1) {
					if (document[vThisForm].keywords.value == "") {
						alert("Search Catalog: \n\n Please enter a search criteria.")
						document[vThisForm].partnumber.focus()
						return(false)
					}
				}
			}
		}	
	}
	if (vThisForm == "frmAssignCat") {	
		if (document[vThisForm].selectcat.selectedIndex < 1) {
			alert("Please select a category from the list.")
			document[vThisForm].selectcat.focus()
			return(false)
		}
	}
	if (vThisForm == "frmPreferences") {	
		if (document[vThisForm].phone.value == "") {
			alert("The field - Phone - cannot be left blank.")
			document[vThisForm].phone.focus()
			return(false)
		}
		if (document[vThisForm].contact[0].checked != true) 
			{
				if (document[vThisForm].contact[1].checked != true)
				{
				alert("The field - Preferred Contact - cannot be left blank..")
				return(false)
				}
				
			}
		if (document[vThisForm].notification[0].checked != true) 
			{
				if (document[vThisForm].notification[1].checked != true)
				{
				alert("The field - Email Notification - cannot be left blank..")
				return(false)
				}
				
			}
	
	}
	
	if (vThisForm == "frmBuyNow") {	
		if (document[vThisForm].vendor[0].checked != true) 
			{
				if (document[vThisForm].vendor[1].checked != true)
				{
					if (document[vThisForm].vendor[2].checked != true)
					{
					alert("Vendor Information: \n\n Please select a vendor for your purchase.")
					return(false)
					}
				}
			}
	}
	
	if (vThisForm == "frmBuyNowIG") {
		if (document[vThisForm].vendor.checked != true)
		{
		alert("Vendor Information: \n\n Please select a vendor for your purchase.")
		return(false)
		}		
	}
	
	if (vThisForm == "frmFav") {
		alert("add to favorites")	
		if (document[vThisForm].vendor[0].checked != true) 
			{
				if (document[vThisForm].vendor[1].checked != true)
				{
				alert("Vendor Information: \n\n Please select a vendor for your purchase.")
				return(false)
				}
			}
	}
	
	
	if (vThisForm == "frmCompVend") {
		var intLength = document[vThisForm].vendor.length 
		var blnAtleastOneChecked = false; 
		for(var i=0; i<=intLength - 1  ; i++)
		{	
			if(document[vThisForm].vendor[i].checked == true)
			{
				blnAtleastOneChecked = true;			
					
			}		
		}

		if(blnAtleastOneChecked  == false)
			{
				alert("Vendor Information: \n\n Please select a vendor for your purchase.")
				return false;	
			}
			
	}
	
	if (vThisForm == "frmCart") {
	if (document[vThisForm].quantity.value == "") {
			alert("Please enter Quantity.")
			document[vThisForm].quantity.focus()
			return(false)
		}
	}
	
	
	if (vThisForm == "frmQuoteRequest") {
		if (document[vThisForm].manufacturer1.value == "") {
			alert("Part Information: \n\n Please enter Manufacturer.")
			document[vThisForm].manufacturer1.focus()
			return(false)
		}
		if (document[vThisForm].product1.value == "") {
			alert("Part Information: \n\n Please enter Product.")
			document[vThisForm].product1.focus()
			return(false)
		}
		if (document[vThisForm].partnumber1.value == "") {
			alert("Part Information: \n\n Please enter Part Number.")
			document[vThisForm].partnumber1.focus()
			return(false)
		}
		if (document[vThisForm].quantity1.value == "") {
			alert("Part Information: \n\n Please enter Quantity.")
			document[vThisForm].quantity1.focus()
			return(false)
		}
		var thisChar = document[vThisForm].quantity1.value
		if (isNaN(thisChar)) {
			alert("Part Information: \n\n The field -Quantity- must be numeric.")
			document[vThisForm].quantity1.focus()
			return(false)
		}
		if (document[vThisForm].name.value == "") {
			alert("Contact Information: \n\n Please enter your Name.")
			document[vThisForm].name.focus()
			return(false)
		}
		if (document[vThisForm].phone.value == "") {
			alert("Contact Information: \n\n Please enter your phone number.")
			document[vThisForm].phone.focus()
			return(false)
		}
		var vThisEmail = new String(document[vThisForm].email.value)
		if (document[vThisForm].email.value == "" || vThisEmail.search("@") == -1) {
			alert("Contact Information: \n\n The field -email- cannot be left blank and must be properly formatted.")
			return(false)
		}
		
	}

}

function ViewAccessories(ProductID)
{	
	var url1 = 'http://www.inquireit.com/search/productService.do?id='
	var url2 = '&action=options&showProductInfo=flase'
	window.open(url1 + ProductID + url2,'Accessories','width=600,height=400')
}

//===make sure shopping cart is not empty
function fCheckCartQuantities(vItemCount) {
	for (i = 1; i < vItemCount + 1; i++) {
		var vThisField = "quantity" +vItemCount
		var vThisNumber = document.shoppingcart[vThisField].value
		if (isNaN(vThisNumber)) {
			alert("The field -quantity- must be numeric.")
			return (false)
		} else if (!(isNaN(vThisNumber))) {
			if (document.shoppingcart[vThisField].value < 1) {
				alert("The field -quantity- must be a whole number (ie. 1 or greater).")
				return (false)
			} else if (document.shoppingcart[vThisField].value > 1) {
				var vOldNumber = document.shoppingcart[vThisField].value
				var vNewNumber = parseInt(vOldNumber).toString()
				if (vOldNumber.length == vNewNumber.length && vNewNumber != "NaN") {
					return (true)
				} else {
					alert("The field -quantity- must be a whole number (ie. 1 or greater).")
					return (false)
				}
			}
		}
	}
}



