/**
  * This source is part of the Times of Money Financial Portal Software System and is 
 * copyrighted by i-flex Solutions Limited.

 * All rights reserved.  No part of this work may be reproduced, stored in a retrieval system, 
 * adopted or transmitted in any form or by any means, electronic, mechanical, photographic, 
 * graphic, optic recording or otherwise, translated in any language or computer language, 
 * without the prior written permission of i-flex Solutions Limited.

 * i-flex Solutions Limited.
 * 10-11, SDF I, SEEPZ, Andheri (East),
 * Mumbai - 400 096.
 * India

 * Copyright © 2000 i-flex Solutions Limited.
*/

var customer_service_action = "";

function customer_service_submit_action(name,email,msg,frmName)
{
 validate_mandatory_tb(name);
 validate_mandatory_tb(email);

 if(email.value!="")
 validate_email_value(email);

 validate_mandatory_tb(msg);

 
 validate_textbox_space(name);
 validate_textbox_space(email);
 validate_textbox_space(msg);

 
 
 return check_display_errors(frmName);
}

function customer_service_submit(name,email,msg,frmName)
{
 initialize_error_msgs();
 if(customer_service_action="send") 
 {
  return customer_service_submit_action(name,email,msg,frmName);
 } 
}

function customer_service_set_action(button)
{
 customer_service_action=button.name;
}


//Added by Manish Sachdev for Modifed Customer Service Form

function customer_service_validate(cname,email,phone,question,qrymessage,browserversion,firewall,proxy,machine,trouble,errmessage,os,browser,netaccess,frequency,encryption,encrypt_other,access_other,CheckScript,cust)
{
	initialize_error_msgs();
	
	//007 code is appended to the string technical difficulties so that talisma can recognize
	//emails with this subject and then sort it to separate folder
	if(question.value=="Technical Difficulties 007")
	{
		validate_mandatory_tb_with_message(cname, "Name cannot be left blank");
		validate_textbox_space_with_msg(cname," Name");
		
		validate_mandatory_tb_with_message(phone, "Contact number cannot be left blank");
		validate_textbox_space_with_msg(phone," Contact number");
		validate_numeric_value_with_msg(phone,"Contact number ");
		
		validate_mandatory_tb_with_message(os, "Operating System cannot be left blank");
		validate_mandatory_tb_with_message(browser, "Browser cannot be left blank");
		validate_mandatory_tb_with_message(encryption, "Browser encryption cannot be left blank");
		validate_mandatory_tb_with_message(CheckScript, "Please mention whether JavaScript is enabled on your browser");

		validate_mandatory_tb_with_message(netaccess, "Internet Access cannot be left blank");
		validate_mandatory_tb_with_message(frequency, "Frequency of problem cannot be left blank");
		validate_email_value(email);
		validate_mandatory_tb_with_message(browserversion, "Browser version cannot be left blank");
		validate_textbox_space_with_msg(browserversion," Browser version");
		
		validate_mandatory_tb_with_message(firewall, "Please mention if you access internet via firewall");
		validate_mandatory_tb_with_message(proxy, "Please mention if you access internet via proxy");
		validate_mandatory_tb_with_message(machine, "Please mention whether you faced the same problem on different machines");	
	
		validate_mandatory_tb_with_message(errmessage, "Problem faced / Error Message cannot be left blank");
		validate_textbox_space_with_msg(errmessage,"Problem faced / Error Message");
		validate_numeric_value_with_msg(browserversion,"Browser version ");
		validate_mandatory_tb_with_message(trouble, "Please mention whether you tried the trouble login link");


		if(encryption.value == "Others")
		{
			validate_mandatory_tb_with_message(encrypt_other, "Please enter your browser encryption");
			validate_textbox_space_with_msg(encrypt_other,"Browser encryption");
		}
		
		if(netaccess.value == "Others")
		{
			validate_mandatory_tb_with_message(access_other, "Please mention how you access the internet");
			validate_textbox_space_with_msg(access_other,"Net access");
		}
			
	}
	else
	{
		validate_mandatory_tb_with_message(cname, "Name cannot be left blank");
		validate_email_value(email);
		
		validate_mandatory_tb_with_message(phone, "Contact number cannot be left blank");
		validate_numeric_value_with_msg(phone,"Contact number ");
		
		validate_mandatory_tb_with_message(question, "Nature of Question cannot be left blank");
		validate_mandatory_tb_with_message(qrymessage, "Query cannot be left blank");
		
		validate_textbox_space_with_msg(qrymessage,"Query");
		
	}
	

	return check_display_errors(cust);
}
