Jquery, swapping z-index of all elements besides picked one on action
<p>I have a problem as the topic name says: Lets say i have gallery on site with 4 photos, they have set z-index for all images in this div. Anyways, i'd like to make my action of enlarging clicked image, to force z-index of rest of images go down (because i'm using fading in black background as part of image view)</p>

<p>Thanks in advance</p>

<pre><code>&lt;div id="main"&gt;
    &lt;div id="masthead"&gt;
        &lt;a href="#"&gt;click&lt;/a&gt; &lt;/div&gt;
    &lt;div id="top_nav"&gt;
        &lt;a href="http://www.google.pl"&gt;Start&lt;/a&gt; &lt;a href="http://www.google.pl"&gt;
        Opis&lt;/a&gt; &lt;a href="http://www.google.pl"&gt;Projekty&lt;/a&gt;
        &lt;a href="http://www.google.pl"&gt;Zdjecia&lt;/a&gt;
        &lt;a href="http://www.google.pl"&gt;Linki&lt;/a&gt; &lt;a href="http://www.google.pl"&gt;
        Kontakt&lt;/a&gt; &lt;/div&gt;
    &lt;div id="content"&gt;
    &lt;div id="textfield"&gt; &lt;p&gt;Profesjonalny web design. &lt;/p&gt;
    &lt;span id="left"&gt;&lt;a href="#"&gt;&amp;#8592;&lt;/a&gt;&lt;/span&gt;
    &lt;span id="right"&gt;&lt;a href="#"&gt;&amp;#8594;&lt;/a&gt;&lt;/span&gt;
    &lt;/div&gt;
    &lt;img id="second" src="model.jpg" alt="model" /&gt;
    &lt;img id="third" src="model.jpg" alt="model" /&gt;
    &lt;img id="fourth" src="model.jpg" alt="model" /&gt;
    &lt;img id="first" src="model.jpg" alt="model" /&gt;
    &lt;/div&gt;
    &lt;div id="box"&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div id="blackb"&gt;&lt;/div&gt;
</code></pre>

<p>css</p>

<pre><code>body {
    margin: 0;
    padding: 0;
    font-family: Verdana;
    background: silver url(bodygrad2.jpg) fixed;;
}
#main {
    width: 1280px;
    margin: 0 auto;
    padding-bottom: 10px;
}
#masthead {
    height: 40px;
    background: -webkit-gradient(linear, 0 0, 0 100%, from(gray), to(black));
    opacity: 0.3;
    margin-bottom: 4px;
    color: white;
    text-align: center;
    padding-top: 20px;
}
#masthead a{
    color: white;
    display: block;
    text-decoration: none;
}
#masthead a:hover{
    color: #FFFF66;
    display: block;
    text-decoration: none;
}

#top_nav {
    width: 100%;
    background: transparent;
    border-bottom: 1px solid #BFBB04;
}
#top_nav a {
    text-decoration: none;
    color: #a7a236;
    font-family: GraublauWeb; /* "Brush Script Std"; */
    font-size: 120%;
    padding: 0 5px;
}
#top_nav a:hover {
    color: #cfc944;
}
#content {
    height: 20px;
    width: 1px;
    background: gray url(content.jpg) 0 0 no-repeat;
}
#content div#textfield{
    display: none;
    position: absolute;
    top: 15%;
    right: 104px;
    width: 310px;
    height: 200px;
    border-bottom: 1px solid black;
    border-right: 1px solid black;
    background: #484B55;
    color: #CCCCCC;
    opacity: 0.5;
    z-index: 9;
}
#content div#textfield p{
    margin: 10px;
}
#content span#left{
    display: block;
    position: absolute;
    bottom: 0;
    left: 0;
}
#content span#right{
    display: block;
    position: absolute;
    bottom: 0;
    right: 0;
}
#content span a{
    text-decoration: none;
    color: #CCCCCC;
}
#content img {
    position: absolute;
    top: 50%;
    right: 50%;
    display: none;
    width: 160px;
    height: 116px;
    border: 2px solid white;
    z-index: 10;
}
#content img:hover {
    width: 164px;
    height: 120px;
    opacity: 0.9;
}
#content img#second {
    right: 35%;
}
#content img#third {
    right: 20%;
}
#content img#fourth {
    right: 5%;
}
#footer {
    position: fixed;
    bottom: 0;
    text-align: center;
    width: 100%;
    background: #ECE7E6;
    border-top: 1px solid #BBBFC8;
    font: 80% italic Arial,Verdana, sans-serif;
    color: silver;
    line-height: 1em;
    padding-bottom: 0.1em;
    z-index: 15;
}
#box {
    position: absolute;
    top: 40px;
    left: 0;
    width: 60px;
    height: 60px;
    background: red;
    opacity: 0.5;
    z-index: 6;
}
#blackb{
    display: none;
    position: absolute;
    top: 0;
    width: 1280px;
    height: 888px;
    background: black;
    opacity: 0.7;
    z-index: 9;
}
</code></pre>
