//////falta por meterle el scroll y para arriba y abajo;
function Combo(id,sX,sY,sH,sW,classS,classL,colorS,colorL,colorB,styleH,img1,selec,contentC,typeC)
{
 	this.id=id;
	this.posX=sX;
	this.posY=sY;
	this.width=sW;
	this.height=sH;	
	this.classSel=classS;
	this.classList=classL;
	this.colorSel=colorS;
	this.colorList=colorL;
	this.colorBorder=colorB;
	this.listHeight=sH;	
	this.selHeight=styleH;
	this.img=img1;
	this.selected=selec;
	this.type=typeC;
	this.content=contentC;
	this.nat="top";	
	this.movingDownLimit=0;
	this.movingUpLimit=0;
	this.posSel=null;
	
	this.int1=null;
	this.int2=null;					
	this.sense=0;
	this.movementPos=0;
	this.inside=false;	

	//contenedor seleccion
	m_selec1X=sX;
	m_selec1Y=sY;
	m_selec1Height=(this.selHeight+2);
	m_selec1Width=(this.width+2);
	
	//contenedor lista
	modCX=sX;
	modCY=(sY+this.selHeight);
	modCHeight=this.listHeight;
	modCWidth=this.width;

	//m_level1
	m_level1X=0;
	m_level1Y=-this.listHeight;
	m_level1Height='';
	m_level1Width=this.width;

	//up
	upSX=(this.width-20);
	upSY=15;
	upSHeight=5;
	upSWidth=9;

	//dw
	dwSX=(this.width-20);
	dwSY=(this.listHeight-20);
	dwSHeight=5;
	dwSWidth=9;
	
	if (this.type==0)
	{
	   this.nat="top";
	   this.movingDownLimit=0;	   
   	   this.movingUpLimit=-this.listHeight;
	}
	else if (this.type==1)
	{
	   this.nat="bottom";
   	   modCY=sY-this.listHeight;
	   m_level1Y=this.listHeight;
   	   this.movingUpLimit=m_level1Y-(this.content.length*this.selHeight);
	   this.movingDownLimit=m_level1Y+(this.content.length*this.selHeight);;	   
	 }	

	this.table_00="<table height='"+this.selHeight+"' width='"+this.width+"' border='0' cellspacing='0' cellpadding='0'><tr><td rowspan='3' bgcolor='"+this.colorBorder+"' width='1'><img src='"+rutaEst+"images/t.gif' width='1' ></td><td bgcolor='"+this.colorBorder+"'><img src='"+rutaEst+"images/t.gif' width='1' ></td><td rowspan='3' width='1' bgcolor='"+this.colorBorder+"'><img src='"+rutaEst+"images/t.gif' width='1'></td></tr><tr><td><table bgcolor='";
	this.table_01="' cellpadding='0' cellspacing='0' border='0' width='"+(this.width-2)+"' ><tr>";
	this.table_02="</td><td align='right' width='10'><a href=javascript:"+this.id+".upLevel();"+this.id+".expandLevel();><img src='"+rutaEst+"images/"+this.img+"' border='0'></a></td></tr></table></td></tr><tr><td bgcolor='"+this.colorBorder+"' ><img src='"+rutaEst+"images/t.gif' width='1' ></td></tr></table>";
	this.table_03="</td></tr></table></td></tr><tr><td bgcolor='"+this.colorBorder+"'><img src='"+rutaEst+"images/t.gif' width='1' ></td></tr></table>";

	//area de seleccion
	buildLayer("m_selec1"+this.id,"m_selec1",1055,"visible");
 	 	if (this.selected==null)
		   textS="&nbsp;"
 	 	else if (isNaN(this.selected))
		   textS=this.selected		   					
		else	 
		   textS=this.content[this.selected];
		textF=this.table_00+this.colorSel+this.table_01+"<td><font class='"+this.classSel+"'>&nbsp;&nbsp;"+textS+"</font>"+this.table_02;		   	
 		document.write(textF);
	closeLayer();
	//area de LISTA	
	buildLayer("modC"+this.id,"modC",1,"visible","","","",modCWidth,modCHeight);
		buildLayer("m_level1"+this.id,"m_level1",1,"inherit","","","","","",this.id+".stopContractLevel()",this.id+".contractLevel()");
			document.write(this.table_00+this.colorList+this.table_01+"<td>");	
			for(ii=0;ii<this.content.length;ii++)
			{
				document.write("<a href=javascript:"+this.id+".selectOp("+ii+"); onMouseOver="+this.id+".stopContractLevel()  class="+this.classList+">&nbsp;&middot;&nbsp;"+this.content[ii]+"</a>");
				if(ii!=this.content.length)
					document.write("<br>");
			}			
			document.write(this.table_03);			
		closeLayer();
	closeLayer();
	
	

function startPos()
{
	changeStyle("","","modC"+this.id,"m_level1"+this.id,"top",m_level1Y);
}

function expandLevel()
{
 		clearInterval(this.int1);
		this.int1=null;
 	 	clearTimeout(this.int2);
		this.int2=null;		
		this.startPos();
		if(this.nat=="top")
		{
		 	if (NS4)
			   changeStyle("","","modC"+this.id,"m_level1"+this.id,"top",this.movingDownLimit)
			else
				this.int1=setInterval(this.id+'.goD()',5);
		}
		else
		{
		 	if (NS4)
			   changeStyle("","","modC"+this.id,"m_level1"+this.id,"top",this.movingUpLimit)
			else		
				this.int1=setInterval(this.id+'.goU()',5);
		}
}

function contractLevel()
{
 	this.int2=setTimeout(this.id+'.contractLyrNow()',500);
}

function contractLyrNow()
{
 	 	clearTimeout(this.int2);
		this.int2=null;
	 	if (this.int1!=null)
		{	
		 	clearInterval(this.int1);
			this.int1=null;		
//			this.startPos();
		}
		else
		{	
			if(this.nat=="top")
			{
			 	if (NS4)
			       changeStyle("","","modC"+this.id,"m_level1"+this.id,"top",this.movingUpLimit)
				else				   
					this.int1=setInterval(this.id+'.goU()',2)
			}
			else
			{
			 	if (NS4)
			   	   changeStyle("","","modC"+this.id,"m_level1"+this.id,"top",this.movingDownLimit)
				else
					this.int1=setInterval(this.id+'.goD()',2);
			}
		}
		this.dwLevel();		
}

function stopContractLevel()
{
	this.inside=true;
 	if (this.int2!=null)
	{
	   clearTimeout(this.int2);
	   this.int2=null;
	}
}

function goD()
{
	if (getStyle("","","modC"+this.id,"m_level1"+this.id,"top")<this.movingDownLimit)
		changeStyle("","","modC"+this.id,"m_level1"+this.id,"top",getStyle("","","modC"+this.id,"m_level1"+this.id,"top")+5);

	if (getStyle("","","modC"+this.id,"m_level1"+this.id,"top")>(this.movingDownLimit-1))
	{
		 clearInterval(this.int1);
		 this.int1=null;

		 if(this.nat=="top")
		 {
		    this.sense=1;this.movementPos=0;			
		 	this.int1= setInterval(this.id+'.moveUpDown()',5);		 
		 }
	}
}

function goU(menuN,lev)
{
	if (getStyle("","","modC"+this.id,"m_level1"+this.id,"top")>this.movingUpLimit)
		changeStyle("","","modC"+this.id,"m_level1"+this.id,"top",getStyle("","","modC"+this.id,"m_level1"+this.id,"top")-5);

	if (getStyle("","","modC"+this.id,"m_level1"+this.id,"top")<(this.movingUpLimit+1))
	{
	   	clearInterval(this.int1);
		this.int1=null;
		if(this.nat!="top")
		{
			this.sense=-1;this.movementPos=0;				
		 	this.int1= setInterval(this.id+'.moveUpDown()',5);
		}		 
	}
}

function moveUpDown()
{
       changeStyle("","","modC"+this.id,"m_level1"+this.id,"top",getStyle("","","modC"+this.id,"m_level1"+this.id,"top")+this.sense);
	   this.movementPos++;
	   (NS6)?this.movementPos++:'';

		if (this.movementPos==10) 
		   this.sense=-this.sense
		else if (this.movementPos==20) 
		{
			this.movementPos=0;
			clearInterval(this.int1);
		 	this.int1=null;			
		}	
		
}

function selectOp(pos)
{
 	this.contractLyrNow();
	changeContent("","","","m_selec1"+this.id,this.table_00+this.colorSel+this.table_01+"<td><font class='"+this.classSel+"'>&nbsp;&nbsp;"+this.content[pos]+"</font>"+this.table_02);
	this.posSel=pos;
	selectFunction(this.id);
}

function hide()
{ 	hideLayer("","","","m_selec1"+this.id);}

function show()
{ 	showLayer("","","","m_selec1"+this.id);}

function move(x,y)
{ 	
	changeStyle("","","","m_selec1"+this.id,"left",x);
	changeStyle("","","","modC"+this.id,"left",x);
	changeStyle("","","","m_selec1"+this.id,"top",y);
	changeStyle("","","","modC"+this.id,"top",y+this.selHeight);
	if(this.nat=="bottom")
		changeStyle("","","","modC"+this.id,"top",y-this.listHeight);	
}
function upLevel()
{
	showLayer("","","","modC"+this.id);
	changeStyle("","","","modC"+this.id,"zIndex",1500);
	changeStyle("","","modC"+this.id,"m_level1"+this.id,"zIndex",1502);	
}
function dwLevel()
{	changeStyle("","","","modC"+this.id,"zIndex",1);
 	changeStyle("","","modC"+this.id,"m_level1"+this.id,"zIndex",1);}

 	this.expandLevel = expandLevel;
	this.startPos=startPos;
	this.goD=goD;
	this.goU=goU;
	this.moveUpDown=moveUpDown;
	this.contractLevel=contractLevel;
	this.contractLyrNow=contractLyrNow;
	this.stopContractLevel=stopContractLevel;
	this.selectOp=selectOp;
	this.hide=hide;
	this.show=show;
	this.move=move;		
	this.upLevel=upLevel;
	this.dwLevel=dwLevel;
}