﻿<!-- 
function trim_field_value(form_name, field){
	var re = /( )*/;
	var the_form = document.forms[form_name];
	var the_value =  eval('the_form.' + field + '.value');
	var trim_value = the_value.replace(re, "");

	return trim_value;
}

function check_mail_validity(form_name, mail){
	var reg=/^[a-z0-9]+([-_\.]?[a-z0-9])+@[a-z0-9]+([-_\.]?[a-z0-9])+\.[a-z]{2,4}?$/;
	var the_form = document.forms[form_name];
	var text = eval('the_form.' + mail + '.value');
	var result = text.match(reg);
	
	return result;
}


var elementLabel = "Изтрий";
function onClickHunter_onclick() {
	if ( window.event.srcElement.innerText == elementLabel ) 
	{
		window.event.returnValue = window.confirm( "Сигурни ли сте, че искате да изтриете този запис?" );
	}
	
}

function checkInput() 
{
	if (document.forms[0].newpsd.value!=document.forms[0].renewpsd.value) 
	{
		alert("Retype new password!");
		document.forms[0].renewpsd.focus();
		return false;
	}
}


function ShowHideBlock(blockID)
{

	var itemsBlock = document.getElementById(blockID);
	if (itemsBlock.style.display == "none")
	{
		itemsBlock.style.display = "block";
	}
	else
	{
		itemsBlock.style.display = "none";
	}

}

function checkSubscribe() 
{
	var obj_form = document.forms['SubscriptionForm'];

	trim_name_bg = trim_field_value('SubscriptionForm', 'firstName');	
	if (!trim_name_bg){
		alert("First Name?");
		obj_form.firstName.focus();
		return false;
	}
	
	trim_name_bg = trim_field_value('SubscriptionForm', 'lastName');	
	if (!trim_name_bg){
		alert("Last Name?");
		obj_form.lastName.focus();
		return false;
	}
	
	trim_email = trim_field_value('SubscriptionForm', 'email');	
	if (!trim_email){
		alert("Email?");
		obj_form.email.focus();
		return false;
	} else 
	{
		valid_email = check_mail_validity('SubscriptionForm', 'email')
		if (!valid_email) {
			alert("Valid mail");
			obj_form.email.focus();
			return false;
		}
	}

}

function SubscribersAll(formElement)
{
	isChecked = formElement.checked;
	
	var inputs = document.getElementsByTagName("input");
	
	for (var i = 0; i < inputs.length; i ++)
	{
		if (inputs[i].type == "checkbox")
		{
			inputs[i].checked = isChecked;
		}
	}
	
	//alert(isChecked);
}






	
// -->