
// ################

function check_intro(q_array){

var questions = new Array();
questions = q_array.split("|");
var q_length = questions.length;
var f;

alert ("q=" + q_length + "\n\nqarray=" + q_array);

alert("form_elems=" + document.intro.length);
for (i=0; i<document.intro.length; i++){
	alert(i + "=" + document.intro.elements[i].name + "=" + document.intro.elements[i].value + "checked=" + document.intro.elements[i].checked);
	}

for(i=0; i<q_length; i++){
	//alert ("i=" + questions[i]);
	f = eval ("func_" + questions[i]);
	f(i);
	}

return true;
}

// ############# functions to check individual question responses...
// 173 - 177 are intro sets...

function func_173(id){		// how old are you...

alert("func_173\n\nl=" + document.intro.id.length);

for(j=0; j<document.intro.id.length; j++){
	//var v = eval (document.intro.q[j].value);
	
	alert("173.j=" + document.intro.id[j].value + "\n\n173.j.length=" + document.intro.id[j].value.length + "\n\nand0=" + document.intro.id[j].value[0].value);
	

	if (document.intro.id[j].checked)  {

		alert("found_it=" + document.intro.id[j].value);
		}

//	var a = (document.intro.q[j.v].checked?document.intro.q[j.v].value:"??");
//	alert("value=" + a);

	}

//	search.cgi?search='+(search[0].checked?search[0].value:'')+(search[1].checked?search[1].value:'') +'&where='+(where[0].checked?where[0].value:'')+(where[1].checked?where[1].value:'')

//
//

}

function func_174(id){
alert("func_174");
}

function func_175(id){
alert("func_175");
}






// ##### jump menu...
function jumpto(){			//	used for dropdown select link boxes

var url=document.dropdown.jump[document.dropdown.jump.selectedIndex].value;
if (url == ""){
	return false;
	}
document.location.href=url;
return true;
} // end jumpto...



// ########## checks textareas, text inputs...
function checkdiscuss(){		//	this is for the discussion boards
							// make sure all forms have the same name & fields

if (document.discussionmsg.email.value.length == 0){
	alert ("You need to enter your email address\n- thanks.");
	document.discussionmsg.email.focus();
	return false;
	};

if (document.discussionmsg.body.value.length == 0){
	alert ("You haven't written any comments!");
	document.discussionmsg.comment.focus();
	return false;
	};

if (document.discussionmsg.name.value.length == 0){
	alert ("You haven't put your name!");
	document.discussionmsg.name.focus();
	return false;
	};

if (document.discussionmsg.subject.value.length == 0){
	alert ("You haven't put the subject!");
	document.discussionmsg.subject.focus();
	return false;
	};

return true;
} // end checkdiscuss..


// ############## ??
function chkedit(l){		//	used in amend.notices.pl in admin

alert("rad.length=" + l);
l++;
for (i=1; i< l; i++){

	alert("i=" + i + " : val=" + document.pp.rad[i].value);
	
	if (document.pp.rad[i].checked){return true;}
	}
alert('You need to select an entry to edit!');
return false;
} // #### ?


// ######## radio check	## topic=return checkoption(document.pp.topic[document.pp.topic.selectedIndex].value)
function checkoption(topic){		// relates to a radio choice?
if (topic == ""){
	alert("You'll need to pick a valid item");
	return false;
	}
return true;
}	// end checkoption...



// ############ trim...
function trim(text) {

   // Removes leading and trailing spaces from the passed string. Also removes
   // consecutive spaces and replaces it with one space. If something besides
   // a string is passed in (null, custom object, etc.) then return the input.

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

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

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

ch = return_value.substring(return_value.length-1, return_value.length);

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

	return_value = return_value.substring(0, return_value.indexOf("  ")) + return_value.substring(return_value.indexOf("  ")+1, return_value.length); // Again, there are two spaces in each of the strings
	
	}
   
return return_value; // Return the trimmed string back to the user

}	// end trim...


