$(document).ready(function() {

  // any image with a 'toggle' class will toggle when you mouse over it
  // (unless it has the 'on' class, in which case it should stay on)
  $("img.toggle:not(.on)").hover(function() {
      var src = $(this).attr('src');
      src = src.replace(/_(on|off)\./, '_on.');
      $(this).attr('src', src);

    }, function() {
      var src = $(this).attr('src');
      src = src.replace(/_(on|off)\./, '_off.');
      $(this).attr('src', src);

    });

  // anything with an 'on' class should be toggled to 'on'
  $("img.on").each(function() {
      var src = $(this).attr('src');
      src = src.replace(/_(on|off)\./, '_selected.');
      $(this).attr('src', src);
    });  
    
    $("#members_container img").hover(function() {
      	$(this).addClass("on");
    },function () {
        $(this).removeClass("on");
      }
	
	);
	
	$(document).ready(
		function(){					
			$('.fade').innerfade({
				speed: 1000,
				timeout: 3000,
				type: 'random_start',
				containerheight: '144px'
			});
			
			$('.fade2').innerfade({
				speed: 1000,
				timeout: 3000,
				type: 'random_start',
				containerheight: '162px'
			});
	});
	
	var url = window.location;
	
	url = url.toString().split("/");
	var last = url.length;
	var file = url[last-1];
	
	$("#nav a[href='"+file+"']").addClass("activo");    
	
});

function validateContactData(){
	var s = "";
	with (document.frmContact) {
	if (Name.value.length == 0) {
		s += "\nPlease provide your name."
	}
	if (Email.value.length == 0) {
		s += "\nPlease provide your email address."
	}
	if (Comments.value.length == 0) {
		s += "\nPlease tell me your reason for contacting me."
	}
	if (s.length==0) {
		with (document.frmContact) {
		} 
		return true;
	}
		else {
			alert("The form could not be submitted for the following reason(s):\n" + s);
			return false;
		}
	}
}

function validateLoginData(){
	var s = "";
	with (document.frmLogin) {
	if (username.value.length == 0) {
		s += "\nPlease provide your username."
	}
	if (password.value.length == 0) {
		s += "\nPlease provide a password."
	}
	if (s.length==0) {
		with (document.frmLogin) {
		} 
		return true;
	}
		else {
			alert("The form could not be submitted for the following reason(s):\n" + s);
			return false;
		}
	}
}


