function xToNumeric(o)
{
	o.value = eval( o.value * 1 )
	if (o.value=="NaN")
		o.value = 0;
	return true;
}

function bildgross( cidlupe, cidziel )
{
var cx;

	o = document.getElementById( cidziel );
	olupe = document.getElementById( cidlupe );

	cx = o.src;
	cx = cx.toLowerCase();
	//alert(cx);
	if (cx.search( "klein.jpg" ) > 0) {
		o.src = cx.replace( "klein.", "gross." );
		if (olupe != null) {
			olupe.src = "../images/lupe_minus.gif";
		}
	}
	else {
		o.src = cx.replace( "gross.", "klein." );
		if (olupe != null) {
			olupe.src = "../images/lupe_plus.gif";
		}
	}
}

function updownmenge(x,cidziel,ncount,lover)
{
var o;
var nx;

	if (cidziel != null)
	{
		o = document.getElementById( cidziel );
		nx = o.value * 1;
		nx += ncount;
		if (nx<=0) {
			nx = "";
		}
		o.value = nx;
	}

	if (lover==1)
	{
		if (ncount>0)
		{
			x.src = "../images/pfeil_up_red.gif";
		}
		else if (ncount<0)
		{
			x.src = "../images/pfeil_down_red.gif";
		}
	}
	else
	{
		if (ncount>0)
		{
			x.src = "../images/pfeil_up.gif";
		}
		else if (ncount<0)
		{
			x.src = "../images/pfeil_down.gif";
		}
	}
return true;
}
function focusrc(x,infocus)
{ //v2.0
var nrows;
var ncols;
var i,j;
var o;
var cid;
var nCodeA;

	cid = x.id;
//	if ( cid.substr(0,1)=="A" || (cid.substr(1,1)=="1" && cid.length == 2) ) //(cid == "A1")
//		return false;

	for (i=1;i<=100;i++)
	{
		o = document.getElementById("A"+i);
		if (o==null)
		{
			nrows=i;
			i=1000;
		}
	}

	for (i=1;i<=100;i++)
	{
		o = document.getElementById( String.fromCharCode(64+i)+"3" );
		if (o==null)
		{
			ncols=i;
			i=1000;
		}
	}
	ncols--;
	
	for (j=1;j<=ncols;j++)
	{
		if ( cid.substr(1,2) != "1" )
		{
			if (infocus==1)
			{
				if (j==1)
				{
					document.getElementById( String.fromCharCode(64+j)+cid.substr(1,2) ).className="td_in_cap_left";	
				}
				else
				{
					document.getElementById( String.fromCharCode(64+j)+cid.substr(1,2) ).className="td_in";	
				}
			}
			else
			{
				if (j==1)
				{
					document.getElementById( String.fromCharCode(64+j)+cid.substr(1,2) ).className="td_out_cap_left";	
				}
				else
				{
					document.getElementById( String.fromCharCode(64+j)+cid.substr(1,2) ).className="td_out";	
				}
			}
		}
	}
	for (i=1;i<nrows;i++)
	{
		if ( cid.substr(0,1) != "A" )
		{
			if (infocus==1)
			{
				if (i==1)
				{
					document.getElementById( cid.substr(0,1)+i ).className="td_in_cap";	
				}
				else
				{
					document.getElementById( cid.substr(0,1)+i ).className="td_in";	
				}
			}
			else
			{
				if (i==1)
				{
					document.getElementById( cid.substr(0,1)+i ).className="td_out_cap";	
				}
				else
				{
					document.getElementById( cid.substr(0,1)+i ).className="td_out";	
				}
			}
		}
	}

	if ( cid.substr(0,1)=="A" || (cid.substr(1,1)=="1" && cid.length == 2) ) //(cid == "A1")
		return true;

	if (infocus==1)
	{
		x.className="td_focus";
	}
	
	return true;
}

function stod(csd) {
	var cret;
	csd = String(csd);
	cret = csd.substr(6,2)+"."+csd.substr(4,2)+"."+csd.substr(0,4);
	return cret;
}

function validateform( cname, cpflichtfelder ) {
	var colorstd = "#ffffff";
	var colorpflicht = "#E8AFC0";
	var aktpflicht;
	var cx;
	var nlen;
	var oform;
	var i;

	oform = document.forms[cname]; 	
	nlen = oform.elements.length;

	for ( i = 0; i < nlen; i++ )
	{
		lx = true;
		cx = oform.elements[i].name;
		
		if ( (oform.elements[i].value.length == 0 || oform.elements[i].value == '-') || ( oform.elements[i].type == "radio" && !IsRadioValue(oform.elements[cx]) ) ) 
		{
			if ( cpflichtfelder.indexOf(cx) > 0 )
			{
				oform.elements[i].style.backgroundColor = colorpflicht;
				if ( aktpflicht == null )
				{
					aktpflicht = oform.elements[i];
				}
			}
		}
		else
		{
			oform.elements[i].style.backgroundColor = colorstd;
		}
		
		if (cx == "email")
		{
			oform.cwFromAdress.value = oform.elements[i].value;
		}
		
	}

	if ( aktpflicht != null )
	{
		aktpflicht.focus();
		return false;
	}

return true;
}
function IsRadioValue( oradio ) {
	for( i = 0; i < oradio.length; i++ ) {
		if( oradio[i].checked == true )
			return true;
	}
	return false;
}

var titellength = 0;
var delay = 5;
function titeltext(cx)
{
	setTimeout( "titeltext2("+"'"+cx+"'"+")", 0 );
}

var titelpos = 300;
function titeltext2(cx)
{
	if ( titelpos > 267 )
	{
		titelpos--;
		delay+=2;
		document.getElementById('titelback').style.top = titelpos+'px';
		setTimeout( "titeltext2("+"'"+cx+"'"+")", delay );
	}
	else
	{
		setTimeout( "licht()", 6500 );
	}
}

var nlicht = 1;
var iindex = 0;
function licht()
{
	iindex += 10;
	document.getElementById('titelback').style.zIndex = iindex;
	setTimeout( "licht()", 6000 )
}

