function SubmitForm() {

	var objects = new Array();
	var object;
	var ErrCnt;

	ErrCnt = 0;

//Make sure all information is provided; none left blank.
objects[0] = document.all.WEB_ADDRESS;	
objects[1] = document.all.DESCRIPTION;
objects[2] = document.all.FIRST_NAME;
objects[3] = document.all.LAST_NAME;
objects[4] = document.all.EMAIL;

	if( objects.length > 0 ) {
		for(var i=0; i < objects.length; i++) {
			object = objects[i];
			object.style.backgroundColor = "";
			
			if(object.value.length < 1) {
				object.style.backgroundColor = "#CCFFCC";
				if( i == 0 ) { alert("Please provide the Web Address."); }
				if( i == 1 ) { alert("Please provide a Description."); }
				if( i == 2 ) { alert("Please provide your First Name."); }
				if( i == 3 ) { alert("Please provide your Last Name."); }
				if( i == 4 ) { alert("Please provide your E-mail Address."); }				
				object.focus();
				ErrCnt++;
				break;
			}
		}
	}

//Validate Url
	if ((ErrCnt<=0) && (document.all.WEB_ADDRESS.value.length > 0)) {
	if(!isValidURL(document.all.WEB_ADDRESS.value)) {
	document.all.WEB_ADDRESS.style.backgroundColor = "#CCFFCC";
	alert("Please make sure the Web Address is typed correctly.");
	document.all.WEB_ADDRESS.focus();
	ErrCnt++;
	}
	}

//Validate email address.
	if( ErrCnt <=0 ) {
	validateEmailAddress(document.all.EMAIL.value);
	}

//If all is well, submit form.		
	if( ErrCnt <= 0 ) {
	document.Suggest_Link_Form.submit();
	}
}

function validateEmailAddress(str) {
		var EmailErr;
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		document.all.EMAIL.style.backgroundColor = "#CCFFCC";
		   alert("Please make sure your E-mail Address is typed correctly.")
		   document.all.EMAIL.focus();
		   ErrCnt++;
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		document.all.EMAIL.style.backgroundColor = "#CCFFCC";
		   alert("Please make sure your E-mail Address is typed correctly.")
		   document.all.EMAIL.focus();
		   ErrCnt++;
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		document.all.EMAIL.style.backgroundColor = "#CCFFCC";
		    alert("Please make sure your E-mail Address is typed correctly.")
			document.all.EMAIL.focus();
			ErrCnt++;
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		 document.all.EMAIL.style.backgroundColor = "#CCFFCC";
		 	alert("Please make sure your E-mail Address is typed correctly.")
			document.all.EMAIL.focus();
			ErrCnt++;
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		 document.all.EMAIL.style.backgroundColor = "#CCFFCC";
		    alert("Please make sure your E-mail Address is typed correctly.")
			document.all.EMAIL.focus();
			ErrCnt++;
		 } 

		 if (str.indexOf(dot,(lat+2))==-1){
		 document.all.EMAIL.style.backgroundColor = "#CCFFCC";
		    alert("Please make sure your E-mail Address is typed correctly.")
			document.all.EMAIL.focus();
			ErrCnt++;
		 } 
		
		 if (str.indexOf(" ")!=-1){
		 document.all.EMAIL.style.backgroundColor = "#CCFFCC";
		    alert("Please make sure your E-mail Address is typed correctly.")
			document.all.EMAIL.focus();
			ErrCnt++;
		 }		
	}

function isValidURL(url){
    var RegExp = /^(([\w]+:)?\/\/)?(([\d\w]|%[a-fA-f\d]{2,2})+(:([\d\w]|%[a-fA-f\d]{2,2})+)?@)?([\d\w][-\d\w]{0,253}[\d\w]\.)+[\w]{2,4}(:[\d]+)?(\/([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)*(\?(&?([-+_~.\d\w]|%[a-fA-f\d]{2,2})=?)*)?(#([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)?$/;
    if(RegExp.test(url)){
        return true;
    }else{
        return false;
    }
} 