
function dnn_Effect(obj,title){
   this.activeClass="active";
   this.inactiveClass="inactive";
   this.eventObject=obj;
   this.title=title;
   this.mnl=null;
   this.mnl_h=null;
   this.mnl_oh=null;
   this.isE=true; 
   this.timer=false; 
   this.timespan=10;
   this.closeWhileCollapse=false;
   this.onlyOne=true;  
   this._effect=null;
}


dnn_Effect.prototype={

   showPanel:function(){
    
		if(this.timer){
		  clearInterval(this.timer); this.timer = null; } 
		var target=getObject(this.title);
		this.mnl = getObject(this.eventObject); 
		if(target && this.mnl){
			this.mnl_h = this.mnl.offsetHeight; 
			if(!this.mnl_oh){ this.mnl_oh = this.mnl_h; } 
			this.isE = !this.isE;
			
			var activeObj=this.getParentByClass(target);
			
			if(this.isE) {
			    //target.className =this.activeClass; 
			    YAHOO.util.Dom.replaceClass(activeObj, this.inactiveClass, this.activeClass);
			
			 } 
			else { YAHOO.util.Dom.replaceClass(activeObj,  this.activeClass ,this.inactiveClass);}
			this.navInterval(); 
			this.timer = setInterval(createDelegate(this,this.navInterval), this.timespan);
		 } 
},
	
   
   	
   navInterval:function(){ 
            
			if(this.mnl_h <= 0 && this.isE) { 
			var o =getObject(this.eventObject);
			if(null!=o){o.style.display='block';} }
		 
		   if(!this.isE){ 
				  this.mnl_h -= 20; 
		   }
		   else{ 
			   this.mnl_h += 20; 
			}
		  if(this.mnl_h < 0){ this.mnl_h = 0; }
		  else if(this.mnl_h > this.mnl_oh){ this.mnl_h = this.mnl_oh; } 
		 
		  this.mnl.style.height = this.mnl_h+'px'; 
		  if(this.mnl_h <= 0 || this.mnl_h >= this.mnl_oh) {
				if(this.mnl_h <= 0 && !this.isE) {
				var o =getObject(this.eventObject);
				o.style.display='none'; }
				clearInterval(this.timer); 
				 this.timer = null; 
				 var masterNavLinks = getObject(this.eventObject); 
				 if(this.closeWhileCollapse && isE && masterNavLinks && masterNavLinks.childNodes)
				 { this.closeWhileCollapse = false; ; } }
			 
		},
		     

       initGroup:function(arrTitles,arrEvent,iniTitle){
				 var i=0;
				 this._effect=new Array(arrTitles.length);
				 for(i=0;i<arrTitles.length;i++){
					 this._effect[i]=new dnn_Effect(arrEvent[i],arrTitles[i]);
					 var objTitle=getObject(arrTitles[i]);
					
					 if(objTitle){
					      YAHOO.util.Event.addListener(objTitle, "click", createDelegate(this, this.onClick));
					 }
					  
					 if(iniTitle==null)continue;
					 
					 if(arrTitles[i]!=iniTitle)this._effect[i].showPanel();
				 }
			},

          setGroup:function(eid){
				 if(eid==null)return;
				 
				 for(i=0;i<this._effect.length;i++){
				   
					if( this._effect[i].title==eid.id){
					   
						this._effect[i].showPanel();
					}
					else{
						if(this.onlyOne){
							if(this._effect[i].isE){
								this._effect[i].showPanel();
							}
						}
						
					}
				 }
			},
			
      getParentByClass:function(id){
       
			var obj=id
			if(obj==null)return null;
			if(obj.className==null)return this.getParentByClass(obj.childNodes[0]);
			
			if(obj.className.indexOf(this.activeClass)>=0||obj.className.indexOf(this.inactiveClass)>=0)return id;
			return this.getParentByClass(obj.childNodes[0]);
	 },
	 
	 onClick:function(evt){
		if(evt==null) evt = window.event;
		var _target = (evt.srcElement ? evt.srcElement : evt.target);
		var o = this.getTitle(_target)
		this.setGroup(o);
	},
	
	getTitle:function(o){
	    if(o == null || o.tagName.toUpperCase() == 'BODY') return;
	    
	    if(o.className == 'c_title'){
	        return o;
	    }else{
	        return this.getTitle(o.parentNode);
	    }
	}
}


function pullPanel(e, clientID, strObj)
{
    var objRequired = getObject(clientID+"_"+strObj); 
    
    if (objRequired != null)
    {
        showPanel1(e, objRequired.checked);
    }

}

function showPanel1(e,flag)
{
   if(flag){
      if(e.isE){
         e.isE=false;
      }
      
      e.showPanel();
         
      return;
   }  
   if(!flag){
      if(e.isE){
        e.showPanel();
      } 
      return;
   }
   
}

