
//para uso general
var sSiteName = 'Panacea';
function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function EnviarFrm(nombref)
	{
	document.nombref.submit()
	}

//********************************
//********************************
// para uso del catálogo
function AbrirPromocion (winwidth,winheight,lcategoria,lcatalogo,lproducto,lnombreprod){
	propiedades='scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,left=60,top=60,width=' + winwidth + ',height=' + winheight;
	destino='promocion.asp?Categoria='+ lcategoria + '&Catalogo=' + lcatalogo + '&Producto='+ lproducto+ '&NombProd='+ lnombreprod;
	window.open(destino,'Promociones',propiedades);
}

function openPopUp(destino, winwidth, winheight, propDefault, propiedades){
	var sProp;
	switch(propDefault){
		case 'Default':
			sProp = 'scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,left=60,top=60';
			break;
		case 'excel':
			sProp = 'scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=yes,resizable=yes,left=60,top=60';
			break;
		default:
			sProp = propiedades
			break;
	}
	sProp += ',width=' + winwidth + ',height=' + winheight;
	window.open(destino,'PopUp',sProp);
}

function submitBusqueda(){
	var busca = false;
	for (var i = 0;i<document.forms[1].elements.length;i++)
		if ((document.forms[1].elements[i].value != "") &&
			((document.forms[1].elements[i].name != "Submiteado")&&
			(document.forms[1].elements[i].name != "Operador"))){
			busca = true;
			}
	if (busca) 
		document.forms[1].submit();
	else 
		alert(msgJsIngreseCriterio);
}

//*** Rutinas de Impresion *************///

function imprime(){
if ( !printIsNativeSupport() )
  printFrame(false,false);
 else
window.print();
}

function printFrame(frame, onfinish) {
  if ( !frame ) frame = window;

  if ( frame.document.readyState != "complete" &&
       !confirm(msgJsPrintFrame) )
  {
    if ( onfinish ) onfinish();
    return;
  }

  if ( printIsNativeSupport() ) {
    var focused = document.activeElement; 
    frame.focus();
    frame.self.print();
    if ( onfinish ) onfinish();
    if ( focused && !focused.disabled ) focused.focus();
    return;
  }

  var eventScope = printGetEventScope(frame);
  var focused = document.activeElement;

  window.printHelper = function() {
    execScript("on error resume next: printWB.ExecWB 6, 1", "VBScript");
    printFireEvent(frame, eventScope, "onafterprint");
    printWB.outerHTML = "";
    if ( onfinish ) onfinish();
    if ( focused && !focused.disabled ) focused.focus();
    window.printHelper = null;
  }

  document.body.insertAdjacentHTML("beforeEnd",
    "<object id=\"printWB\" width=0 height=0 \
    classid=\"clsid:8856F961-340A-11D0-A96B-00C04FD705A2\"></object>");

  printFireEvent(frame, eventScope, "onbeforeprint");
  frame.focus();
  window.printHelper = printHelper;
  setTimeout("window.printHelper()", 0);
}

function printIsNativeSupport() {
  var agent = window.navigator.userAgent;
  var i = agent.indexOf("MSIE ")+5;
  return (i - 5 < 0)||((parseInt(agent.substr(i)) >= 5) && (agent.indexOf("5.0b1") < 0));
}

function printFireEvent(frame, obj, name) {
  var handler = obj[name];
  switch ( typeof(handler) ) {
    case "string": frame.execScript(handler); break;
    case "function": handler();
  }
}

function printGetEventScope(frame) {
  var frameset = frame.document.all.tags("FRAMESET");
  if ( frameset.length ) return frameset[0];
  return frame.document.body;
}
//////////**** fin rutinas de impresion *********////

function muestraTemplate(val){
	if (! document.all){
		return;
	}
		var miObj = document.getElementById('divTemplate');
	if (val){
		miObj.style.display='block';
		document.formTemplate.NombrePedido.focus();
	}else
		miObj.style.display='none';
}
function orderBy(order){
	document.formStat.pag.value = 1;
	document.formStat.ordBy.value = order;
	document.formStat.submit();
}

