
function openpopwindow(theURL,winName,features){
  theURL=encURL(theURL);
  win=window.open(theURL,winName,features);
  if (parseInt(navigator.appVersion) >= 4) win.window.focus();
}

function sp(merk,art){
   //art=encURL(art);
   openpopwindow('ShowProduct.csp?Merk=' + merk + '&Artc=' + art,'ShowProduct','width=610,height=605,resizable=yes,scrollbars=yes,location=no,directories=no,status=no');
}

function bookmarksite(artc, art){
	var bookmarkUrl= "http://www.veiligkopen.nl/veiligkopen/templates/results.csp?item=" + artc;
	var bookmarkName="Veiligkopen.nu Artikel: " + art;
	if (document.all) window.external.AddFavorite(bookmarkUrl, bookmarkName);
	else if (window.sidebar) window.sidebar.addPanel(bookmarkName, bookmarkUrl, "")
}

function encURL(str){
   str=encodeURI(str);
   while (str.indexOf('+')>0) str=str.replace('+','%2B');
   return str;
}

function addpro2(art) {
    art=encURL(art);
    var artUrl = "/veiligkopen/templates/zzzModCart.csp?Art=" + art
	if (window.opener &&!window.opener.closed){
		window.opener.location = artUrl;
		window.close();
		}else{
		  window.open(artUrl,'cart');	 
		}
}

function addpro(art,Secure) {
    art=encURL(art);
    var artUrl = "/veiligkopen/templates/zzzModCart.csp?Art=" + art
    if (Secure=="1"){
     artUrl = "https://www.veiligkopen.nu/veiligkopen/templates/zzzModCart.csp?Art=" + art;
    }

     if (window.opener &&!window.opener.closed){
		window.opener.location = artUrl;
		window.close();
		}
}

function addCart2(art) {
   art=encURL(art);
   var artUrl = "/veiligkopen/templates/zzzModCart.csp?Art=" + art
   window.location = artUrl;
}


function addCart(art,Secure) {
   art=encURL(art);
   if (Secure=="1"){
     window.location = "/veiligkopen/templates/zzzModCart.csp?Art=" + art;
   }else{
     window.location = "/veiligkopen/templates/zzzModCart.csp?Art=" + art;
   }
}

function checkRadio(item,destination){
    document.getElementById(destination).value=item.value
}

function ShowAanb(Aanb){
	window.open('../aanbieding/aanbieding'+Aanb+'.html','ShowProduct','width=800,height=640,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes');
}

function sizeToFit(object,width,height){
   var ratiox=object.width/width;
   var ratioy=object.height/height;
   if (ratioy>ratiox) {
	   object.height=object.height/ratioy;
   }else{
       object.width=object.width/ratiox;
   }
}

