/************************************************************************************/
//	javascripts.js
//
//	Purpose: Central file to store javascipts used on HTML pages.
//	Copyright: Palomar Media. 
//						 Please contact palomar media if you plan on using any part of this file
//						 http://www.palo.com or info@palo.com
//
//	Created: 13.04.2000
//	Modified: 09.05.2000 - D.J. Murchie
//												 Clean up, remove unused functions
//
/************************************************************************************/


/************************************************************************************/
//
// TO USE:
//
// Insert the following line of code into the heading of the
// html page which is going to be using the javascript contained in this file
//
// <SCRIPT LANGUAGE="javascript" SRC="/js/javascripts.js"></SCRIPT>
//
// Remember to check the absolute or relative path, and filename as it may be 
// renamed.
//
/************************************************************************************/




//<SCRIPT LANGUAGE="JAVASCRIPT">
//<!--- Begin Script

/************************************************************************************/
//
// Name: GoToURL
// 
// Type:  function
//
// Purpose : Change the location of the current browser window to jump to the 
//					 url indicated by the value of the form object which invoked the 
//					 function.
//
// Arguements : ControlID of the form object
//
// Returns : nothing
//
// Additional notes :
//
// Edited on/ by :	09.05.2000 - David J. Murchie, Palomar Media
//
/************************************************************************************/

function GoToUrl(controlID)
{
	var d = controlID.options[controlID.selectedIndex].value 
	if (d != "")
	{
		window.top.location.href = d
		controlID.selectedIndex=0
	}
}



/************************************************************************************/
//
// Name:	OpenSlideXYnamed
//
// Type:  function
//
// Purpose :	Open a new window of the browser with limited functionality
//
// Arguements :	Name of the url to open in the new url
//							Desired Width of the new window
//							Desired Hieght of the new window
//							Name of the window
//
// Returns : nothing
//
// Additional notes :
//
// Edited on/ by :	10.05.2000 - David J. Murchie, Palomar Media
//
/************************************************************************************/

function popUp(id, url_to_open, sizeYY, sizeXX)
{

    if (url_to_open == null)
    {
        url_to_open = "/popup.cgi?id=" + id;
    }

    var sizeY = 400;
    var sizeX = 420;

    if (sizeYY != null)
    {
        sizeY = sizeYY;
    }

    if (sizeXX != null)
    {
        sizeY = sizeXX;
    }

	// do browser specific processing required to setup the new window properly
	// use common function to do adjustment
	alter = browserWidthAdjustment();

	if (window.named && !(window.named.closed))
		  window.named.close();

	// open the window
	named=window.open (url_to_open, "slides", "statusbar=no,location=no,name=HelpPopUp,directories=no,scrollbars=yes,resizable=yes,menubar=no,toolbar=no,height=" + (sizeY - alter) + ",width=" + (sizeX) + "");
	// all done, if you want to do anthing extra, like close the original window, you would do that here.

}


/************************************************************************************/
//
// Name:	OpenSlideXYnamed
//
// Type:  function
//
// Purpose :	Open a new window of the browser with limited functionality
//
// Arguements :	Name of the url to open in the new url 
//							Desired Width of the new window 
//							Desired Hieght of the new window
//							Name of the window
//
// Returns : nothing
//
// Additional notes :
//
// Edited on/ by :	10.05.2000 - David J. Murchie, Palomar Media
//
/************************************************************************************/

function openslideXYnamed(url_to_open,sizeX,sizeY,name)
{
	// do browser specific processing required to setup the new window properly
	// use common function to do adjustment
	alter = browserWidthAdjustment();

	if (window.named && !(window.named.closed))
		  window.named.close();

	// open the window
	named=window.open (url_to_open, "slides", "statusbar=yes,location=no,name=slides,directories=no,scrollbars=yes,resizable=yes,menubar=no,toolbar=yes,height=" + (sizeY - alter) + ",width=" + (sizeX) + "");
	// all done, if you want to do anthing extra, like close the original window, you would do that here.

}

