function OpenCustomWindow(sUrl, sName, nWidth, nHeight, bScrollBars, bToolBar, bLocation, bResizable, bMenuBar, bStatus, nX, nY) {
   if ((typeof nWidth == 'undefined') || (nWidth == null)) nWidth = 600;
   if ((typeof nHeight == 'undefined') || (nHeight == null)) nHeight = 450;
   if ((typeof bScrollBars == 'undefined') || (bScrollBars == null)) bScrollBars = false;
   if ((typeof bToolBar == 'undefined') || (bToolBar == null)) bToolBar = false;
   if ((typeof bLocation == 'undefined') || (bLocation == null)) bLocation = false;
   if ((typeof bResizable == 'undefined') || (bResizable == null)) bResizable = false;
   if ((typeof bMenuBar == 'undefined') || (bMenuBar == null)) bMenuBar = false;
   if ((typeof bStatus == 'undefined') || (bStatus == null)) bStatus = false;
   if ((typeof nX == 'undefined') || (nX == null)) nX = -1;
   if ((typeof nY == 'undefined') || (nY == null)) nY = -1;
  
   var param = "width=" + nWidth + ",height=" + nHeight 
                                 + ",scrollbars=" + (bScrollBars ? "yes" : "no")
                                 + ",toolbar=" + (bToolBar ? "yes" : "no")
                                 + ",menubar=" + (bMenuBar ? "yes" : "no")
                                 + ",location=" + (bLocation ? "yes" : "no")
                                 + ",resizable=" + (bResizable ? "yes" : "no")
                                 + ",status=" + (bStatus ? "yes" : "no")
                                 + ((nX != -1) ? ",left=" + nX : "" )
                                 + ((nY != -1) ? ",top=" + nY : "" );
    
   window.open(sUrl, sName == null ? "" : sName, param);
}


function popUp(height, width, filePrefix, imageId){
	var imageHeight = height;
	var imageWidth = width;
	var ratio;
	if(height > width){
		if(height > 500){
			ratio = height/500;
			imageHeight = 500;
			imageWidth = Math.round(width/ratio);
		}
	}
	else{
		if(width > 640){
			ratio = width/640;
			imageWidth = 640;
			imageHeight = Math.round(height/ratio);
		}
	}
	strProperties="top=100,left=100,directories=no,height=" + (imageHeight + 135) + ",width=" + (imageWidth + 10) + ",toolbar=no,scrollbars=no,resizable=no,location=no,menubar=no";
	url="imageDetail.asp?filePrefix=" + escape(filePrefix) + "&imageId=" + imageId + "&height=" + imageHeight + "&width=" + imageWidth;
	window.open(url, "", strProperties);
}


function OpenModelDialog(sUrl,nWidth,nHeight) {
	if ((typeof nWidth == 'undefined') || (nWidth == null)) nWidth = 600;
	if ((typeof nHeight == 'undefined') || (nHeight == null)) nHeight = 450;
	return window.showModalDialog(sUrl,"","dialogWidth:"+nWidth+"px;dialogHeight:"+nHeight+"px;edge:Raised;dialogTop:200px;dialogLeft:200px;help:0;resizable:0;maximize:0;minimize:1;status=0;");
}


function OpenModelLessDialog(sUrl,nWidth,nHeight) {
	if ((typeof nWidth == 'undefined') || (nWidth == null)) nWidth = 600;
	if ((typeof nHeight == 'undefined') || (nHeight == null)) nHeight = 450;
	window.showModelessDialog(sUrl,"","dialogWidth:"+nWidth+"px;dialogHeight:"+nHeight+"px;edge:Raised;dialogTop:200px;dialogLeft:200px;help:0;resizable:1;status=0;");
}



