function SetDefaults()
	{
	document.getElementById('ContactMethodEmail').checked = true;
//	document.getElementById('EmailReqd').style.visibility = 'visible';
	document.getElementById('MAddrReqd').style.visibility = 'hidden';
	document.getElementById('CityReqd').style.visibility = 'hidden';
	document.getElementById('StReqd').style.visibility = 'hidden';
	document.getElementById('ZipReqd').style.visibility = 'hidden';
	document.getElementById('PhoneReqd').style.visibility = 'hidden';
	}
function limitTextInput(what,chars,counter) 
	{
	if (what.value.length > chars) 
		{
		what.value=what.value.substr(0,chars);
		alert('You exceed have ' + chars + ' characters!');
		}

	counting = (chars - what.value.length);
	c = document.getElementById(counter);
	c.innerHTML = counting;
	}

function ContactForm(ContactType)
	{
  switch(ContactType) 
  	{
		case 'E-Mail': 
			{
//			document.getElementById('EmailReqd').style.visibility = 'visible';
			document.getElementById('MAddrReqd').style.visibility = 'hidden';
			document.getElementById('CityReqd').style.visibility = 'hidden';
			document.getElementById('StReqd').style.visibility = 'hidden';
			document.getElementById('ZipReqd').style.visibility = 'hidden';
			document.getElementById('PhoneReqd').style.visibility = 'hidden';
			break;
			}
		case 'Mail': 
			{
//			document.getElementById('EmailReqd').style.visibility = 'hidden';
			document.getElementById('MAddrReqd').style.visibility = 'visible';
			document.getElementById('CityReqd').style.visibility = 'visible';
			document.getElementById('StReqd').style.visibility = 'visible';
			document.getElementById('ZipReqd').style.visibility = 'visible';
			document.getElementById('PhoneReqd').style.visibility = 'hidden';
			break;
			}
		case 'Phone': 
			{
//			document.getElementById('EmailReqd').style.visibility = 'hidden';
			document.getElementById('MAddrReqd').style.visibility = 'hidden';
			document.getElementById('CityReqd').style.visibility = 'hidden';
			document.getElementById('StReqd').style.visibility = 'hidden';
			document.getElementById('ZipReqd').style.visibility = 'hidden';
			document.getElementById('PhoneReqd').style.visibility = 'visible';
			break;
			}
		};
	}
var isOpera = navigator.userAgent.indexOf("Opera") > -1;   
var isIE = navigator.userAgent.indexOf("MSIE") > 1 && !isOpera;   
var isMoz = navigator.userAgent.indexOf("Mozilla/5.") == 0 && !isOpera;   
  
function textboxSelect (oTextbox, iStart, iEnd) {   
  
   switch(arguments.length) {   
       case 1:   
           oTextbox.select();   
           break;   
  
       case 2:   
           iEnd = oTextbox.value.length;   
           /* falls through */   
              
       case 3:            
           if (isIE) {   
               var oRange = oTextbox.createTextRange();   
               oRange.moveStart("character", iStart);   
               oRange.moveEnd("character", -oTextbox.value.length + iEnd);        
               oRange.select();                                                
           } else if (isMoz){   
               oTextbox.setSelectionRange(iStart, iEnd);   
           }                       
   }   
  
   oTextbox.focus();   
}   
  
function textboxReplaceSelect (oTextbox, sText) {   
  
   if (isIE) {   
       var oRange = document.selection.createRange();   
       oRange.text = sText;   
       oRange.collapse(true);   
       oRange.select();                                   
   } else if (isMoz) {   
       var iStart = oTextbox.selectionStart;   
       oTextbox.value = oTextbox.value.substring(0, iStart) + sText + oTextbox.value.substring(oTextbox.selectionEnd, oTextbox.value.length);   
       oTextbox.setSelectionRange(iStart + sText.length, iStart + sText.length);   
   }   
  
   oTextbox.focus();   
}   
  
function autocompleteMatch (sText, arrValues) {   
//   alert (sText);
   for (var i=0; i < arrValues.length; i++) {   
       if (arrValues[i].toUpperCase().indexOf(sText.toUpperCase()) == 0) {   
           return arrValues[i];   
       }   
   }   
  
   return null;   
  
}   
  
