// core based on Vic Phillips - http://www.vicsjavascripts.org.uk 
function WHSet(obj,cmin,cmax,cstps){           
	var obj=document.getElementById(obj);	                      
	obj.onmouseover=function() { WHExec(this.id,1) ;glow(this) };
	obj.onmouseout= function() { WHExec(this.id,-1);setBaseOpac(this) };
 	window[obj.id]=new objWH(obj,cmin,cmax,cstps);
}

function objWH(obj,cmin,cmax,cstps){
	this.htMax='55px';
	this.htMin='30px';
	this.obj=obj;
 	this.objdv=obj.parentNode;                                             
 	this.obj.style.height=this.htMin;                                     
 	this.d=null;
 	this.cnt=0;	
 	this.stps=cstps||50;
 	this.steps=calcSteps(this.stps,cmin,cmax); 
 	this.to=null;
 	this.dly=document.all?20:15;
  this.ref='ref'+obj.id;
  window[this.ref]=this;  
 	this.htincr=calcSteps(this.stps,parseInt(this.htMin),parseInt(this.htMax)); 
 	this.wdstep=calcSteps(this.stps,0,Math.round((cmax-cmin)/2));  
 	this.htstep=calcSteps(this.stps,0,Math.round((parseInt(this.htMax)-parseInt(this.htMin))/2)) ;
 	this.top=this.objdv.style.top;                                      
 	this.left=this.objdv.style.left;                                   
}

function WHExec(ident,cd){                      
 	var vObj=window[ident]; 
	clearTimeout(vObj.to);
 	vObj.obj.style.display='';
	vObj.obj.style.visibility='visible';
	vObj.d=cd; 
	var iDiv=document.getElementById(ident) ; 
 	iDiv=iDiv.parentNode;
	iDiv.style.zIndex = Math.round(iDiv.style.zIndex)+cd; 			// convert to Number
	vObj.cngwh();
}

objWH.prototype.cngwh=function(){  
 	if ((this.d>0 && this.cnt+this.d<this.stps)||(this.d<0 && this.cnt+this.d>0)){ 
  	this.obj.style.width=(this.steps[this.cnt+=this.d])+'px'; 
  	this.obj.style.height=this.htincr[this.cnt]+'px';                                                    
  	this.objdv.style.left=parseInt(this.left)-this.wdstep[this.cnt]+'px';   
	 	this.objdv.style.top=parseInt(this.top)-this.htstep[this.cnt]+'px';     
   	this.setTimeOut('cngwh();',this.dly); 
 	} else {  
  	if (this.d<0){ 
			this.obj.style.width=this.steps[0]+'px';              //** min size **/
			this.obj.style.height=this.htMin;                              
			this.objdv.style.top=this.top;                              				  
			this.objdv.style.left=this.left;
	 	}                       
  	if (this.d>0){
			this.obj.style.width=this.steps[this.stps-1]+'px';    //** max size **//
			this.objdv.style.left=parseInt(this.left)-(this.wdstep[this.stps-1])+'px'; 
      this.obj.style.top=this.htincr[this.stps-1]+'px';          
  	}  
   	this.d=-this.d;
	}
}

objWH.prototype.setTimeOut=function(cf,cd){	
	this.to=setTimeout('window.'+this.ref+'.'+cf,cd);
}

function calcSteps(stps,srt,fin){ 
 	var ary=[];
	for (var i=0;i<stps-1;i++){ 
			ary[i]=Math.floor(Math.abs((srt-fin)/(stps-1))*i+Math.min(srt,fin)); 
	}
	if (srt>fin){ 
		ary.push(srt);
		ary=ary.reverse(); 
	} else { 
		ary.push(fin);
	}	
	return ary;
}
