function count(a){
   
   
  document.getElementById("total_span").innerHTML = parseFloat(document.getElementById("sum").value) - (parseFloat(document.getElementById("sum").value)*a)/100;
  document.getElementById("total").value = parseFloat(document.getElementById("sum").value) - (parseFloat(document.getElementById("sum").value)*a)/100; 
  
  if(!parseFloat(document.getElementById("sum").value)){
     
     document.getElementById("total_span").innerHTML = "0.00";
     document.getElementById("total").value = 0;
  }
   
}


function subscribe_form()
	{////////////////////////////////////////////////////////////////////////////////////////////////
		if (!isEmailAddress(document.subscribe.e_mail.value))
			{
				alert('AlertText7');
				document.subscribe.e_mail.focus();
				return false;
			}
	}////////////////////////////////////////////////////////////////////////////////////////////////
	
	function f_pass_form()
	{////////////////////////////////////////////////////////////////////////////////////////////////
		if (!isEmailAddress(document.f_pass.e_mail.value))
			{
				alert('AlertText7');
				document.f_pass.e_mail.focus();
				return false;
			}
	}////////////////////////////////////////////////////////////////////////////////////////////////	
	
	function c_pass_form()
	{////////////////////////////////////////////////////////////////////////////////////////////////
		if (document.c_pass.password_old.value.length==0)
		{		  
			alert('AlertText1');
			document.c_pass.password_old.focus();
			return false;
		}
			
		if (document.c_pass.password_old.value.length<6)
		{
			alert('AlertText2');
			document.c_pass.password_old.focus();
			return false;
		}	
		/// 
		if (document.c_pass.password.value.length==0)
		{
			alert('AlertText3');
			document.c_pass.password.focus();
			return false;
		}
			
		if (document.c_pass.password.value.length<6)
		{
			alert('AlertText4');
			document.c_pass.password.focus();
			return false;
		}	
		
		
		if (document.c_pass.password_re.value.length==0)
		{
			alert('AlertText5');
			document.c_pass.password_re.focus();
			return false;
		}	
		
		if (document.c_pass.password_re.value != document.c_pass.password.value)
		{
			alert('AlertText6');
			document.c_pass.password_re.focus();
			return false;
		}	
	}////////////////////////////////////////////////////////////////////////////////////////////////
	
	
	function feedback_form()
	{////////////////////////////////////////////////////////////////////////////////////////////////
	
		if (!isEmailAddress(document.reg.e_mail.value))
		{
			alert('AlertText7');
			document.reg.e_mail.focus();
			return false;
		}
			
		if (document.reg.password.value.length==0)
		{
			alert('AlertText8');
			document.reg.password.focus();
			return false;
		}
			
		if (document.reg.password.value.length<6)
		{
			alert('AlertText9');
			document.reg.password.focus();
			return false;
		}	
		
		if (document.reg.password_re.value.length==0)
		{
			alert('AlertText10');
			document.reg.password_re.focus();
			return false;
		}	
		
		if (document.reg.password_re.value != document.reg.password.value)
		{
			alert('AlertText11');
			document.reg.password_re.focus();
			return false;
		}	
		
		
		if (document.reg.first_name.value.length==0)
			{
				alert('AlertText12');
				document.reg.first_name.focus();
				return false;
			}
		
		if (document.reg.middle_name.value.length==0)
			{
				alert('AlertText12');
				document.reg.middle_name.focus();
				return false;
			}
		
		if (document.reg.last_name.value.length==0)
			{
				alert('AlertText12');
				document.reg.last_name.focus();
				return false;
			}
			
				
		if (document.reg.address1.value.length==0)
		{
			alert('AlertText14');
			document.reg.address1.focus();
			return false;
		}
		
		if (document.reg.city.value.length==0)
		{
			alert('AlertText15');
			document.reg.city.focus();
			return false;
		}
		
		if (document.reg.state.value=="not")
		{
			alert('AlertText16');
			document.reg.state.focus();
			return false;
		}
		
		if (document.reg.country.value=="not")
		{
			alert('AlertText17');
			document.reg.country.focus();
			return false;
		}
		
		if (document.reg.zip.value.length==0)
		{
			alert('AlertText18');
			document.reg.zip.focus();
			return false;
		}		
		
		if (document.reg.day.value.length=="not" || document.reg.month.value.length=="not" || document.reg.year.value.length=="not" || document.reg.year.value.length==0)
		{
			alert('AlertText19');
			document.reg.day.focus();
			return false;
		}		
		
		if (document.reg.term.checked != true)
			{
				alert('Terms');
				document.reg.term.focus();
				return false;
			}
		
		return true;	
	}////////////////////////////////////////////////////////////////////////////////////////////////

	
	function validChars(e, goods)
	{////////////////////////////////////////////////////////////////////////////////////////////////
		var key, keychar;
		key = (window.event) ? window.event.keyCode : ((e) ? e.which : null);
		if (key == null) return true;
	 
		keychar = String.fromCharCode(key);
		keychar = keychar.toLowerCase();
		goods = goods.toLowerCase();
	 
		if (goods.indexOf(keychar) != -1)
			return true;
	 
		if (key==null || key==0 || key==8 || key==9 || key==13 || key==27)
			return true;
	 
		return false;
	}////////////////////////////////////////////////////////////////////////////////////////////////


function isEmailAddress (mail) 
{
  		var addressPattern = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
  		return addressPattern.test(mail);
}