function autocompletechk(oTextbox, oEvent, arrValues) {   
  
   switch (oEvent.keyCode) {   
       case 38: //up arrow    
       case 40: //down arrow   
       case 37: //left arrow   
       case 39: //right arrow   
       case 33: //page up    
       case 34: //page down    
       case 36: //home    
       case 35: //end                    
       case 13: //enter    
       case 9: //tab    
       case 27: //esc    
       case 16: //shift    
       case 17: //ctrl    
       case 18: //alt    
       case 20: //caps lock   
       case 8: //backspace    
       case 46: //delete   
           return true;   
           break;   
  
       default:   
           textboxReplaceSelect(oTextbox, String.fromCharCode(isIE ? oEvent.keyCode : oEvent.charCode));   
           var iLen = oTextbox.value.length;   
  
           var sMatch = autocompleteMatch(oTextbox.value, arrValues);   
  
           if (sMatch != null) {   
               oTextbox.value = sMatch;   
               textboxSelect(oTextbox, iLen, oTextbox.value.length);   
           }    
             
           return false;   
   }   
}   
var arrValues =
	["Abbott","Abernathy","Abilene","Ackerly","Addison","Adrian","Agua Dulce","Alamo","Alamo Heights","Alba","Albany","Aledo","Alice","Allen","Alma","Alpine","Alto","Alton","Alvarado","Alvin","Alvord","Amarillo","Ames","Amherst","Anahuac","Anderson","Andrews","Angleton","Angus","Anna","Annetta","Annetta North","Annetta South","Annona","Anson","Anthony","Anton","Appleby","Aquilla","Aransas Pass","Archer City","Arcola","Argyle","Arlington","Arp","Asherton","Aspermont","Athens","Atlanta","Aubrey","Aurora","Austin","Austwell","Avery","Avinger","Azle","Bailey","Bailey's Prairie","Baird","Balch Springs","Balcones Heights","Ballinger","Balmorhea","Bandera","Bangs","Bardwell","Barry","Barstow","Bartlett","Bartonville","Bastrop","Bay City","Bayou Vista","Bayside","Baytown","Bayview","Beach City","Bear Creek","Beasley","Beaumont","Beckville","Bedford","Bedias","Bee Cave","Beeville","Bellaire","Bellevue","Bellmead","Bells","Bellville","Belton","Benavides","Benbrook","Benjamin","Berryville","Bertram","Beverly Hills","Bevil Oaks","Big Lake","Big Sandy","Big Spring","Big Wells","Bishop","Bishop Hills","Blackwell","Blanco","Blanket","Bloomburg","Blooming Grove","Blossom","Blue Mound","Blue Ridge","Blum","Boerne","Bogata","Bonham","Bonney","Booker","Borger","Bovina","Bowie","Boyd","Brackettville","Brady","Brazoria","Brazos Bend","Brazos Country","Breckenridge","Bremond","Brenham","Briarcliff","Briaroaks","Bridge City","Bridgeport","Broaddus","Bronte","Brookshire","Brookside Village","Browndell","Brownfield","Brownsboro","Brownsville","Brownwood","Bruceville-Eddy","Bryan","Bryson","Buckholts","Buda","Buffalo","Buffalo Gap","Buffalo Springs","Bullard","Bulverde","Bunker Hill Village","Burkburnett","Burke","Burleson","Burnet","Burton","Byers","Bynum","Cactus","Caddo Mills","Caldwell","Callisburg","Calvert","Cameron","Camp Wood","Campbell","Canadian","Caney City","Canton","Canyon","Carbon","Carl's Corner","Carmine","Carrizo Springs","Carrollton","Carthage","Cashion","Castle Hills","Castroville","Cedar Hill","Cedar Park","Celeste","Celina","Center","Centerville","Chandler","Channing","Charlotte","Chester","Chico","Childress","Chillicothe","China","China Grove","Chireno","Christine","Cibolo","Cisco","Clarendon","Clarksville","Clarksville City","Claude","Clear Lake Shores","Cleburne","Cleveland","Clifton","Clint","Clute","Clyde","Coahoma","Cockrell Hill","Coffee City","Coldspring","Coleman","College Station","Colleyville","Collinsville","Colmesneil","Colorado City","Columbus","Comanche","Combes","Combine","Commerce","Como","Conroe","Converse","Cool","Coolidge","Cooper","Coppell","Copper Canyon","Copperas Cove","Corinth","Corpus Christi","Corral City","Corrigan","Corsicana","Cottonwood","Cottonwood Shores","Cotulla","Cove","Covington","Crandall","Crane","Cranfills Gap","Crawford","Creedmoor","Cresson","Crockett","Crosbyton","Cross Plains","Cross Roads","Cross Timber","Crowell","Crowley","Crystal City","Cuero","Cumby","Cuney","Cushing","Cut and Shoot","Daingerfield","Daisetta","Dalhart","Dallas","Dalworthington Gardens","Danbury","Darrouzett","Dawson","Dayton","Dayton Lakes","De Leon","Dean","Decatur","Decordova","Deer Park","DeKalb","Del Rio","Dell City","Denison","Denton","Denver City","Deport","DeSoto","Detroit","Devers","Devine","Diboll","Dickens","Dickinson","Dilley","Dimmitt","DISH","Dodd City","Dodson","Domino","Donna","Dorchester","Double Oak","Douglassville","Dripping Springs","Driscoll","Dublin","Dumas","Duncanville","Eagle Lake","Eagle Pass","Early","Earth","East Bernard","East Mountain","East Tawakoni","Eastland","Easton","Ector","Edcouch","Eden","Edgecliff","Edgewood","Edinburg","Edmonson","Edna","Edom","El Campo","El Cenizo","El Lago","El Paso","Eldorado","Electra","Elgin","Elkhart","Elmendorf","Elsa","Emhouse","Emory","Enchanted Oaks","Encinal","Ennis","Escobares","Estelline","Euless","Eureka","Eustace","Evant","Everman","Fair Oaks Ranch","Fairchilds","Fairfield","Fairview","Falfurrias","Falls City","Farmers Branch","Farmersville","Farwell","Fate","Fayetteville","Ferris","Flatonia","Florence","Floresville","Flower Mound","Floydada","Follett","Forest Hill","Forney","Forsan","Fort Stockton","Fort Worth","Franklin","Frankston","Fredericksburg","Freeport","Freer","Friendswood","Friona","Frisco","Fritch","Frost","Fruitvale","Fulshear","Fulton","Gainesville","Galena Park","Gallatin","Galveston","Ganado","Garden Ridge","Garland","Garrett","Garrison","Gary","Gatesville","George West","Georgetown","Gholson","Giddings","Gilmer","Gladewater","Glen Rose","Glenn Heights","Godley","Goldsmith","Goldthwaite","Goliad","Golinda","Gonzales","Goodlow","Goodrich","Gordon","Goree","Gorman","Graford","Graham","Granbury","Grand Prairie","Grand Saline","Grandfalls","Grandview","Granger","Granite Shoals","Granjeno","Grapeland","Grapevine","Grays Prairie","Greenville","Gregory","Grey Forest","Groesbeck","Groom","Groves","Groveton","Gruver","Gun Barrel City","Gunter","Gustine","Hackberry","Hale Center","Hallettsville","Hallsburg","Hallsville","Haltom City","Hamilton","Hamlin","Happy","Hardin","Harker Heights","Harlingen","Hart","Haskell","Haslet","Hawk Cove","Hawkins","Hawley","Hays","Hearne","Heath","Hebron","Hedley","Hedwig Village","Helotes","Hemphill","Hempstead","Henderson","Henrietta","Hereford","Hewitt","Hickory Creek","Hico","Hidalgo","Hideaway","Higgins","Highland Haven","Highland Park","Highland Village","Hill Country Village","Hillcrest Village","Hillsboro","Hilshire Village","Hitchcock","Holiday Lakes","Holland","Holliday","Hollywood Park","Hondo","Honey Grove","Hooks","Horizon City","Horseshoe Bay","Houston","Howardwick","Howe","Hubbard","Hudson","Hudson Oaks","Hughes Springs","Humble","Hunters Creek Village","Huntington","Huntsville","Hurst","Hutchins","Hutto","Huxley","Idalou","Impact","Indian Lake","Industry","Ingleside","Ingleside On The Bay","Ingram","Iola","Iowa Colony","Iowa Park","Iraan","Iredell","Irving","Italy","Itasca","Ivanhoe","Ivanhoe North","Jacinto City","Jacksboro","Jacksonville","Jamaica Beach","Jarrell","Jasper","Jayton","Jefferson","Jersey Village","Jewett","Joaquin","Johnson City","Jolly","Jones Creek","Jonestown","Josephine","Joshua","Jourdanton","Junction","Justin","Karnes City","Katy","Kaufman","Keene","Keller","Kemah","Kemp","Kempner","Kendleton","Kenedy","Kenefick","Kennard","Kennedale","Kerens","Kermit","Kerrville","Kilgore","Killeen","Kingsville","Kirby","Kirbyville","Kirvin","Knollwood","Knox City","Kosse","Kountze","Kress","Krugerville","Krum","Kurten","Kyle","La Coste","La Feria","La Grange","La Grulla","La Joya","La Marque","La Porte","La Vernia","La Villa","La Ward","Lacy-Lakeview","Ladonia","Lago Vista","Laguna Vista","Lake Bridgeport","Lake City","Lake Dallas","Lake Jackson","Lake Tanglewood","Lake Worth","Lakeport","Lakeside","Lakeside","Lakeside City","Lakeview","Lakeway","Lakewood Village","Lamesa","Lampasas","Lancaster","Laredo","Latexo","Lavon","Lawn","League City","Leakey","Leander","Leary","Lefors","Leon Valley","Leona","Leonard","Leroy","Levelland","Lewisville","Lexington","Liberty","Liberty Hill","Lincoln Park","Lindale","Linden","Lindsay","Lipan","Little Elm","Little River Academy","Littlefield","Live Oak","Liverpool","Livingston","Llano","Lockhart","Lockney","Log Cabin","Lometa","Lone Oak","Lone Star","Longview","Loraine","Lorena","Lorenzo","Los Fresnos","Los Indios","Los Ybanez","Lott","Lovelady","Lowry Crossing","Lubbock","Lucas","Lueders","Lufkin","Luling","Lumberton","Lyford","Lytle","Mabank","Madisonville","Magnolia","Malakoff","Malone","Manor","Mansfield","Manvel","Marble Falls","Marfa","Marietta","Marion","Marlin","Marquez","Marshall","Mart","Martindale","Mason","Matador","Mathis","Maud","Maypearl","McAllen","McCamey","McGregor","McKinney","McLean","McLendon-Chisholm","Meadow","Meadowlakes","Meadows Place","Megargel","Melissa","Melvin","Memphis","Menard","Mercedes","Meridian","Merkel","Mertens","Mertzon","Mesquite","Mexia","Miami","Midland","Midlothian","Midway","Milano","Mildred","Miles","Milford","Miller's Cove","Millsap","Mineola","Mineral Wells","Mingus","Mission","Missouri City","Mobeetie","Mobile City","Monahans","Mont Belvieu","Montgomery","Moody","Moore Station","Moran","Morgan","Morgan's Point","Morgan's Point Resort","Morton","Moulton","Mount Calm","Mount Enterprise","Mount Pleasant","Mount Vernon","Mountain City","Muenster","Muleshoe","Mullin","Munday","Murchison","Murphy","Mustang","Mustang Ridge","Nacogdoches","Naples","Nash","Nassau Bay","Natalia","Navarro","Navasota","Nazareth","Nederland","Needville","Nesbitt","Nevada","New Berlin","New Boston","New Braunfels","New Chapel Hill","New Deal","New Fairview","New Home","New Hope","New London","New Summerfield","New Waverly","Newark","Newcastle","Newton","Neylandville","Niederwald","Nixon","Nocona","Nolanville","Nome","Noonday","Nordheim","Normangee","North Cleveland","North Richland Hills","Northlake","Novice","Oak Grove","Oak Leaf","Oak Point","Oak Ridge","Oak Ridge","Oak Ridge North","Oak Valley","Oakwood","O'Brien","Odem","Odessa","O'Donnell","Oglesby","Old River-Winfree","Olmos Park","Olney","Olton","Omaha","Onalaska","Opdyke West","Orange","Orange Grove","Orchard","Ore City","Overton","Ovilla","Oyster Creek","Paducah","Paint Rock","Palacios","Palestine","Palisades","Palm Valley","Palmer","Palmhurst","Palmview","Pampa","Panhandle","Panorama Village","Pantego","Paradise","Paris","Parker","Pasadena","Pattison","Patton Village","Payne Springs","Pearland","Pearsall","Pecan Gap","Pecan Hill","Pecos","Pelican Bay","Penelope","Penitas","Pernitas Point","Perryton","Petersburg","Petrolia","Petronila","Pflugerville","Pharr","Pilot Point","Pine Forest","Pine Island","Pinehurst","Pineland","Piney Point Village","Pittsburg","Plains","Plainview","Plano","Pleak","Pleasant Valley","Pleasanton","Plum Grove","Point","Point Blank","Point Comfort","Point Venture","Ponder","Port Aransas","Port Arthur","Port Isabel","Port Lavaca","Port Neches","Portland","Post","Post Oak Bend","Poteet","Poth","Pottsboro","Powell","Poynor","Prairie View","Premont","Presidio","Primera","Princeton","Progreso","Progreso Lakes","Prosper","Putnam","Pyote","Quanah","Queen City","Quinlan","Quintana","Quitaque","Quitman","Ralls","Rancho Viejo","Ranger","Rangerville","Rankin","Ransom Canyon","Ravenna","Raymondville","Red Lick","Red Oak","Redwater","Refugio","Reklaw","Reno","Reno","Retreat","Rhome","Rice","Richardson","Richland","Richland Hills","Richland Springs","Richmond","Richwood","Riesel","Rio Bravo","Rio Grande City","Rio Hondo","Rio Vista","Rising Star","River Oaks","Riverside","Roanoke","Roaring Springs","Robert Lee","Robinson","Robstown","Roby","Rochester","Rockdale","Rockport","Rocksprings","Rockwall","Rocky Mound","Rogers","Rollingwood","Roma","Roman Forest","Ropesville","Roscoe","Rose City","Rose Hill Acres","Rosebud","Rosenberg","Ross","Rosser","Rotan","Round Mountain","Round Rock","Round Top","Rowlett","Roxton","Royse City","Rule","Runaway Bay","Runge","Rusk","Sabinal","Sachse","Sadler","Saginaw","Saint Hedwig","Saint Jo","Saint Paul","Salado","San Angelo","San Antonio","San Augustine","San Benito","San Diego","San Felipe","San Juan","San Leanna","San Marcos","San Patricio","San Perlita","San Saba","Sanctuary","Sandy Point","Sanford","Sanger","Sansom Park","Santa Anna","Santa Clara","Santa Fe","Santa Rosa","Savoy","Schertz","Schulenburg","Scotland","Scottsville","Scurry","Seabrook","Seadrift","Seagoville","Seagraves","Sealy","Seguin","Selma","Seminole","Seven Oaks","Seven Points","Seymour","Shady Shores","Shallowater","Shamrock","Shavano Park","Shenandoah","Shepherd","Sherman","Shiner","Shoreacres","Silsbee","Silverton","Simonton","Sinton","Skellytown","Slaton","Smiley","Smithville","Smyer","Snook","Snyder","Socorro","Somerset","Somerville","Sonora","Sour Lake","South Houston","South Mountain","South Padre Island","Southlake","Southmayd","Southside Place","Spearman","Splendora","Spofford","Spring Valley","Springlake","Springtown","Spur","Stafford","Stagecoach","Stamford","Stanton","Staples","Star Harbor","Stephenville","Sterling City","Stinnett","Stockdale","Stratford","Strawn","Streetman","Sudan","Sugar Land","Sullivan City","Sulphur Springs","Sun Valley","Sundown","Sunnyvale","Sunray","Sunrise Beach Village","Sunset Valley","Surfside Beach","Sweeny","Sweetwater","Taft","Tahoka","Talco","Talty","Tatum","Taylor","Taylor Lake Village","Taylor Landing","Teague","Tehuacana","Temple","Tenaha","Terrell","Terrell Hills","Texarkana","Texas City","Texhoma","Texline","The Colony","Thompsons","Thorndale","Thornton","Thorntonville","Thrall","Three Rivers","Throckmorton","Tiki Island","Timbercreek Canyon","Timpson","Tioga","Tira","Toco","Todd Mission","Tolar","Tom Bean","Tomball","Tool","Toyah","Trent","Trenton","Trinidad","Trinity","Trophy Club","Troup","Troy","Tulia","Turkey","Tuscola","Tye","Tyler","Uhland","Uncertain","Union Grove","Universal City","University Park","Uvalde","Valentine","Valley Mills","Valley View","Van","Van Alstyne","Van Horn","Vega","Venus","Vernon","Victoria","Vidor","Village of the Hills","Villiage of Volente","Vinton","Waco","Waelder","Wake Village","Waller","Wallis","Walnut Springs","Warren City","Waskom","Watauga","Waxahachie","Weatherford","Webberville","Webster","Weimar","Weinert","Weir","Wellington","Wellman","Wells","Weslaco","West","West Columbia","West Lake Hills","West Orange","West Tawakoni","West University Place","Westbrook","Westlake","Weston","Weston Lakes","Westover Hills","Westworth Village","Wharton","Wheeler","White Deer","White Oak","White Settlement","Whiteface","Whitehouse","Whitesboro","Whitewright","Whitney","Wichita Falls","Wickett","Willis","Willow Park","Wills Point","Wilmer","Wilson","Wimberley","Windcrest","Windom","Windthorst","Winfield","Wink","Winnsboro","Winona","Winters","Wixon Valley","Wolfe City","Wolfforth","Woodbranch Village","Woodcreek","Woodloch","Woodsboro","Woodson","Woodville","Woodway","Wortham","Wylie","Yantis","Yoakum","Yorktown","Zavalla"];
