var OriginalSrc = "";
var OriginalHtml = "";
var ProductImage;
var ProductImageCanvasTD;
var ProductImageDummyImg;

function SetBasketLocation(source)
{
	if(source.attachEvent)
		source.onclick = function(){location.href='/shop/showbasket.html'};
	else
		source.setAttribute('onclick', 'location.href="/shop/showbasket.html"'); 
}

function ProductAdded(prodnumber, caller, postorigin) 
{
	

	if(getCookie('konsolPC') != "on")
	{
		if(window.location.href.indexOf("showbasket") < 1)
		{
		
			//Købs popup
			 var myWidth = 0, myHeight = 0;
		  	 if(typeof(window.innerWidth) == 'number') {
		        //Non-IE
		        myWidth = window.innerWidth;
		        myHeight = window.innerHeight;
				document.getElementById("overlay").style.height = '100%';
				document.getElementById("overlay").style.width = '100%';
			}
			else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
		        //IE 6+ in 'standards compliant mode'
		        myWidth = document.documentElement.clientWidth;
		        myHeight = document.documentElement.clientHeight;
				document.getElementById("overlay").style.height = myHeight;
				document.getElementById("overlay").style.width = myWidth;
		    } 
			else if(document.body &&(document.body.clientWidth || document.body.clientHeight)) {
		        //IE 4 compatible
		        myWidth = document.body.clientWidth;
		        myHeight = document.body.clientHeight;
				document.getElementById("overlay").style.height = myHeight;
				document.getElementById("overlay").style.width = myWidth;
		    } 
			

			document.getElementById("overlay").style.display = "inline";

			
			document.getElementById("koebpopup").style.left 			= (myWidth/2-160+10)+"px";
			document.getElementById("koebpopup").style.top 				= (myHeight/2-225)+document.body.scrollTop+"px";
			document.getElementById("koebpopup").style.width 			= "454px";
			document.getElementById("koebpopup").style.height 			= "320px";
			document.getElementById("koebpopup").style.backgroundImage 	= "url(/grafik/varekort/popup-lagt-i-kurv.png)";
			document.getElementById("koebpopup").style.backgroundRepeat	= "no-repeat";
			document.getElementById("koebpopup").style.position		 	= "absolute";
			document.getElementById('koebpopup').style.display 			= "inline";
	
			var innerDIV = "<div><div style=\"height:65px;\"></div><div style=\"margin-right:0px; width:40px; height:40px; float:right; cursor:pointer;\" onclick=\"HideKoebPopup()\"></div></div>"
						+"<div style=\"float:left; margin:190px 0 0 30px;\"><img onclick=\"HideKoebPopup()\" style=\"cursor:pointer\" src=\"/grafik/varekort/knap-koeb-flere.png\" onMouseOver=\"this.src='/grafik/varekort/knap-koeb-flere-hover.png'\" onMouseOut=\"this.src='/grafik/varekort/knap-koeb-flere.png'\"></div>"
						+"<div style=\"float:left; margin:190px 0 0 60px;\"><a href=\"/shop/showbasket.html\"><img style=\"cursor:pointer\" src=\"/grafik/varekort/knap-gaa-til-kassen.png\" onMouseOver=\"this.src='/grafik/varekort/knap-gaa-til-kassen-hover.png'\" onMouseOut=\"this.src='/grafik/varekort/knap-gaa-til-kassen.png'\"></a></div>"
						+ "<br /><br /><div style=\"clear:both\"></div><div style=\"display:none; clear:left; padding-left:300px; margin-top:10px; color:#fff;\"><p style=\"padding-top:0px\"><form><input type=\"checkbox\" name=\"popupCHECK\" id=\"popupCHECK\"onclick=\"CookieSkjulKoebPopup()\"> <label for=\"popupCHECK\">Vis ikke igen</label></form></p>";
			document.getElementById("koebpopup").innerHTML = innerDIV;
			

			setTimeout(HideKoebPopup, 10000);
			
		}
	}
	
}

//bruges til at skjule købspopuppen via coockies
function CookieSkjulKoebPopup()
{
	setCookie('konsolPC','on',100)
	setTimeout(HideKoebPopup, 1000);
	document.getElementById("overlay").style.display = "none";
}

function HideKoebPopup() 
{
   document.getElementById('koebpopup').style.display = 'none';
   document.getElementById("overlay").style.display = "none";
}


function RestoreOriginalSrc() 
{
    ProductImage.src = OriginalSrc;     
}

function RestoreOriginalMedia() 
{
    ProductImageCanvasTD.style.display = '';
    ProductImageDummyImg.style.display = 'none';
}


