function PopUpBrowser() { };

PopUpBrowser.prototype.createWindow = function(parentWindow,name) {
	this.name = name;
};
PopUpBrowser.prototype.updateWindow = function(position,left,top,width,height,src,features) {
	//alert('PopUpBrowser_updateWindow(' + left + ',' + top + ',' + width + ',' + height + ',' + src + ',' + features + ')');										

	if(!src){
		return;
	}
	if(!this.popUpBrowser||this.popUpBrowser.closed){
		//alert("not open, create");			
		var agt = navigator.userAgent.toLowerCase();
		
		if (agt.indexOf("msie") == -1 && src.indexOf("http://") == -1) {
			var host = window.location.hostname;
			src = "http://" + host + src;
		}
	
		if ((features.indexOf("fullscreen=yes") != -1) && (agt.indexOf("msie") == -1)) {
			var newwidth = window.screen.availWidth;
			var newheight = window.screen.availHeight;
			this.popUpBrowser = window.open(src,this.name,'width='+newwidth+',height='+newheight+',left='+left+',top='+top+','+features);
		} else {

			if(width!="0" && height!="0")
				var features = this.buildFeatures(width,height,left,top,features)

			if(!features)
				this.popUpBrowser = window.open(src,this.name);
			else 
				this.popUpBrowser = window.open(src,this.name,features);
				
		}
	}else{
		//alert("open, update");	
		// update the style of the pop up window
		this.popUpBrowser.moveTo(top,left);	
		this.popUpBrowser.resizeTo(width,height);	

		// if there is a src and the src is different, then update.
		if(src && this.src!=src){
			this.popUpBrowser.location.href = src;	
		}

		// bring it to the front
		this.popUpBrowser.focus();	
	}
	this.src = src;
}
PopUpBrowser.prototype.buildFeatures = function (width, height, left, top, features) {
	var blnHasAProp = false;
	var len = arguments.length;
	for(var i=0;i<len;i++){
		var arg = arguments[i];
		if(arg != '' && arg != null && arg != undefined)
			blnHasAProp = true;
	}
	return (blnHasAProp) ? 'width='+width+',height='+height+',left='+left+',top='+top+','+features : false;
}; 
PopUpBrowser.prototype.destroyWindow = function() {
	//alert('PopUpBrowser_destroyWindow(' + this.popUpBrowser + ')');					
	//if(this.popUpBrowser){	
		//this.popUpBrowser.close();	
	//}	
}

PopUpBrowser.prototype.onPageLoad = function() {
}
