/* ---------------- */
/* Global Variables */
/* ---------------- */
var recentHash;
var currentPage;
var slideNumber;

var enableFileRepositoryPoll;
var recentFileRepositoryHash;
var currentDirectory;

var showPrevious = showMembers;
var rosterState = null;
var rosterSearchState = null;

var searchTimeout = null;

var httpObject = null;

var exitOverride = false;

var hashChangeReload = false;

/* ---------------- */
/*  Main Functions  */
/* ---------------- */

// Initialize the page
function init()
{
	// Redirect if arrived using get
	if (window.location.search)
	{
		exitOverride = true;
		window.location = './#' + window.location.search.substring(1);
	}	
	// Hide submenus
	hideSubmenus();
	// Change links for Ajax
	ajaxify('logo', '\"\\?', '"#');
	ajaxify('topmenu', '\"\\?', '"#');
	ajaxify('submenu_brotherhood', '\"\\?', '"#');
	ajaxify('submenu_recruitment', '\"\\?', '"#');
	ajaxify('news', '\"\\?', '"#');
	ajaxify('crest', '\"\\?', '"#');
	ajaxify('banner', '\"\\?', '"#');
	ajaxify('contactlist', '\"\\?', '"#');
	ajaxify('footer', '\"\\?', '"#');
	// If in site view mode
	if (document.getElementById('site_view').value == 'site')
	{
		ajaxify('content', '\"\\?', '"#');
	}
	// Show js buttons
	ajaxify('content', 'ajaxbutton', 'unhidden');
	ajaxify('news', 'ajaxbutton', 'unhidden');
	// Hide nonjs buttons
	ajaxify('content', 'nonjsbutton', 'hidden');
	ajaxify('news', 'nonjsbutton', 'hidden');
		
	// Initialize AJAX connection
	httpObject = null;
	// Initialise slideshow
	slideNumber = 1;
	setInterval('slideshow()', 5000);
	// Initialize polling system
	pollHash();
	setInterval('pollHash()', 500);
	// Initialize the file repository
	initFileRepository();
}

// Replace links with AJAX equivalents
function ajaxify(haystack, needle, replacement) {
	// Replace needle with replacement for AJAX
    var haystackText = document.getElementById(haystack).innerHTML;
    var match = new RegExp(needle, "ig");     
    var replaced = "";
    replaced = haystackText.replace(match, replacement);
	// Update HTML
    document.getElementById(haystack).innerHTML = replaced;
}

// Poll the Hash
function pollHash() 
{
	// Reload site if requested
	if (document.getElementById('site_reload'))
		siteReload();
	// If hash has changed
	if (recentHash != window.location.hash)
	{
		// Force hash change reload if requested
		if (hashChangeReload)
			siteReload();
		// Update Recent Hash (IE Fix)
		recentHash = (window.location.hash == '#') ? '' : window.location.hash;
		// Extract page name from hash
		var match = new RegExp('[^\#][^&]*');
		var hashPageName = recentHash ? (match.exec(recentHash)).toString() : '';
		// Reinitialise page if not already shown
		if (currentPage != hashPageName)
			gotoPage(hashPageName);
	}
}

// Set Content div visible
function showContent(divName)
{
	// Hide all content
	hideAllContent();
	// Show specified content
	showDiv(divName);
}

// Show the specified div
function showDiv(divName)
{
	((getElem(divName)).style).display = 'block';
}

// Hide submenu
function hideSubmenus()
{
	hideDiv('submenu_brotherhood');
	hideDiv('submenu_recruitment');	
}


// Hide the specified div
function hideDiv(divName)
{
	((getElem(divName)).style).display = 'none';
}

// Set specified link active
function setActive(linkName)
{
	// Activate specified link
	activate(linkName);
	// Handle brotherhood submenu links
	if (linkName == 'brotherhood_link' || linkName == 'philanthropy_link' || linkName == 'chapter_history_link' || linkName == 'national_history_link' || linkName == 'gallery_link')
	{
		activate('brotherhood_link');
		activate('brotherhood_link2');
	}
    // Handle recruitment submenu links
	if (linkName == 'recruitment_link' || linkName == 'about_rush_link' || linkName == 'rush_events_link' || linkName == 'faq_link')
	{
		activate('recruitment_link');
		activate('recruitment_link2');
	}
}

