// created by Thomas Pickett tom.pickett@refinery.com


function windowplus(win)
	{
		// data members
		
		this.ns4 =false;
		this.ns6 =false;
		this.ie =false;
		this.ie4=false;
		this.ie5=false;
		this.ie6 =false;
		this.br6 =false;
		this.pc =false;
		this.mac =false;
		// this.win = window;
		this.vernum =false;
		this.vernumlong = 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.returnobjstr = windowplus_returnobjstr;
		this.returnobj = windowplus_returnobj;
		
		// initialize
		this.init();
	}
	
function windowplus_init()
	{
		this.vernum = parseInt(navigator.appVersion); 
		this.vernumlong = navigator.appVersion;
		 
		var is_minor = parseFloat(navigator.appVersion); 
	
		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.agt = navigator;
		this.ie  = (this.iegeneral) && (this.vernum >= 4); 
		
		if(!(this.ns4) && !(this.ns6))
			{
				if(document.getElementById)
				{
					this.ie5 = true;
				} else {
					this.ie4 = true;
				}
			}
		
		
		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);
if(this.ns6)
	{
		return(this.win.outerWidth);
	}



return(-1);

}
function windowplus_getwindowheight() {
if (this.ns4 || this.ns6)
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;	 
  } 	
  
  
function windowplus_returnobjstr(refwhat)
	{
		
		var ie5notmac = (this.ie5 && this.pc) ? 1: 0; 
	
		if(this.ns6 || ie5notmac)
			{return 'document.getElementById(\''+refwhat+'\');';}
					
		if(this.ie4)
			{return 'document.all.' + refwhat;}	
	
		if(this.mac && this.ie)
			{return 'document.all.' + refwhat;}	
			
		// this will only work on layer and div tags for netscape 4.x.x.
		if(this.ns4)
			{return 'window.document.' + refwhat;}
	}  
  
function windowplus_returnobj(refwhat)
	{
		
		var ie5notmac = (this.ie5 && this.pc) ? 1: 0; 
	
		if(this.ns6 || ie5notmac)
			{return document.getElementById(refwhat);}
					
		if(this.ie4)
			{return eval('document.all.' + refwhat);}	
	
		if(this.mac);
			{
				if(this.ns4)
					{
						return eval('window.document.' + refwhat);
					} else {
						return eval('document.all.' + refwhat);	
					}
				
				// alert('this.mac ' + this.mac + ' this.ie ' + this.ie);
				
			
			}	
			
		// this will only work on layer and div tags for netscape 4.x.x.
		if(this.ns4)
			{return eval('window.document.' + refwhat);}
	}   
 
 
 
 
  
  
  
  
