function Pickup(){
	var expires = new Date();
	expires.setTime(expires.getTime()+(1000*60*30));
	document.cookie = "Pickup=true; expires="+expires.toGMTString()+"; path=/";
	location.href = "/shop/order1.html"
}

function Delivery(){
	var expires = new Date();
	expires.setTime(expires.getTime()-1);
	document.cookie = "Pickup=; expires="+expires.toGMTString()+"; path=/";
	location.href = "/shop/order1.html"
}

function readCookie(name){
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++){
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function b2blogin(){
	//alert("s")
	var expires = new Date();
	expires.setTime(expires.getTime()+1000*60*60);
	document.cookie = "b2b=true; expires="+expires.toGMTString()+"; path=/";
	$("#clubCoolLogin").css("display", "none");
	$("#clubCoolLoggedIn").css("display", "block");
}



function b2blogout(){
	if(readCookie("b2b") == "true"){
		var expires = new Date();
		expires.setTime(expires.getTime()-1);
		document.cookie = "b2b=; expires="+expires.toGMTString()+"; path=/";
		location.href = "/shop/b2blogin.html?logout=1"
		$("#clubCoolLogin").css("display", "block");
		$("#clubCoolLoggedIn").css("display", "none");
	}
}

$(document).ready(function(){
	if($("#ShippingMethodID61").length > 0){
		SelectPayment()
		
	}
	
	if(readCookie("b2b") == "true"){
		$("#clubCoolLogin").css("display", "none");
		$("#clubCoolLoggedIn").css("display", "block");
	}
	
	if($("#pickupTxt").length > 0){
		if(readCookie("Pickup") == "true"){
			$("#pickupTxt").hide();
			$(".Message_OrderStep3").parent().find("br").remove();
		}
	}
	if($("#pickupBannerStep3").length > 0){
		if(readCookie("Pickup") != "true"){
			$("#pickupBannerStep3").hide(); 	
			$("#pickupBanner2Step3").hide(); 	
		}
	}
	if($("#step1DeliveryBanner").length > 0){
		if(readCookie("Pickup") == "true"){
			$("#step1DeliveryBanner").hide(); 	
		}
	}
	
	if($(".HR_OrderStep1").length > 0){
		$(".HR_OrderStep1").parent().parent().parent().parent().remove();
	}
	
	if($(".OrderStep1_Next_TD").length > 0){
		$(".OrderStep1_Next_TD .SubmitButton_Orderstep1").css({
			"position" : "relative",
			"left" : "18px"
		});
	}
	if($("#ClubTxt").length > 0){
		$("#B2BLogin_TD table td").each(function(index){
		    if(index != 0){
		        $(this).css("padding", "0px 20px");
		    }
		});
		
		$("#B2BLogin_TD form").next().next().next().css("display", "block");
		$("#B2BLogin_TD form").next().next().next().css("padding", "0px 20px");
		
		$(".SubmitButton_B2Blogin").css({
			"position" : "relative",
			"left" : "-200px",
			"background" : "url('/includes/btnBg.jpg')",
			"height" : "25px",
			"color" : "#FFFFFF",
			"border" : "none",
			"font-weight" : "bold"
		});
		
		$("#ClubTxt").html("Vi giver dig 10 % rabat på alle produkter som medlem af CLUB COOL.<br>Du sparer altså 10 % på alt i shoppen med få klik!!<br>Som medlem af CLUB COOL er du også sikret førsteret på ekstra gode tilbud, så de ikke når at blive udsolgt!<div id='clubMemberLink'><a href='/shop/addb2b.html'>Bliv GRATIS medlem af CLUB COOL nu!</a></div>");
	}
	if($("#B2BLogin_TD").find("#Field0_0").length > 0){
		$("#Field0_0").parent().parent().find("td").css("padding", "0px 20px");
		$(".CustomerFieldsRequired_ADDB2B_TD").html("<span style='position:relative;left:-130px;'>*</span>")
		$("#Field8_0").find(".CustomerFieldsRequired_ADDB2B_TD").html(" ")		
	}
	
});

function SelectPayment(){
	$("#PaymethodID_62").parent().next().css("display", "none");
	$("#ShippingMethod_61").css("display", "none");

	if(readCookie("Pickup") == "true"){
		document.getElementById('PaymethodID_62').click();
		document.getElementById('ShippingMethodID61').click();
		gotoOrderStep3();
	} else {
		setInterval("HideMe()", 1);
	}
} 
function HideMe(){
	$("#PaymethodID_62").parent().next().css("display", "none");
	$("#ShippingMethod_61").css("display", "none");
} 

function InternLink(LinkId) {
	try {
	if (LinkId != null)
	if (LinkId == 0)
	{document.location.href='/shop/frontpage.html';}
	else if (LinkId == 1)
	{document.location.href='/shop/cms-11.html';}
	else if (LinkId == 2)
	{document.location.href='/shop/faa-en-gratis-71c1.html';}
	else if (LinkId == 3)
	{document.location.href='/shop/showbasket.html';}
	else if (LinkId == 4)
	{document.location.href='/shop/cms-Alle-ordre-kan-afhentes---Se-hvor-let-det-er.html';}
	else if (LinkId == 5)
	{document.location.href='/shop/cms-simpel-sikker-billig-nethandel.html';}
	else if (LinkId == 6)
	{document.location.href='/shop/ipad-tilbehoer-170s.html';}
	
	
	
	
	}
	catch (err) {}
}



