﻿// JScript File

function BPSTATMenu(id)
{
    this.id = id;
    this.addEvent(window,"load",function  () { ativaHover("menu-hv1"); });
}

BPSTATMenu.prototype.addEvent = function(whichObject,eventType,functionName,suffix)
{ 
    if(!suffix)suffix = '';
	if(whichObject.attachEvent)
	    { 
	        whichObject['e'+eventType+functionName+suffix] = functionName; 
	        whichObject[eventType+functionName+suffix] = function(){whichObject['e'+eventType+functionName+suffix]( window.event );} 
	        whichObject.attachEvent( 'on'+eventType, whichObject[eventType+functionName+suffix] ); 
	    } 
    else 
	    whichObject.addEventListener(eventType,functionName,false); 	    
} 

BPSTATMenu.prototype.InitYesEvent = function (objSubscribe , msg , width, height , parent , Header , Type , url) 
{
    var FavAJAXWindow = new AJAXModalMessage(msg, width , height, parent , Header, Type )
    FavAJAXWindow.displayStaticMessage()
    FavAJAXWindow.WindowMessage.ResponseYes.subscribe(this.fnSubscriberonResponseBack, this);      
    this.url = url
}

BPSTATMenu.prototype.fnSubscriberonResponseBack = function(type, args, me) 
{  
    window.location = me.url 
}  


function DOMgetElementsByClassName($node,$className){
/* Description: retorna um array com todos os elementos  dentro
                 de  $node que possuam a classe indicada em $className
    Versão: 1.0 -  30/08/2006
    Author: Micox -  Náiron J.C.G - micoxjcg@yahoo.com.br
    Site:   http://elmicox.blogspot.com
    Não retire estas  informações pra não infringir direitos autorais!
*/
  var $node,  $atual, $className, $retorno = new Array(), $novos = new Array();
  $retorno =  new Array();
  for (var  $i=0;$i<$node.childNodes.length;$i++){
   $atual  = $node.childNodes[$i];
   if($atual.nodeType==1){//  1 = XML_ELEMENT_NODE
   $classeAtual  = $atual.className;                              
   if(new  RegExp("\\b"+$className+"\\b").test($classeAtual)){
      $retorno[$retorno.length] = $atual;
   }
   if($atual.childNodes.length>0){
      $novos =  DOMgetElementsByClassName($atual,$className);
      if($novos.length>0){
     $retorno = $retorno.concat($novos);
      }
   }
   }
  }
  return  $retorno;
}

function ativaHover(classe) {
  var pais =  DOMgetElementsByClassName(document.body,classe);
  for (var  j=0; j<pais.length; j++) {
   var  sfEls = pais[j].getElementsByTagName("LI");
   for  (var i=0; i<sfEls.length; i++) {
   sfEls[i].onmouseover=function()  {
    this.className+="  over";
   }
   sfEls[i].onmouseout=function()  {
    this.className=this.className.replace(new  RegExp(" over\\b"), "");
   }
   }
  }
}

 