var ShowNearCity ='N';
function IssueSelection (SelectValue)
	{
	ShowNearCity ='Y';
	if (isNaN(SelectValue))
		{
		if ((SelectValue != 'HRD') && (SelectValue != 'TRV') && (SelectValue != 'TTA') && (SelectValue != 'GPA'))
			{
			switch (SelectValue) 
				{
				case 'DPS': location.href='http://www.txdps.state.tx.us/DriverLicense/index.htm'; break;
				case 'MCC': location.href='http://www.txdmv.gov/protection/household_movers/after_move.htm';  break;
				case 'OOP': location.href='http://www.txdot.gov/business/motor_carrier/overweight_permit/default.htm';  break;
				case 'TAG': location.href='http://www.txdmv.gov/vehicles/dealers/etag.htm';  break;
				case 'VTR': location.href='http://www.txdmv.gov/vehicles/registration/register.htm';  break;
				case 'VTRT': location.href='http://www.txdmv.gov/vehicles/titles/title_vehicle.htm';  break;
				case 'CRR': location.href='http://www.txdot.gov/drivers_vehicles/crash_records/reports.htm';  break;
				case 'PHC': location.href='?form=Report_a_Pothole'; break;
				}
			}
		ShowNearCity = 'N';
		}
	if (ShowNearCity == 'Y')
		{
		document.getElementById('issuecity').style.visibility = 'visible';
		}
	else
		{
		theForm.NMCity.value='Enter nearest city...';
		document.getElementById('issuecity').style.visibility = 'hidden';
		}
	}


