function strstr( haystack, needle, bool ) {
    var pos = 0;
    haystack += '';
    pos = haystack.indexOf( needle );
    if( pos == -1 ){
        return false;
    } else if( bool ){
        return haystack.substr( 0, pos );
    } else{
        return haystack.slice( pos );
    }
}
$(function(){
  swap = function(){
	if($(this).parent().parent().attr("class") == "active")
	{
	  return;
	}
	if(strstr(this.src, 'gray'))
	{
	  this.src = this.src.replace(/gray/, 'black');
	}
	else
	{
	  this.src = this.src.replace(/black/, 'gray');
	}
  };
  $(".dynamic_image").mouseover(swap).mouseout(swap);
});
