function isValidEmail(str) {

   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
 
}

function IsNumeric(sText)

{
   var ValidChars = "0123456789-";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }

function checkscript() {
	if (document.forms[0].T1.value=='') {
		// something is wrong
		alert('Podaj nazwę firmy');
		return false;
	}
  	else if (document.forms[0].T2.value=='') {
		// something else is wrong
		alert('Podaj adres firmy');
		return false;
	}
	else if (document.forms[0].T3.value=='') {
		// something else is wrong
		alert('Podaj wydział firmy');
		return false;
	}
	else if (document.forms[0].T4.value=='') {
		// something else is wrong
		alert('Podaj dane osoby kontaktowej');
		return false;
	}
	else if ((document.forms[0].T5.value=='')||(!IsNumeric(document.forms[0].T5.value))) {
		// something else is wrong
		alert("Podaj poprawny nr telefonu\n\n(bez spacji,możesz użyć myślnika)");
		return false;
	}
	else if ((document.forms[0].T6.value=='')||(!isValidEmail(document.forms[0].T6.value))) {
		// something else is wrong
		alert('Podaj poprawny adres e-mail');
		return false;
	}

	// If the script makes it to here, everything is OK,
	// so you can submit the form

	return true;
}





function checkscript2() {

	if ((document.forms[0].Mail.value=='')||(!isValidEmail(document.forms[0].Mail.value))) {
		// something else is wrong
		alert('Podaj poprawny adres e-mail');
		return false;
	}

	// If the script makes it to here, everything is OK,
	// so you can submit the form

	return true;
}