function _cShop_addItem(name,HTML,ust,shipping)
{
	if(this.items[name])
	{
		this.get(name);
		return this.items[name]
	}
	else 
	{
		this.items[name]=new _cItem(name,HTML,ust,shipping)
		this.items[name].groupItem=false;
	}
	return this.items[name]
}

function _cShop_addGroup(name,HTML,type,ust,shipping)
{
	if(this.groups[name])return this.groups[name]
	else return this.groups[name]=new _cGroup(this,HTML,type,ust,shipping)
}


function _cShop_getObj(name)
{
	if(this.items[name])return this.items[name]
	else 
	{
		var x,obj
		for(x in this.groups)
		{
			if(this.groups[x].items[name])return this.groups[x].items[name];
		}
	}
}

function _cShop_inc(name)
{
	
	var obj=this.getObj(name);
	if(obj.groupItem)var old=obj.count;
	var min=(obj.groupItem && obj.prices.length==0)?1:obj.prices[0].min
	if(obj.count==0)obj.count=min;
	else obj.count++;
	if(obj.groupItem)obj.parent.count+=obj.count-old;
	this.get(name);
	this.info()
	//this.getHidden();
}

function _cShop_dec(name)
{
	var obj=this.getObj(name);
	if(obj.groupItem)var old=obj.count;
	var min=(obj.groupItem && obj.prices.length==0)?1:obj.prices[0].min
	if(obj.count>min)obj.count--
	else obj.count=0;
	if(obj.groupItem)obj.parent.count+=obj.count-old;
	this.get(name);
	this.info()
	//this.getHidden();
}

function _cShop_set(name,value)
{
	var obj=this.getObj(name);
	if(obj.groupItem)var old=obj.count;
	var min=(obj.groupItem && obj.prices.length==0)?1:obj.prices[0].min
	value=parseInt(value);
	if(value<min)
	{
		alert(cWords["min"]);
		obj.count=0
	}
	else obj.count=value;
	if(obj.groupItem)obj.parent.count+=value-old;
	this.get(name);
	this.info()
	//this.getHidden();
}

function _cShop_del(name)
{
	if(confirm(cWords["del"]))
	{
		var x,y;
		if(name)
		{
			if(this.items[name])this.items[name].count=0;
			else for(x in this.groups)
			{
				if(this.groups[x].items[name])
				{
					this.groups[x].count-=this.groups[x].items[name].count;
					this.groups[x].items[name].count=0;
					break;
				}
			}
			this.get(name);
		}
		else
		{
			for(x in this.items)
			{
				this.items[x].count=0;
				this.get(x);
			}
			for(y in this.groups)
			{
				this.groups[y].count=0;
				for(x in this.groups[y].items)
				{
					this.groups[y].items[x].count=0;
					this.get(x);
				}
			}
		}
	this.info()
	//this.getHidden();
	if(cObjPath.getTgtObj(this.pathNr).document.title==cWords["traytitle"])this.tray();
	}
}

function _cShop_get(name)
{
	var x;
	if(cObjPath.getTgtObj(this.pathNr).document.forms["f_"+name])cObjPath.getTgtObj(this.pathNr).document.forms["f_"+name]["i_"+name].value=this.getObj(name).count;
	else
	{
		if(isNN)
		{
			for(x=0;x<cObjPath.getTgtObj(this.pathNr).document.layers.length;x++)
			{
				if(cObjPath.getTgtObj(this.pathNr).document.layers[x].document.forms["f_"+name])
				{
					cObjPath.getTgtObj(this.pathNr).document.layers[x].document.forms["f_"+name]["i_"+name].value=this.getObj(name).count;
					break;
				}
			}
		}
	}
}

function _cShop_tray(writeonly)
{
	var doc=cObjPath.getTgtObj(this.pathNr).document
	if(!writeonly)doc.open();
	doc.write(this.getTray());
	if(!writeonly)doc.close();

}

