jQuery problem with if()
<p>I'm trying to filtering two links (containing 'next' and 'previous'), then if it finds one of them I append a link to load a photo. My problem is that I want append only one link at time, the Load Next link if it find the Next text and the Prev. link if it find the Previous text. If I write this it won't work  </p>

<pre><code>$(document).ready(function(){

if  ($(".forumrow table").find('a').filter(':contains(Next)')) {
$('.blockhead a').filter('a:last[href^="http://site.com/showgallery.php?cat="]').html('&lt;a class="loadnextone" href="#"&gt;Load next&lt;/a&gt;');
$('a.loadnextone').live("click",function(event) {
event.preventDefault();
var next1 = $(".forumrow table").find('a').filter(':contains(Next)').attr('href');
var next1cat1split =  $('.blockhead a').filter('a:last[href^="http://site.com/showgallery.php?cat="]').attr('href').split(/=/)[1];
$(".nextoz").load(next1+" ol.floatcontainer");
});
}

if ($(".forumrow table").find('a').filter(':contains(Prev)')) {
$('.blockhead a').filter('a:last[href^="http://site.com/showgallery.php?cat="]').html('&lt;a class="loadprevone" href="#"&gt;Load prev&lt;/a&gt;');
$('a.loadprevone').live("click",function(event) {
event.preventDefault();
var prev1 = $(".forumrow table").find('a').filter(':contains(prev)').attr('href');
var prev1cat1split =  $('.blockhead a').filter('a:last[href^="http://site.com/showgallery.php?cat="]').attr('href').split(/=/)[1];
$(".prevozz").load(prev1+" ol.floatcontainer");
});
}

});
</code></pre>

<p>How can I do?</p>
