	
	////////////////////////////////////////////////////////////
	//
	//	DEFAULT_PAGE.JS - last updated Oct 17, 2006
	//	
	////////////////////////////////////////////////////////////
	//
	//	Any function used by more than a single page/frame should
	//	be in this file.
	//
	//	Functions that are used only on one page/frame are
	//	contained in the HTML page that uses them, or in
	//	an external JS page with the same name as the HTML page.
	//
	////////////////////////////////////////////////////////////




///////////////////////////////////////////////////////////////////////////

	 function Window_Size()
	{	
	 // This function eturns width and height of current 
	 // window/frame.  It is used by functions
	 // that resize containers based on window size.
	 // (This version works in IE AND Firefox...)
	 		
		var win_coords = new Array(0,0)
		d=document
		if (typeof window.innerWidth!='undefined') {
		 var winWidth = window.innerWidth;
		 var winHeight = window.innerHeight;
		} else {
		 if (d.documentElement && 
		  typeof d.documentElement.clientWidth!='undefined' && 
		   d.documentElement.clientWidth!=0) {
		  var winWidth = d.documentElement.clientWidth
		  var winHeight = d.documentElement.clientHeight
		 } else {
		  if (d.body && 
		   typeof d.body.clientWidth!='undefined') {
		   var winWidth = d.body.clientWidth
		   var winHeight = d.body.clientHeight
		  }
		 }
		}
		win_coords[0] = winWidth
		win_coords[1] = winHeight
	 return win_coords
	} 
	
	////////////////////////////////////////////////////////////

			 	
	 function resize_container (containerName, minusWidth, minusHeight, passed_minWidth, passed_minHeight)
	{
	// This function accepts multiple container names separated by "^", or a single container name...	
	// 		- It calls resize_container_action for each Container.
	// 		- minusWidth and minusHeight are the amount of px to subtract from the total size of the current window...
	// 		- passed_minWidth and passed_minHeight are the minimum size for the container to be adjusted to
	//		  NOTE: If a container has a width based on %, that setting over-rides trying to reset it here.  
	//				Also, if no minimums are supplied it makes the minimum size 50 x 50.	
	
		 var minWidth = 50	
		 if(passed_minWidth != null)
				minWidth = passed_minWidth
				
		 var minHeight = 50		
		 if(passed_minHeight != null)
				minHeight = passed_minHeight
					   				
		if(containerName.lastIndexOf('^')==-1)
			{
			 resize_container_action (containerName, minusWidth, minusHeight, minWidth, minHeight)
			}
		else
			{
			 // Multiple Containers
			 var ContainerArray = containerName.split("^") 
			 	 for(i=0; i< ContainerArray.length; i++) 
			 	 resize_container_action (ContainerArray[i], minusWidth, minusHeight, minWidth, minHeight)
			}			
	}	
	
					 function resize_container_action (containerName, minusWidth, minusHeight, minWidth, minHeight)
					{

						var compensatedWidth = Window_Size()[0] - minusWidth;
						var compensatedHeight = Window_Size()[1] - minusHeight;
							if(compensatedWidth < minWidth+1)
								compensatedWidth = minWidth
							if(compensatedHeight < minHeight+1)
								compensatedHeight = minHeight
								
						if(document.getElementById(containerName))
						{
							if(minusWidth > -1)
								document.getElementById(containerName).style.width = compensatedWidth;
							if(minusHeight > -1)
								document.getElementById(containerName).style.height = compensatedHeight;
						}
					}	
	
	

	////////////////////////////////////////////////////////////
	
					
		 function Hover_Button(obj,bool)
		{
		 // This function allows a quick and easy way to hover over "buttons", or any image
		 // that has an "on" and "off" state for mouseovers.  It does require that
		 // the ID of the image be called the name of the image WITHOUT the "_on.gif" and
		 // "_off.gif" ending, and that CLASS="button".  Also, images must be GIFs.
		 //
		 // Example of caller:
		 //		<img src="../images_1/grabber_off.gif" id="grabber" class="button" 
		 //			 onmouseover="Hover_Button(this,1)"  onmouseout="Hover_Button(this,0)">
		 
		 if(bool==0)
		 	{
		 	 document.getElementById(obj.id).src="../images_1/" + obj.id + "_off.gif"
		 	}
		 else
		 	{
		 	 document.getElementById(obj.id).src="../images_1/" + obj.id + "_on.gif"
		 	}	
		}	
			

	////////////////////////////////////////////////////////////


	 function popup_window(x,y) 
	{	
		// all popups go through this function... 
		// x is a string or "label" that says which popup to launch.
		// y is secondary information that may (or may not) be used, for instance to pass a varible
		// needed by a particular popup.
		
		switch (x) 
		{
		// Resizable Popups (they have "status=yes" which allows the corner to be grabbed

		 case 'Approve':
		    var popup_Approve = window.open('popup_Approve.htm','popup_Approve','left=5,top=5,toolbar=0,menubar=0,dependant=0,status=yes,location=0,scrollbars=0,resizable=yes,width=300,height=200');	
 			break; 			
		 case 'Reject':
		    var popup_Reject = window.open('popup_Reject.htm','popup_Reject','left=5,top=5,toolbar=0,menubar=0,dependant=0,status=yes,location=0,scrollbars=0,resizable=yes,width=300,height=200');	
 			break; 			
		 case 'Edit':
		    var popup_Edit = window.open('popup_Edit.htm','popup_Edit','left=5,top=5,toolbar=0,menubar=0,dependant=0,status=yes,location=0,scrollbars=0,resizable=yes,width=500,height=280');	
 			break; 

		// Non-Resizable Popups ("status=no")

		 case 'Layout':
		    var popup_Layout = window.open('popup_Layout.htm','popup_Layout','left=5,top=5,toolbar=0,menubar=0,dependant=0,status=0,location=0,scrollbars=0,resizable=0,width=330,height=180');	
 			break; 			

		 default:
		    alert('See js_1\\default.js, popup_window(\'' + x + '\')...\nThis popup needs to be coded still...')
	 	    break; 
	    }
	}	


