$(document).ready(function () {
			
			//Remove generated nav links, switch on login/off
    	$('li#navlogin').remove();
    	$('li#navregister').remove();
    	
    	$('ul#boardsNavigation > li:last').addClass('last');
    	
    	$('li#navlogout').each(function() {
    		$('li#gLogin').remove();
    		$('li#gRegister').remove();
    		$('li#gLogout').removeClass('hidden');
    		var loc = ($(this).find('a').attr('href'));
    		$('li#gLogout').find('a').attr('href', loc);
    		$(this).css('display', 'none');
    	});
    	
    	//Hide unwanted items
    	$('div.main-subhead').css('display', 'none');
    	$('p#extensions-used').css('display', 'none');
    	
    	
    	//remove margin from first, last fieldset for only fieldset pages
    	$('div#profile fieldset:first').css('margin-top', '0');
    	$('div#profile div.data-set:last').css('margin-bottom', '0');
    	
    	//profile page settings
    	if($('div#profile').length == 1){
    		
    		//move password change into intro box
    		$('p.content-options:first').clone().appendTo('div.set1');
    		$('p.content-options:first').remove();
    		
    		//Set header on profile page    	
    		$("div#brd-main").prepend("<h3>Profile</h3>");
    		
    		//set width of profile box for guest view
    		if( $('div.main-menu').length == 0){
    			$('div#profile').css('width',' 930px');
    			$('div#profile').css('padding',' 0');
    			$('div#profile.main-content').css('margin','0');
    			$('div#profile div.data-set:first').css('margin-top', '0');
    			$('div#profile div.data-set:last').css('margin-bottom', '20px');
    		}
    		else {
    			//remove set margin with menu
    			$('div#profile div.data-set:first').css('margin-top', '0');
    		}
    	} 
    	
    	//remove margin from last set in fieldset    	
    	$('div#profile fieldset div.sf-set:last').css('margin-bottom', '0');
    	
    	
    	//If viewing a forum topic or post page list move login or register to post new topic links to header box
    	if($('div#viewForum').length == 1 || $('div#viewTopic').length == 1){    	
	    	$('div#brd-pagepost-top > p:last').clone().insertAfter('p#welcome');
	    	$('p#welcome').remove();
	    	$('div#brd-pagepost-top > p:last').remove();
    	}
    	
    	//Remove board info box if empty
    	if($('div#boardInfo').children().length == 0){
    		$('div#boardInfo').remove();
    	}
    	
    	//remove post new topic from bottom pagination
    	$('div#brd-pagepost-end p.posting:first').remove();
    	
    	//clear bottom page nav
    	$('div#brd-pagepost-end').css('margin-bottom', '15px');
    	
    	//remove empty box on search
    	if( $('div.info-box.search:first').children().length == 0){
    			$('div.info-box.search:first').remove();
    	}
    	
    	//hide agree checkbox on registration
    	$('fieldset#hideCheckBox').find('input#fld1').attr('checked','true');
    	$('fieldset#hideCheckBox').css('display', 'none');
    				
}); //end of doc ready

