function myround(zahl,stellen)
{
	shifter=Math.pow(10,stellen)
	dummy=String(Math.round(zahl*shifter)/shifter);
//	alert(dummy+"\n"+dummy.search(/.+\.../)+"\n"+dummy.indexOf(".")+"\n"+dummy.length);
	if (dummy.search(/.+\.../)==-1)
	{
		if (dummy.indexOf(".")==-1)
		{
			dummy=dummy+".";
		}
		while ( (dummy.indexOf(".")) >= (dummy.length-stellen) )
		{
			dummy=dummy+"0";
		}
//		alert(dummy);
	}
	return dummy;
}

function yep()
{
	alert('Dieser Artikel ist zur Zeit lieferbar.');
}

function nope()
{
	alert('Dieser Artikel ist zur Zeit nicht lieferbar.\nDer dort angegebene Preis ist der letzgültige Preis für dieses Produkt\nund somit nur ein Richtpreis!');
}

function intowk(def)
{
	dummy=def.split("_");
	_hgr=eval(dummy[0]);
	_ugr=eval(dummy[1]);
	_art=eval(dummy[2]);
	def="menge_"+def;
	_menge=document.shopform[def].value;
	window.top.artikel[_hgr][_ugr][_art]=eval(_menge);
	window.top.main.shopwk.wkrefresh();
	alert(_menge+" Stk. "+window.top.artikel[_hgr][_ugr][_art-4]+" wurden in den Warenkorb gelegt");
}

function buildugr()
{
	for (u=1; u<window.top.artikel[window.top.hgr].length; u++)
	{
		if (window.top.artikel[window.top.hgr][u].length>1)
		{
			if (window.top.artikel[window.top.hgr][u][0]!="")
			{
				document.writeln('							<tr>');
				document.writeln('								<TD background="/rcs/ttl.gif"><a name="'+u+'"></a><img src="/rcs/_blind.gif" width=650 height=1><br>');
				document.writeln('									<b>&nbsp;&raquo; '+window.top.artikel[window.top.hgr][u][0]+'</b>');
				document.writeln('								</td>');
				document.writeln('							</tr>');
			}

			document.writeln('							<tr>');
			document.writeln('								<td>');
			document.writeln('									<table width=645 cellspacing=0 cellpadding=0 border=1>');
			document.writeln('										<tr>');
			document.writeln('											<td><p>Artikel</p></td>');
			document.writeln('											<td><p>Beschreibung</p></td>');
			document.writeln('											<td><p>EUR</p></td>');
			document.writeln('											<td><p>BILD</p></td>');
			document.writeln('											<td><p>Menge</p></td>');
			document.writeln('										</tr>');

			a=1;
			while (a<window.top.artikel[window.top.hgr][u].length)
			{
				document.writeln('										<tr>');
				document.writeln('											<td width=150><p class=smallleft>'+window.top.artikel[window.top.hgr][u][a+1]+'</p></td>');
				document.writeln('											<td width=240><p class=smallleft>'+window.top.artikel[window.top.hgr][u][a+2]+'&nbsp;</p></td>');
				document.writeln('											<td width=45><nobr><p class=smallright>'+myround(window.top.artikel[window.top.hgr][u][a+3],2)+'</nobr></p></td>');
				document.writeln('											<td width=50><a href="http://ec.ingrammicro.de/JPG/'+window.top.artikel[window.top.hgr][u][a+4]+' "target=fenster2 ><img src="http://ec.ingrammicro.de/JPG/'+window.top.artikel[window.top.hgr][u][a+4]+'" border="0"  height="50" ></a></td>');
				document.writeln('											<td width=60>');
				document.writeln('												<table>');
				document.writeln('													<tr>');
//				alert(window.top.artikel[window.top.hgr][u][a+0]);
				if (window.top.artikel[window.top.hgr][u][a+0]=="N")
				{
					document.writeln('														<td><a class=small href="javascript:nope();"><img src="x.gif" border=0></a></td>');
				}
				else
				{
					document.writeln('														<td><a class=small href="javascript:yep();"><img src="hakerl.gif" border=0></a></td>');
				}
				document.writeln('														<td><input name="menge_'+window.top.hgr+'_'+u+'_'+eval(a+5)+'" value="'+window.top.artikel[window.top.hgr][u][a+5]+'" size=2 maxlength=3></td>');
				document.writeln('														<td><a class=small href="javascript:intowk(\''+window.top.hgr+'_'+u+'_'+eval(a+5)+'\')"><b>&raquo; wählen</b></a></td>');
				document.writeln('													</tr>');
				document.writeln('												</table>');
				document.writeln('											</td>');
				document.writeln('										</tr>');
				a=a+7;
			}
			document.writeln('									</table><br><br>');
			document.writeln('								</td>');
			document.writeln('							</tr>');
		}
	}
}