function checkmanual()
{
	if (document.forms.purchase.additional.checked)
	{
	document.forms.purchase.prodadd.value="Manual";
	}
	else
	{
	document.forms.purchase.prodadd.value=""
	}
}


function checkbuy()
{
	if (document.forms.purchase.prodver.value || document.forms.purchase.prodadd.value)
	{
		var productvers = document.forms.purchase.prodver.value;
		var registerproduct = document.forms.purchase.registerprod.value;
		
		if (productvers=="Pro")
		{
			if(registerproduct!="")
			{
				xolRegister('XaraXtremePro4',document.forms.purchase.registerprod.value);
			}
			else
			{
				//alert('XaraXtremePro4');
				//xolBuy('XaraXtremePro4');
				if (pagelang)
				{
					document.location='/'+pagelang+'/buy?'+VAR_XTREMEPRO_PRODUCTID;
				}
				else
				{
					document.location='/buy?'+VAR_XTREMEPRO_PRODUCTID;
				}
			}
		}
		else
		{
			//alert('XaraXtreme3_2'+document.forms.purchase.prodver.value+document.forms.purchase.prodadd.value);
			//xolBuy('XaraXtreme4');
			if (pagelang)
			{
				document.location='/'+pagelang+'/buy?'+VAR_XTREME_PRODUCTID;
			}
			else
			{
				document.location='/buy?'+VAR_XTREME_PRODUCTID;
			}		
		}
	}
	else
	{
	alert('Please select a product...');
	}
}


function changeBox(cbox) 
{
	box = eval(cbox);
	box.checked = !box.checked;	
	checkmanual();
}
var spanModes = new Object();
	
function registerSpan(id)
{
	spanModes[id] = false;
}

function toggleSpan(id)
{
	var mode = spanModes[id];
	
	if(mode==null) { mode = false; }
	
	mode = !mode;
	
	spanModes[id] = mode;
	
	var title = 'hide';
	var display = 'inline';
	var img = 'minus';
	
	if(!mode)
	{
		title = 'show';
		display = 'none';
		img = 'plus';
	}
	
	var titleSpan = document.getElementById(id + 'Title');
	var imgSpan = document.getElementById(id + 'Img');
	
	if(titleSpan!=null)
	{
		titleSpan.innerText = title;
	}
	
	if(imgSpan!=null)
	{
		imgSpan.src = '/img/global/' + img + '.gif';
	}
		
	document.getElementById(id + 'Span').style.display = display;		
}


registerSpan('box');
registerSpan('pbox');

function insert_price(pboxdollar,boxdollar,showstd,showpro,showcross)
{
	document.getElementById('pboxPrice').innerHTML = pboxdollar;
	document.getElementById('boxPrice').innerHTML = boxdollar;
	
	if (showstd!=0 || showpro!=0)
	{
		document.getElementById('step2').style.display = 'block';
		document.getElementById('step2titles').style.display = 'block';
		document.getElementById('step3').style.display = 'block';
	}
	else
	{
		document.getElementById('step2').style.display = 'none';
		document.getElementById('step2titles').style.display = 'none';
		document.getElementById('step3').style.display = 'none';
	}			
	
	if (showstd)
	{
		document.getElementById('step2stdbox').style.display = 'block';
	}
	else
	{
		document.getElementById('step2stdbox').style.display = 'none';
	}
	
	if (showpro)
	{
		document.getElementById('step2pro').style.display = 'block';
	}
	else
	{
		document.getElementById('step2pro').style.display = 'none';
	}	
	
	if (showcross)
	{
		document.getElementById('step4').style.display = 'block';
		document.getElementById('step3').style.display = 'none';
	}
	else
	{
		document.getElementById('step4').style.display = 'none';
	}	
	
}


function check_total(langcode)
{
	if (document.forms.purchase.version[1].checked)
	{
		var prodtotal = document.getElementById('boxPrice').innerHTML;
	}
	else if (document.forms.purchase.version[0].checked)
	{
		var prodtotal = document.getElementById('pboxPrice').innerHTML;
	}
	else
	{
		var prodtotal = '0';
	}

	var extrastotal = '0';

	ordertotal = parseInt(prodtotal,10) + parseInt(extrastotal,10);
	if (ordertotal)
	{
		convert(ordertotal,langcode);
	}
	else
	{
		alert('Please select a product...');
	}
	
}