	
	var popupPrintWindow = null;
	
	function getObjectHeight( divobj ){

			var height = 0;
		
			if ( !divobj ){
				alert("error");
			}
		
			if(divobj.offsetHeight){ 	
		
				height = divobj.offsetHeight;
				
			}else if(divobj.style.pixelHeight){ 	
				height = divobj.style.pixelHeight;
			}
		
			else if(divobj.style.height){ 	
				height = divobj.style.height;
			}
		
			//alert( "height is " + height );
		
			return height;
  }

  /* Enlarge right column, to make it expand all the way down (to the footer) 
  	 
  */
  
  function enlargeRightColumn(){

	  var barkergroup = "barkergroupdrill";
	  var ishomepage = false;
	  
	  if ( arguments.length >= 1 ) {
		  barkergroup = arguments[0];
	  }
	  
	  var toppadd = 270;  //the logic below will only work if the 
							    //main content is at least this value in height
	  var error = 0;
	  
	  var div_to_grow = "dummybarker";
	  
	  
	  if ( barkergroup == "barkergroup1"){
		  ishomepage = true;
	  }
	  
	  if ( ishomepage ) {
		  toppadd = 318;
		  error = -48;
	  }
	  
	  
	  //alert("will enlarge " +  div_to_grow );
	  
	  //alert('will enlarge: ' +   barkergroup );
	  
			//2 things to change
			var div1 = document.getElementById( div_to_grow );
			var div2 = document.getElementById( barkergroup );
		
			var dummbarkerheight = 271;   //dummy barker height
			var extra_height = 0;
			

			if ( div1 ) {

				//get the main text column of the page
				var tablecenter = document.getElementById("columncenter");

				if ( tablecenter ) {
					var aheight = getObjectHeight(tablecenter);
					if ( aheight > toppadd ){
						
						
						div1.style.display="block";
						
						if ( ishomepage ) {
						
							var barker3_div = document.getElementById("barker3");
							if ( barker3_div){
								barker3_div.style.borderBottom = "1px solid #ccd8a7";
							}
						}
						
						//alert("Height is " + aheight );
						aheight = aheight - toppadd;
						aheight += extra_height;
						div1.style.height =  aheight+ "px";					
						div2.style.height =  (aheight+dummbarkerheight-error)+ "px";					
						
					}
				}else{
							//alert("not found2");					
					}
			}else{
				//alert("not found1");
			}
		 
  }

   function initDrillPage(){
	   		enlargeRightColumn();

   }
   
   
   
  function openPrintWindow( url ) {
	  	
			var nWidth = 620;
			var nHeight = 650;
			var x = (screen.width - nWidth) / 3;
			var y = (screen.height - nHeight) / 3;		

			var optionString = "scrollbars=yes,location=no,resizable=yes,status=no,";
			optionString += "height=" + nHeight + ",width=" + nWidth;
			optionString += ",screenX="+ x +",screenY="+ y +",top="+ y +",left="+ x;

		    if (! popupPrintWindow || popupPrintWindow.closed ) {
		    	popupPrintWindow = window.open(url,"windowPrintView",optionString);
		    } else {
		    	// window already exists, so bring it forward
			    popupPrintWindow.location.href=url;
			    popupPrintWindow.focus();
			}
	}
	
	
	function enlargeMainContent( leftnavid, cell_id){
		var leftnav = document.getElementById( leftnavid );
		var maincell = document.getElementById( cell_id);
		
		if ( leftnav && maincell ){
			var aheight1 = getObjectHeight( leftnav );
			var aheight2 = getObjectHeight( maincell );
			
			if ( aheight2 < aheight1 - 20 ) {
				maincell.style.height = ( aheight1 + 20 ) + "px";
			}
		}
	}
	
	var popupEmailPageWindow = null;
	
	
	var emailPageWindow = null;
	
	/* function created for integrating the "e-mail a friend" function  */
  function openEmailWindow(  ) {

	  				
	  
	  //var currpage = window.location.href.replace("http://", "" ) ;
			var currpage = window.location.href;
			
			currpage = currpage.replace(/\//g, "||" );
			
			//alert( currpage ); 
		
			if ( currpage.indexOf("/") != -1 ) {
				//alert( "bad parameters" );
				return;
			} 
			
			var url = "http://webapp.chsli.org/utils/mailpage/" +  currpage   ;
	  	
			//alert( "url will be : " + url ) ;
			
			var nWidth = 480;
			var nHeight = 650;
			var x = (screen.width - nWidth) / 3;
			var y = (screen.height - nHeight) / 3;		

			var optionString = "scrollbars=yes,location=no,resizable=yes,status=no,";
			optionString += "height=" + nHeight + ",width=" + nWidth;
			optionString += ",screenX="+ x +",screenY="+ y +",top="+ y +",left="+ x;

		    if (! emailPageWindow || emailPageWindow.closed ) {
		    	emailPageWindow = window.open(url,"emailPageWindow",optionString);
		    } else {
		    	// window already exists, so bring it forward
			    emailPageWindow.location.href=url;
			    emailPageWindow.focus();
			}
	  
	  
        }
