<!--
function resize_textarea(x, minw, minh, maxw, maxh)
{	var rows = 0;
	var cols = 0;
	arrayOfStrings = x.value.split('\n')   
	for (var i=0; i < arrayOfStrings.length; i++) 
	{	var l = arrayOfStrings[i].length;
		cols = limit(cols, l, maxw);
		while(l > maxw)
		{	l -= maxw;
			rows++;
			cols = maxw;
		}
		rows++;
	}
	x.rows = limit(limit(rows, 1, null), minh, maxh);
	x.cols = limit(limit(cols, 1, null), minw, maxw);
}

function limit_Chars(TextElement, max)
{
	var TextLength = TextElement.value.length;
	if (TextLength >= max) 
		{alert("You have reached the maximum number of characters (" + max + ") for this field. This field will not accept any further characters.");
		TextElement.value = TextElement.value.substring(0,max);}
}

function SetQuestions(cat)
{
	if (cat == 'Billing'){
		document.getElementById('BIQ').style.display = "inline";
		document.getElementById('QuestionTopic_BIQ').style.visibility = "visible";
		document.getElementById('CCQ').style.display = "none";
		document.getElementById('QuestionTopic_CCQ').style.visibility = "hidden";		
		document.getElementById('HRQ').style.display = "none";
		document.getElementById('QuestionTopic_HRQ').style.visibility = "hidden";
		document.getElementById('TSQ').style.display = "none";		
		document.getElementById('Product_TSQ').style.visibility = "hidden";		
		document.getElementById('Priority_TSQ').style.visibility = "hidden";
		document.getElementById('SupportNote').style.visibility = "hidden";			
		document.getElementById('Company_REQ').style.visibility = "hidden";		
		document.getElementById('City_REQ').style.visibility = "hidden";
		document.getElementById('State_REQ').style.visibility = "hidden";		
		document.getElementById('Zip_REQ').style.visibility = "hidden";}							
	else if (cat == 'Customer Care') {
		document.getElementById('BIQ').style.display = "none";
		document.getElementById('QuestionTopic_BIQ').style.visibility = "hidden";
		document.getElementById('CCQ').style.display = "inline";
		document.getElementById('QuestionTopic_CCQ').style.visibility = "visible";		
		document.getElementById('HRQ').style.display = "none";
		document.getElementById('QuestionTopic_HRQ').style.visibility = "hidden";
		document.getElementById('TSQ').style.display = "none";		
		document.getElementById('Product_TSQ').style.visibility = "hidden";		
		document.getElementById('Priority_TSQ').style.visibility = "hidden";
		document.getElementById('SupportNote').style.visibility = "hidden";			
		document.getElementById('Company_REQ').style.visibility = "hidden";				
		document.getElementById('City_REQ').style.visibility = "hidden";
		document.getElementById('State_REQ').style.visibility = "hidden";		
		document.getElementById('Zip_REQ').style.visibility = "hidden";}										
	else if (cat == 'Human Resources') {
		document.getElementById('BIQ').style.display = "none";
		document.getElementById('QuestionTopic_BIQ').style.visibility = "hidden";
		document.getElementById('CCQ').style.display = "none";
		document.getElementById('QuestionTopic_CCQ').style.visibility = "hidden";		
		document.getElementById('HRQ').style.display = "inline";
		document.getElementById('QuestionTopic_HRQ').style.visibility = "visible";
		document.getElementById('TSQ').style.display = "none";		
		document.getElementById('Product_TSQ').style.visibility = "hidden";		
		document.getElementById('Priority_TSQ').style.visibility = "hidden";
		document.getElementById('SupportNote').style.visibility = "hidden";			
		document.getElementById('Company_REQ').style.visibility = "hidden";				
		document.getElementById('City_REQ').style.visibility = "hidden";
		document.getElementById('State_REQ').style.visibility = "hidden";		
		document.getElementById('Zip_REQ').style.visibility = "hidden";}
	else if (cat == 'IT Technical Support') {
		document.getElementById('BIQ').style.display = "none";
		document.getElementById('QuestionTopic_BIQ').style.visibility = "hidden";
		document.getElementById('CCQ').style.display = "none";
		document.getElementById('QuestionTopic_CCQ').style.visibility = "hidden";		
		document.getElementById('HRQ').style.display = "none";
		document.getElementById('QuestionTopic_HRQ').style.visibility = "hidden";		
		document.getElementById('TSQ').style.display = "inline";		
		document.getElementById('Product_TSQ').style.visibility = "visible";		
		document.getElementById('Priority_TSQ').style.visibility = "visible";
		document.getElementById('SupportNote').style.visibility = "visible";		
		document.getElementById('Company_REQ').style.visibility = "visible";		
		document.getElementById('City_REQ').style.visibility = "hidden";
		document.getElementById('State_REQ').style.visibility = "hidden";		
		document.getElementById('Zip_REQ').style.visibility = "hidden";}		
	else {		
		document.getElementById('BIQ').style.display = "none";
		document.getElementById('QuestionTopic_BIQ').style.visibility = "hidden";
		document.getElementById('CCQ').style.display = "none";
		document.getElementById('QuestionTopic_CCQ').style.visibility = "hidden";		
		document.getElementById('HRQ').style.display = "none";
		document.getElementById('QuestionTopic_HRQ').style.visibility = "hidden";
		document.getElementById('TSQ').style.display = "none";		
		document.getElementById('Product_TSQ').style.visibility = "hidden";		
		document.getElementById('Priority_TSQ').style.visibility = "hidden";
		document.getElementById('SupportNote').style.visibility = "hidden";			
		document.getElementById('Company_REQ').style.visibility = "hidden";				
		
		if (cat == 'Sales & Marketing') {
			document.getElementById('City_REQ').style.visibility = "visible";
			document.getElementById('State_REQ').style.visibility = "visible";		
			document.getElementById('Zip_REQ').style.visibility = "visible";}
		else {
			document.getElementById('City_REQ').style.visibility = "hidden";
			document.getElementById('State_REQ').style.visibility = "hidden";		
			document.getElementById('Zip_REQ').style.visibility = "hidden";}
		}		
					
	document.frmContact.QuestionTopic.value = "";
	document.frmContact.AccountNumber.value = "";
	document.frmContact.DateOfService.value = "";
	
}

