I would rather do this way:
HTML
<div id='mainIconTile1' class="mainIconTile">
</div>
<div id='mainIconTile2' class="mainIconTile">
</div>
<div id='mainIconTile3' class="mainIconTile">
</div>
<div id='mainIconTile4' class="mainIconTile">
</div>
<div id='mainIconTile5' class="mainIconTile">
</div>
<div id='mainIconTile6' class="mainIconTile">
</div>
<div id='mainContentTile1'>
1
</div>
<div id='mainContentTile2'>
2
</div>
<div id='mainContentTile3'>
3
</div>
<div id='mainContentTile4'>
4
</div>
<div id='mainContentTile5'>
5
</div>
<div id='mainContentTile6'>
6
</div>
<strong>CSS
.mainIconTile {
background:#888888;
width:20px;
height:20px;
margin:1px;
float:left;
}
#mainIconTile1:hover, #mainIconTile1.active {
background:#5aa02c;
}
#mainIconTile2:hover, #mainIconTile2.active {
background:red;
}
#mainIconTile3:hover, #mainIconTile3.active {
background:blue;
}
#mainIconTile4:hover, #mainIconTile4.active {
background:green;
}
#mainIconTile5:hover, #mainIconTile5.active {
background:pink;
}
#mainIconTile6:hover, #mainIconTile5.active {
background:brown;
}
#mainContentTile1 {
background:orange;
height:50px;
width:50px;
float:left;
clear:left;
display:none;
}
#mainContentTile2 {
background:#e8e8e8;
height:50px;
width:50px;
float:left;
clear:left;
}
#mainContentTile3 {
background:#e8e8e8;
height:50px;
width:50px;
float:left;
clear:left;
display:none;
}
#mainContentTile4 {
background:#e8e8e8;
height:50px;
width:50px;
float:left;
clear:left;
display:none;
}
#mainContentTile5 {
background:#e8e8e8;
height:50px;
width:50px;
float:left;
clear:left;
display:none;
}
#mainContentTile6 {
background:#e8e8e8;
height:50px;
width:50px;
float:left;
clear:left;
display:none;
}
</p>
JavaScript
$(document).ready(function(){
$('div[id*="mainIconTile"]').click(function() {
var theId = $(this).attr("id");
$(".mainIconTile").removeClass('active');
$("#" + theId).addClass('active');
$('.mainContentTile:visible').hide(0, function(){
$('#mainContentTile' + theId.substring(12)).show();
});
});
});