// Activate the specified link
function activate(linkName)
{
	// Fetch link style
	var vis = (getElem(linkName)).style;
	// Update appearance
	vis.color = '#FFF';
	vis.backgroundColor = '#CC0000';
}

// Deactivate the specified link
function deactivate(linkName)
{
	// Fetch link style
	var vis = (getElem(linkName)).style;
	// Update appearance
	vis.color = '';
	vis.backgroundColor = '';
}

/* ------------------- */
/*    Contact Page     */
/* ------------------- */

// Execute AJAX contact submission 
function submitContactForm()
{  
	// Form request parameters
	var parameters = 'contact_submit=true&name=' + document.getElementById('contact_name').value + '&email=' + document.getElementById('contact_email').value + '&phone=' + document.getElementById('contact_phone').value + '&comment=' + document.getElementById('contact_comment').value + '&preferred=' + document.getElementById('contact_preferred').value + '&maillist=' + (document.getElementById('contact_maillist').checked ? '1' : '0');
	// Execute AJAX request
	ajaxRequest('POST', 'contact.php', parameters, 'contact_page');
}

/* ------------------- */
/* Slideshow Function  */
/* ------------------- */

// Slideshow
function slideshow()
{
	// Increment counter
	slideNumber++;
	// Change picture
	switch (slideNumber)
	{
        case 5:
			document.animation.src = 'images/animation5.gif';
			return;
    	case 4:
			document.animation.src = 'images/animation4.gif';
			return;
		case 3:
			document.animation.src = 'images/animation3.gif';
			return;
		case 2:
			document.animation.src = 'images/animation2.gif';
			return;
		default:
			document.animation.src = 'images/animation.gif';
			// Reset counter at end of cycle
			slideNumber = 1;
			return;
	}
}

/* ---------------------- */
/* Members Area Functions */
/* ---------------------- */

// Execute AJAX authentication 
function authenticate()
{  
	// Reset roster state
	rosterState = null;
	// If Roster dirty
	if (document.roster_search)
	{
		// Reset roster viewing preferences
		document.roster_search.show.value = 50;
		document.roster_search.search.value = '';
	}
	// Form request parameters
	var parameters = 'username=' + document.getElementById('username').value + '&password=' + document.getElementById('password').value;
	// Execute AJAX request
	ajaxRequest('POST', 'members.php', parameters, 'members_area');
}

// Execute AJAX deauthentication   
function deauthenticate()
{  
	// Reset roster state
	rosterState = null;
	// Form request parameters
	var parameters = 'logout=true';
	// Execute AJAX request
	ajaxRequest('POST', 'members.php', parameters, 'members_area');
}

// Show Registration 
function showRegister(clear)
{  
	// Form request parameters
	var parameters = 'register';
	// If form is valid
	if (document.registration && !clear)
	{
		// Extract FIeld Values
		parameters += '&create_user&new_username=' + document.registration.new_username.value + '&password=' + document.registration.password.value + '&password2=' + document.registration.password2.value + '&first_name=' + document.registration.first_name.value + '&last_name=' + document.registration.last_name.value + '&roster_number=' + document.registration.roster_number.value + '&pledge_quarter=' + document.registration.pledge_quarter.value + '&pledge_year=' + document.registration.pledge_year.value + '&email=' + document.registration.email.value;
	}
	// Execute AJAX request
	ajaxRequest('GET', 'members.php', parameters, 'members_area');
}

// Show Password Reset 
function showPasswordReset(clear)
{  
	// Form request parameters
	var parameters = 'password_reset';
	// If form valid
	if (document.password_reset && !clear)
	{
		// Extract FIeld Values
		parameters += '&reset_user&new_username=' + document.password_reset.new_username.value + '&first_name=' + document.password_reset.first_name.value + '&last_name=' + document.password_reset.last_name.value + '&roster_number=' + document.password_reset.roster_number.value + '&pledge_quarter=' + document.password_reset.pledge_quarter.value + '&pledge_year=' + document.password_reset.pledge_year.value + '&email=' + document.password_reset.email.value;
	}
	// Execute AJAX request
	ajaxRequest('GET', 'members.php', parameters, 'members_area');
}

// Show Members 
function showMembers(params)
{  
	// Clear any search timers
	if (searchTimeout)
		clearTimeout(searchTimeout);
	// Update Previous
	showPrevious = showMembers;
	// Execute AJAX request
	ajaxRequest('GET', 'members.php', '', 'members_area');
}

