// <script>
document.write('');
var gmtTime=0, topFrame=coreFrame=this;

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;

function getCookStr(name) {
	var allCookies=document.cookie;
	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 winMgr(){
	this.init=wmInit;this.reg=wmReg;this.rld=wmRld;this.get=wmGet;this._fr=wmFr;
	this.url=wmUrl;this.path=wmPath;this.file=wmFile;this.jfile=wmJFile;this.pProp=wmPProp;
	this.add2Q=wmAdd2Q;
	this.init();
}
function wmInit(){this._a=new Array();this.host=this.path(location);this._rnd=Math.random();
var h=location.pathname;if(h.indexOf('contents')!=-1) h=h.substr(0,h.indexOf('contents'));var i=h.indexOf('index.html');this.baseurl=(i<0)?h+'contents/':h.substr(0,i)+'contents/';
this.online=(location.protocol.indexOf('file:')==-1);
}
function wmFr(a,d,r){
	var f=d?d.frames:frames;for (var i=0;i<f.length;i++){
	var n=f[i].name;if(n.indexOf('-')!=-1)continue;
	if (!a[n])a[n]=eval(r+n);this._fr(a,a[n],r+n+'.')}
}
function wmPath(p){
	p=p.toString();
	var i=p.indexOf('?');if(i!=-1)p=p.substring(0,i);
	return (p.charAt(p.length-1)=='/')?p:p.substring(0,p.lastIndexOf('/')+1);
}
function wmFile(f){
	var rf=(this.host)?f.substring(this.host.length,f.length):'';
	return rf?rf:f;
}
function wmJFile(f){
	var m=Math.max(f.lastIndexOf('/'),f.lastIndexOf('\\'));
	return (m>-1)?f.substring(m+1):f;
}
function wmGet(n){
	return window;
}
function wmReg(n,w){
	n=n.toString();var f=n.lastIndexOf('/')+1;var t=n.indexOf('.',f);
	t=(t!=-1)?t:n.length;var n=n.substring(f,t);this._a[n]=w;return this;
}
function wmRld(n,u,p,h){
	var w=this.get(n);if(w==null)return;
	if(u==null)w.location.reload();else w.location=this.url(u,p,h);return;
}
function wmUrl(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=topFrame.lang+'/'+f;
	return (a=='-')?this.baseurl+f:this.add2Q(this.baseurl+f,'lmd',a);
}
function wmAdd2Q(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('&?','?');
}
function wmPProp(id,prop){
	if(this._pArr==null)this._pArr=new Array();if(prop!=null)this._pArr[id]=prop;
	return this._pArr[id];
}
var wm=new winMgr();wm.reg('top',this);

var pg = new Array();
var dl = 'dynamic.html';

pg['D1']='d1.html';
pg['D2']='d2.html';
pg['D3']='d3.html';
pg['D6']='d6.html';
pg['D30']='d30.html';
pg['D32']='d32.html';
pg['D38']='d38.html';
pg['D39']='d39.html';
pg['D36']='d36.html';
pg['D41']='d41.html';
pg['D44']='d44.html';
pg['D35']='d35.html';
pg['D37']='d37.html';
pg['D40']='d40.html';
pg['D34']='d34.html';
pg['D42']='d42.html';
pg['D4']='d4.html';
pg['D16']='d16.html';
pg['D5']='d5.html';
pg['D17']='d17.html';
pg['D18']='d18.html';
pg['D19']='d19.html';
pg['D20']='d20.html';
pg['D21']='d21.html';
pg['D23']='d23.html';
pg['D24']='d24.html';
pg['D25']='d25.html';
pg['D26']='d26.html';
pg['D45']='d45.html';
pg['D12']='d12.html';
pg['D13']='d13.html';
pg['D9']='d9.html';
pg['D10']='d10.html';
pg['D43']='d43.html';
pg['D48']='d48.html';
pg['D46']='d46.html';
pg['D47']='d47.html';
pg['D51']='d51.html';
pg['D52']='d52.html';
pg['D53']='d53.html';
pg['D54']='d54.html';
pg['D55']='d55.html';
pg['D56']='d56.html';
pg['D57']='d57.html';
pg['D58']='d58.html';
pg['D59']='d59.html';
pg['D60']='d60.html';
pg['D61']='d61.html';
pg['D62']='d62.html';
pg['D63']='d63.html';
pg['D64']='d64.html';
pg['D65']='d65.html';
pg['D66']='d66.html';
pg['D69']='d69.html';
pg['D70']='d70.html';
pg['D71']='d71.html';
pg['D72']='d72.html';
pg['D73']='d73.html';
pg['D74']='d74.html';
pg['D75']='d75.html';
pg['D76']='d76.html';
pg['D77']='d77.html';
pg['D78']='d78.html';
pg['D79']='d79.html';
pg['D80']='d80.html';
pg['D81']='d81.html';
pg['D82']='d82.html';
pg['D83']='d83.html';
pg['D84']='d84.html';
pg['D85']='d85.html';
pg['D86']='d86.html';
pg['D87']='d87.html';
pg['D88']='d88.html';
pg['D89']='d89.html';
pg['D90']='d90.html';
pg['D91']='d91.html';
pg['D92']='d92.html';
pg['D93']='d93.html';
pg['D94']='d94.html';
pg['D95']='d95.html';
pg['D96']='d96.html';
pg['D97']='d97.html';
pg['D98']='d98.html';
pg['D99']='d99.html';
pg['D100']='d100.html';
pg['D101']='d101.html';
pg['D102']='d102.html';
pg['D103']='d103.html';
pg['D104']='d104.html';
pg['D105']='d105.html';
pg['D106']='d106.html';
pg['D107']='d107.html';
pg['D108']='d108.html';
pg['D109']='d109.html';
pg['D110']='d110.html';
pg['D111']='d111.html';
pg['D112']='d112.html';
pg['D113']='d113.html';
pg['D114']='d114.html';
pg['D115']='d115.html';
pg['D116']='d116.html';
pg['D117']='d117.html';
pg['D118']='d118.html';
pg['D119']='d119.html';
pg['D120']='d120.html';
pg['D121']='d121.html';
pg['D122']='d122.html';
pg['D123']='d123.html';
pg['D124']='d124.html';
pg['D125']='d125.html';
pg['D126']='d126.html';
pg['D127']='d127.html';
pg['D129']='d129.html';
pg['D130']='d130.html';
pg['D131']='d131.html';
pg['D132']='d132.html';
pg['D133']='d133.html';
pg['D134']='d134.html';
pg['D135']='d135.html';
pg['D136']='d136.html';
pg['D137']='d137.html';
pg['D138']='d138.html';
pg['D139']='d139.html';
pg['D140']='d140.html';
pg['D141']='d141.html';
pg['D142']='d142.html';
pg['D143']='d143.html';
pg['D144']='d144.html';
pg['D145']='d145.html';
pg['D146']='d146.html';
pg['D147']='d147.html';
pg['D148']='d148.html';
pg['D149']='d149.html';
pg['D150']='d150.html';
pg['D151']='d151.html';
pg['D152']='d152.html';
pg['D153']='d153.html';
pg['D154']='d154.html';
pg['D155']='d155.html';
pg['D156']='d156.html';
pg['D157']='d157.html';
pg['D158']='d158.html';
pg['D159']='d159.html';
pg['D160']='d160.html';
pg['D161']='d161.html';
pg['D162']='d162.html';
pg['D163']='d163.html';
pg['D164']='d164.html';
pg['D165']='d165.html';
pg['D166']='d166.html';
pg['D167']='d167.html';
pg['D168']='d168.html';
pg['D169']='d169.html';
pg['D170']='d170.html';
pg['D171']='d171.html';
pg['D172']='d172.html';
pg['D173']='d173.html';
pg['D174']='d174.html';
pg['D175']='d175.html';
pg['D176']='d176.html';
pg['D177']='d177.html';
pg['D178']='d178.html';
pg['D179']='d179.html';
pg['D180']='d180.html';
pg['D181']='d181.html';
pg['D182']='d182.html';
pg['D183']='d183.html';
pg['D184']='d184.html';
pg['D185']='d185.html';
pg['D186']='d186.html';
pg['D187']='d187.html';
pg['D188']='d188.html';
pg['D189']='d189.html';
pg['D190']='d190.html';
pg['D191']='d191.html';
pg['D192']='d192.html';
pg['D193']='d193.html';
pg['D194']='d194.html';
pg['D195']='d195.html';
pg['D196']='d196.html';
pg['D197']='d197.html';




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('de');
 }

 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 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.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=2;
	this.dec = (!dp||isNaN(dp))?0.01: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=split(val,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=split(val,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;
	if (roff) return Math.round(val/roff)*roff;
	if(!dp)return val;
	ret=Math.round(val/dp)*dp;
	var pow=Math.pow(10, this.dec_num);
	return Math.round(ret*pow)/pow;
}

function numDisplay(val, dp, curSym)
{
	if (!dp) dp = this.dec;
	val = this.round(val).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 dynObj(gid)
{
	this.gid = gid;
	this._arr = new Array();
	this._idtags = new Array();
	this._cnt = 0;

	this.cnt = dOCnt;
	this.idx = dOIdx;
	this.add = dOAdd;
	this.del = dODel;
	this.get = dOGet;
	this.getById = dOGetById;
	this.empty = dOEmpty;
	this.start = dOStart;
	this.next  = dONext;
	this.replace = dOReplace;
	this.eAdd  = dOEAdd;
}

function dOCnt()
{
	return this._cnt;
}

function dOIdx(idtag)
{
	for (var i=0; i<this._cnt; i++) if (this._arr[i].idtag == idtag) return i;
	return -1;
}

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._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 '';
	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._arr[this._cnt-1] = null;
	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)) return this.get(this.idx('_'+idx));
	if (idx<0 || idx>=this.cnt()) return '';
	return this._arr[idx];
}

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    = eval('new '+this.gid+'()');
	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 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.idx=0;
