
function showLogin(i_sectionNumber)
{
	var o_link1 = document.getElementById('linkLogin');
	var o_link2 = document.getElementById('linkRegister');
	var o_link3 = document.getElementById('linkForgot');

	var o_section1 = document.getElementById('containerLogin');
	var o_section2 = document.getElementById('containerRegister');
	var o_section3 = document.getElementById('containerForgot');

	o_section1.style.display = (i_sectionNumber == 1) ? 'block' : 'none';
	o_section2.style.display = (i_sectionNumber == 2) ? 'block' : 'none';
	o_section3.style.display = (i_sectionNumber == 3) ? 'block' : 'none';

	var o_input1 = document.getElementById('formLogin').comp;
	var o_input2 = document.getElementById('formRegister').inputName;
	var o_input3 = document.getElementById('formForgot').knr;

	if (i_sectionNumber == 1) o_input1.focus();
	if (i_sectionNumber == 2) o_input2.focus();
	if (i_sectionNumber == 3) o_input3.focus();
	
	window.scrollTo(0,0);
	
	try
	{
		o_link1.setAttribute('class', (i_sectionNumber == 1) ? 'bubbleLinkActive' : '');
		o_link2.setAttribute('class', (i_sectionNumber == 2) ? 'bubbleLinkActive' : '');
		o_link3.setAttribute('class', (i_sectionNumber == 3) ? 'bubbleLinkActive' : '');
	}
	catch (error)
	{
	}
	
	try
	{
		o_link1.setAttribute('className', (i_sectionNumber == 1) ? 'bubbleLinkActive' : '');
		o_link2.setAttribute('className', (i_sectionNumber == 2) ? 'bubbleLinkActive' : '');
		o_link3.setAttribute('className', (i_sectionNumber == 3) ? 'bubbleLinkActive' : '');
	}
	catch (error)
	{
	}
}

function submitUpdate()
{
	document.getElementById('updateForm').submit();
}

function clickedPatternList()
{
	var o_patternList = document.getElementById('patternList');
	var o_imageDiv = document.getElementById('articlePatternHolder');
	var o_formElement = document.getElementById('pattern');
	
	if ((o_imageDiv != null) && (o_patternList != null))
	{
		var s_imageValue = o_patternList.options[o_patternList.selectedIndex].value;
		var s_imageText = o_patternList.options[o_patternList.selectedIndex].text;
		o_imageDiv.innerHTML = '<img src="' + 'WigesPict/' + s_imageValue + '" alt="" width="250px" onmouseover="return overlib(\'<img src=&quot;' + 'WigesPict/' + s_imageValue + '&quot; alt=&quot;&quot;/>\', ABOVE)" onMouseOut="nd()"/>';
		o_formElement.value = s_imageText;
	}
}

function clickedUpdate()
{
	var o_cartForm = document.getElementById('cartForm');
	o_cartForm.submit();
}

function clickedDelete()
{
	var o_cartForm = document.getElementById('cartPost');
	o_cartForm.page.value = '15';
	o_cartForm.action.value = 'cart.delete';
	o_cartForm.submit();
}

function clickedSubmit()
{
	var o_cartForm = document.getElementById('cartPost');
	o_cartForm.action.value = '';
	o_cartForm.page.value = '16';
	o_cartForm.submit();
}

function clickedBackCart()
{
	var o_orderForm = document.getElementById('orderForm');
	o_orderForm.action.value = '';
	o_orderForm.page.value = '15';
	o_orderForm.submit();
}

function clickedDeleteRow(s_rowName)
{
	var o_orderRow = document.getElementById(s_rowName);
	o_orderRow.style.display = 'none';
	o_orderRow.value = '0';
	clickedUpdate();	
}

function clickedOtherPattern(s_artNum)
{
	top.location.href = 'Servlet?page=11&anr=' + s_artNum;
}

