function CheckSubscriptionForm(frmName)
{
    var idfrm=document.getElementById(frmName);
    var idemail=document.getElementById("subscription_email");
    var idname=document.getElementById("subscription_name");
    var idfirma=document.getElementById("subscription_firma");
    var idstanowisko=document.getElementById("subscription_stanowisko");
    var idnlId1=document.getElementById("subscription_nlId1");
    var idnlId2=document.getElementById("subscription_nlId2");


    if(!CyJS_Utils_IsEmailValid(idemail.value)){
      alert("Nieprawidłowy format e-mail");
    }else {

      if(!idemail.value || !idname.value || !idfirma.value){
         alert("Wszystkie dane s± obowi±zkowe");
         //alert("Pola oznaczone gwiazdk± nie mog± zostać puste.");
      }else{
        idfrm.submit();
      }
    }
}


function CheckSubscriptionForm_en(frmName)
{
    var idfrm=document.getElementById(frmName);
    var idemail=document.getElementById("subscription_email");
    var idname=document.getElementById("subscription_name");
    var idfirma=document.getElementById("subscription_firma");
    var idstanowisko=document.getElementById("subscription_stanowisko");
    var idnlId1=document.getElementById("subscription_nlId1");
    var idnlId2=document.getElementById("subscription_nlId2");


    if(!CyJS_Utils_IsEmailValid(idemail.value)){
      alert("Incorrect e-mail address");
    }else {

      if(!idemail.value || !idname.value || !idfirma.value){
         alert("All data are required");
         //alert("Pola oznaczone gwiazdk± nie mog± zostać puste.");
      }else{
        idfrm.submit();
      }
    }
}


function CyJS_Utils_IsEmailValid(checkThisEmail)
{
var myEMailIsValid = true;
var myAtSymbolAt = checkThisEmail.indexOf('@');
var myLastDotAt = checkThisEmail.lastIndexOf('.');
var mySpaceAt = checkThisEmail.indexOf(' ');
var myLength = checkThisEmail.length;


// at least one @ must be present and not before position 2
// @yellow.com : NOT valid
// x@yellow.com : VALID

if (myAtSymbolAt < 1 )
 {myEMailIsValid = false}


// at least one . (dot) afer the @ is required
// x@yellow : NOT valid
// x.y@yellow : NOT valid
// x@yellow.org : VALID

if (myLastDotAt < myAtSymbolAt)
 {myEMailIsValid = false}

// at least two characters [com, uk, fr, ...] must occur after the last . (dot)
// x.y@yellow. : NOT valid
// x.y@yellow.a : NOT valid
// x.y@yellow.ca : VALID

if (myLength - myLastDotAt <= 2)
 {myEMailIsValid = false}


// no empty space " " is permitted (one may trim the email)
// x.y@yell ow.com : NOT valid

if (mySpaceAt != -1)
 {myEMailIsValid = false}


/*if (myEMailIsValid == true)
 {alert("email is VALID")}
else
 {alert("email is NOT valid!")}
*/

return myEMailIsValid
}