// JScript source code
//The sniffer script was taken from
/* cbe_core.js $Revision: 0.22 $
 * CBE v4.19, Cross-Browser DHTML API from Cross-Browser.com
 * Copyright (c) 2002 Michael Foster (mike@cross-browser.com)
 * Distributed under the terms of the GNU LGPL from gnu.org
*/

function ESGetElement(myId)
{
	
	if(document.layers) 
	{
		//alert("Using Layers");
		return document.forms[0].myId;
	}

	if ((window.is.nav6up ) || (window.is.opera)) //(document.all) 
	{
		//alert("Using All[]");
		return document.all[myId];
	} 
	
	if (window.is.dom1getbyid)
	{
		//alert("using getElementByID");
		return document.getElementById(myId);
	} 
	
	
	
	alert('ES_ERROR: ESGetElement returning null');
	ShowBrowser();
	return null;
}

function ESGetElementsByTagName(myName)
{
	if (document.layers) 
	{
		return document.forms[0].myName;
	} 
	
	if ((window.is.nav6up ) || (window.is.opera)) //(document.all) 
	{
		//alert("Using All[]");
		return document.all[myName];
	} 
	if (window.is.dom1getbyid)
	{
		//alert("using getElementByID");
		return document.getElementsByTagName(myName);
	} 
	
	alert('ES_ERROR: ESGetElement returning null');
	ShowBrowser();
	return null;
}

function TestElements(id)
{
	var ele = ESGetElement(id);
	alert(ele.name);
}

function ShowBrowser()
{
//Function for debug purposes 
	var alertString = "Unknown Browser\n";
	if(window.is.ie3) alertString = "IE 3 or even lower\n";
	if(window.is.ie4) alertString = "IE 4\n";
	if(window.is.ie4up) alertString = "IE 4+\n";
	if(window.is.ie5) alertString="IE 5\n";
	if(window.is.ie5up) alertString="IE 5+\n";
	if(window.is.ie6) alertString="IE 6\n";
	if(window.is.ie6up) alertString="IE 6+\n";
	if(window.is.nav4) alertString="Netscape 4\n";
	if(window.is.nav4up) alertString="Netscape 4+\n";
	if(window.is.nav5up) alertString="Netscape 5+\n";
	if(window.is.nav6) alertString="Netscape 6\n";
	if(window.is.nav6up) alertString="Netscape 6+\n";
	if(window.is.opera) alertString="Opera\n";
	if(window.is.opera5) alertString="Opera 5\n";
	if(window.is.opera6) alertString="Opera 6\n";
	if(window.is.opera7) alertString="Opera 7\n";
	if(window.is.opera9) alertString="Opera 9\n";
	//Minor browsers
	if(window.is.kong) alertString="Konqueror\n";
	if(window.is.hotjava) alertString="HotJava\n";
	if(window.is.webtv) alertString="Web TV\n";
	if(window.is.aol) alertString="AOL\n";
	
	alertString = "You are using\n" + alertString + "Thanks for testing";
    alertString = alertString + "\n" + navigator.userAgent.toLowerCase();
		
	alert(alertString);
	
}

function ClientSnifferJr()
{
  this.ua=navigator.userAgent.toLowerCase();
  this.major=parseInt(navigator.appVersion);
  this.minor=parseFloat(navigator.appVersion);
  if (document.addEventListener && document.removeEventListener) this.dom2events=true;
  if (document.getElementById) this.dom1getbyid=true;
  if (window.opera)
  {
    this.opera=true;
    this.opera5=(this.ua.indexOf("opera 5") !=-1 || this.ua.indexOf("opera/5") !=-1);
    this.opera6=(this.ua.indexOf("opera 6") !=-1 || this.ua.indexOf("opera/6") !=-1);
    this.opera5or6=this.opera5 || this.opera6;
    this.opera7=(this.ua.indexOf("opera 7") !=-1 || this.ua.indexOf("opera/7") !=-1);
	this.opera9=(this.ua.indexOf("opera 9") !=-1 || this.ua.indexOf("opera/9") !=-1);
    return;
 }
 this.konq=this.ua.indexOf('konqueror') !=-1;
 this.ie=this.ua.indexOf('msie') !=-1;
 if (this.ie)
 {
    this.ie3=this.major < 4;
    this.ie4=(this.major==4 && this.ua.indexOf('msie 5')==-1 && this.ua.indexOf('msie 6')==-1);
    this.ie4up=this.major >=4;
    this.ie5=(this.major==4 && this.ua.indexOf('msie 5.0') !=-1);
    this.ie5up=!this.ie3 && !this.ie4;
    this.ie6=(this.major==4 && this.ua.indexOf('msie 6.0') !=-1);
    this.ie6up=(!this.ie3 && !this.ie4 && !this.ie5 && this.ua.indexOf("msie 5.5")==-1);
    return;
 }
 this.hotjava=this.ua.indexOf('hotjava') !=-1;
 this.webtv=this.ua.indexOf('webtv') !=-1;
 this.aol=this.ua.indexOf('aol') !=-1;
 if (this.hotjava || this.webtv || this.aol) return;
 // Gecko, NN4, and NS6
 this.gecko=this.ua.indexOf('gecko') !=-1;
 this.nav=(this.ua.indexOf('mozilla') !=-1 && this.ua.indexOf('spoofer')==-1 && this.ua.indexOf('compatible')==-1);
 if (this.nav)
 {
    this.nav4=this.major==4;
    this.nav4up=this.major >=4;
    this.nav5up=this.major >=5;
    this.nav6=this.major==5;
    this.nav6up=this.nav5up;
 }
}
window.is=new ClientSnifferJr();

