lastOpenedList = '';

function setInpSelVis( divId )
{
	oDiv = document.getElementById( divId );
	if( oDiv.style.visibility == 'visible' )
	{
		oDiv.style.visibility = 'hidden';
	}
	else
	{
		if( lastOpenedList != '' )
		{
			document.getElementById( lastOpenedList ).style.visibility = 'hidden';
		}
		oDiv.style.visibility = 'visible';
		lastOpenedList = divId;
	}
}

function setInpSelVal( inpValue, inpId, divId )
{
	document.getElementById( inpId ).value = inpValue;
	document.getElementById( divId ).style.visibility = 'hidden';
}

function sendBestellen( txt, txt2, infoTxt )
{
	ok = 1;
	ok2 = 1;
	req = Array( 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1 );
	for( var i = 0; i <= 10; i++ )
	{
		if( req[i] == 1 )
		{
			oInp = document.getElementById( 'cdata'+i );
			if( oInp.value == '' )
			{
				ok = 0;
				oInp.style.border = 'solid #ff0000 1px';
			}
			else
			{
				oInp.style.border = 'solid #aaaaaa 1px';
			}
		}
	}
	for( var i = 1; i <= 5; i++ )
	{
		oInp = document.getElementById( 'file'+i );
		if( oInp.value != '' )
		{
			fVal = oInp.value;
			re = /.*((\.dxf)|(\.dwg))$/ig;
			if( fVal.match( re ) )
			{
				oInp.style.border = 'solid #aaaaaa 1px';
			}
			else
			{
				ok2 = 0;
				oInp.style.border = 'solid #ff0000 1px';
			}
		}
	}
	oArtnr = document.getElementById( 'artnr' );
	if( oArtnr.value == '' )
	{
		ok = 0;
		oArtnr.style.border = 'solid #ff0000 1px';
	}
	else
	{
		oArtnr.style.border = 'solid #aaaaaa 1px';
	}
	oMontpl = document.getElementById( 'montpl' );
	if( oMontpl.value == '' )
	{
		ok = 0;
		oMontpl.style.border = 'solid #ff0000 1px';
	}
	else
	{
		oMontpl.style.border = 'solid #aaaaaa 1px';
	}
	oStck = document.getElementById( 'stck' );
	if( oStck.value == '' )
	{
		ok = 0;
		oStck.style.border = 'solid #ff0000 1px';
	}
	else
	{
		oStck.style.border = 'solid #aaaaaa 1px';
	}
	oRal = document.getElementById( 'ral' );
	if( oRal.value == '' )
	{
		ok = 0;
		oRal.style.border = 'solid #ff0000 1px';
	}
	else
	{
		oRal.style.border = 'solid #aaaaaa 1px';
	}
	if( ( ok == 1 ) && ( ok2 == 1 ) )
	{
		if( confirm( infoTxt ) )
		{
			document.getElementById( 'insertsearch' ).submit();
		}
	}
	else
	{
		txtToShow = '';
		if( ok == 0 )
		{
			txtToShow += txt;
		}
		if( ok2 == 0 )
		{
			if( ok == 0 )
			{
				txtToShow += "\n";
			}
			txtToShow += txt2;
		}
		alert( txtToShow );
	}
}


