$(document).ready(function() {
		
//rotate tabs upon reload randomly	
	randomNumber = (Math.floor(Math.random()*2));
	if (randomNumber == 1) {
		$("#industryTabLink").parents("li").replaceWith("<li class='tabIndustryFore'><a id='industryTabLink' href='#'>Browse by Industry</a></li>");
		$("#serviceTabLink").parents("li").replaceWith("<li class='tabService'><a id='serviceTabLink' href='#'>Browse by Service</a></li>");	
		$("#browseService").hide();
		$("#browseIndustry").show();
	}

//handle clicks on tabs
	$("#serviceTabLink").click(handleServiceClick);
	$("#industryTabLink").click(handleIndustryClick);
	
//handle images
	collages = [ 'collage1.jpg', 'collage2.jpg', 'collage3.jpg', 'collage4.jpg', 'collage5.jpg', 'collage6.jpg', 'collage7.jpg'];
	$("p.collage").css({ "background-image" : "url(/assets/images/hp_marketing/" + collages[Math.floor(Math.random() * collages.length)] + ")", "background-repeat" : "no-repeat", "background-position" : "50%" });

});

	function handleIndustryClick(event) {
		$(this).parents("li").replaceWith('<li class="tabIndustryFore"><a id="industryTabLink" href="#">Browse by Industry</a></li>');
		$("#serviceTabLink").parents("li").replaceWith('<li class="tabService"><a id="serviceTabLink" href="#">Browse by Service</a></li>');
		$("#serviceTabLink").click(handleServiceClick);
		$("#industryTabLink").click(handleIndustryClick);
		$("#browseService").hide();
		$("#browseIndustry").show();
		setAllHeights();
		return false;
	}

	function handleServiceClick(event) {
		$(this).parents("li").replaceWith('<li class="tabServiceFore"><a id="serviceTabLink" href="#">Browse by Service</a></li>');
		$("#industryTabLink").parents("li").replaceWith('<li class="tabIndustry"><a id="industryTabLink" href="#">Browse by Industry</a></li>');
		$("#serviceTabLink").click(handleServiceClick);
		$("#industryTabLink").click(handleIndustryClick);
		$("#browseIndustry").hide();
		$("#browseService").show();
		setAllHeights();
		return false;
	}
