	  /**GLOBAL VARIABLES */
	  
	  isMac = (navigator.appVersion.indexOf("Mac")!=-1) ? true : false;
      NS4 = (document.layers) ? true : false;
      IEmac = ((document.all)&&(isMac)) ? true : false;
      IE4plus = (document.all) ? true : false;
      IE4 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 4.")!=-1)) ? true : false;
      IE5 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 5.")!=-1)) ? true : false;
      IE6 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 6.")!=-1)) ? true : false;
      ver4 = (NS4 || IE4plus) ? true : false;
      NS6 = (!document.layers) && (navigator.userAgent.indexOf('Netscape')!=-1)?true:false;
    
      IE5plus = IE5 || IE6;
      IEMajor = 0;
    
      if (IE4plus)
      {
      	var start = navigator.appVersion.indexOf("MSIE");
    	var end = navigator.appVersion.indexOf(".",start);
    	IEMajor = parseInt(navigator.appVersion.substring(start+5,end));
    	IE5plus = (IEMajor>=5) ? true : false;
      }
      
      
      
      function showContentBlock(div_name) {
	
		var div_top = document.getElementById(div_name + "_top");
		var div_sub = document.getElementById(div_name + "_sub");
		var link_name = document.getElementById(div_name + "_link");
			
		if (div_sub.style.display=="none") 
		{
			div_sub.style.display="block";
			link_name.innerHTML = "<img src=\"/images/dynamic_expanded.gif\" valign=\"bottom\" border=\"0\">";
		} 
		else if (div_sub.style.display=="block") 
		{
			// If the div is visible, hide it
			div_sub.style.display="none";
			link_name.innerHTML = "<img src=\"/images/dynamic_collapsed.gif\" border=\"0\" valign=\"bottom\">";
		}
	}
	
	
	
	function toggleFormContentBlock(div_name,toggle_field,prompt_body_not_present,prompt_body_present,isInit) {
	
		var div_top = document.getElementById(div_name + "_top");
		var div_sub = document.getElementById(div_name + "_content");
		var link_name = document.getElementById(div_name + "_link");
			
		var currentToggleFieldVal = toggle_field.value;
		
		if ( (currentToggleFieldVal==null) || (currentToggleFieldVal=='') ){
			currentToggleFieldVal=0;		
		}
		
		
		
		//not the initialization, so base the display on a user's click (i.e., it's a true toggle)
		if (isInit==null) {
			
			
			
			if (currentToggleFieldVal==0) 
			{
				div_sub.style.display="block";
				link_name.innerHTML = prompt_body_present;
				toggle_field.value=1;  //we are using the dyna-displayed field(s), so set the toggle field to true
			} 
			else if (currentToggleFieldVal==1) 
			{
				// hide it
				div_sub.style.display="none";
				link_name.innerHTML = prompt_body_not_present;
				toggle_field.value=0;  //we are using the dyna-displayed field(s), so set the toggle field to true			
			}	
			
		} else {
			
			
			
			//we are in the initialization, so base the display on what the current toggle field value is

			
			if (currentToggleFieldVal==1) 
			{
				div_sub.style.display="block";
				link_name.innerHTML = prompt_body_present;
				toggle_field.value=1;  //we are using the dyna-displayed field(s), so set the toggle field to true
			} 
			else if (currentToggleFieldVal==0) 
			{
				// hide it
				div_sub.style.display="none";
				link_name.innerHTML = prompt_body_not_present;
				toggle_field.value=0;  //we are using the dyna-displayed field(s), so set the toggle field to true			
			}
		} 
	}
	
	
	
	/**
	   * Reuse this all over
	   *
	   * usage:  toggleVisibility('LayerName','hidden','hidden','hidden')
	   *         toggleVisibility('LayerName','show','visible','visible')
	   *
	   **/
	 function toggleVisibility(id, NNtype, IEtype, WC3type) {
	    if (document.getElementById) {
	        eval("document.getElementById(id).style.visibility = \"" + WC3type + "\"");
	    } else {
	        if (document.layers) {
	            document.layers[id].visibility = NNtype;
	        } else {
	            if (document.all) {
	                eval("document.all." + id + ".style.visibility = \"" + IEtype + "\"");
	            }
	        }
	    }
	}
	
	
	function toggleOptionalContentBlock(div_name,prompt_body_not_present,prompt_body_present) {
	
		var div_top = document.getElementById(div_name + "_top");
		var div_sub = document.getElementById(div_name + "_content");
		var link_name = document.getElementById(div_name + "_link");
			
		
		if (div_sub.style.display=="none") 
		{
			div_sub.style.display="block";
			link_name.innerHTML = prompt_body_present;
			
		} 
		else if (div_sub.style.display=="block") 
		{
			// hide it
			div_sub.style.display="none";
			link_name.innerHTML = prompt_body_not_present;
		}	
	}
	
	
	
	/****
         *
         * parent_field  :  name of the parent field that invokes the toggle
         * 
         * child_block : name of the child block
         *
         ****/
	function toggleChildFormFieldBlock(parent_field,child_block) {
                var parent_field_value = parent_field.value;
		
		        if ( (parent_field_value==null) || (parent_field_value=='') ){
			      currentToggleFieldVal=-1;		
		        }
		
                var child = document.getElementById(child_block);

                
                //check current value of the parent_field
                if(child != null){// add by ajay for removing js error
                if (parent_field_value==-1  ) {
                    //parent_field is "" or null (field not present):
                    
                    
                    //hide the child block
                    child.style.display="none";

                    //disable the child fields?  If not here---  need to make sure Server-Side knows to ignore them.  It logicially should if the parent has not value.  The decision tree logic must be know client side as well as server side. 

                } else {
                    //parent_field has a value:
                  
                    
                    //show the child block
                    child.style.display="block"; 

                    //enable the child fields -- server-side needs to know to not ignore them somehow (based on fact that parent has a value) 

                }
                }//// add by ajay for removing js error
	}
	
	function disableForm(theform) {
		if (document.all || document.getElementById) {
			for (i = 0; i < theform.length; i++) {
				var tempobj = theform.elements[i];
				if (tempobj.type.toLowerCase() == "submit" || tempobj.type.toLowerCase() == "reset")
					tempobj.disabled = true;
			}
	
			return true;
		} else {
	
			return false;
	   }
	}
	
		
	
			