function enviaDatosConsulta(){
	var msgOK = intervalofechavalida(document.datosConsulta,document.datosConsulta.elements["DateFromD"].value,document.datosConsulta.elements["DateFromM"].value,document.datosConsulta.elements["DateFromA"].value,document.datosConsulta.elements["DateToD"].value,document.datosConsulta.elements["DateToM"].value,document.datosConsulta.elements["DateToA"].value);
	if(msgOK.length==0)
		document.datosConsulta.submit();
	else
		alert(msgOK);
		
/*	if (checkFechaOk(document.datosConsulta.elements["DateFrom"].value) && 
		checkFechaOk(document.datosConsulta.elements["DateTo"].value))
			document.datosConsulta.submit();
	else
		alert(msgJsFormatoFecha);
*/}

function checkFechaOk(str){
var re = /^\d{4}-\d{2}-\d{2}$/;
	return ((str == null) || (str.length == 0) ||
			(re.test(str)));
}
function vaPag(miPag){
	document.formStat["pag"].value = miPag;
	document.formStat.submit();
}

function verCategorias(miSel,str){
	if (document.all){
		var div1=document.all.ctg1.style;
		var div2=document.all.ctg2.style;
	} else {
		var div1=document.ctg1;
		var div2=document.ctg2;
	}
	if (miSel.value == ""){
	 div1.visibility = "hidden";
	 div2.visibility = "hidden";
	}else{
	  //if (document.selForm.Categoria.options < 2)
		llenaOpcionesCategoria(miSel.value,str);
	 div1.visibility = "visible";
	 div2.visibility = "visible";
	}
}
function llenaOpcionesCategoria(catalog,str){
	for (var i=1;i < document.selForm.Categoria.options.length;i++)
		document.selForm.Categoria.options[i] = null;
	var cuenta = 1;
	var selected;
	for (var i = 0;i< arrayCat.length;i++){
		if (arrayCat[i][0]==catalog){
			document.selForm.Categoria.options[cuenta]= new Option(arrayCat[i][1],arrayCat[i][2],selected,selected);
			selected = (arrayCat[i][2]==str);
			cuenta++;
		}
	}
}

function irAPagina(oForm,iPag){
	oForm.iPagina.value = iPag;
	oForm.submit();
}
function Anterior_onclick(oForm){
	oForm.Accion.value = 'Anterior';
	oForm.submit();
}
function Refrescar_onclick(oForm){
	oForm.Accion.value = '';
	oForm.submit();
}
function Siguiente_onclick(oForm){
	oForm.Accion.value = 'Siguiente';
	oForm.submit();
}
function Primero_onclick(oForm){
	oForm.Accion.value = 'Primero';
	oForm.submit();
}
function Ultimo_onclick(oForm){
	oForm.Accion.value = 'Ultimo';
	oForm.submit();
}

function vaAPag(pagNum,action,ord, oForm, inicio){
/*	if(action=='srchdept.asp')
		oForm = document.Buscar;
	else
		oForm = document.Catalogo;
*/
/*	var miAcc = document.Catalogo.action;
	document.Catalogo.elements["ORD"].value = ord;
	document.Catalogo.elements["page"].value = pagNum;
	document.Catalogo.action = action;
	document.Catalogo.submit();
*/	//var miAcc = oForm.action;
//alert(pagNum);alert(action);alert(ord);alert(oForm.value);
	oForm.elements["ORD"].value = ord;
	oForm.elements["page"].value = pagNum;
	oForm.elements["inicio"].value = inicio;
	oForm.action = action;
	oForm.submit();

}

function vaAPag1(pagNum,action,ord){
	var miAcc = document.Catalogo.action;
	//alert(document.forms[1].name)	
	document.Catalogo.ORD.value = ord;
	document.Catalogo.page.value = pagNum;
	document.Catalogo.action = action;
	//alert(document.Catalogo.action);	
	document.Catalogo.submit();
	//document.Catalogo.action = miAcc;
}
function ordenaLista(url,pag, inicio, formulario){
	//alert(url);alert(pag);alert(inicio);
    vaAPag(1,url,pag, formulario, inicio)
}

function ordenaLista1(url,pag){
    vaAPag1(1,url,pag)
}

var flag = true;
function FuncEspere(icMostrarDiv){	
	if (flag){
	    if (icMostrarDiv == 'S')
			DivEspere.style.visibility='visible';
		flag = false;
		return(true);
	}
	else{
		alert(msgJsOpcionSeleccionada);
		return(false);
	}
}

