function CheckColor(sender, e)
{
	if( document.forms[0].rblArticleColor == null )
	{
		e.IsValid = false;
	}
	else
	{
		if( document.forms[0].rblArticleColor.length == null )
		{
			e.IsValid = document.forms[0].rblArticleColor.checked;
		}
		else
		{
			var checked = false;
			for (var i=0; i<document.forms[0].rblArticleColor.length; i++)
				if( document.forms[0].rblArticleColor[i].checked )
					checked = true;
			e.IsValid = checked;
		}
	}
}

function Voucher_CheckOptionSelected(sender, e)
{
	var checked = false;
	
	for(var i=0; i<document.forms[0].rbStandardCombination.length; i++)
		if( document.forms[0].rbStandardCombination[i].checked )
			checked = true;
	
	e.IsValid = checked;	
}

function Voucher_CheckMaxValue(sender, e)
{
	if( document.forms[0].rbStandardCombination[document.forms[0].rbStandardCombination.length-1].checked )
	{
		var price = 0;
		price    += Voucher_GetOptionValue('ctl00_cphMainContent_txtQuantity_750', 750);
		price    += Voucher_GetOptionValue('ctl00_cphMainContent_txtQuantity_1000', 1000);
		price    += Voucher_GetOptionValue('ctl00_cphMainContent_txtQuantity_1250', 1250);
		price    += Voucher_GetOptionValue('ctl00_cphMainContent_txtQuantity_1500', 1500);
		price    += Voucher_GetOptionValue('ctl00_cphMainContent_txtQuantity_2000', 2000);
		price    += Voucher_GetOptionValue('ctl00_cphMainContent_txtQuantity_2500', 2500);
		
		e.IsValid = (price <= 5000);
	}
	else
	{	//Standard combination. Allways correct
		e.IsValid = true;
	}
}

function Voucher_CheckNulValue(sender, e)
{
	if( document.forms[0].rbStandardCombination[document.forms[0].rbStandardCombination.length-1].checked )
	{
		var price = 0;
		price    += Voucher_GetOptionValue('ctl00_cphMainContent_txtQuantity_750', 750);
		price    += Voucher_GetOptionValue('ctl00_cphMainContent_txtQuantity_1000', 1000);
		price    += Voucher_GetOptionValue('ctl00_cphMainContent_txtQuantity_1250', 1250);
		price    += Voucher_GetOptionValue('ctl00_cphMainContent_txtQuantity_1500', 1500);
		price    += Voucher_GetOptionValue('ctl00_cphMainContent_txtQuantity_2000', 2000);
		price    += Voucher_GetOptionValue('ctl00_cphMainContent_txtQuantity_2500', 2500);
		
		e.IsValid = (price > 0);
	}
	else
	{	//Standard combination. Allways correct
		e.IsValid = true;
	}
}

function Voucher_GetOptionValue(option, value)
{
	if( document.getElementById(option).value != '' && document.getElementById(option).value != '0' )
		return parseInt(document.getElementById(option).value ,10) * value;
	else
		return 0;
}