var activeSub=0;
var SubNum=0;


function reDo(){ window.location.reload() }
    window.onresize = reDo;


    //Define global variables

	  var timerID = null;
		var timerOn = false;
		var timecount = 1000;
		var what = null;
		var newbrowser = true;
		var check = false;

function inithtmlarea(area_id) 
{
  //-- transform textarea into HTMLArea editor   
  editor = new HTMLArea(area_id);  
  editor.generate();
}

function initcascmnu() 
{
          if (document.layers) {
                      //  alert ("Running Netscape 4");
                        layerRef="document.layers";
                        styleSwitch="";
                        visibleVar="show";
			screenSize = window.innerWidth;
			what ="ns4";


          }else if(document.all){
                      //  alert ("Running IE");
                        layerRef="document.all";
                        styleSwitch=".style";
                        visibleVar="visible";
			screenSize = document.body.clientWidth + 18;
			what ="ie";

		  }else if(document.getElementById){
                      //  alert ("Running Netscape 6");
                        layerRef="document.getElementByID";
                        styleSwitch=".style";
                        visibleVar="visible";
			what="moz";
		  
		  }else{
		  	//alert("Older than 4.0 browser.");
			what="none";
			newbrowser = false;
		  }
		  
 
	//	window.status='status bar text to go here';
		  check = true;

  	 	}

  // Turns the layers on and off
  function showLayer(layerName)
  {
    if(check)
    {
      if (what =="none")
      {
        return;
      }
      else if (what == "moz")
      {           
        document.getElementById(layerName).style.visibility="visible";
      }
      else
      {       
        eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
      }
    }
    else 
    {
      // alert ("Please wait for the page to finish loading.");
      return;
    }
  }
  
  function hideLayer(layerName)
  {  
    if(check)
    {
      if (what =="none")
      {
        return;
      }      
      else if (what == "moz")
      {
        document.getElementById(layerName).style.visibility="hidden";
      }
      else
      {
        eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
      }
    
    }
    else 
    {// alert ("Please wait for the page to finish loading.");
      return;
    }
  }


function hideAll()
{
   hideLayer('cascmnu1');
   hideLayer('cascmnu2');
   hideLayer('cascmnu3');
   hideLayer('cascmnu4');
   hideLayer('cascmnu5');
   hideLayer('cascmnu6');
   hideLayer('cascmnu7');
   hideLayer('cascmnu8');
   hideLayer('cascmnu9');
   hideLayer('cascmnu10');
   hideLayer('cascmnu11');
   hideLayer('cascmnu12');
   hideLayer('cascmnu13');
   hideLayer('cascmnu14');
   hideLayer('cascmnu15');
   hideLayer('cascmnu16');
   hideLayer('cascmnu17');
   hideLayer('cascmnu18');
   hideLayer('cascmnu19');
   hideLayer('cascmnu20');   
}


function startTime() 
{
  if (timerOn == false) 
  {
    timerID=setTimeout( "hideAll()" , timecount);
    timerOn = true;
  }
}


  function stopTime() 
  {
    if (timerOn) 
    {
      clearTimeout(timerID);
      timerID = null;
      timerOn = false;
    }
  }
  
  function onLoad()
  {
    initcascmnu();
  }
  
  
  function doSearch()
  {
    if(document.searchFrm.P_SEARCH_TYPE[0] != null 
    && document.searchFrm.P_SEARCH_TYPE[0].checked) 
    {
      document.searchFrm.action = "page.jsp";     
      document.searchFrm.target = "_top";
      document.searchFrm.submit();
    } 
    else 
    {
      document.searchFrm.action = "http://www.google.com/custom"; 
      document.searchFrm.target = "_blank";
      document.searchFrm.submit();
    }
  }
  
  function navJumpTo(pageUrl)
  {
    window.location=pageUrl;
  }  
  
  
  function doConfirmAction(v_btn, site_id, page_id, entity_type, primary_id, confirmMessage)
  {
    if((confirmMessage == null) || (confirm(confirmMessage)))
    {    
      window.location="../_admin/action.jsp?P_SITE_ID="+site_id+"&P_PAGE_ID="+ page_id +"&P_BTN="+v_btn+"&P_ENTITY_TYPE="+entity_type+"&P_PRIMARY_ID="+primary_id+"&P_INLINE_ACTION=Y";
    }
  }
  
  function doPromptInsert(v_btn, site_id, page_id, entity_type, primary_id, confirmMessage)
  {

      newName = prompt(confirmMessage,"New Name");
    
  }  