
function customBodyLoad(sender)
{updatePayLink();}
function customBodyResize(sender,size)
{}
function customBodyScroll(sender)
{}
var map;var markers=[];function onAfterSlide(currSlideElement,nextSlideElement,options,forwardFlag)
{sIFR.replace(futuraMdCn,{selector:'h2.flashTitle20',wmode:'transparent',ratios:[],css:['.sIFR-root{font-weight: normal; color:#E0DCDA; text-align:left; letter-spacing:0;} a{color:#E0DCDA; text-decoration:none;} a:hover{color:#FFFFFF;}']});highLightMarker(markers[options.currSlide]);}
function initializeMap()
{var latlng=new google.maps.LatLng(53.000736,5.771599);var myOptions={zoom:11,center:latlng,disableDefaultUI:true,mapTypeId:google.maps.MapTypeId.ROADMAP};map=new google.maps.Map(document.getElementById("map_canvas"),myOptions);for(var i=0;i<locations.length;i++)
{addLocationToMap(locations[i]);}}
function addLocationToMap(location)
{var img="img/iconFles.png"
if(location.type==2)
img="img/iconGlas.png";if(location.tip==1)
img=img.replace("icon","iconTip");var image=new google.maps.MarkerImage(img,new google.maps.Size(23,32),new google.maps.Point(0,0),new google.maps.Point(0,32));var myLatLng=new google.maps.LatLng(location.latitude,location.longitude);var marker=new google.maps.Marker({position:myLatLng,map:map,icon:image,title:location.name,image:img});markers.add(marker);google.maps.event.addListener(marker,'click',function()
{highLightMarker(marker);JQ.query('#locations').cycle(location.position-1);JQ.query('#locations').cycle("pause");});}
function highLightMarker(marker)
{for(var i=0;i<markers.length;i++)
{var icon=markers[i].image.replace(".png","Current.png");if(icon.indexOf("Current")>0)
{icon=markers[i].image.replace("Current.png",".png");var image=new google.maps.MarkerImage(icon,new google.maps.Size(23,32),new google.maps.Point(0,0),new google.maps.Point(0,32));markers[i].setIcon(image);}}
var icon=marker.image.replace(".png","Current.png");var image=new google.maps.MarkerImage(icon,new google.maps.Size(23,32),new google.maps.Point(0,0),new google.maps.Point(0,32));marker.setIcon(image);map.panTo(marker.getPosition());}
function tip(ID)
{try
{HTTP=new XMLHttpRequest();HTTP.open("GET","misc/tipSellingPoint.aspx?itmID="+ID+"&random="+rndString(15),false);HTTP.send(null);if(HTTP.status!=200)
{alert("Er kon niet worden getipt");}
else
{if(HTTP.responseText=="true")
{var number=$("number_"+ID);if(number)
{if(number.innerHTML.length>0)
number.innerHTML=parseInt(number.innerHTML)+1;else
number.innerHTML="1";}}
else
alert("Je hebt deze locatie al getipt");}}
catch(error)
{alert(error.description);}}
function updatePayLink()
{var
aBetalen=document.getElementById("aBetalen");if(aBetalen)
{if(shop.Orders.Total!=null&&shop.Orders.Total.value()>0)
{aBetalen.href="javascript:void(pay());";aBetalen.className="betalenSmall";}
else
{aBetalen.href="javascript:void(0);";aBetalen.className="betalenSmall disabled";}}}
function shopChange(wizard,field,oldValue)
{if(field!=null)
{if(field.name=="Quantity"&&field.value()==0)
{shop.OrderDetails.removeRow(field.owner);var
divOrderDetail=document.getElementById("divOrderDetail_"+field.owner.ItmID.value());if(divOrderDetail)
divOrderDetail.parentNode.removeChild(divOrderDetail);}
if(field.name=="DiscountCode"&&field.value()!=null&&shop.Orders.Percentage.value()==0.0)
field.showError("De door u ingevoerde kortingscode is niet correct.");else
field.clearError();}
var
trKorting=document.getElementById("trKorting");if(trKorting)
{if(shop.Orders.Percentage.value()>0.0)
trKorting.style.display="";else
trKorting.style.display="none";}
updatePayLink();}
function addItems(sender,quantity,itmID,name,volume,price)
{var
details=shop.OrderDetails,rows=details.rows.length,row=details.getRow("ItmID",itmID),spnQuantity=document.getElementById("spnQuantity_"+itmID);if(row==null)
{if(quantity==0)
return;row=details.addRow(null,null,quantity,itmID,name,volume,price,price);}
else
{var
old=row.Quantity.value();row.Quantity.value(old+quantity);}
if(spnQuantity)
spnQuantity.innerHTML=row.Quantity.value();if(sender)
sender.className="btnBestellen aantal";}
function pay(url)
{if(typeof(url)=="undefined")
{if(shop.Orders.Total.value()==0.0)
alert("U heeft nog niets besteld!");else if(shop.OrderDetails.canSave())
document.location.href=payLink;else
{alert("Er zijn nog enkele gegevens niet ingevuld.");document.location.href=basketLink;}}
else
{shop.Orders.first();var
errors=shop.Orders.current().canSave();for(var i=0;i<errors.length;i++)
{if(errors[i].message)
errors[i].showError();else
errors[i].showError("U heeft dit veld nog niet ingevuld.");}
if(errors.length>0)
{if(typeof(errors[0].focus)!="undefined")
errors[0].focus();return;}
var
zipCode=/^(\d{4})\s?([a-z]{2}$)/gi;shop.Orders.ZipCode.value(shop.Orders.ZipCode.value().replace(zipCode,"$1 $2").toUpperCase());doGoogle();doMail();document.location.href=url;}}
function doMail()
{var
url=new Url();url=url.replacePage("misc/wdcSendMail.aspx");alert(url);url.request();}
function doGoogle()
{if(typeof(pageTracker)!="undefined")
{var
orderID=shop.Orders.ID.value(),code=shop.Orders.DiscountCode.value(),total=shop.Orders.Total.value(),city=shop.Orders.City.value();pageTracker._addTrans(orderID,code,total,0,0,city,"","Nederland");shop.OrderDetails.first();while(!shop.OrderDetails.eof)
{var
ID=shop.OrderDetails.ID.value(),name=shop.OrderDetails.Name.value(),price=shop.OrderDetails.Price.value(),quantity=shop.OrderDetails.Quantity.value();pageTracker._addItem(ID,ID,name,"Wodka",price,quantity);}}}
function goto(ID,type)
{var
url=new Url();url=url.remove("msg");url=url.add("ID",ID);if(type=="orders")
url=url.add("action","Details");else if(type=="discount")
url=url.add("action","Edit");document.location.href=url;}
function add()
{var
url=new Url();url=url.add("action","Add");document.location.href=url;}
function save(type)
{var
url=new Url();if(type=="orders")
{var
zipCode=/^(\d{4})\s?([a-z]{2}$)/gi;admin.Orders.ZipCode.value(admin.Orders.ZipCode.value().replace(zipCode,"$1 $2").toUpperCase());var
errors=admin.Orders.Rows(0).canSave();if(errors.length>0)
{for(var i=0;i<errors.length;i++)
{if(errors[i].message)
errors[i].showError();else
errors[i].showError("U heeft dit veld nog niet ingevuld.");}
if(typeof(errors[0].focus)!="undefined")
errors[0].focus();return;}
url=url.add("action","Save");}
else if(type=="discount")
{var
errors=admin.Discounts.Rows(0).canSave();if(errors.length>0)
{for(var i=0;i<errors.length;i++)
{if(errors[i].message)
errors[i].showError();else
errors[i].showError("U heeft dit veld nog niet ingevuld.");}
if(typeof(errors[0].focus)!="undefined")
errors[0].focus();return;}
url=url.add("action","Save");}
document.location.href=url;}
function cancel()
{document.location.href=new Url().filter("action","ID");}
function remove(ID,event)
{if(!confirm("Weet u zeker dat u deze kortingscode wilt verwijderen?"))
return;event.cancelBubble=true;var
url=new Url();url=url.add("action","Remove");url=url.add("ID",ID);document.location.href=url.remove("msg");}
