/* ---------------------------------------------------------------------------------------
hlc_stdlib.js
--------------------------------------------------------------------------------------- */

    /* -------------------------------------------------- */
    /* function   : popwindowtoscale
       created by : chris andrade
       created on : 12/22/2003	
       description: pops a new window to the specified width and height
       
       arguments: page -> html,aspx page to open
       
				  winname -> identifier of the new 
							 window instance
				
				  width -> width of window
				
				  height -> height of window
    ----------------------------------------------------- */
		function popwindow(page, winname, width, height) 
		{
			var browser_name = navigator.appname;
			
			if (browser_name.indexof("webtv") != -1) return null;
			
			// find the center position to launch the window to
			if (parseint(navigator.appversion) >= 4 )
			{
				xposition = (screen.width - width) / 2;
				yposition = (screen.height - height) / 2;
			}

			// assign the window arguments
			args = "width=" + width + ",";
			args += "height=" + height + ",";
			args += "location=0" + ",";
			args += "menubar=0" + ",";
			args += "resizable=0" + ",";
			args += "scrollbars=0" + ",";
			args += "status=1" + ",";
			args += "titlebar=1" + ",";
			args += "toolbar=0" + ",";
			args += "hotkeys=0" + ",";
			args += "screenx=" + xposition + ",";
			args += "screeny=" + yposition + ",";
			args += "left=" + xposition + ",";
			args += "top=" + yposition;
			
			var new_window = window.open(page, winname, args);
			new_window.focus();
		}

    /* -------------------------------------------------- */
    /* function   : popwindownostatusbar
       created by : chunyan cao
       created on : 1/8/2004	
       description: pops a new window to the specified width and height and with no status bar
       
       arguments: page -> html,aspx page to open
       
				  winname -> identifier of the new 
							 window instance
				
				  width -> width of window
				
				  height -> height of window
    ----------------------------------------------------- */
		function popwindownostatusbar(page, winname, width, height) 
		{
			var browser_name = navigator.appname;
			
			if (browser_name.indexof("webtv") != -1) return null;
			
			// find the center position to launch the window to
			if (parseint(navigator.appversion) >= 4 )
			{
				xposition = (screen.width - width) / 2;
				yposition = (screen.height - height) / 2;
			}

			// assign the window arguments
			args = "width=" + width + ",";
			args += "height=" + height + ",";
			args += "location=0" + ",";
			args += "menubar=0" + ",";
			args += "resizable=0" + ",";
			args += "scrollbars=0" + ",";
			args += "status=0" + ",";
			args += "titlebar=0" + ",";
			args += "toolbar=0" + ",";
			args += "hotkeys=0" + ",";
			args += "screenx=" + xposition + ",";
			args += "screeny=" + yposition + ",";
			args += "left=" + xposition + ",";
			args += "top=" + yposition;
			
			var new_window = window.open(page, winname, args);
			new_window.focus();
		}

    /* -------------------------------------------------- */
    /* function   : popwindowtoscale
       created by : chris andrade
       created on : 10/30/2003	
       description: pops a new window to the specified scale percentage
       
       arguments: page -> html,aspx page to open
       
									winname -> identifier of the new 
														 window instance
									
									scaleperc -> the scale percentange the 
															 window should open up to (ex. if 75%, enter 75) 
    ----------------------------------------------------- */
		function popwindowtoscale(page, winname, scaleperc) 
		{
			var browser_name = navigator.appname;
			
			// change scaleperc value to it's decimal equivalent
			var perc = scaleperc * .01;
			
			// apply the scale ratio to both the width and height
			var width = math.floor(screen.width * perc);
			var height = math.floor(screen.height * perc);
			
			if (browser_name.indexof("webtv") != -1) return null;
			
			// find the center position to launch the window to
			if (parseint(navigator.appversion) >= 4 )
			{
				xposition = (screen.width - width) / 2;
				yposition = (screen.height - height) / 2;
			}

			// assign the window arguments
			args = "width=" + width + ",";
			args += "height=" + height + ",";
			args += "location=1" + ","
			args += "menubar=1" + ","
			args += "resizable=1" + ","
			args += "scrollbars=1" + ","
			args += "status=1" + ","
			args += "titlebar=1" + ","
			args += "toolbar=1" + ","
			args += "hotkeys=0" + ","
			args += "screenx=" + xposition + ",";
			args += "screeny=" + yposition + ",";
			args += "left=" + xposition + ",";
			args += "top=" + yposition;
			
			var new_window = window.open(page, winname, args);
			new_window.focus();
		}

    /* -------------------------------------------------- */
    /* function   : resetvalidation
       created by : chris christopher
       created on : 09/23/2003	
       description: the only thing this function does is return true.  used to reset
                    custom validation controls whose error state is normally set via
                    code.
    ----------------------------------------------------- */
		function resetvalidation(strhtmlid) {
		  document.getelementbyid(strhtmlid).style.isvalid = "true";
		  return true;
		}


    /* -------------------------------------------------- */
    /* function   : displayelement
       created by : chris christopher
       created on : 09/20/2003	
       description: dynamically hides/shows a html element based on the value
                    of a webform control, additionally it can enabled/disable an
                    associated webform validation control.
       
       arguments  : strhtmlid	   - id of the html element you wish to hide/show.
									  flgdisplay   - determines of the visibilty attribute is to be set
									                 to 'hidden' or 'visible'
									  flgisdynamic - when true this causes the web page to be dynamically
									                 resized when the element is hidden/displayed. 
    ----------------------------------------------------- */
		function displayelement(strhtmlid, flgdisplay, flgisdynamic) {
			
		  if(flgdisplay == true)
		    {
		      document.getelementbyid(strhtmlid).style.visibility = 'visible';
		      if(flgisdynamic == true)
		        {document.getelementbyid(strhtmlid).style.display = '';}
		    }
		  else
		    {
		      document.getelementbyid(strhtmlid).style.visibility = 'hidden';
		      if(flgisdynamic == true)
		        {document.getelementbyid(strhtmlid).style.display = 'none';}
		    }		    		  
		  return true;
		}
    
    /* -------------------------------------------------- */
    /* function   : displayelement
       created by : chris christopher
       created on : 09/20/2003	
       description: originally intended to enable disable page validation controls
										when the input fields are hidden/displayed.
       
       arguments  : strhtmlid	   - id of the html element you wish to hide/show.
									  flgenabled   - value to set the 'enabled' attribute to.
    ----------------------------------------------------- */
    function enableelement(strhtmlid, flgenabled) {
      if(flgenabled == true)
		    {
          document.getelementbyid(strhtmlid).setattribute('enabled', true);
		    }
		  else
		    {
  	      document.getelementbyid(strhtmlid).setattribute('enabled', false);
		    }		    		  
		  return true;
		}


/* ------------------------------------------------------------------------------------ */
