function isMail(field){
	var regExp = new RegExp("^[a-z0-9][a-z0-9_.-]*@[a-z0-9_.-]+\\.[a-z]{2,4}$", "i");
	if(!regExp.test(field.value)) return false;
	else return true;
}

/*function detailsClient(){
  var lib_plans = document.getElementById('lib_plans')
  if (lib_plans.style.display == 'none') {
    lib_plans.style.display = 'block'
  } else {
    lib_plans.style.display = 'none'
  }
}*/

function textCounter(field, countfield, maxlimit) {
	if (field.value.length > maxlimit) // if too long...trim it!
		field.value = field.value.substring(0, maxlimit);
	// otherwise, update 'characters left' counter
	else 
		countfield.value = maxlimit - field.value.length;

}
// -----------------------------------
// button rollover
// -----------------------------------

function btnRollover() {
 $(':image')
 .mouseover(function() {
 $(this).attr('src',$(this).attr('src').slice(0,-4) + '_on.png');
 })
 .mouseout (function() {
 $(this).attr('src',$(this).attr('src').replace('_on', ''));
 });
}
//--------------------------------------------------------------------------//
$(function() {
 btnRollover();
});

/*
 * share current page on facebook
 */
function fbs_click()
{
  if (arguments.length == 2)
  {
    var u = arguments[0];
    var t = arguments[1];
  }
  else if (arguments.length == 1)
  {
    var u = arguments[0];
    var t = encodeURIComponent(document.title);
  }
  else
  {
    var u = encodeURIComponent(location.href);
    var t = encodeURIComponent(document.title);
  }

  window.open('http://www.facebook.com/sharer.php?u=' + u + '&t=' + t, 'sharer', 'toolbar=0,status=0,width=626,height=436');

  return false;
}
