
// Used to swap the section of the tabs on the main page
function swapSection( intSection ){	
	var arrSections = new Array();
	
	arrSections[0] = "agriculture";
	arrSections[1] = "pestcontrol";
	arrSections[2] = "amenity";
	
	for( i=0; i<arrSections.length;i++ ){
		// reset the section layer order
		var objThisSection = document.getElementById( 'section' + arrSections[i] );
		if( i != intSection ){
			objThisSection.style.display = 'none';
		} else {
			objThisSection.style.display = 'block';
		}
		
		
		// reset the tab state
		var objThisTab = document.getElementById( 'tab' + arrSections[i] );
		if( i != intSection ){
			objThisTab.className = '';
		} else {
			objThisTab.className = 'over';
		}
	}
	
	return true;
}


// Used to swap the forms on the organiser login page
function swapLogin( intSection ){	
	var arrSections = new Array();
	
	arrSections[0] = "login";
	arrSections[1] = "register";
	arrSections[2] = "forgot";
	
	for( i=0; i<arrSections.length;i++ ){
		// reset the section layer order
		var objThisSection = document.getElementById( 'section' + arrSections[i] );
		if( i != intSection ){
			objThisSection.style.display = 'none';
		} else {
			objThisSection.style.display = 'block';
		}
		
		
		// reset the tab state
		var objThisTab = document.getElementById( 'tab' + arrSections[i] );
		if( i != intSection ){
			objThisTab.className = '';
		} else {
			objThisTab.className = 'over';
		}
	}
	
	return true;
}


// Used for single selection of cpd instances in dynamic table within the organisers area
function singleSelectCpdInstance( intId ){  
    var checkboxName = 'selectCheckBoxCeid' + intId;       
    for(i=0; i<document.forms[0].elements.length; i++) {        
        var objThisElement = document.forms[0].elements[i];                
        if(objThisElement.type=="checkbox") {
            var elementName = objThisElement.name;                    
            if (elementName.indexOf(checkboxName) == -1) {
                objThisElement.checked=false;
            } 
        }
    }    
}