// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

function mark_for_destroy(element) {
	$(element).next('.should_destroy').value = 1;
	$(element).up('.task').hide();
}

function check_creditcard_visa_mastercard_is_valid()
{ 
 if($("paymentmethod").value == 'ECA' || $("paymentmethod").value == 'VIS' || $("paymentmethod").value == 'AMX')
  {
    if ($("cardno").value.length < 15 || $("cvv").value.length < 3 || $("expy").value.length < 2 || $("expm").value.length < 2  )
    {    
  		$('cc_error').style.display = '';
      return false;
    }
    else
    {   
      return true;
    }
  }
 if($("paymentmethod").value == 'ELV' || $("paymentmethod").value == 'AP')
 {
   return true;
 }
}

function showhide_creditcard_input_fields()
{

	if($("paymentmethod").value == 'ECA' || $("paymentmethod").value == 'VIS')
	{
		$('tr_cc').style.display = '';
		$('tr_cvv').style.display = '';
		$('tr_cvv_desc').style.display = '';
		$('tr_exp').style.display = '';
	}
	else
	{	
		$('tr_cc').style.display = 'none';
		$('tr_cvv').style.display = 'none';
		$('tr_cvv_desc').style.display = 'none';
		$('tr_exp').style.display = 'none';		
	}
}
