 $(document).ready(function() {
 	$("#footer-tabs-list > ul > li").click(function(){
		
		/*
		 * The tab list item must be named with an id like this <li id="tab1">Benefits</li>
		 * The tabs must have a matching content tab <div id="content1" class="tab-panels-content"> 
		 */
		var tabContentId = $(this).attr("id");
		var tabNumber = tabContentId.substr(3);
		tabContentId = "fp-content" + tabNumber;
		var parentID = $("#footer-tabs-list").parent().attr("id");
		
		// Remove active class from others then add active class to the tab clicked
		$("#footer-tabs-list > ul > li").removeClass("active active-first-tab active-last-tab");
		if (tabNumber == '1') {
			$(this).addClass("active-first-tab");
			$('#footer-popup-container #tabs-middle-container').animate({height:'140px'});
		} else if (tabNumber == '3' && parentID == "footer-popup-container"){
			$(this).addClass("active-last-tab");
			$('#footer-popup-container #tabs-middle-container').animate({height:'445px'});
			if (navigator.userAgent.toLowerCase().indexOf("msie") != -1) {
				urlhz = "http://maps.google.co.uk/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=%4030.27889707150173,120.16473412513733&amp;sll=30.273978,120.155361&amp;sspn=0.832568,1.586151&amp;ie=UTF8&amp;t=h&amp;ll=30.27886,120.164702&amp;spn=0.005559,0.006437&amp;z=16&amp;output=embed";
				setTimeout('$("#footer-map-hz").html(\'<iframe width="300" height="265" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="\' + urlhz + \'"></iframe>\');', 100);
			}
		} else {
			$(this).addClass("active");
			$('#footer-popup-container #tabs-middle-container').animate({height:'445px'});
			/*$('#footer-popup-container #tabs-middle-container').css({width:'3232px'});
			$('#footer-popup-container #tabs-middle-container').css({borderLeft:'1px solid #C7C8CA'});
			$('#footer-popup-container #tabs-middle-container').css({borderRight:'1px solid #C7C8CA'});*/
		}		
		
		$("#footer-tab-panels > div").hide();		
		$("#footer-tab-panels > div#" + tabContentId + "").show();
	});
	
	
	
	/* Sub Tab Content
	/*
	 * The list item must have an id - <a href="" id="textiles-and-bags"> and a matching content div id
	 * <div class="sub-tab-content" id="textiles-and-bags-content">
	 */
	$("#prod-exp-list > li > a").click(function(){
		
		var subTabContentId = $(this).attr("id");
		subTabContentId = subTabContentId + "-content";
		
		// Remove active class from others then add active class to the tab clicked
		$("#prod-exp-list > li > a").removeClass("active active-first-tab active-last-tab");
		
		$(this).addClass("active");		
		
		$("#prod-exp-content > div").hide();		
		$("#prod-exp-content > div#" + subTabContentId + "").show();
		return false;
	});
   
 });

