function preload_link_images(){
//alert('onload');
var img_array = new Array(
	'/images/links/about_on.gif',
	'/images/links/contact_on.gif',
	'/images/links/events_on.gif',
	'/images/links/home_on.gif',
	'/images/links/news_on.gif',
	'/images/links/resources_on.gif',
	'/images/themes_on.gif',
	'/images/enhancement_on.gif'

	);

return true;

}

function swap_link_img(id, source){

//		alert ('id=' + id + '\nsrc=' + source);
//		alert ('src1=' + document.images[id].src);

document.images[id].src = source;

//		alert ('src2=' + document.images[id].src);

return true;
}

// =================================================================

function checkform_postings(){

//alert('down=' + document.post_message.down.checked);

document.post_message.post_name.value = trim(document.post_message.post_name.value);
document.post_message.post_work.value = trim(document.post_message.post_work.value);
document.post_message.post_message.value = trim(document.post_message.post_message.value);

if (document.post_message.post_name.value.length < 1){
	alert ('You need to enter your name!');
	document.post_message.post_name.focus();
	document.post_message.post_name.select();
	return false;
	}

if (document.post_message.post_work.value.length < 1){
	alert ('You need to enter where you work!');
	document.post_message.post_work.select();
	return false;
	}

if(document.post_message.mode.value == 'new'){
	if (document.post_message.hdg.value.length < 1){
		alert ('You need to enter a subject heading!');
		document.post_message.hdg.select();
		return false;
		}
	}

if (document.post_message.post_message.value.length < 1){
	alert ('You need to enter a message!');
	document.post_message.post_message.select();
	return false;
	}



if((document.post_message.type.value == 'buddy')
&&(document.post_message.mode.value == 'new')){
	var num = document.post_message.buddy_id.length;
//			if(num == undefined){ num = 1};
	var i;

	var ticked = false;

//	alert('bidl=' + num);

// if only 1 item:
	if((num == undefined)||(num == null)||num < 2){ 
//		alert('bid0=' + document.post_message.buddy_id.checked);
		if (document.post_message.buddy_id.checked == false){
			alert ('You\'ll need to pick a buddy...');
			return false;
			}
		return true;
		}
	
	for(i = 0; i < num; i++){
//		alert(i + '=' + document.post_message.buddy_id[i].checked);
		if (document.post_message.buddy_id[i].checked){
			ticked = true;
			}
		}
	
	if (ticked == false){
		alert ('You\'ll need to pick a buddy...');

		return false;
		}
	}

return true;
}


function trim(text){

if (typeof text != "string") { return text; }

var ret_value = text;
var ch = ret_value.substring(0, 1);

while (ch == " ") {				// Check for spaces at the beginning of the string
	ret_value = ret_value.substring(1, ret_value.length);
	ch = ret_value.substring(0, 1);
	}

ch = ret_value.substring(ret_value.length-1, ret_value.length);
while (ch == " ") {				// Check for spaces at the end of the string
	ret_value = ret_value.substring(0, ret_value.length-1);
	ch = ret_value.substring(ret_value.length-1, ret_value.length);
	}
while (ret_value.indexOf("  ") != -1) {			 // Note that there are two spaces in the string - look for multiple spaces within the string
	ret_value = ret_value.substring(0, ret_value.indexOf("  ")) + ret_value.substring(ret_value.indexOf("  ")+1, ret_value.length); // Again, there are two spaces in each of the strings
	}

return ret_value;
}

// ====================================================

function checkform(){

document.post_message.post_name.value = trim(document.post_message.post_name.value);
document.post_message.post_work.value = trim(document.post_message.post_work.value);
document.post_message.post_message.value = trim(document.post_message.post_message.value);

if (document.post_message.post_name.value.length < 1){
	alert ('You need to enter your name!');
	document.post_message.post_name.select();
	return false;
	}

if (document.post_message.post_work.value.length < 1){
	alert ('You need to enter where you work!');
	document.post_message.post_work.select();
	return false;
	}

if (document.post_message.post_message.value.length < 1){
	alert ('You need to enter a message!');
	document.post_message.post_message.select();
	return false;
	}

return true;
}

//		======================================================

function jumpto(loc){			//	used for dropdown select link boxes
// alert("l=" + loc);

var url=loc;
if (url == ""){
	return false;
	}
url = '#' + url;

// alert("url=" + url);

document.location.href=url;
return true;
}


