Edit in JSFiddle

$("img.ad").click(function(e){
      window.location = $(this).attr("rel");
});
<body>
    <img src="http://www.bing.com/fd/hpk2/AnzacDay_EN-US956296396.jpg" class="ad" alt="" rel="http://google.com" />
    <div class="contents">
    <span>testing</span>
    </div>
</body>
img{position:absolute;display:block;top:0;left:0;z-index:1;}
div{position:relative;z-index:1000;}
span{color:#f00;}