this.start=itStart;
this.next=itNext;
}

function itStart() {
this._idx = 0;
return this.obj._arr[0];
}

function itNext()
{return this.obj._arr[++this._idx];}



function timeMgr(offset)
{
	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));
}

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();
	for (var i=0; i<=rep; i++) {
		var period = i*freq*86400;
		if (fr+period <= now && now <= to+period) return 1;
	}
	return 0;
}




function range()
{
	this.init = rgInit;
	this.getData = rgGetData;
	return this;
}

function rgInit(min,max,data)
{
	if (max == null) {
		var arr = split(min, ',');
		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 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 (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); break;
		case '1': case '10': p=prc2*(parseFloat(this.value)/100);break;
		case '5': perc=this.getData(qnty);p=(isNaN(perc))?0:(prc2-perc);break;
//		case '6': if (lvl==null) break; if (lvl==1) qnty=prc;
		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')return p;else return 0;}

	return p;
}


function discPurchasePrice(prc) {
  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 perc=this.getData(discPrice);
  var p=(isNaN(perc))?0:(prc)*(perc/100);
  if (p>=prc) return 0;
  return p;
}


function discFree(qnty)
{
	switch(this.type) {

		case '2': return parseInt(qnty/this.rg.get(0).max)*this.getData(qnty);break;
		case '3': var rg=this.getData(qnty,null,1);return (rg)?new Array((qnty>rg.max)?parseInt(qnty/rg.max):1,rg.data):'';


		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);
}

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('/')
		return arr;
	}

	var ret = 1;
	for (var i=0; i<arr.length; i++) {
		var sr = h2a(arr[i]);
		var prop=sr[0].split('~');
		if (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[tmp[0]]=tmp;
		}
		prop['sig'] = sr[sr.length-1];
		prop['opt'] = op;
		if (!isNaN(prop[9])) prop[9]+='%%P';


		wm.pProp(prop[0], prop);
	}
	return ret;
}

var sh_dobj;
if (this.discount) {
	sh_dobj = new discount();
	gd_obj = new discount();
	sh_dobj.init('1','0.000','');
}

function getDscAmt(id, prc)
{
var p=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(p[1]-amt, p[1]-amt, 0, 1);
}
if ((getCookStr('ResellerID')!='')) {
var Basket=parent.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=wm.pProp(id);
	if (p==null) return '';
	var prc = p[1];
	if (sid) prc = p['opt'][sid];
	if (!dsc||sid) return prc;

	return prc-getDscAmt(id, prc);
}

function getOPrc(id, sid, od)
{
	
	if (id.indexOf('O')>-1) id=id.substr(0,id.indexOf('O'));
	var op=getPrc(id,sid);
	return (op==null)?0:op[od+1];
}

function dPrc(prc, ifscurr,dispZero)
{
	var scurr='';
	if (!ifscurr&&topFrame.secondCurrency) scurr=' ('+getSCurr(prc)+')';
	return (prc==''&&!dispZero)?'':nfmt.display(prc*topFrame.currentCurrency.multiplier/topFrame.shopCurrency.multiplier, topFrame.currentCurrency.decimal_places,topFrame.currentCurrency.abbrev)+scurr;
}

function getSCurr(prc){
var scCurr=topFrame.secondCurrency;
return (scCurr)?nfmt.display(prc*scCurr.multiplier/topFrame.shopCurrency.multiplier,scCurr.decimal_places,scCurr.abbrev):'';
}


function CSS(doc)
{
	this.get  = cssGet;
	this.init = cssInit;
	this.init(doc);
}

function cssInit(doc)
{
	var hs = new Array();

	function docSS(arr,doc) {
		if (ds = doc.styleSheets)
		for(var i=0; i<ds.length; i++) {
			hs[ds[i].href] = 1;
			for(var j=0, rl=ds[i].rules; rl&&j<rl.length; j++) {
				var tag=rl[j].selectorText.toLowerCase();

				if (ds[i].href.indexOf('styles/D')!=-1)
					arr[tag] = rl[j].style.cssText;
			}
		}
		return ds;
	}
	function defSS(arr,doc) {}

	if (!doc) doc=document;
	this._css = new Array();
	if (!docSS(this._css, doc)) defSS(this._css,doc);

	this.themes = '';for (i in hs) this.themes += i+',';
}

function cssGet(name,type)
{
	switch(type){
		case 1: name='.'+name;break;
	}
	return this._css[name];
}






var sfImgPopWnd=null,aImgPopTmp=null;
function sfImgPop(a,lmd,prid,css){
	if(document.getElementsByTagName('head')[0].profile!='SFV6 Pageview'){
		if(a[prid]){
			if(!css){css='../styles/pa_front_default.css';}
			var url="image_viewer.html";
			if(wm){css=wm.url(css,lmd);url=wm.url(url,lmd,1);}
			aImgPopTmp=[css,'mw=800','mh=600'];aImgPopTmp=aImgPopTmp.concat(a[prid]);
			if(!sfImgPopWnd||(sfImgPopWnd&&sfImgPopWnd.closed)){
				sfImgPopWnd=window.open(url,"sfImgPop","location=no,menubar=no,toolbar=no,directories=no,width=100,height=100");
			}
			else{sfImgPopWnd.focus();sfImgPopWnd.start(aImgPopTmp);}
		}
	}
}


function sfMM(a){
	//id,lmd,t,src,w,h,mw,mh,alt
	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];
	src=(wm?wm.url(src,lmd):src);
	var dim=' width="'+(w>0?w:mw)+'" height="'+(h>0?h:mh);
	var s='';
	if(src.lastIndexOf(t)!=src.length-3){
		//display the source as an image if it doesn't match the type
		s=sfImg([id,w,h,w,h,src,"0",alt,"0","0","",""]);
	}
	else{
		switch(t){
		case 'swf':
			s+='<object classid="CLSID:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://active.macromedia.com/flash6/cabs/swflash.cab#version=4,0,0,0" '+dim+' title="'+alt+'">';
			s+='	<param name="movie" value="'+unescape(src)+'">';
			s+='	<param name="quality" value="high"><PARAM NAME="WMode" VALUE="Transparent">';
			s+='	<embed src="'+src+'" quality="high" '+dim+' title="'+alt+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>';
			s+='</object>';
			break;
		case 'class':
			s+='<applet code="'+src+'" '+dim+' title="'+alt+'"></applet>';
			break;
		default:
			s+='<img src="../media/trans.gif" width="'+mw+'" height="1">';
		}
	}
	return s;
}


var tsI=new Array();

function pprice(args) {
	var ret=''; var Id=args[0],Price=args[1],pt=args[2],b1=args[3],b2=args[4],b3=args[5];
	
	

	var _prc=getPrc(Id,null);
	
	var _dp=getPrc(Id,null,1);
	if (_prc-_dp>0.001) {
		ret+='<span sf:object="GC8 ProductPriceOriginal" class="ProductPriceOriginal" id="ProductPrice-'+Id+'">'+dPrc(_prc,1)+'</span> ';
		ret+='<span sf:object="ProductPriceCalculated" class="ProductPriceCalculated" id="ProductDiscount-'+Id+'">'+dPrc(_dp,1,true)+'</span>';
	} else ret+=dPrc(_prc,1);
	var a=pt.split(','); pt='';
	if(wm.get('conf'))wm.get('conf').populateTSI();
	for (var i=0; i<a.length; i++)	if (tsI[a[i]]) pt+=','+tsI[a[i]];
	if (pt!='') ret+=' <span class="ProductIncTaxes" sf:object="ProductIncTaxes">('+pt.substr(1)+')</span>';
	return ret;
}

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','')+': <nobr>'+ld('LD_BASEPRICE_RESULT','',new Array(nfmt.toLoc(b2),b3,dPrc(b1,1)))+'</nobr>';
}