function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}


function FormValidator(theForm)
	{

	if (theForm.IssueTypeDDL.value == 'ORR')
		{
		if (theForm.RouteTo.value=='')
			{
			alert ('Please select an E-Mail Recipient.');
			theForm.RouteTo.focus();
			return (false);
			}
		}

	if (theForm.IssueTypeDDL.value == '')
		{
		alert ('Please select a Contact Reason.');
		theForm.IssueTypeDDL.focus();
		return (false);
		}
	
	if (document.getElementById('NMCity') != null && ShowNearCity != 'N')
		{
		if ((theForm.NMCity.value == "Enter nearest city...") || (trim(theForm.NMCity.value) == ''))
			{
			alert ('Please enter a City Location.');
			theForm.NMCity.value='';
			theForm.NMCity.focus();
			return (false);
			}
		}

	if (theForm.SalutationDDL.value == '')
		{
		alert ('Please select a Salutation.');
		theForm.SalutationDDL.focus();
		return (false);
		}

	if (trim(theForm.FirstName.value) == '')
		{
		alert ('Please enter a First Name.');
		theForm.FirstName.value = '';
		theForm.FirstName.focus();
		return (false);
		}

	if (trim(theForm.LastName.value) == '')
		{
		alert ('Please enter a Last Name.');
		theForm.LastName.value = '';
		theForm.LastName.focus();
		return (false);
		}

	if (trim(theForm.Email.value) == '')
		{
		alert ('Please enter your E-Mail Address.');
		theForm.Email.value = '';
		theForm.Email.focus();
		return (false);
		}
	else
		{
		var emailID = theForm.Email.value;
		if (emailcheck(emailID)==false)
			{
			theForm.Email.value="";
			theForm.Email.focus();
			return (false);
			}
		}



	var strContactMethod = 0;

	for( i = 0; i < theForm.ContactMethod.length; i++ )
		{
		if( theForm.ContactMethod[i].checked == true)
			{
			strContactMethod = theForm.ContactMethod[i].value;
			}
		}


	if (strContactMethod == 'Mail' || ((trim(theForm.MailAddress1.value) != '') || (trim(theForm.MailAddress2.value) != '') || (trim(theForm.MailAddress3.value) != '') || (trim(theForm.City.value) != '') || (trim(theForm.State.value) != '') || (trim(theForm.Zip.value) != '') || (trim(theForm.Zipplus4.value) != '')))
		{
		if (ValidateMail()==false)
			{
			return (false);
			}
		}
	else
		{
		if (strContactMethod == 'Phone' || (theForm.areacode.value != "" || theForm.phone_prefix.value != "" || theForm.phone_suffix.value != ""))

			{
			if (ValidatePhone() == false)
				{
				return (false);
				}
			}
		}


	
	if (trim(theForm.Comments.value) == '')
		{
		alert ("Please provide your comments.");		
		theForm.Comments.value = '';
		theForm.Comments.focus();
		return (false);
		}

	if (theForm.IssueTypeDDL.value != 'ORR')
		{
		var strComplaintCheck = '';
		for( i = 0; i < theForm.Complaint.length; i++ )
			{
			if(theForm.Complaint[i].checked == true)
				{
				strComplaintCheck = theForm.Complaint[i].value;
				}
			}
		if (strComplaintCheck == '')
			{
			alert("Please identify if this message is a complaint.");
			return (false);
			}
		}

//remove after testing
//return (false);





	return (true);
	}