function catalogSubmit(){
document.Catalogo.action='../pedidos/_CrossSelling.asp';
document.Catalogo.submit();
}

var diasdelmes   = new haceArray( 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
var diasdelmesbi = new haceArray( 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);

function haceArray()    {
    this[0] = haceArray.arguments.length;
    for (i = 0; i<haceArray.arguments.length; i++)
        this[i+1] = haceArray.arguments[i];
}

function aniobisiesto(anio) {
    if ((anio/4)   != Math.floor(anio/4))   return false;
    if ((anio/100) != Math.floor(anio/100)) return true;
    if ((anio/400) != Math.floor(anio/400)) return false;
    return true;
}

function fechavalida(dia,mes,anio) {
    if ( (aniobisiesto(anio) && (dia > diasdelmesbi[parseInt(mes*1)])) ||
         (!aniobisiesto(anio) && (dia > diasdelmes[parseInt(mes*1)])) ){
        //alert("fecha inválida"); 
        return false;}
    else{
        return true;}
}

function intervalofechavalida(oForm,dia_d,mes_d,anio_d,dia_h,mes_h,anio_h){
	if(fechavalida(dia_d, mes_d, anio_d)){
		if(fechavalida(dia_h, mes_h, anio_h)){
			var desde = anio_d*10000 + mes_d*100 + dia_d*1;
			var hasta = anio_h*10000 + mes_h*100 + dia_h*1;
			if (desde <= hasta)
				return '';
			else
				return msgJsFechaInicialAnterior;
		}else
			return msgJsFechaFinalInvalida;
	}else
		return msgJsFechaInicialInvalida;
}

function valido(){

	var data;
	var data1;
	var msg="";
	var obj=null;
	
	if (! fechavalida(document.frmSeleccione.dias.options[document.frmSeleccione.dias.selectedIndex].value,document.frmSeleccione.meses.options[document.frmSeleccione.meses.selectedIndex].value,document.frmSeleccione.years.options[document.frmSeleccione.years.selectedIndex].value)){
		msg = msgJsFechaInvalida;
		if (obj==null) {
			obj=document.frmSeleccione.dias;
		}
	}
	

	if (msg.length!=0){
		alert(msg);
		obj.focus();
		return false;
	}
	return true;
}


function checkeaTodo(hasta)
{
	flag=true;
	n = 0;
	for(var i=0;i<=hasta;i++){
		if (eval('document.forms[1].RemoveCheck_' + i + '.checked==true'))
			n++;
	}
n--;
if (n == hasta){
		for(var i=0;i<=hasta;i++){
			eval('document.forms[1].RemoveCheck_' + i + '.checked=false');
		}
	}else{
		for(var i=0;i<=hasta;i++){
			eval('document.forms[1].RemoveCheck_' + i + '.checked=true');
		}	
	}
}

function verificarQuantity(inputBox)
{
	var string=inputBox.value;
	var auxstring="";
	
    if (!string) return;
    
    var Chars = "0123456789";

    for (var i = 0; i < string.length; i++) 
    {
       if (Chars.indexOf(string.charAt(i)) == -1)
			;
       else
			auxstring=auxstring + string.charAt(i);
    }
    if (inputBox.value != auxstring)
		inputBox.value = auxstring;
	return;
}

/**************************************
COMIENZAN FUNCIONES MENU
**************************************/

function lib_bwcheck(){ //Browsercheck (needed)
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=(navigator.userAgent.indexOf("Opera")>-1 && document.getElementById)?1:0
	//alert(navigator.appVersion);
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
	//alert(bw);
	return this
}
var bw=lib_bwcheck()
//Opera no quiere padding en los layers, pierde las imagenes de fondo, aqui su version sin paddings.
if(bw.opera5) document.write("<style>DIV.clSlide{padding:0px; background-image:url(' ')}\nDIV.clSlideSub{padding:0px; background-image:url(' ')}\nDIV.clSlideSub2{padding:0px; background-image:url(' ')}</style>")

/************************************************************************************
Objetos para todos los navegadores
************************************************************************************/
function makeMenuObj(obj,nest){
	nest=(!nest) ? "":'document.'+nest+'.'										
   	this.css=bw.dom? document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+"document.layers." +obj):0;		
	this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;	
	this.ref=bw.dom || bw.ie4? document:bw.ns4?eval(nest+"document.layers." +obj+".document"):0;		
	this.x=(bw.ns4 || bw.ns5)? this.css.left:this.css.offsetLeft;
	this.y=(bw.ns4 || bw.ns5)? this.css.top:this.css.offsetTop;		
	this.hideIt=b_hideIt; this.showIt=b_showIt; this.movey=b_movey
	this.moveIt=b_moveIt; this.moveBy=b_moveBy; this.status=0; 
	this.bgImg=b_bgImg;	this.obj = obj + "Object"; eval(this.obj + "=this"); 
	this.clipTo=b_clipTo;
	return this
}
function b_showIt(){this.css.visibility="visible"; this.status=1}
function b_hideIt(){this.css.visibility="hidden"; this.status=0}
function b_movey(y){this.y=y; this.css.top=this.y}	
function b_moveIt(x,y){this.x=x; this.y=y; this.css.left=this.x;this.css.top=this.y}
function b_moveBy(x,y){this.x=this.x+x; this.y=this.y+y; this.css.left=this.x;this.css.top=this.y}
function b_bgImg(img){if(bw.ie||bw.dom)this.css.backgroundImage="url("+img+")"
else this.css.background.src=img
}
function b_clipTo(t,r,b,l,w){if(bw.ns4){this.css.clip.top=t;this.css.clip.right=r
this.css.clip.bottom=b;this.css.clip.left=l
}else{this.css.clip="rect("+t+","+r+","+b+","+l+")"; if(w){this.css.width=r; this.css.height=b}}}
/********************************************************************************
MENU
Inicializacion de la pagina, creacion de objetos.
********************************************************************************/
function SlideMenuInit(){
	oSlideMenu=new makeMenuObj('divSlideCont')
	oSlideMenu.moveIt(menux,menuy)
	oSlide=new Array()
	for(i=0;i<menus.length;i++){
		oSlide[i]=new makeMenuObj('divSlide'+i,'divSlideCont')
		oSlide[i].subs=menus[i].subs
		oSlide[i].sub=new Array()
		oSlide[i].moveIt(0,mainheight*i)
		oSlide[i].starty=oSlide[i].y
    if(bw.opera) oSlide[i].css.paddingLeft="10px"
		if(!menus[i].seperator) oSlide[i].bgImg(level0_regular)
		for(j=0;j<oSlide[i].subs;j++){
			oSlide[i].sub[j]=new makeMenuObj('divSlideSub'+i+"_"+j,'divSlideCont')
			//oSlide[i].sub[j].moveIt(10,oSlide[i].y+subheight*j+between)
			//Modificado para que no se deslice hacia la derecha
			oSlide[i].sub[j].moveIt(0,oSlide[i].y+subheight*j+between)
			oSlide[i].sub[j].starty=oSlide[i].sub[j].y
			oSlide[i][j]=new Array()
			oSlide[i][j].subs=menus[i][j].subs
			oSlide[i][j].sub=new Array()
			img=level1_round
			if(oSlide[i][j].subs!=0){
				if(j!=oSlide[i].subs-1) img=level1_sub
				else img=level1_sub_round
				oSlide[i].sub[j].css.color="white"
			}else{
				if(j!=oSlide[i].subs-1)img=level1_regular
			}
			oSlide[i].sub[j].origimg=img
			oSlide[i].sub[j].bgImg(img)
			for(a=0;a<oSlide[i][j].subs;a++){
				oSlide[i][j].sub[a]=new makeMenuObj('divSlideSub'+i+"_"+j+"_"+a,'divSlideCont')
				//oSlide[i][j].sub[a].moveIt(20,oSlide[i].sub[j].y+subheight*a+between-2)
				//Modificado para que no se deslice hacia la derecha
				oSlide[i][j].sub[a].moveIt(0,oSlide[i].sub[j].y+subheight*a+between-2)
				oSlide[i][j].sub[a].starty=oSlide[i][j].sub[a].y			
				oSlide[i][j][a]=new Array()
				oSlide[i][j][a].subs=menus[i][j][a].subs
				oSlide[i][j][a].sub=new Array()
				if(a!=oSlide[i][j].subs-1) img=level2_regular
				else img=level2_round
				oSlide[i][j].sub[a].origimg=img
				oSlide[i][j].sub[a].bgImg(img)
			}
		}
	}
	oSlideMenu.showIt();
	//que abra el menu en el nodo 1
	//swmenu(0,-1,-1);
	//que reacomode al estado del usuario
	//setTimeout(abrirNodo,200);
	abrirNodo1();
}