var contentFrame;
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];
	
	contentFrame=wm.get('content');
	var bdiv='<div class="ProductOptionName">';
	var ediv='</div>', first=true;
	function _v(v,a,o) {return (!v)?'':' value="'+a[1].replace(/"/g,'&quot;')+str_sep1+getOPrc(a[0],id,o)+str_sep1+a[4]+str_sep1+a[5]+str_sep1+a[6]+str_sep1+a[7]+str_sep1+a[8]+'"'}
	function _p(v,a,o) {var op=getOPrc(v,a,o); if (op>0.001) var pf='+'; else if (op<-0.001) var pf='-'; else return ''; return ' ('+pf+coreFrame.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);
			s+=bdiv;
			var dp=(t=='radio'||(t=='checkbox'))?_p(a[i][0],id,i):'';
			if (t=='radio') s+='<nobr>'+a[i][1]+dp+'</nobr>'; else s+='<nobr>'+on+dp+'</nobr>';
			if (t=='text') s+=ediv;
			var ch=(dv=='1')?' checked':'';
			var ch=(((dv)?dv:'0')=='1'&&first)?' checked':'';
			if (ch&&t=='radio') first=false;
			s+='<input onclick="cancelBuble()" type='+t+val+' name="'+n.replace(/"/g,'&quot;')+'" size="'+c+'" maxlength="'+maxlen+'" class=GC8 '+cl+ch+'>\n';
			if (t!='text') s+=ediv;
		}
		return s;
	}
	function _sl(n,r,a,dv,on){
		var s='';
		s+='<select onclick="cancelBuble()" name="'+n.replace(/"/g,'&quot;')+'"';
		
		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';
				
			}
			s+='<option '+_v(1,a[i],i)+checked+'>'+a[i][1]+_p(a[i][0],id,i)+'</option>\n';
		}
		return s+'</select><br>';
	}

	var rc=(c=='')?'':' cols="'+c+'"';
	rc+=(r=='')?'':' rows="'+r+'"';
	var s='';
	switch(t) {
		case 1: s=_ip(n,'text','TextInput',0,oA,on); break;
		case 5: s=bdiv+on+ediv+_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=bdiv+on+ediv+'<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) {
	if (!isNaN(prd_cd)) prd_cd+='%%P';
	var qnty;
	qnty=eval('d.productForm.'+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 (topFrame && coreFrame && topFrame.coreLoaded&&!issf) {
		var bt;bt=coreFrame.Basket;
		
		bt.parse(id,d,qnty,title,weight,orderNo,useDec,esd,taxes,opt,prd_cd,man_cd,dst_cd,prc_cd,null,false);
	} else if (confirm(ld('LD_ENTER_SHOP','Bevor Sie dieses Produkt kaufen können, müssen Sie das Geschäft aufrufen. Wollen Sie das Geschäft aufrufen?'))) {
		d.location = s+'&product='+id;
	}
}


var nfmt = new numeric(',','');

var str_sep1='~|`';

var topFrame=wm.get("top");
if (topFrame==null) topFrame=parent.topFrame;
if (topFrame==null) topFrame=parent.parent;
var LD=topFrame;
if(topFrame.location!=document.location){
	var xf=topFrame.extra;
	if(xf){
		var cnt=xf.frames.length,n=0
		while(n<cnt){if(xf.frames[n].name=='core'){topFrame.coreFrame=xf.frames[n];break;}n++;}
	}else{
		topFrame.coreFrame=topFrame.core;
	}
}

if(typeof(SymRealWinOpen)!='undefined')window.open=SymRealWinOpen;
if(window.NS_ActualOpen){window.open=NS_ActualOpen;}

var shopName = '', shopRegion='HK';


var ordStage;
var region = '',regionChanged=false;
var method = '';

var flag   = 'on';



function ld(name,sf,args) {var s;if(LD)s=eval('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 document.getElementById(s);}


var active_servers=new Array(),gmtTime=0,active_servers_scripts='';
if(!window.sf){
var servers='http://timecheck.shopfactory.com/ping/ping.js'.split(',');
for (var i in servers) {
var fake_country=(topFrame.params&&topFrame.params['fake_country'])?'?c='+topFrame.params['fake_country']+'&':'?';
var ss='<script src="'+servers[i]+fake_country+'t='+topFrame.testShop+'&u='+escape(location.protocol+'//'+location.hostname+wm.baseurl)+'&lmd='+(topFrame.lmd?topFrame.lmd['index']:'')+'"><'+'/script>';
d.write(ss);active_servers_scripts+=ss;
}

}




var pg = new Array(),dl = 'dynamic.html',lang=this.wm?wm.get('top').lang:'de', coreFrame=this;

pg['D-33']='toc.html';
pg['D-34']='button.html';
pg['D-2']='front.html';
pg['D-3']='about.html';
pg['D-4']='privacy.html';
pg['D-5']='terms.html';
pg['D-6']='basket.html';
pg['D-7']='customerdtl.html';
pg['D-8']='thankyou.html';
pg['D-9']='contactus.html';
pg['D-10']='favorites.html';
pg['D1']='d1.html';
pg['D2']='d2.html';
pg['D3']='d3.html';
pg['D6']='d6.html';
pg['D30']='d30.html';
pg['D32']='d32.html';
pg['D38']='d38.html';
pg['D39']='d39.html';
pg['D36']='d36.html';
pg['D41']='d41.html';
pg['D44']='d44.html';
pg['D35']='d35.html';
pg['D37']='d37.html';
pg['D40']='d40.html';
pg['D34']='d34.html';
pg['D42']='d42.html';
pg['D4']='d4.html';
pg['D16']='d16.html';
pg['D5']='d5.html';
pg['D17']='d17.html';
pg['D18']='d18.html';
pg['D19']='d19.html';
pg['D20']='d20.html';
pg['D21']='d21.html';
pg['D23']='d23.html';
pg['D24']='d24.html';
pg['D25']='d25.html';
pg['D26']='d26.html';
pg['D45']='d45.html';
pg['D12']='d12.html';
pg['D13']='d13.html';
pg['D9']='d9.html';
pg['D10']='d10.html';
pg['D43']='d43.html';
pg['D48']='d48.html';
pg['D46']='d46.html';
pg['D47']='d47.html';
pg['D51']='d51.html';
pg['D52']='d52.html';
pg['D53']='d53.html';
pg['D54']='d54.html';
pg['D55']='d55.html';
pg['D56']='d56.html';
pg['D57']='d57.html';
pg['D58']='d58.html';
pg['D59']='d59.html';
pg['D60']='d60.html';
pg['D61']='d61.html';
pg['D62']='d62.html';
pg['D63']='d63.html';
pg['D64']='d64.html';
pg['D65']='d65.html';
pg['D66']='d66.html';
pg['D69']='d69.html';
pg['D70']='d70.html';
pg['D71']='d71.html';
pg['D72']='d72.html';
pg['D73']='d73.html';
pg['D74']='d74.html';
pg['D75']='d75.html';
pg['D76']='d76.html';
pg['D77']='d77.html';
pg['D78']='d78.html';
pg['D79']='d79.html';
pg['D80']='d80.html';
pg['D81']='d81.html';
pg['D82']='d82.html';
pg['D83']='d83.html';
pg['D84']='d84.html';
pg['D85']='d85.html';
pg['D86']='d86.html';
pg['D87']='d87.html';
pg['D88']='d88.html';
pg['D89']='d89.html';
pg['D90']='d90.html';
pg['D91']='d91.html';
pg['D92']='d92.html';
pg['D93']='d93.html';
pg['D94']='d94.html';
pg['D95']='d95.html';
pg['D96']='d96.html';
pg['D97']='d97.html';
pg['D98']='d98.html';
pg['D99']='d99.html';
pg['D100']='d100.html';
pg['D101']='d101.html';
pg['D102']='d102.html';
pg['D103']='d103.html';
pg['D104']='d104.html';
pg['D105']='d105.html';
pg['D106']='d106.html';
pg['D107']='d107.html';
pg['D108']='d108.html';
pg['D109']='d109.html';
pg['D110']='d110.html';
pg['D111']='d111.html';
pg['D112']='d112.html';
pg['D113']='d113.html';
pg['D114']='d114.html';
pg['D115']='d115.html';
pg['D116']='d116.html';
pg['D117']='d117.html';
pg['D118']='d118.html';
pg['D119']='d119.html';
pg['D120']='d120.html';
pg['D121']='d121.html';
pg['D122']='d122.html';
pg['D123']='d123.html';
pg['D124']='d124.html';
pg['D125']='d125.html';
pg['D126']='d126.html';
pg['D127']='d127.html';
pg['D129']='d129.html';
pg['D130']='d130.html';
pg['D131']='d131.html';
pg['D132']='d132.html';
pg['D133']='d133.html';
pg['D134']='d134.html';
pg['D135']='d135.html';
pg['D136']='d136.html';
pg['D137']='d137.html';
pg['D138']='d138.html';
pg['D139']='d139.html';
pg['D140']='d140.html';
pg['D141']='d141.html';
pg['D142']='d142.html';
pg['D143']='d143.html';
pg['D144']='d144.html';
pg['D145']='d145.html';
pg['D146']='d146.html';
pg['D147']='d147.html';
pg['D148']='d148.html';
pg['D149']='d149.html';
pg['D150']='d150.html';
pg['D151']='d151.html';
pg['D152']='d152.html';
pg['D153']='d153.html';
pg['D154']='d154.html';
pg['D155']='d155.html';
pg['D156']='d156.html';
pg['D157']='d157.html';
pg['D158']='d158.html';
pg['D159']='d159.html';
pg['D160']='d160.html';
pg['D161']='d161.html';
pg['D162']='d162.html';
pg['D163']='d163.html';
pg['D164']='d164.html';
pg['D165']='d165.html';
pg['D166']='d166.html';
pg['D167']='d167.html';
pg['D168']='d168.html';
pg['D169']='d169.html';
pg['D170']='d170.html';
pg['D171']='d171.html';
pg['D172']='d172.html';
pg['D173']='d173.html';
pg['D174']='d174.html';
pg['D175']='d175.html';
pg['D176']='d176.html';
pg['D177']='d177.html';
pg['D178']='d178.html';
pg['D179']='d179.html';
pg['D180']='d180.html';
pg['D181']='d181.html';
pg['D182']='d182.html';
pg['D183']='d183.html';
pg['D184']='d184.html';
pg['D185']='d185.html';
pg['D186']='d186.html';
pg['D187']='d187.html';
pg['D188']='d188.html';
pg['D189']='d189.html';
pg['D190']='d190.html';
pg['D191']='d191.html';
pg['D192']='d192.html';
pg['D193']='d193.html';
pg['D194']='d194.html';
pg['D195']='d195.html';
pg['D196']='d196.html';
pg['D197']='d197.html';


var pm=[],prMap=[], splitNum=200;
var pm_str='D-33,;D-34,;D-2,P2432,P2407,P2429,P2430,P2426,P2431,P2409,P2408,P2401,P2414,P769,P2404,;D-3,;D-4,;D-5,;D-6,;D-7,;D-8,;D-9,;D-10,;D1,;D2,;D3,P2407,P2429,P2430,P2409,P2401,P2408,P2404,P2402,;D6,;D30,P332,P389,P388,P325,P323,P324,P326,P327,P328,P329,P330,P364,P365,P331,P366,P334,P338,P339,P340,P341,P342,P343,P345,P346,P348,P333,P335,P336,P337,P367,P344,P347,P349,P350,P351,P352,P353,P354,P355,;D32,P2330,;D38,P383,P386,P960,P728,P576,P729,P318,P319,P320,P321,P322,P359,P723,P579,P736,P298,P297,P294,P724,P546,P879,P372,P817,P374,P726,P357,P583,P584,P574,P887,P886,P487,P911,P686,P120,P725,P452,P380,P387,P385,P483,P481,P632,P575,P382,P715,P486,P921,P923,P571,P815,P631,P553,P484,P358,P633,P874,P913,P714,P712,P730,P1714,P362,P489,P482,P532,P884,P885,P873,P813,;D39,P363,P360,P722,P922,P737,P738,P740,P1713,P741,P516,P485,P369,P530,P821,P883,P745,P925,P746,P747,P731,P748,P823,P368,P750,P580,P732,P739,P742,P822,P752,P751,P373,P753,P491,P492,;D36,P473,P503,P418,P419,P420,P421,P422,P423,P424,P425,P426,P427,P429,P430,P428,P432,P433,P434,P435,P963,P436,P910,P437,P439,P440,P441,P442,P444,P446,P447,P448,P572,P449,P450,P454,P635,P456,P457,P458,P460,P461,P462,P463,P464,P465,P2064,P466,P467,P468,P469,P872,P470,P471,P472,P474,P476,P477,P495,P497,P888,P882,P498,P500,P501,P919,P918,P502,P504,P417,P431,P438,P443,P455,P475,P478,P499,P506,P509,P505,P507,P508,P510,P711,;D41,P870,P494,P493,P816,P356,P716,P634,P371,P707,P148,P121,P709,P705,P717,P706,P378,P734,P820,P878,P552,P122,P628,P875,P531,P710,P889,P908,P909,P912,P920,;D44,P646,P654,P675,P677,P637,P638,P639,P640,P641,P689,P661,P642,P643,P688,P645,P665,P690,P684,P647,P683,P648,P666,P667,P668,P649,P650,P687,P911,P686,P698,P120,P669,P452,P380,P651,P652,P653,P680,P700,P699,P339,P670,P671,P694,P672,P681,P656,P693,P673,P695,P696,P674,P678,P348,P636,P662,P663,P664,P644,P679,P335,P655,P657,P658,P676,P702,P682,P685,P692,P701,P691,P659,P660,P924,P978,;D35,P415,P353,P351,P414,P413,P416,P410,P1681,P1682,P1676,P1674,P361,P1712,P391,P412,P411,P2330,P409,P916,P408,P881,P407,P404,P403,P961,P955,P402,P735,P401,P400,P399,P331,P398,P397,P396,P329,P395,P394,P393,P324,P323,P392,P718,P388,P389,;D37,P1507,P1549,P1624,P317,P316,P315,P313,P312,P310,P311,;D40,P523,P525,P585,P824,P527,P528,P529,P586,P512,P513,P514,P524,P496,P511,P488,;D34,P451,P445,P517,P573,P379,P384,P381,P459,P905,P962,P578,;D42,P536,P547,P535,P548,P549,P538,P550,P539,P551,P2014,P537,;D4,P1814,P1799,P1789,P988,;D16,P1185,P1118,P521,;D5,P1152,P1006,P1959,P1960,;D17,P1862,P1861,P1894,P1918,;D18,P140,P141,P142,P1187,P1188,P143,P147,P144,P146,;D19,P542,P772,P543,P541,;D20,P2219,P2123,P2124,P2125,P1388,P2045,P1787,P2037,;D21,P1115,P1205,P1206,P1117,;D23,P2361,P1804,P53,P1815,P1622,P1623,P253,P58,;D24,P58,P1947,P1949,P1950,;D25,P253,;D26,P229,P202,P230,P231,P232,P233,P234,P235,P60,P236,P237,P238,P239,P1805,P61,P240,P241,P242,;D45,P1464,P1915,P825,P119,P767,P768,P223,P224,P225,P226,P227,P222,P766,P765,P733,P1211,P1965,P771,P770,P1471,P1470,P1644,;D12,P610,P296,P614,P609,P608,P627,P591,P620,P611,P613,P626,P622,P623,P625,P624,P587,P588,P621,P616,P589,P590,P612,;D13,P600,P598,P615,P847,P599,P618,P605,P603,P593,P604,P970,P971,P973,P972,P606,P848,P850,P849,P597,P601,P602,P619,P295,P595,P594,P596,P607,;D9,P2352,P2134,P1925,P1030,;D10,P123,P124,P125,P286,;D43,;D48,P807,P802,P804,P800,P805,P801,P803,P906,P2410,P1016,P1124,P2012,P2013,P2011,P991,P2412,P1003,P926,P927,P827,P25,P810,P2411,P979,P2413,P1061,;D46,P1491,P773,P774,;D47,P2304,P2233,P2223,P2191,P2043,P2179,P1916,P1917,;D51,P534,P880,P877,P490,P868,P479,P453,P480,P871,P869,P829,P515,P915,;D52,;D53,P828,;D54,;D55,P2238,P2237,P2234,P2239,P2243,P2244,P2241,P2242,;D56,P853,P854,P855,P851,P852,;D57,P2107,P2108,P2088,P2106,P2104,P2101,P2102,P2098,P2099,;D58,P2365,P2366,P2364,P1218,P2375,P2376,P2377,P2378,;D59,;D60,;D61,P1028,P1027,P1006,P89,P1018,P1017,P1019,P1025,P867,P772,P1396,P1409,;D62,P2432,P2407,P2426,P2431,P2430,P2429,P2409,P2401,;D63,P1098,P1095,P1492,P1493,P2252,P1097,P1099,P1096,;D64,P1378,P1366,P1374,P1358,P1103,P1102,P1363,P1376,P1373,P1448,P1380,P1361,P1369,P1104,P1105,P1367,P1435,P1362,P1359,P1381,P1106,P1371,P1107,P1108,P1375,P1365,P1110,P1377,P1372,P1360,P1368,P1109,P1370,P1364,P1379,;D65,P1411,P1401,P1400,P1128,P1402,P1495,P1407,P1404,P1827,P1936,P1937,P1245,P1355,P1938,P1891,P1757,P1509,P1093,P1217,P1208,P1037,P1036,P1506,P1748,P1410,P1035,P1034,P933,P1396,P1475,P1409,P1508,P1383,P1357,P1356,P1494,;D66,P1089,P1086,P1127,P1352,P1138,P1721,P1092,P1147,P1350,P1056,P1972,P1111,P1515,P2008,P1351,P1574,P1091,P1469,P1213,P2279,P1692,P1153,P1349,P1720,P1082,P1353,P1500,P2049,P1462,P1875,P1084,P2050,P1146,P1694,P1088,P1502,P1501,P1689,P1080,P1087,P2130,P1830,P1690,P1753,P1743,P1686,P1739,P1120,P1081,P2009,P1119,P1685,P1007,P1057,P2048,P1517,P1650,P1876,P1585,P1573,P1688,P1684,P1687,P1085,P1505,P1742,P1055,P1058,P1083,P2029,P1516,P1957,P1054,P1691,P1463,P1090,P2026,P1693,P2375,P2376,P2377,P2378,P2379,;D69,;D70,P1851,P1917,P1916,P2181,P2179,P2087,P2119,P2233,P2266,P2283,P2180,P965,P987,P1053,P1051,P951,P797,P857,P1151,P1050,P1148,P1052,;D71,P1246,P1971,P1247,P947,P1736,P1832,P2120,P1131,P2047,P1737,P1769,P1249,P1716,P1771,P942,P1584,P1726,P1250,P1135,P1705,P2373,P1214,P1251,P1252,P1497,P1133,P945,P1253,P2245,P1254,P1255,P1256,P1258,P2030,P1581,P1257,P1790,P949,P1189,P1715,P1259,P2043,P1319,P1320,P1321,P1261,P1260,P1725,P1496,P1262,P1263,P2246,P2097,P1264,P1265,P950,P1718,P1774,P1248,P948,P1134,P1956,P1717,P1728,P1575,P1266,P944,P1394,P1267,P1582,P2247,P1393,P941,P2096,P1892,P1651,P1704,P946,P1020,P1268,P1727,P1504,P1503,P1852,P1269,P1033,P1652,P1215,P2025,P1270,P2304,P1271,P1272,;D72,P287,P4,P288,P1183,P26,P29,P1914,P1831,P25,P995,P990,P989,P2015,P994,P993,P992,P985,P988,P31,;D73,P18,P781,P10,P782,P1799,P11,P12,P13,P2278,P181,P864,P790,P788,P21,P23,P24,P1004,P779,P180,P183,P799,P1626,P1560,P179,P1625,P1749,P798,P35,P36,P1556,P1627,P1219,P182,P43,P48,;D74,P754,P1028,P83,P1027,P1858,P84,P1386,P1465,P1387,P1388,P1859,P1389,P1860,P1382,P1741,P1510,P1734,P1416,P1869,P89,P81,P82,P568,P769,P1787,P1018,P2125,P1017,P1019,P2124,P2220,P2218,P1025,P2123,P867,P78,P567,P93,;D75,P73,P74,P284,P2037,P1334,P1335,P1422,P1330,P1740,P77,P1756,P1755,P1745,P85,P2219,P1329,P1324,P86,P1332,P1327,P1336,P796,P87,P88,P90,P1328,P1333,P1326,P1325,P1419,P91,P285,P92,P1331,P1323,P96,;D76,P1006,;D77,P97,P98,P791,P1629,P99,P100,P1630,P1631,P1460,P101,P1459,P518,P2,P776,P775,P102,P522,P1005,P1632,P778,;D78,P1185,P1498,;D79,P103,P104,P1654,P106,P107,P783,P108,P521,P109,P789,P780,P110,P113,P115,P116,P117,P118,;D80,P1523,P1535,P1525,P1537,P1527,P1539,P1529,P1541,P1531,P1543,P1533,P1545,P976,P72,P1546,P1547,P1548,;D81,P1513,P1205,P303,P1648,P1649,P309,P1514,P984,P974,P1706,P520,P1115,P307,P1116,P977,P299,P1511,P1512,P306,P2309,P1206,P1117,P67,P914,P917,P308,P68,P787,P300,P1977,P1978,P968,P966,P1645,P69,P70,P1703,P1707,P975,P1913,P969,P1647,P1935,P304,P1646,P1979,P71,P794,P793,P302,P2033,P1708,P519,P301,P305,P795,;D82,P2398,P2310,P2276,P2290,P2296,P2301,P2281,P1619,;D83,P2287,P2302,P2358,P2295,P2322,P2315,P2314,P2294,;D84,P2331,P2333,P2325,P2328,P2334,P2336,P2335,P2332,;D85,P1304,P2284,P1071,P1311,P892,P1773,P1829,P1306,P1772,P1130,P1767,P1287,P1290,P1014,P894,P893,P1770,P1064,P1305,P1975,P1296,P1281,P1067,P1066,P1123,P1289,P1283,P1294,P1285,P1313,P1070,P1065,P1278,P1288,P901,P1577,P895,P1302,P1314,P1299,P1291,P896,P1308,P2178,P1074,P1076,P897,P1280,P1068,P2010,P1078,P1079,P1063,P1766,P1279,P1048,P1282,P898,P2249,P2248,P2250,P1309,P1578,P1310,P1077,P899,P1768,P1297,P1317,P1286,P1307,P1216,P1764,P1312,P1298,P1315,P1292,P1073,P1318,P2191,P900,P1719,P1576,P1293,P1316,P1765,P1072,P902,P1295,P1974,P1301,P1069,P903,P1579,P1580,P2374,P1075,P1300,P1284,P904,;D86,P1139,P981,P1776,P1100,P1178,P1986,P1126,P1177,P1775,P1663,P1145,P1879,P1961,P939,P1175,P1697,P1211,P1125,P1164,P1414,P1179,P1160,P2155,P1871,P1468,P1168,P1176,P1723,P1171,P1156,P1874,P1144,P1698,P1181,P1047,P1985,P2133,P953,P1161,P982,P938,P1735,P2368,P937,P1044,P1722,P1039,P1878,P2280,P952,P1777,P1169,P1170,P996,P1043,P1046,P980,P1042,P935,P2251,P1162,P1155,P1499,P1159,P1143,P936,P1166,P1154,P1165,P1142,P1141,P1778,P1779,P1167,P1780,P1038,P1696,P2131,P2135,P1180,P1140,P954,P1041,P1174,P1877,P940,P1322,P1163,P1157,P1158,P1172,P1173,P1040,;D87,P865,P1752,P6,P1244,P764,P5,P8,P9,P1628,P1224,P1021,P792,P1241,P1220,P1848,P1443,P1231,P1022,P719,P720,P721,P863,P997,P14,P15,P16,P17,P1953,P1461,P1759,P1230,P1222,P1238,P22,P862,P228,P1229,P1221,P1227,P1954,P1444,P1761,P1240,P866,P1760,P27,P28,P1,P1442,P1695,P1758,P30,P1032,P1228,P32,P1850,P1955,P1814,P34,P1561,P1747,P1243,P1849,P1445,P1232,P1235,P1239,P1223,P1789,P37,P38,P39,P40,P1233,P1226,P1762,P41,P42,P1023,P1049,P1242,P1225,P1236,P44,P45,P544,P545,P1237,P46,P47,P1182,P1234,;D88,P1337,P1338,P1339,P1343,P1344,P1345,P1346,P1347,P1348,P1340,P1341,P1342,P79,;D89,P861,P1152,P860,P859,P1750,;D90,P1976,P105,P1732,P1751,P1653,P891,P784,P1112,P785,P786,P1118,P111,P112,P114,P1746,;D91,P1392,P1412,P1413,P1398,P1390,P1391,;D92,P2016,P1434,P832,P831,P2236,P2235,P2238,P2237,P833,P1452,P1453,P1522,P840,P841,P842,P1482,P1481,P1483,P1484,P2230,P1486,P1485,P2229,P1431,P1430,P1451,P845,P1967,P846,P1432,P1433,P1449,P1844,P1450,P1933,P1934,P1966,P1932,P2017,P2019,P837,P838,P2234,P844,P2018,P2228,P1812,P2227,P1813,P1810,P1811,P1845,P1847,P1846,P843,P1521,P1520,P2020,P2021,P1487,P1488,P1489,;D93,P1423,P836,P2244,P2243,P1424,P1425,P1454,P835,P834,P2239,P2240,P1428,P1429,P1455,P1456,P2242,P2241,P839,P1480,P1457,P1458,P1473,P1476,P1477,P1478,P1479,P1472,;D94,;D95,;D96,;D97,;D98,P1713,P1714,P830,P1712,;D99,;D100,P1467,P1982,P1981,P1984,P1968,P1466,P1983,;D101,P3,P19,P1980,P20,P1559,P1763,P986,P33,;D102,P1555,P1550,P1551,P1552,P1553,P1554,P1303,;D103,P1129,P1011,P1417,P2127,P1012,P1418,P2078,P1010,P930,P1558,;D104,P998,P1001,P1636,P999,P1637,P1638,P1000,P559,P556,P560,P557,P558,P2121,P2122,;D105,P1658,P1655,P2079,P1656,P1657,P1661,P1659,P1660,P2080,P562,P563,P561,P2415,P2416,P2417,;D106,P570,P2068,P1009,P564,P774,P565,;D107,P1595,P1596,P1597,P1598,P1599,P2217,P1601,P1820,P1602,P1973,P1603,P1604,P1594,P1606,P1607,P1608,P1609,P1610,P1611,P1605,P1612,P1613,P1614,P2024,P1600,P1615,P1616,;D108,P2141,P2263,P2140,P1885,P2132,P1621,P2290,P1587,P1588,P1589,P1888,P2066,P1889,P2258,P1816,P2259,P2139,P2077,P1785,P1590,P1881,P1591,P1781,P2137,P1786,P1592,P1883,P2143,P2144,P1887,P1784,P2145,P2138,P1890,P1593,P1884,P1882,P1880,P1783,P2142,P1886,;D109,P2270,P2271,P1731,P1672,P2028,P2027,P1671,P1670,P1669,P1673,P2281,P2075,P1618,P1619,P1964,P1617,P1963,P2298,P2307,;D110,P1729,P1129,P1011,P1417,P1012,P1418,P1010,P930,P1558,P1396,;D111,P1699,P1868,P1702,P2297,P928,P2044,P1395,P1113,P929,P1420,P1114,P1218,P1421,P2364,P2365,P2366,P2367,;D112,P1622,P1623,P1803,;D113,P1683,;D114,P1399,P1729,P1406,P1149,P1150,P1207,P932,P1212,P1557,P931,;D115,P1403,P1405,P1474,P2089,P1354,P1801,P1802,P1800,P1209,P1384,P1121,P1210,P2051,P2052,P1408,P934,P1396,;D116,;D117,P1738,P1962,P1664,P1620,;D118,P50,P277,P281,P279,P280,P53,P1804,P1815,P1828,P278,;D119,P1930,P1931,;D120,P52,P220,P55,P2361,P63,P221,P65,;D121,P51,P59,P62,P66,;D122,P64,;D123,P1730,P1744,P1806,P1807,P1809,P1808,;D124,P1825,P1822,P1665,P1666,P1823,P1667,P1821,P1824,P1782,P1668,;D125,P1427,P1426,P1833,P1834,P1835,P1836,P1837,P1838,P1839,P1841,P1842,P1843,P1840,;D126,P1857,P1854,P1855,P1853,P1856,P1872,P957,P1132,P943,P956,;D127,;D129,P1101,;D130,P1447,;D131,P1865,;D132,P1866,P1867,;D133,P1894,;D134,P1918,P1920,P1862,P1928,P1893,P1861,P1929,P1919,;D135,;D136,P58,;D137,P1943,P1941,P1898,P1949,P218,P1897,P1902,P1908,P186,P189,P1909,P1948,P1945,P191,P184,P1904,P1947,P1900,P193,P57,P1911,P1910,P1905,P1906,P1912,P187,P197,P1940,P1951,P1907,P185,P251,P1942,P1946,P1950,P194,P1895,P1903,P1896,P195,P1899,P1939,P1952,P1944,P1901,;D138,P282,P2224,P1922,P1921,;D139,P205,P207,P201,P213,P204,P217,P209,P216,P582,P211,P292,P206,P188,P214,P210,P212,P581,P203,P215,P208,;D140,P2223,P2299,P2129,P959,P2154,P2153,P2152,P2182,P2221,P2215,P2216,P1490,P2222,;D141,P1923,P1924,P1925,P1926,P1927,;D142,P289,P1029,P2134,P1030,P1826,P1031,;D143,;D144,;D145,P253,;D146,P255,P265,P267,P271,P261,P257,P252,P200,P262,P275,P259,P256,P268,P260,P269,P254,P276,P266,P272,P274,P263,P273,P264,P270,P199,P258,;D147,P1931,P1930,;D148,P49,P56,;D149,P1959,P1960,;D150,P1987,P2022,P1990,P1991,P2296,P2380,P1992,P2384,P2308,P2282,P2031,P1993,P2274,P2065,P1994,P2398,P2276,P2277,P1995,P2146,P2255,P1996,P2112,P2067,P2300,P1997,P2273,P2272,P1998,P1999,P2000,P2001,P2147,P2002,P2003,P2004,P2256,P2036,P1988,P2257,P2262,P1989,P2261,P2023,P2005,P2006,P2381,P2310,P2275,P2032,P2007,P2301,P2111,P2305,P2306,;D151,;D152,P2042,P2041,P2040,P2038,P2039,;D153,P2056,P2053,P2054,P2055,;D154,P2057,P2058,;D155,P2072,P2073,P2074,;D156,P2082,P2083,P2081,P2086,P2084,P2085,;D157,P755,P756,P757,P137,P758,P759,P133,P760,P134,P1564,P1572,P135,P761,P762,P136,P1586,P2117,P2118,P2177,P2190,P2400,P2109,P1277,P1122,P139,P127,P763,P811,;D158,P2407,P2404,P2405,P2406,P2401,P2408,P769,P2113,P1639,P2225,P2254,P2253,P2269,P2034,P2312,P2311,P1640,;D159,P2409,P2231,P2183,P2045,P2267,P2264,P1136,P2116,P1817,P2353,;D160,P2432,P2402,P2403,;D161,P2088,P2106,;D162,P2090,P2091,P2092,P2093,P2094,P2095,;D163,P2098,P2099,P2100,;D164,P2102,P2101,;D165,P2103,P2104,P2105,;D166,P2108,P2107,;D167,;D168,;D169,P2114,P2115,;D170,P2288,P2286,P2302,P2287,P2285,;D171,;D172,;D173,P2172,P2160,P2173,P2161,P2159,P2169,P2156,P2171,P2158,P2170,P2157,;D174,P2174,P2162,P2176,P2164,P2175,P2163,P2166,P2165,;D175,P2167,P2168,;D176,P2188,P2189,P2186,P2187,P2399,P2185,P2418,P2424,P2425,;D177,P2196,P2195,P2194,P2192,P2193,;D178,P1437,P1438,P1439,P1440,P1441,P1873,P566,P76,;D179,P1415,;D180,P80,P1385,P94,P1035,P1436,;D181,P958,P2128,;D182,P1385,P94,P964,P2070,P2069,P2071,P1436,;D183,P2325,;D184,P2329,P2327,P2328,P2326,;D185,P2393,P2390,P2396,P2392,P2395,P2388,P2394,P2389,P2385,P2387,P2397,P2391,P2386,;D186,P2339,P2333,P2340,P2341,P2334,P2342,P2336,P2343,P2337,P2335,P2344,P2332,P2338,P2331,;D187,P2357,;D188,P2359,P2289,P2360,;D189,P2323,P2362,P2319,P2349,P2291,P2313,P2383,P2293,P2318,P2314,P2317,P2382,P2363,P2294,P2295,P2292,P2322,P2321,P2358,;D190,P2350,P2356,P2303,P2324,P2351,;D191,P2346,P2347,P2316,P2315,P2320,P2348,P2345,;D192,P2352,;D193,;D194,P2414,P2427,P2428,;D195,P2426,;D196,P2426,;D197,P2430,P2429,P2431,P2354,;';
var pm_arr=pm_str.split(';');


for (i in pm_arr) {
	if(!pm_arr[i])continue;
	var prs=pm_arr[i].split(',');
	pm[prs[0]]='';
	for(var j=1;j<prs.length;j++) {
		if(!prs[j]) continue;
		var suf=parseInt((j-1)/splitNum);
		if(suf==0) suf='';
		else {
			if(suf<10) suf='0'+suf;
			suf='_'+suf;
		}
		prMap[prs[j]]=escape(unescape(pg[prs[0]]).replace('.html','')+suf+'.html');
	}
}

function getParentPage(productId){
	return prMap[productId];
}




var tf=topFrame;
tf.wm.path=function(p){
	p=p.toString();
	var i=p.indexOf('?');if(i!=-1)p=p.substring(0,i);
	return (p.charAt(p.length-1)=='/')?p:p.substring(0,p.lastIndexOf('/')+1);
}
tf.wm._fr=function(a,d,r){
	var f=d?d.frames:frames;for (var i=0;i<f.length;i++){
	var n=f[i].name;if(n.indexOf('-')!=-1)continue;
	if (!a[n])a[n]=eval(r+n);this._fr(a,a[n],r+n+'.')}
}
tf.wm.file=function(f){
	var rf=(this.host)?f.substring(this.host.length,f.length):'';
	return rf?rf:f;
}
tf.wm.rld=function(n,u,p,h){
	var w=this.get(n);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.host=tf.wm.path(escape(tf.loc));

function def(str) {return (str==null)?'':str;}

function split(str, del)
{
	function _s(a, s, d)
	{
		var idx=s.indexOf(d);
		if (idx==-1) a[a.length] = s;
		else {
			a[a.length] = s.substring(0, idx);
			_s(a, s.substring(idx+d.length, s.length), d);
		}
	}

	var arr = new Array();
	_s(arr, str, del);
	return arr;
}

function ckCodeStr(obj, order, sep, str)
{
	if (str==null) str = '';
	function delim(i, s) {return (i==0)?'':s}

	var cstr = '';
	var arr  = split(str, sep);
	var len  = arr.length;

	for (var i=0; i<order.length; i++){
		var val = arr[i];
		var val = (isNaN(val)||val=='')?'"'+val+'"':parseFloat(val);
		val	= (len>1)?'='+val:'';
		cstr += delim(i,sep) + def(eval('obj.'+order[i]+val));
	}

	if (typeof(obj.xcode)=='function') cstr += sep + obj.xcode((str!='')?arr[i]:'');
	return cstr;
}


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, del)
{
	if (isNaN(val)) return val;
	var scurr='';
	if (c1==null) return nfmt.display(val);
	if (c2!=null) {
		var val2 = val*c2.multiplier/topFrame.shopCurrency.multiplier;
		if (!raw) scurr = nfmt.display(val2, c2.decimal_places,entities(c2.abbrev));
		scurr=del+'('+scurr+')';
	}
	if (!raw) val = nfmt.display(val*c1.multiplier/topFrame.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,del) {
	if (type||!topFrame.secondCurrency) return dCurr(val, 0, topFrame.currentCurrency);
	if (!del) del=' ';
	return dCurr(val, 0, topFrame.currentCurrency, topFrame.secondCurrency,del);
}

function rl_total()
{
	Basket.refreshTotal();
}

function createMap(arr) {
var ret=[];
for (var i in arr) ret[arr[i]]=1;
return ret;
}



function viewBasket()	{ wm.rld('content', 'contents/'+topFrame.lang+'/basket.html')}
function order(){
	if (topFrame.mainLoaded) {
		orderStage = 1;
		topFrame.main.content.location='../order.html';
	}
}



function updateReseller(prdc, values){
if (Basket&&Basket.gdisc) {
for (var i=0; i<prdc.length; i++) {
Basket.gdisc.eAdd(prdc[i], new Array(10,values[i],''))
}}}


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){
if(d.all){
for(var s=startS; s<d.styleSheets.length; s++){
startS=s+1;
for(var r=startR; r<d.styleSheets[s].rules.length; r++){
startR=r+1;
if(d.styleSheets[s].rules[r].selectorText==className){startS=s;return d.styleSheets[s].rules[r];}
}}}
else if(d.getElementById){
for (var s=startS; s<d.styleSheets.length; s++){
startS=s+1;
for (var r=startR; r<d.styleSheets[s].cssRules.length; r++){
startR=r+1;
if(d.styleSheets[s].cssRules[r].selectorText==className){return d.styleSheets[s].cssRules[r];}
}}}
return null;
}
function getCssText(className,d) {
if(!d)d=wm.get('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;
}



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; i < x.length; i += 16)
  {
    var olda = a
    var oldb = b
	var oldc = c
	var oldd = d
	var 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; i < str.length * chrsz; i += chrsz)
    bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (24 - i%32)
  return bin
}
function binb2hex(binarray)
{
  var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"
  var str = ""
  for(var i = 0; i < binarray.length * 4; i++)
  {
    str += hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8+4)) & 0xF) +
           hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8  )) & 0xF)
  }
  return str
}

