function isCompletedField( field, alerttxt ) {
	with (field) {
		if (tagName=='SELECT'){
			if (selectedIndex<0) {
				alert(alerttxt);
				return false; 
			}
		}
		else {
			if (value==null||value=="") {
				alert(alerttxt);
				return false;
			}
		}
		return true;
	}
}
function isCompletedTextArea( field, alertTxtEmpty, min, max ) {
var numChars, choppedValue, alertTxtVerbose;

	min = min || 1;
	max = max || 10000;

	with (field) {
		numChars = value.length;
		alertTxtVerbose = alertTxtEmpty;
		if (numChars < min) {
			alertTxtVerbose += '\nThe input box contains ' + numChars + ' characters. The minimum is ' + min + '.';
			alert(alertTxtVerbose);
			return false; }
		else if (numChars > max) {
			choppedValue = value.substr(0, max);
			alertTxtVerbose += '\nThe input box contains ' + numChars + ' characters. The limit is ' + max + '.';
			alertTxtVerbose += '\nThe entry will be shortened.';
			alert(alertTxtVerbose);
			value = choppedValue;
			}
		else {
			return true;
		}
	}
}
function isValidEmail( field, alerttxt ) {
	with (field) {
	  apos=value.indexOf("@");
	  dotpos=value.lastIndexOf(".");
	  if (apos<1||dotpos-apos<2) {
		alert(alerttxt);
		return false;
	  }
	  else {
		return true;
	  }
	}
}
function isRightsizedTextfield( field, alerttxt, maxSize ) {
	with (field) {
	  if (value.length > maxSize) {
		alert(alerttxt);
		return false;
	  }
	  else {
		return true;
	  }
	}
}
function hideDiv( divId ) {
var elem, vis;
	if (document.getElementById) 			// this is the way the standards work
		elem = document.getElementById( divId );
	else if (document.all)					// this is the way old msie versions work
		elem = document.all[divId];
	else if (document.layers) 				// this is the way nn4 works
		elem = document.layers[divId];
	
	vis = elem.style;
	vis.display = 'none';
}
function showDiv( divId ) {
var elem, vis;
	if (document.getElementById)
		elem = document.getElementById( divId );
	else if (document.all)
		elem = document.all[divId];
	else if (document.layers)
		elem = document.layers[divId];
	
	vis = elem.style;
	vis.display = 'block';
}
function showUrlField( website_needs_index, url_field_id ) {
	if (website_needs_index==1) {			// Existing website field
		showDiv(url_field_id);
	}
	else {
		hideDiv(url_field_id);
	}
}
function switchContentFields( content_input_index, input_svcs_id, copywriting_id ) {
	if (content_input_index==1) {			// Inputting services field
		showDiv(input_svcs_id);
		hideDiv(copywriting_id);
	}
	else if (content_input_index==2) {		// Copywriting services field
		hideDiv(input_svcs_id);
		showDiv(copywriting_id);
	}
	else {
		hideDiv(input_svcs_id);
		hideDiv(copywriting_id);
	}
}

