function oc(a)
{
  var o = {};
  for(var i=0;i<a.length;i++)
  {
    o[a[i]]='';
  }
  return o;
}

(function ($) {


  $(document).ready(function () {

    var disableit=["3512","3168","3291","3170", "3165","3598"];
    /* do your magic */
    $('#edit-submitted-how-did-you-hear-about-us').change(function(){
      var val = $(this).val();
      if(val in oc(disableit)) {
        $('#webform-component-please-specify-exact-station-or-print-source').hide();
      } else {
        $('#webform-component-please-specify-exact-station-or-print-source').fadeIn();
      }
    })
  });


})(jQuery);;
(function ($) {

$(document).ready(function(){

	$('#webform-client-form-7 #webform-component-zip-code input').bind('keypress', function(e) {
		if ( e.which!=8 && e.which!=0 && (e.which<48 || e.which>57)){
			input = $(this);
			if ($(input).next('div.tooltip').length<=0){
				$(input).after('<div class="tooltip">5 digit zip code only please.</div>').show();
				setTimeout(function(){ $(input).next('div.tooltip').hide(); }, 4000);
			}else{
				$(input).next('div.tooltip').show();
				setTimeout(function(){ $(input).next('div.tooltip').hide(); }, 4000);
			}
			return false;
		}else{
			return true;
		}
		
		//return ( e.which!=8 && e.which!=0 && (e.which<48 || e.which>57)) ? false : true ;
	});

	$('#webform-client-form-7 #webform-component-phone-number input').bind('keypress', function(e) {
		if ( e.which!=8 && e.which!=0 && e.which!=45 && (e.which<47 || e.which>57)){
			input = $(this);
			if ($(input).next('div.tooltip').length<=0){
				$(input).after('<div class="tooltip" style="margin-left: 330px;">10 digit phone number only please.</div>').show();
				setTimeout(function(){ $(input).next('div.tooltip').hide(); }, 4000);
			}else{
				$(input).next('div.tooltip').show();
				setTimeout(function(){ $(input).next('div.tooltip').hide(); }, 4000);
			}
			return false;
		}else{
			return true;
		}
		
		//return ( e.which!=8 && e.which!=0 && (e.which<48 || e.which>57)) ? false : true ;
	});

	$('#webform-client-form-7 #webform-component-phone-number input').bind('blur', function(e) {
		input = $(this);
		var phone = $(input).val();
	    var intRegex = /^\d+$/;
		var num = 0;
		for (var i=0,c; c=phone.substr(i++,1);){
			if(intRegex.test(c)){
				num++;
			}
		}
		
		if (num<10 || num>10) {
			if ($(input).next('div.tooltip').length<=0){
				$(input).after('<div class="tooltip" style="margin-left: 330px;">10 digit phone number only please.</div>').show();
				$('#webform-client-form-7 #edit-submit').attr('disabled',true);
			}else{
				$(input).next('div.tooltip').show();
				$('#webform-client-form-7 #edit-submit').attr('disabled',true);
			}
		}else{
			$(input).next('div.tooltip').hide();
			$('#webform-client-form-7 #edit-submit').attr('disabled',false);
		}
	});

});

})(jQuery);;

