// created by Thomas Pickett tom.pickett@refinery.com


function windowplus(win)
	{
		// data members
		
		this.ns4 =false;
		this.ns6 =false;
		this.ie =false;
		//this.ie4;
		// this.ie5;
		this.ie6 =false;
		this.br6 =false;
		this.pc =false;
		this.mac =false;
		// this.win = window;
		this.vernum =false;
		this.agt =false;
		if(win)
		this.win = win;
		else
		this.win = window;
		
		// member functions
		this.getwindowwidth = windowplus_getwindowwidth;
		this.getwindowheight = windowplus_getwindowheight;
		this.setwindowwidth = windowplus_setwindowwidth;
		this.setwindowheight = windowplus_setwindowheight;
		this.popup = windowplus_popup;
		this.init = windowplus_init;
		
		this.init();
	}
	
function windowplus_init()
	{
		this.vernum = parseInt(navigator.appVersion); 
		var is_minor = parseFloat(navigator.appVersion); 
		// var agt=navigator.userAgent.toLowerCase(); 
		var agt=navigator.userAgent.toLowerCase(); 
		var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) 
	                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) 
	                && (agt.indexOf('webtv')==-1)); 
		this.ns4 = (is_nav && (this.vernum == 4));
		this.ns6 = (is_nav && (this.vernum == 5)); 
		this.iegeneral  = (agt.indexOf("msie") != -1); 
		var is_ie3  = (this.iegeneral&& (this.vernum < 4)); 
	    // this.ie  = (this.iegeneral&& (this.vernum >= 4) && (agt.indexOf("msie 5.0")==-1) ); 
	    // alert('ie general ' + this.iegeneral + '\n' + ' is major ' + this.vernum);
		this.agt = navigator;
		this.ie  = (this.iegeneral) && (this.vernum >= 4); 
		
		// this.ie5      = (this.iegeneral && (!is_ie3) && !this.ie4); 
	    // this.ie6  = (this.iegeneral && !is_ie3 && !this.ie4); 
		this.mac    = (agt.indexOf("mac")!=-1);	
		this.pc = (!(this.mac)) ? 1 : 0;
	}	
	
	
function windowplus_getwindowwidth() {
if (this.ns4)
return(this.win.innerWidth);
if (this.ie)
return(this.win.document.body.offsetWidth);
return(-1);
}
function windowplus_getwindowheight() {
if (this.ns4)
return(this.win.innerHeight);
if (this.ie)
return(this.win.document.body.offsetHeight);
return(-1);
}

function windowplus_setwindowwidth(num) {
if (this.ns4)
this.win.innerWidth = num;
if (this.ie)
this.win.offsetWidth = num;
}
function windowplus_setwindowheight(num) {
if (this.ns4)
this.win.innerHeight = num ;
if (this.ie)
this.win.offsetHeight = num;
return(-1);
}



function windowplus_popup(url,w,h,winname,scrolloption)
  { 
	if (scrolloption == null)
	 	{scrolloption = 'no';} 	 
	if (winname == null)
		{winname = 'newwindow';}
	var browserstring = '';
	var windowoptions = 'width='+w+',height='+h+',resizable=no,scrollbars='+scrolloption;
	var newwin = this.win.open(url,winname,windowoptions);  
	newwin.focus(); 
	return newwin;	 
  } 	
  
  