<%@  page pageEncoding="utf-8" contentType="text/html;charset=utf-8" import="com.novell.webaccess.common.JSPConduit2, com.novell.emframe.dev.eMFrameUtils" isELIgnored="false" %>
<%   JSPConduit2 c = JSPConduit2.getJSPConduit(request);
     c.stringTable("DevResources");
     c.stringTable("FwResources"); %>
<%@taglib prefix="iman"  uri="/WEB-INF/iman.tld" %>

<HTML>
<HEAD><TITLE>OVRefresh</TITLE>
<iman:eMFrameScripts/>

<script language="JavaScript">
   //------------- find OVTop ----------------
   var OVTop=top.Mainscreen.ObjectView;

    //---------------Blink Functionality-------------------
    // Code Added to show an indicator as "Loading...." while Loading the Tree-View on the 
    // click of the View Object Button.
    // This work is done to do an enhancement (Bugzilla id # 267747).

   function displayProcessing(){
  
     // As we are calling the method onload of the body,hence it would be risky to try to
     // render the <DIV> tag as an HTML Tag in Body.Rather It would be meaningful to create 
     // the tag dynamically whenever the method displayProcessing() get called.
     
      OVTop.Results.document.open();
      OVTop.Results.document.writeln('<html><head><title>Processing Result</title></head>');
          
      if (MS55) // To make the color uniform with Browse view as well as search view.
        OVTop.Results.document.writeln('<body bgcolor="#FFFFFF" style="border-style:solid; border-width:1; border-bottom-width:0; border-color:#BFBBB2;">');
      else
        OVTop.Results.document.writeln ('<body bgcolor="#FFFFFF">');
        
      OVTop.Results.document.writeln('<div id=processDiv style="display:inline">');
      OVTop.Results.document.writeln('<font face="Helvetica,Arial" size=-1 color=red><b><%= c.toScript(c.string("OV.Browser.Loading")) %></b></font>');
      OVTop.Results.document.writeln('</div></body></html>');
      OVTop.Results.document.close();
      
      //This is the method to make the text Blink 
      blinkProcessing(-1);
  }
   
   //Method to Work on FireFox , IE and safari

      var blinking = false;
    	var blinkVisibility = "";
   			var waitCnt = 30;

  
   function blinkProcessing(cnt){
       
      
       if(cnt == -1){
           //initialize clearResults
           OVTop.resultsLoaded =   false;
           blinking =              false;
           waitCnt =               30;      
           cnt =                   0;
       }
       if (OVTop.resultsLoaded){
            
            if(OVTop.Results.document.getElementById("processDiv"))
            {
        		OVTop.Results.document.getElementById("processDiv").style.display="none";  
       		}
        } else if (cnt<waitCnt){
        cnt++;
        setTimeout("blinkProcessing("+cnt+")",100);
       } else{
            if (!blinking){
               try{
                   iman.debugOV("making Loading... message visible");
                   OVTop.Results.document.getElementById("processDiv").style.display="inline";
                    blinking=true;
                    blinkVisibility="inline";
                    waitCnt = 20;    
               }catch (e){
              
                }
            } else{
				
                blinkVisibility=((blinkVisibility=="none")?"inline":"none");
               waitCnt = ((blinkVisibility=="none")?5:20);    //wait up to .5 or 2 seconds more
               try{
                  OVTop.Results.document.getElementById ("processDiv").style.display=blinkVisibility;
               }catch (e){
   
                }
            
              }
           setTimeout("blinkProcessing(0)",100);  
           
     }

   }//End of blinkProcessing
   
   
   
   
   
   
   
   //------------------- onLoad frame coordination ---------------------
   var t = null;
   function onRefreshLoad(cnt)
   {
      //wait up to 10 seconds for the Results frame to load
      iman.debugOV("in OVRefresh.jsp::onRefrshLoad("+cnt+")");
      if(OVTop.m_mode=="tree")
      {
    	   
        displayProcessing();
        return;
      }
      if (cnt<100)
      {
         if (OVTop.m_mode!="tree" && OVTop.queryLoaded==false)
         {
            cnt++;
            t = setTimeout("onRefreshLoad("+cnt+")",100)  
         }
         else
         {
            iman.debugOV("in OVRefresh.onRefreshLoad-- OVTop.m_mode==tree or OVTop.queryLoaded == true");
            if (t!=null)
            {
               iman.debugOV("calling ClearTimeout("+t+")"); 
               clearTimeout(t);
            }
            
            //if refreshing, clear results and selected objects list
            if ("${refreshOV}"=="true")
            {
               //clear results
               iman.debugOV("in OVRefresh.onRefreshLoad with refreshOV= true.  Calling OVTop.processDisplayCountChange()"); 
               OVTop.processDisplayCountChange();
               iman.debugOV("in OVRefresh.onRefreshLoad with refreshOV= true.  Calling OVTop.doSearch()"); 
               OVTop.doSearch();
               
               //clear any selected objects
               if ((OVTop.m_multiSelect=="true") && (OVTop.ovTitleLoaded))
               {
                  OVTop.SelectedObjectsTitle.clearAllSelections();
               }
            }  
         }
      }
   }
</script>
</HEAD>
<BODY onLoad="javascript:onRefreshLoad(0)">
</BODY>
<HTML>