function checkEmailValid(address){
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	if (filter.test(address)){
		return true;
	}else{
		return false;
	}
}

function Swap(obj, removeRed, noHook)
{
  var imgId = obj.id+"Img";
  if($(imgId).src.indexOf('red_') != -1 || removeRed) 
  {
	if(!badForm || removeRed) {
	  $(imgId).src = $(imgId).src.replace('red_', '');
	}
  }
  else 
  {
	$(imgId).src = $(imgId).src.replace('form_', 'form_red_');
	if(noHook == null) { badForm = true; }
  }
}


function limitChars(textid, limit, infodiv){
	var text = $('#'+textid).val(); 
	var textlength = text.length;
	
	if(textlength > limit){
	
		$('#' + infodiv).html('You cannot write more then '+limit+' characters!');
		$('#'+textid).val(text.substr(0,limit));
		return false;
	
	}else{
		
		$('#' + infodiv).html('You have '+ (limit - textlength) +' characters left.');
		return true;
	
	}
}

function ValidateForm(form) 
{      

  badForm = false;
  
  /*
  if(form.staf_form_name.value == "") { badForm = true; Swap(form.staf_form_name); }
  else { Swap(form.TextBox1, true); }
  
  if(form.TextBox2.value == "" || !IsValidEmail(form.TextBox2.value)) { Swap(form.TextBox2); badForm = true; }
  else { Swap(form.TextBox2, true); }
  
  if(form.TextBox3.value == "") { Swap(form.TextBox3); badForm = true; }
  else { Swap(form.TextBox3, true); }       
  
  if(badForm) { window.scrollTo(0, 0); $('join_error').style.visibility = "visible"; }
  return !badForm;     
  */
  
}    

$(document).ready(function() {
	$("#button_send").hover(
      function () {
        this.src = 'images/button_send_over.jpg';
      }, 
      function () {
        this.src = 'images/button_send.jpg';
      }
    );
});
