function SelComponents(theForm)
{		
	/* Components Module */
	
	if(document.frmConfigure.Components[0].checked)
	{	
		document.getElementById('SystemController').style.display = "block";
	}
	else
	{		
		document.getElementById('SystemController').style.display = "none";
	}
	if(document.frmConfigure.Components[1].checked)
	{		
		document.getElementById('SystemProcessing').style.display = "block";
	}
	else
	{
		document.getElementById('SystemProcessing').style.display = "none";
	}
	if(document.frmConfigure.Components[2].checked)
	{
		document.getElementById('SystemInterfaces').style.display = "block";
	}
	else
	{
		document.getElementById('SystemInterfaces').style.display = "none";
		document.getElementById('SystemGraphics').style.display = "none";
		document.getElementById('SystemSwitches').style.display = "none";
		document.getElementById('SystemDatacom').style.display = "none";
		document.getElementById('SystemStorage').style.display = "none";		
	}	
	
	/* InterFace Module */
	if(document.frmConfigure.Interfaces[0].checked)
	{		
		document.getElementById('SystemGraphics').style.display = "block";
	}
	else
	{		
		document.getElementById('SystemGraphics').style.display = "none";
	}
	
	if(document.frmConfigure.Interfaces[1].checked)
	{	
		document.getElementById('SystemSwitches').style.display = "block";
	}
	else
	{		
		document.getElementById('SystemSwitches').style.display = "none";
	}
	
	if(document.frmConfigure.Interfaces[2].checked)
	{	
		document.getElementById('SystemDatacom').style.display = "block";
	}
	else
	{		
		document.getElementById('SystemDatacom').style.display = "none";
	}
	
	if(document.frmConfigure.Interfaces[3].checked)
	{	
		document.getElementById('SystemStorage').style.display = "block";
	}
	else
	{		
		document.getElementById('SystemStorage').style.display = "none";
	}
	
	
	/* Datacom Platform Combo box */
	var $datacom;
	$datacom=document.getElementById('cboDataPlatform').value;
	if($datacom == '6U-VME')
	{
		document.getElementById('DatacomVME').style.display = "block";
		document.getElementById('DatacomPMC').style.display = "none";
		document.getElementById('DatacomXMC').style.display = "none";
		document.getElementById('datacomtype').style.display = "block";
	}
	else if($datacom == 'PMC')
	{
		document.getElementById('DatacomVME').style.display = "none";
		document.getElementById('DatacomPMC').style.display = "block";
		document.getElementById('DatacomXMC').style.display = "none";
		document.getElementById('datacomtype').style.display = "block";
	}
	else if($datacom == 'XMC')
	{
		document.getElementById('DatacomVME').style.display = "none";
		document.getElementById('DatacomPMC').style.display = "none";
		document.getElementById('DatacomXMC').style.display = "block";
		document.getElementById('datacomtype').style.display = "block";
	}
	else
	{
		document.getElementById('DatacomVME').style.display = "none";
		document.getElementById('DatacomPMC').style.display = "none";
		document.getElementById('DatacomXMC').style.display = "none";
		document.getElementById('datacomtype').style.display = "none";
	}
		
	/* Storage Interface Platform */	
	/* Datacom Platform Combo box */
	var $storage;
	$storage=document.getElementById('StorageMedium').value;
	if($storage == 'RAID')
	{		
		document.getElementById('StorageRaid').style.display = "block";		
		document.getElementById('StorageFlash').style.display = "none";
		document.getElementById('Storagetitle').style.display = "block";				
	}
	else if($storage == 'Flash')
	{
		document.getElementById('StorageFlash').style.display = "block";
		document.getElementById('StorageRaid').style.display = "none";			
		document.getElementById('Storagetitle').style.display = "block";			
	}
	else if($storage == 'JBOD')
	{
		document.getElementById('StorageRaid').style.display = "block";		
		document.getElementById('StorageFlash').style.display = "none";
		document.getElementById('Storagetitle').style.display = "block";			
	}
	else
	{
		document.getElementById('StorageRaid').style.display = "none";		
		document.getElementById('StorageFlash').style.display = "none";
		document.getElementById('Storagetitle').style.display = "none";			
	}
	
}