function _cShop_getTray()
{
	var out='',outh='',out2='';
	this.clearUst()

	out+='<TABLE CLASS="tray">'//
	out+='<TR>'
	
	for(x=0;x<cShopStyle.length;x++)
	{
		if(cShopStyle[x])out+='<TH>'+cShopStyle[x]+'</TH>'
	}
	out+='</TR>'

	var x,y,z,c,s,p,u,cu,cp,tsum,sum=0,csum=0,nosum=0,usum=0,ship=0;
	

	for(x in this.items)
	{
		c=this.items[x].count
		if(c)
		{
			csum+=c;
			sum+=s=this.items[x].count*this.getPrice(this.items[x]);
			p=this.getPrice(this.items[x]);
			cp=c*p

			s=this.items[x].ust
			this.sumUst(cp,s);
			u=this.calcUst(p,s);
			cu=u*c
			
			out+='<TR>'
			if(cShopStyle[0])out+='<TD CLASS="'+this.evenOdd(true)+'" >'+this.items[x].HTML+'</TD>'
			if(cShopStyle[1])out+='<TD CLASS="'+this.evenOdd()+'" >'+c+'</TD>'
			if(cShopStyle[2])out+='<TD CLASS="'+this.evenOdd()+'" >'+this.round(p)+'</TD>'
			if(cShopStyle[3])out+='<TD CLASS="'+this.evenOdd()+'" >'+this.round(this.toDM(p))+'</TD>'
			if(cShopStyle[4])out+='<TD CLASS="'+this.evenOdd()+'" >'+s+'%: '+this.round(u)+'</TD>'
			if(cShopStyle[5])out+='<TD CLASS="'+this.evenOdd()+'">'+s+'%: '+this.round(this.toDM(u))+'</TD>'
			if(cShopStyle[6])out+='<TD CLASS="'+this.evenOdd()+'" >'+s+'%: '+this.round(p-u)+'</TD>'
			if(cShopStyle[7])out+='<TD CLASS="'+this.evenOdd()+'">'+s+'%: '+this.round(this.toDM(p-u))+'</TD>'
			if(cShopStyle[8])out+='<TD CLASS="'+this.evenOdd()+'">'+this.round(cp)+'</TD>'
			if(cShopStyle[9])out+='<TD CLASS="'+this.evenOdd()+'">'+this.round(this.toDM(cp))+'</TD>'
			if(cShopStyle[10])out+='<TD CLASS="'+this.evenOdd()+'">'+s+'%: '+this.round(cu)+'</TD>'
			if(cShopStyle[11])out+='<TD CLASS="'+this.evenOdd()+'">'+s+'%: '+this.round(this.toDM(cu))+'</TD>'
			if(cShopStyle[12])out+='<TD CLASS="'+this.evenOdd()+'">'+s+'%: '+this.round(cp-cu)+'</TD>'
			if(cShopStyle[13])out+='<TD CLASS="'+this.evenOdd()+'">'+s+'%: '+this.round(this.toDM(cp-cu))+'</TD>'
			out+='</TR>'
			
		}
	}
	for(x in this.groups)
	{
		if(this.groups[x].count)
		{
			if(this.groups[x].type)
			{
				for(y in this.groups[x].items)
				{
					if(this.groups[x].items[y].count)
					{
						/*out+='<TR>'
						out+='<TD>'+this.groups[x].items[y].HTML+'</TD>'
						out+='<TD>'+this.groups[x].items[y].count+'</TD>'
						out+='<TD COLSPAN=4></TD>'
						out+='</TR>'
						*/
					}
				}
				if(this.groups[x].type)
				{
					var gc=new Array();
					var gm=new Array();
					var gr=new Array();
					for(y in this.groups[x].items)gc[y]=this.groups[x].items[y].count;
					for(y in this.groups[x].prices)gm[this.groups[x].prices[y].min]=this.groups[x].prices[y].price
					var ready=true,to=0,last,nosum;
					while(ready)
					{
						var no=new Array();
						to=nosum=0;
						for(y in gc)
						{
							if(gc[y]>0)
							{
								nosum+=this.getPrice(this.groups[x].items[y])
								if(!no[y])no[y]=0;
								no[y]++;
								gc[y]--
								last=y;
								to++
							}
						}
						csum+=ready=to;
						if(to>1)
						{
							if(to*gm[to]<=nosum)
							{
								cu=0;
								sum+=tsum=to*gm[to];
								for(y in no)
								{
									s=this.getUst(this.groups[x].items[y])
									cu+=u=this.sumUst(tsum/to,this.getUst(this.groups[x].items[y]));
									out+='<TR>'
									if(cShopStyle[0])out+='<TD CLASS="'+this.evenOdd(true)+'">'+this.groups[x].items[y].HTML+'</TD>'
									if(cShopStyle[1])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
									if(cShopStyle[2])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
									if(cShopStyle[3])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
									if(cShopStyle[4])out+='<TD CLASS="'+this.evenOdd()+'">'+s+'%: '+this.round(u)+'</TD>'
									if(cShopStyle[5])out+='<TD CLASS="'+this.evenOdd()+'">'+s+'%: '+this.round(this.toDM(u))+'</TD>'
									if(cShopStyle[6])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
									if(cShopStyle[7])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
									if(cShopStyle[8])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
									if(cShopStyle[9])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
									if(cShopStyle[10])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
									if(cShopStyle[11])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
									if(cShopStyle[12])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
									if(cShopStyle[13])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
									out+='</TR>'
								}
								out+='<TR>'
								if(cShopStyle[0])out+='<TD CLASS="'+this.evenOdd(true)+'">'+this.groups[x].HTML+'</TD>'
								if(cShopStyle[1])out+='<TD CLASS="'+this.evenOdd()+'">'+to+'</TD>'
								if(cShopStyle[2])out+='<TD CLASS="'+this.evenOdd()+'">'+this.round(this.getPrice(this.groups[x],to))+'</TD>'
								if(cShopStyle[3])out+='<TD CLASS="'+this.evenOdd()+'">'+this.round(this.toDM(this.getPrice(this.groups[x],to)))+'</TD>'
								if(cShopStyle[4])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
								if(cShopStyle[5])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
								if(cShopStyle[6])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
								if(cShopStyle[7])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
								if(cShopStyle[8])out+='<TD CLASS="'+this.evenOdd()+'">'+this.round(tsum)+'</TD>'
								if(cShopStyle[9])out+='<TD CLASS="'+this.evenOdd()+'">'+this.round(this.toDM(tsum))+'</TD>'
								if(cShopStyle[10])out+='<TD CLASS="'+this.evenOdd()+'">'+this.round(cu)+'</TD>'
								if(cShopStyle[11])out+='<TD CLASS="'+this.evenOdd()+'">'+this.round(this.toDM(cu))+'</TD>'
								if(cShopStyle[12])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
								if(cShopStyle[13])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
								out+='</TR>'
								
							}
							else
							{
								sum+=nosum;
								for(y in no)
								{
									if(!gr[y])gr[y]=0;
									gr[y]+=no[y];
								}
							}
						}
						else if(to)
						{
							sum+=this.getPrice(this.groups[x].items[last])
							if(gr[last])gr[last]++;
							else gr[last]=1;
						}
					}
					for(y in gr)
					{
						p=this.getPrice(this.groups[x].items[y]);
						cp=gr[y]*p;
						s=this.getUst(this.groups[x].items[y])
						this.sumUst(cp,s)
						u=this.calcUst(p,s)
						cu=gr[y]*u
						out+='<TR>';
						if(cShopStyle[0])out+='<TD CLASS="'+this.evenOdd(true)+'">'+this.groups[x].items[y].HTML+'</TD>';
						if(cShopStyle[1])out+='<TD CLASS="'+this.evenOdd()+'">'+gr[y]+'</TD>';
						if(cShopStyle[2])out+='<TD CLASS="'+this.evenOdd()+'">'+this.round(p)+'</TD>';
						if(cShopStyle[3])out+='<TD CLASS="'+this.evenOdd()+'">'+this.round(this.toDM(p))+'</TD>';
						if(cShopStyle[4])out+='<TD CLASS="'+this.evenOdd()+'">'+s+'%: '+this.round(u)+'</TD>';
						if(cShopStyle[5])out+='<TD CLASS="'+this.evenOdd()+'">'+s+'%: '+this.round(this.toDM(u))+'</TD>';
						if(cShopStyle[6])out+='<TD CLASS="'+this.evenOdd()+'">'+s+'%: '+this.round(p-u)+'</TD>';
						if(cShopStyle[7])out+='<TD CLASS="'+this.evenOdd()+'">'+s+'%: '+this.round(this.toDM(p-u))+'</TD>';
						if(cShopStyle[8])out+='<TD CLASS="'+this.evenOdd()+'">'+this.round(cp)+'</TD>';
						if(cShopStyle[9])out+='<TD CLASS="'+this.evenOdd()+'">'+this.round(this.toDM(cp))+'</TD>';
						if(cShopStyle[10])out+='<TD CLASS="'+this.evenOdd()+'">'+s+'%: '+this.round(cu)+'</TD>';
						if(cShopStyle[11])out+='<TD CLASS="'+this.evenOdd()+'">'+s+'%: '+this.round(this.toDM(cu))+'</TD>';
						if(cShopStyle[12])out+='<TD CLASS="'+this.evenOdd()+'">'+s+'%: '+this.round(cp-cu)+'</TD>';
						if(cShopStyle[13])out+='<TD CLASS="'+this.evenOdd()+'">'+s+'%: '+this.round(this.toDM(cp-cu))+'</TD>';
						out+='</TR>';
					}
				}
			}
			else
			{
				p=this.getPrice(this.groups[x])
				for(y in this.groups[x].items)
				{
					c=this.groups[x].items[y].count;
					if(c)
					{
						s=this.getUst(this.groups[x].items[y]);
						u=this.calcUst(p,s)
						cu=c*u
						cp=c*p
						
						this.sumUst(cp,s)
						out+='<TR>'
						if(cShopStyle[0])out+='<TD CLASS="'+this.evenOdd(true)+'">'+this.groups[x].items[y].HTML+'</TD>'
						if(cShopStyle[1])out+='<TD CLASS="'+this.evenOdd()+'">'+c+'</TD>'
						if(cShopStyle[2])out+='<TD CLASS="'+this.evenOdd()+'">'+this.round(p)+'</TD>'
						if(cShopStyle[3])out+='<TD CLASS="'+this.evenOdd()+'">'+this.round(this.toDM(p))+'</TD>'
						if(cShopStyle[4])out+='<TD CLASS="'+this.evenOdd()+'">'+s+'%: '+this.round(u)+'</TD>'
						if(cShopStyle[5])out+='<TD CLASS="'+this.evenOdd()+'">'+s+'%: '+this.round(this.toDM(u))+'</TD>'
						if(cShopStyle[6])out+='<TD CLASS="'+this.evenOdd()+'">'+s+'%: '+this.round(p-u)+'</TD>'
						if(cShopStyle[7])out+='<TD CLASS="'+this.evenOdd()+'">'+s+'%: '+this.round(this.toDM(p-u))+'</TD>'
						if(cShopStyle[8])out+='<TD CLASS="'+this.evenOdd()+'">'+this.round(cp)+'</TD>'
						if(cShopStyle[9])out+='<TD CLASS="'+this.evenOdd()+'">'+this.round(this.toDM(cp))+'</TD>'
						if(cShopStyle[10])out+='<TD CLASS="'+this.evenOdd()+'">'+s+'%: '+this.round(cu)+'</TD>'
						if(cShopStyle[11])out+='<TD CLASS="'+this.evenOdd()+'">'+s+'%: '+this.round(this.toDM(cu))+'</TD>'
						if(cShopStyle[12])out+='<TD CLASS="'+this.evenOdd()+'">'+s+'%: '+this.round(cp-cu)+'</TD>'
						if(cShopStyle[13])out+='<TD CLASS="'+this.evenOdd()+'">'+s+'%: '+this.round(this.toDM(cp-cu))+'</TD>'
						out+='</TR>'
						
					}
				}
				c=this.groups[x].count;
				cp=c*p;
				/*out+='<TR>'
				out+='<TD>'+this.groups[x].HTML+'</TD>'
				out+='<TD>'+c+'</TD>'
				out+='<TD>'+this.round(p)+'</TD>'
				out+='<TD>'+this.round(this.toDM(p))+'</TD>'
				out+='<TD>'+this.round(cp)+'</TD>'
				out+='<TD>'+this.round(this.toDM(cp))+'</TD>'
				out+='</TR>'
				*/
				csum+=c;
				sum+=cp;
			}
		}
	}
	
	if(csum )
	{
	this.count=csum;
	if(cShopSumStyle[0])
	{
		out+='<TR>'
		out+='<TD CLASS="'+this.evenOdd(true)+'">'+cShopSumStyle[0]+':</TD>'
		out+='<TD CLASS="'+this.evenOdd()+'">'+csum+'</TD>'
		if(cShopStyle[2])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[3])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[4])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[5])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[6])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[7])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		out+='<TD CLASS="'+this.evenOdd()+'">'+this.round(sum)+'</TD>'
		if(cShopStyle[9])out+='<TD CLASS="'+this.evenOdd()+'">'+this.round(this.toDM(sum))+'</TD>'
		if(cShopStyle[10])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[11])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[12])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[13])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		out+='</TR>'
	}
		for(y in this.usts)
		{
			usum+=this.usts[y];
			if(cShopSumStyle[3])
			{
			out+='<TR>'
			out+='<TD CLASS="'+this.evenOdd(true)+'">'+cShopSumStyle[3]+' '+y+'% '+cWords["ust"]+':</TD>'
			if(cShopStyle[1])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
			if(cShopStyle[2])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
			if(cShopStyle[3])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
			if(cShopStyle[4])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
			if(cShopStyle[5])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
			if(cShopStyle[6])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
			if(cShopStyle[7])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
			out+='<TD CLASS="'+this.evenOdd()+'">'+this.round(this.usts[y])+'</TD>'
			if(cShopStyle[9])out+='<TD CLASS="'+this.evenOdd()+'">'+this.round(this.toDM(this.usts[y]))+'</TD>'
			if(cShopStyle[10])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
			if(cShopStyle[11])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
			if(cShopStyle[12])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
			if(cShopStyle[13])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
			out+='</TR>'
			}
			if(cShopSumStyle[4])
			{
				out+='<TR>'
				out+='<TD CLASS="'+this.evenOdd(true)+'">'+cShopSumStyle[4]+':</TD>'
				if(cShopStyle[1])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
				if(cShopStyle[2])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
				if(cShopStyle[3])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
				if(cShopStyle[4])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
				if(cShopStyle[5])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
				if(cShopStyle[6])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
				if(cShopStyle[7])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
				out+='<TD CLASS="'+this.evenOdd()+'">'+this.round(sum-this.usts[y])+'</TD>'
				if(cShopStyle[9])out+='<TD CLASS="'+this.evenOdd()+'">'+this.round(this.toDM(sum-this.usts[y]))+'</TD>'
				if(cShopStyle[10])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
				if(cShopStyle[11])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
				if(cShopStyle[12])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
				if(cShopStyle[13])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
				out+='</TR>'
			}
		}
	if(cShopSumStyle[1])
	{
		out+='<TR>'
		out+='<TD CLASS="'+this.evenOdd(true)+'">'+cShopSumStyle[1]+':</TD>'
		out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[2])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[3])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[4])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[5])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[6])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[7])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		out+='<TD CLASS="'+this.evenOdd()+'">'+this.round(sum-usum)+'</TD>'
		if(cShopStyle[9])out+='<TD CLASS="'+this.evenOdd()+'">'+this.round(this.toDM(sum-usum))+'</TD>'
		if(cShopStyle[10])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[11])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[12])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[13])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		out+='</TR>'
	}

	if(cShopSumStyle[2])
	{
		out+='<TR>'
		out+='<TD CLASS="'+this.evenOdd(true)+'">'+cShopSumStyle[2]+':</TD>'
		out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[2])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[3])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[4])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[5])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[6])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[7])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		out+='<TD CLASS="'+this.evenOdd()+'">'+this.round(usum)+'</TD>'
		if(cShopStyle[9])out+='<TD CLASS="'+this.evenOdd()+'">'+this.round(this.toDM(usum))+'</TD>'
		if(cShopStyle[10])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[11])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[12])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[13])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		out+='</TR>'
	}
	sum+=ship=this.calcShipping()
	if(cShopSumStyle[5])
	{
		out+='<TR>'
		out+='<TD CLASS="'+this.evenOdd(true)+'">'+cShopSumStyle[5]+':</TD>'
		out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[2])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[3])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[4])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[5])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[6])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[7])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		out+='<TD CLASS="'+this.evenOdd()+'">'+this.round(ship)+'</TD>'
		if(cShopStyle[9])out+='<TD CLASS="'+this.evenOdd()+'">'+this.round(this.toDM(ship))+'</TD>'
		if(cShopStyle[10])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[11])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[12])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[13])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		out+='</TR>'
	}
	
	if(cShopSumStyle[6])
	{
		out+='<TR>'
		out+='<TD CLASS="'+this.evenOdd(true)+'">'+cShopSumStyle[6]+':</TD>'
		out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[2])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[3])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[4])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[5])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[6])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[7])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		out+='<TD CLASS="'+this.evenOdd()+'">'+this.round(sum)+'</TD>'
		if(cShopStyle[9])out+='<TD CLASS="'+this.evenOdd()+'">'+this.round(this.toDM(sum))+'</TD>'
		if(cShopStyle[10])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[11])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[12])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		if(cShopStyle[13])out+='<TD CLASS="'+this.evenOdd()+'">&nbsp;</TD>'
		out+='</TR>'
	}
	out+='</TABLE>';
	}
	else
	{
		out=cWords["emptytray"];
	}
	
	if(isNN)out="Wegen schwerwiegenden Fehlern im Netscape Navigator<BR>kann es vorkommen, da&szlig; sich die Bestellliste<BR> weiter unten auf der Seite befindet.<BR>"+out;
	return out;
}

