// JavaScript Document

//	detect browser, javascriptically
var is = new BrowserDetectLite();

function BrowserDetectLite() {
	var agent = navigator.userAgent.toLowerCase(); 
	
	// Browser version
	this.versionMajor = parseInt(navigator.appVersion); 
	this.versionMinor = parseFloat(navigator.appVersion); 

	// Browser name
	this.ns    = (agent.indexOf('mozilla')!=-1 && agent.indexOf('spoofer')==-1 && agent.indexOf('compatible') == -1 && agent.indexOf('opera')==-1 && agent.indexOf('webtv')==-1); 
	this.ns2   = (this.ns && this.versionMajor == 2); 
	this.ns3   = (this.ns && this.versionMajor == 3); 
	this.ns4   = (this.ns && this.versionMajor == 4); 
	this.ns4up = (this.ns && this.versionMajor >= 4); 
	this.ns6   = (this.ns && this.versionMajor == 5); 
	this.ns6up = (this.ns && this.versionMajor >= 5); 
	this.ie    = (agent.indexOf("msie") != -1); 
	this.ie3   = (this.ie && this.versionMajor < 4); 
	this.ie4   = (this.ie && this.versionMajor == 4 && agent.indexOf("msie 4.0") != -1); 
	this.ie4up = (this.ie && this.versionMajor >= 4); 
	this.ie5   = (this.ie && this.versionMajor == 4 && agent.indexOf("msie 5.0") != -1); 
	this.ie55  = (this.ie && this.versionMajor == 4 && agent.indexOf("msie 5.5") != -1);
	this.ie5up = (this.ie && !this.ie3 && !this.ie4); 
	this.ie6   = (this.ie && this.versionMajor == 4 && agent.indexOf("msie 6.0") != -1);
	this.ie6up = (this.ie && !this.ie3 && !this.ie4 && !this.ie5 && !this.ie55); 
	this.opera = (agent.indexOf("opera") != -1); 
	this.webtv = (agent.indexOf("webtv") != -1); 
	this.aol   = (agent.indexOf("aol") != -1); 
	
	// Javascript version
	this.js = 0.0;
	if (this.ns2 || this.ie3) this.js = 1.0 
	else if (this.ns3 || this.opera || (document.images && this.ie && !this.ie4up)) this.js = 1.1 
	else if ((this.ns4 && this.versionMinor <= 4.05) || this.ie4) this.js = 1.2 
	else if ((this.ns4 && this.versionMinor > 4.05) || this.ie5up) this.js = 1.3 
	else if (this.ns6up) this.js = 1.4 

	// Platform type
	this.win   = (agent.indexOf("win")!=-1 || agent.indexOf("16bit")!=-1);
	this.win32 = (agent.indexOf("win95")!=-1 || agent.indexOf("windows 95")!=-1 || agent.indexOf("win98")!=-1 || agent.indexOf("windows 98")!=-1 || agent.indexOf("winnt")!=-1 || agent.indexOf("windows nt")!=-1 || (this.versionMajor >= 4 && navigator.platform == "win32") || agent.indexOf("win32")!=-1 || agent.indexOf("32bit")!=-1);
	this.mac   = (agent.indexOf("mac")!=-1);
}

// OPEN POPUP

if (is.mac) { var offsetMac = 0; } else { var offsetMac = 0; }

function pop(goPage,nom,windowWidth,windowHeight,style) {
	var x = 0;
	var y = 0;
	var offset = 30;
		
	if (screen) x = (screen.availWidth - windowWidth) / 2;
	if (screen) y = (screen.availHeight - windowHeight) / 2;
	
	
	if ( style == 'POP' ) { 
	    var popped = window.open(goPage,nom,'width='+windowWidth+',height='+(windowHeight+offsetMac)+',status=no,menubar=no,scrollbars=no,resizable=no,screenX='+x+',screenY='+y+',left='+x+',top='+y); 
    }
    
	if ( style == 'POPSCROLL' ) { 
	    var popped = window.open(goPage,nom,'width='+windowWidth+',height='+(windowHeight+offsetMac)+',status=no,menubar=no,scrollbars=auto,resizable=no,screenX='+x+',screenY='+y+',left='+x+',top='+y); 
    }

	if ( style == 'WINDOW' ) {
		if (windowHeight > screen.availHeight) windowHeight = (screen.availHeight - offset);
		var popped = window.open(goPage,nom,'width='+windowWidth+',height='+(windowHeight+offsetMac)+',status=yes,menubar=yes,scrollbars=yes,resizable=yes,screenX='+x+',screenY='+y+',left='+x+',top='+y);
	}
	
	if ( is.ns || document.all) popped.focus();
	if ( !popped.opener) { popped.opener = window; }	
}

