function detectBrowser() {

// This snippet of code was written in Javascript by Sat Tara Singh Khalsa
// on 2007, and may be freely used by all under the terms of the GPL license.
// If you find your browser is not correctly detected, please contact me
// at smonkey@entropia.com.mx and I'll try to fix it!  


var browserName = '';
var fullVersion = 0;
var majorVersion = 0;
var appName = '';
var appVersion = '';
var userAgent = '';

var agent = navigator.userAgent;
var version = navigator.appVersion;
var name = navigator.appName;

// We define some string variables, including the first and last
// words in the userAgent attribute, along with the number which follows 

var first = ' ';
var second = ' ';
var penultimate = ' ';
var ultimate = ' ';
var begin = 0;
var end = 0;
var slash = 0;

begin = agent.lastIndexOf(' ')+1;
end = agent.lastIndexOf('/');
slash = agent.indexOf('/');

first = agent.substring(0,slash);
second = agent.substring(slash+1);

if (begin < end) {
penultimate = agent.substring(begin,end);
ultimate = agent.substring(end+1);
}

// Now we check for individual browsers

// Firefox, checked for 2.0

if (penultimate == 'Firefox') {
browserName = 'Mozilla Firefox...congratulations!';
fullVersion = ultimate;
majorVersion = parseInt(ultimate);
return 0; 
}

// Opera, checked for 9

else if (first == 'Opera') {
browserName = 'Opera...a select minority!';
fullVersion = parseFloat(second);
majorVersion = parseInt(second);
return 0;
}

// Avant, checked for 11.5

else if (agent.indexOf('Avant Browser')!=-1) {
browserName = 'Avant Browser...cheap and non-compliant, but rare';
fullVersion = 'unknown';
majorVersion = 'unknown';
return 1;
}

// Internet Explorer, checked for 6.0

else if (agent.indexOf('MSIE')!= -1) {
browserName = 'Microsoft Internet Explorer...and may God have mercy of your soul!';
begin = agent.indexOf('MSIE')+5;
rest = agent.substring(begin);
end = begin + rest.indexOf(';');
fullVersion = agent.substring(begin,end);
majorVersion = parseInt(fullVersion);
return 1;
} 
 
else {
browserName = agent;
}
document.getElementById('browserName').innerHTML = browserName;
document.getElementById('majorVersion').innerHTML = majorVersion;
document.getElementById('fullVersion').innerHTML = fullVersion;
document.getElementById('userAgent').innerHTML = agent;
document.getElementById('appVersion').innerHTML = version;
document.getElementById('appName').innerHTML = name;
return 1;
}


