$(document).ready( function(){
   PEPS.rollover.init();
});

PEPS = {};

PEPS.rollover =
{
   init: function(){
      this.preload();
     
      $(".ro").hover(
         function () { $(this).attr( 'src', PEPS.rollover.newimage($(this).attr('src')) ); },
         function () { $(this).attr( 'src', PEPS.rollover.oldimage($(this).attr('src')) ); }
      );
   },

   preload: function(){
      $(window).bind('load', function() {
         $('.ro').each( function( key, elm ) { $('<img>').attr( 'src', PEPS.rollover.newimage( $(this).attr('src') ) ); });
      });
   },
   
   newimage: function( src ){
      return src.substring( 0, src.search(/(\.[a-z]+)$/) ) + '_over' + src.match(/(\.[a-z]+)$/)[0];
   },

   oldimage: function( src ){
      return src.replace(/_over\./, '.');
   }
};


// FORM VALIDATION
function verify() {
	var themessage = "You are required to complete the following fields: \n\n";
	if (document.comments.name.value=="") {
		themessage = themessage + " -  Name\n";
	}
	if (document.comments.address.value=="") {
		themessage = themessage + " -  Address\n";
	}
	if (document.comments.phone.value=="") {
		themessage = themessage + " -  Phone\n";
	}
	if (document.comments.email.value=="") {
		themessage = themessage + " -  Email\n";
	}
	if (document.comments.comments.value=="") {
		themessage = themessage + " -  Comments\n";
	}
	
	if (themessage == "You are required to complete the following fields: \n\n") {
		document.quote.submit();
	}else{
		alert(themessage);
	return false;
   }
}