function place(s) {
  var t = "";
  for (var x = 0; x < s.length; x++) {
    t += s.charCodeAt(x);
    if (x < s.length - 1) {
      t += hexdelim;
    }
  }
  return t
}
function show(s) {
  var t = ""
  var v = s.split(hexdelim)
  for (var x = 0; x < v.length; x++) {
    t += String.fromCharCode(v[x])
  }
  return t
}





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.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.value = value;
	this.prop  = split(value, str_sep1);
}

function optCheck()
{
	if (this.value == '') {
		if (this.type) return this.title;
		return ' ';
	}
	return '';
}

function optChoice()
{
	return this.prop[0];
}

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 = new Array('prop[0]','prop[1]','prop[2]','prop[3]');
function optCode(str)
{
	if (this.choice() == '') return '';
	return ckCodeStr(this, _oArr, ',', str);
}


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;
}




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','EL','ES','FI','FR','GB','HU','IE','IT','LT','LU','LV','MT','NL','PL','PT','SE','SL','SK']);
}





rules['AT']="L(9)&&C(0,'U')&&N(1,8)"
rules['BE']="L(9)&&N(0,9)"
rules['DK']="L(8)&&N(0,8)";
rules['FI']="L(8)&&N(0,8)";
rules['FR']="L(11)&&N(2,11)"
rules['DE']="L(9)&&N(0,9)";
rules['GR']="L(9)&&N(0,9)";
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['LU']="L(8)&&N(0,8)";
rules['NL']="L(12)&&N(0,8)&&C(9,'B')&&N(10,12)";
rules['PT']="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,8)))";
rules['SE']="L(12)&&N(0,10)&&C(10,'0')&&C(11,'1')";

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.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) {
	if(!tax||!reg||!this.mapTax[tax])return false;
	var tmp=this.mapTax[tax].split(',');
	for(var i in tmp) 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 = split(tid, ',');
	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():'HK';

		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 taxRate(i,c)
{
	var a = split(i, ',');
	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;
	return (inc)?amt/(1+r):amt;
}

function taxAllAmt(i,p,c)
{
	if (!c) c=this.currRegn();
	var tot=0;
	p=this.exTax(i,p);
	var a = split(i, ',');
	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)
	return p * r;
}

