
function remove_text(item, text) {
    if (item.value == text) {
        item.value = '';
    }
}


var popup = false; // Set to false to hide popups
var expDays = 14; // number of days the cookie should last

var page = "popup.html";  // The popup page
var windowprops = "width=420,height=320,location=no,toolbar=no,menubar=no,scrollbars=no,resizable=yes";

function GetCookie (name) {  
var arg = name + "=";  
var alen = arg.length;  
var clen = document.cookie.length;  
var i = 0;  
while (i < clen) {    
var j = i + alen;    
if (document.cookie.substring(i, j) == arg)      
return getCookieVal (j);    
i = document.cookie.indexOf(" ", i) + 1;    
if (i == 0) break;   
}  
return null;
}
function SetCookie (name, value) {  
var argv = SetCookie.arguments;  
var argc = SetCookie.arguments.length;  
var expires = (argc > 2) ? argv[2] : null;  
var path = (argc > 3) ? argv[3] : null;  
var domain = (argc > 4) ? argv[4] : null;  
var secure = (argc > 5) ? argv[5] : false;  
document.cookie = name + "=" + escape (value) + 
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
((path == null) ? "" : ("; path=" + path)) +  
((domain == null) ? "" : ("; domain=" + domain)) +    
((secure == true) ? "; secure" : "");
}
function DeleteCookie (name) {  
var exp = new Date();  
exp.setTime (exp.getTime() - 1);  
var cval = GetCookie (name);  
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
var exp = new Date(); 
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
function amt(){
var count = GetCookie('count')
if(count == null) {
SetCookie('count','1')
return 1
}
else {
var newcount = parseInt(count) + 1;
DeleteCookie('count')
SetCookie('count',newcount,exp)
return count
   }
}
function getCookieVal(offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}

function openPopup() {
var countpopup = GetCookie('countpopup');
if (countpopup == null) {
countpopup=1;
SetCookie('countpopup', countpopup, exp);

}
else {
countpopup++;
SetCookie('countpopup', countpopup, exp);
   }
if (countpopup+0 <= 3 && popup) {
    window.open(page, "", windowprops);
}

}

function openPopup2() { 
  myWin= open("", "displayWindow","width=500,height=400,status=no,toolbar=no,menubar=no"); 

  // open document for further output 
  myWin.document.open(); 
  
  // create document 
  myWin.document.write("<html><head><title>Belangrijk bericht"); 
  myWin.document.write("</title></head><body>"); 
  myWin.document.write("<center><font size=+3>"); 
  myWin.document.write("BENGSHOP is gesloten tussen kerst en oud en nieuw."); 
  myWin.document.write("Orders zullen vanaf de tweede week van januari worden geleverd<br />"); 
  myWin.document.write("BENGSHOP wenst u fijne kerstdagen en een gelukkig nieuwjaar."); 
  myWin.document.write("</font></center>"); 
  myWin.document.write("</body></html>"); 

  // close the document - (not the window!) 
  myWin.document.close();  
} 

function checkMinAantal(field, minaantal) {
   var value;
   
   value = document.getElementById(field).value;
   
   if (parseInt(value, 10) % minaantal != 0) {
   	alert('Afname in hoeveelheden van ' + minaantal + '.');
   	return false;
   }
   return true;
}


