﻿
function openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function openModalWindow(passedDiv, passedBgDiv) {
	var div = $(passedDiv);        
	var bgDiv = $(passedBgDiv);        
	var docDim = Element.getDimensions(document.body);        
	//get the size of the window and calculate where the box should be placed        
	var wDim = getBrowserWindowSize();        
	var dDim = Element.getDimensions(div);        
	//div.style.top = ((wDim.height - dDim.height*2) / 2) + 'px';        
	div.style.left = ((wDim.width - dDim.width) / 2) + 'px';        
	if (docDim.height > wDim.height) {            
		wDim.height = docDim.height;        
	}        
	bgDiv.style.width = wDim.width + 'px';
	bgDiv.style.height = '2000px';        
	//bgDiv.style.height = wDim.height + 'px';        
	Element.show(div);        
	Element.show(bgDiv);
}

function closeModalWindow(div, bgDiv) {    
	//Element.hide('ctl00_ContentPlaceHolder_ContentRenderer_Edit');    
	//Element.hide('modalBackgroundDiv');
	Element.hide(div);    
	Element.hide(bgDiv);	
}

function getBrowserWindowSize() {    
	var winW = 630, winH = 460;    
	if (parseInt(navigator.appVersion)>3) {        
		if (navigator.appName=="Netscape") {            
		winW = window.innerWidth;            
		winH = window.innerHeight;        
		}        
	if (navigator.appName.indexOf("Microsoft")!=-1) {            
		winW = document.body.offsetWidth;            
		winH = document.body.offsetHeight;        
	}  
	}    
	var rval = {        
	width: winW,        
	height: winH    
};    

return rval;
}