// Show Roster 
function showRoster(params)
{  
	// Clear any search timers
	if (searchTimeout)
		clearTimeout(searchTimeout);
	// Update Previous
	showPrevious = showRoster;
	// Form request parameters
	var parameters = 'roster&' + params;
	// If form valid and
	if (document.roster_search)
	{
		// Extract Field Values (IE6 FIx)
		if (document.roster_search.search.value != '')
			parameters += '&search=' + document.roster_search.search.value;
		if (document.roster_search.show.value != '')
			parameters += '&show=' + document.roster_search.show.value;
		else
			parameters += '&show=' + document.roster_search.showie.value;
	}
	// Store roster state
	rosterState = parameters;
	// Execute AJAX request
	ajaxRequest('GET', 'members.php', parameters, 'members_area', focusSearch);
}

// Show Roster  Timer Function
function showRosterTimer()
{  
	// Form request parameters
	var parameters = 'roster&' + rosterSearchState;
	// Extract Field Values (IE6 FIx)
	if (document.roster_search.search.value != '')
		parameters += '&search=' + document.roster_search.search.value;
	if (document.roster_search.show.value != '')
		parameters += '&show=' + document.roster_search.show.value;
	else
		parameters += '&show=' + document.roster_search.showie.value;
	// Execute AJAX request
	ajaxRequest('GET', 'members.php', parameters, 'members_area', focusSearch);
}

// Focus the search box
function focusSearch()
{ 
	// Prevent error on timeout
	if (document.roster_search)
		document.roster_search.search.focus();
}

// Show Detail 
function showDetail(params)
{  
	// Clear any search timers
	if (searchTimeout)
		clearTimeout(searchTimeout);
	// Form request parameters
	var parameters = 'detail&' + params;
	// Execute AJAX request
	ajaxRequest('GET', 'members.php', parameters, 'members_area', toggleDeceased);
}

// Update Detail
function updateDetail(id)
{
	// Form request parameters
	var parameters = 'id=' + id + '&roster_number=' + document.roster_detail.roster_number.value + '&first_name=' + document.roster_detail.first_name.value + '&last_name=' + document.roster_detail.last_name.value + '&is_deceased=' + (document.roster_detail.is_deceased.checked ? '1' : '0') + '&is_alumniboard=' + (document.roster_detail.is_alumniboard.checked ? '1' : '0') + '&is_undergraduate=' + (document.roster_detail.is_undergraduate.checked ? '1' : '0') + '&nick_name=' + document.roster_detail.nick_name.value + '&pledge_quarter=' + document.roster_detail.pledge_quarter.value + '&pledge_year=' + document.roster_detail.pledge_year.value + '&graduating_year=' + document.roster_detail.graduating_year.value + '&current_occupation=' + document.roster_detail.current_occupation.value + '&is_married=' + (document.roster_detail.is_married.checked ? '1' : '0') + '&email=' + document.roster_detail.email.value + '&website=' + document.roster_detail.website.value + '&phone=' + document.roster_detail.phone.value + '&address_1=' + document.roster_detail.address_1.value + '&address_2=' + document.roster_detail.address_2.value + '&address_city=' + document.roster_detail.address_city.value + '&address_state=' + document.roster_detail.address_state.value + '&address_postcode=' + document.roster_detail.address_postcode.value + '&address_country=' + document.roster_detail.address_country.value + '&comment=' + document.roster_detail.comment.value + '&current_profession=' + document.roster_detail.current_profession.value + '&current_practicearea=' + document.roster_detail.current_practicearea.value + '&graduate_degree=' + document.roster_detail.graduate_degree.value + '&graduate_school=' + document.roster_detail.graduate_school.value + '&graduate_class=' + document.roster_detail.graduate_class.value + '&state_licenses=' + document.roster_detail.state_licenses.value + '&last_updated=' + document.roster_detail.last_updated.value;
	// Execute AJAX request
	ajaxRequest('POST', 'members.php?detail&edit&update_roster_detail', parameters, 'members_area', toggleDeceased);
}