///////////////////////////////////////////////////////////////////////////


		 function hover_over_header(obj,bool)
		{
			// This function is used to highlight a column header on mouseover.  Note,
			// it only changes the Hex color of the background because these cells have a
			// background image already that is used to have the 1 pixel separator...
			//
			// obj 		= the TD object that is being "hovered over"
			// if bool	= 1 means mouseover
			// if bool	= 2 it means mouseout
			
			if(bool==1)
				obj.style.backgroundColor='#B9C8DC'
			else
				obj.style.backgroundColor='#D3DDE7'
		}
			 

///////////////////////////////////////////////////////////////////////////


		 function hover_over_row(obj,bool)
		{
			// This function is used to "highlight" rows on data tables (like in the TRADE frame)
			// obj 		= the TD object that is being "hovered over"
			// if bool	= 1 means mouseover
			// if bool	= 2 it means mouseout
			
			if(bool==1)
				{
				 if(obj.className == 'row_disabled') // this hack is needed or else the font-style gets reset to 'normal'
				 	obj.style.fontStyle='italic'
	 			 old_row_class = obj.className
				 obj.className = 'row_hover'
				}
			else
				obj.className = old_row_class
		}
		
///////////////////////////////////////////////////////////////////////////

			 
		 function sort_this(sort_col)
		{
			// sort_col	= the column # to sort on...
			
			alert('sort this table on column #' + sort_col + '\n[This action not completed in prototype...]')	
		}			
	
	
///////////////////////////////////////////////////////////////////////////	

		 function toggleContent(obj)
		{
			var Frag = obj.parentNode.previousSibling
				if(Frag.className=='fragOn')
					{
						Frag.className='fragOff';
					}
				else
					{
						Frag.className='fragOn';
					}

		}
		
		 function editContent(arg1, arg2, arg3, arg4, arg5)
		{
				// function editContent('mainC',2,'_H_default.asp','../default.asp')
			document.FORM_EDIT.action = "../admin/edit_page.asp"
			document.FORM_EDIT.Edit_File.value = arg3
			document.FORM_EDIT.Edit_Dir.value = arg2
			document.FORM_EDIT.Edit_URL.value = arg4
			document.FORM_EDIT.Edit_Headline.value = arg5
			//alert(document.FORM_EDIT.Edit_URL.value)
			document.FORM_EDIT.submit()
		}		