somthing like this is what you want have not got the time to finish this good luck with the rest. may need a for loop instead
<script type="text/javascript">//<![CDATA[ jQuery(document).ready(function($){ //find each jQuery('img').each(function(){ //read attr var start = jQuery(this).attr('src'); //count amount of string var amount = start.length; //subtract the .gif 4 characters var remainder = amount-4; //replace if you like var jpeg = ".jpg"; //removes gif var maintest = start.slice(0,remainder); //final part concat string var fin = maintest+jpeg; //does not work good luck alert(fin); }); }); </script>