
	function isNonEmpty(obj)

{

    retval = false;

    for (var i = 0; i < obj.value.length; i++) {

        if (obj.value.substring(i, i + 1) != " ") {

            retval = true;

            break;

        }

    }

    return retval;

}




function check1(form)
{

    if(!isNonEmpty(document.getElementById('name'))) {

		alert("You forgot to fill <Name> field.");

		return false;

    }
   
    if(!isNonEmpty(document.getElementById('password'))) {

		alert("You forgot to fill <Password> field.");

		return false;

    }

    if(document.getElementById('password').value!=document.getElementById('password1').value) {

		alert("Passwords are different.");

		return false;

    }
    
    
  if(!isNonEmpty(document.getElementById('email'))) {

		alert("You forgot to fill <E-Mail> field.");

		return false;

    }

    regexp = /^([a-zA-Z0-9_\-])+(\.([a-zA-Z0-9_\-])+)*@(((\[)?(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5]))(\])?))|((([a-zA-Z0-9\-])+\.)+([a-zA-Z\-])+))$/gi;

    if(isNonEmpty(document.getElementById('email')) && (document.getElementById('email').value.search(regexp)==-1)) {

		alert("Incorrect <E-Mail>.");

		return false;

    }

	form.submit();
    return false;

}



function check2(form)
{

    if(!isNonEmpty(document.getElementById('name'))) {

		alert("You forgot to fill <Name> field.");

		return false;

    }
   
    if(!isNonEmpty(document.getElementById('phone'))) {

		alert("You forgot to fill <Phone> field.");

		return false;

    }

    if ( (!document.getElementById('found1').checked) &&
    (!document.getElementById('found2').checked) &&
    (!document.getElementById('found3').checked) &&
    (!document.getElementById('found4').checked))
    {

		alert("You forgot to fill <How did you find us> field.");

		return false;

    }
    
    
  if(!isNonEmpty(document.getElementById('email'))) {

		alert("You forgot to fill <E-Mail> field.");

		return false;

    }

    regexp = /^([a-zA-Z0-9_\-])+(\.([a-zA-Z0-9_\-])+)*@(((\[)?(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5]))(\])?))|((([a-zA-Z0-9\-])+\.)+([a-zA-Z\-])+))$/gi;

    if(isNonEmpty(document.getElementById('email')) && (document.getElementById('email').value.search(regexp)==-1)) {

		alert("Incorrect <E-Mail>.");

		return false;

    }

	form.submit();
    return false;

}


