
//
// Filename: lockout_functions.js
// 
// Description: contains JavaScript function(s) that assist in locking down file downloads.
// 
// Other files involved: /includes/lockout_functions.php
//						 /lockout_form.php
//


//-------------------------------------------------------------------------------
//
// Function: open_lockout 
// 
// Description: opens a new window containing a web form that a user 
//				needs to complete to continue the download. 
//
// Parameters: r (string) - the requested download. Usually the location of a file.
//
// Returns: none
//
   function open_lockout(r) {

      window.open('/lockout_form.php?download='+r,'mywindow','resizable=1, top=100, left=300, width=350, height=575');
	  
   }


//-------------------------------------------------------------------------------
//
// Function:	fullsize_window
//
// Description:	resize a window to full size
//
// Parameters:	none
//
// Returns:		none
//
   function fullsize_window() {

      window.moveTo(0,0);	
		
	   if (document.all) {

          top.window.resizeTo(screen.availWidth,screen.availHeight);
	
	   }	
		
	   else if (document.layers||document.getElementById) {

          if (top.window.outerHeight < screen.availHeight || top.window.outerWidth < screen.availWidth){
				 
		     top.window.outerHeight = screen.availHeight;
				 
		     top.window.outerWidth = screen.availWidth;
		  
		  }
	
	   }
 		   
   }
   
   
//-------------------------------------------------------------------------------
//
// Function:	open_window
//
// Description:	opens a new window
//
// Parameters:	location (string) the URL for the new window. 
//
// Returns:		none
//
   function open_window(location) {

	  window.open(location);
	
   }
 

//-------------------------------------------------------------------------------
//
// Function:	change_location
//
// Description:	changes the location.href of a window, i.e. relocates the user
//
// Parameters:	location (string) the URL for the new window. optional.
//
// Returns:		none
//
   function change_location(location) {

	  self.location.href = location;
		
   }
   
  
//-------------------------------------------------------------------------------
//
// Function:	close_window
//
// Description:	closes current window
//
// Parameters:	none
//
// Returns:		none
//
   function close_window() {

      self.close();
		
   }
 