
/* 
 * Check for IE for tutorials (alert if not)
 */
var detect = navigator.userAgent.toLowerCase();
var OS,browser,thestring,place;
var version = 0;

if (checkIt('konqueror')) {
   browser = "Konqueror";
   OS = "Linux";
}
else if (checkIt('safari')) browser = "Safari"
else if (checkIt('omniweb')) browser = "OmniWeb"
else if (checkIt('opera')) browser = "Opera"
else if (checkIt('webtv')) browser = "WebTV";
else if (checkIt('icab')) browser = "iCab"
else if (checkIt('msie')) browser = "Internet Explorer"
else if (!checkIt('compatible')) {
   browser = "Gecko-based browsers (Firefox, Mozilla, Netscape etc)"
   version = detect.charAt(8);
}
else browser = "a browser";

if (!version) version = detect.charAt(place + thestring.length);

if (!OS) {
   if (checkIt('linux')) OS = "Linux";
   else if (checkIt('x11')) OS = "Unix";
   else if (checkIt('mac')) OS = "a Mac"
   else if (checkIt('win')) OS = "Windows"
   else OS = "a different operating system";
}

function checkIt(string) {
   place = detect.indexOf(string) + 1;
   thestring = string;
   return place;
}

function checkIE() {
   if (OS=="a Mac") alert('You must use Internet Explorer on Windows for the tutorials to function properly. They will not display correctly in ' + browser + ' on ' + OS + '.');
   else if (!(browser=="Internet Explorer")) alert('You must use Internet Explorer on Windows for the tutorials to function properly. They will not display correctly in ' + browser + '.');
}

/* 
 * Change a class name of an element if not IE
 */
function changeIE(id, newClass) {
   if (!(browser=="Internet Explorer" && OS=="Windows")) {
      var identity;
      identity=document.getElementById(id);
      identity.className=newClass;
   }
}