// Insert Detail
function insertDetail()
{
	// Form request parameters
	var parameters = 'roster_number=' + document.roster_detail.roster_number.value + '&first_name=' + document.roster_detail.first_name.value + '&last_name=' + document.roster_detail.last_name.value + '&is_deceased=' + (document.roster_detail.is_deceased.checked ? '1' : '0') + '&is_alumniboard=' + (document.roster_detail.is_alumniboard.checked ? '1' : '0') + '&is_undergraduate=' + (document.roster_detail.is_undergraduate.checked ? '1' : '0') + '&nick_name=' + document.roster_detail.nick_name.value + '&pledge_quarter=' + document.roster_detail.pledge_quarter.value + '&pledge_year=' + document.roster_detail.pledge_year.value + '&graduating_year=' + document.roster_detail.graduating_year.value + '&current_occupation=' + document.roster_detail.current_occupation.value + '&is_married=' + (document.roster_detail.is_married.checked ? '1' : '0') + '&email=' + document.roster_detail.email.value + '&website=' + document.roster_detail.website.value + '&phone=' + document.roster_detail.phone.value + '&address_1=' + document.roster_detail.address_1.value + '&address_2=' + document.roster_detail.address_2.value + '&address_city=' + document.roster_detail.address_city.value + '&address_state=' + document.roster_detail.address_state.value + '&address_postcode=' + document.roster_detail.address_postcode.value + '&address_country=' + document.roster_detail.address_country.value + '&comment=' + document.roster_detail.comment.value + '&current_profession=' + document.roster_detail.current_profession.value + '&current_practicearea=' + document.roster_detail.current_practicearea.value + '&graduate_degree=' + document.roster_detail.graduate_degree.value + '&graduate_school=' + document.roster_detail.graduate_school.value + '&graduate_class=' + document.roster_detail.graduate_class.value + '&state_licenses=' + document.roster_detail.state_licenses.value + '&last_updated=' + document.roster_detail.last_updated.value;
	// Execute AJAX request
	ajaxRequest('POST', 'members.php?detail&edit&add&insert_roster_detail', parameters, 'members_area', toggleDeceased);
}

// Toggle Deceased Fields enable/disable
function toggleDeceased()
{
	// If in edit mode
	if (document.roster_detail)
	{
		// Toggle deceased/alive fields
		if (document.roster_detail.is_deceased.checked)
		{
			document.roster_detail.is_alumniboard.disabled = true;
			document.roster_detail.is_undergraduate.disabled = true;
			document.roster_detail.current_occupation.disabled = true;
			document.roster_detail.is_married.disabled = true;
			document.roster_detail.email.disabled = true;
			document.roster_detail.website.disabled = true;
			document.roster_detail.phone.disabled = true;
			document.roster_detail.address_1.disabled = true;
			document.roster_detail.address_2.disabled = true;
			document.roster_detail.address_city.disabled = true;
			document.roster_detail.address_state.disabled = true;
			document.roster_detail.address_postcode.disabled = true;
			document.roster_detail.address_country.disabled = true;
			document.roster_detail.current_profession.disabled = true;
			document.roster_detail.current_practicearea.disabled = true;
			document.roster_detail.graduate_degree.disabled = true;
			document.roster_detail.graduate_school.disabled = true;
			document.roster_detail.graduate_class.disabled = true;
			document.roster_detail.state_licenses.disabled = true;
		}
		else
		{
			document.roster_detail.is_alumniboard.disabled = false;
			document.roster_detail.is_undergraduate.disabled = false;
			document.roster_detail.current_occupation.disabled = false;
			document.roster_detail.is_married.disabled = false;
			document.roster_detail.email.disabled = false;
			document.roster_detail.website.disabled = false;
			document.roster_detail.phone.disabled = false;
			document.roster_detail.address_1.disabled = false;
			document.roster_detail.address_2.disabled = false;
			document.roster_detail.address_city.disabled = false;
			document.roster_detail.address_state.disabled = false;
			document.roster_detail.address_postcode.disabled = false;
			document.roster_detail.address_country.disabled = false;
			document.roster_detail.current_profession.disabled = false;
			document.roster_detail.current_practicearea.disabled = false;
			document.roster_detail.graduate_degree.disabled = false;
			document.roster_detail.graduate_school.disabled = false;
			document.roster_detail.graduate_class.disabled = false;
			document.roster_detail.state_licenses.disabled = false;
		}
	}
}