function _cShop_getHidden()
{
	if(this.form)
	{
		var x,y;
		this.hidden=new Array();
		for(x in this.items)
		{
			if(this.items[x].count)this.hidden[this.hidden.length]='<INPUT TYPE="hidden" VALUE="'+this.items[x].count+'" NAME="'+x+'">'
		}
		for(x in this.groups)
		{
			if(this.groups[x].count)
			{
				this.hidden[this.hidden.length]='<INPUT TYPE="hidden" VALUE="'+this.groups[x].count+'" NAME="'+x+'">'
				for(y in this.groups[x].items)
				{
					if(this.groups[x].items[y].count)this.hidden[this.hidden.length]='<INPUT TYPE="hidden" VALUE="'+this.groups[x].items[y].count+'" NAME="'+y+'">'
				}
			}
		}
		
		this.form.setHidden(this.hidden);
	}
}


function _cShop_info()
{
	this.hidden=new Array();
	var x,y,z,sum=0,csum=0;
	for(x in this.items)
	{
		if(this.items[x].count)
		{
			csum+=this.items[x].count;
			sum+=this.items[x].count*this.getPrice(this.items[x]);
			this.hidden[this.hidden.length]=parse(cWords['hidden'],'hid'+this.hidden.length,this.items[x].name,this.items[x].count,this.items[x].count*this.getPrice(this.items[x]));
		}
	}
	for(x in this.groups)
	{
		if(this.groups[x].count)
		{
			if(this.groups[x].type)
			{
				var gc=new Array();
				var gm=new Array();
				for(y in this.groups[x].items)
				{
					gc[y]=this.groups[x].items[y].count;
					if(this.groups[x].items[y].count)this.hidden[this.hidden.length]=parse(cWords['hidden'],'hid'+this.hidden.length,this.groups[x].items[y].name,this.groups[x].items[y].count,'');
				}
				for(y in this.groups[x].prices)gm[this.groups[x].prices[y].min]=this.groups[x].prices[y].price
				var ready=true,to=0,last,noff;
				while(ready)
				{
					to=noff=sum2=0;
					for(y in gc)
					{
						if(gc[y]>0)
						{
							noff+=this.getPrice(this.groups[x].items[y])
							gc[y]--
							last=y;
							to++
						}
					}
					csum+=ready=to;
					if(to>1)
					{
						sum+=_s=(to*gm[to]<noff)?to*gm[to]:noff
					}
					else if(to)sum+=_s=this.getPrice(this.groups[x].items[last])
					
					if(to)this.hidden[this.hidden.length]=parse(cWords['hidden'],'hid'+this.hidden.length,'H----->','['+to+']',_s);
				}
				

				
			}
			else
			{
				csum+=this.groups[x].count;
				sum+=this.groups[x].count*this.getPrice(this.groups[x]);
				for(y in this.groups[x].items)
				{
					this.hidden[this.hidden.length]=parse(cWords['hidden'],'hid'+this.hidden.length,this.groups[x].items[y].name,this.groups[x].items[y].count,this.getPrice(this.groups[x]));
				}
			}
		}
	}
	this.count=csum;
	
	if(this.infoPathNr>=0)
	{
		this.writeInfo(csum,sum)
	}
	ship=this.calcShipping()
	this.hidden[this.hidden.length]=parse(cWords['sum'],'hid'+this.hidden.length,sum,csum,ship);
	this.form.setHidden(this.hidden);
}