/********************************************************************************
Variables
********************************************************************************/
var active=-1;var going;var isthere; var sactive=-1; var sisthere=-1; var s2active=-1; var s2isthere=-1
/********************************************************************************
Funcion Switch - menu .
********************************************************************************/
function swmenu(num,snum,s2num){
	//alert(num+'*'+snum+'*'+s2num);
	if(snum!=-1){
		if(oSlide[num][snum].subs==0) return
	}
	if(s2num!=-1){
		if(oSlide[num][snum][s2num].subs==0) return
	}
	if((num!=active || snum!=sactive || s2num!=s2active) && !going){
		going=true;isthere=0;sisthere=0; moveUp(num,snum,s2num)
	}
}
/********************************************************************************
movimiento de menus a sus posiciones originales.
********************************************************************************/
function moveUp(num,snum){
	if(snum==-1){
		for(i=0;i<oSlide.length;i++){
			if(oSlide[i].y>oSlide[i].starty+pxspeed && active!=i) oSlide[i].moveBy(0,-pxspeed)
			else{if(active!=i) oSlide[i].moveIt(oSlide[i].x,oSlide[i].starty); isthere=i}
		}
		
		if(isthere<oSlide.length-1) {
		 setTimeout("moveUp("+num+","+snum+")",timspeed);
		 }
		else swmenu2(num,snum)
	}else{
		if(num==oSlide.length-1) isthere=num
	
		if(sactive!=-1){ //Is out!
			//Slide subs
			j=0
			for(i=sactive+1;i<oSlide[num].sub.length;i++){
				j++
				if(oSlide[num].sub[i].y>oSlide[num].sub[i].starty+pxspeed) oSlide[num].sub[i].moveBy(0,-pxspeed)
				else{oSlide[num].sub[i].moveIt(oSlide[num].sub[i].x,oSlide[num].sub[i].starty); sisthere=i}
			}
			//Slide main
			for(i=num+1;i<oSlide.length;i++){
				if(oSlide[i].y>oSlide[i].starty + oSlide[num].sub[sactive].y +subheight*j )  oSlide[i].moveBy(0,-pxspeed)
				else{oSlide[i].moveIt(oSlide[i].x,oSlide[i].starty + oSlide[num].sub[sactive].y +subheight*j ); isthere=i}
			}
		}else{ //Slide to the one clicked
			for(i=num+1;i<oSlide.length;i++){
				if(oSlide[i].y>oSlide[i].starty + snum*between+between)  oSlide[i].moveBy(0,-pxspeed)
				else{oSlide[i].moveIt(oSlide[i].x,oSlide[i].starty + snum*between+between); isthere=i}
			}
		}
		if(isthere<oSlide.length-1 || (sactive!=-1 && sisthere<oSlide[num].sub.length-1 && sactive!=oSlide[num].sub.length-1)){
		 setTimeout("moveUp("+num+","+snum+")",timspeed)
		 } else {
		  swmenu2(num,snum);
		  }
	}
}
/********************************************************************************
Switch - menu 2, sucede cuando se abren (dscilan hacia abajo) nuevamente los menuses.
********************************************************************************/
function swmenu2(num,snum){
	isthere=0;
	sisthere=0;
	if(active>-1 && snum==-1){
		//Hiding submenus
		for(j=0;j<oSlide[active].subs;j++){oSlide[active].sub[j].hideIt()}
		oSlide[active].bgImg(level0_regular)
		oSlide[active].moveIt(0,oSlide[active].starty)
	}
	if(sactive>-1){
		//Hiding submenus
		for(j=0;j<oSlide[active][sactive].sub.length;j++){oSlide[active][sactive].sub[j].hideIt()}
		oSlide[active].sub[sactive].bgImg(oSlide[active].sub[sactive].origimg)
		//oSlide[active].sub[sactive].moveIt(10,oSlide[active].sub[sactive].starty)
		//Para evitar desplazamiento hacia la derecha
		oSlide[active].sub[sactive].moveIt(0,oSlide[active].sub[sactive].starty)
		//Move back to place
		for(i=sactive+1;i<oSlide[active].sub.length;i++){
			oSlide[active].sub[i].moveIt(oSlide[active].sub[i].x,oSlide[active].sub[i].starty)
		}
	}
	active=num
	//Showing submenus
	if(snum>-1){
//Repito esta parte para que abra el conjunto de menúes, si sólo abre el submenu.
		sactive=-1
		for(j=0;j<oSlide[active].subs;j++){oSlide[active].sub[j].showIt()}
		//oSlide[num].moveBy(10,3)
		//Para evitar que se mueva hacia la derecha y hacia abajo al abrir
		oSlide[num].moveBy(0,0)
		oSlide[num].bgImg(level0_round)

		sactive=snum
		for(j=0;j<oSlide[num][snum].sub.length;j++){oSlide[num][snum].sub[j].showIt()}
		//oSlide[num].sub[snum].moveBy(10,3)
		//Para evitar que se mueva hacia la derecha y hacia abajo al abrir
		oSlide[num].sub[snum].moveBy(0,0)
		oSlide[num].sub[snum].bgImg(level1_round2)
	}else{
		sactive=-1
		for(j=0;j<oSlide[active].subs;j++){oSlide[active].sub[j].showIt()}
		//oSlide[num].moveBy(10,3)
		//Para evitar que se mueva hacia la derecha y hacia abajo al abrir
		oSlide[num].moveBy(0,0)
		oSlide[num].bgImg(level0_round)
	}
	if(num!=oSlide.length-1) moveDown(num,snum)
	else{
		isthere=num
		moveDown(num,snum)
	}
}
/********************************************************************************
Desplazando los menuses hacia abajo
********************************************************************************/
function moveDown(num,snum){
	//if(num==oSlide.length-1) isthere=num
	for(i=num+1;i<oSlide.length;i++){
		if(snum==-1){
			if(oSlide[i].y<(oSlide[num].subs-1)*subheight+oSlide[i].starty+between-pxspeed) oSlide[i].moveBy(0,pxspeed)
			else{oSlide[i].moveIt(oSlide[i].x,(oSlide[num].subs-1)*subheight+oSlide[i].starty+between); isthere=i}
		}else{
			if(oSlide[i].y<(oSlide[num].subs-1)*subheight+oSlide[i].starty+between-pxspeed + (oSlide[num][snum].subs-1)*subheight+between)  oSlide[i].moveBy(0,pxspeed)
			else{oSlide[i].moveIt(oSlide[i].x,(oSlide[num].subs-1)*subheight+oSlide[i].starty+between  + (oSlide[num][snum].subs-1)*subheight+between); isthere=i}
		}
	}
	if(snum!=-1){
		for(i=snum+1;i<oSlide[num].sub.length;i++){		
			if(oSlide[num].sub[i].y<(oSlide[num][snum].subs-1)*subheight+oSlide[num].sub[i].starty+between-pxspeed) oSlide[num].sub[i].moveBy(0,pxspeed)
			else{oSlide[num].sub[i].moveIt(oSlide[num].sub[i].x,(oSlide[num][snum].subs-1)*subheight+oSlide[num].sub[i].starty+between); sisthere=i}
		}
	}
	if(snum==-1){
		if(isthere<oSlide.length-1) setTimeout("moveDown("+num+","+snum+")",timspeed)
		else going=false
	}else{
		if(isthere<oSlide.length-1 || (sisthere<oSlide[num].sub.length-1 && snum!=oSlide[num].sub.length-1)) setTimeout("moveDown("+num+","+snum+")",timspeed)
		else going=false
	}
}
var test=0
/********************************************************************************
Escritura de los layers...
********************************************************************************/
menus=new Array(); var a=0; var b=0; var c=0; var d=0
function makeMenu(type,text,lnk,target,strEvento,end){
//	alert(type +'*'+text+'*'+lnk+'*'+target+'*'+strEvento+'*'+end);
var sOnMouseOver = ' onMouseOver="window.status=\'' + sSiteName + '\';return true;';
	str=""; tg="";
  if(target) tg='target="'+target+'"'
  if(!lnk) lnk="#"
  if(!strEvento) strEvento=""
  self.status=lnk
	if(a==0) str='<div id="divSlideCont">\n'
	if(type=="top"){
		menus[a]=new Array();
		if(text=="seperator"){
			str+='\t<div id="divSlide'+a+'" class="clSlide"></div>\n'
			menus[a].seperator=1
		}else{
      str+='\t<div id="divSlide'+a+'" class="clSlide"><a '+strEvento+' href="'+lnk+'" '+tg+' onclick="swmenu('+a+',-1,-1); if(bw.ie || bw.ns6) this.blur();" ' + sOnMouseOver; 
      if(lnk=="#") str+='return false'
      str+='" class="clSlideLinks"> '+text+'</a><br></div>\n'
		}
    menus[a].subs=0; a++; b=0
	}else if(type=="sub"){
		str+='\t\t<div id="divSlideSub'+(a-1)+'_'+(b)+'" class="clSlideSub"><a '+tg+' '+strEvento+' onclick="swmenu('+(a-1)+','+b+',-1); if(bw.ie || bw.ns6) this.blur();" ' + sOnMouseOver
    if(lnk=="#") str+='return false'
    str+='" href="'+lnk+'" class="clSlideSubLinks">  '+text+'</a><br></div>\n'
		b++; menus[a-1].subs=b; menus[a-1][b-1]=new Array(); c=0; menus[a-1][b-1].subs=0
	}else if(type=="sub2"){
		str+='\t\t<div id="divSlideSub'+(a-1)+'_'+(b-1)+'_'+c+'" class="clSlideSub2"><a '+tg+' '+strEvento+' href="'+lnk+'" ' + sOnMouseOver + '" class="clSlideSub2Links">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+text+'</a><br></div>\n'
		c++; menus[a-1][b-1].subs=c; menus[a-1][b-1][c-1]=new Array(); d=0; menus[a-1][b-1][c-1].subs=0
	}
	if(end) str+="</div>"
	document.write(str);
//		alert(str);
}
function preLoadBackgrounds(){
  
  for(i=0;i<arguments.length;i++){
    this[i]=new Image()
    	this[i].src=arguments[i]
  }
  return this
}


