var M = {};
			M.h = 28;
			M.a = "b_0";
			M.bTimer = "";
			
			M.init = function()
			{
				if(navigator.appName == "Microsoft Internet Explorer")
				{
					$("#ie_c").html("Hej kära användare! Vi märker att du använder Internet Explorer. Vi skulle rekomendera att du<br />byter till något av följande alternativ för en bättre surfupplevelse: <a href=http://www.google.com/chrome/?hl=sv'>Chorme</a>, <a href='http://www.mozilla.com/sv-SE/firefox/'>Firefox</a>, <a href='http://www.apple.com/safari/'>Safari</a>.");
				}
				
				$(".page_under").each(function(){
					$(this).height($("#page").height());
				});
				
				
				
				$("#package").change(function(){
					if($(this).val() == "LightAgent")
					{
						if($('input:radio[name=time]:checked').val() == "12")
						{
							$("#totalPrice").val("8900:-");
						}
						else
						{
							$("#totalPrice").val("17800:-");
						}
					}
					else
					{
						if($('input:radio[name=time]:checked').val() == "12")
						{
							$("#totalPrice").val("11900:-");
						}
						else
						{
							$("#totalPrice").val("23800:-");
						}
					}
				});
				
				$("input[name=time]").click(function(){
					
					if($("#package").val() == "LightAgent")
					{
						if($('input:radio[name=time]:checked').val() == "12")
						{
							$("#totalPrice").val("8900:-");
						}
						else
						{
							$("#totalPrice").val("17800:-");
						}
					}
					else
					{
						if($('input:radio[name=time]:checked').val() == "12")
						{
							$("#totalPrice").val("11900:-");
						}
						else
						{
							$("#totalPrice").val("23800:-");
						}
					}
				});
				
				$("#lang").click(function(){
					
					$("#lightbox_bg").width($("body").width());
					$("#lightbox_bg").height($("body").height());
					$("#lightbox_bg").css("opacity", 0.4);
					$("#lightbox_bg").fadeIn();
					
					$("#login_wrapper").css("left", ($(window).width()/2) - ($("#login_wrapper").width()/2) );
					$("#login_wrapper").css("top", ($(window).height()/2) - ($("#login_wrapper").height()/2) );
					$("#login_wrapper").css("opacity", 0.6);
					$("#login_wrapper").fadeIn();
					
					$("#login_box").css("left", ($(window).width()/2) - ($("#login_box").width()/2) );
					$("#login_box").css("top", ($(window).height()/2) - ($("#login_box").height()/2) );
					$("#login_box").fadeIn();
					
					$("#lightbox_bg").click(function(){
						$("#lightbox_bg").fadeOut();
						$("#login_wrapper").fadeOut();
						$("#login_box").fadeOut();
					});
					
					return false;
				});
				
				$("#login_form a").click(function(){
					$("#login_form").submit();
				});
				
				$(".case").each(function(){
					$(this).css("opacity", 0.6);
				});
				
				$(".case").mouseover(function(){
					$(this).css("opacity", 1);
				});
				
				$(".case").mouseout(function(){
					$(this).css("opacity", 0.6);
				});
				
				$(".b_2").click(function(){
					window.open("http://www.youtube.com/watch?v=RNCg9c8aCEQ", "_blank");
				});
				
				
				$(".info_left_arrow").animate({"margin-top": (parseInt($(".info_slider_content_1").height())/2)-15 }, 1000);
				$(".info_right_arrow").animate({"margin-top": (parseInt($(".info_slider_content_1").height())/2)-15 }, 1000);
				$(".info_left_arrow").css("opacity", 0);
				
				$(".info_right_arrow").click(function(){
					var spacing = 15;
					
					if(parseInt($("#info_slider_content").css("margin-left")) == 0)
					{
						$("#info_slider_content").animate({"margin-left": -900}, 1000);
						$(".info_left_arrow").animate({"margin-top": (parseInt($(".info_slider_content_2").height())/2)-spacing, "opacity": 1 }, 1000);
						$(".info_right_arrow").animate({"margin-top": (parseInt($(".info_slider_content_2").height())/2)-spacing }, 1000);
						
						
					}
					else if(parseInt($("#info_slider_content").css("margin-left")) == -900)
					{
						$("#info_slider_content").animate({"margin-left": -1800}, 1000);
						$(".info_left_arrow").animate({"margin-top": (parseInt($(".info_slider_content_3").height())/2)-spacing }, 1000);
						$(".info_right_arrow").animate({"margin-top": (parseInt($(".info_slider_content_3").height())/2)-spacing, "opacity": 0 }, 1000);
					}
				});
				
				$(".info_left_arrow").click(function(){
					var spacing = 15;
					
					if(parseInt($("#info_slider_content").css("margin-left")) == 0)
					{
						//$("#info_slider_content").css("margin-left", "0px");
					}
					else if(parseInt($("#info_slider_content").css("margin-left")) == -900)
					{
						$("#info_slider_content").animate({"margin-left": 0}, 1000);
						$(".info_left_arrow").animate({"margin-top": (parseInt($(".info_slider_content_1").height())/2)-spacing, "opacity": 0 }, 1000);
						$(".info_right_arrow").animate({"margin-top": (parseInt($(".info_slider_content_1").height())/2)-spacing }, 1000);
					}
					else if(parseInt($("#info_slider_content").css("margin-left")) == -1800)
					{
						$("#info_slider_content").animate({"margin-left": -900}, 1000);
						$(".info_left_arrow").animate({"margin-top": (parseInt($(".info_slider_content_2").height())/2)-spacing }, 1000);
						$(".info_right_arrow").animate({"margin-top": (parseInt($(".info_slider_content_2").height())/2)-spacing, "opacity": 1 }, 1000);
					}
				});
				
				$("#banner_dots li").click(function()
				{
					clearTimeout(M.bTimer);
					
					$("#banner_dots li").removeClass("active");
					$(this).addClass("active");
					
					if(M.a != $(this).attr("rel"))
					{
						$("."+M.a).fadeOut('slow');
						M.a = $(this).attr("rel");
						$("."+M.a).fadeIn('slow');
					}
					M.bTimer = setTimeout(M.nextBanner, 15000);
					return false;
				});
				
				$(".case").click(function(){
					window.open(M.Cases[$(this).attr("rel").substring(1,3)]);
				})
				
				$(".big_case").click(function(){
					window.location =  $(this).find("a").attr("href");
				});
				
				M.bTimer = setTimeout(M.nextBanner, 15000);
				
				setTimeout(M.flipRefs, 5000);
				M.map();
			}
			
			M.nextBanner = function()
			{
				$("#banner_dots li").removeClass("active");
				
				
				if( $("#banner_dots > li").length-1 > parseInt(M.a.substring(2,3)) )
				{
					$("."+M.a).fadeOut('slow');
					M.a = "b_" + (parseInt(M.a.substring(2,3))+1);
					$("."+ M.a ).fadeIn('slow');
				}
				else
				{
					$("."+M.a).fadeOut('slow');
					M.a = "b_0";
					$("."+ M.a ).fadeIn('slow');
				}
				
				$("li[rel="+M.a+"]").addClass("active");
				
				M.bTimer = setTimeout(M.nextBanner, 15000);
			}
			
			M.flipRefs = function()
			{
				
				$("#ref_container").animate(
				{
					marginTop: -55
				}, 1000, function(){
					$("#ref_container").append($("#ref_container img:nth-child(1)").clone());
					$("#ref_container img:nth-child(1)").remove();
					$("#ref_container").css("marginTop", "0px");
					setTimeout(M.flipRefs, 5000);
				});
				
				
				
			}
			
			M.map = function()
			{
				var mapContainer = document.getElementById("map");
	
				if(mapContainer == null)
				{
					return null;
				}
				
				var map = new GMap2(mapContainer);
				var startPoint = new GLatLng(56.6685, 16.3532);
				map.setCenter(startPoint, 14);
				map.addControl(new GSmallMapControl());
				
				
				var marker = new GMarker(new GLatLng(56.6685, 16.3532));
				map.addOverlay(marker);	
			}
			
			M.Cases = [];
			M.Cases[1] = "https://www.dina.se/";
			M.Cases[2] = "http://www.fiskarhedenvillan.se/";
			M.Cases[3] = "http://www.randstad.se/";
			M.Cases[4] = "http://barometern.se/";
			M.Cases[5] = "http://www.skanskabyggvaror.se/";
			M.Cases[6] = "http://www.sparbanken1826.se/";
			M.Cases[7] = "http://www.lansforsakringar.se/";
			M.Cases[8] = "http://www.fonus.se/";
			M.Cases[9] = "http://www.daloc.se/";
			M.Cases[10] = "http://www.lnu.se/";
			M.Cases[11] = "http://www.ica.se/maxi/kalmar";
			M.Cases[12] = "http://www.taxi020.se/";
			M.Cases[13] = "http://www.sparbankennord.se/";
			M.Cases[14] = "http://www.leoslekland.se/";
			M.Cases[15] = "http://www.gnesta.se/";
			M.Cases[16] = "http://www.harnosand.se/";
			M.Cases[17] = "http://www.sensia.se/";
			M.Cases[18] = "http://www.skurupssparbank.se/";
			M.Cases[19] = "http://www.flen.se/";
			M.Cases[20] = "http://www.jordbruksverket.se/";
			M.Cases[21] = "http://www.kalmar.se/";
			M.Cases[22] = "http://www.varbergssparbank.se/";
			M.Cases[23] = "http://www.mora.se/";
			M.Cases[24] = "http://www.vasteras.se/";
			M.Cases[25] = "http://www.fofspar.se/";
			M.Cases[26] = "http://www.guldfageln.se/";
			M.Cases[27] = "http://www.alvsbyn.se/";
			M.Cases[28] = "http://www.kalmarsciencepark.se/";
			M.Cases[29] = "http://www.adrecord.com/";
			M.Cases[30] = "http://www.wspa.se/";
			
			window.onload = M.init;
