My jquery headline and PHP query
<p>I have a jquery headline like this:</p>

<pre><code>&lt;div class="mainGallery"&gt;
  &lt;div class="main"&gt;
    &lt;div class="mainDesc"&gt;
      &lt;h2&gt; &lt;/h2&gt;
      &lt;a class="mainA" href="#"&gt; &lt;/a&gt; &lt;/div&gt;
    &lt;ul class="pg"&gt;
      &lt;li&gt; 1 &lt;a href="#" rel="Headline Title 1"&gt;&lt;/a&gt; &lt;span rel="Headline Lorem1 ipsum dolor sit amet"&gt;&lt;/span&gt;
        &lt;p rel="images/1.jpg"&gt;&lt;/p&gt;
      &lt;/li&gt;
      &lt;li&gt; 2 &lt;a href="#" rel="Headline Title 2"&gt;&lt;/a&gt; &lt;span rel="Headline Lorem ipsum2 dolor sit amet"&gt;&lt;/span&gt;
        &lt;p rel="images/2.jpg"&gt;&lt;/p&gt;
      &lt;/li&gt;
      &lt;li&gt; 3 &lt;a href="#" rel="Headline Title 3"&gt;&lt;/a&gt; &lt;span rel="Headline Lorem ipsum3 dolor sit amet"&gt;&lt;/span&gt;
        &lt;p rel="images/3.jpg"&gt;&lt;/p&gt;
      &lt;/li&gt;
      &lt;li&gt; 4 &lt;a href="#" rel="Headline Title 4"&gt;&lt;/a&gt; &lt;span rel="Headline Lorem ipsum4 dolor sit amet"&gt;&lt;/span&gt;
        &lt;p rel="images/4.jpg"&gt;&lt;/p&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/div&gt;
  &lt;div class="mainImg"&gt;&lt;img src=""/&gt;&lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>My jquery is:</p>

<pre><code>$(document).ready(function(){
$('.pg li').click(function(){
    var header      = $(this).find('a').attr('rel');
    var desc        = $(this).find('span').attr('rel');
    var images      = $(this).find('p').attr('rel');
    $(".mainDesc h2").text(header);
    $(".mainDesc a").text(desc);
    $(".mainImg img").attr("src", images);
   }
);
 }

);
</code></pre>

<p>Everything is ok, But when refreshing the page, the first item is missed.
I want to insert only one mysql query in mainDesc. I want to first item will be shown with jquery not mysql query.
How can I fix this for showing first item when page refreshed.
Thanks</p>

<p><img src="http://img59.imageshack.us/img59/9201/79025058.jpg" alt="When page refreshed">
<img src="http://img535.imageshack.us/img535/2926/25644092.jpg" alt="When clicked"></p>
