<!--

function openTab(container, tab)
{
	var tabButtonsContainer = $(container + 'Tabs'),
		tabButtons = tabButtonsContainer.getElementsByTagName('li'),
		tabContentsContainer = $(container + 'TabContainer'),
		tabContents = tabContentsContainer.getElementsByTagName('div');
	
	// change button classes
	for(var i=0; i<tabButtons.length; i++)
	{
		tabButtons[i].className = tabButtons[i].id == tab + 'Tab'
			? 'active'
			: '';
	}
	
	// change content visibility
	for(var i=0; i<tabContents.length; i++)
	{
		if(!tabContents[i].id || tabContents[i].id.substr(tabContents[i].id.length-8) != 'Contents')
			continue;
		
		tabContents[i].style.display = tabContents[i].id.substr(0, tab.length) == tab
			? ''
			: 'none';
	}
}

function checkProfileForm()
{
	var result = true;
	
	if($('strasse').value.length < 3)
	{
		$('strasse').className = 'inputErr';
		result = false;
	}
	if($('nr').value.length < 1)
	{
		$('nr').className = 'inputErr';
		result = false;
	}
	if($('plz').value.length < 3)
	{
		$('plz').className = 'inputErr';
		result = false;
	}
	if($('ort').value.length < 3)
	{
		$('ort').className = 'inputErr';
		result = false;
	}
	if($('email').value.length < 6)
	{
		$('email').className = 'inputErr';
		result = false;
	}
	
	if(!result)
		alert('Bitte prüfen Sie Ihre Eingaben in den rot markierten Feldern.');
	
	return(result);
}

function checkPrefsForm()
{
	var result = true;
	
	if($('pw1').value != $('pw2').value
		|| ($('pw1').value.length > 0 && $('pw1').value.length < 6))
	{
		$('pw1').className = 'inputErr';
		$('pw2').className = 'inputErr';
		result = false;
	}
	
	if(!result)
		alert('Bitte prüfen Sie Ihre Eingaben in den rot markierten Feldern.');
	
	return(result);
}

function openWindow(url, name, w, h, clean)
{
	var wa = (screen.width-w)/2;
	var l = 0;
	var ha = (screen.height-h)/2 - 60;
	var features;

	if(clean)
		features = 'scrollbars=no,scrolling=no,toolbar=no,statusbar=no,menubar=no,resizable=no,width='+w+',height='+h+',top=' + ha + ',left=' + wa;
	else
		features = 'scrollbars=yes,scrolling=yes,toolbar=no,statusbar=no,menubar=no,resizable=yes,width='+w+',height='+h+',top=' + ha + ',left=' + wa;

	var hwnd = window.open(url,name,features);
	return(hwnd);
}

function showInvoice(orderID)
{
	openWindow('/customers/orders/?action=showOrder&do=showInvoice&id=' + orderID, 'invoice'+orderID, 650, 680, false);
}

function toggleLicense(licenseID)
{
	var img = $('img'+licenseID),
		content = $('content'+licenseID);
	
	if(content.visible())
	{
		Effect.BlindUp('content'+licenseID, { duration: 0.5 });
		img.src = img.src.replace('contract', 'expand');
	}
	else
	{
		Effect.BlindDown('content'+licenseID, { duration: 0.5 });
		img.src = img.src.replace('expand', 'contract');
	}
}

function showLicenseKey(key, title)
{
	openWindow('/customers/licenses/?action=showKey&key=' + escape(key) + '&title=' + escape(title), 'key'+key, 450, 150, false);
}

function showDownloads(licenseID)
{
	openWindow('/customers/licenses/?action=showDownloads&id=' + licenseID, 'downloads'+licenseID, 640, 600, false);
}

function checkForumAccessForm()
{
	var result = true;
	
	if($('username').value.length < 2)
	{
		$('username').className = 'inputErr';
		result = false;
	}
	if($('password').value.length < 4)
	{
		$('password').className = 'inputErr';
		result = false;
	}
	
	if(!result)
		alert('Bitte prüfen Sie Ihre Eingaben in den rot markierten Feldern.');
	
	return(result);
}

function checkDomainForm()
{
	var result = true;
	
	if($('domain').value.length < 4)
	{
		$('domain').className = 'inputErr';
		result = false;
	}
	
	if(!result)
		alert('Bitte prüfen Sie Ihre Eingaben in den rot markierten Feldern.');
	
	return(result);
}

