function goURL(url) {
	document.location = url;
}

function limitTextArea(obj, maxChars) {
	if(obj.value.length > maxChars)
		obj.value = obj.value.substring(0, maxChars);
}

function viewImage(url) {
	var w = 600;
	var h = 600;
	
	window.open(url, 'imgWin', 'resizable=1,scrollbars=1,toolbar=0,width=' + w + ',height=' + h);
}

function popHelpByID(id) {
	var w = 500;
	var h = 450;
	
	window.open('help.cfm?id=' + id, 'helpWin', 'resizable=1,scrollbars=1,toolbar=0,width=' + w + ',height=' + h);
}

function popHelpByCode(code) {
	var w = 500;
	var h = 450;
	
	window.open('help.cfm?code=' + code, 'helpWin', 'resizable=1,scrollbars=1,toolbar=0,width=' + w + ',height=' + h);
}

function deleteConfirm(itemName,whereTo) {
	if (confirm('Are you sure you want to delete "' + itemName + '"?\n\nClick "OK" to delete or "Cancel" to save it.')){
		document.location.href = whereTo;
	}
}

function CancelConfirm(itemName,whereTo) {
	if (confirm('Are you sure you want to cancel "' + itemName + '"?\n\n')){
		document.location.href = whereTo;
	}
}

function doubleCheckSubmit(message,formName) {
	if (confirm(message)){
		eval('document.' + formName + '.submit()');
	}
}

function popAnyWindow(whereTo) {
	var w = 500;
	var h = 450;
	
	window.open(whereTo, 'newWindow', 'resizable=1,scrollbars=1,toolbar=0,width=' + w + ',height=' + h);
}

function popNewBrowser(whereTo) {
	var w = 500;
	var h = 450;
	
	window.open(whereTo, 'newWindow');
}

function checkFile(item,theForm){
	//checks for spaces in the file name and file extensions (optional) then removes file name if not ok
		
	var fileOK = 1; //default to submit form.  If something fails, it won't be submitted.
	var checkExtension = 1; //if the extensions should be checked along with spaces. 1=yes 0=no		
	var okExtensions = new Array("gif", "GIF", "jpg", "JPG", "jpeg", "JPEG");

	if (item != '') {
		var fileNameArray = item.split("\\");
		var fileName = fileNameArray[fileNameArray.length-1];
		var fileExtensionArray = fileName.split(".");
		var extension = fileExtensionArray[fileExtensionArray.length - 1];
		var extensionOK = 0;
		
		
		if (checkExtension) {
			//find if the extension of the file is in the list of ok Extensions.  run through the list of 
			//acceptable extensions
			for (var i = 0; i < okExtensions.length; i++){
				if (extension == okExtensions[i]){
					extensionOK = 1;
				}
			} 
		} else {
			//if we aren't checking, extension is automatically ok
			extensionOK = 1;
		}
		
		// if the file name has no spaces in it, the fileNameSpaces.length will = 1
		if (fileName.split(' ').length != 1) {
			alert('You should not upload this file because it has spaces in its name.  Please rename the file and try again.'); //It has spaces:' + fileName.split(' ').length 
			fileOK = 0
		} else if (extensionOK == 0) {
			alert('You should enter an image of type .gif or .jpg');
			fileOK = 0
		} 
	}
}
