//request querystring
setTimeout("location.href=location.href",3000000);
function getURLParam(strParamName){
  var strReturn = "";
  var strHref = location.href;
  if ( strHref.indexOf("?") > -1 ){
    var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
    var aQueryString = strQueryString.split("&");
    for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
      if ( 
		aQueryString[iParam].indexOf(strParamName + "=") > -1 ){
        var aParam = aQueryString[iParam].split("=");
        strReturn = aParam[1];
        break;
      }
    }
  }
  return strReturn;
}
function getURLParamVareliste(strParamName){
  var strReturn = "";
  var strHref = location.href.replace("&", "?");
  if ( strHref.indexOf("?") > -1 ){
    var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
    var aQueryString = strQueryString.split("&");
    for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
      if ( 
		aQueryString[iParam].indexOf(strParamName + "=") > -1 ){
        var aParam = aQueryString[iParam].split("=");
        strReturn = aParam[1];
        break;
      }
    }
  }
  return strReturn;
}
//productlist
function search()
{
	var keyword = unescape(getURLParam("keyword"));
	
	if(keyword !="")
	{
		document.getElementById('VarelistSearchh1').innerHTML = '<br />Søgning på &quot;' + keyword.replace('+',' ') + '&quot;';
	}
	else
	{
		var keywordnew = unescape(getURLParamVareliste("keyword"));
		if(keywordnew !="")
		{
		document.getElementById('VarelistSearchh1').innerHTML = '<br />Søgning på &quot;' + keywordnew.replace('+',' ') + '&quot;';
		}
	}
}
//cookie functions
function setCookie(c_name,value,expiredays){
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function getCookie(c_name){
if (document.cookie.length>0){
	c_start=document.cookie.indexOf(c_name + "=");
	if (c_start!=-1){ 
	    c_start=c_start + c_name.length+1; 
    	c_end=document.cookie.indexOf(";",c_start);
	    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));} 
  }
return "";
}
//popup
function ProductAdded(prodnumber, caller, postorigin) 
{
	if(getCookie('popup') != "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;
			}
			else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
		        //IE 6+ in 'standards compliant mode'
		        myWidth = document.documentElement.clientWidth;
		        myHeight = document.documentElement.clientHeight;
		    } 
			else if(document.body &&(document.body.clientWidth || document.body.clientHeight)) {
		        //IE 4 compatible
		        myWidth = document.body.clientWidth;
		        myHeight = document.body.clientHeight;
		    } 
			
			document.getElementById("koebpopup").style.left 			= (myWidth/2-155+10)+"px";
			document.getElementById("koebpopup").style.top 				= (myHeight/2-235)+document.body.scrollTop+"px";
			document.getElementById("koebpopup").style.width 			= "419px";
			document.getElementById("koebpopup").style.height 			= "289px";
			document.getElementById("koebpopup").style.backgroundImage 	= "url(/images/dd/popup-bg.png)";
			document.getElementById("koebpopup").style.position		 	= "absolute";
			document.getElementById('koebpopup').style.display 			= "inline";
	
			var innerDIV = "<div><div style=\"height:30px\"></div><div style=\"margin-right:30px; width:30px; height:30px; float:right; cursor:pointer\" onclick=\"HideKoebPopup()\"></div></div>"
						+"<div style=\"float:left; margin:160px 0 0 55px\"><img onclick=\"HideKoebPopup()\" style=\"cursor:pointer\" src=\"/images/dd/kobmere.png\" onMouseOver=\"this.src='/images/dd/kobmere-hover.png'\" onMouseOut=\"this.src='/images/dd/kobmere.png'\"></div>"
						+"<div style=\"float:left; margin:160px 0 0 20px\"><a href=\"/shop/showbasket.html\"><img border=\"0\" style=\"cursor:pointer\" src=\"/images/dd/gatilkurven.png\" onMouseOver=\"this.src='/images/dd/gatilkurven-hover.png'\" onMouseOut=\"this.src='/images/dd/gatilkurven.png'\"></a></div>"
						+ "<br /><br /><div style=\"clear:both\"></div><div style=\"clear:left; padding-left:250px; margin-top:10px; color:#111\"><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('popup','on',100)
	setTimeout(HideKoebPopup, 1000);
}

function HideKoebPopup()
{
   document.getElementById('koebpopup').style.display = 'none';
}
//popup
function popup(width, height, url, name){
	window.open(url,name,"width="+width+",height="+height);
}