// Delete Detail
function deleteDetail(id)
{
	// Form request parameters
	var parameters = 'id=' + id;
	// Execute AJAX request
	ajaxRequest('POST', 'members.php?detail&edit&delete_roster_detail', parameters, 'members_area');
}

// Show Group Email 
function showEmail(filter, raw)
{  
	// Form request parameters
	var parameters = 'email';
	// Add filter if set
	if (filter)
		parameters += '&filter=' + filter;
	// Add raw if set
	if (raw)
		parameters += '&raw=' + filter;
	// Execute AJAX request
	ajaxRequest('GET', 'members.php', parameters, 'members_area');
}

// Show Change Password 
function showChangePassword(clear)
{  
	// Form request parameters
	var parameters = 'change_password';
	// If form valid
	if (document.change_password && !clear)
	{
		// Extract Field Values
		parameters += '&change_user&old_password=' + document.change_password.old_password.value + '&new_password=' + document.change_password.new_password.value + '&new_password2=' + document.change_password.new_password2.value;
	}
	// Execute AJAX request
	ajaxRequest('GET', 'members.php', parameters, 'members_area');
}

// Initialise the FileRepository (Enables Bookmarking)
function initFileRepository()
{
	// Initialise navigation system
	enableFileRepositoryPoll = false;
	recentFileRepositoryHash = '';
	currentDirectory = '';
	// Initialize polling system
	pollFileRepositoryHash();
	setInterval('pollFileRepositoryHash()', 500);
}

// Poll the Hash
function pollFileRepositoryHash() 
{
	// If dataroom visible
	if (currentPage == 'dataroom')
	{
		// If newly focussed and in site view reinitialise current directory
		if (!enableFileRepositoryPoll && (document.getElementById('site_view').value == 'site') && (document.getElementById('file_repository_view').value != 'login'))
			fetchFileRepository(currentDirectory);
		// Enable polling system
		enableFileRepositoryPoll = true;
	}
	// Otherwise Disable polling system if dataroom not visible
	else
		enableFileRepositoryPoll = false;
	// If polling system enabled and hash has changed
	if (enableFileRepositoryPoll && (recentFileRepositoryHash != window.location.hash))
	{
		// Update Recent Hash
		recentFileRepositoryHash = window.location.hash;
		// Extract directory from hash
		var match = new RegExp('.*directory=');
		if (match.test(recentFileRepositoryHash))
			var hashDirectory = (recentFileRepositoryHash.replace(match, '')).toString();
		else
			hashDirectory = '';
		// Update topmenu link - Removed \" and " for IE6 fix
		ajaxify('topmenu', '\#dataroom[^"]*"', '#dataroom&directory=' + hashDirectory + '"');
		// Reinitialise directory if not already shown and in site view
		if ((currentDirectory != hashDirectory)  && (document.getElementById('site_view').value == 'site'))
			fetchFileRepository(hashDirectory);
	}
}

// Execute AJAX File Repository Update
function fetchFileRepository(directory)
{  
	// Replace white space with %20 to prevent multiple hits
	var match = new RegExp(' ');
	if (match.test(directory))
		directory = (directory.replace(match, '%20')).toString();
	// Update current directory variable
	currentDirectory = directory;
	// Form request parameters
	var parameters = 'directory=' + directory;
	// Execute request
	ajaxRequest('GET', 'file_repository.php', parameters, 'file_repository');
}

/* ---------------- */
/* Helper Functions */
/* ---------------- */

// Get the specified div
function getElem(divName)
{
	// As per standards
	if (document.getElementById)
		return document.getElementById(divName);
	// Fix for old IE versions
	else if (document.all)
	  return document.all[divName];
	// Fix for old Netscape browsers
	else if(document.layers)
		return document.layers[divName];
}

// Fix nested mouseOut
function fixOnMouseOut(element, event, JavaScript_code) 
{
	// Initialise pointer
	var current_mouse_target = null;
	// Determine mouse target
	if( event.toElement )			
		current_mouse_target = event.toElement;
	else if( event.relatedTarget )				
		current_mouse_target = event.relatedTarget;
	// Only execute code if non-nested trigger
	if( !is_child_of(element, current_mouse_target) && element != current_mouse_target )
		eval(JavaScript_code);
}

// Determine if an element is a child of another
function is_child_of(parent, child) 
{
	// If object has children
	if (child != null) 
		// Check each child
		while (child.parentNode) 
			// Determine if parent is parent
			if ((child = child.parentNode) == parent)
				return true;
	// Otherwise not a child
	return false;
}