function taxInTax(i,p,c)
{
	p = this.exTax(i,p);
	var amt = this.amt(0,i,p,c);
	return p+amt;
}

function taxExTax(i,p)
{
	p = parseFloat(p);
	var a = split(i, ',');
	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 = split(i, ',');
	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;


	return p+d;

}

function taxDisp(i,p,co,ccr)
{

	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='\n '+showPrc(inT);}
	else {
		if (this.showBoth && inT>exT) {
			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&&tax.code.indexOf(rcode)!=-1) return false;
	} else {
		if (tax&&tax.perc>0) return false;
	}
}
return true;
}


var frPrArr=new Array();



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=='') this.items.eAdd(id, new Array(this.bsk,id,wm.get('content').document,parseFloat(qnty),price,title,parseFloat(weight),prdc,'','','','',imgid));
	else tmp.quantity = qnty;
}

function fbGetTitles(ids,del) {
var ret=''; if (!del) del=',';
for (var i=0; i<frPrArr.length; i++) {
if (ids.indexOf(frPrArr[i][0])==-1) continue;
ret+=del+frPrArr[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=val[0]; val=val[1];
	
	var z=0;
	for (var i=0; i<frPrArr.length; i++) {
		if (val.indexOf(frPrArr[i][0])==-1) continue;
		z=1;
		if (disp) str += '<br>  '+freeqnty+' x ' + frPrArr[i][1];
		else {
			pid=(itm.id)?itm.id:'shop';
			this._add(pid+"|"+frPrArr[i][0], freeqnty, frPrArr[i][1], frPrArr[i][2],frPrArr[i][3],frPrArr[i][4],frPrArr[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 (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]);
}
}

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.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.pShip	= bskPShip;
	this.searchTaxes= bskSearchTaxes;
	this.getAvgTaxAmt=bskGetAvgTaxAmt;
	this.invalidate = bskInvalidate;
	this.getTaxIDs	= bskGetTaxIDs;
	this.refreshTotal=bskRefreshTotal;
	this.clearBsk	= bskClearBsk;
	
}


function bskParse(id,doc,qnty,title,weight,itemNo,useDec,esd,taxes,opts,prdc,manc,dstc,prcc,ship,restoring)
{
	var price=0;

	function cf(i,d,sd,s,t,st)
	{

		currentItem	= i;
		var dcf		= doc.cf_popup;
		
		
			var wnd=wm.get('content');
			wnd.sfAddRef={core:window,item:i,stock:st,options:opts,pdoc:doc,noopt:false}
			return false;
		
	}

	var p=wm.pProp(id), stkEn; 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 smin=p[2]; smax=p[3]; savail=p[4],st='';if (savail<0) savail=Number.MAX_VALUE;

var stk;
	if(restoring!=false||false){
	var chk = itm.addOpt(opts, doc);
	if (chk!='') {
		if (chk != ' ') return alert(LD.LD_ORDER_ERROR_FIELDS + '\n' + chk);
		if (!confirm(LD.LD_CHOOSE_OPTIONS)) return 0;
	}}

	var disc = Basket.disc.eAdd(itm.id, new Array(p[5], p[6], p[7]));
	var ship = Basket.ship.eAdd(itm.id, new Array(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;
}

function bskAdd(itm)
{


	for (var i=0; i<this.items.cnt(); i++) {
		var tmp = this.items.get(i);
		if (!itm.isSame(tmp)) continue;
		
		tmp.transfer(itm)
		this.items.del(i)
		break;
	}

	this.items.add(itm)

	itm.cache=new Array();
	


	rl_total()

	this.save()
	return 1;
}

function bskDel(idx)
{
	var itm = this.items.get(idx)
	if (itm == '') return ''

	this.items.del(idx)

	if (this.fbsk&&this.name=='') {
		this.fbsk.delByPr(itm.id)
		this.fbsk.delByPr('shop');
		this.fbsk.add(this.total(), this.shDisc(), null, 0);
	}
	rl_total();

	this.save()
}


function bskUpdQnty(idx, qnty)
{
	var itm = this.items.get(idx);
	var tmp = itm.quantity;
	if (isNaN(qnty)||parseInt(qnty)<0) qnty=tmp;
	if (parseInt(qnty)==0) {this.del(idx); return;}
			// Subtract old quantity from stock
	itm.quantity=(itm.useDec>0)?parseFloat(qnty):parseInt(qnty);
			// Update new quantity to stock
	itm.cache=new Array();
	
	this.save()
	this.ckOut()
}

function bskTotal(type)
{
	var apply_dsc=true;
	if (type=='orig') {apply_dsc=false; type=''}
	if (type==null) type=''
	var tot=0,prprice=0,purtot=0;
	var i=this.items.start()
	while (i!=null) {
		tot += i.calc(type)
		purtot+=i.cache['pur'+i.quantity];
		if (type=='tax') prprice+=i.calc('ndc')
		i = this.items.next()
	}

	var shDisc=this.shDisc();
	if((type==''||type=='pur'||type=='inc')&&apply_dsc&&this._shDisc)tot-=shDisc.purchasePrice(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);

	}

	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.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);
		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 (i in tmp) if (i&&tmp[i]==0) ps[i]=1;
		itm = this.items.next();
	}
	return ps;
}

function bskPShip(mid)
{
	if(!mid)return 0;
	if(wm)var core=wm.get("core");
	var loc=3;
	if (core&&core.region){
		var cnt=this.shp_obj.links.length,code=core.region;
		if(code.length>4)code=code.substring(0,4);
		var midrgcnt=-1;
		for(var i=0;i<cnt;i++){
			var lk=this.shp_obj.links[i];
			if(lk.mid!=mid)midrgcnt=-1;else midrgcnt++;
			if(lk.mid==mid&&lk.zip[code]!=null){
				// For local region, it should be 2, anywhere else, 3.
				loc=(midrgcnt==0?2:3);
				break;
			}
		}
	}

	var e	= 0;
	var itm = this.items.start();
	while (itm) {
		var n=itm.shipMth(mid, loc);
		e += (typeof(core.STax.mapRegn[core.region])!='undefined'?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 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 bskGetAvgTaxAmt(inc)
{

var it=new Iterator(this.items),avg=0, i=it.start(), prprice=0;
while (i!=null) {
	if (this.price<=0) continue;
	var a=i.taxes.split(','),rate=0;
	for (var j=0; j<a.length; j++) {
		if(!a[j])continue;
		if (inc&&!this.tax._tax.get(a[j]).incTax) continue;
		var crate=this.tax.regnRate(a[j],this.tax.currRegn());
		rate+=crate;
	}
	if (rate>0) avg+=rate*i.calc('exc');
	prprice+=i.calc('ndc');
	i=it.next();
}
if(this.shDisc())
	avg-=this.shDisc().purchasePriceByPrice(avg,prprice);
return avg;

}

function bskInvalidate() {
var it=new Iterator(this.items),i=it.start();
while (i!=null) {
	i.cache=new Array();
	i=it.next();
}
}

function bskRefreshTotal() {
var result='',total=wm.get('total');

if(topFrame&&LD&&total) {
	wm.get('conf').greySettings();
	if (this.items.cnt()<1&&total&&total.setTotal) {total.setTotal('');return;}
	var shipObj	= wm.get('ship_obj');
	var bsk=this;
	if (shipObj) {
		var ppur=bsk.total();
		var ppur_ex=bsk.total('exc');
		var shp=bsk.shipPrice(shipObj);
		var ttax=(ppur>0.001)?bsk.total('tax'):0;
		var shp_asis=bsk.shipPrice(shipObj,null,1);
		if(shipObj._ttype==1){
			shtaxex=(ppur>0.001)?shp_asis/(1+bsk.getAvgTaxAmt(1)/ppur_ex):shp_asis;
		}else{
			shtaxex=core.STax.exTax(core.STax.allIDs(),shp_asis);
		}
		taxonshp=(ppur>0.001)?shipObj.tax(shp_asis,ppur_ex,null,shtaxex):0;
		var tax=ttax+taxonshp;
		var total=ppur_ex+tax+shtaxex;
	} else {
		var ppur_ex	= bsk.total('exc');
		var ttax	= bsk.total('tax');
		var t		= ppur_ex + ttax;
	}

	if (t>0) {

	result=LD.LD_TOTAL;
	if (bsk.tax.cntInc(bsk.items)) {
		result+=' '+LD.LD_INC;
	}


	result+=": <b>";
	result+=showPrc(t,0,'</b> ~ ');
	}
	if(total&&total.setTotal)total.setTotal(result);
}
}

function bskClearBsk() {
this.items = new dynObj('item');
this.fbsk  = new freeBasket(this);
}

function load_price(args)
{
	var all = args[1];
	for (var i=0; i<all.length; i++) {
		var itm = all[i];
		args[0].parse(itm.id, itm, itm.quantity, '', '');
	}
}


function bskSave()
{
	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();
		ck = place(ck) + "TEST" + add(place(ck));
	}
	savCookStr(ckName, ck, '7');
	if (this.name!='')savCookStr(ckName, ck, -1);
	this.shpP = 0;
}

function bskLoad()
{
	if (getCookStr('storebasket')!='1'&&this.name!='Favorite') return;
	var ckName = this.name; if (!ckName) ckName='ADDRESS';
	var arr = split(getCookStr(ckName), "TEST");
	if (arr.length == 2 && add(arr[0]) == arr[1]) {
		if (this.name!='' || confirm(shopName+':\n\n'+LD.LD_LOAD_BASKET+'  '+this.name))
			this.decode(show(arr[0]));
		else savCookStr(ckName, "", '7');
	}
rl_total();
}

function bskEncode()
{
	var is=''; var ss=''; var ds=''; var sep='';
	for (var i=0; i<this.items.cnt(); i++) {
		var itm = this.items.get(i);
		is += sep + itm.code();
		sep = '~';
	}
	return '['+is+']';
}

function bskDecode(str)
{
	
	function _L(url){
		var jfile=wm.jfile(url);
		if(jfile.substr(0,1).toLowerCase()=='p')jfile=getParentPage(jfile.substr(0,jfile.indexOf('.')).toUpperCase());
		jfile=jfile.split('?')[0];
		jfile=jfile.replace('.html','_');
		return topFrame.lang+'/'+jfile;
	}
	

	var s  = str.substring(1,str.length-1);
	var sa = split(s, '][');
	var is = split(sa[0], '~');

	

	

	
	var fstr='wm.get("core").load_price';
	var pg = new Array();
	
	for (var i=0; i<is.length; i++) {
		var itm = this.items.empty();
		itm.code(this,is[i])

		if (wm.pProp(itm.id))		// Price already exists
			this.parse(itm.id, itm, itm.quantity,'','');
		else {
			var p = _L(itm.purl)
			if (!pg[p]) pg[p] = new Array();
			pg[p][pg[p].length] = itm;
		}


	}
	for (var i in pg) load_page(i, fstr, new Array(this, pg[i]));
	
}

function item()
{
	this.options	= new dynObj('options');
	this.init	= itemInit;
	this.isSame	= itemIsSame;
	this.transfer	= itemTx;
	this.sig	= itemSig;
	this.code	= itemCode;

	this.xcode	= itemXCode;
	this.updQnty	= itemUQnty;
	this.addOpt	= itemAddOpt;
	this.weight	= itemWeight;
	this.shipMth	= itemShipMth;
	this.calc	= itemCalc;

	return this;
}

function itemInit(prt,id,doc,qnty,price,title,weight,itemNo,useDec,esd,taxes,prdc,imgsrc)
{
	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=wm.url(escape(doc.location.toString()));
			if(!imgsrc){i=doc.getElementById('I'+id);img=i?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	= new Array();
	this.price	= parseFloat(price);
	this.taxes	= taxes;
	this.updQnty(qnty);
	this.weight(weight);
	this.handlingcosts=new Array();

}

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=new Array(
	'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=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 = split(str, ';');
		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]));
		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 itemCalc(type,shMeth,islocal,nocache)
{
	if (!type) type='pur';
	var qty=this.quantity;
	if (!nocache&&this.cache[type+qty.toString()]) return this.cache[type+qty.toString()];
	var prt= this.parent;
	var sd = prt.shDisc();
	
	var dsc= prt.disc.get(this.id);
	var gdsc=(getCookStr('ResellerID')!='')?prt.gdisc.get(this.prdc):null;
	if (!gdsc&&(getCookStr('ResellerID')!='')) gdsc=prt.gdisc.get('ALL_OTHERS');
	var tax= prt.tax;
	var prc= 0;

	switch (type) {
		case 'pdamt':
			prc=0;
			if(true)prc=dsc.amount(this.price,qty,this.calc('opt',shMeth,islocal,nocache));
			if(gdsc)prc=100-((100-prc)*(100-gdsc.amount(this.price,qty,this.calc('opt',shMeth,islocal,nocache))))/100;
			break;
		case 'damt':
			var all = this.parent.items;
			for (var i=0; i<all.cnt(); i++) {
				var itm = all.get(i);
				if (itm==this) continue;
				prc += (itm.calc('snd',shMeth,islocal,nocache)-itm.calc('pdamt',shMeth,islocal,nocache))*itm.quantity;
			}
			var iprc = this.calc('snd',shMeth,islocal,nocache) - this.calc('pdamt',shMeth,islocal,nocache);
			prc += qty?iprc*qty:iprc;
			prc  = sd.amount(iprc,prc,0) + this.calc('pdamt',shMeth,islocal,nocache);
			break;
		case 'opt': for(var i=0,o=this.options;i<o.cnt();i++)prc+=o.get(i).price();break;
		case 'snd': prc=this.price+this.calc('opt',shMeth,islocal,nocache);break;
		case 'sdc': prc=this.calc('snd',shMeth,islocal,nocache)-this.calc('damt',shMeth,islocal,nocache);break;
		case 'ndc': prc=(this.price+this.calc('opt',shMeth,islocal,nocache))*qty;break;
		case 'dsc': prc=this.calc('sdc',shMeth,islocal,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,islocal,nocache));break;
		case 'exc': prc=tax.exTax(this.taxes,this.calc('dsc',shMeth,islocal,nocache)); break;
		case 'inc': prc=tax.calcTax(this.taxes,this.calc('dsc',shMeth,islocal,nocache)); break;
		case 'hcp': prc=(isLocal)?this.handlingcosts[shMeth][3]:handlingcosts[shMeth][4]; break;
	}
        if (!nocache) this.cache[type+qty.toString()]=prc;
/*	switch (type) {
		case 'pdamt':
		case 'damt': return parseFloat(prc);
		default: return nfmt.round(prc, null, '');
	}*/
	return parseFloat(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('1','0.000','');
var theBsk=Basket;
ordStage=0;


topFrame.coreLoaded=true;

/*$Revision: 221 $
$Archive: /Autobuild/sf_63/ShopFactory_V6/Common Files/parseLang/sf.js $*/