function ValidateMail()
	{
	if ((trim(theForm.MailAddress1.value) == '') && (trim(theForm.MailAddress2.value) == '') && (trim(theForm.MailAddress3.value) == ''))
		{
		alert ('Please enter a Mailing Address.');
		theForm.MailAddress1.value = '';
		theForm.MailAddress2.value = '';
		theForm.MailAddress3.value = '';
		theForm.MailAddress1.focus();
		return (false);
		}
	else
		{
		if (trim(theForm.MailAddress1.value) == '')
			{
			theForm.MailAddress1.value = '';
			}
		if (trim(theForm.MailAddress2.value) == '')
			{
			theForm.MailAddress2.value = '';
			}
		if (trim(theForm.MailAddress3.value) == '')
			{
			theForm.MailAddress3.value = '';
			}
		}
	if (trim(theForm.City.value) == '')
		{
		alert ('Please enter a City.');
		theForm.City.value = '';
		theForm.City.focus();
		return (false);
		}
	if (theForm.State.value == '')
		{
		alert ('Please select a State.');
		theForm.State.focus();
		return (false);
		}
	
	var ZipCode = trim(theForm.Zip.value);
	var ZipCodePlus4 = trim(theForm.Zipplus4.value);
	if (ZipCode == '')
		{
		alert ("Please enter a Zip Code.");
		theForm.Zip.value = '';
		theForm.Zipplus4.value = '';
		theForm.Zip.focus();
		return (false);
		}
	else
		{
		if (ZipCodePlus4 != '')
			{
			ZipCode = ZipCode + '-' + ZipCodePlus4;
			}
		else
			{
			theForm.Zipplus4.value = '';
			}
		}
	if (isZip(ZipCode)==false)
		{
	       	alert("Zip Code is not valid. Please enter a valid Zip Code.");
		theForm.Zip.value = '';
		theForm.Zipplus4.value = '';
		theForm.Zip.focus();
		return (false);
		}
	}