function checkShopProductForm(productID)
{
	var count = parseInt($('count'+productID).value),
		result = true;

	if(isNaN(count) || count <= 0 || count > 99)
	{
		$('count'+productID).className = 'inputErr';
		result = false;
	}

	if(!result)
		alert('Bitte prüfen Sie Ihre Eingaben in den rot markierten Feldern.');
	
	return(result);
}

function checkRequestForm()
{
	var result = true;
	
	if($('vorname').value.length < 2)
	{
		$('vorname').className = 'inputErr';
		result = false;
	}
	if($('nachname').value.length < 2)
	{
		$('nr').className = 'inputErr';
		result = false;
	}
	if($('email').value.length < 6)
	{
		$('email').className = 'inputErr';
		result = false;
	}
	if($('subject').value.length < 3)
	{
		$('subject').className = 'inputErr';
		result = false;
	}
	if($('text').value.length < 32)
	{
		$('text').className = 'inputErr';
		result = false;
	}
	
	if(!result)
		alert('Bitte prüfen Sie Ihre Eingaben in den rot markierten Feldern.');
	else
		$('submitButton').disabled = true;
	
	return(result);
}

function checkSubscribeForm()
{
	var result = true;
	
	if($('subscribeEMail').value.length < 6)
	{
		$('subscribeEMail').className = 'inputErr';
		result = false;
	}
	if($('subscribeFirstName').value.length < 2)
	{
		$('subscribeFirstName').className = 'inputErr';
		result = false;
	}
	if($('subscribeFirstName').value.length < 2)
	{
		$('subscribeLastName').className = 'inputErr';
		result = false;
	}
	
	if(!result)
		alert('Bitte prüfen Sie Ihre Eingaben in den rot markierten Feldern.');
	
	return(result);
}

function checkUnsubscribeForm()
{
	var result = true;
	
	if($('unsubscribeEMail').value.length < 6)
	{
		$('unsubscribeEMail').className = 'inputErr';
		result = false;
	}
	
	if(!result)
		alert('Bitte prüfen Sie Ihre Eingaben in den rot markierten Feldern.');
	
	return(result);
}

function checkTransferForm()
{
	var result = true;
	
	if($('customer_existing').checked)
	{
		if($('customer_no').value.length < 5)
		{
			$('customer_no').className = 'inputErr';
			result = false;
		}
		if($('customer_email').value.length < 6)
		{
			$('customer_email').className = 'inputErr';
			result = false;
		}
	}
	else
	{
		if($('vorname').value.length < 2)
		{
			$('vorname').className = 'inputErr';
			result = false;
		}
		if($('nachname').value.length < 2)
		{
			$('nachname').className = 'inputErr';
			result = false;
		}
		if($('strasse').value.length < 3)
		{
			$('strasse').className = 'inputErr';
			result = false;
		}
		if($('nr').value.length < 1)
		{
			$('nr').className = 'inputErr';
			result = false;
		}
		if($('plz').value.length < 3)
		{
			$('plz').className = 'inputErr';
			result = false;
		}
		if($('ort').value.length < 3)
		{
			$('ort').className = 'inputErr';
			result = false;
		}
		if($('email').value.length < 6)
		{
			$('email').className = 'inputErr';
			result = false;
		}
	}
	
	if(!result)
		alert('Bitte prüfen Sie Ihre Eingaben in den rot markierten Feldern.');
	
	return(result);
}

function ustidnrBoxUpdate(field)
{
	var box = $('ustidnrBox');
	
	if(field.value > 0 && field.value <= 26)
	{
		if(!box.visible())
			Effect.BlindDown('ustidnrBox', { duration: 0.5 });
	}
	else
	{
		if(box.visible())
			Effect.BlindUp('ustidnrBox', { duration: 0.5 });
	}
}

function checkOrderForm()
{
	var result = true;
	
	if($('vorname').value.length < 2)
	{
		$('vorname').className = 'inputErr';
		result = false;
	}
	if($('nachname').value.length < 2)
	{
		$('nachname').className = 'inputErr';
		result = false;
	}
	if($('strasse').value.length < 3)
	{
		$('strasse').className = 'inputErr';
		result = false;
	}
	if($('nr').value.length < 1)
	{
		$('nr').className = 'inputErr';
		result = false;
	}
	if($('plz').value.length < 3)
	{
		$('plz').className = 'inputErr';
		result = false;
	}
	if($('ort').value.length < 3)
	{
		$('ort').className = 'inputErr';
		result = false;
	}
	if($('email').value.length < 6)
	{
		$('email').className = 'inputErr';
		result = false;
	}
	
	if(!result)
		alert('Bitte prüfen Sie Ihre Eingaben in den rot markierten Feldern.');
	
	return(result);
}

//-->