/************************************************************************************/
//
// Name:	OpenSlideXY
//
// Type:  function
//
// Purpose :	Open a new window of the browser with limited functionality
//
// Arguements :	Name of the url to open in the new url
//							Desired Width of the new window
//							Desired Hieght of the new window
//
// Returns : nothing
//
// Additional notes :
//
// Edited on/ by :	10.05.2000 - David J. Murchie, Palomar Media
//
/************************************************************************************/

function openslideXY(url_to_open,sizeX,sizeY)
{
	// do browser specific processing required to setup the new window properly
	// use common function to do adjustment
	alter = browserWidthAdjustment();

	// open the window
	window.open (url_to_open, "slides", "statusbar=yes,location=no,name=slides,directories=no,resizable=yes,scrollbars=no,menubar=no,toolbar=yes,height=" + (sizeY - alter) + ",width=" + (sizeX) + "");
	// all done, if you want to do anthing extra, like close the original window, you would do that here.

}


/************************************************************************************/
//
// Name:	OpenSlide 
// 
// Type:  function
//
// Purpose :	Open a new window of the browser with limited functionality 
//
// Arguements :	Name of the url to open in the new url 
//
// Returns : nothing
//
// Additional notes :
//
// Edited on/ by :	10.05.2000 - David J. Murchie, Palomar Media
//
/************************************************************************************/
function openslide(url_to_open) 
{
	// default height
	hieght = 420;
	// default width
	width = 600;

	// call function to open the window
	openslideXY(url_to_open, hieght, width);

	// all done, if you want to do anthing extra, like close the original window, you would do that here.
	// this window, if already open, will not be raised to the top.  In the html of the 
	// destination window you must put a call to the javascript function to raise the window to focus.
	// Raise();
}
								 
/************************************************************************************/
//
// Name:	Raise	
// 
// Type:  function
//
// Purpose :	Bring the current window to the top, and put it into focus	
//
// Arguements :	Name of the url to open in the new url 
//
// Returns : nothing
//
// Additional notes :
//
// Edited on/ by :	10.05.2000 - David J. Murchie, Palomar Media
//
/************************************************************************************/
function Raise() 
{
	window.focus();
}



/************************************************************************************/
//
// Name:	
// 
// Type: browserWidthAdjustment 
//
// Purpose :	Return the value the width of window should be altered depending on browser	
//
// Arguements :	None	
//
// Returns :	Amount to alter with width 
//
// Additional notes :
//
// Edited on/ by :	11.05.2000 - David J. Murchie, Palomar Media
//
/************************************************************************************/
function browserWidthAdjustment()
{
	if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) <= 3))
	{
 		//IE 3
 		alter = 15;
 	}	
	else
	{
 		// All others 15pix less than ie 3
 		alter = 0;
	}
	return alter;
}



/************************************************************************************/
//
// Name: len_ck	
// 
// Type: 
//
// Purpose : Print an alert box telling the user how long a form item is. (textarea)	
//
// Arguements : label , length	, maximum desired length, quiet
//
// Returns : true if length is less than maximum desired length, otherwise false.	
//
// Additional notes : 
//
// Edited on/ by :	05.27.2000 - David J. Murchie, Palomar Media
//
/************************************************************************************/

function len_ck(label, length, maxlength, quiet) 
{
	if (!(maxlength))
	{
		maxlength = 10000;
	}

	if (length <= maxlength)
	{
		if (quiet != 'quiet')
		{
			alert(label + "field current character count is " + length + ".");
		}
		return true;
	}
	else
	{
		alert(label + "field character count is currently " + length + ", which is longer than the maximum allowed number of characters of " + maxlength + ".  Please shorten the text you have entered");
		return false;
	}

	// won't get here
	return false;
}

//-->
//</SCRIPT>