function _cShop_getUst(obj)
{
	if(obj.ust)return obj.ust;
	else return this.getUst(obj.parent);
}

function _cShop_getPrice(obj,count)
{
	var x;i=0
	count=count?count:obj.count
	for(x in obj.prices)
	{
		if(count>=obj.prices[x].min)i=x;
	}
	if(obj.prices.length)return obj.prices[i].price;
	else return this.getPrice(obj.parent);
}

function _cShop_writeInfo(itemcount,sum)
{
	var out=""
	if(this.stylesheet)
	{
		out+='<HEAD><LINK REL="stylesheet" TYPE="text/css" HREF="'+this.stylesheet+'"></HEAD>'
	}
	if(itemcount>0)
	{
		out+="<BODY CLASS='info'>"
		out+=parse(cWords["info"],itemcount,this.round(sum),this.round(this.toDM(sum)));
		out+="</BODY>"
		var doc=cObjPath.getTgtObj(this.infoPathNr).document
		doc.open();
		doc.write(out);
		doc.close();
	}
	else
	{
		if(this.infoEmpty)
		{
			cObjPath.getTgtObj(this.infoPathNr).location.href=this.infoEmpty;
		}
		else
		{
			out+="<BODY CLASS='info'>"
			out+=cWords["emptytray"];
			out+="</BODY>"
			var doc=cObjPath.getTgtObj(this.infoPathNr).document
			doc.open();
			doc.write(out);
			doc.close();
		}
	}
}

