I solved this by using jQuery.
<section id="bg">
<section id="overlay" style="cursor:pointer;"></section>
<a href="#" class="nextImageBtn" title="next"></a><a href="#" class="prevImageBtn" title="previous"></a>
<img src="" id="bgimg" runat="server" alt=""/>
</section>
<div id="preloader">
<img src="images/ajax-loader_dark.gif" width="32" height="32" alt="" /></div>
<div id="img_title">
</div>
<div id="toolbar">
<a href="#" title="Maximize" onclick="ImageViewMode('full');return false">
<img src="images/toolbar_fs_icon.png" width="50" height="50" alt="" /></a></div>
<div id="thumbnails_wrapper">
<div id="outer_container">
<div class="thumbScroller">
<div class="container">
<div>
<asp:Repeater ID="rpt1" runat="server">
<ItemTemplate>
<div class="content">
<a data-cid='<%#Eval("CId")%>' href='<%#String.Format("images/MainFolderImages/Gallery/{0}?{1}",Eval("Image").ToString().Trim(),Eval("CId").ToString().Trim()) %>'>
<img src="images/MainFolderImages/Thumbnail/<%#Eval("Image")%>" title="<%#Eval("MainFolder")%>"
alt="<%#Eval("MainFolder")%>" class="thumb" />
</a>
</div>
</ItemTemplate>
</asp:Repeater>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" language="javascript">
$(document).ready(function() {
$("section#overlay").click(function() {
var path = $(this).parent().find("img#bgimg").attr('src');
var id = path.substring(path.indexOf("?", 0) + 1);
var ae = $(".content>a").filter(function() {
return $(this).attr('data-cid') === id;
});
window.location.href = ae.attr('data-path');
//alert(a.attr('href'));
});
});
</script>