(function($) {
	$(document).ready(function($){
		/*:: main tabs toggle::*/							   
		$("ul#tabs li").click(function(){
			$(this).removeClass("tab").addClass("active");
			$(this).siblings().removeClass("active").addClass("tab");
			
			if($(this).attr("id") == "type-tab"){
				$(".serie-menu").hide();
				$(".type-menu").fadeIn("normal");
			}
			else if($(this).attr("id") == "serie-tab"){
				$(".type-menu").hide();
				$(".serie-menu").fadeIn("normal");
			}
			return false;			
		});

		/*:: link hover in header::*/
		$(".header-inner a").hover(function(){
			$(this).animate({ fontSize: '1.1em'  }, 100);
		},function(){
			$(this).animate({ fontSize: '1em'   }, 100);			
		});

//		$(".forhandler #tabs-small").idTabs();

		/*:: google map ::*/
		$("#tabs-small #liste-tab a").click(function(){
			$("#gmap").html("");
			$("#forhandler-map").hide();													  
			$("#forhandler-list").show();
			$(".forhandler #tabs-small #liste-tab").removeClass("tab").addClass("active");
			$(".forhandler #tabs-small #kort-tab").removeClass("active").addClass("tab");			
			return false;
		});
		var geoLocations = $(".storeMap").filter(":gt(0)");

		$("#tabs-small #kort-tab a").click(function(){
			showGmap();
			gMapInit(geoLocations, "multi");
			return false;			
		});
		
		$(".storeMap a").click(function(){
			showGmap();
			gMapInit($(this).siblings(".geo"), "single")
			return false;			
		});

	});
})(jQuery);

function showGmap(){
		$("#forhandler-list").hide();
		$("#forhandler-map").show();
		$(".forhandler #tabs-small #kort-tab").removeClass("tab").addClass("active");
		$(".forhandler #tabs-small #liste-tab").removeClass("active").addClass("tab");			
}

function gMapInit(geoLocations, type){
		$("#gmap").googleMap(null,null,14, {
			controls: ["GLargeMapControl3D"],
			markers: geoLocations,
			listtype: type
		});
}
