function is_int(value){
  if((parseFloat(value) == parseInt(value)) && !isNaN(parseInt(value))){
      return true;
 } else {
      return false;
 }
}  

function is_not_blank(value){
  if((value != null) && (value != '')){
      return true;
 } else {
      return false;
 }
}

function isEmail(Mail) {
  Mail=Mail.toLowerCase();
  return (Mail.search(/^([a-z]+)([a-z0-9\-\_\.]{1,100})([a-z0-9]+)\@([a-z0-9]+)([a-z0-9\-\.]*)([a-z0-9]+)\.([a-z]{2,6})$/) != -1);
}

function getQueryVariable(variable) {
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
      return pair[1];
    }
  }
}

var nbaMobileSignuptext = new Array ();
nbaMobileSignuptext[0] = '&nbsp;';
nbaMobileSignuptext[1] = 'Thank you for signing up to receive information about NBA GAME TIME for the upcoming year.';
nbaMobileSignuptext[2] = 'There was a problem processing your email signup request. Please re-enter a valid email address.';


function nbaMobileSignupDisplayText(value){
  if (is_not_blank(value) && is_int(value)){
    if(value == 1) {
      document.write(nbaMobileSignuptext[1]);
    }
    else if(value == 2)      
      alert(nbaMobileSignuptext[2]);
    else
      document.write(nbaMobileSignuptext[0]);
  }
  else{    
      document.write(nbaMobileSignuptext[0]);
  }

}
function nbaMobileSignupDisplayForm(value){
  if (is_not_blank(value) && is_int(value)){
    if(value == 1) {
     
	  document.getElementById("nbaMobileLandingForm").style.display='none';
	  
    }
  }
}

function submitForm()
{
  if(isEmail(document.nbaMobileLandingForm.email.value))
    return true;
  else {
    alert(nbaMobileSignuptext[2]);
    return false;
  }
  return true;
}