function _cShop_evenOdd(start)
{
	this.eo=(start)?start:!this.eo;
	return(this.eo)?"even":"odd";
}

function _cShop_sumUst(value,percent)
{
	var ust;
	if(!this.usts[percent])this.usts[percent]=0;
	ust=(value/(100+percent))*percent;
	this.usts[percent]+=ust;
	return ust;
}

function _cShop_calcUst(value,percent)
{
	return (value/(100+percent))*percent;
}

function _cShop_clearUst()
{
	this.usts=new Array();
}

function _cShop_toEURO(value)
{
	return value/this.EURO;
}

function _cShop_toDM(value)
{
	return value/this.DM;
}

function _cShop_round(value)
{
	var pos;
	value=(Math.round(value*100)/100).toString();
	pos=value.indexOf(".")
	if(pos>=0)
	{
		value=value.substr(0,pos)+","+value.substr(pos+1)
		if(pos==0)value="0"+value;
		else if(pos>=1)if(pos==(value.length-2))value+="0";
	}
	else value+=",-" 
	return value 
}

function _cShop_calcShipping()
{
	var ship=0,x,y,s;
	for(x in this.groups)
	{
		if(this.groups[x].count)
		{
			for(y in this.groups[x].items)
			{
				if(s=this.groups[x].items[y].shipping)ship+=s*this.groups[x].items[y].count;
				else if(s=this.groups[x].shipping)ship+=s*this.groups[x].count;
				else if(s=this.shipping)ship+=s*this.count;
				else if(s=this.shippingAll)return ship+s+this.shippingBase;	
			}
		}
	}
	for(x in this.items)
	{
		if(s=this.items[x].shipping)ship+=this.items[x].count*s;
		else if(s=this.shipping)ship+=s*this.count;
		else if(s=this.shippingAll)return ship+s+this.shippingBase;	
	}
	return ship+this.shippingBase
}

