$(document).ready(function(){
	// Set image correctly in topnavigation
	isIE6 = /msie|MSIE 6/.test(navigator.userAgent);
	if(!isIE6){
		var p = $(".topnav");
		for(var i=0;i<p.length;i++){
			var LIWidth = $(p[i]).innerWidth();
			// Get img within list item
			var children = $(p[i]).children();
			var subchild = $(children[0]).children();
			var subimage = $(subchild).get(0);
			subimage.width=LIWidth-3;
			subimage.style.display='block';
			subimage.style.position='absolute';
			// place text over image by cloning the text div and position it absolute
			var subdiv = $(subchild).get(1);
			$(subdiv).clone().prependTo(children[0]);
			var subchild2 = $(children[0]).children();
			var copieddiv = $(subchild).get(1);
			copieddiv.className='btn';
			copieddiv.style.position='absolute';
			copieddiv.style.cursor='pointer';
			copieddiv.style.top='11px';
		}	
		// remove the original text div
		var o = $(".hideme");
		for(var i=0;i<o.length;i++){
			o[i].style.visibility='hidden';
		}
	}
});