// Catch Space Key
function catchSpace(e, params) 
{
	var key;
	// Catch keystroke in IE
	if(window.event)
		key = window.event.keyCode;
	// Catch keystroke in Firefox
	else
		key = e.which;
	// Do nothing on Space Key or Apple or Ctrl or		Shift 		Up/Down/Left/RIght
	if ((key == 32) || (key == 224) || (key == 17) || (key == 16) || (key == 37) || (key == 38) || (key == 39) || (key == 40))
		return false;
	// Update roster on Enter or CR
	if ((key == 13) || (key == 10))
	{
		// Clear existing timeouts
		if (searchTimeout != null)
			clearTimeout(searchTimeout);
		// Update roster
		showRoster(params);
		return false;
	}
	// Otherwise
	else
	{
		// Clear existing timeouts
		if (searchTimeout != null)
			clearTimeout(searchTimeout);
		// Schedule update in 2 seconds
		rosterSearchState = params;
		searchTimeout = setTimeout (showRosterTimer, 1000);
		return true;
	}
}

// Catch Enter key and execute specified code
function catchEnter(e, JavaScript_code) 
{
	var key;
	// Catch keystroke in IE
	if(window.event)
		key = window.event.keyCode;
	// Catch keystroke in Firefox
	else
		key = e.which;
	// If Enter key
	if((key == 13) || (key == 10))
	{
		// Execute javascript
		eval(JavaScript_code);
		return false;
	}
	// Otherwise
	else
		return true;	
}

// Execute AJAX Request
function ajaxRequest(method, action, parameters, divName, finishAction)
{
	// Show loading div
	showDiv('loading');
	// Fetch http object
	httpObject = getHTTPObject();
	// If fetch successful
	if (httpObject != null)
	{
		// Format parameters
		var parameters = 'ajax=true&' + parameters;
		// If using POST
		if (method == 'POST')
		{
			httpObject.open('POST', action, true);
			httpObject.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
			httpObject.setRequestHeader('Content-length', parameters.length);
			httpObject.setRequestHeader('Connection', 'close');
			httpObject.send(parameters);
		}
		// Otherwise, if using GET
		else if (method == 'GET')
		{
			httpObject.open('GET', action + '?' + parameters, true);
			httpObject.send(null); 
		}
		// Designate listener
		httpObject.onreadystatechange = function () 
		{
			if (httpObject.readyState == 4)
				ajaxExecution(divName, finishAction);
		}
	}	
}

// Update the Contact Page
function ajaxExecution(divName, finishAction)
{
	// If connection failure, alert to failed connection
	if (httpObject.responseText == '')
		document.getElementById(divName).innerHTML = '<p>The connection has been interrupted.</p><p>Please check your internet connection and try again.</p>';
	else
	{
		// Do not update if requested
		if (finishAction != 'no_update')
		{
			// Update content
			document.getElementById(divName).innerHTML = httpObject.responseText;
			// Show js buttons
			ajaxify(divName, 'ajaxbutton', 'unhidden');
			// Hide nonjs buttons
			ajaxify(divName, 'nonjsbutton', 'hidden');
			// If in site view mode, ajaxify links
			if (document.getElementById('site_view').value == 'site')
			{
				// IE6 Members fix
				if (isIE6 && (currentPage == 'members'))
					ajaxify(divName, '\\?members', '#members');
				// Otherwise
				else
					ajaxify(divName, '\"\\?', '"#');
			}
			// If a finshing action is specified, do it
			if (finishAction != null)
				finishAction();
		}
	}
	// Hide loading div
	hideDiv('loading');
}

// Get the HTTP Object
function getHTTPObject()
{
	// Try method 1
   	if (window.ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP");
	// Try method 2
   	else if (window.XMLHttpRequest) return new XMLHttpRequest();
	// Fail
   	else {
      alert("Your browser does not support AJAX. To rectify this problem please disable JavaScript or upgrade your browser.");
      return null;
   }
}  

// Reload the site
function siteReload()
{
	// Override exit prevention
	exitOverride = true;
	// Refresh the site
	document.location.reload();
}

// Detect IE6
function isIE6()
{
	return ( document.all && (/msie 6./i).test(navigator.appVersion) && window.ActiveXObject ) ? true : false;
}