// define referral source details
var DefaultSelected = [];
var Tradeshow = ['DCGS',
				  'DISA',
				  'FTC',
				  'JavaOne',
				  'Microsoft Developer Conf',
				  'Other',
				  'Platform User Conf',
				  'QCon',
				  'SIFMA',
				  'SOA on Wall Street',
				  'Software 2008',
				  'Street#Grid'];
var WebSearch = ['Google',
				  'Other',
				  'Yahoo'];
var CustomerReferral = [];
var PartnerReferral	 = ['Accenture',
						'BEA',
						'CCK Financial Solutions',
						'Cincom',
						'Codemesh',
						'Confinti Solutions',
						'Data Synapse',
						'DataDirect',
						'Elind',
						'Exolab.org',
						'IBM',
						'ILOG',
						'Intel',
						'Merlin',
						'NIWS',
						'ObjectWave',
						'Platform Computing',
						'Raba Technologies',
						'Rogue Wave',
						'SES',
						'SolarMetric',
						'Sun Microsystems',
						'Talentain',
						'TechSIG',
						'The Apache Jakarta Project',
						'VSi',
						'XML:DB'];
var GemStoneEmployee = [];	
var ArticlePR	= [];

var referralSourceDetails = ['',Tradeshow,WebSearch,CustomerReferral,PartnerReferral,GemStoneEmployee,ArticlePR];

function selectReferralDetail()
{
	var el = document.getElementById('ReferralSource');
	var referralSource = el.options[el.selectedIndex].value;
	var detailsArray = referralSourceDetails[el.selectedIndex];
	var referralDetail = document.getElementById('referral_detail');
	if (el.selectedIndex == 0)
	{
		referralDetail.style.display = 'none';
		document.getElementById('referral_detail_other').style.display = 'none';
	}
	else if (detailsArray.length == 0)
	{
		referralDetail.style.display = 'none';
		document.getElementById('referral_detail_other_text').innerHTML = referralSource;
		document.getElementById('referral_detail_other').style.display = 'block';
	}
	else
	{
		var optionList = document.getElementById('ReferralSourceDetail');
		
		optionList.options.length = 0;

		for (i=0;i<detailsArray.length;i++)
		{
			optionList.options[i] = new Option(detailsArray[i], detailsArray[i], false, false);
		}
		
		document.getElementById('referral_detail_text').innerHTML = referralSource;
		document.getElementById('referral_detail_other').style.display = 'none';
		referralDetail.style.display = 'block';
	}
}

function selectReferralOther()
{
	var el = document.getElementById('ReferralSource');
	var referralSource = el.options[el.selectedIndex].value;

	var el2 = document.getElementById('ReferralSourceDetail');

	if (el2.options[el2.selectedIndex].value == 'Other')
	{
		document.getElementById('referral_detail_other_text').innerHTML = 'Other ' + referralSource;
		document.getElementById('referral_detail_other').style.display = 'block';
	}
	else
	{
		document.getElementById('referral_detail_other').style.display = 'none';
	}
}

function show_sla(formObj)
{
	var txt = '<p class="content2">Before you download this product, you must accept the terms of the ';
	txt += '<a href="/pdf/SLA.pdf" target="_blank">software license agreement</a>.</p>';
	txt += '<form name="form_sla" method="post" action="">';
	txt += '  <div align="center">';
	txt += '    <input type="button" value="I accept the terms of the Software License Agreement" onClick="' + formObj.name + '.submit();Control.Modal.close();">';
	txt += '    <p><a class="content2" href="#" onclick="Control.Modal.close();return false;">Close this window</a></p>';
	txt += '  </div>';
	txt += '</form>';
	
	m = new Control.Modal(false,{  
		opacity: 0.5,
		contents: function() {  
			return txt;  
		}  
	});  
	m.open();
}