function clickedRegisterType(i_type)
{
	var o_form = document.getElementById('formRegister');
	
	o_form.inputCustomer.disabled		= (i_type == 0);
	o_form.inputOrganisation.disabled	= (i_type == 1);
	o_form.inputAddress1.disabled 		= (i_type == 1);
	o_form.inputAddress2.disabled 		= (i_type == 1);
	o_form.inputCity.disabled 			= (i_type == 1);
	o_form.inputQuestion.disabled 		= (i_type == 1);

	o_form.inputCustomer.className 		= (i_type == 0) ? 'inputTextDisabled' : 'inputText';
	o_form.inputOrganisation.className 	= (i_type == 1) ? 'inputTextDisabled' : 'inputText';
	o_form.inputAddress1.className 		= (i_type == 1) ? 'inputTextDisabled' : 'inputText';
	o_form.inputAddress2.className 		= (i_type == 1) ? 'inputTextDisabled' : 'inputText';
	o_form.inputCity.className 			= (i_type == 1) ? 'inputTextDisabled' : 'inputText';
	o_form.inputQuestion.className 		= (i_type == 1) ? 'inputTextDisabled' : 'inputText';

	o_form.inputCustomer.value 			= (i_type == 0) ? '' : o_form.inputCustomer.value;
	o_form.inputOrganisation.value 		= (i_type == 1) ? '' : o_form.inputOrganisation.value;
	o_form.inputAddress1.value 			= (i_type == 1) ? '' : o_form.inputAddress1.value;
	o_form.inputAddress2.value 			= (i_type == 1) ? '' : o_form.inputAddress2.value;
	o_form.inputCity.value 				= (i_type == 1) ? '' : o_form.inputCity.value;
	o_form.inputQuestion.value 			= (i_type == 1) ? '' : o_form.inputQuestion.value;
	
	checkRegisterForm();
	o_form.inputName.focus();
}

function clickedCatalogueType(i_type)
{
	var o_form = document.getElementById('catalogueForm');
	o_form.inputCustomer.disabled  = (i_type == 0);
	o_form.inputCustomer.className = (i_type == 0) ? 'inputTextDisabled' : 'inputText';
	o_form.inputCustomer.value	   = (i_type == 0) ? '' : o_form.inputCustomer.value;
	checkCatalogueForm();
	o_form.inputName.focus();
}

function checkCatalogueForm()
{
	var b_isReady = true;
	var o_form = document.getElementById('catalogueForm');

	b_isReady = b_isReady && (o_form.inputName.value.length > 0);
	b_isReady = b_isReady && (o_form.inputCompany.value.length > 0);
	b_isReady = b_isReady && (o_form.inputMail.value.length > 0);
	b_isReady = b_isReady && (o_form.inputTelephone.value.length > 0);

	if (document.getElementById('inputOrganisation') != null)
	{
		b_isReady = b_isReady && (o_form.inputOrganisation.value.length > 0);
		b_isReady = b_isReady && (o_form.inputAddress1.value.length > 0);
		b_isReady = b_isReady && (o_form.inputAddress2.value.length > 0);
		b_isReady = b_isReady && (o_form.inputCity.value.length > 0);
		b_isReady = b_isReady && (o_form.inputQuestion.value.length > 0);

		if (!o_form.inputCustomer.disabled)
		{
			b_isReady = b_isReady && (o_form.inputCustomer.value.length > 0);
		}
	}

	document.getElementById('catalogueSubmit').disabled = !b_isReady;
	document.getElementById('catalogueSubmit').className = b_isReady ? 'inputButton' : 'inputButtonDisabled';
}

function checkRegisterForm()
{
	var b_isReady = true;
	var o_form = document.getElementById('formRegister');

	b_isReady = (o_form.inputName.disabled)			? b_isReady : b_isReady && (o_form.inputName.value.length > 0);
	b_isReady = (o_form.inputCompany.disabled)		? b_isReady : b_isReady && (o_form.inputCompany.value.length > 0);
	b_isReady = (o_form.inputMail.disabled)			? b_isReady : b_isReady && (o_form.inputMail.value.length > 0);
	b_isReady = (o_form.inputTelephone.disabled)	? b_isReady : b_isReady && (o_form.inputTelephone.value.length > 0);
	b_isReady = (o_form.inputCustomer.disabled)		? b_isReady : b_isReady && (o_form.inputCustomer.value.length > 0);
	b_isReady = (o_form.inputOrganisation.disabled)	? b_isReady : b_isReady && (o_form.inputOrganisation.value.length > 0);
	b_isReady = (o_form.inputAddress1.disabled) 	? b_isReady : b_isReady && (o_form.inputAddress1.value.length > 0);
	b_isReady = (o_form.inputAddress2.disabled) 	? b_isReady : b_isReady && (o_form.inputAddress2.value.length > 0);
	b_isReady = (o_form.inputCity.disabled) 		? b_isReady : b_isReady && (o_form.inputCity.value.length > 0);
	b_isReady = (o_form.inputQuestion.disabled) 	? b_isReady : b_isReady && (o_form.inputQuestion.value.length > 0);

	document.getElementById('registerSubmit').disabled = !b_isReady;
	document.getElementById('registerSubmit').className = b_isReady ? 'inputButton' : 'inputButtonDisabled';
}

function checkTextBox()
{
	var o_textBox = document.getElementById('inputTextBox');
	if (o_textBox.value.length > 50)
	{
		o_textBox.value = o_textBox.value.substring(0, 50);
	}
}