/*************************************
Aspecto general del menu. 
Esto trabaja junto a los styles definidos en layaout1.asp
**************************************/

between=20 //pixels entre menu y submenmu
mainheight=20 //Altura de los menu principales
subheight=20 //Altura de submenus
//pxspeed=13 //Velocidad en pixels de la animacion
pxspeed=99999 //Velocidad en pixels de la animacion
timspeed=15 //Velocidad del timer de la animacion
menuy=92 //Top (ubicacion) del menu.
menux=0 //Left (ubicacion) del menu
//Images - Son para generar botones con imagenes de fondo
level0_regular="../../images/level0_regular.gif"
level0_round="../../images/level0_regular.gif"
level1_regular="../../images/level1_regular.gif"
level1_round="../../images/level1_regular.gif"
level1_sub="../../images/level1_sub.gif"
level1_sub_round="../../images/level1_sub.gif"
level1_round2="../../images/level1_sub.gif"
level2_regular="../../images/level2_regular.gif"
level2_round="../../images/level2_round.gif"

MM_preloadImages('../../images/level0_regular.gif','../../images/level1_regular.gif','../../images/level1_sub.gif','../../images/level2_regular.gif','../../images/level2_round.gif');


preLoadBackgrounds(level0_regular,level0_round,level1_regular,level1_round,level1_sub,level1_sub_round,level1_round2,level2_regular,level2_round)


/***********************************
FIN FUNCIONES MENU
***********************************/

function trimJS(oText){
var sData;
	if (oText.value.substr(0,1)==" ")
		sData = oText.value.substr(1);
	else{
		if (oText.value.substr(oText.value.length -1)== " ")
			sData = oText.value.substr(0,oText.value.length -1);
		else
			return oText.value.length;
	}
	oText.value = sData;
	trimJS(oText);
}

function ConEnter(original,nuevotexto){
var temp=original;
	if (temp.length != 0)
		temp = temp + "\n";
	temp=temp + nuevotexto;
	return temp;
}

