// <script>
var gmtTime=0,tf=core=utils=LD=content=this,tfc=tf.content,tfcd=tfc.document;
var wx=window.external,arrLoad=[];
if((typeof(isInLL) == 'undefined' || !isInLL) && typeof(wx.extractContentAndMoveToBody)!='undefined'&&tfc.document.styleSheets.length>0){
var cssHideBody=tfc.document.styleSheets[0];
if(cssHideBody.imports&&cssHideBody.imports.length>0)cssHideBody = cssHideBody.imports;
cssHideBody = cssHideBody[cssHideBody.length-1];
cssHideBody.addRule('body','visibility:hidden;overflow:hidden;');
}
function load(url,id,isLang){
if(wx&&wx.getPageID){
if(wx.getPageID()=='D-34'&&id=='index1holder'||wx.getPageID()=='D-33'&&id=='index2holder'){
wxecamtb(id);
}
else if(wx.getPageID()!='D-34'&&wx.getPageID()!='D-33'&&id=='core'){
var site='WebSiteContent',cntr='PageContainer1';
if(!gl(site))site='WebSite';
if(gl('PageContainer1')&&!gl('PageContainer11'))cntr='Content';
else if(gl('PageContainer11'))cntr='PageContainer11';
if(gl('Content')&&gl('Content').currentStyle.position=='absolute'||!gl(cntr))cntr='Content';
setTimeout("wxecamtb2('"+site+"','"+cntr+"')",50);
}}
}
function loadReady(){
if(d.readyState=='complete'){
for(var xid in arrLoad){
var a=arrLoad[xid];
d.body.insertAdjacentHTML('afterBegin','<iframe name="'+xid+'" id="'+xid+'" width="0" height="0" frameborder="0" border="0"></iframe>');
d.frames[xid].location.replace(tf.wm.url(a['url'],null,a['isLang']));
}
}
}
function loadCallback(doc,id){
id=id.replace(/^x_/,'');
var el=gl(id);
el.innerHTML=doc.body.innerHTML;
var parid=id;
while(el.parentNode&&el.parentNode.id!='WebSite'){
el=el.parentNode;
if(el.id&&!el.getAttribute('sf:object')&&el.className&&el.tagName!='BODY'){
parid=el.id;break;
}
}
wxecamtb(parid);
}
function wxecamtb(id){
var bReady=(d.readyState=='complete'&&!tfc.specialLoading&&typeof(ms_done)!='undefined'&&ms_done);
if(bReady){
a=d.getElementsByTagName('IFRAME');
for(var n=0;n<a.length;n++){bReady=(a[n].readyState=='complete');}
}
if(bReady){
if(typeof(cssHideBody)!='undefined')cssHideBody.removeRule(cssHideBody.rules.length-1);
setTimeout(function(){wx.extractContentAndMoveToBody('',id);}, 10);
}
else{setTimeout('wxecamtb("'+id+'")',50);}
}
function wxecamtb2(id,id2){
var bReady=(d.readyState=='complete'&&!tfc.specialLoading);
var a=d.getElementsByTagName('OBJECT');
for(var n=0;n<a.length;n++){bReady=(!a[n].Playing||a[n].object.ReadyState==4)}
if(bReady){
a=d.getElementsByTagName('IFRAME');
for(var n=0;n<a.length;n++){bReady=(a[n].readyState=='complete');}
}
if(bReady){
if(typeof(cssHideBody)!='undefined')cssHideBody.removeRule(cssHideBody.rules.length-1);
setTimeout(function(){wx.extractContentAndMoveToBody(id,id2);}, 10);
}
else{setTimeout('wxecamtb2("'+id+'","'+id2+'")',50);}
}
var currencies=new Array();
function currency(i,a,m,d) {
this.iso=i;
this.abbrev=a;
this.multiplier=m;
this.decimal_places=d;
}
var shopCurrency = new currency("EUR", "€", 1.0, 2);
var currentCurrency = shopCurrency;
var secondCurrency = null;
var d=document,loc=d.location,nav=navigator,wnd=window;
function winMgr(){this._a=[];this._rnd=Math.random();this.online=(loc.protocol.indexOf('file:')==-1);var h=(this.online?'':'file://')+loc.pathname.replace(/\\/g,'/');var re=new RegExp('(\/'+lang+')?\/contents\/.*?$|(\/'+lang+')?\/([^/]*){1}$');this.baseurl=h.replace(re,'/')+'contents/';}
winMgr.prototype.url=function(f,a,l){
var ff=unescape(f),unescaped=(ff!=f);
if(ff.indexOf(':\\')!=-1||ff.indexOf('://')!=-1)return f;
if(ff.substr(0,3)=='../'){f=ff.substr(3);if(unescaped)f=escape(f);}
if(!a&&a!='-')a=this._rnd;
if(l)f=tf.lang+'/'+f;
return (a=='-')?this.baseurl+f:this.add2Q(this.baseurl+f,'lmd',a);
}
winMgr.prototype.add2Q=function(h,p,v){
if(h.indexOf('?')==-1)return h+'?'+p+'='+v;
if(h.indexOf(p)==-1)return h+'&'+p+'='+v;
var t=h.replace('?','&').split('&');
for(var i=0;i<t.length;i++)if(t[i].indexOf(p+'=')==0)t[i]=p+'='+v;
if(t.length>1) t[1]='?'+t[1];return t.join('&').replace('&?','?');
}
winMgr.prototype.jfile=function(f,q){
var ff=unescape(f),unescaped=(ff!=f);
if(ff.indexOf('?')>-1){ff=ff.substr(0,ff.indexOf('?'));if(unescaped)f=escape(ff);}
var m=Math.max(f.lastIndexOf('/'),f.lastIndexOf('\\'));
return (m>-1)?f.substring(m+1):f;
}
var wm=new winMgr();
function addEvent(e,f,t){if(!t)var t=window;if (t.addEventListener)t.addEventListener(e.replace(/^on/,''),f,false);else if (t.attachEvent)t.attachEvent(e,f);}
var bskLoaded=true;
var internalEqualHeight={
applyAfterResizeCnt:0,
applyAfterResizeClass:[],
setupForAfterResize:function(){
for(var n=0,nn=internalEqualHeight['applyAfterResizeClass'].length;n<nn;n++){
addEventOnClass('onresize',internalEqualHeight['applyAfterResize'],internalEqualHeight['applyAfterResizeClass'][n]);
addEventOnClass('onactivate',function(evt){evt.srcElement.runtimeStyle.height='auto';},internalEqualHeight['applyAfterResizeClass'][n]);
}
},
applyAfterResize:function(){
if(!d.activeElement||d.activeElement.contentEditable!='true')return;
internalEqualHeight['applyAfterResizeCnt']++;
if(internalEqualHeight['applyAfterResizeCnt']>2){internalEqualHeight['applyAfterResizeCnt']=0;return;}
for(var n=0,nn=tf.equalHeightClass.length;n<nn;n++){
internalEqualHeight['engine'](tf.equalHeightClass[n]);
}
setTimeout(internalEqualHeight['applyAfterResize'], 0);
if(tf.equalHeight)setTimeout(tf.equalHeight, 200);
},
engine:function(c) {
if(!d.activeElement||d.activeElement.contentEditable!='true')return;
if(!c)c='EqualHeight';
var tfcd=tfc.document,maxh=0,coll=[],re = new RegExp(' ?'+c+'( |$)');
var atag=['DIV','SPAN','H1','H2','H3','TD'];
for(var ntag=0,nntag=atag.length;ntag<nntag;ntag++){
var t=tfcd.getElementsByTagName(atag[ntag]);
for (var x = 0, cnt=t.length; x<cnt; x++) {
var tx=t[x],cls=tx.className;
if (cls && cls.match(re) && tx.scrollHeight > 0) {
coll.push(tx);
if (tx.scrollHeight) {
var adjust=0;
if(tx.currentStyle){
adjust=isNaN(parseInt(tx.currentStyle.borderTopWidth))?0:parseInt(tx.currentStyle.borderTopWidth);
adjust+=isNaN(parseInt(tx.currentStyle.borderBottomWidth))?0:parseInt(tx.currentStyle.borderBottomWidth);
}
maxh = Math.max(maxh, tx.scrollHeight-adjust);
}
}
}
}
if(coll.length>1){
for (x=0,cnt=coll.length; x<cnt; x++) {
coll[x].runtimeStyle.height = maxh+'px';
}
}
}
};
addEvent('onload',internalEqualHeight['setupForAfterResize'],window);
function coreSettings(){
if (!tf.coreLoaded||!tf.core||!tf.core.Basket){setTimeout("coreSettings()",100);return;}
core=tf.core;
core.Basket.shDisc('103','','');
core.Basket.tax=new core.tax();
core.BTax=core.Basket.tax;
core.STax=new core.tax();
core.BTax.init(core.shopRegion,true);
core.STax.init(core.shopRegion,true);
core.BTax.addArea('TD1','NL','19.000','B.T.W.',true, 1);
core.BTax.addArea('TD1','05','19.000','B.T.W.',true, 1);
core.BTax.addArea('TD1','AT','19.000','B.T.W.',true, 1);
core.BTax.addArea('TD1','BE','19.000','B.T.W.',true, 1);
core.BTax.addArea('TD1','CY','19.000','B.T.W.',true, 1);
core.BTax.addArea('TD1','CZ','19.000','B.T.W.',true, 1);
core.BTax.addArea('TD1','DE','19.000','B.T.W.',true, 1);
core.BTax.addArea('TD1','DK','19.000','B.T.W.',true, 1);
core.BTax.addArea('TD1','EE','19.000','B.T.W.',true, 1);
core.BTax.addArea('TD1','ES','19.000','B.T.W.',true, 1);
core.BTax.addArea('TD1','FI','19.000','B.T.W.',true, 1);
core.BTax.addArea('TD1','FR','19.000','B.T.W.',true, 1);
core.BTax.addArea('TD1','GR','19.000','B.T.W.',true, 1);
core.BTax.addArea('TD1','HU','19.000','B.T.W.',true, 1);
core.BTax.addArea('TD1','IE','19.000','B.T.W.',true, 1);
core.BTax.addArea('TD1','IT','19.000','B.T.W.',true, 1);
core.BTax.addArea('TD1','LT','19.000','B.T.W.',true, 1);
core.BTax.addArea('TD1','LU','19.000','B.T.W.',true, 1);
core.BTax.addArea('TD1','LV','19.000','B.T.W.',true, 1);
core.BTax.addArea('TD1','MT','19.000','B.T.W.',true, 1);
core.BTax.addArea('TD1','PL','19.000','B.T.W.',true, 1);
core.BTax.addArea('TD1','PT','19.000','B.T.W.',true, 1);
core.BTax.addArea('TD1','SE','19.000','B.T.W.',true, 1);
core.BTax.addArea('TD1','SI','19.000','B.T.W.',true, 1);
core.BTax.addArea('TD1','SK','19.000','B.T.W.',true, 1);
core.BTax.addArea('TD1','UK','19.000','B.T.W.',true, 1);
// Add tax descriptions for taxes included into price
populateTSI();
core.confLoaded=true;
if(tf.core&&tf.updateTab&&tf.bsk)tf.updateTab();
}
coreSettings();
function populateTSI(){
if(!core)core=tf.core;
if(!core)return;
var TS=[];
TS['TD1']={inc:'incl B.T.W.',exc:'excl B.T.W.'};TS['TD1']={inc:'incl B.T.W.',exc:'excl B.T.W.'};TS['TD1']={inc:'incl B.T.W.',exc:'excl B.T.W.'};TS['TD1']={inc:'incl B.T.W.',exc:'excl B.T.W.'};TS['TD1']={inc:'incl B.T.W.',exc:'excl B.T.W.'};TS['TD1']={inc:'incl B.T.W.',exc:'excl B.T.W.'};TS['TD1']={inc:'incl B.T.W.',exc:'excl B.T.W.'};TS['TD1']={inc:'incl B.T.W.',exc:'excl B.T.W.'};TS['TD1']={inc:'incl B.T.W.',exc:'excl B.T.W.'};TS['TD1']={inc:'incl B.T.W.',exc:'excl B.T.W.'};TS['TD1']={inc:'incl B.T.W.',exc:'excl B.T.W.'};TS['TD1']={inc:'incl B.T.W.',exc:'excl B.T.W.'};TS['TD1']={inc:'incl B.T.W.',exc:'excl B.T.W.'};TS['TD1']={inc:'incl B.T.W.',exc:'excl B.T.W.'};TS['TD1']={inc:'incl B.T.W.',exc:'excl B.T.W.'};TS['TD1']={inc:'incl B.T.W.',exc:'excl B.T.W.'};TS['TD1']={inc:'incl B.T.W.',exc:'excl B.T.W.'};TS['TD1']={inc:'incl B.T.W.',exc:'excl B.T.W.'};TS['TD1']={inc:'incl B.T.W.',exc:'excl B.T.W.'};TS['TD1']={inc:'incl B.T.W.',exc:'excl B.T.W.'};TS['TD1']={inc:'incl B.T.W.',exc:'excl B.T.W.'};TS['TD1']={inc:'incl B.T.W.',exc:'excl B.T.W.'};TS['TD1']={inc:'incl B.T.W.',exc:'excl B.T.W.'};TS['TD1']={inc:'incl B.T.W.',exc:'excl B.T.W.'};TS['TD1']={inc:'incl B.T.W.',exc:'excl B.T.W.'};TS['TD1']={inc:'incl B.T.W.',exc:'excl B.T.W.'};
core.tsI=[];core.tsIx=[];
var country_code=(core.region)?core.region:core.shopRegion;
for(var s in TS){if((core.STax&&core.STax.forRegion(s,country_code))||(core.BTax&&core.BTax.forRegion(s,country_code))){core.tsI[s]=TS[s]['inc'];core.tsIx[s]=TS[s]['exc'];}}
}
function greySettings(){
if (!tf.coreLoaded||!tf.greyLoaded||!tf.shipping||!tf.shipping.shipping||!tf.cntyListLoaded){setTimeout("greySettings()",100);return;}
core=tf.core,grey=tf.shipping;
grey.core=core;
grey.ship=new grey.shipping(grey.cnty, 0, 0.000);
tf.ship_obj=grey.ship;
grey.ship.addMeth('SM1', 'Bezorgen na vooruitbetaling');
grey.ship.addRegn('SM1RS1','Lokale regio','NL,');
grey.ship.link('SM1','SM1RS1',0.000,'0',0,'0.000,9.990,4.95;9.990,49.950,8.95;49.950,99.000,12.95;99.000,200.000,17.95;200.000,1999.000,35.95;1999.000,99999.000,0',0.000,'0',0.000,0.000,'SM1,SM1RS1,0.000,0,0,0.000,9.990,4.95;9.990,49.950,8.95;49.950,99.000,12.95;99.000,200.000,17.95;200.000,1999.000,35.95;1999.000,99999.000,0,0.000,0,0.000,0.000/B72635EAB9AF1A00244B8AC4ACCCFFF3');
grey.ship.addRegn('SM1RS2','RegionSet 1','BE,DE,');
grey.ship.link('SM1','SM1RS2',0.000,'0',0,'0.000,99.000,19.5;99.000,400.000,41;400.000,2000.000,85;2000.000,3000.000,85;3000.000,99999.000,0',0.000,'0',0.000,0.000,'SM1,SM1RS2,0.000,0,0,0.000,99.000,19.5;99.000,400.000,41;400.000,2000.000,85;2000.000,3000.000,85;3000.000,99999.000,0,0.000,0,0.000,0.000/799799B02299DF83F3D6F119C128BA1A');
grey.ship.addMeth('SM4', 'Afhalen');
grey.ship.addRegn('SM4RS1','Lokale regio','NL,');
grey.ship.link('SM4','SM4RS1',0.000,'0',0,'0.000,99999.000,0',0.000,'0',0.000,0.000,'SM4,SM4RS1,0.000,0,0,0.000,99999.000,0,0.000,0,0.000,0.000/97E25F200C4307CF761CE05423A87568');
grey.ship.addMeth('SM10', 'Rembours verzending binnen Nederland');
grey.ship.addRegn('SM10RS1','Lokale regio','NL,');
grey.ship.link('SM10','SM10RS1',0.000,'0',0,'0.000,10.000,15.5;10.000,200.000,21;200.000,99999.000,55',0.000,'0',0.000,0.000,'SM10,SM10RS1,0.000,0,0,0.000,10.000,15.5;10.000,200.000,21;200.000,99999.000,55,0.000,0,0.000,0.000/24297F79DA84A4CE71F89C0F9D495197');
grey.ship.forAllProds={'SM1':1,'SM2':0,'SM3':0,'SM4':1,'SM6':0,'SM7':0,'SM8':0,'SM9':0,'SM10':1};
tf.shipping.serviceReady=true;
grey.ship.type('2', '35.000000');
}
greySettings();
function custInfo(){
var grey=tf.shipping;
var ret=[];
var FF=[
'1,Voornaam,customer_firstname,1,0,0,20,1,50,0,0,0,1,1,0,0,'
,'2,Achternaam,customer_lastname,1,0,0,20,1,50,0,0,0,1,1,0,0,'
,'4,Straat,customer_street,1,0,0,20,1,70,0,0,0,1,1,0,0,'
,'6,Huisnummer,customer_house_number,1,0,0,20,1,70,0,0,0,1,1,0,0,'
,'7,Postcode,customer_zip,1,0,0,20,1,20,0,0,0,1,1,0,0,'
,'8,Stad,customer_city,1,0,0,20,1,80,0,0,0,1,1,0,0,'
,'11,Land ,customer_country,1,0,0,20,1,80,0,0,0,1,1,0,0,'
,'12,Telefoon,customer_phone,1,0,0,20,1,25,0,0,0,1,1,0,0,'
,'14,E-mail,customer_email,1,0,0,20,1,200,0,0,0,1,1,0,0,'
,'15,Uw bericht aan ons,customer_notice,2,0,0,50,5,200,0,0,0,1,1,0,0,'
];
ret['Factuuradres']=grey.crCGIFlds('customer', FF);
var FF=[
'1,Voornaam,delivery_firstname,1,0,0,20,1,50,0,0,0,1,1,0,0,'
,'2,Achternaam,delivery_lastname,1,0,0,20,1,50,0,0,0,1,1,0,0,'
,'5,Huisnummer,delivery_house_number,1,0,0,20,1,70,0,0,0,1,1,0,0,'
,'6,Straat,delivery_street,1,0,0,20,1,70,0,0,0,1,1,0,0,'
,'7,Stad,delivery_city,1,0,0,20,1,80,0,0,0,1,1,0,0,'
,'10,Postcode,delivery_zip,1,0,0,20,1,20,0,0,0,1,1,0,0,'
,'11,Land ,delivery_country,1,0,0,20,1,80,0,0,0,1,1,0,0,'
,'12,Telefoon,delivery_phone,1,0,0,20,1,25,0,0,0,1,1,0,0,'
];
ret['Adres']=grey.crCGIFlds('customer', FF);
return ret;
}
function payMethod(){
var grey=tf.shipping;
var ret=[];
return ret;
}
tf.conf=this.window;
tf.confLoaded='nl';
var isIEBefore7=parseFloat(navigator.appVersion.split('MSIE')[1])<7;
var tfcd=tf.content.document;
var prpgmap={
pgMap:{},
prMap:{},
requested:{},
loaded:{},
onloadPgMap:function(oResp,fn){
tf.merge(this.pgMap,tf.sfJSON.parse(oResp.req.responseText));
if(fn)fn.call(this);
},
onloadPrMap:function(oResp,fn){
tf.merge(this.prMap,tf.sfJSON.parse(oResp.req.responseText));
if(fn)fn.call(this);
},
getParentPage:function(prid,pgid,fn){
if(!pgid){pgid=tf.content.pgid;}
pgid=pgid.toLowerCase();
prid=prid.toLowerCase();
var pridNum=parseInt(prid.substr(1)),pgidNum=parseInt(pgid.substr(1)),pgidFound=0;
if(pgid.indexOf('/'+tf.enterFilename)!=-1)pgidNum=-2;
var prmapURL='prpgmap/prmap_'+Math.floor(pridNum/2000)+'.js';
if(isNaN(pridNum)||this.prMap[pridNum]){
if(isNaN(pridNum))pgidFound=pgidNum;
else {
var a=this.prMap[pridNum];
if(typeof(a.length)=='number'&&typeof(a)!='string'){
pgidFound=a[0];
for(var n=1,num=a.length;n<num;n++){
if(a[n]==pgidNum||a[n].toString().indexOf(pgidNum+'_')==0){
pgidFound=a[n];
break;
}
}
}
else pgidFound=a;
}
var pgidSplit=(isNaN(pgidFound)?pgidFound.split('_'):[pgidFound]);
if(typeof(this.pgMap[pgidSplit[0]])!='undefined'){
var s=this.pgMap[pgidSplit[0]], internalURL=((s==''||s.indexOf('_')==0)||unescape(s).indexOf('://')==-1),specialPage=(parseInt(pgidSplit[0])<0);
if(parseInt(pgidSplit[0])==-2&&pgid.indexOf('/'+tf.enterFilename)!=-1)s=tf.enterFilename.replace(/\.[^.]*$/,'');
var f=(internalURL&&!specialPage?'d'+pgidSplit[0]:'')+s+(pgidSplit[1]?'_'+pgidSplit[1]:'')+(internalURL||(specialPage&&internalURL)?'.html':'');
return fn(f,prid,'d'+pgidSplit[0]);
}
else{
var pgmapURL='prpgmap/pgmap_'+Math.floor(Math.abs(pgidSplit[0])/2000)+'.js';
if(!tf.utils.prpgmap.requested[pgmapURL]){
tf.utils.prpgmap.requested[pgmapURL]=true;
new net.ContentLoader(
tf.wm.url(pgmapURL,'-'),
function(){tf.utils.prpgmap.onloadPgMap.call(tf.utils.prpgmap,this,function(){this.loaded[pgmapURL]=true;this.getParentPage(prid,pgid,fn);});},
null, null, 'GET', '');
}
else if(tf.utils.prpgmap.loaded[pgmapURL])return fn('',prid,pgid);
else setTimeout(function(){tf.utils.prpgmap.getParentPage(prid,pgid,fn)},0);
}
}
else{
if(!tf.utils.prpgmap.requested[prmapURL]){
tf.utils.prpgmap.requested[prmapURL]=true;
new net.ContentLoader(
tf.wm.url(prmapURL,'-'),
function(){tf.utils.prpgmap.onloadPrMap.call(tf.utils.prpgmap,this,function(){this.loaded[prmapURL]=true;this.getParentPage(prid,pgid,fn);});},
null, null, 'GET', '');
}
else if(tf.utils.prpgmap.loaded[prmapURL])return fn('',prid,pgid);
else setTimeout(function(){tf.utils.prpgmap.getParentPage(prid,pgid,fn)},0);
}
}
};
var tmplParser = {
parse:function(tmplName, vars) {
var el=(typeof(tmplName)=='string'?gl(tmplName):tmplName);
if(!el)return false;
var result=el.innerHTML.replace('<!--','').replace('-->','');
if(vars){
for(var param in vars){
var reg=eval('/__'+param+'__(?:="")?/gi'),val=new String(vars[param]);
result=result.replace(reg, val.replace(/\$/g,'&#36;'));
}
}
var reg = /__(LD_.+?)__/g;
result = result.replace(reg,
function($0, $1) {
var str = eval($1);
if (str) return str;
else return $1;
}
);
return result;
}
};
var sfMediaBox={
closeBox:function(){
var el=gl('sfLightBox'); if(el)el.parentNode.removeChild(el);
el=gl('sfLightBoxOverlay'); if(el)el.parentNode.removeChild(el);
this.showDropDowns(true);
},
centerBox:function(w,h,img){
var el=gl('sfLightBox');
if(el){
var tfcdb=(tf.isSafari||tf.isIE6?tf.content.document.documentElement:tf.content.document.body);
var el2=gl('sfLightBoxContents');
el2.style.width=w+'px';
el2.style.height=h+'px';
if(img)el2.style.overflow=(img.width<=w&&img.height<=h?'hidden':'auto');
el2=gl('sfLightBoxBody');
el2.style.width=w+'px';
el.style.marginLeft=(-el.offsetWidth/2 + tfcdb.scrollLeft)+'px';
el.style.marginTop=(-el.offsetHeight/2 + tfcdb.scrollTop)+'px';
}
},
hideLoading:function(){
if(gl('sfLightBoxLoading'))gl('sfLightBoxLoading').style.display='none';
},
showDropDowns:function(show){
function looper(a,show){
for(var i=0,num=a.length;i<num;i++){
a[i].style.visibility=(show?'visible':'hidden');
}
}
if(tf.isIE6)looper(tfcd.getElementsByTagName('SELECT'),show);
looper(tfcd.getElementsByTagName('OBJECT'),show);
},
content_onload:function(o){
var el2=gl('sfLightBoxContents'),oi1=o.getAttribute('index'),oi2=el2.getAttribute('index');
if(oi1!=oi2)return;
if(o.width==0||o.height==0)return;
this.centerBox(this.getVirtualWidth(o.width),this.getVirtualHeight(o.height),o);
this.hideLoading();
},
render:function(o,a,isMM){
var el=tfcd.createElement('div');
el.innerHTML=(typeof(a)=='function'?a(o):a);
for(var i=0,num=el.childNodes.length;i<num;i++){
if(tf.isIE&&isMM)el.childNodes[0].style.visibility='hidden';
var elNew=o.tfcdb.appendChild(el.childNodes[0]);
if(tf.isIE6&&elNew.currentStyle.position=='fixed')elNew.style.position='absolute';
if(tf.isIE&&isMM)setTimeout(function(){elNew.style.visibility='visible';},20);
}
},
getVirtualWidth:function(w){ return Math.max(100,Math.min(w,this.tfcdb.offsetWidth * 0.9)); },
getVirtualHeight:function(h){ return Math.max(100,Math.min(h,this.tfcdb.offsetHeight * 0.8)); },
gl:function(s){try{return d.getElementById(s);}catch(e){return null;}},
tfcdb:(tf.isSafari?tfcd.documentElement:tfcd.body),
relPrefix:(tf.isEntryPage?(tf.lang!=tf.baseLang?'../':'')+'contents/':'../'),
close_onclick:'tf.utils.sfMediaBox.closeBox();return false;',
aHTML:[
function(o){ return tmplParser.parse(o.gl('tmplSFLightBoxOverlay'), { height:'100%', close_onclick:o.close_onclick }); },
function(o){ return tmplParser.parse(o.gl('tmplSFLightBox'), o.data); }
],
aRef:[],
aPrefetch:[],
init:function(names){
this.closeBox();
this.aRef=[];
this.aPrefetch=[];
var a=tfcd.getElementsByTagName('A');
for(var n=0,nn=a.length;n<nn;n++){
for(var m=0,mm=names.length;m<mm;m++){
if(a[n].rel=='sfMediaBox['+names[m]+']'){
this.aRef.push(a[n]);
}
}
}
if(this.aRef.length>0 && this.aRef[0].mediaType!='MM'){
this.render(this, this.aHTML[0]);
this.aPrefetch[0]=new Image();
this.aPrefetch[0].onload=function(){
for(var n=1,nn=sfMediaBox.aRef.length;n<nn;n++){
var img=new Image();
img.loaded=false;
img.onload=function(){this.loaded=true;}
img.src=sfMediaBox.aRef[n].href;
sfMediaBox.aPrefetch.push(img);
}
}
this.aPrefetch[0].src=this.aRef[0].href;
this.showContents(0);
}
},
showContents:function(n){
var el=gl('sfLightBox');if(el)el.parentNode.removeChild(el);
var o=this.aPrefetch[n],oo=this.aRef[n];
if(!o){this.aPrefetch[0].onload();o=this.aPrefetch[n];}
var isMM=(oo.getAttribute('mediaType')=='MM'),w=o.width,h=o.height;
if(isMM){w=oo.getAttribute('mw');h=oo.getAttribute('mh');}
var vw=this.getVirtualWidth(w), vh=this.getVirtualHeight(h);
this.data={
navdisplay:(this.aRef.length>1?'inline':'none'), captiondisplay:'block', counterdisplay:'block',
relprefix:this.relPrefix,
close_onclick:this.close_onclick,
prev_visible:(this.aRef.length==1?'hidden':'visible'), next_visible:(this.aRef.length==1?'hidden':'visible'),
count:this.aRef.length, index:n+1,
prev_onclick:'tf.utils.sfMediaBox.showContents('+(n==0?this.aRef.length-1:n-1)+');return false;',
next_onclick:'tf.utils.sfMediaBox.showContents('+(n==this.aRef.length-1?0:n+1)+');return false;',
width:vw+'px', height:vh+'px',
overflow:(w==0||h==0?'hidden':(w<=vw&&h<=vh?'hidden':'auto')),
title:(oo.title?oo.title:''), description:(oo.getAttribute('description')?oo.getAttribute('description'):''),
loadingdisplay:(o.loaded||isMM?'none':'block'),
marginleft:(-vw/2+this.tfcdb.scrollLeft)+'px', margintop:(-vh/2+this.tfcdb.scrollTop)+'px',
contents:(isMM?
this.getMMHTML(oo.id,oo.href,oo.getAttribute('filetype'),w,h,oo.title):
tmplParser.parse(this.gl('tmplSFLightBoxImage'), { src:o.src, index:n+1, onload:(o.loaded?'':'tf.utils.sfMediaBox.content_onload(this);') })
)
};
this.showDropDowns(false);
this.render(this, this.aHTML[1], isMM);
this.centerBox(vw,vh);
},
getMMHTML:function(id,s,t,w,h,title){
if(typeof(isInLL)=='undefined'||!isInLL){if(s.indexOf('file:/')==0)s=unescape(s.replace(/^file:\/+/,'').replace(/\//g,'\\'));if(!tf.wm.online){s=tf.wm.url(unescape(s),'-');s=s.replace(/\\/g,'/').replace(/^(?:file:\/+)?(.*)$/,'file:///$1');}}
var src=unescape(s);
return sfMM([id,'',t,src,w,h,w,h,title]);
}
}
function populatePrice(){var a=tfc.ppriceArr;if(!a||!tf.core.region){setTimeout('tf.utils.populatePrice()',1000);return;}for(var i=0,l=a.length;i<l;i++){var el=gl('ProductPrice-'+a[i][0]);if(el){var s=tf.core.pprice(el,a[i]);if(s)el.innerHTML=s;}}}
function populatedata(){
tfc.specialLoading=true;
if(wx&&typeof(wx.getPageID)=='function'&&(wx.getPageID()=='D-34'||wx.getPageID()=='D-33'))return;
if(!tf.conf){tf.load('conf.html','conf',true);}
core=tf.core;
if(!tfc.ppriceArr||!tf.bskLoaded||!tf.conf||!core||!core.confLoaded||!tf.coreLoaded||!core.tsI){setTimeout('populatedata()',50);return;}
if(tfc.timedDiscountsExist){tf.core.active_servers=[];tf.core.ping.go(false);tf.core.currTime.getTime();}
populatePrice();
a=tfc.weightArr;for(var i=0,l=a.length;i<l;i++){var s=a[i][1].toString(),el=gl('ProductWeightFormatted-'+a[i][0]);if(el)el.innerHTML=core.nfmt.display(s,s.length-s.indexOf('.')-1,'');}
a=tfc.bpriceArr;for(var i=0,l=a.length;i<l;i++){var el=gl('ProductBasePrice-'+a[i][0]);if(el)el.innerHTML=core.bprice(a[i]);}
a=tfc.crFFldArr;var optHTML=[];for(var i=0,l=a.length;i<l;i++){var choicesOnly=a[i][12],id=a[i][choicesOnly?2:8];if(!optHTML[id])optHTML[id]='';optHTML[id]+=core.crFFld(a[i]);}
for(var i in optHTML){var el=gl((choicesOnly?'ProductOptionChoices-':'ProductOptions-')+i);if(el)el.innerHTML=optHTML[i];}
tfc.specialLoading=false;
if(tfc.equalHeight)setTimeout(tfc.equalHeight,0);
}
function sfMM(a){
var wm, id=a[0],lmd=a[1],t=a[2],src=a[3],w=parseInt(a[4]),h=parseInt(a[5]),mw=parseInt(a[6]),mh=parseInt(a[7]),alt=a[8];
if(src.toLowerCase().lastIndexOf(t)==src.length-t.length){
if(typeof(isInLL)=='undefined'||!isInLL){src=tf.wm.url(src,'-');src=src.replace(/\\/g,'/');if(!tf.wm.online)src=src.replace(/^(file:\/\/)?(.*)$/,'file://$2');}
src=unescape(src); w=(w>0?w:mw); h=(h>0?h:mh);
var dim=' width="'+w+'" height="'+h+'"',s='';
switch(t){
case 'swf':
s+='<object classid="CLSID:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" '+dim+' title="'+alt+'">	<param name="movie" value="'+src+'" /> <param name="src" value="'+src+'" /> <param name="wmode" value="opaque" /> <param name="menu" value="false" /> <embed src="'+src+'" '+dim+' title="'+alt+'"  type="application/x-shockwave-flash" wmode="opaque" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" menu="false" /> </object>';
break;
case 'mp3':
s+='<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="'+w+'" height="16"> <param name="src" value="'+src+'" /> <param name="autoplay" value="false" /> <param name="controller" value="true" /> <param name="wmode" value="opaque" /> <embed type="audio/mpeg" src="'+src+'" width="'+w+'" height="16" autoplay="false" controller="true" wmode="opaque" pluginspage="http://www.apple.com/quicktime/download/" /> </object>';
break;
case 'mov': case 'avi': case 'mpg':
s+='<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" '+dim+' title="'+alt+'"> <param name="src" value="'+src+'" /> <param name="autoplay" value="false" /> <param name="controller" value="true" /> <param name="scale" value="aspect" /> <param name="wmode" value="opaque" /> <embed type="video/mpeg" src="'+src+'" '+dim+' title="'+alt+'" autoplay="false" scale="aspect" controller="true" wmode="opaque" pluginspage="http://www.apple.com/quicktime/download/" /> </object>';
break;
case 'wmv':
s+='<object classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" type="video/x-ms-wmv" '+dim+' title="'+alt+'"> <param name="URL" value="'+src+'" /> <param name="AutoStart" value="false" /> <param name="ShowTracker" value="true" /> <param name="ShowControls" value="true" /> <param name="ShowGotoBar" value="false" /> <param name="ShowDisplay" value="false" /> <param name="ShowStatusBar" value="false" /> <param name="AutoSize" value="false" /> <param name="StretchToFit" value="true" /> <param name="wmode" value="transparent" /> <object type="application/x-ms-wmp" '+dim+' title="'+alt+'"> <param name="URL" value="'+src+'" /> <param name="AutoStart" value="true" /> <param name="ShowTracker" value="true" /> <param name="ShowControls" value="true" /> <param name="ShowGotoBar" value="false" /> <param name="ShowDisplay" value="false" /> <param name="ShowStatusBar" value="false" /> <param name="AutoSize" value="false" /> <param name="StretchToFit" value="true" /> <param name="wmode" value="transparent" /> <a></a><!--IE workaround--> </object></object>';
break;
case 'flv':
s+='<object id="flvplayer_'+id+'" '+dim+' title="'+alt+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0"> <param value="../media/flowplayer.swf" name="movie" /> <param value="true" name="allowfullscreen" /> <param value="always" name="allowscriptaccess" /> <param name="wmode" value="opaque" /> <param value=\'config={"playerId":"flvplayer_'+id+'","clip":{"url":"'+src+'","autoPlay":false}}\' name="flashvars" /> <object id="player" '+dim+' title="'+alt+'" data="../media/flowplayer.swf"> <param value="true" name="allowfullscreen" /> <param value="always" name="allowscriptaccess" /> <param name="wmode" value="opaque" /> <param value=\'config={"playerId":"flvplayer_'+id+'","clip":{"url":"'+src+'","autoPlay":false}}\' name="flashvars" /> <a></a><!--IE workaround--> </object> </object>';
break;
case 'class':
s+='<applet code="'+tf.wm.jfile(src).replace(/\?.*/,'')+'" codebase="'+tf.loc.toString().replace(/[^\/]*$/,'contents/media/')+'"'+dim+' title="'+alt+'"></applet>';
break;
default:
s+='<embed src="'+src+'" quality="high" '+dim+' title="'+alt+'"></embed>';
}
}
return s;
}
function sfMMDraw(){var a=tfc.aMM;if(a){for(var i=0,num=a.length;i<num;i++){if(a[i]){var aa=a[i],el=gl(aa[0]);if(el){if(tf.isIE)el.style.visibility='hidden';el.innerHTML=sfMediaBox.getMMHTML(aa[0],aa[3],aa[2],aa[4],aa[5],aa[8]);a[i]=null;if(tf.isIE)setTimeout('gl("'+aa[0]+'").style.visibility="visible"',20);}}}}}
function pngIE(d){
if(!isIEBefore7)return;
if(tf.content.aMS.length>0&&!tf.utils.ms_done){setTimeout(function(){pngIE(d);},100);return;}
d=d?d:tfc.document,a=d.images,alpha="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader";
for(var i=0,ii=a.length;i<ii;i++){
if(!a[i])continue;
var img=a[i],imgName=img.src;
if (imgName.substring(imgName.length-3,imgName.length).toUpperCase()=="PNG"){
if(img.width==0&&img.height==0)continue;
var imgID=(img.id?'id="'+img.id+'" ':'');
var imgClass=(img.className?'class="'+img.className+'" ':'');
var imgTitle='title="'+(img.title?img.title:img.alt)+'" ';
var imgStyle='display:inline-block;'+img.style.cssText;
if (img.align=="left"||img.align=="right")imgStyle='float:'+img.align+';'+imgStyle;
if (img.parentElement.href)imgStyle='cursor:hand;'+imgStyle;
function cdestrip(o,e){return o[e]?e+'="'+o[e].toString().replace(/^([\n\r]|.)*\{[\n\r]*(([\n\r]|.)*)[\n\r]*\}[\n\r]*$/,'$2')+'" ':'';}
var s="<span "+cdestrip(img,'onmouseover')+cdestrip(img,'onmouseout')+imgID+imgClass+imgTitle+" style=\""+"width:"+img.width+"px;height:"+img.height+"px;"+imgStyle+";"+alpha+"(src=\'"+img.src.replace(/\'/,'%27').replace(/\(/g,'%28').replace(/\)/g,'%29')+"\',sizingMethod='scale');\" src=\'"+img.src+"\'></span>";
img.outerHTML=s;
i--;
}}
var an=['DIV','SPAN','H1','TD','INPUT'];
for(var n in an){
var a=d.getElementsByTagName(an[n]);
for(var i=0,ii=a.length;i<ii;i++){
var img=a[i],src=img.currentStyle.backgroundImage.replace(/url\(\"(.*)\"\)/,'$1');
pngIEbg(img,src);
}}}
function pngIEbg(img,src,title){
if(!isIEBefore7)return;
if (src.substring(src.length-3,src.length).toUpperCase()=="PNG"){
img.style.backgroundImage='none';
img.style.cssText=img.style.cssText+";"+this.alpha+"(src='"+src.replace(/\'/,'%27').replace(/\(/g,'%28').replace(/\)/g,'%29')+"',sizingMethod='scale');";
}}
function imgs(){sfMMDraw();pngIE();}
function applyms(){
if(typeof(ms)=='function'&&(!tf.extra||tf.extra.loadInProgress<1)){
var aMS=tf.content.aMS;
if(aMS){
var cnt=aMS.length,a;
for(var n=0;n<cnt;n++){a=aMS[n];ms(a[0],a[1],a[2],a[3]);}
}
}
else{setTimeout('applyms()',100);}
}
var ms_rv,ms_lv,ms_dv,ms_uv,ms_oldn,ms_n,ms_sp=3,ms_sp2=20;
function ms_rt(id){var el=gl('ms_'+id),x=el.offsetLeft;if(x>(ms_n-ms_oldn-(tf.isChrome?36:0)))el.style.left=(x-ms_sp)+'px';ms_rv=setTimeout('ms_rt(\''+id+'\')',ms_sp2);}
function ms_lt(id){var el=gl('ms_'+id),x=el.offsetLeft;if(x<0)el.style.left=(x+ms_sp)+'px';ms_lv=setTimeout('ms_lt(\''+id+'\')',ms_sp2);}
function ms_dn(id){var el=gl('ms_'+id),y=el.offsetTop;if(y>(ms_n-ms_oldn-(tf.isChrome?18:0)))el.style.top=(y-ms_sp)+'px';ms_dv=setTimeout('ms_dn(\''+id+'\')',ms_sp2);}
function ms_up(id){var el=gl('ms_'+id),y=el.offsetTop;if(y<0)el.style.top=(y+ms_sp)+'px';ms_uv=setTimeout('ms_up(\''+id+'\')',ms_sp2);}
function ms_stop(dir){clearTimeout(eval('ms_'+dir.substr(0,1)+'v'));}
function ms_set(oldn,n,sp,sp2){ms_oldn=oldn;ms_n=n;if(typeof(sp)!='undefined')ms_sp=sp;if(typeof(sp2)!='undefined')ms_sp2=sp2;}
function searchload(url,force){
tf.searchPhrase=tfc.document.search.phrase.value.toLowerCase();
if (tf.searchPhrase==''&&!force) return;
tf.nametag.add('searchPhrase',tf.searchPhrase);
url+='?searchphrase='+window.encodeURI(tf.searchPhrase);
tfc.location=tf.wm.url(url,'-');
}
function search(){searchload(tf.lang+'/search.html')}
function search_all(advanced)
{
if ( tf.loc.hostname=='127.0.0.1' || tf.loc.hostname=='')
{
alert(tf.LD.LD_PHPSEARCH_ONLY_WHEN_PUBLISHED);
}
else
{
tf.searchAdvanced=advanced;
if(typeof(tf.searchAdvanced)!='undefined')tf.nametag.add('searchAdvanced',tf.searchAdvanced);
searchload(tf.lang+'/search.html',true);
}
}
function showPopup(url, width, height, useOverlay){
function gl(s){try{return d.getElementById(s);}catch(e){return null;}}
var tfcd=tfc.document,tfcdb=(tf.isSafari?tfcd.documentElement:tfcd.body);
var w=width||640, h=height||480;
var a=[
(useOverlay?tmplParser.parse(gl('tmplSFLightBoxOverlay'), { height:tfcdb.scrollHeight+'px', close_onclick:tf.utils.sfMediaBox.close_onclick }):''),
tmplParser.parse(gl('tmplSFLightBox'),
{
relprefix:(tf.isEntryPage?(tf.lang!=tf.baseLang?'../':'')+'contents/':'../'),
captiondisplay:'none', navdisplay:'none', counterdisplay:'none',
cssborder:'border:1px #999999 solid;',
contents:tmplParser.parse(gl('tmplSFLightBoxFrame'), { src:url, height:h+'px', onload:'tf.utils.sfMediaBox.centerBox('+w+','+h+');tf.utils.sfMediaBox.hideLoading();return false;'}),
close_onclick:tf.utils.sfMediaBox.close_onclick,
width:w+'px', height:h+'px', marginleft:(-w/2+tfcdb.scrollLeft)+'px', margintop:(-h/2+tfcdb.scrollTop)+'px'
}
)
];
sfMediaBox.showDropDowns(false);
for(var n=0,nn=a.length;n<nn;n++){
sfMediaBox.render(sfMediaBox,a[n]);
}
}
function displayResellerForm(){
function ihtml(el,str){el.innerHTML=str;tf.ldwrite();}
var elForm=gl('ResellerForm');ld=tfc.ld;
if(tf.coreLoaded&&tf.bskLoaded&&elForm){
core=tf.core;
if(core.ResellerID!=''){ihtml(elForm,'<span class="SignUp"><a href="#" onclick="if(core){core.ResellerID=\'\';core.ResellerPasswd=\'\';delete core.Basket.gdisc;tf.saveBskToName();tf.nametag.add(\'coreProperties\',tf.sfJSON.stringify(core.getCoreProperties()));}tf.wm.rld(tf.content);return false;">'+ld('LD_LOGOUT','Uitloggen')+'</a></span>');}
else{
if(core&&core.Basket&&core.Basket.gdisc)core.Basket.gdisc=new core.dynObj('discount');
ihtml(elForm,'<a href="#" onclick="location=tf.wm.url(\'login.html\',\'-\',1)"><span class="SignUp">'+tf.ldwriteadd('LD_LOGIN','Inloggen')+'</span></a>&nbsp;&nbsp;&nbsp;<a href="#" onclick="if(!tf.wm.online){alert(LD.LD_SHOP_MUST_BE_PUBLISHED);return false;}else tf.utils.showPopup(\'https://www.globecharge.com/webshop/customer_signon.cgi?pid=UmFuZG9tSVbn43UZ7Pz8UAgLpJMHkSUbk1yxIQnl5qA%3d&lang=\'+tf.lang,0,0,true);return false;"><span class="SignUp">'+tf.ldwriteadd('LD_SIGN_UP','Aanmelden')+'</span></a>');
}
if(core.Basket){core.Basket.refreshTotal();core.Basket.invalidate();}
tfc.specialLoading=false;
if(tf.mfhObj)tf.mfhObj.resize(null,true);
}
else{setTimeout('displayResellerForm()',500);}
}
function equaldiv(c) {
if(!c)c='EqualHeight';
var tfcd=tfc.document,maxh=0,coll=[],re = new RegExp(' ?'+c+'( |$)');
var atag=['DIV','SPAN','H1','H2','H3','TD','A','LI'];
for(var ntag=0,nntag=atag.length;ntag<nntag;ntag++){
var t=tfcd.getElementsByTagName(atag[ntag]);
for (var x = 0, cnt=t.length; x<cnt; x++) {
var tx=t[x],cls=tx.className;
if (cls && cls.match(re) && tx.scrollHeight > 0) {
coll.push(tx);
if (tx.scrollHeight) {
var adjust=0;
if(tx.currentStyle&&!tf.isOpera){
adjust=isNaN(parseInt(tx.currentStyle.borderTopWidth))?0:parseInt(tx.currentStyle.borderTopWidth);
adjust+=isNaN(parseInt(tx.currentStyle.borderBottomWidth))?0:parseInt(tx.currentStyle.borderBottomWidth);
}
else {
tx.style.height='auto';
}
maxh = Math.max(maxh, tx.scrollHeight-adjust);
}
}
}
}
if(coll.length>1){
for (x=0,cnt=coll.length; x<cnt; x++) {
if(tf.isIE7){var tester=tf.gl('for-Sidebar_R')||tf.gl('for-RightStrip');if(!tester||tester.disabled==true){if(coll[x].currentStyle.position!='absolute')coll[x].style.position = 'relative';} coll[x].className=coll[x].className;}
coll[x].style.height = maxh+'px';
}
}
}
var fadeMagic = {
inst: 0,
step: 0,
orig: 1,
wait: 2000,
lat: 100,
decr: 0.05,
nl: null,
insts: 0,
ieOvr: 1,
start: function(nl, orig, decr, lat, wait, ieOvr) {
fadeMagic.nl = nl;
fadeMagic.insts = nl.length;
fadeMagic.inst = fadeMagic.insts - 1;
fadeMagic.orig = orig;
fadeMagic.decr = decr;
fadeMagic.lat = lat;
fadeMagic.wait = wait;
fadeMagic.ieOvr = ieOvr;
fadeMagic.fade();
},
fade: function() {
var inst = ((fadeMagic.inst + 1) % fadeMagic.insts);
fadeMagic.step = fadeMagic.step - fadeMagic.decr;
if(fadeMagic.step <= 0)
fadeMagic.step = 0;
var elsCurr=fadeMagic.nl[fadeMagic.inst].style,elsNext=fadeMagic.nl[inst].style;
elsCurr.opacity = fadeMagic.step;
elsNext.opacity = fadeMagic.orig - fadeMagic.step;
elsCurr.filter = 'alpha(opacity='+(fadeMagic.step*100*fadeMagic.ieOvr)+')';
elsNext.filter = 'alpha(opacity='+(((fadeMagic.orig*100)-(fadeMagic.step*100))*fadeMagic.ieOvr)+')';
elsCurr.zIndex=0;
elsNext.zIndex=1;
if(fadeMagic.step == 0) {
fadeMagic.step = fadeMagic.orig;
fadeMagic.inst = inst;
window.setTimeout('fadeMagic.fade();', fadeMagic.wait[inst > fadeMagic.wait.length - 1 ? fadeMagic.wait.length - 1 : inst]);
}
else
window.setTimeout('fadeMagic.fade();', fadeMagic.lat);
}
}
var elLinkSF = gl('LinkSF');
if(elLinkSF){
var elsLinkSF=elLinkSF.style;
var nl = elLinkSF.childNodes;
for(var n=0,len=nl.length;n<len;n++){
nl[n].style.position = 'absolute';
nl[n].style.opacity = 0.0;
nl[n].style.filter = 'alpha(opacity=0)';
}
fadeMagic.start(nl, 2, 0.3, 250, [2000, 2000, 4000, 2000], 0.4);
}
var navRO=tf.navRO,navOvr=tf.navOvr,navOut=tf.navOut,navClk=tf.navClk;
var tf=parent.tf,LD=tf,tfc=tf.content;
if(typeof(SymRealWinOpen)!='undefined')window.open=SymRealWinOpen;
if(window.NS_ActualOpen){window.open=NS_ActualOpen;}
var str_sep1='~|`';
var shopName='Savannah Wellness',shopRegion='NL';
var confLoaded=false;
var region='',regionChanged=false,method='';
function getCoreProperties(){
if(voucher!=null&&voucher.type!=0)voucher['wssig']=tf.wssig;
return {'active_servers':active_servers,'region':region,'regionChanged':regionChanged,'method':method,'ResellerID':ResellerID,'gmtTime':gmtTime,'reseller':reseller,'voucher':voucher};
}
function setCoreProperties(arr){
for(var s in arr){
if(s=='voucher'){if(arr[s].wssig==tf.wssig)tf.merge(voucher,arr[s]);}
else if(s=='reseller'){tf.merge(reseller,arr[s]);}
else this[s]=arr[s];
}
}
function ld(name,sf,args){var s;if(LD)s=LD[name];if(!LD||!s)s=(sf)?sf:'';if(args){var sa=s.split('%%');s='';for(var i=0;i<sa.length;i++)if(args[i])s+=sa[i]+args[i];else s+=sa[i];}return s.replace('%%','');}
var d=document;function dw(s){d.write(s);}function gl(s){return d.getElementById(s);}
function isInSF(){try{if(window.external&&typeof(window.external.isInSF)!='undefined')return true;else return false;}catch(e){return false;}}
function isInDesigner(){try{return typeof(tf.parent.applyColorScheme)!='undefined';}catch(e){return false;}}
function dw(s){document.write(s);}
var scr={
load:function(id,url){
this.rmv(id);
var scr=d.createElement('script');
scr.id=id;
scr.src=url;
scr.type='text/javascript';
d.getElementsByTagName("head")[0].appendChild(scr);
},
rmv:function(id){var el=gl(id);if(el)d.getElementsByTagName("head")[0].removeChild(el);}
};
var active_servers=[],gmtTime=0;
var ping={
timer1:null,
timer2:null,
timer3:[],
poll:function(){
if(typeof(country_code)=='undefined'){ping.timer1=setTimeout("ping.poll()",100);return;}
if(active_servers.length>0){for(var tt in ping.timer3){clearTimeout(ping.timer3[tt]);}ping.timer3=[];}
clearTimeout(ping.timer2);ping.timer2=null;clearTimeout(ping.timer1);ping.timer1=null;
if(country_code!=''&&country_code!='A1'&&country_code!='A2'&&shopRegion.indexOf(country_code)!=0)region=country_code;
else if(shopRegion.indexOf(country_code)==0)region=shopRegion;
tf.nametag.add('coreProperties',tf.sfJSON.stringify(getCoreProperties()));
},
failed:function(){
if(ping.timer2){
clearTimeout(ping.timer1);
if(ping.timer3.length==0)ping.go(true);
if(!region){region=shopRegion;if(tf.utils)tf.utils.populatePrice();}
}
},
go:function(all){
if(active_servers.length>0)return;
function id(n){return'ping'+servers[n].replace(/[^a-zA-Z0-9]/g,'');}
function url(n){return servers[n]+fake_country+'t='+tf.testShop+'&u='+escape(location.protocol+'//'+location.hostname+tf.wm.baseurl)+'&lmd='+(tf.lmd?tf.lmd['index']:'');}
var i=0,servers='http://timecheck.shopfactory.com/ping/v7ping.js,http://secure11.globecharge.com/ping/v7ping.js,http://secure17.globecharge.com/ping/v7ping.js,http://secure18.globecharge.com/ping/v7ping.js,http://secure19.globecharge.com/ping/v7ping.js,http://secure20.globecharge.com/ping/v7ping.js'.split(','),fake_country=(tf.parm&&tf.parm['fake_country'])?'?c='+tf.parm['fake_country']+'&':'?';
scr.load(id(i),url(i));
if(all){
for(i=1;i<servers.length;i++){
ping.timer3.push(setTimeout("scr.load('"+id(i)+"','"+url(i)+"')",1000*i));
}
}
else ping.timer2=setTimeout('ping.failed()',5000);
ping.poll();
}
};
if(!isInSF()){setCoreProperties(tf.sfJSON.parse(tf.nametag.get('coreProperties')));ping.go(false);}
else{country_code=region=shopRegion;} // We don't ping if in SF, so we need to initialise country_code
tf.wm.rld=function(w,u,p,h){if(w==null)return;if(u==null)w.location.reload();else w.location=this.url(u,p,h);return;}
tf.wm.pProp=function(id,prop){if(this._pArr==null)this._pArr=[];if(prop!=null)this._pArr[id]=prop;return this._pArr[id];}
tf.wm.pPropStk=function(id,fld,val){if(this._pArr[id])if(typeof(val)!='undefined')this._pArr[id][fld]=val;else return this._pArr[id][fld]}
tf.wm.pPropMin=function(id,val){return this.pPropStk(id,2,val);}
tf.wm.pPropMax=function(id,val){return this.pPropStk(id,3,val);}
tf.wm.pPropQty=function(id,val){return this.pPropStk(id,4,val);}
var lang=tf.lang?tf.lang:'nl';
function regionalSettingsObj(rulesList) {
this.defDecimal='.';
this.defThousand=',';
this.defPosition=0;
this.regions=[];
this.region=function(dec,thous,pos) {
this.decimal=dec;
this.thousand=thous;
this.position=pos;
}
for (var i in rulesList) {
switch (rulesList[i].length) {
case 1: this.regions[rulesList[i][0]]=new this.region(this.defDecimal,this.defThousand,this.defPosition);break;
case 3: this.regions[rulesList[i][0]]=new this.region(rulesList[i][1],rulesList[i][2],this.defPosition);break;
case 4: this.regions[rulesList[i][0]]=new this.region(rulesList[i][1],rulesList[i][2],rulesList[i][3]);break;
}
}
this.getCurrentSettings=function() {
return this.getSettings((navigator.language)?navigator.language:navigator.userLanguage);
}
this.getSettings=function(lang)  {
if(lang&&this.regions[lang])return this.regions[lang];
else if (lang&&lang.length>2&&this.regions[lang.substr(0,2)])return this.regions[lang.substr(0,2)];
else return this.defRegion;
}
this.getMerchantSettings=function() {
return this.getSettings('nl');
}
this.defRegion=new this.region(this.defDecimal,this.defThousand,this.defPosition);
}
var regionalSettings=new regionalSettingsObj([["af",".",",",2],["ar",".",",",2],
["az",",","",3],["be",",","",3],["bg",",","",3],["ca",",",".",3],["cs",",","",3],
["da",",",".",2],["de",",",".",3],["de-at",",",".",2],["de-ch",".","'",2],
["de-li",".","'",2],["de-lu",",",".",3],["div",".",",",3],["el",",",".",3],
["en"],["es",",",".",3],["es-ar",",",".",2],["es-bo",",",".",2],["es-cl",",",".",2],
["es-co",",",".",2],["es-cr",",",".",0],["es-do"],["es-ec",",",".",2],
["es-es",",",".",3],["es-gt"],["es-hn",".",",",2],["es-mx"],["es-ni",".",",",2],
["es-pa",".",",",2],["es-pe",".",",",2],["es-pr",".",",",2],["es-py",",",".",2],
["es-sv"],["es-uy",",",".",2],["es-ve",",",".",2],["et",".","",3],["eu",",",".",3],
["fa","/",",",2],["fi",",","",3],["fo",",",".",2],["fr",",","",3],["fr-be",",",".",3],
["fr-ca",",","",3],["fr-ch",".","'",2],["fr-lu",",","",3],["fr-mc",",","",3],
["gl",",",".",2],["gu",".",",",2],["he",".",",",2],["hi",".",",",2],
["hr",",",".",3],["hu",",","",3],["hy",".",",",3],["id",",",".",0],
["is",",",".",3],["it",",",".",2],["it-ch",".","'",2],["ja"],["ka",",","",3],
["kk","-","",0],["kn",".",",",2],["ko"],["kok",".",",",2],["ky","-","",3],
["lt",",",".",3],["lv",",","",2],["mk",",",".",3],["mn",",","",1],
["mr",".",",",2],["ms",",",".",0],["ms-bn",",",".",0],["nb",",","",2],
["nl",",",".",2],["nl-be",",",".",3],["nn-no",",","",2],["pa",".",",",2],
["pl",",","",3],["pt",",",".",0],["pt-pt",",",".",3],["ro",",",".",3],
["ru",",","",1],["sa",".",",",2],["sk",",","",3],["sl",",",".",3],
["sq",",",".",1],["sr",",",".",3],["sv",",",".",3],["sv-fi",",","",3],
["sw"],["syr",".",",",2],["ta",".",",",2],["te",".",",",2],["th"],
["tr",",",".",3],["tt",",","",3],["uk",",","",3],["ur"],["uz",",","",3],
["vi",",",".",3],["zh"]]);
function def(str) {return (str==null)?'':str;}
function ckCodeStr(obj, order, sep, str)
{
if (str==null) str = '';
function delim(i, s) {return (i==0)?'':s}
var cstr = [];
var arr  = str.split(sep);
var len  = arr.length;
for (var i=0,ii=order.length; i<ii; i++){
var val='';
if(typeof(arr[i])=='string'){
if(len>1){
val=unescape(arr[i]);
val=val.replace(/\\"/g,'"').replace(/&#44;/g,',').replace(/&#45;/g,'-');
}
else val=arr[i].replace(/"/g,'\\"').replace(/,/g,'&#44;').replace(/-/g,'&#45;');
}
else{arr[i];}
val = (isNaN(val)||val=='')?'"'+val+'"':parseFloat(val);
val	= (len>1)?'='+val:'';
val = eval('obj.'+order[i]+val);
val = (val == 'undefined'||typeof(val)=='undefined'?'':val);
cstr.push(delim(i,sep) + def(len>1?val:escape(val)));
}
if (typeof(obj.xcode)=='function') cstr.push(sep + obj.xcode((str!='')?arr[i]:''));
return cstr.join('');
}
var sym = new Array();
sym['yen']   = '%A5';
sym['pound'] = '%A3';
function entities(s)
{
var i=s.indexOf('&');
if (i==-1) return s;
var j=s.indexOf(';', i);
var s1=s.substring(0,i);
var s2=unescape(sym[s.substring(i+1,j)]);
var s3=entities(s.substring(j+1,s.length));
return s1+s2+s3;
}
function dCurr(val, raw, c1, c2)
{
if (isNaN(val)) return val;
var scurr='';
if (c1==null) return nfmt.display(val);
if (c2!=null) {
var val2 = val*(c2.multiplier/tf.shopCurrency.multiplier);
if (!raw) scurr = nfmt.display(val2, c2.decimal_places,entities(c2.abbrev));
scurr=' <span class="SecondaryCurrencyAmount">(~'+scurr+')</span>';
}
if (!raw) val = nfmt.display(val*(c1.multiplier/tf.shopCurrency.multiplier), c1.decimal_places,c1.abbrev);
return val+scurr;
}
function dispCurr(val, c1, c2) {return dCurr(val, 0, c1, c2);}
function showPrc(val, type) {
if (type||!tf.secondCurrency) return dCurr(val, 0, tf.currentCurrency);
return dCurr(val, 0, tf.currentCurrency, tf.secondCurrency);
}
function rl_total()
{
var tfcd=tf.content.document;
if(tf.utils&&tfcd&&tfcd.getElementById('MiniCartTotal'))Basket.refreshTotal();
else setTimeout('rl_total()',100);
}
function createMap(arr) {
var ret=[];
for (var i in arr) ret[arr[i]]=1;
return ret;
}
var reseller = {'frship':false,'frship_am':0,'ismember':false};
function updateReseller(prdc,values,type){
if (Basket&&Basket.gdisc) {
for (var i=0; i<prdc.length; i++) {
Basket.gdisc.eAdd(prdc[i], new Array(type,values[i],''))
}}}
var ResellerID='';
var ResellerPasswd='';
function smart_unescape(s) {
try {
return unescape(s);
} catch (e) { return s;}
}
function smart_escape(s) {
if(window.encodeURI) return encodeURI(s);
else return escape(s)
}
var startS=0;
var startR=0;
function getStyleClass(className,d){
var ss;
try{
if(d.all){
for(var s=startS; s<d.styleSheets.length; s++){
startS=s+1;
if(!d.styleSheets[s].imports) continue;
if(d.styleSheets[s].imports.length==0)continue;
ss=d.styleSheets[s].imports[0];
for(var r=startR; r<ss.rules.length; r++){
startR=r+1;
if(ss.rules[r].selectorText==className){startS=s;return ss.rules[r];}
}}}
else if(d.getElementById){
for (var s=startS; s<d.styleSheets.length; s++){
startS=s+1;
if(d.styleSheets[s].cssRules.length==0)continue;
if(d.styleSheets[s].cssRules[0].type!=3)continue;
ss=d.styleSheets[s].cssRules[0].styleSheet;
for (var r=startR; r<ss.cssRules.length; r++){
startR=r+1;
if(ss.cssRules[r].selectorText==className){return ss.cssRules[r];}
}}}
}catch(e){return null;}
return null;
}
function getCssText(className,d) {
if(!d)d=tf.content.document;
if(!d.styleSheets)return'';
startS=0;
startR=0;
var prevClass=getStyleClass(className,d);
var curClass=prevClass;
while(curClass) {
curClass=getStyleClass(className,d);
if (curClass) prevClass=curClass;
}
if (!prevClass) return '';
return prevClass.style.cssText;
}
function savCookStr(name,str,exp,test) {
var cookie=name+"="+escape("0400"+str);
var expiration=new Date();
if(exp!=''){
if (exp==-1){
expiration.setYear(2020);
expiration.setMonth(01);
expiration.setDate(01);
}
else expiration.setTime(expiration.getTime()+(24*60*60*1000*exp));
if(exp!=0)cookie+="; expires="+expiration.toGMTString();
else cookie=name+"=";
}
if(tf.isIE)savUserData(name,cookie,expiration);
else d.cookie=cookie;
if(typeof(test)=='undefined')savCookStr('test','674f8c05-04e4-43c8-ad0c-6cf325a88336',exp,true);
}
function getCookStr(name) {
var allCookies=(tf.isIE?getUserData('test'):d.cookie);
var id='0400674f8c05-04e4-43c8-ad0c-6cf325a88336',testPos=allCookies.indexOf('test=');
if(testPos==-1||allCookies.substr(testPos+5,id.length)!=id){if(tf.isIE)savUserData('test','');else d.cookie=name+'=0000; expires=Fri, 31 Dec 1990 23:59:59 GMT';return'';}
if(tf.isIE)allCookies=unescape(getUserData(name));
var start=allCookies.indexOf(name+"=");
if(start==-1)return'';
start+=name.length+1;
var end=allCookies.indexOf(';',start);
if(end==-1) end=allCookies.length;
var cookieStr=unescape(allCookies.substring(start,end));
if(cookieStr.length<4) return("");
if(cookieStr.substring(0,4)!="0400") return("")
cookieStr=cookieStr.substring(4,cookieStr.length);
return(cookieStr);
}
function savUserData(name,str,exp){
var el=d.getElementById('cookieUserData');
if(!el)return;
if(exp)el.expires=exp.toUTCString();
el.setAttribute(name,str);
el.save('oXMLStore');
}
function getUserData(name){
var el=d.getElementById('cookieUserData');
if(!el)return'';
var val='';
try{
el.load('oXMLStore');
val = el.getAttribute(name);
}catch(e){}
return (val?val:'');
}
function timeMgr(offset)
{
this.handlers={getTime:[]};
this.setTime = tmSetTime;
this.getTime = tmGetTime;
this.isActive = tmIsActive;
this.offset = tmOffset;
this.myTZ = (new Date()).getTimezoneOffset() / 60 * -1;
this.timestamp = new Date();
this.offset(offset);
return this;
}
var currTime = new timeMgr('');
currTime.getTime();
function tmGetTime(){
if (gmtTime==0) setTimeout("currTime.getTime()", 500);
else{(this.setTime(gmtTime));var hl=this.handlers['getTime'];for(var n=0,num=hl.length;n<num;n++)hl[n]();}
}
function tmSetTime(ti)
{
if (ti==null) return this._cTime;
this._cTime = ti;
return this._cTime;
}
function tmOffset(os)
{
if (os!=null&&os!='') this._offset=os;
return this._offset;
}
function tmIsActive(fr, to, rep, freq)
{
if (fr==null || fr=='') return 1;
if (to==null) {
var a=fr.split(',');
if (a.length==1) return 1;
return this.isActive(a[0],a[1],a[2],a[3]);
}
fr=parseInt(fr);to=parseInt(to);rep=parseInt(rep);freq=parseInt(freq);
var now  = this.setTime();
if(!now)return 1;
for (var i=0; i<=rep; i++) {
var period = i*freq*86400;
if (fr+period <= now && now <= to+period) return 1;
}
return 0;
}
function numeric(fmt, dp)
{
this.cvt = numCvt;
this.fmt = numFmt;
this.display = numDisplay;
this.parse = numParse;
this.delim = numDelim;
this.round = numRnd;
this.toLoc = numToLoc;
this.fromLoc = numFromLoc;
this.getDecPlaces=numDecimalPlaces;
this.roundTotalTable=[];
this.roundTotal=numRndTotal;
this.roundTotalSetup=numRndTotalSetup;
this.roundTotalSetup();
this.fmt(fmt, dp);
return this;
}
function numDelim() {return this.del2};
function numFmt(fmt, dp)
{
if(!regionalSettings.getCurrentSettings())
this.settings=regionalSettings.getMerchantSettings();
else
this.settings=regionalSettings.getCurrentSettings();
this.del2=this.settings.decimal;
this.del1=this.settings.thousand;
this.pos=this.settings.position;
this.dec_sep='.';
this.dec_num=tf.currentCurrency.decimal_places;
this.dec = (!dp||isNaN(dp))?1/Math.pow(10,this.dec_num):parseFloat(dp);
}
function numCvt(val, del)
{
var len = val.length;
if (len <= 3) return val;
var rem = this.cvt(val.substring(0, len - 3), del);
var dig = val.substring(len - 3, len);
if (rem == '') del = '';
return rem+del+dig;
}
function numToLoc(val)
{
val=''+val;val=val.replace(/^0*/,'');
var a=val.split(this.dec_sep);
if(a.length==1)return ''+parseFloat(val.replace(this.del2,''));
if(a.length>1){
if(!a[0])a[0]='0';if(!a[1])a[1]='0';
return ''+parseInt(a[0])+this.del2+a[1];
}
else return val;
}
function numFromLoc(val)
{
val=''+val;val=val.replace(/^0*/,'');
var a=val.split(this.del2);
if(a.length==1)return ''+parseFloat(val.replace(this.del1,''));
if(a.length>1){
if(!a[0])a[0]='0';if(!a[1])a[1]='0';
return ''+parseInt(a[0])+this.dec_sep+a[1];
}
else return val;
}
function numRnd(val,dp,roff)
{
var ret=val;
if (dp==null){ dp = this.dec; var dn=this.dec_num; }
else var dn=(1/dp).toString().length-1;
if (roff) return Math.round(val/roff)*roff;
if(!dp)return val;
var pow=Math.pow(10, dn+1);
return Math.round((val/dp)+(dn>0?1/pow:0))/(1/dp);
}
function numDecimalPlaces(v)
{
var s=v.toString();
s=s.substr(s.indexOf('.')+1);
return 1/Math.pow(10,s.length);
}
function numDisplay(val, dp, curSym)
{
if (dp==null) dp = this.dec;
val = this.round(val,1/Math.pow(10,dp)).toString();
var idx = val.indexOf(this.dec_sep);
var itr = (idx == -1)?val:val.substring(0, idx);
var dec = (idx == -1)?'':val.substring(idx+1, idx+dp+1);
itr = this.cvt(itr, this.del1);
for (var i=dec.length;i<dp; i++) dec += '0';
var ret=(dp<1)?itr:itr + this.del2 + dec;
switch(this.pos) {
case 1: ret=ret+curSym;break;
case 2: ret=curSym+' '+ret;break;
case 3: ret=ret+' '+curSym;break;
default: ret=curSym+ret;break
}
return ret;
}
function numParse(str,dec)
{
str=str.toString();
if (str=='') return 0;
function _chg(s,del) {
var idx = s.indexOf(del);
if (idx == -1) return s;
var ts = s.substring(0, idx) + _chg(s.substring(idx+1, s.length));
return ts;
}
var pwr = Math.pow(10, (dec==null)?1:dec);
return (Math.round(parseFloat(_chg(str,this.del1))*pwr)/pwr);
}
function numRndTotalSetup()
{
var a='CHF,0.05;'.split(';');
for(var n=0,l=a.length;n<l;++n)
{
if(a[n])
{
var nv=a[n].split(',');
if(nv[0]&&nv[1])this.roundTotalTable[nv[0]]=parseFloat(nv[1]);
}
}
}
function numRndTotal(val,iso)
{
var rnd=this.roundTotalTable[iso];
if(rnd){
val=Math.round(val/rnd)*rnd;
}
return val;
}
var hexdelim	= "O";
var chrsz	= 8;
var hexcase = 0;
var b64pad  = "";
function add(s) {return binb2hex(core_sha1(str2binb(s),s.length * chrsz))}
function core_sha1(x, len)
{
x[len >> 5] |= 0x80 << (24 - len % 32)
x[((len + 64 >> 9) << 4) + 15] = len
var w = Array(80)
var a =  1732584193
var b = -271733879
var c = -1732584194
var d =  271733878
var e = -1009589776
for(var i = 0,ii=x.length; i < ii; i += 16)
{
var olda = a,oldb = b,oldc = c,oldd = d,olde = e;
for(var j = 0; j < 80; j++)
{
if(j < 16) w[j] = x[i + j]
else w[j] = rol(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1)
var t = safe_add(safe_add(rol(a, 5), ft(j, b, c, d)),
safe_add(safe_add(e, w[j]), kt(j)))
e = d
d = c
c = rol(b, 30)
b = a
a = t
}
a = safe_add(a, olda)
b = safe_add(b, oldb)
c = safe_add(c, oldc)
d = safe_add(d, oldd)
e = safe_add(e, olde)
}
return Array(a, b, c, d, e)
function ft(t, b, c, d)
{
if(t < 20) return (b & c) | ((~b) & d);
if(t < 40) return b ^ c ^ d;
if(t < 60) return (b & c) | (b & d) | (c & d);
return b ^ c ^ d;
}
function kt(t)
{
return (t < 20) ?  1518500249 : (t < 40) ?  1859775393 :
(t < 60) ? -1894007588 : -899497514;
}
}
function safe_add(x, y)
{
var lsw = (x & 0xFFFF) + (y & 0xFFFF)
var msw = (x >> 16) + (y >> 16) + (lsw >> 16)
return (msw << 16) | (lsw & 0xFFFF)
}
function rol(num, cnt)
{
return (num << cnt) | (num >>> (32 - cnt))
}
function str2binb(str)
{
var bin = Array()
var mask = (1 << chrsz) - 1
for(var i = 0,ii=str.length * chrsz; i < ii; i += chrsz)
bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (24 - i%32)
return bin
}
function binb2hex(binarray)
{
var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef", a = [];
for(var i = 0, num = binarray.length * 4; i < num; i++)
{
a.push(hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8+4)) & 0xF) +
hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8  )) & 0xF));
}
return a.join('');
}
function place(s) {
var a=[];
for (var x = 0, num = s.length; x < num; x++) {
a.push(s.charCodeAt(x).toString(16));
}
return a.join('');
}
function show(v) {
var a=[];
if((v.length%2)==0){
for (var x = 0, num = v.length; x < num; x+=2) {
a.push(String.fromCharCode(parseInt(v.charAt(x)+v.charAt(x+1),16)));
}
}
return a.join('');
}
function stock()
{
this.init = stkInit;
this.check = stkCheck;
this.update = stkUpd;
this.code = stkCode;
return this;
}
function stkInit(min,max,avail,prdc,manc,dstc,prcc)
{
this.min = isNaN(min)?-1:parseFloat(min);
this.max = isNaN(max)?-1:parseFloat(max);
this.avail = isNaN(avail)?-1:parseFloat(avail);
this.prd_cd = prdc;
this.man_cd = manc;
this.dst_cd = dstc;
this.prc_cd = prcc;
this.used  = 0;
}
function stkCheck(itm)
{
function getMsg(title,msg,min,max,avail,used){
if(min>0 && used<min && qnty<min){
rc=1;
msg.push(title+': '+LD.LD_MIN_ORD_QTY+' '+min);
}
if(max>0 && used>max){
rc=1;
msg.push(title+': '+LD.LD_MAX_ORD_QTY+' '+max);
}
if(avail>=0 && used>avail){
rc=0;
msg.push(title+': '+LD.LD_STOCK_ORD_QTY+' '+avail);
}
return rc;
}
var rc=0,msg=[];
var qnty = parseFloat(itm.quantity),itemNo=itm.getItemNo();
if (!qnty||qnty<=0) return 0;
var used = qnty + this.used;
var min = this.min, max = this.max, avail = this.avail;
rc = getMsg(itm.title+' ['+itemNo+']',msg,min,max,avail,used);
var optcnt=itm.options.cnt();
for(var n=0;n<optcnt;n++){
var opt=itm.options.get(n);
if(opt.choice()!==''||opt.combine||!opt.prop[3])continue;
var itemNo=opt.prop[3],stkopt=Basket.stk.get(itemNo);
if(stkopt){
min=stkopt.min;max=stkopt.max;avail=stkopt.avail;
used = qnty + stkopt.used;
rc = getMsg(itm.title+'/'+opt.prop[0]+' ['+itemNo+']',msg,min,max,avail,used);
}
}
return [rc,msg.join('\n')];
}
function stkUpd(itm, neg)
{
if(itm.temporary)return;
if (neg == null) this.used += itm.quantity;
else this.used = Math.max(0, this.used - itm.quantity);
var optcnt=itm.options.cnt();
for(var n=0;n<optcnt;n++){
var opt=itm.options.get(n);
if(opt.choice()!==''||opt.combine||!opt.prop[3])continue;
var stkopt=Basket.stk.get(opt.prop[3]);
if(neg==null)stkopt.used += itm.quantity;
else stkopt.used = Math.max(0, stkopt.used - itm.quantity);
}
}
var _stkArr = new Array('min','max','avail');
function stkCode(str)
{
return ckCodeStr(this, _stkArr, '|', str);
}
function dynObj(gid)
{
this.gid = gid;
this._arr = [];
this._idtags = [];
this._idxArr = [];
this._cnt = 0;
this.cnt = dOCnt;
this.idx = dOIdx;
this.add = dOAdd;
this.del = dODel;
this.get = dOGet;
this.getS = dOGetS;
this.getById = dOGetById;
this.empty = dOEmpty;
this.start = dOStart;
this.next  = dONext;
this.replace = dOReplace;
this.eAdd  = dOEAdd;
this.eAddS = dOEAddS;
}
function dOCnt()
{
return this._cnt;
}
function dOIdx(idtag)
{
var i=this._idxArr[idtag];
if(typeof(i)=='undefined')return -1;
return i;
}
function dOAdd(obj)
{
var idx = this.idx(obj.idtag);
if (idx!=-1) return 0;
if (!isNaN(obj.idtag)) obj.idtag = (obj.id&&isNaN(obj.id))?'_'+obj.id:this._cnt;
this._idxArr[obj.idtag]=this._cnt;
this._arr[this._cnt++] = obj;
return 1;
}
function dODel(idx)
{
if (isNaN(idx)) {
idx = this.idx('_'+idx);
if (idx==-1) return '';
}
if (idx<0 || idx>=this._cnt) return '';
for (var i=idx+1; i<this._cnt; i++) this._idtags[i-1]=this._arr[i].idtag;
for (var i=idx; i<this._cnt-1; i++) this.replace(i, this._arr[i+1]);
this._cnt--;
delete this._idxArr[this._arr[this._cnt].idtag];
delete this._arr[this._cnt];
}
function dOReplace(idx, obj)
{
if (isNaN(idx)) return this.replace(this.idx('_'+idx));
if (idx<0 || idx>this._cnt) return this.add(obj);
if (obj!=null) obj.idtag = this._idtags[idx];
this._arr[idx] = obj;
}
function dOGet(idx)
{
if (isNaN(idx)){
var i=this._idxArr['_'+idx];
if(typeof(i)=='undefined')return '';
return this._arr[i];
}
if (idx<0||idx>=this._cnt) return '';
return this._arr[idx];
}
function dOGetS(idx)
{
var i=this._idxArr['_'+idx];
if(typeof(i)=='undefined')return '';
return this._arr[i];
}
function dOStart()
{
this._idx = 0;
return this._arr[0];
}
function dONext()
{
return this._arr[++this._idx];
}
function dOEmpty(idtag)
{
if (idtag==null) idtag = this._cnt;
else idtag = '_'+idtag;
var tmp;
switch(this.gid){
case 'range':tmp=new range();break;
case 'tax_regn':tmp=new tax_regn();break;
case 'item':tmp=new item();break;
case 'stock':tmp=new stock();break;
case 'discount':tmp=new discount();break;
case 'keyval':tmp=new keyval();break;
case 'options':tmp=new options();break;
default:tmp=null;break;
}
if(tmp){
tmp.gid = this.gid;
tmp.idtag = idtag;
}
return tmp;
}
function dOEAdd(idtag, a)
{
var obj = this.get(idtag);
if (obj!='') return obj;
var s='obj.init(';for (var i=0;i<a.length-1;i++) s+='a['+i+'],';s+='a['+i+'])';
obj=this.empty(idtag); eval(s);
this.add(obj);
return obj;
}
function dOEAddS(idtag, a)
{
var obj = this.getS(idtag);
if (obj!='') return obj;
var s='obj.init(';for (var i=0;i<a.length-1;i++) s+='a['+i+'],';s+='a['+i+'])';
obj=this.empty(idtag); eval(s);
this.add(obj);
return obj;
}
function dOGetById(idtag) {
var gd=null;
if (isNaN(idtag)) idtag='_'+idtag;
var i=this.start();
while(i!=null) {
if (i.idtag==idtag) {gd=i;break;}
i=this.next();
}
return gd;
}
function Iterator(obj) {
this.obj=obj;
this.objarr=obj._arr
this.idx=0;
this.start=itStart;
this.next=itNext;
}
function itStart() {
this._idx = 0;
return this.objarr[0];
}
function itNext()
{return this.objarr[++this._idx];}
function iField(field)
{
var type = field.type;
var idx	= 0;
var value = '';
switch (type) {
case 'hidden':	 value = field.value; break;
case 'text': 	 value = field.value; break;
case 'textarea': value = field.value; break;
case 'radio':	 if (field.checked) value = field.value; break;
case 'checkbox': if (field.checked) value = field.value; break;
case 'select-one':
idx = field.selectedIndex;
idx=(idx>0)?idx:0;
value = field[idx].value;
break;
}
this.value	= value;
this.idx	= idx;
this.type	= type;
this.name	= field.name;
this.display	= field.display;
if (!def(this.display)) this.display = '';
return this;
}
function iForm(form)
{
this.getField = iformGFld;
this.getValue = iformGVal;
this.count = 0;
this.fields = new Array();
for (var i=0; i<form.length; i++) {
var fld = new iField(form[i]);
if (fld.value == '') continue;
var exist = this.getField(fld.name);
if (exist != '') exist.value += '&&' + fld.value;
else this.fields[this.count++] = fld;
}
return this;
}
function iformGFld(name)
{
var str = '';
for (var i=0; i<this.count; i++)
if (this.fields[i].name == name) return this.fields[i];
return '';
}
function iformGVal(name)
{
var val = this.getField(name).value;
return def(val);
}
function options()
{
this.prop	= new Array();
this.order	= _oArr;
this.separator	= ',';
this.init	= optInit;
this.check	= optCheck;
this.choiceId = optChoiceId;
this.choice	= optChoice;
this.price	= optPrice;
this.weight	= optWeight;
this.optId	= optOptId;
this.code	= optCode;
return this;
}
function optInit(arr, value)
{
this.name  = arr[1];
this.title = arr[2];
this.type  = arr[3]==1;
this.opttype = arr[4];
this.combine = arr[5];
this.value = value;
this.prop  = value.split(str_sep1);
}
function optCheck()
{
if (this.value == '' && this.type) {
return this.title;
}
return '';
}
function optChoice()
{
return this.prop[0];
}
function optChoiceId()
{
return this.prop[7];
}
function optPrice()
{
var prc = this.prop[1];
return (!def(prc))?0:parseFloat(prc);
}
function optWeight()
{
var wght = this.prop[2];
return (!def(wght))?0:parseFloat(wght);
}
function optOptId()
{
var id = this.prop[3];
return (!def(id))?'':id;
}
var _oArr=['prop[0]','prop[1]','prop[2]','prop[3]','title','combine'];
function optCode(str)
{
if (this.choice() === '') return '';
return ckCodeStr(this, _oArr, ',', str);
}
function range()
{
this.init = rgInit;
this.getData = rgGetData;
return this;
}
function rgInit(min,max,data)
{
if (max == null) {
var arr = min.split(',');
return this.init(arr[0], arr[1], arr[2]);
}
this.min = min;
this.max = max;
this.data = data;
}
function rgGetData(value, type)
{
if (type==null) type=0;
if (this.min==this.max) type=1;
if (type==1) if (this.min <= value) return this.data;
if (this.min <= value && value < this.max) return this.data;
return '';
}
function keyval()
{
this.init = srInit;
this.val =  srVal;
}
function srInit(i,v,s)
{
this._id = i;
this.val(v);
this.str = (s==null)?'':s;
}
function srVal(v)
{
if (v!=null) this._val = v;
return this._val;
}
function discount()
{
this.rg = new dynObj('range');
this.init = discInit;
this.getData = discData;
this.amount = discAmount;
this.purchasePrice = discPurchasePrice;
this.purchasePriceByPrice = discPurchasePriceByPrice;
this.getNextRange = discGetNextRange;
this.free = discFree;
this.code = discCode;
return this;
}
function discInit(type, val, tlim, del1, del2)
{
this.type = type;
this.value = val;
this.tlim = tlim;
this.del1 = (del1==null)?';':del1;
this.del2 = (del2==null)?',':del2;
var a1 = this.value.split(this.del1);
for (var i=0; i<a1.length; i++) {
var a2 = a1[i].split(this.del2);
if (a2.length == 1) continue;
var tmp = this.rg.empty();
tmp.init(a2[0],a2[1],a2[2]);
this.rg.add(tmp)
}
}
function discData(key,type,getO)
{
var cnt = this.rg.cnt();
if (!cnt) return '';
if (!currTime.isActive(this.tlim)||key<this.rg.get(0).min) return '';
for (var i=0; i<cnt; i++) {
var rg = this.rg.get(i);
if (rg == '') return '';
var data = rg.getData(key,type);
if (data!='') return (data=='-')?'':(getO)?rg:data;
}
var rg = this.rg.get(cnt-1);
return (getO)?rg:rg.data;
}
function discGetNextRange(key)
{
var cnt = this.rg.cnt();
if (!cnt) return '';
if (key<this.rg.get(0).min) return this.rg.get(0);
var flag=false;
for (var i=0; i<cnt; i++) {
var rg = this.rg.get(i);
if (rg == '') return '';
if (flag) return rg;
var data = rg.getData(key);
if (data!='') flag=true;
}
return '';
}
function discAmount(prc,qnty,oprc,lvl)
{
var type=this.type.toString();
if (false)
return 0;
var p=0,perc = 0;
if (!currTime.isActive(this.tlim)) return p;
var prc2=prc;
switch(type) {
case '0': p=prc-parseFloat(this.value==''||isNaN(this.value)?0:this.value); break;
case '1': case '10': case '11': p=prc2*(parseFloat(this.value)/100);break;
case '5': perc=this.getData(qnty);p=(isNaN(perc))?0:(prc2-perc);break;
case '4': perc=this.getData(qnty);
p=(isNaN(perc))?0:prc2*(perc/100);break;
}
if (p>=(type==0?prc:prc2)||p<0){if(p==(type==0?prc:prc2)&&(type=='10'||type=='11'))return p;else return 0;}
return p;
}
function discPurchasePrice(prc) {
var type=this.type.toString();
if (false)
return 0;
var perc=this.getData(prc);
var p=(isNaN(perc))?0:(prc)*(perc/100);
if (p>=prc) return 0;
return p;
}
function discPurchasePriceByPrice(prc,discPrice) {
var type=this.type.toString();
if (false)
return 0;
var perc=this.getData(discPrice);
var p=(isNaN(perc))?0:(prc)*(perc/100);
if (p>=prc) return 0;
return p;
}
function discFree(qnty)
{
var type=this.type.toString();
if (false)
return 0;
switch(this.type) {
case '2': case '3': case '103': return this.getData(qnty);
case '103': return new Array(1,this.getData(qnty));
}
return '';
}
var _dArr = new Array('type','value','tlim');
function discCode(str)
{
return ckCodeStr(this, _dArr, '|', str);
}
var rules = new Array();
var taxExemptObj=new taxExempt();
function taxExempt()
{
this.len=new Function('x','return this.s.length==x');
this.chr=new Function('x','y','x=this.s.charAt(x);return y?(x==y):("A"<=x&&x<="z")');
this.num=new Function('x','y','x=this.s.substring(x,y);return parseInt(x.replace(/^0+/,\'\'))==x');
this.chk=new Function('s','c','this.s=s.toUpperCase();return (rules[c])?eval(rules[c]):1');
this.euroCountries=createMap(['AT','BE','CY','CZ','DE','DK','EE','ES','FI','FR','GR','HU','IE','IT','LT','LU','LV','MT','NL','PL','PT','SE','SI','SK','BG','RO']);
}
rules['AT']="L(9)&&C(0,'U')&&N(1,8)";
rules['BE']="L(10)&&N(0,10)";
rules['BG']="(L(9)&&N(0,9))||(L(10)&&N(0,10))";
rules['CY']="L(9)&&(N(0,8)&&C(8))";
rules['CZ']="(L(8)&&N(0,8))||(L(9)&&N(0,9))||(L(10)&&N(0,10))";
rules['DE']="L(9)&&N(0,9)";
rules['DK']="L(8)&&N(0,8)";
rules['EE']="L(9)&&N(0,9)";
rules['ES']="L(9)&&((C(0)&&N(1,8))||(N(0,8)&&C(8))||(C(0)&&C(8)&&N(1,7)))";
rules['FI']="L(8)&&N(0,8)";
rules['FR']="L(11)&&N(2,11)";
rules['GR']="L(9)&&N(0,9)";
rules['HU']="L(8)&&N(0,8)";
rules['IE']="L(8)&&C(7)&&(N(0,7)||(N(0,1)&&C(1)&&N(2,7)))";
rules['IT']="L(11)&&N(0,11)";
rules['LT']="(L(9)&&N(0,9))||(L(12)&&N(0,12))";
rules['LU']="L(8)&&N(0,8)";
rules['LV']="L(11)&&N(0,11)";
rules['MT']="L(8)&&N(0,8)";
rules['NL']="L(12)&&N(0,8)&&C(9,'B')&&N(10,12)";
rules['PL']="L(10)&&N(0,10)";
rules['PT']="L(9)&&N(0,9)";
rules['RO']="(L(2)&&N(0,2))||(L(3)&&N(0,3))||(L(4)&&N(0,4))||(L(5)&&N(0,5))||(L(6)&&N(0,6))||(L(7)&&N(0,7))||(L(8)&&N(0,8))||(L(9)&&N(0,9))||(L(10)&&N(0,10))";
rules['SE']="L(12)&&N(0,10)&&C(10,'0')&&C(11,'1')";
rules['SI']="L(8)&&N(0,8)";
rules['SK']="L(10)&&N(0,10)";
rules['UK']="L(9)&&N(0,9)||C(0,'G')&&C(1,'B')&&((L(11)&&N(2,11))||(L(15)&&N(2,15))||(L(8)&&C(2,'G')&&C(3,'D')&&N(4,8))||(L(8)&&C(2,'H')&&C(3,'A')&&N(4,8)))";
function rpl(s,f,t){
var i=s.indexOf(f);
if (i==-1) return s;
return rpl(s.substring(0,i)+t+s.substring(i+f.length,s.length), f, t);
}
for (i in rules) {
rules[i] = rpl(rules[i],'L','this.len');
rules[i] = rpl(rules[i],'C','this.chr');
rules[i] = rpl(rules[i],'N','this.num');
}
function tax_regn()
{
this.init = taxRInit;
this.calcShipAmt = taxCalcShipAmt;
return this;
}
function taxRInit(i,c,p,t,e,it)
{
this.id	  = i;
this.code = c;
this.perc = parseFloat(p);
this.taxName	= t;
this.exempt	= e;
this.exNo	= '';
this.incTax	= it;
this.cache	= 0;
}
function taxCalcShipAmt(sumRates,avgAmt) {
if (this.exempt && this.exNo) return 0
return avgAmt*this.perc/(100*sumRates);
}
function tax()
{
this._tax = new dynObj('tax_regn');
this._rgn = new Array();
this.exNo = '';
this.init	= taxInit;
this.getDefaultReg=taxGetDefaultReg;
this.currRegn	= taxCurrRegn;
this.addArea	= taxAddArea;
this.regnName	= taxRegnName;
this.cntInc	= taxCntInc;
this.regnRate	= taxRegnRate;
this.forRegion	= taxForRegion;
this.rate	= taxRate;
this.amt	= taxAmt;
this.allAmt	= taxAllAmt;
this.singleAmt	= taxSingleAmt;
this.inTax	= taxInTax;
this.exTax	= taxExTax;
this.calcTax	= taxCalcTax;
this.disp	= taxDisp;
this.list	= taxList;
this.allCodes	= taxAllCodes;
this.allIDs	= taxAllIDs;
this.ship	= taxShip;
this.isEmpty	= taxIsEmpty;
this.anyTaxInclCountry=taxAnyTaxInclCountry;
this.anyTaxForRegion=taxAnyTaxForRegion;
this.findMajorityTaxID=taxFindMajorityTaxID;
this.mapRegn	= {};
this.mapTax	= {};
return this;
}
function taxInit(d,s)
{
this._default	= d;
this.showBoth	= s;
}
function taxGetDefaultReg(){
if (this._default) return this._default;
var rc=window.shopRegion;
var _t = this._tax.start();
while (_t!=null) {
if (rc.indexOf(_t.code)==0&&_t.code.length>this._default.length) this._default=_t.code;
_t  = this._tax.next();
}
if (!this._default) this._default=rc;
return this._default;
}
function taxCurrRegn(rc)
{
if (!rc) this._current = rc;
else rc=this._current;
if (!rc) rc=window.region;
if (!rc) rc=this.getDefaultReg();
this._current=rc;
return rc;
}
function taxAddArea(id,c,p,t,r,inc)
{
var tr = this._tax.get(id);
if (tr == '') tr = this._tax.eAdd(id, new Array(id,c,p,t,r,inc));
else tr.code += ','+c;
if(this.mapRegn[c]) {
if(!this.mapTax[id]) this.mapRegn[c]+=','+id;
} else {
this.mapRegn[c]=id;
}
this.mapTax[id]=tr.code;
return 0;
}
function taxForRegion(tax,reg,exact) {
if(!tax||!reg||!this.mapTax[tax])return false;
var tmp=this.mapTax[tax].split(',');
for(var i=0,num=tmp.length;i<num;i++){
if(exact){if(reg==tmp[i]) return true;}
else if(reg.indexOf(tmp[i])==0) return true;
}
return false;
}
function taxRegnName(rc,rn)
{
if (rn != null) this._rgn[rc] = rn;
return (this._rgn[rc]==null)?'':this._rgn[rc];
}
function taxRegnRate(tid,c,ign)
{
if (tid == '') return 0;
var a = tid.split(',');
var ret=0;
for (var j=0; j<a.length; j++) {
if(!a[j])continue;
var tr = this._tax.get(a[j]);
if (tr=='') continue;
if (tr.exempt && tr.exNo && !ign) continue
if (c==null || c=='') c=this.currRegn();
if (c==-1) c=(this.anyTaxInclCountry(this.currRegn()))?this.currRegn():'NL';
var cd=tr.code.split(',');
var tmpreg='',tmpval=0;
for (var i=0; i<cd.length; i++) {
if (cd[i]=='') continue;
if (c.indexOf(cd[i])==0) {
if (tmpreg.length<cd[i].length) {
tmpreg=cd[i];
tmpval=tr.perc;
}
}
}
ret+=tmpval/100;
}
return ret;
}
function taxAnyTaxInclCountry(regn) {
var it = new Iterator(this._tax);
var _t=it.start();
while (_t!=null) {
if(_t.incTax&&this.forRegion(_t.id,regn)) return true;
_t = it.next();
}
return false;
}
function taxAnyTaxForRegion(regn) {
var it = new Iterator(this._tax);
var _t=it.start();
while (_t!=null) {
if(this.forRegion(_t.id,regn)) return true;
_t = it.next();
}
return false;
}
function taxFindMajorityTaxID(regn) {
function findMajorityTaxIDAtSameLevel(o,rgn) {
var it = new Iterator(o._tax),_t=it.start(),high=0,highRate=0,highID='';
while (_t!=null) {
if (o.forRegion(_t['id'],rgn,true) && typeof(_t['prodAmt'])!='undefined'){
var rate=_t['perc'];
if (_t['prodAmt']>high || (_t['prodAmt']==high && rate>highRate)) { high=_t['prodAmt']; highRate=rate; highID=_t['id']; }
}
_t = it.next();
}
return highID+(highID?',':'');
}
var highID='',rgn=regn;
highID+=findMajorityTaxIDAtSameLevel(this,rgn.substr(0,2));
if(rgn.length>2)highID+=findMajorityTaxIDAtSameLevel(this,rgn.substr(0,4));
if(rgn.length>4)highID+=findMajorityTaxIDAtSameLevel(this,rgn);
return highID;
}
function taxRate(i,c)
{
var a = i.split(',');
var r = 0;
for (var j=0; j<a.length; j++) r += this.regnRate(a[j], c);
return r;
}
function taxAmt(inc,i,p,c)
{
var r = this.rate(i,c);
var amt = p * r;
var val = (inc)?amt/(1+r):amt;
return val;
}
function taxAllAmt(i,p,c)
{
if (!c) c=this.currRegn();
var tot=0;
p=this.exTax(i,p);
var a = i.split(',');
for (var j=0; j<a.length; j++)
if (a[j]&&this._tax.get(a[j])) tot += this.amt(0,a[j],p);
return tot;
}
function taxSingleAmt(i,p,c)
{
var r = this.regnRate(i, c)
var val = p * r;
return val;
}
function taxInTax(i,p,c)
{
p = this.exTax(i,p);
var amt = this.amt(0,i,p,c);
var val = p+amt;
return val;
}
function taxExTax(i,p)
{
p = parseFloat(p);
var a = i.split(',');
var r=0;
for (var j=0; j<a.length; j++)
if (a[j]&&this._tax.get(a[j])) r += (this._tax.get(a[j]).incTax)?this.regnRate(a[j],-1,1):0;
p-=p*r/(1+r);
return p;
}
function taxCalcTax(i,p,c)
{
if (!c) c=this.currRegn();
if (this.exempt && this.exNo) return this.exTax(i,p);
var a = i.split(',');
var d=0;
p=this.exTax(i,p);
for (var j=0; j<a.length; j++)
if (a[j]&&this._tax.get(a[j])) d+=(this._tax.get(a[j]).incTax)?this.singleAmt(a[j],p,c):0;
var val = p+d;
return val;
}
function taxDisp(i,p,co,ccr,onpage,tinc,texc)
{
var exT = this.exTax(i,p);
var inT = exT+this.allAmt(i,p);
if (ccr != null && ccr!=0) {
inT /= ccr;
exT /= ccr;
}
var s='';
if (this.isEmpty(i)||exT>=inT) { s=(onpage?'':'\n ')+showPrc(inT);}
else {
if (this.showBoth && inT>exT) {
if(onpage) {
if(this._tax.get(i).incTax){
var p1t=tinc, p1a=dPrc(inT,1,false,true);
var p2t=texc, p2a=dPrc(exT,1,false,true);
}
else{
var p1t=texc, p1a=dPrc(exT,1,false,true);
var p2t=tinc, p2a=dPrc(inT,1,false,true);
}
s='<span class="ProductPriceGroup"><span class="ProductPriceGroupPart1"><span class="ProductPriceGroupPart1_Text">'+p1t+'</span> <span class="ProductPriceGroupPart1_Amt">'+p1a+'</span></span> <span class="ProductPriceGroupPart2"><span class="ProductPriceGroupPart2_Text">'+p2t+'</span> <span class="ProductPriceGroupPart2_Amt">'+p2a+'</span></span></span>';
}
else s='\n - '+LD.LD_INC_TOTAL_TAX+' '+showPrc(inT)+' '+LD.LD_EX_TOTAL_TAX+' '+showPrc(exT);
} else {
if (p-exT>0.0001) {
s=LD.LD_INC_TOTAL_TAX+' '+showPrc(p);
} else {
s=showPrc(p);
}
}
}
return s;
}
function taxList(taxes)
{
var a=taxes.split(',');
var ret = new Array();
for (i=0; i<a.length; i++) {
if (!this.regnRate(a[i])) continue;
var t=this._tax.get(a[i]);
if (t=='') continue;
ret[ret.length] = t;
}
return ret;
}
function taxAllCodes()
{
var s = '';
var _t = this._tax.start();
while (_t!=null) {
s += _t.code + ',';
_t  = this._tax.next();
}
return s;
}
function taxAllIDs()
{
var s = new Array();
var _t = this._tax.start();
while (_t!=null) {
s[s.length] = _t.id;
_t = this._tax.next();
}
return s.join(',');
}
function taxShip(amt)
{
if (amt!=null) this._stax=amt;
return this._stax?this._stax:0;
}
function taxCntInc(items) {
var itm=items.start();
var a;
while (itm!=null) {
a=itm.taxes.split(',');
for (var j=0; j<a.length; j++)
if (a[j]&&this._tax.get(a[j])&&this._tax.get(a[j]).incTax&&this._tax.get(a[j]).perc>0) return true;
itm=items.next();
}
return false;
}
function taxIsEmpty(i,rcode) {
var a=i.split(',');
for (var j=0; j<a.length; j++) {
if(!a[j])continue;
var tax=this._tax.get(a[j]);
if (rcode) {
if (tax&&tax.perc>0){
var ad=false, t = tax.code.split(',');
for(k=0;k<t.length;k++){var lRegion = rcode.substr(0,Math.min(t[k].length,rcode.length));if(t[k].indexOf(lRegion)==0){ad=true;break}}
if(ad) return false;
}
} else {
if (tax&&tax.perc>0) return false;
}
}
return true;
}
var frPrArr={};
frPrArr['nl']=[];
frPrArr['nl'].push(['P89D45','POOL POWER STARTSET MIDDEL ', '0.000','59.950000', '391360','../media/startset.jpg']);
frPrArr['nl'].push(['P599D30','POOL POWER STARTSET GROOT ', '5.000','99.000000', 'SW200','../media/starterset actie zomer.jpg']);
frPrArr['nl'].push(['P343D134','BODEMSTOFZUIGER SET AR 2064 ', '0.000','74.950000', 'AR 2064','../media/a2064.jpg']);
frPrArr['nl'].push(['P1199D231','Zwembad douche ', '0.000','42.950000', 'AR104','../media/ar104.jpg']);
frPrArr['nl'].push(['P1196D231','Solar douche hoog 220 cm tank 30 liters PVC ', '0.000','259.000000', 'AR1030','../media/ar1030.jpg']);
frPrArr['nl'].push(['P575D137','Zomerkleed voor Dream Pool rond', '0.000','0.000000', '','../media/zomerkleed rond.jpg']);
frPrArr['nl'].push(['P792D134','Completeset schoonmaakset zwembad >30m3 AR20642 ', '0.000','199.000000', 'AR20642','../media/ar 20642.jpg']);
frPrArr['nl'].push(['P793D134','Completeset schoonmaakset voor zwembad >15m3 AR20641 ', '0.000','99.950000', 'AR20641','../media/ar 20641.jpg']);
frPrArr['nl'].push(['P1200D134','Automatische bodemstofzuiger \"Joker\" ', '0.000','139.000000', 'AR2068','../media/ar2068.jpg']);
function freeBasket(bsk)
{
this._add	= fb_Add;
this.bsk	= bsk;
this.fqnty	= fbQnty;
this.fprod	= fbProd;
this.add	= fbAdd;
this.clear	= fbClear;
this.overall	= fbOverall;
this.checkBasket=fbCheckBasket;
this.delByPr	=fbDelByPr;
this.getTitles	=fbGetTitles;
this.clear();
}
function fbClear()
{
this.items = new dynObj('item');
}
function fb_Add(id, qnty, title, weight,price, prdc,imgid)
{
var tmp = this.items.get(id);
prdc=prdc.replace('%%P','');
if (tmp==''){
var prc=price;
this.items.eAdd(id, new Array(this.bsk,id,tf.content.document,parseFloat(qnty),prc,title,parseFloat(weight),prdc,'','','','',imgid));
}
else tmp.quantity = qnty;
}
function fbGetTitles(ids,del) {
var ret=''; if (!del) del=',';
var ids=ids.split('|'),lastOne=ids[ids.length-2];
for (var i=0,a=frPrArr[tf.lang],l=a.length; i<l; i++) {
if (lastOne != a[i][0]) continue;
ret+=del+a[i][1];
}
return ret.substr(1);
}
function fbQnty(val, itm, disp)
{
if (disp) return ld('LD_FREE_QUANTITY', '')+ ':  ' + val + ' x ' + itm.title;
this._add(itm.id+"|"+itm.id, parseFloat(val), itm.title, itm.weight(), itm.price, itm.prdc, itm.pimg);
}
function fbProd(val,itm,disp)
{
if (!val) return '';
var str = ld('LD_FREE_PRODUCT', '');
var freeqnty=1;
var z=0,isForProd=typeof(itm.id)!='undefined',ids=val.split('|'),lastOne=ids[ids.length-2];
for (var i=0,a=frPrArr[tf.lang],l=a.length; i<l; i++) {
if (!isForProd && lastOne != a[i][0]) continue;
if ( isForProd && val.indexOf(a[i][0])==-1) continue;
z=1;
if (disp) str += '<br>  '+freeqnty+' x ' + a[i][1];
else {
if(isForProd)pid=itm.id;
else{pid='shop';this.delByPr('shop');}
this._add(pid+"|"+a[i][0], freeqnty, a[i][1], a[i][2],a[i][3],a[i][4],a[i][5]);
}
}
return (z)?str:'';
}
function fbAdd(itm, disc, stk, disp)
{
var qnty=(typeof(itm)=='object')?itm.quantity:0;
if (typeof(itm)=='number') qnty=itm;
var free = (disc)?disc.free(qnty):null;
if (!free) return '';
if (this.checkBasket(itm.id)) return '';
if (disp==null) disp=0;
switch(disc.type) {
case '2': return this.fqnty(free, itm, disp);
case '3': case '103': return this.fprod(free, itm, disp);
}
return '';
}
function fbOverall(type)
{
var ret = 0;
for (var i=0; i<this.items.cnt(); i++) {
var itm = this.items.get(i);
switch (type) {
case 'weight':	 ret += itm.weight() * itm.quantity; break;
case 'quantity': ret += itm.quantity;
default: break;
}
}
return ret;
}
function fbCheckBasket(id) {
var i=this.items.start();
while (i!=null) {
if (i.id.split('|')[0]==id) return 1
i=this.items.next();
}
return 0;
}
function fbDelByPr(id) {
var delArr=new Array();
var it=new Iterator(this.items); var i=it.start();
while (i!=null) {
if (i.id.split('|')[0]==id) delArr[delArr.length]=i.id;
i=it.next();
}
for (var i=0; i<delArr.length; i++) {
this.items.del(delArr[i]);
}
}
var showBasketWhenAddingToBasket=true;
if(getCookStr('showbasket')!=''){showBasketWhenAddingToBasket=getCookStr('showbasket')!='0';}
var glowing=false;
function glow(id,r,g,b){
if(glowing)return;
var tfcd=tf.content.document;
var elMCT=tfcd?tfcd.getElementById(id):null;
if(elMCT&&elMCT.innerText!=''){
function getStyle(el,prop){
if(!el)return'';
var val='';
if(tfcd.defaultView&&tfcd.defaultView.getComputedStyle){
val=tfcd.defaultView.getComputedStyle(el,'').getPropertyValue(prop);
}
else if(el.currentStyle){
prop=prop.replace(/-(\w)/g,function(strMatch,p1){return p1.toUpperCase();});
val=el.currentStyle[prop];
}
return val;
}
function fade(els,sr,sg,sb,er,eg,eb,steps,delay){
var r,g,b;
for(var i=0;i<=steps;i++){
r=Math.floor(sr*((steps-i)/steps)+er*(i/steps));
g=Math.floor(sg*((steps-i)/steps)+eg*(i/steps));
b=Math.floor(sb*((steps-i)/steps)+eb*(i/steps));
setTimeout(els+'.style.backgroundColor="rgb('+r+','+g+','+b+')"',(80*i)+delay);
}
}
glowing=true;
var elR=255,elG=255,elB=255;
function getColor(id,r,g,b){
var el=tfcd.getElementById(id),styleVal=getStyle(el,'background-color');
while(el&&(!styleVal||styleVal=='transparent')){
el=el.parentNode;
styleVal=(el?getStyle(el,'background-color'):'');
}
if(styleVal){
if(styleVal.substr(0,1)=='#'){
var bg=styleVal.substr(1);
r=parseInt(bg.substr(0,2),16);
g=parseInt(bg.substr(2,2),16);
b=parseInt(bg.substr(4,2),16);
}
else{
var vala=styleVal.replace(/rgb\((\d+), ?(\d+), ?(\d+)\)/,function(strMatch,p1,p2,p3){return[p1,p2,p3];}).split(',');
r=vala[0];g=vala[1];b=vala[2];
}
}
return [r,g,b];
}
var s=getColor(id,elR,elG,elB),e=getColor('Index2',r,g,b);
if(s[0]==e[0]&&s[1]==e[1]&&s[2]==e[2]){e[0]=r;e[1]=g;e[2]=b;}
fade('tf.content.document.getElementById("'+id+'")',s[0],s[1],s[2],e[0],e[1],e[2],20,0);
fade('tf.content.document.getElementById("'+id+'")',e[0],e[1],e[2],s[0],s[1],s[2],20,1800);
setTimeout('glowing=false',3600);
}
}
function basket(name)
{
this.name  = (name!=null)?name:'';
this.items = new dynObj('item');
this.stk   = new dynObj('stock');
this.disc  = new dynObj('discount');
this.gdisc = new dynObj('discount');
this.ship  = new dynObj('keyval');
this.fbsk  = new freeBasket(this);
this.tax   = new tax();
this.chk_total=0;
this.chk_total_tax=0;
this.chk_tax_noshiptax=0;
this.chk_tax_ship=0;
this.chk_disc_novoucher=0;
this.decodeState = 'initialised';
this.parse	= bskParse;
this.add	= bskAdd;
this.del	= bskDel;
this.save	= bskSave;
this.load	= bskLoad;
this.encode	= bskEncode;
this.decode	= bskDecode;
this.shpP	= 0;
this.shDisc	= bskShDisc;
this.updQnty	= bskUpdQnty;
this.total	= bskTotal;
this.ckOut	= bskCkOut;
this.hasDisc	= bskHasDisc;
this.overall	= bskOverall;
this.shipPrice	= bskShpPrice;
this.noShip	= bskNoShp;
this.shipMeths	= bskShpMeths;
this.pShip	= bskPShip;
this.searchTaxes= bskSearchTaxes;
this.hasTaxAtCountyLevel = bskHasTaxAtCountyLevel;
this.invalidate = bskInvalidate;
this.getTaxIDs	= bskGetTaxIDs;
this.refreshTotal=bskRefreshTotal;
this.calcTotal = bskCalcTotal;
this.clearBsk	= bskClearBsk;
this.updDecodeState = bskUpdDecodeState;
this.itemsTemporary = new dynObj('item');
this.incorporateTemp=bskIncorporateTemp;
this.clone=bskClone;
this.merge=bskMerge;
}
function bskParse(id,doc,qnty,title,weight,itemNo,useDec,esd,taxes,opts,prdc,manc,dstc,prcc,ship,restoring,temp)
{
var price=0;
function cf(i,d,sd,s,t,st){
currentItem	= i;
var dcf		= doc.cf_popup;
tf.load('conf.html','conf',true);
tf.load('grey.html','shipping');
var wnd=tf.content;
wnd.sfAddRef={core:window,item:i,stock:st,options:opts,pdoc:doc}
return false;
}
if(temp){
var p=tf.wm.pProp(id);
if(!p)return alert('Error: 0x00CEFF');
var price=parseFloat(p[1]);
if(!weight)weight=parseFloat(p[10]);
var itm=this.itemsTemporary.empty();
itm.init(this,id,doc,qnty,price,title,weight,itemNo,useDec,esd,taxes,prdc,null,temp);
var chk=itm.addOpt(opts,doc);
if(chk!=''){
tf.content.sfAddUnpop();
if(chk!=' ')return alert(LD.LD_ORDER_ERROR_FIELDS+'\n'+chk);
if(!confirm(LD.LD_CHOOSE_OPTIONS))return -1;
}
this.itemsTemporary.del(0);
this.itemsTemporary.add(itm);
if(title!=''&&!cf(itm, disc, this.shDisc(), null, this.tax, null)) return 0;
return 1;
}
var stkEn=0,p=tf.wm.pProp(id);
if(!p)return alert('Error: 0x00CEFF');
var price=parseFloat(p[1]);
if(!weight)weight=parseFloat(p[10]);
var itm=this.items.empty();
itm.init(this,id,doc,qnty,price,title,weight,itemNo,useDec,esd,taxes,prdc);
var chk=itm.addOpt(opts,doc);
if(chk!=''){
tf.content.sfAddUnpop();
if(chk!=' ')return alert(LD.LD_ORDER_ERROR_FIELDS+'\n'+chk);
if(!confirm(LD.LD_CHOOSE_OPTIONS))return -1;
}
var stkItm=this.items.empty();
stkItm.init(this,id,doc,qnty,price,title,weight,itemNo,useDec,esd,taxes,prdc);
stkItm.addOpt(opts,doc);
var stkItmNo=stkItm.getItemNo(),pstk=tf.wm.pProp(stkItmNo);
if(typeof(pstk)=='undefined')pstk=p;
var smin=pstk[2],smax=pstk[3],savail=pstk[4],st='';
if (stkItmNo){
var stk=Basket.stk.eAddS(stkItmNo,[smin,smax,savail,prdc,manc,dstc,prcc]);
stk.avail=useDec>0?parseFloat(savail):parseInt(savail);
var stkopts=stkItm.options;
for (var i=0;i<stkopts.cnt();i++){
var opt=stkopts.get(i);
if(opt.choice()!==''||opt.combine||!opt.optId())continue;
var pstkopt=tf.wm.pProp(opt.optId());
if(pstkopt){
var stkopt=Basket.stk.eAdd(opt.optId(),[pstkopt[2],pstkopt[3],pstkopt[4],manc,dstc,prcc]);
stkopt.avail=useDec>0?parseFloat(pstkopt[4]):parseInt(pstkopt[4]);
}
}
}
var disc = Basket.disc.eAdd(itm.id,[p[5], p[6], p[7]]);
var ship = Basket.ship.eAdd(itm.id,[itm.id, p[8]]);
if(this.name != ''){
if(title!=''){if(confirm(LD.LD_FAVOURITES_CONFIRM))this.add(itm);}
else this.add(itm);
return null;
}
if (title!='' && !cf(itm, disc, this.shDisc(), stk, this.tax, st)) return 0;
if (!this.add(itm)) return 0;
return 1;
}
function bskAdd(itm)
{
var stk=this.stk.getS(itm.getItemNo());
var items=this.items,l=items.cnt();
for (var i=0; i<l; i++) {
var tmp = items.get(i);
if (!itm.isSame(tmp)) continue;
tmp.transfer(itm)
items.del(i)
break;
}
items.add(itm)
if(this.name==''&&stk){
stk.update(itm);
}
itm.cache=[];
voucher.invalidate();
if(this.decodeState=='complete'){
if(this.name==''){
this.calcTotal(tf.ship_obj)
rl_total()
if(!showBasketWhenAddingToBasket)glow('MiniCartTotalDrawer',255,255,0);
}
this.save()
}
return 1;
}
function bskDel(idx)
{
var itm = this.items.get(idx)
if (itm == '') return ''
this.items.del(idx)
voucher.invalidate();
if (this.fbsk&&this.name=='') {
this.fbsk.delByPr(itm.id)
this.fbsk.delByPr('shop');
this.fbsk.add(this.total(), this.shDisc(), null, 0);
}
if(this.name==''){
this.calcTotal(tf.ship_obj)
rl_total();
if(!showBasketWhenAddingToBasket)glow('MiniCartTotalDrawer',255,255,0);
}
this.save()
}
function bskUpdQnty(idx, qnty)
{
var itm = this.items.get(idx);
var tmp = itm.quantity,qty=(itm.useDec>0?parseFloat(qnty):parseInt(qnty));
if (isNaN(qty)||qty<0) qty=tmp;
if (qty==0) {this.del(idx); return;}
var stk=this.stk.getS(itm.getItemNo());
// Subtract old quantity from stock
itm.quantity=qty;
if(stk){
stk.update(itm);
}		// Update new quantity to stock
voucher.invalidate();
itm.cache=new Array();
if(this.name=='')this.calcTotal(tf.ship_obj)
this.save()
this.ckOut()
}
function bskTotal(type)
{
var apply_voucher=true;
if(type=='novoucher'){apply_voucher=false;type='';}
var apply_dsc=true;
if (type=='orig') {apply_dsc=false; type=''}
if (type==null) type=''
var tot=0,prprice=0,purtot=0;
var items=this.items,i=items.start()
while (i!=null) {
tot += i.calc(type)
purtot+=i.cache['pur'+i.quantity];
if (type=='tax') prprice+=(i.getGDsc()?i.calc('dsc'):i.calc('ndc'))
i = items.next()
}
var shDisc=this.shDisc();
if((type==''||type=='pur'||type=='inc')&&apply_dsc&&this._shDisc){tot-=shDisc.purchasePrice(tot);
if(core.voucher.type!=0){core.voucher.purtot=tot;core.voucher.newtot=core.voucher.calcRaw(tot);}}
if(type=='exc'&&apply_dsc&&this._shDisc)tot-=shDisc.purchasePriceByPrice(tot,purtot);
if(type=='tax'&&apply_dsc&&this._shDisc) {
tot-=shDisc.purchasePriceByPrice(tot,prprice);
}
if(tot>0&&apply_dsc&&apply_voucher){tot=core.voucher.calc(tot);}
return tot;
}
function bskHasDisc()
{
return this.total('damt');
}
function bskShDisc(type, val, tLim)
{
if (type==null||type=='') return this._shDisc;
if (this._shDisc==null) this._shDisc=this.disc.eAdd('shop', new Array(type,val,tLim));
return this._shDisc;
}
function bskOverall(type, ckOut)
{
var ret = 0;
for (var i=0; i<this.items.cnt(); i++) {
var itm = this.items.get(i);
switch (type) {
case 'weight'  : ret += itm.weight() * itm.quantity; break;
case 'quantity': ret += itm.quantity; break;
default: break;
}
}
if (ckOut != null) return ret;
this.ckOut()
ret += this.fbsk.overall(type);
return ret;
}
function bskCkOut()
{
this.fbsk.clear();
for (var i=0; i<this.items.cnt(); i++) {
var itm = this.items.get(i);
var dsc = this.disc.get(itm.id);
var stk = this.stk.getS(itm.getItemNo());
this.fbsk.add(itm, dsc, stk);
}
this.fbsk.add(this.total(), this._shDisc);
}
function bskShpPrice(shp_obj, ckOut, inc)
{
if (shp_obj && typeof(shp_obj)=='object')this.shp_obj=shp_obj;
if (shp_obj!=null) {
if (shp_obj.cost==null) return 0;
var e = 0;
var t = this.total('tax');
var p = this.total('exc');
var pur = this.total();
var w = this.overall('weight', ckOut);
var q = this.overall('quantity', ckOut);
var s = (inc)?shp_obj.cost(pur, w, q, region, method):shp_obj.calc(pur, p, w, q, region, method);
this.shpP = (s==null||s<0)?0:s+this.pShip(shp_obj.cLink.mid,inc);
this.tax.ship(shp_obj.tax(this.shpP, p));
}
return parseFloat(this.shpP);
}
function bskNoShp()
{
var itm = this.items.start();
var ps  = new Array();
while (itm) {
var tmp = itm.shipMth();
for (var i in tmp) if (i) ps[i]=(typeof(ps[i])=='undefined'?(!parseInt(tmp[i])):(ps[i]&&!parseInt(tmp[i])));
itm = this.items.next();
}
return ps;
}
function bskShpMeths()
{
if (!tf.shipping || !tf.shipping.ship) return;
var ps = [], fap = tf.shipping.ship.forAllProds;
for (var i in fap) {
ps[i] = 0;
}
var itm = this.items.start(), high = 0;
while (itm) {
var itmMth = itm.shipMth(), yes = 0;
for (var i in fap) {
if (typeof(itmMth[i]) == 'undefined') yes = fap[i];
else if (parseInt(itmMth[i]) == 1) yes = 1;
else yes = 0;
ps[i] += yes;
if (ps[i] > high) high = ps[i];
}
itm = this.items.next();
}
for (var i in ps) {
if (ps[i] < high) delete ps[i];
}
return ps;
}
function bskPShip(mid,inc)
{
if(!mid)return 0;
var loc=-1;
if (tf.core&&tf.core.region){
var cnt=this.shp_obj.links.length,code=core.region;
if(code.length>4)code=code.substring(0,4);
var rgnLen=Math.min(core.shopRegion.length,code.length);
for(var i=0;i<cnt;i++){
var lk=this.shp_obj.links[i];
if(lk.mid==mid&&lk.zip[code]!=null){
loc=(core.shopRegion.indexOf(code.substr(0,rgnLen))==0?2:3);
break;
}
}
}
if(loc==-1)return 0;
var e	= 0;
var itm = this.items.start();
while (itm) {
var n=itm.shipMth(mid, loc);
if(typeof(inc)=='undefined'){
var rgnCde=core.region;len=rgnCde.length-(rgnCde.length%2);
for(var l=len;l>0;){
if(typeof(core.STax.mapRegn[rgnCde])!='undefined'){e+=n;break;}
l-=2;
rgnCde=rgnCde.substring(0,l);
}
if(l==0)e+=core.STax.exTax(itm.taxes,n);
}
else{e+=(inc?n:core.STax.exTax(itm.taxes,n));}
itm = this.items.next();
}
return e;
}
function bskSearchTaxes(rcode)
{
var it = new Iterator(this.items),i=it.start();
while (i!=null) {
if (i.taxes!='') {
if (!this.tax.isEmpty(i.taxes,rcode)) return true;
}
i = it.next();
}
return false;
}
function bskHasTaxAtCountyLevel(statecode)
{
var it = new Iterator(this.items),i=it.start(),has=false;
while (i!=null&&i.taxes!='') {
var a=i.taxes.split(',');
for (var j=0,jmax=a.length; j<jmax; j++) {
if(!a[j])continue;
var tax=this.tax._tax.get(a[j]);
if (tax&&tax.perc>0){
var t=tax.code.split(',');
for(var k=0,kmax=t.length;k<kmax;k++){if(t[k].indexOf(statecode)==0 && t[k].length>statecode.length){has=true;break;}}
}
}
i = it.next();
}
return has;
}
function bskGetTaxIDs()
{
var it	= new Iterator(this.items),i=it.start(),ret=new Array();
while (i!=null) {
var a=i.taxes.split(',');
for (var j=0;j<a.length;j++) {
if(ret.join(',').indexOf(a[j])==-1) ret[ret.length]=a[j];
}
i=it.next();
}
return ret.join(',');
}
function bskInvalidate() {
var it=new Iterator(this.items),i=it.start();
while (i!=null) {
i.cache=[];
i=it.next();
}
}
function bskCalcTotal(shipObj){
var ppur,ppur_ex,shp,ttax,shp_asis,shtaxex,taxonshp,tax,t,bsk=this;
if(shipObj){
ppur=bsk.total();
ppur_ex=bsk.total('exc');
shp=bsk.shipPrice(shipObj);
ttax=(ppur>0.001)?bsk.total('tax'):0;
shp_asis=bsk.shipPrice(shipObj,null,1);
if(shipObj._ttype==1)
shtaxex=tf.core.STax.exTax(tf.core.BTax.findMajorityTaxID(core.BTax.currRegn()),shp_asis);
else
shtaxex=tf.core.STax.exTax(tf.core.STax.allIDs(),shp_asis);
taxonshp=(ppur>0.001)?shipObj.tax(shp_asis,ppur_ex,null,shtaxex):0;
tax=ttax+taxonshp;
if(ppur_ex!=ppur){
t=ppur+shp+(shp_asis==shtaxex?taxonshp:0);
if((ppur-ppur_ex)>0.01)t+=(tax-(ppur-ppur_ex)-(shp_asis==shtaxex?taxonshp:shp_asis-shtaxex));
}
else
t=ppur_ex+tax+shtaxex;
}else{
ppur_ex=bsk.total('exc');
ttax=bsk.total('tax');
t=ppur_ex+ttax;
}
t=core.nfmt.roundTotal(t,tf.shopCurrency.iso);
bsk.chk_total=t;
bsk.chk_total_tax=tax;
bsk.chk_tax_noshiptax=ttax;
bsk.chk_tax_ship=taxonshp;
return [ppur,shp,shtaxex,t];
}
function bskRefreshTotal(){
if(LD&&tf.content&&tf.utils) {
if(tf.conf&&tf.conf.greySettings)tf.conf.greySettings();else return;
if(this.items.cnt()==0){
tf.sfMakeSpace.go(false,'','MiniCart');
}
else {
if(confLoaded){
function MiniCartTotalAmount(o){
o.calcTotal(tf.shipping.ship);
return '&nbsp;'+(o.chk_total_tax>0?LD.LD_INC:LD.LD_EX)+'&nbsp;'+showPrc(o.chk_total,0);
}
var showPlusShipping=-1,showPlusTax=-1,showPlusDone=-1;
function getShowPlusShipping(o){
return (!tf.core.regionChanged||(tf.shipping.ship.method.cnt()>1&&tf.core.method=='--'));
}
function getShowPlusTax(o){
var itm=o.items.start(),regn=(showPlusDone?null:o.tax.getDefaultReg()),t={};
t.length=0;
while (itm!=null) {
var a=itm.taxes.split(',');
for (var j=0,jj=a.length; j<jj; j++){
var _t=o.tax._tax.get(a[j]);
if(_t&&typeof(t[_t.id])=='undefined'){
if(o.tax.regnRate(_t.id,regn)){t[_t.id]=1;t.length++;}
}
}
itm=o.items.next();
}
return t.length > 0;
}
function getShowPlusDone(o){
return (tf.core.regionChanged&&(tf.shipping.ship.method.cnt()==1||tf.core.method!='--'));
}
var dd=tf.content.document;
var arr={
MiniCartTotalAmount:function(o){return MiniCartTotalAmount(o);},
MiniCartTotalSummary:function(o){return o.overall('quantity')+' '+LD.LD_ITEMS+' = '+MiniCartTotalAmount(o);},
MiniCartTotalItemsQuantity:function(o){return o.overall('quantity');},
MiniCartTotalTotalText:function(o){
if(tf.miniCartHandler&&tf.miniCartHandler.shippingChargeHandler)return;
if(showPlusShipping==-1)showPlusShipping=getShowPlusShipping(o);
return (!showPlusShipping ? LD.LD_TOTAL : LD.LD_SUBTOTAL);
},
MiniCartTotalPlusExpenses:function(o){
if(tf.miniCartHandler&&tf.miniCartHandler.shippingChargeHandler)return;
if(showPlusDone==-1)showPlusDone=getShowPlusDone(o);
if(showPlusShipping==-1)showPlusShipping=getShowPlusShipping(o);
if(showPlusTax==-1)showPlusTax=getShowPlusTax(o);
if(!showPlusShipping&&!showPlusTax&&!showPlusDone)return '';
var plusPrefix=(showPlusDone?LD.LD_INC+' ':'+');
var HTML=['<a href="#" class="ImgLink" onclick="cancelBuble();sfAddPop(\'shipping_charge\',true);return false;">'+plusPrefix+'<span id="PlusExpensesText">'];
if(showPlusDone||showPlusShipping)HTML.push(LD.LD_SHIPPING_CHARGES);
if((showPlusDone||showPlusShipping)&&showPlusTax)HTML.push(', ');
if(showPlusDone||showPlusTax){
var itm=o.items.start(),regn=(showPlusDone?null:o.tax.getDefaultReg()),t={},txt=[];
while (itm!=null) {
var a=itm.taxes.split(',');
for (var j=0,jj=a.length; j<jj; j++){
var _t=o.tax._tax.get(a[j]);
if(_t&&typeof(t[_t.id])=='undefined'){
if(o.tax.regnRate(_t.id,regn)){t[_t.id]=1;txt.push(_t.taxName);}
}
}
itm=o.items.next();
}
HTML.push(txt.join(', '));
}
HTML.push('</span>'+'</a>');
return HTML.join('');
},
MiniCartTotalList:function(o){
var HTML=[],itms=o.items,itFree=new core.Iterator(o.fbsk.items);
for (var i=0,num=itms.cnt(); i<num; i++) {
var itm = itms.get(i);
var vars={
'ProductQuantity':itm.quantity,
'ProductTitle':itm.title,
'ProductPrice':showPrc(itm.calc(),0),
'ProductImage':'src="'+(itm.pimg!=''?itm.pimg:tf.wm.url('../media/trans.gif','-'))+'"',
'ProductURL':'href="'+(unescape(itm.purl).replace('#'+itm.id.toLowerCase(),''))+'#'+itm.id.toLowerCase()+'"'
};
HTML.push(tf.utils.tmplParser.parse('tmplMiniCartTotalList', vars));
var idtag=(isNaN(itm.id)?'_':'')+itm.id,iFree=itFree.start();
while(iFree!=null) {
if(iFree.idtag.split("|")[0]==idtag) {
vars={
'ProductQuantity':iFree.quantity,
'ProductTitle':iFree.title,
'ProductPrice':LD.LD_FREE,
'ProductImage':'src="'+(tf.isEntryPage?'contents/media/':'')+(iFree.pimg!=''?iFree.pimg:'../media/trans.gif')+'"'
};
HTML.push(tf.utils.tmplParser.parse('tmplMiniCartTotalFreeList', vars));
}
iFree=itFree.next();
}
}
var iFree=itFree.start();
while(iFree!=null) {
if(iFree.idtag.split("|")[0]=='_shop') {
vars={
'ProductQuantity':iFree.quantity,
'ProductTitle':iFree.title,
'ProductPrice':LD.LD_FREE,
'ProductImage':'src="'+(tf.isEntryPage?'contents/media/':'')+(iFree.pimg!=''?iFree.pimg:'../media/trans.gif')+'"'
};
HTML.push(tf.utils.tmplParser.parse('tmplMiniCartTotalFreeList', vars));
}
iFree=itFree.next();
}
return HTML.join('');
}
};
for(var n in arr){
var el=dd.getElementById(n);
if(el){el.innerHTML=arr[n](this);}
}
}
tf.sfMakeSpace.go(true,'','MiniCart');
}
if(tf.miniCartHandler&&tf.miniCartHandler.refreshEnd)tf.miniCartHandler.refreshEnd();
if(tf.autoText)tf.autoText.apply('ancestorGC');
if(tf.equalHeight)tf.equalHeight();
if(tf.isInDesigner()){tf.parent.applyColorScheme(tf);}
}
}
function bskClearBsk() {
this.stk   = new dynObj('stock');
this.items = new dynObj('item');
this.fbsk  = new freeBasket(this);
core.voucher.clear();
}
function load_price(args)
{
var all = args[1],inTempBsk=(args[2]!=false);
for (var i=0, num=all.length; i<num; i++) {
var itm = all[i];
args[0].parse(itm.id, itm, itm.quantity, '', '','',null,null,null,null,null,null,null,null,null,null,inTempBsk);
}
var complete=args[0].updDecodeState();
if(complete){
if(tf.isFavoritesPage)tf.fillBasketTable();
if(args[0].name==''){
args[0].calcTotal(tf.ship_obj);
rl_total();
if(!showBasketWhenAddingToBasket)glow('MiniCartTotalDrawer',255,255,0);
}
args[0].save();
}
}
function bskSave()
{
tf.saveBskToName();
if (getCookStr('storebasket')!='1'&&this.name!='Favorite') return;
var ck = '';
var ckName = this.name; if (!ckName) ckName='ADDRESS';
if (this.items.cnt()>0) {
ck = this.encode();
var pck=place(ck);
ck = pck + "TEST" + add(pck);
}
if (this.name!='')savCookStr(ckName, ck, -1);
else savCookStr(ckName, ck, '60');
this.shpP = 0;
tf.nametag.add('askRestoreBsk','false');
}
function bskLoad()
{
tf.loadBskFromName();
if(getCookStr('storebasket')!='1'&&this.name!='Favorite'){this.decodeState='complete';return;}
if(this.name=='Favorite'&&(!tf.isFavoritesPage||this.decodeState=='complete')){this.decodeState='complete';return;}
var ckName = this.name; if (!ckName) ckName='ADDRESS';
var arr = getCookStr(ckName).split("TEST"),askAgain=true;
if ((tf.nametag.get('askRestoreBsk') != 'false' || this.name) && arr.length == 2 && add(arr[0]) == arr[1]) {
askAgain=false;
if (this.name!='' || confirm(shopName+':\n\n'+LD.LD_LOAD_BASKET+'  '+this.name)){
this.decode(show(arr[0]));
}
else savCookStr(ckName, "", '60');
}
else {rl_total();this.decodeState='complete';}
if(!askAgain)tf.nametag.add('askRestoreBsk','false');
if(!showBasketWhenAddingToBasket)glow('MiniCartTotalDrawer',255,255,0);
}
function bskEncode()
{
var is=[];
for (var i=0,ii=this.items.cnt(); i<ii; i++) {
var itm = this.items.get(i);
if(itm.temporary)continue;
is.push(itm.code());
}
return '['+is.join('~')+']';
}
function bskDecode(str)
{
var s = str.substring(1,str.length-1), sa = s.split(']['), is = sa[0].split('~');
function _L(f,prid,pgid){
pgcnti++;
var p=tf.lang+'/'+f.replace(/(_\d\d)?\.html/,'_$1').replace(/&#44;/g,',').replace(/&#45;/g,'-');
if (!pg[p]){thisBsk.expectedpgcnt++;pg[p] = [];}
pg[p]=pg[p].concat(pgtmp[prid]?pgtmp[prid]:pgtmp[f]);
if(pgcnti==expectedpgcnt){for(var i in pg)load_page(i, 'core.load_price', [thisBsk, pg[i], false]);}
}
if(is.length>0)this.decodeState='loading';
var pg = [], pgtmp = {}, expectedpgcnt = 0, pgcnti = 0, thisBsk = this;
for (var i=0,ii=is.length; i<ii; i++) {
var itm = this.items.empty();
itm.code(this,is[i])
if (tf.wm.pProp(itm.id))		// Price already exists
this.parse(itm.id, itm, itm.quantity,'','');
else {
var jfile=tf.wm.jfile(itm.purl).split('?')[0],id=jfile.replace(/[._].*/,'');
if(id.substr(0,1)!='p')id=jfile;
if(!pgtmp[id]){expectedpgcnt++;pgtmp[id]=[];}
pgtmp[id].push(itm);
}
}
this.pgcnti=0;
this.expectedpgcnt=0;
for (var jfile in pgtmp){
var id=jfile.replace(/[._].*/,'');
if(id.substr(0,1)=='p'){tf.utils.prpgmap.getParentPage(id,'',_L);}
else _L(jfile,'',id);
}
if(expectedpgcnt==0)this.decodeState='complete';
}
function bskUpdDecodeState(){
this.pgcnti++;
if(this.pgcnti>=this.expectedpgcnt){
this.decodeState='complete';
delete this.pgcnti;
delete this.expectedpgcnt;
return true;
}
return false;
}
function bskIncorporateTemp(){
for (var i=0;i<this.itemsTemporary.cnt();i++){
var tmp=this.itemsTemporary.get(i);
for (var i=0; i<this.items.cnt(); i++) {
var itm=this.items.get(i);
if (!itm.isSame(tmp)) continue;
itm.transfer(tmp);
this.items.del(i);
break;
}
tmp.cache=[];
tmp.parent=this;
var p=tf.wm.pProp(tmp.id);
this.disc.eAdd(tmp.id,[p[5], p[6], p[7]]);
this.ship.eAdd(tmp.id,[tmp.id, p[8]]);
this.items.add(tmp);
this.itemsTemporary.replace(i,tmp);
}
}
function bskClone(o,lvl,o2,oTop){
if(isNaN(lvl)){lvl=0;oTop=o;}else if(lvl>10)return;
lvl++;
var oThis=(o2?o2:this);
for (var i in o){
if(i=='parent'||i=='bsk'){oThis[i]=oTop;continue;}
if(typeof(o[i])=='object')
if(o[i]&&!isNaN(o[i].length)){oThis[i]=[];bskClone(o[i],lvl,oThis[i],oTop);}
else oThis[i]=new bskClone(o[i],lvl,null,oTop);
else
oThis[i]=o[i];
}
}
function bskMerge(o,lvl,o2,oTop){
if(isNaN(lvl)){lvl=0;oTop=this;}else if(lvl>10)return;
lvl++;
var oThis=(o2?o2:this);
for (var i in o){
if(i=='parent'||i=='bsk'){oThis[i]=oTop;continue;}
if(typeof(o[i])=='object'&&o[i])
if(o[i]&&!isNaN(o[i].length)){oThis[i]=[];bskMerge(o[i],lvl,oThis[i],oTop);}
else if(oThis[i]&&(oThis[i].gid||o[i].gid)){
for(var oi in o[i]._arr){
if(!o[i]._arr[oi])continue;
if(!oThis[i].getById(o[i]._arr[oi].id)){
var oNew=oThis[i].empty();
bskMerge(o[i]._arr[oi],lvl,oNew,oTop);
oThis[i].add(oNew);
}
else if(i=='items'&&oThis[i]._arr&&!oThis[i]._arr[oi]){
var oNew=oThis[i].empty(),newidtag=oNew.idtag;
bskMerge(o[i]._arr[oi],lvl,oNew,oTop);
oNew.idtag=newidtag;
oThis[i].add(oNew);
}
if(oThis[i]._arr[oi].gid=='item')oThis[i]._arr[oi].parent=oTop;
}
}
else if(i=='fbsk'||i=='tax'){
for(var oo in o[i]){
bskMerge(o[i],lvl,oThis[i],oTop);
}
}
else{oThis[i]=new bskMerge(o[i],lvl,null,oTop);}
else
oThis[i]=o[i];
}
}
var voucher = {
rawDisc:0,type:0,msg:'',code:'',fnPostProcess:null,
gl:function(id){return tf.content.gl(id);},
clear:function(){this.invalidate();this.code=this.msg='';this.purtot=this.newtot=0;},
invalidate:function(){this.type=0;this.rawDisc=0;},
process:function(dt,disc,resp,msgcode,msgtext,msgarg1){
if(msgcode=='ld_voucher_must_add_more_to_basket')msgarg1=core.showPrc(msgarg1,1);
if(typeof(msgtext)!='undefined')msgtext=msgtext.replace(/\$1/g,msgarg1);
this.rawDisc=(disc>=0?disc:0);
if(this.rawDisc>0){
this.type=dt;
this.msg=msgtext;
this.purtot=core.Basket.total('orig');
this.newtot=this.calcRaw(core.Basket.total('novoucher'));
}
else{this.msg=(resp?msgtext:'');this.code='';this.purtot=this.newtot=0;}
this.dispDisc('voucherDisc');
this.dispCode('voucherCode');
this.dispMsg('voucherMsg','btnVoucher',true,true);
if(typeof(this.fnPostProcess) == 'function'){this.fnPostProcess();this.fnPostProcess=null;}
},
calcRaw:function(tot){
var val=0;
switch(this.type){
case 1:val=tot-this.rawDisc;break;
case 2:var purtot=core.Basket.total('orig');val=this.purtot-purtot*this.rawDisc/100.0;break;
case 3:var purtot=core.Basket.total('orig');val=this.purtot-(purtot-this.rawDisc);break;
}
val=Math.max(0,val);
return val;
},
calc:function(tot,purtot,newtot){
if(this.type==0)return tot;
purtot=(purtot?purtot:this.purtot);
newtot=(newtot?newtot:this.newtot);
var val=0,oTax=core.Basket.tax,hasTax=oTax.anyTaxForRegion(oTax.currRegn());
if(hasTax)val=(((tot*newtot)+0.000000000001)/purtot);
else{
var incTax=oTax.cntInc(core.Basket.items);
if(this.type==3&&incTax)val=core.Basket.tax.calcTax(core.Basket.tax.allIDs(),purtot)/purtot*newtot;
else val=this.calcRaw(tot);
}
val=Math.max(0,val);
return val;
},
dispMsg:function(id,idbtn,showmsg,showbtn){
var el=this.gl(id);
if(el){if(showmsg){el.style.display='inline';el.innerHTML='<br>'+this.msg;}else{el.style.display='none';}}
el=this.gl(idbtn);
if(el)el.style.visibility=(showbtn?'visible':'hidden');
},
dispDisc:function(id){if(this.type!=0&&this.purtot-this.newtot>0){var el=this.gl(id);if(el)el.innerHTML=core.showPrc(this.purtot-this.newtot,1);}},
dispCode:function(id){var el=this.gl(id);if(el)el.value=this.code;},
query:function(code,idmsg,idbtn,iddisc,fn){
this.fnPostProcess=fn;
this.msg=LD.LD_LOADING;
this.dispMsg(idmsg,idbtn,true,false);
var el=this.gl(iddisc);if(el)el.innerHTML='';
this.code=code;
if(!this.code){this.dispMsg(idmsg,idbtn,false,true);this.dispDisc(iddisc);return false;}
this.disc=0;
tf.load('https://www.globecharge.com/webshop/voucher_discount.cgi?lang='+tf.lang+'&lmd='+Date()+'&from=sf&url='+escape(tf.wm.online?location.protocol+'//'+location.host+tf.wm.baseurl+'provider.html':tf.wm.url('provider.html','-'))+'&tot='+core.Basket.total('orig')+'&mid=demob_765&vc='+this.code,'voucher',false,true);
return false;
}
};
function item()
{
this.options	= new dynObj('options');
this.init	= itemInit;
this.isSame	= itemIsSame;
this.transfer	= itemTx;
this.sig	= itemSig;
this.code	= itemCode;
this.getItemNo = itemGetItemNo;
this.xcode	= itemXCode;
this.updQnty	= itemUQnty;
this.addOpt	= itemAddOpt;
this.weight	= itemWeight;
this.shipMth	= itemShipMth;
this.calc	= itemCalc;
this.getGDsc = itemGetGDsc;
return this;
}
function itemInit(prt,id,doc,qnty,price,title,weight,itemNo,useDec,esd,taxes,prdc,imgsrc,temp)
{
var loc='',img='';
if(doc){
if (doc.gid=='item'){
var o=doc;
title=o.title;if(!weight)weight=o.weight;itemNo=o.itemNo;
useDec=o.useDec;esd=o.esd;taxes=o.taxes;loc=o.purl;img=o.pimg;
}else{
loc=tf.wm.url(escape(doc.location.toString()));
if(!imgsrc){i=doc.getElementById('I'+id);img=i?tf.wm.url(i.src):'';}
else img=imgsrc;
}
}
this.parent	= prt;
this.id		= id;
this.useDec	= useDec;
this.title	= title;
this.itemNo	= itemNo;
this.esd	= esd;
this.purl	= loc;
this.pimg	= img;
this.prdc	= prdc;
this.quantity=0;
this._wght=0;
this.cache	= [];
this.price	= parseFloat(price);
this.taxes	= taxes;
this.updQnty(qnty);
this.weight(weight);
this.handlingcosts=[];
this.temporary=temp;
}
function itemGetItemNo(){
var s=this.itemNo;
for (var i=0, o=this.options;i<o.cnt();i++){
var opt=o.get(i);
if(opt.combine&&opt.optId()){
s=opt.optId();
break
}
}
return s;
}
function itemTx(obj,dcp)
{
if (!dcp) {obj.quantity += this.quantity;if(typeof(nfmt)=='object'){obj.quantity=nfmt.round(obj.quantity);}return obj.quantity;}
obj.code(this.code());
}
function itemIsSame(obj)
{
if (obj.id != this.id) return 0;
var myOpt = this.options;
var yrOpt = obj.options;
if (myOpt.cnt() != yrOpt.cnt()) return 0;
for (var i=0; i<myOpt.cnt(); i++) {
var opt = yrOpt.get(i);
if (opt == '' || myOpt.get(i).choice() != opt.choice()) return 0;
}
return 1;
}
var _iArr=['id','quantity','title','price','_wght','itemNo','taxes','esd','useDec','purl','pimg'];
function itemCode(prt,str)
{
if (prt) this.parent=prt;
return ckCodeStr(this, _iArr, '|', str);
}
function itemSig()
{
var p=tf.wm.pProp(this.id);
if (!p) return '';
p[9]=p[9].replace('%%P','');
var op = new Array();
for (var i in p['opt']) op[op.length]=p['opt'][i].join('~');
var ret=p.join('~') + ((op.length)?'/'+op.join('/'):'') + '/' + p['sig'];
if (!isNaN(p[9])) p[9]+='%%P';
return ret;
}
function itemXCode(str)
{
var s = '';
if (str==null||str=='') {
for (var i=0; i<this.options.cnt(); i++) {
s += (i==0)?'':';';
s += this.options.get(i).code();
}
} else {
var arr = str.split(';');
for (var i=0; i<arr.length; i++) {
var opt = this.options.empty();
opt.code(arr[i]);
this.options.add(opt);
}
}
return s;
}
function itemUQnty(qnty)
{
this.quantity = (this.useDec>0)?parseFloat(qnty):parseInt(qnty);
}
function itemAddOpt(allOpts, doc)
{
var opts = this.options;
var _f=doc.productForm;
if (!_f) {
_f=doc.options;
for (var i=0; i<_f.cnt(); i++) {
var o = opts.empty();
o.code(_f.get(i).code());
opts.add(o);
}
return '';
}
var len=(allOpts)?allOpts.length:0;
var form=new iForm(_f);
for (var i=0; i<len; i++) {
var arr = allOpts[i];
if (arr[0].substr(0,this.id.length)!=this.id||arr[0].substr(this.id.length,1)!='O') continue;
var o = opts.empty();
o.init(arr, form.getValue(arr[1]));
if(!o.prop[7])o.prop[7]=arr[0]+'C1'
opts.add(o);
}
var str  = '';
var warn = 0;
for (var i=0; i<opts.cnt();i++) {
var s = opts.get(i).check();
if (!s) continue;
if (s==' ') warn=1; else str+=s+'\n';
}
if (str != '') return str;
if (warn) return ' ';
return '';
}
function itemWeight(w)
{
if (w!=null) this._wght = parseFloat(w);
else w=this._wght;
if (isNaN(w)) w=0;
for (var i=0,o=this.options; i<o.cnt(); i++) w += o.get(i).weight();
return w;
}
function itemGetGDsc()
{
var prt= this.parent,gdsc=(ResellerID!='')?prt.gdisc.get(this.prdc):null;
if (!gdsc&&ResellerID!='') gdsc=prt.gdisc.get('ALL_OTHERS');
return gdsc;
}
function itemCalc(type,shMeth,nocache)
{
if (!type) type='pur';
var qtyCache=type+this.quantity;
if (!nocache&&this.cache[qtyCache]) return this.cache[qtyCache];
var qty=this.quantity,prt= this.parent,sd = prt.shDisc();
var dsc= prt.disc.get(this.id),gdsc=this.getGDsc();
var tax= prt.tax,prc= 0;
switch (type) {
case 'pdamt':
prc=0;
if(true)prc=dsc.amount(this.price,qty,this.calc('opt',shMeth,nocache));
if(gdsc)prc=prc+gdsc.amount(this.price-prc,qty,this.calc('opt',shMeth,nocache));
break;
case 'damt':
var all = this.parent.items;
for (var i=0,ii=all.cnt(); i<ii; i++) {
var itm = all.get(i);
if (itm==this) continue;
prc += (itm.calc('snd',shMeth,nocache)-itm.calc('pdamt',shMeth,nocache))*itm.quantity;
}
var iprc = this.calc('snd',shMeth,nocache) - this.calc('pdamt',shMeth,nocache);
prc += qty?iprc*qty:iprc;
prc  = sd.amount(iprc,prc,0) + this.calc('pdamt',shMeth,nocache);
break;
case 'opt': for(var i=0,o=this.options,oi=o.cnt();i<oi;i++)prc+=o.get(i).price();break;
case 'snd': prc=this.price+this.calc('opt',shMeth,nocache);break;
case 'sdc': prc=this.calc('snd',shMeth,nocache)-this.calc('damt',shMeth,nocache);break;
case 'ndc': prc=(this.price+this.calc('opt',shMeth,nocache))*qty;break;
case 'dsc': prc=this.calc('sdc',shMeth,nocache)*qty;break;
case 'tax': prc=tax.allAmt(this.taxes,this.calc('dsc'));break;
case 'pur': prc=tax.calcTax(this.taxes,this.calc('dsc',shMeth,nocache));break;
case 'exc': prc=tax.exTax(this.taxes,this.calc('dsc',shMeth,nocache)); break;
case 'inc': prc=tax.calcTax(this.taxes,this.calc('dsc',shMeth,nocache)); break;
}
prc=parseFloat(prc);
if((type=='pur'&&!tax.exempt&&qty==1)||(type=='dsc'&&qty==1)||type=='sdc')prc=nfmt.round(prc);
if (!nocache) this.cache[qtyCache]=prc;
return prc;
}
function itemShipMth(mid, cde)
{
var ps  = new Array();
var sh  = this.parent.ship.get(this.id);
var val = sh?sh.val():'';
if (!val) return mid?0:ps;
val = val.split(';');
for (v in val) {
var e = val[v].split(',');
if (!mid) ps[e[0]] = e[1];
else if (mid==e[0]) return e[cde]?parseFloat(e[cde])*this.quantity:0;
}
return mid?0:ps;
}
var Basket=new basket();
Basket.shDisc('103','','');
var theBsk=Basket;
var nfmt=new numeric(',',''),css=new CSS();
var Basket=new basket();
var theBsk=Basket;
var Favorite=new basket('Favorite');
tf.coreLoaded=true;
try{tf.content.core=this.window;}catch(e){}
tf.core=core=this.window;
function regPrc(arr)
{
function h2a(s) {
var ret = ''
var len = s.length;
for (var i=0; i<len-32; i+=2) ret += unescape('%'+s.charAt(i)+s.charAt(i+1));
ret += s.substring(len-32,len);
var arr = ret.split('/')
for (var i=0; i<arr.length; i++){arr[i]=arr[i].replace('&#47;','/');}
return arr;
}
var ret = 1;
for (var i=0; i<arr.length; i++) {
var sr = h2a(arr[i]);
if(!sr[0])continue;
var prop=sr[0].split('~');
var discType=parseInt(prop[5]);
if (tf.wm.pProp(prop[0])) {
ret = 0;
continue;
}
var op=new Array();
for (var j=1; j<sr.length-1; j++) {
var tmp = sr[j].split('~');
op[op.length] = tmp;
}
prop['sig'] = sr[sr.length-1];
prop['opt'] = op;
if (!isNaN(prop[9])) prop[9]+='%%P';
tf.wm.pProp(prop[0], prop);
}
return ret;
}
var sh_dobj;
if (this.discount) {
sh_dobj = new discount();
gd_obj = new discount();
sh_dobj.init('103','','');
var timedDiscountsExist=true;
if(!isInSF()){
if(timedDiscountsExist){
function shopDiscMsg(){
if(!currTime.isActive(sh_dobj.tlim)){
var el=tf.content.document.getElementById('ShopDiscountMessage-'+tf.content.pgid);
if(el)el.style.display='none';
}
}
currTime.handlers['getTime'].push(shopDiscMsg);
shopDiscMsg();
}
if(timedDiscountsExist||tf.content.timedDiscountsExist)currTime.handlers['getTime'].push(function(){if(tf.utils){tf.utils.populatePrice()}});
}
}
function getDscAmt(id, prc, usePrc)
{
var p=tf.wm.pProp(id);
var amt=0;
var dsc_obj = new discount();
if (!p || !dsc_obj) return '';
if (true) {
dsc_obj.init(p[5], p[6], p[7]);
amt += dsc_obj.amount(prc, 1, 0);
if(sh_dobj.type!=6)amt += sh_dobj.amount((usePrc?prc:p[1])-amt, (usePrc?prc:p[1])-amt, 0, 1);
}
if (ResellerID!='') {
var Basket=core.Basket;
var gdsc=Basket.gdisc.get(p[9]);
if (!gdsc) gdsc=Basket.gdisc.get('ALL_OTHERS');
if (gdsc) amt+=gdsc.amount(parseFloat(prc)-amt, 1, 0);
}
return amt;
}
function getPrc(id, sid, dsc)
{
var p=tf.wm.pProp(id);
if (p==null) return '';
var prc = p[1];
if (sid) { for (var i in p['opt']) { if (p['opt'][i][0] == sid) { prc = p['opt'][i]; break; } } }
var val=null;
if (!dsc||sid) val=prc;
else val=prc-getDscAmt(id, prc);
if(!isNaN(val)){
if(nfmt.dec!=tf.currentCurrency.decimal_places)val=nfmt.round(val,nfmt.dec);
val=nfmt.round(val,1/Math.pow(10,tf.currentCurrency.decimal_places));
}
return val;
}
function getOPrc(id, sid, od, dsc)
{
if (id.indexOf('O')>-1) id=id.substr(0,id.indexOf('O'));
var op=getPrc(id,sid);
return (op==null)?0:(dsc?op[od*2+2]-getDscAmt(id,op[od*2+2],true):op[od*2+2]);
}
function dPrc(prc, ifscurr,dispZero,fmtCurr)
{
var scurr='';
if (!ifscurr&&tf.secondCurrency) scurr=' <span class="SecondaryCurrencyAmount">('+getSCurr(prc,fmtCurr)+')</span>';
var abbrev = tf.currentCurrency.abbrev;
if (fmtCurr) abbrev = '<span class="ProductCurrencySymbol">'+abbrev+'</span>';
return (prc==''&&!dispZero)?'':nfmt.display(prc*(tf.currentCurrency.multiplier/tf.shopCurrency.multiplier), tf.currentCurrency.decimal_places,abbrev)+scurr;
}
function getSCurr(prc,fmtCurr){
var scCurr=tf.secondCurrency, abbrev = scCurr ? scCurr.abbrev : '';
if (fmtCurr) abbrev = '<span class="ProductCurrencySymbol">'+abbrev+'</span>';
return (scCurr)?nfmt.display(prc*(scCurr.multiplier/tf.shopCurrency.multiplier),scCurr.decimal_places,abbrev):'';
}
function CSS(doc)
{
this.get  = cssGet;
this.init = cssInit;
this.init(doc);
}
function cssInit(doc)
{
function docSS(arr,doc) {
var ds=doc.styleSheets;
if (ds&&ds.length>0&&ds[0].imports&&ds[0].imports.length>0){
ds=ds[0].imports[0];
for(var j=0,rl=ds.rules;rl&&j<rl.length;j++){
var tag=rl[j].selectorText.toLowerCase();
arr[tag]=rl[j].style.cssText;
}
}
else ds=null;
return ds;
}
function defSS(arr,doc) {}
if (!doc) doc=document;
this._css = new Array();
if (!docSS(this._css, doc)) defSS(this._css,doc);
}
function cssGet(name,type)
{
switch(type){
case 1: name='.'+name;break;
}
return this._css[name];
}
var tsI=new Array();
function prodDiscMsg(id){
var p=tf.wm.pProp(id);
if(p&&!currTime.isActive(p[7])){
var	el=tf.content.document.getElementById('ProductDiscountMessage-'+id);
if(el)el.style.display='none';else setTimeout(function(){prodDiscMsg(id);},100);
}
}
function pprice(elPrice,args) {
var ret=[]; var Id=args[0],pi=args[1],pt=args[2],b1=args[3],b2=args[4],b3=args[5];
var _prc=getPrc(Id,null),_prcStr=dPrc(_prc,1,false,true),discShown=false,bsk=tf.core.Basket;
function gl(id){return tf.content.document.getElementById(id);}
if(!elPrice)elPrice=gl('ProductPrice-'+Id);
var elOrig=gl('ProductPriceOriginal-'+Id),elCalc=gl('ProductPriceCalculated-'+Id),elIntro=gl('ProductPriceIntro-'+Id);
if(pi){
if(elIntro)elIntro.innerHTML=pi;
else ret.push('<span class="ProductPriceIntro" id="ProductPriceIntro-'+Id+'">'+pi+'</span> ');
}
if(tf.conf&&tsI.length==0)tf.conf.populateTSI();
if(bsk.tax.showBoth){
var a=pt.split(','),tinc='',texc='',tid=pt;
for (var i=0,ii=a.length; i<ii; i++){
if(tsI[a[i]])tinc+=', '+tsI[a[i]];
if(tsIx[a[i]])texc+=', '+tsIx[a[i]];
if(typeof(tsI[a[i]])!='undefined')tid=a[i];
}
tinc=tinc.substr(2);
texc=texc.substr(2);
}
var _dp=getPrc(Id,null,1);
if(bsk.tax.showBoth)var _prcStr=bsk.tax.disp(tid,_prc,tf.shopCurrency,null,true,tinc,texc),_dpStr=bsk.tax.disp(tid,_dp,tf.shopCurrency,null,true,tinc,texc);
else var _dpStr=dPrc(_dp,1,false,true);
if (_prc-_dp>0.001) {
if(elOrig&&elOrig.parentNode!=elPrice)elOrig.innerHTML=dPrc(_prc,1,false,true);
else ret.push('<span class="ProductPriceOriginal" id="ProductPriceOriginal-'+Id+'">'+dPrc(_prc,1,false,true)+'</span> ');
if(elCalc&&elCalc.parentNode!=elPrice)elCalc.innerHTML=_dpStr;
else ret.push('<span class="GC21 ProductPriceCalculated" id="ProductPriceCalculated-'+Id+'">'+_dpStr+'</span>');
discShown=true;
}
else {
if(elPrice)elPrice.innerHTML=_prcStr;
}
if(!region){setTimeout('tf.utils.populatePrice()',1000);return ret;}
if(!bsk.tax.showBoth){
var a=pt.split(','); pt='';
if(tf.conf&&tsI.length==0)tf.conf.populateTSI();
for (var i=0,ii=a.length; i<ii; i++)if (tsI[a[i]]) pt+=','+tsI[a[i]];
if (pt!='') {
var elTaxText=gl('ProductIncTaxes-'+Id);
if(elTaxText&&elTaxText.parentNode!=elPrice)elTaxText.innerHTML='('+pt.substr(1)+')';
else {
if(!discShown)ret.push(_prcStr);
ret.push(' <span class="ProductIncTaxes" id="ProductIncTaxes-'+Id+'">('+pt.substr(1)+')</span>');
}
}
}
if(!tfc.isInSF())prodDiscMsg(Id);
return ret.join('');
}
function getPPrices(prid,txids){
var bsk=tf.core.Basket,arr={};
var _prc=tf.core.getPrc(prid),_dp=tf.core.getPrc(prid,null,1);
if (bsk.tax.showBoth) {
var a=txids.split(','),tinc='',texc='',tid=txids;
for (var i=0,ii=a.length; i<ii; i++){
if(tsI[a[i]])tinc+=', '+tsI[a[i]];
if(tsIx[a[i]])texc+=', '+tsIx[a[i]];
if(typeof(tsI[a[i]])!='undefined')tid=a[i];
}
tinc=tinc.substr(2);
texc=texc.substr(2);
if(_prc-_dp>0.001)
var exT=bsk.tax.exTax(txids,_dp),inT=exT+bsk.tax.allAmt(txids,_dp);
else
var exT=bsk.tax.exTax(txids,_prc),inT=exT+bsk.tax.allAmt(txids,_prc);
if(bsk.tax._tax.get(tid).incTax){
var p1t=tinc, p1a=tf.core.dPrc(inT,1,true);
var p2t=texc, p2a=tf.core.dPrc(exT,1,true);
}
else{
var p1t=tinc, p1a=tf.core.dPrc(exT,1,true);
var p2t=texc, p2a=tf.core.dPrc(inT,1,true);
}
arr['orig']=tf.core.dPrc(_prc,1,true);
arr['calc']=tf.core.dPrc(_dp,1,true);
arr['prc1_text']=p1t;
arr['prc1_amt']=p1a;
arr['prc2_text']=p2t;
arr['prc2_amt']=p2a;
}
else {
arr['orig']=tf.core.dPrc(_prc,1,true);
arr['calc']=tf.core.dPrc(_dp,1,true);
}
return arr;
}
function bprice(args) {
var b1=args[1],b2=args[2],b3=args[3];
if(b1&&isNaN(b1)||parseFloat(b1)<0.001) return '';
return ld('LD_BASEPRICE','Basisprijs')+': <nobr>'+ld('LD_BASEPRICE_RESULT','%% %% = %%',new Array(nfmt.toLoc(b2),b3,dPrc(b1,1)))+'</nobr>';
}
function crFFld(args){
var t=args[0],n=args[1],id=args[2],r=args[3],c=args[4],oA=args[5],dv=args[6],on=args[7],pid=args[8],maxlen=args[9],right=args[10],combine=args[11],choicesonly=args[12];
tfc=tf.content;
var first=true,ponB='<div class="ProductOptionName">',ponE='</div>',pcnB='<div class="ProductChoiceName">',pcnE='</div>';
if(choicesonly)pcnB='<div id="ProductChoiceName-%%" class="ProductChoiceName">';
function _v(v,a,o){return (v?' value="'+[a[1].replace(/\"/g,'&quot;'),getOPrc(a[0],id,o),a[4],a[5],a[6],a[7],a[8],a[2]].join(str_sep1)+'"':'');}
function _p(v,a,o,both){var op=getOPrc(v,a,o);if(op>0.001)var pf='LD_OPTION_PRICE_ADD';else if(op<-0.001)var pf='LD_OPTION_PRICE_SUBTRACT';else return'';return ' '+ld(pf,'',[core.showPrc(Math.abs(op),1)]);}
function _ip(n,t,cl,v,a,on,dv) {
var s='';
var len=(a)?a.length:0;
for (var i=0;i<len;i++) {
var val=(t=='text')?' value="'+a[i][1].replace(/"/g,'&quot;')+'"':_v(v,a[i],i);
var ch=(dv=='1')?' checked':'';ch=(((dv)?dv:'0')=='1'&&first)?' checked':'';
if (ch&&t=='radio') first=false;
var onclick='';
if(t=='radio')onclick+='dBasePrice2(\''+pid+'\',this.value);';
var btn='<input onclick="cancelBuble();'+onclick+'" type='+t+val+' name="'+n.replace(/"/g,'&quot;')+'" size="'+c+'" maxlength="'+maxlen+'" '+(t=='text'?'':'class=GC8')+' '+cl+ch+'>\n';
s+=pcnB.replace(/\%\%/,a[i][2]);
if(!right&&t!='text'){s+=btn;}
var dp=(t=='radio'||(t=='checkbox'))?_p(a[i][0],id,i,true):'';
if (t=='radio') s+='<span>'+a[i][1]+dp+'</span>';else if(t!='text')s+='<span>'+on+dp+'</span>';
if (t=='text') s+=pcnE;
if(right||t=='text'){s+=btn;}
if (t!='text') s+=pcnE;
if(t=='radio'&&ch&&core)setTimeout("tfc.dBasePrice2('"+pid+"','"+(['','','','',a[i][6],a[i][7],a[i][8]].join(str_sep1))+"',tfc)",500);
}
return s;
}
function _sl(n,r,a,dv,on){
var s='';
s+='<select onclick="cancelBuble()" name="'+n.replace(/"/g,'&quot;')+'"';
s+=' onChange="dBasePrice2(\''+pid+'\',this.value);'+'"';
s+=' size='+r+'>\n';
s+='<option value="">'+on+'</option>';
for (var i=0; i<a.length; i++) {
var checked='';
if (i==0&&dv!='0') {
checked=' selected';
if(core)setTimeout("tfc.dBasePrice2('"+pid+"','"+(['','','','',a[i][6],a[i][7],a[i][8]].join(str_sep1))+"',tfc)",500);
}
s+='<option '+_v(1,a[i],i)+checked+'>'+a[i][1]+_p(a[i][0],id,i,false)+'</option>\n';
}
return s+'</select><br>';
}
var rc=(c=='')?'':' cols="'+c+'"';
rc+=(r=='')?'':' rows="'+r+'"';
var s='',ponBE=(choicesonly?'':ponB+on+ponE);
switch(t) {
case 1:s=ponBE+_ip(n,'text','TextInput',0,oA,on);break;
case 5:s=ponBE+_ip(n,'radio','RadioButtonIcon',1,oA,on,dv);break;
case 6:s=_ip(n,'checkbox','CheckBoxIcon',1,oA,on,dv);break;
case 3:rc='';
case 4:s=_sl(n,r,oA,dv,on);break;
case 2:s=ponBE+'<textarea onclick="cancelBuble()" onChange="this.value=this.value.substring(0,'+maxlen+');if(this.value.length>='+maxlen+'){alert(ld(\'LD_MAXLENGTH\',\'\',['+maxlen+']));}" onKeyUp="if(this.value.length>='+maxlen+'){this.blur();}" name="'+n.replace(/"/g,'&quot;')+'" '+rc+'>'+oA[0][1]+'</textarea>';break;
}
return s;
}
function load_add(d,type,id,title,weight,orderNo,useDec,esd,taxes,prd_cd,man_cd,dst_cd,prc_cd,opt,issf,s,minorder,temp) {
var ret=false;
if (!isNaN(prd_cd)) prd_cd+='%%P';
var qnty;
qnty=tf.content.document.getElementById(id+'_Quantity');
if (!minorder) minorder=(useDec>0)?'1.00':'1';
if (useDec<1) minorder=parseInt(minorder);
var qv='';
if(qnty){
qv=nfmt.fromLoc(qnty.value);
if(isNaN(qv))qnty.value=(useDec?nfmt.toLoc("1.00"):"1");
else{
if((useDec>0&&parseFloat(qv)<0.0001)||(useDec<1&&parseInt(qv)<1))qnty.value=nfmt.toLoc(minorder);
else qnty.value=nfmt.toLoc(qv);
}
}
qnty=qnty?parseFloat(nfmt.fromLoc(qnty.value)):0;
if (isNaN(qnty) || !qnty) qnty=1;
if (tf.coreLoaded&&!issf) {
var bt;bt=core.Basket;
if (type==1){bt=core.Favorite;bt.save();}
ret=bt.parse(id,d,qnty,title,weight,orderNo,useDec,esd,taxes,opt,prd_cd,man_cd,dst_cd,prc_cd,null,false,temp);
} else if (confirm(ld('LD_ENTER_SHOP','Om dit product te kopen moet u eerst de shop binnengaan. Wilt u nu naar de shop gaan?'))) {
location = s+'#'+id.toLowerCase();
}
return ret;
}
var nfmt=new numeric(',','');
var css=new CSS();
tf.core=this.window;
/*$Revision: 5648 $
$HeadURL: svn://3d3-p432/ShopFactory/branches/V8_20/bin/Common Files/parseLang/sf.js $*/