function ValidatePhone()
	{
	if (theForm.areacode.value == "")
		{
		alert("Please enter a value for the area code.");
		theForm.areacode.focus();
		return (false);
		}
	else
		{
		if (theForm.areacode.value.length != 3)
			{
			alert("Area code must be 3 numeric characters in length.  Please correct.");
			theForm.areacode.value='';
			theForm.areacode.focus();
			return (false);
			}
		var checkStr = theForm.areacode.value;
		if (validateAllNumeric(checkStr)==false)
			{
			alert("Please enter only numeric characters for the area code.");
			theForm.areacode.value='';
			theForm.areacode.focus();
			return (false);
			}
		}

	if (theForm.phone_prefix.value == "")
		{
		alert("Please enter a value for the first 3 digits of the phone number.");
		theForm.phone_prefix.focus();
		return (false);
		}
	else
		{
		if (theForm.phone_prefix.value.length != 3)
			{
			alert("The phone number prefix must be 3 numeric characters in length.  Please correct.");
			theForm.phone_prefix.value='';
			theForm.phone_prefix.focus();
			return (false);
			}
 		var checkStr = theForm.phone_prefix.value;
		if (checkStr != parseInt(checkStr))
			{
			alert("Please enter only numeric characters for the phone number prefix.");
			theForm.phone_prefix.value='';
			theForm.phone_prefix.focus();
			return (false);
			}
 		}
	if (theForm.phone_suffix.value == "")
		{
		alert("Please enter a value for the last 4 digits of the phone number.");
		theForm.phone_suffix.focus();
		return (false);
		}
	else
		{
		if (theForm.phone_suffix.value.length != 4)
			{
			alert("The phone number suffix must be 4 numeric characters in length.  Please correct.");
			theForm.phone_suffix.value='';
			theForm.phone_suffix.focus();
			return (false);
			}
 		var checkStr = theForm.phone_suffix.value;
		if (validateAllNumeric(checkStr)==false)
			{
			alert("Please enter only numeric characters for the phone number suffix.");
			theForm.phone_suffix.value='';
			theForm.phone_suffix.focus();
			return (false);
			}
 		}
	if (theForm.phone_ext.value != '')
		{
 		var checkStr = theForm.phone_ext.value;
		if (validateAllNumeric(checkStr)==false)
			{
			alert("Please enter only numeric characters for the phone number extension.");
			theForm.phone_ext.value='';
			theForm.phone_ext.focus();
			return (false);
			}
		}
	}

