	function isNum (str) {
	var i, ch;
	for (i = 0; i < str.length; ++i) {
	ch = str.charAt(i);
	if (ch < "0" || ch > "9") return 1;}
		return 0;
	}

	function new_category (id, name) {
		document.submit_list.cat_id.value = id;
		document.submit_list.possibility.value = name;
	}

	function ClearFrm (gl_field, gl_val) {
		var gl_field_value = eval("document.submit_list." + gl_val);
			if (gl_field == gl_field_value.value) {
				gl_field_value.value = "";
			}
	}

	/*********************************************************
	/ LTrim,Rtrim,Trim : drop the spaces (at left,right and both)
	/ args : TRIM_VALUE - the string to treat
	/ Noam E. - 09/12/2004
	/*********************************************************/
	function Trim(TRIM_VALUE)
	{
		if(TRIM_VALUE.length < 1)
		{
			return"";
		}
		TRIM_VALUE = RTrim(TRIM_VALUE);
		TRIM_VALUE = LTrim(TRIM_VALUE);
		if(TRIM_VALUE=="")
		{
			return "";
		}
		else
		{
			return TRIM_VALUE;
		}
	} //End Function

	function RTrim(VALUE)
	{
		var w_space = String.fromCharCode(32);
		var v_length = VALUE.length;
		var strTemp = "";
		
		if(v_length < 0)
		{
			return"";
		}

		var iTemp = v_length -1;

		while(iTemp > -1)
		{
			if(VALUE.charAt(iTemp) != w_space)
			{
				strTemp = VALUE.substring(0,iTemp +1);
				break;
			}
			iTemp = iTemp-1;
		} //End While
		return strTemp;
	} //End Function

	function LTrim(VALUE)
	{
		var w_space = String.fromCharCode(32);

		if(v_length < 1)
		{
			return"";
		}

		var v_length = VALUE.length;
		var strTemp = "";
		var iTemp = 0;

		while(iTemp < v_length)
		{
			if(VALUE.charAt(iTemp) != w_space)
			{
				strTemp = VALUE.substring(iTemp,v_length);
				break;
			}
			iTemp = iTemp + 1;
		} //End While
		return strTemp;
	} //End Function

	/*********************************************************
	/ CountWords : count the number of string in a string
	/ args : str_value - the string to treat
	/ Noam E. - 09/12/2004
	/*********************************************************/
	function CountWords (str_value)
	{

		var fullStr = str_value;
		var charCount = fullStr.length;
		var rExp = /[^A-Za-z0-9]/gi;
		var spacesStr = fullStr.replace(rExp, " ");
		var cleanedStr = spacesStr + " ";

		do
		{
			var old_str = cleanedStr;
			cleanedStr = cleanedStr.replace("  ", " ");
		} while(old_str != cleanedStr);

		var splitString = cleanedStr.split(" ");
		var wordCount = splitString.length -1;
		
		if (fullStr.length <1) {
			wordCount = 0;
		}

		return wordCount;
	}

	/**********************************************************
	/ is_email : check if the string passed has an email format
	/ args : email - the email string
	/ Noam E. - 09/12/2004
	/*********************************************************/
	function is_email(email)
	{
		var reg = /^[a-z0-9\._-]+@(:?[a-z0-9][a-z0-9-]+\.){1,6}[a-z]{2,6}$/i
		return ((reg.exec(email)!=null))
	}

	/**********************************************************
	/ is_url : check if the string passed has an url format
	/ args : url - the email string
	/ Noam E. - 09/12/2004
	/*********************************************************/
	function is_url(url)
	{
		var reg_http= /^http:\/\/[\w.]+\.\w{1,4}/
		var reg2 = /[.]{2,}/
		
		return ( (reg_http.exec(url)!=null) && (reg2.exec(url)==null) )
	}

	function CheckFrm () {
		var list = document.submit_list.list_title.value;
		var category = document.submit_list.possibility.value;
		var list_url = document.submit_list.list_url.value;
		var list_description = document.submit_list.list_description.value;
		var username = document.submit_list.name.value;

		if (Trim(list) == "" || list == "1-5 words") {
			alert("Please enter a list title/name.");
			document.submit_list.list_title.value = "";
			document.submit_list.list_title.select();
			return false;
		}

		if (CountWords(Trim(list)) > 5) {
			alert("The list title/name must be composed of 1 to 5 words.");
			document.submit_list.list_title.value = "";
			document.submit_list.list_title.select();
			return false;
		}

		if (category == "No Category was chosen" || category == "" || category == " ") {
			alert("Please select a Category.");
			return false;
		}

		if (Trim(list_url) == "" || list_url == "http://") {
			alert("Please enter the Your List Location (URL).");
			document.submit_list.list_url.value = "";
			document.submit_list.list_url.select();
			return false;
		}

		var is_valid = list_url.indexOf("http://");
		if (is_valid == -1)
		{
			list_url = "http://" + list_url;
		}

		if ( !is_url(list_url) ) {
			alert("Please enter a valid Url.");
			document.submit_list.list_url.select();
			return false;
		}

		if (Trim(list_description) == "" || list_description == "Description") {
			alert("Please enter a Description.");
			document.submit_list.list_description.value = "";
			document.submit_list.list_description.select();
			return false;
		}

		if (Trim(username) == "" || username == "Your Name") {
			alert("Please enter your name.");
			document.submit_list.name.value = "";
			document.submit_list.name.select();
			return false;
		}

		 if(Trim(document.submit_list.email.value) == ""){
			alert("Please insert a valid email address.")
			document.submit_list.email.value = "";
			document.submit_list.email.select();
			return false;
		}

		if(!is_email(Trim(document.submit_list.email.value))){
			alert("Please insert a valid email address.")
			document.submit_list.email.value = "";
			document.submit_list.email.select();
			return false;
		}

		if(document.submit_list.email.value.indexOf(".",2) == -1){
			alert("Please insert a valid email address.")
			document.submit_list.email.value = "";
			document.submit_list.email.select();
			return false;

		}

		if (document.submit_list.icq_num.value.length < 5 || document.submit_list.icq_num.value.length > 9 || isNaN(document.submit_list.icq_num.value) || document.submit_list.icq_num.value != parseInt(document.submit_list.icq_num.value)) {
			alert("Please type in a valid ICQ#");
			document.submit_list.icq_num.value = "";
			document.submit_list.icq_num.select();
			return false;
		}

		return true;
	}

