var undefined;

/**
 *	=========================================================================================
 *   browser.js:
 *			Utilities class use to detect the browser type
 *
 *	=========================================================================================
 */

var browserDetector = new browserDetector();
 


function detectVersion(subStr)
{
   this.major=0;
   this.minor=0;
   
   p1=subStr.indexOf('.');
   if (p1>0) {
		this.major = subStr.substr(0,p1);
		this.minor = subStr.substr(p1+1, subStr.length-p1);
   }
   else major=subStr;
}
 
function browserDetector()
{
    this.userAgent = navigator.userAgent;
    this.detectVersion = detectVersion;

    index_MSIE		= this.userAgent.indexOf("MSIE");
    index_OPERA		= this.userAgent.indexOf("Opera");
    index_MOZILLA4	= this.userAgent.indexOf("Mozilla/4");
    index_MOZILLA5	= this.userAgent.indexOf("Mozilla/5");
    index_NETSCAPE6	= this.userAgent.indexOf("Netscape6");
    
	this.isOpera = false;
	this.isNavigator = false;
	this.isMozilla = false;
	this.isIE = false;
	
    if (index_OPERA>=0) {
		this.isOpera=true;
		this.type="OPERA";
		start	= index_OPERA+6;
		end		= this.userAgent.indexOf(" ", index_OPERA+6);
		subStr	= this.userAgent.substr(start, end-start);
		this.detectVersion(subStr);
    }
    else if (index_MSIE>=0) {
		this.isIE=true;
		this.type="IE";
		start	= index_MSIE+5;
		end		= this.userAgent.indexOf(";", index_MSIE+5);
		subStr	= this.userAgent.substr(start, end-start);
		this.detectVersion(subStr);
    }
    else if (index_MOZILLA5>=0) {
		this.type="Mozilla";
		this.isMozilla = true;
		start	= index_MOZILLA5+8;
		end		= this.userAgent.indexOf(" ", index_MOZILLA5+8);
		subStr	= this.userAgent.substr(start, end-start);
		this.detectVersion(subStr);
    }
    else if (index_MOZILLA4>=0) {
		this.isNavigator = true;
		this.type="NS4";
		start	= index_MOZILLA4+8;
		end		= this.userAgent.indexOf(" ", index_MOZILLA5+8);
		subStr	= this.userAgent.substr(start, end-start);
		this.detectVersion(subStr);
    }
  
    
    function showItem(itemCode) {
			return ("__sgx_action=EComItemDetailsSection.ShowItemExternalByCode('" + itemCode + "')");
	}
}
 
