/**
 * Handle with services checkboxes
 * @return void
 */
function mailFormHandler()
{
   if($("#mail_receive2").is(":checked") )
   {
     $("#mail_collect").attr("disabled", true);
     $(".mail_collect").attr("style", 'color: silver;');
     $(".mail_collect .ff_control_err").attr("style", 'display: none;');
     
     $("[name=mail_often]").attr("disabled", false);
     $(".mail_often").attr("style", 'color: none;');
   }
   else if($("#mail_receive3").is(":checked") )
   {
     $("#mail_collect").attr("disabled", false);
     $(".mail_collect").attr("style", 'color: none;');
     
     $("[name=mail_often]").attr("disabled", true);
     $(".mail_often").attr("style", 'color: silver;');
     $(".mail_often .ff_control_err").attr("style", 'display: none;');
   }
   else if($("#mail_receive1").is(":checked"))
   {
     $("#mail_collect").attr("disabled", true);
     $(".mail_collect").attr("style", 'color: silver;');
     
     $("[name=mail_often]").attr("disabled", true);
     $(".mail_often").attr("style", 'color: silver;');
     
     $(".mail_often .ff_control_err").attr("style", 'display: none;');
     $(".mail_collect .ff_control_err").attr("style", 'display: none;');
   }
}

/**
 * if customer is going back - index.php
 */
if(page=='index.php')
{	
	$(document).ready(function(){
		mailFormHandler();
	  }
	);
}

/**
 * @return void
 */
function telFormHandler()
{
   if($("#tel_sms2").is(":checked") )
   {
     $("#tel_sms_mobile").attr("disabled", false);
     $(".tel_sms_mobile").attr("style", 'color: none;');

   }
   else
   {
     $("#tel_sms_mobile").attr("disabled", true);
     $(".tel_sms_mobile").attr("style", 'color: silver;');
     $(".tel_sms_mobile .ff_control_err").attr("style", 'display: none;');
   }
	
}

/**
 * if customer is going back - index.php
 */
if(page=='index.php')
{	
	$(document).ready(function(){
		telFormHandler();
	  }
	);
}

/**
 * @return void
 */
function faxFormHandler()
{
   if($("#fax_forward2").is(":checked") || $("#fax_forward3").is(":checked"))
   {
     $("#fax_forward_email").attr("disabled", false);
     $(".fax_mobile").attr("style", 'color: none;');

   }
   else
   {
     $("#fax_forward_email").attr("disabled", true);
     $(".fax_mobile").attr("style", 'color: silver;');
     $(".fax_mobile .ff_control_err").attr("style", 'display: none;');
   }
	
}

/**
 * if customer is going back - index.php
 */
if(page=='index.php')
{	
	$(document).ready(function(){
		faxFormHandler();
	  }
	);
}

/**
 * @return void
 */
function personalFormHandler()
{
   if($('#how_heard').val() == 4)
   {
     	$('#how_heard_other').attr('disabled',false);
   		$('.how_heard_other').attr('style','color: none;');
   }
   else
   {
   		$('#how_heard_other').attr('disabled',true);
     	$('.how_heard_other').attr('style','color: silver;');
   		$(".how_heard_other .ff_control_err").attr("style", 'display: none;');
   }
}


/**
 * if customer is going back - personal.php
 */
if(page=='personal.php')
{	
	$(document).ready(function(){
		personalFormHandler();
	  }
	);
}


