//alert("generic functions");
//-------------------------------------





/*

var lvi = gf_round_number ( argi_num , argi_dec_places ) ;


var lva_abs_pos = gf_get_obj_pos( argo_tag )  ; //  :  [ lvi_abs_left , lvi_abs_top ]












*/
















//-------------------------------------
function m_my_omm ( ) // OnMouseMove , this only fires if a picture has loaded
  { alert("generic_functions.js.m_my_omm , hey");
    document.getElementById( 'the_body'  ).style.cursor = "default" ;
    document.getElementById( 'the_body'  ).onmousemove  = null ; // this should make it such that it fires only once
    //document.getElementById( "display_p" ).innerHTML   += "m_my_omm , onmousemove <br/> " ;
  };
  
//-------------------------------------
//bSuccess = object.execCommand(sCommand [, bUserInterface] [, vValue])
//----------------------------------------------------------------------
// used to dynamically add javascripts such that they are 'activated' upon creation;
//  if I were to do a_tag.innerHTML="<script type='JS' src='blah.js'></ script>", it would not actually work; 
function gf_include_js( args_URL , args_parent_ID )
  { // I am NOT using args_parent_ID, but instead using tag = 'head' instead of id=args_parent_ID
    //alert("gf_include_js : " + args_URL ); 
	//gf_ri("gf_include_js");
	//      do not use gf_ri() because this function is used prior to th construction of the DOM
	var lvo_script  = document.createElement( 'script' ) ;
    lvo_script.src  = args_URL                           ;
    lvo_script.type = 'text/javascript'                  ;
        
    //var lvo_element = document.getElementById( args_parent_ID ) ;    
	var lvo_element = document.getElementsByTagName('head').item(0);
	lvo_element.appendChild( lvo_script )                       ;
  } ;
	
//----------------------------------------------------------------------
// used by SW/flash detection scripts to send var/values, which are then emailed to me
// ofcourse I really only need this for the detections.php page that I set up, but because
//   bunches of other pages use the SW/FLASH detection scripts, which automatically call this function
//           I need this function in a global scope;
var gvs_message = "" ;
function gf_handle_message_appending( args_message )
  { gvs_message += args_message   +  ";;;;;"      ;
  };

//----------------------------------------------------------------------
function gf_round_number ( argi_num , argi_dec_places ) 
  {
	var lvi_tens  = Math.pow  ( 10 , argi_dec_places ) ;
	var result    = Math.round( argi_num * lvi_tens ) / lvi_tens ;
	return result;
  }

//----------------------------------------------------------------------
function gf_stripSpaces( args_text ) 
  { var lvs_stripped = args_text ;
    
	//gf_ri( "generic_functions.js , gf_stripSpaces , A : " + lvs_stripped.length ) ;
    // strip leading white spaces
    while ( lvs_stripped.substring( 0 , 1 ) == ' ' ) 
	  { //gf_ri( "generic_functions.js , gf_stripSpaces , B " ) ;
	    lvs_stripped = lvs_stripped.substring( 1 ) ;
	  } ;
	//gf_ri( "generic_functions.js , gf_stripSpaces , B : " + "|" + lvs_stripped + "|" + " , " + lvs_stripped.length ) ;
      
    // strip trailing white spaces
	while ( lvs_stripped.substring( lvs_stripped.length - 1 , lvs_stripped.length ) == ' ' ) 
	  { //gf_ri( "generic_functions.js , gf_stripSpaces , C " ) ;
	    lvs_stripped = lvs_stripped.substring( 0 , lvs_stripped.length - 1 ) ;
	  } ;
	  
    //gf_ri( "generic_functions.js , gf_stripSpaces , D : " + lvs_stripped.length ) ;
    return lvs_stripped ;
  } ;

//----------------------------------------------------------------------
function gf_setup_jQuery_centering_function( )
  { //alert( "gf_setup_jQuery_centering_function" ) ;
    // DON'T call this if jQuery hasn't been installed
	//  $(element).center( ) ;

    jQuery.fn.center = function ( argo_parent , args_direction ) 
		  { // argo_parent must be a jQuery tag
            alert( "generic_functions.js , jQuery.fn.center : " + argo_parent  ) ;
		    
            this.css( "position" , "absolute" ) ;
            if( args_direction == "both" || args_direction == "vertical" )
			  { this.css( "top"  , ( argo_parent.height() - this.height() ) / 2 + argo_parent.scrollTop () + "px" ) ;
			  } ;
			  
            if( args_direction == "both" || args_direction == "horizontal" )
			  { this.css( "left" , ( argo_parent.width () - this.width () ) / 2 + argo_parent.scrollLeft() + "px" ) ;
			  } ;
			  
			return this;
		  } ;
  } ;

//----------------------------------------------------------------------
function gf_zeroPad ( argi , argi_places ) // ( 4 , 3 ) ==> 004
  {
    var lvs_numZeropad = String( argi ) ;  //  + '' ;
    while( lvs_numZeropad.length < argi_places ) 
	  { lvs_numZeropad = "0" + lvs_numZeropad ; // 04 , 004
      } ;
	  
    return lvs_numZeropad;
  } ;

//----------------------------------------------------------------------
function gf_get_obj_pos( argo_tag )  //  :  [ lvi_abs_left , lvi_abs_top ]
  { // http://www.quirksmode.org/js/findpos.html
    
	// returns absolute top/left
	var lvi_curleft = lvi_curtop = 0 ;
    if ( argo_tag.offsetParent ) 
	  { do 
	      { lvi_curleft +=  argo_tag.offsetLeft ;
			lvi_curtop  +=  argo_tag.offsetTop  ;
			//gf_ri( "generic_functions.gf_get_obj_pos : " + argo_tag.id  + " , " + lvi_curleft + " , " + lvi_curtop ) ;
          } 
		while ( argo_tag = argo_tag.offsetParent);
        return [ lvi_curleft , lvi_curtop ] ;
	  } ;
  }
  
//----------------------------------------------------------------------


//----------------------------------------------------------------------


//----------------------------------------------------------------------


//----------------------------------------------------------------------