function validateAllNumeric (checkStr)
	{
	var checkOK = "0123456789";
	var allValid = true;
	var allNum = "";
	for (i = 0;  i < checkStr.length;  i++)
		{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		if (ch == checkOK.charAt(j))
			break;
		if (j == checkOK.length)
			{
			allValid = false;
			break;
			}
		allNum += ch;
		}
	if (!allValid)
		{
		return (false);
		}
	return (true)
	}
function isZip(ZipCodeTest) 
	{
	// Check for correct zip code
	reZip = new RegExp(/(^\d{5}$)|(^\d{5}-\d{4}$)/);

	if (!reZip.test(ZipCodeTest)) 
		{
          	return false;
     		}
	return true;
	}

function emailcheck(emailid) 
	{
	var at="@"
	var dot="."
	var lat=emailid.indexOf(at)
	var lstr=emailid.length
	var ldot=emailid.indexOf(dot)
	if ((emailid.indexOf(at)==-1) || (emailid.indexOf(at)==-1 || emailid.indexOf(at)==0 || emailid.indexOf(at)==lstr) || (emailid.indexOf(dot)==-1 || emailid.indexOf(dot)==0 || emailid.indexOf(dot)==lstr) || (emailid.indexOf(at,(lat+1))!=-1) || (emailid.substring(lat-1,lat)==dot || emailid.substring(lat+1,lat+2)==dot) || (emailid.indexOf(dot,(lat+2))==-1) || (emailid.indexOf(" ")!=-1))
		{
		alert("Invalid E-mail Address");
		return (false);
		}
	}