//function for checking the length of an array
function checkArrayEmpty(data)
{		
	j=0;
	for(i=0;i<data.length;i++)
	{
		if(data[i].checked)
		{			
			j++;			
		}
	}
	if(j==0)
	{
		return true;
	}
	else
	{
		return false;
	}	
}

//function for checking the length of an array
function checkArraySelected(data)
{		
	j=0;
	for(i=0;i<data.length;i++)
	{
		if(data[i].selected)
		{
			j++;			
		}
	}
	if(j==0)
	{
		return true;
	}
	else
	{
		return false;
	}	
}
	
	
function ValidateConfigForm(theForm)
{	
	var errortext = '';
	var emptytext = 'Please provide information for ';
	var invalidtext = 'Please provide valid information for ';	
	document.getElementById('errdisp').innerHTML = '';	
	var focused = false;		
	
	//Validate Component Check box
	if( (!document.frmConfigure.Components[0].checked) && (!document.frmConfigure.Components[1].checked) && (!document.frmConfigure.Components[2].checked) )
	{
		errortext = "Please Select a component of the system you would like to build\n";
		document.getElementById('ecomponent').style.color='red';
	}
	else
	{
		document.getElementById('ecomponent').style.color='black';
	}
	
	//Validate RTOS
    if(checkArrayEmpty(document.frmConfigure.RTOS))
	{
		errortext +=  ("Please choose atleast one RTOS\n");
		document.getElementById('ertos').style.color='red';
	}
	else
	{
		document.getElementById('ertos').style.color='black';	
	}
	
	//Validate RUGGEDIZATION LEVELS
    if(checkArrayEmpty(document.frmConfigure.RugLvl))
	{
		errortext +=  ("Please choose atleast one Ruggedization Levels\n");
		document.getElementById('erl').style.color='red';
	}
	else
	{
		document.getElementById('erl').style.color='black';	
	}
	
	//Validate CONFORMANCE CERTIFICATION
    if(checkArrayEmpty(document.frmConfigure.ConCert))
	{
		errortext +=  ("Please choose atleast one Conformannce Certification\n");
		document.getElementById('ecc').style.color='red';
	}
	else
	{
		document.getElementById('ecc').style.color='black';	
	}	
		
	//Validate System Control Module
	if(document.frmConfigure.Components[0].checked)
	{
			//Validate System Controller Platform	
			if(document.frmConfigure.cboSCPlatform.value == '')
			{
				errortext +=  ("Please Select System Controller - Platform\n");
				document.getElementById('escplat').style.color='red';
			}
			else
			{
				document.getElementById('escplat').style.color='black';	
			}
			
			//Validate System Controller Processor	
			if(checkArrayEmpty(document.frmConfigure.SCProcessor))
			{
				errortext +=  ("Please choose atleast one System Controller - Processor\n");
				document.getElementById('escpro').style.color='red';
			}
			else
			{
				document.getElementById('escpro').style.color='black';	
			}
			
			//Validate No of Processor and cores	
			if(checkArrayEmpty(document.frmConfigure.SCProCores))
			{
				errortext +=  ("Please choose atleast one System Controller - No of processor and Cores\n");
				document.getElementById('escnopro').style.color='red';
			}
			else
			{
				document.getElementById('escnopro').style.color='black';	
			}
			
			//Validate Core Speed
			if(checkArrayEmpty(document.frmConfigure.SCCoreSpeed))
			{
				errortext +=  ("Please choose atleast one System Controller - Core Speed\n");
				document.getElementById('esccs').style.color='red';
			}
			else
			{
				document.getElementById('esccs').style.color='black';
			}
	
			//Validate Memory Ram
			if(checkArrayEmpty(document.frmConfigure.SCMemRam))
			{
				errortext +=  ("Please choose atleast one System Controller - Memory - Ram\n");
				document.getElementById('escram').style.color='red';
			}
			else
			{
				document.getElementById('escram').style.color='black';	
			}
			
			//Validate Memory Flash
			if(checkArrayEmpty(document.frmConfigure.SCMemFlash))
			{
				errortext +=  ("Please choose atleast one System Controller - Memory - Flash\n");
				document.getElementById('escflash').style.color='red';
			}
			else
			{
				document.getElementById('escflash').style.color='black';	
			}
			
			//Validate Perhipheral Interconnect Type
			if(checkArrayEmpty(document.frmConfigure.SCPIType))
			{
				errortext +=  ("Please choose atleast one System Controller - Perhipheral Interconnect - Type\n");
				document.getElementById('esctype').style.color='red';
			}
			else
			{
				document.getElementById('esctype').style.color='black';	
			}
			
			//Validate Perhipheral Interconnect High-speed Switched Fabric
			if(checkArraySelected(document.frmConfigure.SCPIHPSF))
			{
				errortext +=  ("Please choose atleast one System Controller - Perhipheral Interconnect - High-speed Switched Fabric\n");
				document.getElementById('eschsf').style.color='red';
			}
			else
			{
				document.getElementById('eschsf').style.color='black';	
			}
			
			//Validate Perhipheral Interconnect I/O Options
			if(checkArrayEmpty(document.frmConfigure.SCIOOption))
			{
				errortext +=  ("Please choose atleast one System Controller - Perhipheral Interconnect - I/O Options\n");
				document.getElementById('escio').style.color='red';
			}			
			else
			{
				document.getElementById('escio').style.color='black';	
			}
	}
		
	//Validate Signal Processing  Module
	if(document.frmConfigure.Components[1].checked)
	{
			//Validate System Controller Platform	
			if(document.frmConfigure.cboSPPlatform.value == '')
			{
				errortext +=  ("Please Select Signal Processing - Platform\n");
				document.getElementById('espplat').style.color='red';	
			}
			else
			{
				document.getElementById('espplat').style.color='black';		
			}
			
			//Validate DSP
			if(checkArrayEmpty(document.frmConfigure.SPDSP))
			{
				errortext +=  ("Please choose atleast one Signal Processing - DSP\n");
				document.getElementById('espdsp').style.color='red';	
			}
			else
			{
				document.getElementById('espdsp').style.color='black';		
			}
			
			//Validate No of Processor and cores	
			if(checkArrayEmpty(document.frmConfigure.SPProCores))
			{
				errortext +=  ("Please choose atleast one Signal Processing - No of processor and Cores\n");
				document.getElementById('espnopro').style.color='red';	
			}
			else
			{
				document.getElementById('espnopro').style.color='black';		
			}
			
			//Validate Core Speed
			if(checkArrayEmpty(document.frmConfigure.SPCoreSpeed))
			{
				errortext +=  ("Please choose atleast one Signal Processing - Core Speed\n");
				document.getElementById('espcp').style.color='red';	
			}
			else
			{
				document.getElementById('espcp').style.color='black';		
			}
	
			//Validate Memory Ram
			if(checkArrayEmpty(document.frmConfigure.SPMemRam))
			{
				errortext +=  ("Please choose atleast one Signal Processing - Memory - Ram\n");
				document.getElementById('espram').style.color='red';	
			}
			else
			{
				document.getElementById('espram').style.color='black';		
			}
			
			//Validate Memory Flash
			if(checkArrayEmpty(document.frmConfigure.SPMemFlash))
			{
				errortext +=  ("Please choose atleast one Signal Processing - Memory - Flash\n");
				document.getElementById('espflash').style.color='red';	
			}
			else
			{
				document.getElementById('espflash').style.color='black';		
			}
			
			//Validate Perhipheral Interconnect Type
			if(checkArrayEmpty(document.frmConfigure.SPPIType))
			{
				errortext +=  ("Please choose atleast one Signal Processing - Perhipheral Interconnect - Type\n");
				document.getElementById('esptype').style.color='red';	
			}
			else
			{
				document.getElementById('esptype').style.color='black';		
			}
			
			//Validate Perhipheral Interconnect High-speed Switched Fabric
			if(checkArraySelected(document.frmConfigure.SPPIHPSF))
			{
				errortext +=  ("Please choose atleast one Signal Processing - Perhipheral Interconnect - High-speed Switched Fabric\n");
				document.getElementById('esphsf').style.color='red';	
			}
			else
			{
				document.getElementById('esphsf').style.color='black';		
			}
			
			//Validate Perhipheral Interconnect Communication Ports
			if(checkArrayEmpty(document.frmConfigure.SPPICP))
			{
				errortext +=  ("Please choose atleast one Signal Processing - Perhipheral Interconnect - Communication Ports\n");
				document.getElementById('espcomp').style.color='red';	
			}
			else
			{
				document.getElementById('espcomp').style.color='black';		
			}			
	}
	
	//Validate Interface  Module
	if(document.frmConfigure.Components[2].checked)
	{
			//Validate Interface  
			if(checkArrayEmpty(document.frmConfigure.Interfaces))
			{
				errortext +=  ("Please choose atleast one type of Interface\n");
				document.getElementById('einterface').style.color='red';	
			}
			else
			{
				document.getElementById('einterface').style.color='black';		
			}
	
	
			//Validate Grephic Platform
			if(document.frmConfigure.Interfaces[0].checked)
			{
					//Validate Platform	
					if(document.frmConfigure.cboGraPlatform.value == '')
					{
						errortext +=  ("Please Select Graphics - Platform\n");
						document.getElementById('egraplatform').style.color='red';	
					}
					else
					{
						document.getElementById('egraplatform').style.color='black';		
					}
					
					//Validate Processor
					if(checkArrayEmpty(document.frmConfigure.GraProcessor))
					{
						errortext +=  ("Please choose atleast one Graphics - Processor\n");
						document.getElementById('egraprocessor').style.color='red';	
					}
					else
					{
						document.getElementById('egraprocessor').style.color='black';		
					}
					
					//Validate Ports
					if(checkArrayEmpty(document.frmConfigure.GraPorts))
					{
						errortext +=  ("Please choose atleast one Graphics - Processor - Port\n");
						document.getElementById('egraports').style.color='red';	
					}
					else
					{
						document.getElementById('egraports').style.color='black';		
					}
					
					//Validate Graphics Software support
					if(checkArrayEmpty(document.frmConfigure.GraGPS))
					{
						errortext +=  ("Please choose atleast one Graphics Software support\n");
						document.getElementById('egss').style.color='red';	
					}
					else
					{
						document.getElementById('egss').style.color='black';		
					}
			}
			
			//Validate Interface Switches   
			if(document.frmConfigure.Interfaces[1].checked)
			{
					//Validate Platform	
					if(document.frmConfigure.cboSwitchPlatform.value == '')
					{
						errortext +=  ("Please Select Switches - Platform\n");
						document.getElementById('eswitches').style.color='red';	
					}
					else
					{
						document.getElementById('eswitches').style.color='black';	
					}
					
					//Validate Ports
					if(checkArrayEmpty(document.frmConfigure.SwitchPorts))
					{
						errortext +=  ("Please choose atleast one Switches - Port\n");
						document.getElementById('eswhports').style.color='red';	
					}
					else
					{
						document.getElementById('eswhports').style.color='black';		
					}
			}
			
			//Validate Interface Datacom
			if(document.frmConfigure.Interfaces[2].checked)
			{
					//Validate Platform	
					if(document.frmConfigure.cboDataPlatform.value == '')
					{
						errortext +=  ("Please Select Datacom - Platform\n");
						document.getElementById('edataplatform').style.color='red';		
					}
					else
					{
						document.getElementById('edataplatform').style.color='black';
					}
					
					if(document.frmConfigure.cboDataPlatform.value == '6U-VME')
					{
						//Validate Dataacom VME
						if(checkArrayEmpty(document.frmConfigure.DatacomVME))
						{
							errortext +=  ("Please choose atleast one Datacom - Platform - Type\n");
							document.getElementById('datacomtype').style.color='red';		
						}
						else
						{
							document.getElementById('datacomtype').style.color='black';	
						}
					}
					if(document.frmConfigure.cboDataPlatform.value == 'PMC')
					{
						//Validate Datacom PMC
						if(checkArrayEmpty(document.frmConfigure.DatacomPMC))
						{
							errortext +=  ("Please choose atleast one Datacom - Platform - Type\n");
							document.getElementById('datacomtype').style.color='red';		
						}
						else
						{
							document.getElementById('datacomtype').style.color='black';			
						}
					}
					if(document.frmConfigure.cboDataPlatform.value == 'XMC')
					{
						//Validate Datacom XMC
						if(checkArrayEmpty(document.frmConfigure.DatacomXMC))
						{
							errortext +=  ("Please choose atleast one Datacom - Platform - Type\n");
							document.getElementById('datacomtype').style.color='red';		
						}	
						else
						{
							document.getElementById('datacomtype').style.color='black';			
						}
					}			
			}	
				
			//Validate Interface Storage
			if(document.frmConfigure.Interfaces[3].checked)
			{
					//Validate Platform	
					if(document.frmConfigure.cboStoragePlatform.value == '')
					{
						errortext +=  ("Please Select Storage - Platform\n");
						document.getElementById('estgeplatform').style.color='red';		
					}	
					else
					{
						document.getElementById('estgeplatform').style.color='black';			
					}
					
					//Validate Storage Interface
					if(checkArrayEmpty(document.frmConfigure.StorageInterface))
					{
						errortext +=  ("Please choose atleast one Storage - Interface\n");
						document.getElementById('estgeinter').style.color='red';		
					}
					else
					{
						document.getElementById('estgeinter').style.color='black';			
					}
					
					//Validate Storage Interface
					if(document.frmConfigure.StorageMedium.value =='')
					{
						errortext +=  ("Please Select a Storage - Medium\n");
						document.getElementById('estgemedium').style.color='red';		
					}
					else
					{
						document.getElementById('estgemedium').style.color='black';			
					}
					
					if(document.frmConfigure.StorageMedium.value == 'RAID')
					{
						//Validate Dataacom VME
						if(checkArrayEmpty(document.frmConfigure.StorageDenCapRaid))
						{
							errortext +=  ("Please choose atleast one Storage - Raid Medium\n");
							document.getElementById('estgedencap').style.color='red';		
						}
						else
						{
							document.getElementById('estgedencap').style.color='black';		
						}
					}
					if(document.frmConfigure.StorageMedium.value == 'Flash')
					{
						//Validate Datacom PMC
						if(checkArrayEmpty(document.frmConfigure.StorageDenCapFlash))
						{
							errortext +=  ("Please choose atleast one Storage - Flash Medium\n");
							document.getElementById('estgedencap').style.color='red';		
						}
						else
						{
							document.getElementById('estgedencap').style.color='black';			
						}
					}
					if(document.frmConfigure.StorageMedium.value == 'JBOD')
					{
						//Validate Datacom XMC
						if(checkArrayEmpty(document.frmConfigure.StorageDenCapRaid))
						{
							errortext +=  ("Please choose atleast one Storage - JBOD Medium\n");
							document.getElementById('estgedencap').style.color='red';		
						}
						else
						{
							document.getElementById('estgedencap').style.color='black';			
						}
					}			
			}
	}
	
	//Validate Captcha Security Image Textbox
			if(document.frmConfigure.security_code.value == '')
			{
				errortext +=  ("Please type security code\n");
				document.getElementById('scode').style.color='red';	
			}
			else
			{
				document.getElementById('scode').style.color='black';		
			}
	
	if( errortext == '')
	{
		return true;
	}
	else
	{
		alert(errortext);		
		document.getElementById('errdisp').innerHTML =	'&nbsp;&nbsp;Please provide valid information for all the required fields marked in \'Red\'<br>&nbsp;';
		window.scroll(0, 0);		
		return false;
		
	}
}

function configureSubmit()
{
	document.frmConfigure.action = "../user/validatelogin.php?from=5";
	document.frmConfigure.method="post";
	document.frmConfigure.submit();		
}