function cShop(pathNr,infoPathNr,EURO,DM,form,infoEmpty,shipping,shippingBase,shippingAll)
{
	this.count;
	this.EURO=EURO;
	this.DM=DM;
	this.pathNr=pathNr;
	this.infoPathNr=infoPathNr;
	this.ptrNr=cObjPtr.setPtr(this);
	this.form=form;
	this.items=new Array();
	this.groups=new Array();
	this.usts=new Array();
	this.infoEmpty=infoEmpty;
	this.shipping=(shipping)?shipping:0;
	this.shippingAll=(shippingAll)?shippingAll:0;
	this.shippingBase=(shippingBase)?shippingBase:0;
	this.addGroup=_cShop_addGroup;
	this.addItem=_cShop_addItem;
	this.getObj=_cShop_getObj;
	
	this.before='';
	this.after='';
	
	this.inc=_cShop_inc;
	this.dec=_cShop_dec;
	this.set=_cShop_set;
	this.get=_cShop_get;
	this.del=_cShop_del;

	this.info=_cShop_info;
	this.getHidden=_cShop_getHidden;
	this.tray=_cShop_tray;
	this.getTray=_cShop_getTray;

	this.calcShipping=_cShop_calcShipping;
	this.writeInfo=_cShop_writeInfo;
	this.getPrice=_cShop_getPrice;
	this.sumUst=_cShop_sumUst;
	this.getUst=_cShop_getUst;
	this.clearUst=_cShop_clearUst;
	this.calcUst=_cShop_calcUst;
	this.eo=false;
	this.evenOdd=_cShop_evenOdd;
	
	this.round=_cShop_round;
	this.toEURO=_cShop_toEURO;
	this.toDM=_cShop_toDM;

	this.stylesheet='';
}

