	function chooseAllBox(sectionName){
		var section = document.getElementsByName(sectionName);

		if(typeof(section[0]) != 'undefined'){
			section[0].checked = true;
			
			if(sectionName == 'construction'){
				document.getElementById('constructionList').selectedIndex = 0;
			}
			  		
	  		for(i=1; i<section.length; i++){
		  		section[i].checked = false;
		  	}
	  	}
	}
	
	function chooseCriteriaBox(sectionName){
		var section = document.getElementsByName(sectionName);
		var anyChecked = false;
		
		if(typeof(section[0]) != 'undefined'){
			section[0].checked = false;  
			
			if(sectionName == 'construction'){
				if(section[1].checked == false)
					document.getElementById('constructionList').selectedIndex = 0;
			}
			
		  	for(i=1; i<section.length; i++){
		  		if(section[i].checked == true)
		  			anyChecked = true;
		  	}
		  	
		  	if(!anyChecked){
		  		section[0].checked = true;
			}
		}
	}
	
	function initializeSearch(){
			chooseCriteriaBox('construction');
			chooseCriteriaBox('brand');
			chooseCriteriaBox('design');
			chooseCriteriaBox('style');
			chooseCriteriaBox('dcolor');
			chooseCriteriaBox('scolor');
			chooseCriteriaBox('price');
			chooseCriteriaBox('purpose');
	}
	
	function searchChooseBaseCloth(){
		
		var section = document.getElementsByName('construction');
		if(typeof(section[1]) != "undefined"){
			section[1].checked = true;
			chooseCriteriaBox('construction');
		}
	}
	
	function clearSearchForm(){
		var section; 
		if(typeof(document.getElementsByName('construction')) != 'undefined'){ chooseAllBox('construction'); }
		if(typeof(document.getElementsByName('brand')) != 'undefined'){ chooseAllBox('brand'); }
		if(typeof(document.getElementsByName('design')) != 'undefined'){ chooseAllBox('design'); }
		if(typeof(document.getElementsByName('style')) != 'undefined'){ chooseAllBox('style'); }
		if(typeof(document.getElementsByName('dcolor')) != 'undefined'){ chooseAllBox('dcolor'); }
		if(typeof(document.getElementsByName('scolor')) != 'undefined'){ chooseAllBox('scolor'); }
		if(typeof(document.getElementsByName('price')) != 'undefined'){ chooseAllBox('price'); }
		if(typeof(document.getElementsByName('purpose')) != 'undefined'){ chooseAllBox('purpose'); }
		document.getElementById('HFrom').value='';
		document.getElementById('HTo').value='';
		document.getElementById('VFrom').value='';
		document.getElementById('VTo').value='';
		document.getElementById('rpp').selectedIndex = 0;
	}
	
	function validateFFTSearch(fftField){
		var fftSearchObject = document.getElementById(fftField);
		if(fftSearchObject.value == '' || fftSearchObject.value == 'Enter Search Terms'){
			alert('Please enter search terms.');
		}
		else{
			doPost('actionSearch','/search/search_results.jsp','/search/search_no_results.jsp','searchByFreeFormText',fftSearchObject.value);
		}
	}
	
	function clearFFTSearchBox(fftObject){
		if(fftObject.value == 'Enter Search Terms')
			fftObject.value = '';
	}