function CheckForm_frmContact()
{
	document.frmContact.btnSubmit.disabled = true;
	if (document.frmContact.FirstName.value == "") 
		{alert("Please enter your First Name.");
		document.frmContact.FirstName.focus();
		document.frmContact.btnSubmit.disabled = false;		
		return false;}
	if (document.frmContact.LastName.value == "") 
		{alert("Please enter your Last Name.");
		document.frmContact.LastName.focus();
		document.frmContact.btnSubmit.disabled = false;		
		return false;}	 			 	
	if (document.frmContact.PhoneNumber.value == "" && document.frmContact.EmailAddress.value == "")
		{alert("Please enter either a valid Phone Number or a valid Email Address.");
		document.frmContact.PhoneNumber.focus();
		document.frmContact.btnSubmit.disabled = false;
		return false;}
	if (!_CF_checkphone(document.frmContact.PhoneNumber.value))
		{alert("Invalid Phone Number. Please enter a valid Phone Number, format = xxx-xxx-xxxx.");
		document.frmContact.PhoneNumber.focus();
		document.frmContact.btnSubmit.disabled = false;
		return false;}
	if (document.frmContact.PhoneNumber.value != "" && document.frmContact.PhoneNumberTime[0].checked == false && document.frmContact.PhoneNumberTime[1].checked == false)
		{alert("Please select Daytime or Evening for your Phone Number.");
		document.frmContact.PhoneNumber.focus();
		document.frmContact.btnSubmit.disabled = false;
		return false;}		
	if (document.frmContact.EmailAddress.value != "" && (document.frmContact.EmailAddress.value.indexOf ('@', 1) == -1 || document.frmContact.EmailAddress.value.indexOf ('.', 3) == -1)) 
		{alert("Invalid Email Address. Please enter a valid Email Address.");
		document.frmContact.EmailAddress.focus();
		document.frmContact.btnSubmit.disabled = false;		
		return false;} 					
	if (!_CF_checkzip(document.frmContact.Zip.value))
		{alert("Invalid Zip Code. Please enter a valid Zip Code.");
		document.frmContact.Zip.focus();
		document.frmContact.btnSubmit.disabled = false;
		return false;}
	if (document.frmContact.QuestionCategory.value == "") 
		{alert("Please select a Question Category.");
		document.frmContact.QuestionCategory.focus();
		document.frmContact.btnSubmit.disabled = false;		
		return false;}			
	if (document.frmContact.QuestionCategory.value == "Billing"){
		if (document.frmContact.QuestionTopic_BIQ.value == "") 
			{alert("Please select a Question Topic.");
			document.frmContact.QuestionTopic_BIQ.focus();
			document.frmContact.btnSubmit.disabled = false;		
			return false;}		
		if (document.frmContact.DateOfService.value == "") 
			{alert("Please select your Date Of Service.");
			/* document.frmContact.DateOfService.select();      TREX - can't move focus to field with onFocus and onBlur events */
			document.frmContact.btnSubmit.disabled = false;		
			return false;}
		}
	if (document.frmContact.QuestionCategory.value == "Customer Care"){
		if (document.frmContact.QuestionTopic_CCQ.value == "") 
			{alert("Please select a Question Topic.");
			document.frmContact.QuestionTopic_CCQ.focus();
			document.frmContact.btnSubmit.disabled = false;		
			return false;}
		}
	if (document.frmContact.QuestionCategory.value == "Human Resources"){
		if (document.frmContact.QuestionTopic_HRQ.value == "") 
			{alert("Please select a Question Topic.");
			document.frmContact.QuestionTopic_HRQ.focus();
			document.frmContact.btnSubmit.disabled = false;		
			return false;}
		}												
	if (document.frmContact.QuestionCategory.value == "Sales & Marketing"){
		if (document.frmContact.City.value == "") 
			{alert("Please enter your City.");
			document.frmContact.City.focus();
			document.frmContact.btnSubmit.disabled = false;		
			return false;}
		if (document.frmContact.State.value == "") 
			{alert("Please select your State.");
			document.frmContact.State.focus();
			document.frmContact.btnSubmit.disabled = false;		
			return false;}
		if (document.frmContact.Zip.value == "" || !_CF_checkzip(document.frmContact.Zip.value)) 
			{alert("Please enter a valid Zip Code.");
			document.frmContact.Zip.focus();
			document.frmContact.btnSubmit.disabled = false;		
			return false;}			
		}
	if (document.frmContact.QuestionCategory.value == "IT Technical Support"){
		if (document.frmContact.Product_TSQ.value == "") 
			{alert("Please select a Product.");
			document.frmContact.Product_TSQ.focus();
			document.frmContact.btnSubmit.disabled = false;		
			return false;}		
		if (document.frmContact.Priority_TSQ.value == "") 
			{alert("Please select a Priority.");
			document.frmContact.Priority_TSQ.focus();
			document.frmContact.btnSubmit.disabled = false;		
			return false;}	
		if (document.frmContact.ProblemSummary.value == "") 
			{alert("Please enter a Problem Summary.");
			document.frmContact.ProblemSummary.focus();
			document.frmContact.btnSubmit.disabled = false;		
			return false;}
		if (document.frmContact.CompanyName.value == "") 
			{alert("Please enter your Company Name.");
			document.frmContact.CompanyName.focus();
			document.frmContact.btnSubmit.disabled = false;		
			return false;}						
		}		
	if (document.frmContact.Message.value == "") 
		{alert("Please enter your message.");
		document.frmContact.Message.focus();
		document.frmContact.btnSubmit.disabled = false;		
		return false;}
	if (document.frmContact.Message.value.length > 4000) 
		{alert("Message maximum size is 4000 characters. Current Message size is " + document.frmContact.Message.value.length + " characters.");
		document.frmContact.Message.focus();
		document.frmContact.btnSubmit.disabled = false;
		return false;}													

	document.frmContact.submit();
}
//-->