function _cGroup_addPrice(min,price)
{
	this.prices[this.prices.length]= new _cPrice(min,price);
}

function _cGroup_addItem(name,HTML,ust,shipping)
{
	if(this.items[name])
	{
		this.parent.get(name);
	}
	else 
	{
		this.items[name]=new _cItem(name,HTML,ust,shipping)
		this.items[name].groupItem=true;
		this.items[name].parent=this;
	}
	return this.items[name]
}

function _cGroup_get(name)
{
	if(cObjPath.getTgtObj(this.parent.pathNr).document.forms["f_"+name])cObjPath.getTgtObj(this.parent.pathNr).document.forms["f_"+name]["i_"+name].value=this.parent.getObj(name).count;
}

function _cGroup(parent,HTML,type,ust,shipping)
{
	this.parent=parent;
	this.items=new Array();
	this.HTML=HTML
	this.count=0;
	this.prices=new Array();
	this.type=type;
	this.ust=ust;
	this.shipping=shipping;
	//this.get=_cGroup_get;
	this.addPrice=_cGroup_addPrice;
	this.addItem=_cGroup_addItem;
}

function _cItem_addPrice(min,price)
{
	this.prices[this.prices.length]= new _cPrice(min,price);
}

function _cItem(name,HTML,ust,shipping)
{
	this.parent=null;
	this.groupItem=false;
	this.name=name;
	this.HTML=HTML;
	this.ust=ust;
	this.shipping=shipping;
	this.count=0;
	this.prices=new Array();
	this.addPrice=_cItem_addPrice
}

function _cPrice(min,price)
{
	this.price=price;
	this.min=(min)?min:1;
}
