var NN = (document.layers ? true : false);
var hideName = (NN ? 'hide' : 'hidden');
var showName = (NN ? 'show' : 'visible');
var open_sm = new Array ();
var to_load = new Array ();
var imgs_url = new Array ();
var imgs_loaded = new Array ();
var positioned_array = new Array ();
var autoHide_pass = 1;
var autoHide_on = false;
var autoHide_var = null;
var autoHide_activate = true;
var autoHide_seconds = 3;
var	images_base = '';
var idYouarehere = '';
var first_over = true;
var tempX;
var tempY;

function Menu (idMenu,m_left,m_top) {

	this.m_left = m_left;
	this.m_top = m_top;
	this.m_vertical  = true;
	this.sm_width  = 110;
	this.sm_height  = 34;
	this.m_width  = this.sm_width; 
	this.m_height  = this.sm_height; 
	this.default_icon_height = 16;
	this.default_icon_width = 16;
	this.h_offset  = -3; 
	this.v_offset  = 3; 
	this.vertical_adjust = 0;
	this.horizontal_adjust = 0;
	this.zIndx = 10;
	this.activeYouarehere = true;
	this.default_cursor ='default';
	this.link_cursor = 'pointer';
	this.sm_direction = 'right';
	this.base_url = '';
	this.default_main_page = 'index.html';
	this.positioning = 'absolute';
	this.internal_browse_active = true;
	this.base_url_active = true;
	this.frameMenu = 'noFrames'; 
	this.frameSubMenu = 'noFrames';

	this.l_m_background  = '#FFFFFF';
	this.l_m_border = '2px outset #FFFFFF';
	this.l_m_border_top = this.l_m_border;
	this.l_m_border_right = this.l_m_border;
	this.l_m_border_bottom = this.l_m_border;
	this.l_m_border_left = this.l_m_border;
	this.l_sm_background  = '#FFFFFF';
	this.l_sm_border = '2px outset #FFFFFF';
	this.l_sm_border_top = this.l_sm_border;
	this.l_sm_border_right = this.l_sm_border;
	this.l_sm_border_bottom = this.l_sm_border;
	this.l_sm_border_left = this.l_sm_border;

	this.m_align = 'center';
	this.m_padding = 3;
	this.m_background  = '#3333AA';
	this.m_bottom_decor = '';
	this.m_txt_font_family = 'Helvetica, Arial, sans-serif';
	this.m_txt_font_size = '12px';
	this.m_txt_color  = '#FFFFFF';
	this.m_txt_weight = 700;
	this.m_txt_decoration = 'none';

	this.m_a_background  = this.m_background;
	this.m_txt_a_color  = this.m_txt_color;
	this.m_txt_a_link_weight = 900;
	this.m_txt_a_link_decoration = 'none';	

	this.sm_align = null;
	this.sm_padding = [3,3,3,5];
	this.sm_background  = 'silver';
	this.sm_bottom_decor = '1px inset #FFFFFF';
	this.txt_font_family = 'Helvetica, Arial, sans-serif';
	this.txt_font_size = '11px';
	this.txt_color  = 'black';
	this.txt_weight = 700;
	this.txt_decoration = 'none';

	this.sm_a_background  = '#669999';
	this.txt_a_font_family = this.txt_font_family;
	this.txt_a_font_size = this.txt_font_size;
	this.txt_a_color  = 'white';
	this.txt_a_link_weight = 900;
	this.txt_a_link_decoration = 'underline';

	this.txt_i_font_family = this.txt_font_family;
	this.txt_i_font_size = this.txt_font_size;
	this.txt_i_color  = 'gray';

	this.default_image = 'url(imagenes/transparent.gif)';
	this.m_dec = 'url(imagenes/transparent.gif)'; 
	this.m_a_dec = 'url(imagenes/transparent.gif)';
	this.sm_sep = (NN)? '----------' : 'url(imagenes/trans.gif)'; 
	this.sm_arrow = 'url(imagenes/mini_right.gif)';
	this.sm_a_arrow = 'url(imagenes/menu_flecha.gif)';
	this.sm_left_arrow = 'url(imagenes/mini_left.gif)'; 
	this.sm_a_left_arrow = 'url(imagenes/mini_a_left.gif)';
	this.sm_current = 'url(imagenes/v.gif)'; 
	this.iconYouarehere = 'url(imagenes/transparent.gif)';
	this.iconYouarenothere = 'url(imagenes/transparent.gif)';
	this.thenames_waiting = 'url(imagenes/waiting.gif)';
	this.thenames_down = 'url(imagenes/down.gif)';
	this.thenames_up = 'url(imagenes/up.gif)';
	this.thenames_here = 'url(imagenes/here.gif)';

	

	frameMenu = this.frameMenu;
	this.thenames = new Array ();
	this.idMenu = idMenu;
	this.lev = 0;
	this.pre_sm = this.idMenu + 'm';
	this.pre_td = 'td';
	this.suf_sm_a = this.idMenu + 'a';
	this.pre_l = this.idMenu + 'l';
	this.num_sm = -1;
	this.sm = new Array ();
	this.sm[0] = new Array();
	this.c_a = new Array ();
	this.c_a[this.lev] = [0,0,0,false,0,'',0];
	this.c_l = new Array ();

	this.mn = new Array();
	this.idYouarehere = idYouarehere;
	this.nextChangeDir = false;
	this.lastYouAreHere = new Array ();
	this.ImagesList = new Array ();
		
	//Functions
	this.addItem = addItem;
	this.doMenu = doMenu;
	this.genL = genL;
	this.endL = endL;
	this.hideL = hideL;
	this.showL = showL;
	this.refL = refL;
	this.hideMenus = hideMenus;
	this.onOut_sm = onOut_sm;
	this.onOver_sm = onOver_sm;
	this.youAreHere = youAreHere
	this.mark_youAreHere = mark_youAreHere;
	this.openHere = openHere;
	this.open_l = open_l;
	this.findPosY = findPosY;
	this.show_internal_browse = show_internal_browse;
	this.import_prefs = import_prefs;
	
	return this;
}

function genL(positioned,sName, sLeft, sTop,sWdh, sHgt, sVis,sColor,copy,handlers,morestyles) {
	if (NN) {
		tWidth = (!sWdh)? '' : ' WIDTH="' + sWdh + '"';
		tHeight = (!sHgt)? '' : ' HEIGHT="' + sHgt + '"';
		tHandlers = (!handlers)? '' : handlers;
		var s = '<LAYER NAME="' + sName + '" LEFT="' + sLeft;
		s += '" TOP="' + sTop + '"';
		s += tWidth;
		s += tHeight;
		s += ' VISIBILITY="' + sVis + '"';
		s += ' z-Index="' + (++this.zIndx) + '" ';
		if (typeof (sColor) == 'number'){
		    s += ' background="' + to_load[sColor] + '"';
		} else {
		    s +=' bgcolor="' + sColor + '"';
		}
		s += tHandlers + '>\n' + copy;
		return s;
	} else {
		tWidth = (!sWdh)? '' : ' width: ' + sWdh + 'px;';
		tHeight = (!sHgt)? '' : ' height: ' + sHgt + 'px;';
		tHandlers = (!handlers)? '' : handlers;
		var s = '<DIV ID="' + sName + '" STYLE="';
		s += (positioned != null)? 'position: '+positioned+';' : '';
		s += (sLeft != null)? ' left: ' + sLeft + 'px;' : '';
		s += (sTop != null)? ' top: ' + sTop + 'px;' : '';
		s += tWidth;
		s += tHeight;
		s += ' visibility:' + sVis + '; z-Index: ' + (++this.zIndx) + '; background: ';
		s += (typeof (sColor) == 'number'? imgs_url[sColor] : sColor);
		s += ';'
		s += (!morestyles)? '' : morestyles;
		s += '"' + tHandlers + '>\n' + copy;
		return s;
	}
}

function endL (){
	if (NN){
		return '</LAYER>\n';
	}
	else{
		return '</DIV>\n';
	}
}

function hideL(name,alayer,theFrame) {
    if (NN){refL(name,alayer,theFrame).visibility = hideName} else {refL(name,alayer,theFrame).style.visibility = hideName}
}

function showL(name,alayer,theFrame) {
    if (NN){refL(name,alayer,theFrame).visibility = showName} else {refL(name,alayer,theFrame).style.visibility = showName}
}

function refL(aLayer,aLayout,theFrame) {
    theDoc = (theFrame == 'noFrames')? document : top.frames[theFrame].document;
    if (document.getElementById) {
	    return theDoc.getElementById(aLayer);
    } else if (document.layers){
	    if (aLayout != ''){
		    return theDoc.layers[aLayout].document.layers[aLayer]
	    } else {
		    return theDoc.layers[aLayer]
	    }
    } else if (document.all){
	    return eval('theDoc.all.' + aLayer);
    }
}

function refLcomplet (aLayer,aLayout,theFrame) {
    theDoc = (theFrame == 'noFrames')? document : top.frames[theFrame].document;
    this.theName = aLayer;
    if (document.getElementById) {
		this.myRef = theDoc.getElementById (aLayer);
		this.theTop = parseInt(this.myRef.style.top);
		this.theLeft = parseInt(this.myRef.style.left);
		this.theHeight = parseInt(this.myRef.style.height);
		this.theWidth = parseInt(this.myRef.style.width);
		this.inHeight = parseInt(this.myRef.offsetHeight);
		this.inWidth = parseInt(this.myRef.offsetWidth);
		this.theRight = parseInt(this.myRef.style.left) + parseInt(this.myRef.style.width);
		this.theBottom = parseInt(this.myRef.style.top) + parseInt(this.myRef.style.height)
    } else if (document.layers){
		if (aLayout != ''){
			this.myRef = theDoc.layers[aLayout].document.layers[aLayer];
		} else {
			this.myRef = theDoc.layers[aLayer];
		}
		this.theTop = this.myRef.y;
		this.theLeft = this.myRef.x;
		this.theHeight = this.myRef.height || this.myRef.clip.height;
		this.theWidth = this.myRef.width || this.myRef.clip.width;
		this.theRight = this.myRef.x + this.theWidth;
		this.inHeight = this.theHeight;
		this.inWidth = this.theWidth;
		this.theBottom = this.myRef.y + this.theHeight
    } else if (document.all){
		this.myRef = eval('theDoc.all.' + aLayer);
		this.theTop = parseInt(this.myRef.style.top);
		this.theLeft = parseInt(this.myRef.style.left);
		this.theHeight = parseInt(this.myRef.style.height);
		this.theWidth = parseInt(this.myRef.style.width);
		this.theRight = parseInt(this.myRef.style.left) + parseInt(this.myRef.style.width);
		this.inHeight = parseInt(this.myRef.offsetHeight);
		this.inWidth = parseInt(this.myRef.offsetWidth);
		this.theBottom = parseInt(this.myRef.style.top) + parseInt(this.myRef.style.height)
    }
}

function searchL (searchedL,anarray,full) {
    var isMatch = false;
    for (i = 0;i < anarray.length;i++){
		if (full){
			if (anarray[i][0] == searchedL){
				isMatch = true;
				break;
			}
		} else {
			if (anarray[i][0].indexOf (searchedL) > -1){
				isMatch = true;
				break;
			}
		}
    }
    theMatch = (isMatch)? i : -1;
    return theMatch
}



function addItem (mText,mXtras,isLast) {
    var suf = '',idLayout,theText,theDecor,is_active;
	var theStatus = '';
	var addedStyle = '';
    var clickAction = '';
    var prevWidth = 0;
    var prevDiff = 0;
    mXtras = (typeof (mXtras) == 'string')? {'url':mXtras}: mXtras;
	default_align = (this.sm_direction == 'left')? 'right': 'left';
	theAlign = mXtras['align'] || this.sm_align || default_align;
	prePadding = mXtras['padding'] || this.sm_padding;
	thePadding = (typeof (prePadding) == 'object')? prePadding : [prePadding,prePadding,prePadding,prePadding];
	theFontFamily = mXtras['font-family'] || this.txt_font_family;
	theFontSize = mXtras['font-size'] || this.txt_font_size;
    theColor = mXtras['Mnbackground'] || mXtras['background'] || this.sm_color || this.sm_background;
    theaColor = mXtras['MnAbackground'] || mXtras['backgroundA'] || this.sm_a_color || this.sm_a_background;
    txtcolor = mXtras['Mntxtcolor'] || mXtras['txtcolor'] || this.txt_color;
    txtAcolor =  mXtras['Mntxtacolor'] || mXtras['txtacolor'] || this.txt_a_color;
    theWidth = mXtras['theWidth'] || mXtras['width'] || this.sm_width;
    theHeight = mXtras['theHeight'] || mXtras['height'] ||this.sm_height;
    winOpts = mXtras['winOptions'] || '';
    theDir = mXtras['nextOpenDir'] || '';
    theURL = mXtras['url'];
    if (this.base_url_active && theURL.indexOf ('://') == -1 && theURL.length > 1 && theURL.indexOf ('#') != 0 && theURL.indexOf ('mailto:') == -1 && theURL.indexOf ('javascript:') == -1){
		mXtras['url'] = this.base_url + mXtras['url'];
	}
	theStatus = mXtras['title'] || (mXtras['onclick'] &&  mXtras['url'] == 'a') || mXtras['url'];
	theStatusOn = (theStatus.length > 1)? escape ("top.status = '"+theStatus+"';") : '';
	theStatusOut = (theStatus.length > 1)? escape ("top.status = '';") : '';
	overAction = mXtras['onmouseover'] || '';
	overAction = (overAction > '')? theStatusOn + escape (overAction): theStatusOn;
	outAction = mXtras['onmouseout'] || '';
	outAction = (outAction > '')? theStatusOut + escape (outAction) : theStatusOut;
	offImage = (theDir == 'right' || this.sm_direction == 'right')? mXtras['image'] || this.sm_arrow : mXtras['image'] || this.sm_left_arrow;
	onImage = (theDir == 'right' || this.sm_direction == 'right')? mXtras['imageA'] || this.sm_a_arrow : mXtras['imageA'] || this.sm_a_left_arrow;
	if (this.c_l.length == 0){
		this.c_l[0] = [this.m_left,this.m_top];
	}
	for (i=0;i <= this.lev; i++){
		suf += '_';
		suf += this.c_a[i][0];
    }
	if (!isLast && this.sm_bottom_decor > '' && this.lev > 0){
		addedStyle = ';border-bottom: '+ this.sm_bottom_decor + ';';
	} else if (!isLast && this.m_bottom_decor > '' && this.lev == 0){
		addedStyle = ';border-bottom: '+ this.m_bottom_decor + ';';
	}
    if (this.c_a[this.lev][0] == 0){
		this.num_sm++;
		this.sm[this.num_sm] = new Array ();
		this.c_a[this.lev][4] = this.num_sm;
		if ((this.sm_direction == 'left' && !this.nextChangeDir) || (this.nextChangeDir && this.sm_direction != 'left')){
			this.c_l[this.lev][0] -= ((this.lev > 1 && !this.m_vertical) || (this.lev > 0 && this.m_vertical))? theWidth : 0;
			this.nextChangeDir = false
		} else if (this.sm_direction == 'left' && this.nextChangeDir){
			this.nextChangeDir = false
		}
		this.mn[this.c_a[this.lev][4]] = new Array(this.c_l[this.lev][0],this.c_l[this.lev][1]);
		this.c_a[this.lev][5] = suf;
		}
		if (mXtras['url'] == ''){
			this.c_a[this.lev][6] = theWidth;
			var s = '';
			prevWidth = theWidth;
			clickAction = mXtras['onclick'] || '';
			if (this.lev == 0) {
				idLayer = this.pre_l + suf;
				idLayout = this.c_a[this.lev][5];
				theClass = '';
				theText = mText;
				is_active = true;
				theWidth = mXtras['theWidth'] || mXtras['width'] || this.m_width;
				theHeight = mXtras['theHeight'] || mXtras['height'] ||this.m_height;
				theColor = mXtras['Mnbackground'] || mXtras['background'] || this.m_color || this.m_background;
				theaColor = mXtras['MnAbackground'] || mXtras['backgroundA'] || this.m_a_color || this.m_a_background;
				theFontFamily = mXtras['font-family'] || this.m_txt_font_family;
				theFontSize = mXtras['font-size'] || this.m_txt_font_size;
				txtcolor = mXtras['Mntxtcolor'] || mXtras['txtcolor'] || this.m_txt_color;
				txtAcolor = mXtras['Mntxtacolor'] || mXtras['txtacolor'] || this.m_txt_a_color;
				theAlign = mXtras['align'] || this.m_align || default_align;
				prePadding = mXtras['padding'] || this.m_padding;
				thePadding = (typeof (prePadding) == 'object')? prePadding : [prePadding,prePadding,prePadding,prePadding];
				offImage = mXtras['image'] || this.m_dec;
				onImage = mXtras['imageA'] || this.m_a_dec;
				if (String (this.m_dec).indexOf ('src=') > -1 || String (this.m_dec).indexOf ('url(') > -1){
					decImg = (this.frameMenu == 'noFrames')? new addToLoad (String (this.m_dec)) : new top.addToLoad (String (this.m_dec));
					theDecor = decImg.indx;
					offImage = decImg.indx;
				} else {
					offImage = -1;
					theDecor = this.m_dec;
				}
				if (String (this.m_a_dec).indexOf('src=') > -1 || String (this.m_a_dec).indexOf('url(') > -1){
					decaImg = (this.frameMenu == 'noFrames')? new addToLoad (String (this.m_a_dec)) : new top.addToLoad (String (this.m_a_dec));
					onImage = decaImg.indx;
				} else {
					onImage = -1;
				}
			} else {
				idLayer = this.pre_l + suf;
				idLayout = this.c_a[this.lev][5];
				theClass = '';
				theText = mText;
				if (offImage.indexOf ('url(') > -1){
					arrImg = (this.frameMenu == 'noFrames')? new addToLoad (offImage) : new top.addToLoad (offImage);
					offImage = arrImg.indx;
				}
				theDecor = offImage;
				if (onImage.indexOf ('url(') > -1){
					activeArr = (this.frameMenu == 'noFrames')? new addToLoad (onImage) : new top.addToLoad (onImage);
					onImage = activeArr.indx
				}
				is_active = true;
			}
			addedStyle += ';font-family: ' + theFontFamily + ';font-size: '+ theFontSize + ';';
			if (theColor.indexOf ('url') > -1){
				offImg = (this.frameMenu == 'noFrames')? new addToLoad (theColor) : new top.addToLoad (theColor);
				theColor = offImg.indx
			}
			if (theaColor.indexOf ('url') > -1){
				activeImg = (this.frameMenu == 'noFrames')? new addToLoad (theaColor) : new top.addToLoad (theaColor);
				theaColor = activeImg.indx
			}
			this.ImagesList['img_'+this.pre_sm+suf+'_off'] = offImage;
			this.ImagesList['img_'+this.pre_sm+suf+'_on'] = onImage;
			this.sm[this.c_a[this.lev][4]][this.c_a[this.lev][0]] = new Array (suf,idLayer,idLayout,theClass,theText,
											   theDecor,is_active,this.c_a[this.lev][1],
											   this.c_a[this.lev][2],
											   [theColor,theaColor,txtcolor,txtAcolor,
											   theWidth,theHeight,overAction,outAction,offImage,onImage],mXtras['url'],mText,null,
											   clickAction,prevWidth,prevDiff,addedStyle,theAlign,isLast,thePadding);
			if (isLast){
				if (this.m_vertical || this.lev > 0){
					this.mn[this.c_a[this.lev][4]][3] = this.c_a[this.lev][2] + theHeight;
					this.mn[this.c_a[this.lev][4]][2] = theWidth;
				} else {
					this.mn[this.c_a[this.lev][4]][3] = theHeight;
					this.mn[this.c_a[this.lev][4]][2] = this.c_a[this.lev][1] + theWidth;		    
				}
				this.c_a[this.lev][3] = true;
			} else {
				this.c_a[this.lev][3] = false;
			}
			this.lev++;
			if (this.lev == 1 && !this.m_vertical){
				if (this.frameMenu == 'noFrames'){
					this.c_l[this.lev] = new Array(this.c_l[this.lev-1][0]+this.c_a[this.lev-1][1] + this.horizontal_adjust,this.c_l[this.lev-1][1] + theHeight + this.vertical_adjust);
					this.c_a[this.lev] = new Array(0,0,0,false,this.num_sm,'',0);
				} else {
					this.c_l[this.lev] = new Array(this.c_l[this.lev-1][0]+this.c_a[this.lev-1][1] + this.horizontal_adjust,this.c_l[this.lev-1][1] + this.vertical_adjust);
					this.c_a[this.lev] = new Array(0,0,0,false,this.num_sm,'',0);
				}
			} else if (this.lev == 1 && this.m_vertical){
				if (this.frameMenu == 'noFrames'){
					toSum = (this.sm_direction == 'left')? 0 : theWidth;
					this.c_l[this.lev] = new Array(this.c_l[this.lev-1][0]+toSum + this.horizontal_adjust,this.c_l[this.lev-1][1]+this.c_a[this.lev-1][2]+this.vertical_adjust);
					this.c_a[this.lev] = new Array(0,0,0,false,this.num_sm,null,0);
				} else {
					this.c_l[this.lev] = new Array(this.c_l[this.lev-1][0] + this.horizontal_adjust,this.c_l[this.lev-1][1]+this.c_a[this.lev-1][2]+this.vertical_adjust);
					this.c_a[this.lev] = new Array(0,0,0,false,this.num_sm,'',0);
				}
			} else {
				if (this.sm_direction == 'left'){
					this.c_l[this.lev] = new Array(this.c_l[this.lev-1][0]-this.h_offset,this.c_l[this.lev-1][1]+this.c_a[this.lev-1][2] + this.v_offset);
					this.c_a[this.lev] = new Array(0,0,0,false,this.num_sm,'',0);
				} else {
					this.c_l[this.lev] = new Array(this.c_l[this.lev-1][0]+theWidth+this.h_offset,this.c_l[this.lev-1][1]+this.c_a[this.lev-1][2] + this.v_offset);
					this.c_a[this.lev] = new Array(0,0,0,false,this.num_sm,'',0);
				}
			}
			if (this.sm_direction == 'left' &&  theDir == 'right'){
				this.c_l[this.lev][0] = this.c_l[this.lev-1][0] + theWidth;
				this.nextChangeDir = true
			} else if (this.sm_direction == 'right' &&  theDir == 'left'){
				this.c_l[this.lev][0] = this.c_l[this.lev-1][0];
				this.nextChangeDir = true
			}
			if ((this.lev - 1) == 0){
				if (this.m_vertical){
					this.c_a[this.lev-1][2] += theHeight;
					this.c_a[this.lev-1][1] = 0
				} else {
					this.c_a[this.lev-1][1] += theWidth;
					this.c_a[this.lev-1][2] = 0;
				}
			} else {
				this.c_a[this.lev-1][2] += theHeight;
				this.c_a[this.lev-1][1] = 0
			}
		} else {
			var s;
			offImage = -1;
			onImage = -1;
			if (this.lev == 0){
				theClass = '';
				is_active = true;
				theWidth = mXtras['theWidth'] || mXtras['width'] || this.m_width;
				theHeight = mXtras['theHeight'] || mXtras['height'] ||this.m_height;
				txtcolor = mXtras['Mntxtcolor'] || mXtras['txtcolor'] || this.m_txt_color;
				txtAcolor = mXtras['Mntxtacolor'] || mXtras['txtacolor'] || this.m_txt_a_color;
				theColor = mXtras['Mnbackground'] || mXtras['background'] || this.m_color || this.m_background;
				theaColor = mXtras['MnAbackground'] || mXtras['backgroundA'] || this.m_a_color || this.m_a_background;
				theFontFamily = mXtras['font-family'] || this.m_txt_font_family;
				theFontSize = mXtras['font-size'] || this.m_txt_font_size;
				txtcolor = mXtras['Mntxtcolor'] || mXtras['txtcolor'] || this.m_txt_color;
				txtAcolor = mXtras['Mntxtacolor'] || mXtras['txtacolor'] || this.m_txt_a_color;
				theAlign = mXtras['align'] || this.m_align || default_align;
				prePadding = mXtras['padding'] || this.m_padding;
				thePadding = (typeof (prePadding) == 'object')? prePadding : [prePadding,prePadding,prePadding,prePadding];
				theDecor = mXtras['image'] || this.default_image;
				offImage = mXtras['image'] || this.m_dec;
				onImage = mXtras['imageA'] || this.m_a_dec;
			} else {
				theClass = '';
				is_active = true;
				theDecor = mXtras['image'] || this.default_image;
			}
			if (mText == '-') {
				idLayout = this.c_a[this.lev][5];
				if (this.sm_sep.indexOf ('url(') > -1){
					sepImg = (this.frameMenu == 'noFrames')? new addToLoad (this.sm_sep) : new top.addToLoad (this.sm_sep);
					this.sm_sep = '<img src="'+parent.to_load[sepImg.indx]+'" border="0">';
				}
				theText = this.sm_sep;
				is_active = false;
				theDecor = mXtras['image'] || this.default_image;
			} else {
				idLayer = '';
				idLayout = this.c_a[this.lev][5];
				if (mXtras['url'] == 'v'){
					theDecor = this.sm_current;
					onImage = -1;
				} else if (mXtras['url'] == 'x'){
					theClass = '';
					txtcolor  = this.txt_i_color;
					txtAcolor  = this.txt_i_color;
					is_active = false;
					theFontFamily = mXtras['font-family'] || this.txt_i_font_family;
					theFontSize = mXtras['font-size'] || this.txt_i_font_size;
				} else if (mXtras['url'] == 'a'){
					clickAction = mXtras['onclick'];
				} else if (mXtras['url'].indexOf ('#') == 0 && mXtras['url'].length > 1 && this.internal_browse_active){
					clickAction = 'document.location.href = \'' + mXtras['url'] + '\';';
					hereImg = (this.frameMenu == 'noFrames')? new addToLoad (this.thenames_here) : new top.addToLoad (this.thenames_here);
					this.hereImgIndx = hereImg.indx;
					downImg = (this.frameMenu == 'noFrames')? new addToLoad (this.thenames_down) : new top.addToLoad (this.thenames_down);
					this.downImgIndx = downImg.indx;
					upImg = (this.frameMenu == 'noFrames')? new addToLoad (this.thenames_up) : new top.addToLoad (this.thenames_up);
					this.upImgIndx = upImg.indx;
					theDecor = this.thenames_waiting;
					theLength = this.thenames.length;
					this.thenames[theLength] = new Array ();
					this.thenames[theLength][0] = mXtras['url'].substr (1);
					this.thenames[theLength][1] = 'img_' + this.pre_sm + suf;
					this.thenames[theLength][2] = this.hereImgIndx;
					this.thenames[theLength][3] = this.downImgIndx;
					this.thenames[theLength][4] = this.upImgIndx;
				} else {
					theTarget = (mXtras['target'])? mXtras['target'] : '' ;
					preAct = (this.frameMenu == 'noFrames')? '': 'parent.';					
					if (theTarget.indexOf ('parent') > -1 && theTarget.length <= 7){
						clickAction = 'parent.location.href = \'' + mXtras['url'] + '\';'
					} else if (theTarget.indexOf ('top') > -1 && theTarget.length <= 4){
						clickAction = 'top.location.href = \'' + mXtras['url'] + '\';'
					} else if (theTarget == '') {
						clickAction = 'window.location.href = \'' + mXtras['url'] + '\';'
					} else if (theTarget.indexOf ('blank') > -1 && theTarget.length <= 6){
						postNW = String(Math.random ());
						postNWin = (postNW.length > 1)? postNW.substr (2) : postNW;
						clickAction = preAct + 'mapb_openBrWindow (\'' + mXtras['url'] + '\',\'mapbNewWin' + postNWin + '\',\'' + winOpts +'\');'
					} else if (parent.frames[theTarget]){
						clickAction = 'parent.frames[\''+ theTarget +'\'].document.location.href = \'' + mXtras['url'] + '\';'
					} else {
						clickAction = preAct + 'mapb_openBrWindow (\'' + mXtras['url'] + '\',\''+ theTarget +'\',\''+ winOpts +'\');'
					}
				}
				theText = mText;
			}
			addedStyle += ';font-family: ' + theFontFamily + ';font-size: '+ theFontSize + ';';
			if (theColor.indexOf ('url') > -1){
				smoffImg = (this.frameMenu == 'noFrames')? new addToLoad (theColor) : new top.addToLoad (theColor);
				theColor = smoffImg.indx
			}
			if (theaColor.indexOf ('url') > -1){
				smactiveImg = (this.frameMenu == 'noFrames')? new addToLoad (theaColor) : new top.addToLoad (theaColor);
				theaColor = smactiveImg.indx
			}
			if (theDecor.indexOf ('url') > -1){
				decorImg = (this.frameMenu == 'noFrames')? new addToLoad (theDecor) : new top.addToLoad (theDecor);
				theDecor = decorImg.indx;
				offImage = decorImg.indx;
			}
			if (onImage != -1){
				if (onImage.indexOf ('url') > -1){
					onImg = (this.frameMenu == 'noFrames')? new addToLoad (onImage) : new top.addToLoad (onImage);
					onImage = onImg.indx;
				}
			}
			if (mXtras['imageA']){
				if (mXtras['imageA'].indexOf ('url(') > -1){
					activeArr = (this.frameMenu == 'noFrames')? new addToLoad (mXtras['imageA']) : new top.addToLoad (mXtras['imageA']);
					onImage = activeArr.indx;
				}
			}
			this.ImagesList['img_'+this.pre_sm+suf+'_off'] = offImage;
			this.ImagesList['img_'+this.pre_sm+suf+'_on'] = onImage;
			this.sm[this.c_a[this.lev][4]][this.c_a[this.lev][0]] = new Array (suf,idLayer,idLayout,theClass,
											   theText,theDecor,is_active,
											   this.c_a[this.lev][1],this.c_a[this.lev][2],
											   [theColor,theaColor,txtcolor,txtAcolor,
											   theWidth,theHeight,overAction,outAction,offImage,onImage],mXtras['url'],mText,null,
											   clickAction,prevWidth,prevDiff,addedStyle,theAlign,isLast,thePadding);
			this.c_a[this.lev][2] += theHeight;
			if (this.lev == 0){
				if (!this.m_vertical){
					this.c_a[this.lev][2] = 0;
					this.c_a[this.lev][1] = this.c_a[this.lev][1] + theWidth;
				}
			}
			this.c_a[this.lev][0]++;
			if (isLast){
				this.c_a[this.lev][0] = 0;
				this.c_a[this.lev][3] = true;
				if (!this.m_vertical && this.lev == 0){
					this.mn[this.c_a[this.lev][4]][2] = this.c_a[this.lev][1];
					this.mn[this.c_a[this.lev][4]][3] = 0;
				} else {
					this.mn[this.c_a[this.lev][4]][2] = theWidth;
					this.mn[this.c_a[this.lev][4]][3] = this.c_a[this.lev][2];
				}
				if (this.lev > 0){
					this.lev--;
				}
				if (this.lev >= 0){
				this.c_a[this.lev][0]++;
				}
				while (this.c_a[this.lev][3] == true){
					this.c_a[this.lev][0] = 0;
					this.lev--;
					if (this.lev >= 0){
						this.c_a[this.lev][0]++;
						}
					if (this.lev <= 0){
						break;
					}
				}
			} else {
				this.c_a[this.lev][3] = false;
			}
		}
}

function doMenu (theWindow){
    var theL = '';
	var theLocation = '';
	var thehost = '';
	if (this.frameMenu == 'noFrames'){
		theLocation = location.href;
		thehost = location.host;
	} else if (theWindow == this.frameSubMenu) {
		thesubframe = top.frames[this.frameSubMenu];
		theLocation = thesubframe.location.href;
		thehost = thesubframe.location.host;
	}
	url_texto = theLocation.substring (theLocation.lastIndexOf ('//') + 2);
	if (url_texto.lastIndexOf ('.') < thehost.length){
		if (url_texto.lastIndexOf ('/') == (url_texto.length - 1)){
			theLocation = theLocation + this.default_main_page;
		} else {
			theLocation = theLocation + '/' + this.default_main_page;
		}
	}
    for (var i=0;i < this.sm.length;i++){
		var m = '',s = '',h = '';
		if (i == 0){
			s =  (this.l_m_border_top > '')? 'border-top: '+this.l_m_border_top : '';
			s += (this.l_m_border_right > '')? ';border-right: '+this.l_m_border_right : '';
			s += (this.l_m_border_bottom > '')? ';border-bottom: '+this.l_m_border_bottom : '';
			s += (this.l_m_border_left > '')? ';border-left: '+this.l_m_border_left : '';
			if (!this.m_vertical){
				m = '<table border="0" cellpadding="0" cellspacing="0">\n';
			} else {
				m = '<table border="0" cellpadding="0" cellspacing="0">';
			}
			theB = this.l_m_color || this.l_m_background;
			theL += this.genL (this.positioning,this.pre_l + this.sm[i][0][0],this.mn[i][0],this.mn[i][1],this.mn[i][2],false,showName,theB,m,h,s);
		} else {
			theB = this.l_sm_color || this.l_sm_background;
			s =  (this.l_sm_border_top > '')? 'border-top: '+this.l_sm_border_top : '';
			s += (this.l_sm_border_right > '')? ';border-right: '+this.l_sm_border_right : '';
			s += (this.l_sm_border_bottom > '')? ';border-bottom: '+this.l_sm_border_bottom : '';
			s += (this.l_sm_border_left > '')? ';border-left: '+this.l_sm_border_left : '';
			m = '<table border="0" cellpadding="0" cellspacing="0">';
			theL += this.genL ('absolute',this.pre_l + this.sm[i][0][0],this.mn[i][0],this.mn[i][1],this.mn[i][2],false,hideName,theB,m,h,s);
		}
		for (j=0;j < this.sm[i].length;j++){
			f = (i == 0)? this.frameMenu : this.frameSubMenu;
			txtWeight = (i == 0)? this.m_txt_weight : this.txt_weight;
			txtDec = (i == 0)? this.m_txt_decoration : this.txt_decoration;
			t = (this.frameMenu != 'noFrames')? 'parent.' : '';
			visibleText = this.sm[i][j][4];
			xTras ='';
			for (lm=0;lm < this.sm[i][j][9].length;lm++){
				xTras += (typeof(this.sm[i][j][9][lm]) == 'string')? ',\'' + this.sm[i][j][9][lm] + '\'' : ',' + this.sm[i][j][9][lm];
			}
			acType = (NN)? 'onFocus':  'onclick';
			actOnClick = (this.sm[i][j][13] > '')? ' ' + acType + '="' + this.sm[i][j][13] : '';
			hasLink = (actOnClick.length > 1)? 1 : 0;
			cursorST = (actOnClick.length > 1)? this.link_cursor : this.default_cursor;
			tdStyle = ' style="color: '+ this.sm[i][j][9][2] +';font-weight:'+ txtWeight +';text-decoration:'+ txtDec;
			overaction = t + this.idMenu + '.onOver_sm(\''+ i + '\',' + hasLink + ',\'' + this.pre_sm + this.sm[i][j][0] +'\',\'';
			overaction += this.sm[i][j][1] + '\',\'' + this.pre_l + this.sm[i][j][2] + '\',' + this.sm[i][j][6] + ',\''+ f + '\'';
			overaction += xTras + ')';
			outaction = t + this.idMenu+'.onOut_sm(\''+i+'\','+hasLink+',\'' + this.pre_sm + this.sm[i][j][0] + '\',\'' + this.pre_l + this.sm[i][j][2] + '\',' + this.sm[i][j][6] + ',\''+ f + '\'';
			outaction += xTras + ')';
			sepacts = (this.sm[i][j][13].substr(-1,1) != ';')? ';' : '';
			actOnClick += (this.sm[i][j][13] > '')? sepacts + outaction + ';' + t + 'hideMenus ()" ' : '';
			decor_img = this.sm[i][j][5];
			id_image = 'img_'+ this.pre_sm +this.sm[i][j][0];
			c_url = this.sm[i][j][10]; // current url
			if (theLocation.indexOf(c_url) > -1 && c_url.indexOf('#') == -1 && c_url.length > 1 && i > 0 && this.activeYouarehere){
				test_here = this.mark_youAreHere (theWindow,this.youAreHereWin,this.sm[i][j][2],id_image,decor_img,i,true);
				decor_img = test_here;
				this.Iamhere = this.sm[i][j][2];
				this.imghere = test_here;
				this.cellhere = this.pre_sm + this.sm[i][j][0];
				this.idYouarehere = this.sm[i][j][2];
			} else if (this.lastYouAreHere.length > 0) {
				if (this.lastYouAreHere[0] == this.sm[i][j][2]){
					this.mark_youAreHere (theWindow,this.youAreHereWin,this.sm[i][j][2],id_image,decor_img,i,false);
					this.cellhere = '';
					this.idYouarehere = '';
				}
			}
			imgsrc = (this.frameMenu == 'noFrames')? to_load[decor_img] : top.to_load[decor_img];
			decoration = '<img src="'+imgsrc+'" border="0" id="'+ id_image +'" name="'+ id_image +'">';
			h = ' onMouseOver="' + overaction + '"';
			h += actOnClick;		
			h += ' onMouseOut="' + outaction + '"';
			m = '<table border="0" cellspacing="0">\n'; // cellpadding="'+ this.sm[i][j][19] +'">\n';
			m += '<tr>';
			theAlign = this.sm[i][j][17];
			if (NN){
				longTD = '<td ' + tdStyle + '" width="' + this.sm[i][j][9][4] + '" height="' + this.sm[i][j][9][5] + '"' + ' align="' + theAlign + '"'
				longTD += ' id="' + this.pre_td + this.pre_sm + this.sm[i][j][0] + '"';
				longTD += ' name="' + this.pre_td + this.pre_sm + this.sm[i][j][0] + '"><font color="'+ this.sm[i][j][9][2] +'">' + visibleText + '</font></td>\n';
				shortTD = (decoration > '')?'<td align="right" ' + tdStyle + '"><font color="'+ this.sm[i][j][9][2] +'">' + decoration + '</font></td>\n':'';
			} else {
				t = this.sm[i][j][19][0]; // padding top
				r = this.sm[i][j][19][1]; // padding right
				b = this.sm[i][j][19][2]; // padding bottom
				l = this.sm[i][j][19][3]; // padding left
				thePad = ';padding: '+t+'px '+r+'px '+b+'px '+l+'px;"';
				longTD = '<td width="' + this.sm[i][j][9][4] + '" height="' + this.sm[i][j][9][5] + '"' + ' align="' + theAlign + '"'
				longTD += ' style="cursor: '+ cursorST + this.sm[i][j][16] + thePad; // top right bottom left
				longTD += '><span';
				longTD += ' id="' + this.pre_td + this.pre_sm + this.sm[i][j][0] + '"';
				longTD += tdStyle + '"';
				longTD += '>' + visibleText + '</span></td>\n';
				shortTD = (decoration > '')? '<td ' + tdStyle + this.sm[i][j][16] + thePad +'">' + decoration + '</td>\n':'';
			}
			m += (this.sm_direction == 'left')? shortTD + longTD : longTD + shortTD;
			m += '</tr></table>\n';	    
			layerName = this.pre_sm + this.sm[i][j][0];
			beginrow = (j > 0 && !this.m_vertical && i == 0)? '':'<tr>';
			endrow = (!this.sm[i][j][18] && !this.m_vertical && i == 0)? '':'</tr>';
			theL += beginrow+'<td' + ' width="' + this.sm[i][j][9][4] + '" height="' + this.sm[i][j][9][5] + '"'+'>';
			theL += this.genL (null,layerName,null,null,this.sm[i][j][9][4],this.sm[i][j][9][5],'inherit',this.sm[i][j][9][0],m,h,'');
			theL += endL();
			theL += '</td>'+endrow;
		}
		theL += '</table>\n';
		theL += endL() + '\n';
		if (this.frameMenu == 'noFrames'){
			document.writeln(theL);

		} else {
			if (i == 0 && theWindow == this.frameMenu){
				top.frames[this.frameMenu].document.writeln(theL);
			} else if (i > 0 && theWindow == this.frameSubMenu){
				top.frames[this.frameSubMenu].document.writeln(theL);
			}
		}
		theL = ''; 
    }
}

function hideMenus () {
	for (var i = 0;i < open_sm.length;i++){
	    if (open_sm[i][1] != 'noFrames'){
			if (document.all){
				refL(open_sm[i][0],'',open_sm[i][1]).style.pixelTop = open_sm[i][2];
				refL(open_sm[i][0],'',open_sm[i][1]).style.pixelLeft = open_sm[i][3]
			} else if (NN){
				refL(open_sm[i][0],'',open_sm[i][1]).top = open_sm[i][2];
				refL(open_sm[i][0],'',open_sm[i][1]).left = open_sm[i][3]
			} else if (document.getElementById) {
				refL(open_sm[i][0],'',open_sm[i][1]).style.top = open_sm[i][2] + 'px';
				refL(open_sm[i][0],'',open_sm[i][1]).style.left = open_sm[i][3] + 'px';
			}
	    } else {
			if (open_sm[i][2] != null){
				if (document.all){
					refL(open_sm[i][0],'',open_sm[i][1]).style.pixelTop = open_sm[i][2];
					refL(open_sm[i][0],'',open_sm[i][1]).style.pixelLeft = open_sm[i][3]
				} else if (NN){
					refL(open_sm[i][0],'',open_sm[i][1]).top = open_sm[i][2];
					refL(open_sm[i][0],'',open_sm[i][1]).left = open_sm[i][3];
				} else {
					refL(open_sm[i][0],'',open_sm[i][1]).style.top = open_sm[i][2] + 'px';
					refL(open_sm[i][0],'',open_sm[i][1]).style.left = open_sm[i][3] + 'px';
				}
			}
		}
	    hideL(open_sm[i][0],'',open_sm[i][1]);
	}
	clearInterval (autoHide_var);
	first_over = true;
	positioned_array = new Array ();
	open_sm = new Array ();
	autoHide_on = false;
}

function onOver_sm (Level,isaURL,what_sm,what_l,parentL,sm_active,theFrame,smColor,smaColor,txtcolor,txtAcolor,thewidth,theheight,overaction,outaction,offimage,onimage) {
    if (first_over){
		clearInterval (autoHide_var);
		autoHide_pass = 1;
		first_over = false;
		if (sm_active){
			if (NN){
				if (typeof (smaColor) == 'number'){
					refL(what_sm,parentL,theFrame).background.src = to_load[smaColor];
				} else {
					refL(what_sm,parentL,theFrame).bgColor = (smaColor > '')? smaColor : this.sm_a_color;
				}
			} else {
				if (typeof (smaColor) == 'number'){
					refL(what_sm,'',theFrame).style.background = imgs_url[smaColor];
				} else {
					refL(what_sm,'',theFrame).style.background = (smaColor > '')? smaColor : this.sm_a_color;
				}
				refL(this.pre_td + what_sm,'',theFrame).style.color =  (txtAcolor > '')? txtAcolor : this.txt_a_color;
				if (isaURL > 0){
					refL(this.pre_td + what_sm,'',theFrame).style.fontWeight = (Level == 0)? this.m_txt_a_link_weight : this.txt_a_link_weight;
					refL(this.pre_td + what_sm,'',theFrame).style.textDecoration = (Level == 0)? this.m_txt_a_link_decoration :  this.txt_a_link_decoration;
				}
				if (onimage != -1){
					thename = 'img_' + what_sm;
					img_name = thename+'_on';
					theimageindx = this.ImagesList[img_name];
					if (this.cellhere == what_sm){
						theimageindx = this.imghere;
					}
					if (theFrame == 'noFrames'){
						document.images[thename].src = to_load[theimageindx];
					} else {
						parent.frames[theFrame].document.images[thename].src = parent.to_load[theimageindx];
					}
				}
			}
			if (overaction > ''){
				foo = window.setTimeout (unescape(overaction),10);
			}
		}
		if (Level == 0 || isaURL == 0){
			this.open_l (what_sm,what_l);
		}
	}
}

function onOut_sm (Level,isaURL,what_sm,what_l,sm_active,theFrame,smColor,smaColor,txtcolor,txtAcolor,thewidth,theheight,overaction,outaction,offimage,onimage){
	autoHide_var = setInterval ("autoHide ()",10);
    first_over = true;
	if (sm_active){
		if (NN){
			if (typeof (smColor) == 'number'){
				refL(what_sm,what_l,theFrame).background.src = to_load[smColor];
			} else {
				refL(what_sm,what_l,theFrame).background.src = null;
				refL(what_sm,what_l,theFrame).bgColor = (smColor > '')? smColor : this.sm_color;
			}
		} else {
			if (typeof (smColor) == 'number'){
				refL(what_sm,'',theFrame).style.background = imgs_url[smColor];
			} else {
				refL(what_sm,'',theFrame).style.background = (smColor > '')? smColor : this.sm_color;
			}
			refL(this.pre_td + what_sm,'',theFrame).style.color = (txtcolor > '')? txtcolor : this.txt_color;
			if (isaURL > 0){
				refL(this.pre_td + what_sm,'',theFrame).style.fontWeight = (Level == 0)? this.m_txt_weight : this.txt_weight;
				refL(this.pre_td + what_sm,'',theFrame).style.textDecoration = (Level == 0)? this.m_txt_decoration : this.txt_decoration;
			}
			if (offimage != -1){
				thename = 'img_' + what_sm;
				img_name = thename+'_off';
				theimageindx = this.ImagesList[img_name];
				if (this.cellhere == what_sm){
					theimageindx = this.imghere;
				}
				if (theFrame == 'noFrames'){
					document.images[thename].src = to_load[theimageindx];
				} else {
					parent.frames[theFrame].document.images[thename].src = parent.to_load[theimageindx];
				}
			}
		}
		if (outaction > ''){
			foo = window.setTimeout (unescape(outaction),10);
		}
    }
}

function open_l (what_sm,what_l){
    if (what_l != ''){
		if (this.thenames.length > 0){
			this.show_internal_browse (this);
		}
		theLayer = new refLcomplet (what_l+'_0','',this.frameSubMenu);
		var initialY = theLayer.theTop;
		var initialX = theLayer.theLeft;
		if (this.frameMenu != 'noFrames'){
			if (document.all){
				var tempY = eval(this.frameSubMenu + '.document.body.scrollTop');
				var tempX = eval(this.frameSubMenu + '.document.body.scrollLeft');
				thePos = searchL (what_l+'_0',open_sm,true);
				if (thePos > -1){
					initialY = open_sm[thePos][2];
					initialX = open_sm[thePos][3]
				} else {
					initialY = refL(what_l+'_0','',this.frameSubMenu).style.pixelTop;
					initialX = refL(what_l+'_0','',this.frameSubMenu).style.pixelLeft;
				}
				refL(what_l+'_0','',this.frameSubMenu).style.pixelTop = initialY + tempY;
				refL(what_l+'_0','',this.frameSubMenu).style.pixelLeft = initialX + tempX
			} else if (NN || document.getElementById){
				var tempY = eval(this.frameSubMenu + '.pageYOffset');
				var tempX = eval(this.frameSubMenu + '.pageXOffset');
				thePos = searchL (what_l+'_0',open_sm,true);
				if (thePos > -1){
					initialY = open_sm[thePos][2];
					initialX = open_sm[thePos][3]
				} else {
					initialY = (NN)? refL(what_l+'_0','',this.frameSubMenu).top : parseInt(refL(what_l+'_0','',this.frameSubMenu).style.top);
					initialX = (NN)? refL(what_l+'_0','',this.frameSubMenu).left : parseInt(refL(what_l+'_0','',this.frameSubMenu).style.left);
				}
				if (NN){
					refL(what_l+'_0','',this.frameSubMenu).top = initialY + tempY;
					refL(what_l+'_0','',this.frameSubMenu).left = initialX + tempX;
				} else {
					refL(what_l+'_0','',this.frameSubMenu).style.top = (initialY + tempY) + 'px';
					refL(what_l+'_0','',this.frameSubMenu).style.left = (initialX + tempX) + 'px';
				}
			}
		} else {
			if (this.positioning == 'relative'){
				if (positioned_array.length > 0 && open_sm.length > 0 && searchL (this.idMenu,open_sm,false) == -1){
					positioned_array = new Array ();
				}
				thePos = searchL (what_l+'_0',positioned_array,true);
				if (thePos > -1){
					initialY = positioned_array[thePos][1];
					initialX = positioned_array[thePos][2];
				} else {
					oldpos = this.findPosY (what_l+'_0','',this.frameSubMenu);
					newpos = this.findPosY (this.pre_l + '_0','',this.frameSubMenu);

					initialY = oldpos[1];
					initialX = oldpos[0];
					positioned_array[positioned_array.length] = new Array (what_l+'_0',initialY,initialX);
				}
				if (NN){
					refL(what_l+'_0','',this.frameSubMenu).top = (initialY + newpos[1]);
					refL(what_l+'_0','',this.frameSubMenu).left = (initialX + newpos[0]);
				} else {
					refL(what_l+'_0','',this.frameSubMenu).style.top = (initialY + newpos[1]) + 'px';
					refL(what_l+'_0','',this.frameSubMenu).style.left = (initialX + newpos[0]) + 'px';
				}
			}
		}
		theLength = open_sm.length;
		position = searchL (what_l+'_0',open_sm,true);
		if (position == -1){
			open_sm[theLength] = new Array (what_l+'_0',this.frameSubMenu,initialY,initialX);
		} else {
			open_sm[position][2] = initialY;
			open_sm[position][3] = initialX;
		}
		if (theLength > 1){
			patata = new calculWinDim (this.frameSubMenu);
		}
		showL (what_l+'_0','',this.frameSubMenu);
    }
    var tempA = new Array ();
    for (this.i = 0;this.i < open_sm.length;this.i++){
    	theID = open_sm[this.i][0]
	    if (theID.indexOf(this.idMenu) == -1 || (theID.length > what_sm.length && theID.indexOf(this.pre_l + what_sm.substr(this.pre_sm.length)) == -1)){
			hideL (open_sm[this.i][0],'',this.frameSubMenu);
			if (this.frameMenu != 'noFrames'){
				if (document.all){
					refL(open_sm[this.i][0],'',this.frameSubMenu).style.pixelTop = open_sm[this.i][2];
					refL(open_sm[this.i][0],'',this.frameSubMenu).style.pixelLeft = open_sm[this.i][3]
				} else if (NN){
					refL(open_sm[this.i][0],'',this.frameSubMenu).top = open_sm[this.i][2];
					refL(open_sm[this.i][0],'',this.frameSubMenu).left = open_sm[this.i][3]
				} else if ( document.getElementById){
					refL(open_sm[this.i][0],'',this.frameSubMenu).style.top = open_sm[this.i][2] + 'px';
					refL(open_sm[this.i][0],'',this.frameSubMenu).style.left = open_sm[this.i][3] + 'px'
				}
			} else {
				if (open_sm[this.i][2] != null){
					if (NN){
						refL(open_sm[this.i][0],'',this.frameSubMenu).top = open_sm[this.i][2];
						refL(open_sm[this.i][0],'',this.frameSubMenu).left = open_sm[this.i][3];
					} else {
						refL(open_sm[this.i][0],'',this.frameSubMenu).style.top = open_sm[this.i][2] + 'px';
						refL(open_sm[this.i][0],'',this.frameSubMenu).style.left = open_sm[this.i][3] + 'px';
					}
				}
			}
	    } else {
			tempA[tempA.length] = open_sm[this.i];
	    }
    }
    open_sm = tempA;
}

function autoHide () {
	if (autoHide_activate){
		autoHide_time = ((autoHide_seconds * 100) > 1)? autoHide_seconds * 100 : 1;
		if (autoHide_pass > autoHide_time) {
			hideMenus ();
		} else {
			autoHide_pass++;
		}
	}
}

function youAreHere (myname,my_left,my_top,my_width,my_height,theText,my_color,positioning,thewin){
		theimageTemp = (this.idYouarehere == '')? this.iconYouarenothere : this.iconYouarehere; 
		theimageTemp = (this.frameMenu == 'noFrames')? new addToLoad (theimageTemp) : new top.addToLoad (theimageTemp);
		theimageTemp = theimageTemp.indx;
		theimage = (this.frameMenu == 'noFrames')? to_load[theimageTemp] : top.to_load[theimageTemp];
		theimage = '<img src="'+ theimage +'" border="0" id="' + this.idMenu + '_you_are_here_img" name="'+ this.idMenu + '_you_are_here_img">';
		scriptpage = (this.frameSubMenu == 'noFrames')? '' :'parent.';
		my_aText = '<table border="0" cellspacing="0" width="' + my_width + '"><tr><td align="right">';
		my_aText += theimage;
		my_aText += '</td><td align="left" style="font-size: 9px;font-family: sans-serif; cursor: default">'+ theText +'</td></tr></table>';
		aHand = ' onMouseOver="'+ scriptpage + this.idMenu + '.openHere ()" onMouseOut="'+ scriptpage + this.idMenu + '.hideMenus ()"';
		aText = genL(positioning,myname,my_left,my_top,my_width,my_height,showName,my_color,my_aText,aHand);
		aText +=  endL();
		this.youAreHereWin = (thewin)? thewin : self;
		this.youAreHereWin.document.writeln (aText);
		this.youAreHereLoaded = true;
}

function openHere (){
    if (this.idYouarehere.length > 2 && first_over){
		first_over = false;
		if (open_sm.length == 0){
			hideMenus ();
		}
		aLength = this.idYouarehere.length - 2;
		sinceOpen = this.pre_sm + this.idYouarehere;
		for (u = 2; u <= aLength; u += 2){
			whatOpen = this.pre_l + this.idYouarehere.substr (0,u);
			this.open_l (sinceOpen,whatOpen);
		}
    }
}

function mark_youAreHere (currentWindow,theYouAreHereWin,theitem,theimage,indx_image,isMenu,itsHere){
	what_image = (itsHere)? this.iconYouarehere : this.iconYouarenothere;
	image_here = (this.frameMenu == 'noFrames')? new addToLoad (what_image) : new top.addToLoad (what_image);
	theindx = image_here.indx;
	if (this.frameMenu == 'noFrames'){
		// si no es frames no ens compliquem la vida...
		return theindx;
	} else {
		currentFrame = (isMenu)? this.frameMenu : this.frameSubMenu;
		if (this.lastYouAreHere.length > 0){

			if (this.lastYouAreHere[3] == 0 && isMenu != 0){
				img_id = this.lastYouAreHere[0];
				img_indx = this.lastYouAreHere[1];
				img_frame = this.lastYouAreHere[2];
				parent.frames[img_frame].document.images[img_id].src = parent.to_load[img_indx];
			}
			if (itsHere){
				this.lastYouAreHere[0] = theimage;
				this.lastYouAreHere[1] = indx_image;
				this.lastYouAreHere[2] = currentFrame;
				this.lastYouAreHere[3] = isMenu;
			} else {
				theindx = image_here.indx;
				this.lastYouAreHere = new Array ();
			}
		} else {
			this.lastYouAreHere[0] = theimage;
			this.lastYouAreHere[1] = indx_image;
			this.lastYouAreHere[2] = currentFrame;
			this.lastYouAreHere[3] = isMenu;
		}

		if (this.youAreHereLoaded){
			img_id_here = this.idMenu + '_you_are_here_img';
			img_win_here = this.youAreHereWin;
			img_win_here.document.images[img_id_here].src = parent.to_load[theindx];
		}

		return theindx;
	}
}

function addToLoad (searchedString) {
	extractURL = '';
	if (searchedString.indexOf ('url(') > -1){
		startStr = searchedString.indexOf ('(') + 1;
		endStr = searchedString.length - startStr - 1;
		extractURL = searchedString.substr(startStr,endStr);
	} else if (searchedString.indexOf ('src') > -1){
		firstposoff = searchedString.indexOf ('src="') + 5;
		endposoff = searchedString.indexOf ('"',firstposoff);
		extractURL = searchedString.substring (firstposoff,endposoff);
		searchedString = 'url('+images_base+extractURL+')';
	}
    i = 0;
    isMatch = false;
    if (to_load.length > 0){
		for (i = 0;i < to_load.length;i++){
			if (to_load[i] == extractURL){
				isMatch = true;
				break
			}
		}
		if (!isMatch){
			oldLength = to_load.length;
			to_load[self.to_load.length] = images_base+extractURL;
			imgs_url[self.imgs_url.length] = 'url('+images_base+extractURL+')';
			addNewImg (images_base+extractURL);
		}
		this.indx = i;
    } else {
		to_load[0] = images_base+extractURL;
		imgs_url[0] = 'url('+images_base+extractURL+')';
		addNewImg (images_base+extractURL);
		this.indx = 0;
    }
    return this
}

function addNewImg (asrc){
	var newimage = new Image ();
	newimage.src = asrc;
}

function mapb_openBrWindow (theURL,winName,features) {
    var finestra;
    if (features > ''){
		finestra = window.open(theURL,winName,features);
    } else {
		finestra = window.open(theURL,winName,'status=yes,toolbar=yes,resizable=yes,location=yes,scrollbars=yes');
    }
}

function findPosY(name,layer,frame){
	obj = refL(name,layer,frame);
	var curtop = 0;
	var curleft = 0;
	if (document.getElementById || document.all){
		while (obj.offsetParent){
			curtop += obj.offsetTop;
			curleft += obj.offsetLeft;
			obj = obj.offsetParent;
		}
	} else if (document.layers){
		curtop += obj.y;
		curleft += obj.x;
	}
	atornar = new Array (curleft,curtop);
	return atornar;
}

function calculWinDim (theFrame) {
	if(window.innerWidth) {
		theDoc = (theFrame == 'noFrames')? window : top.frames[theFrame];
		this.page_width = theDoc.innerWidth;
		this.page_height = theDoc.innerHeight;
	} else if(theDoc.body.clientWidth) {
		theDoc = (theFrame == 'noFrames')? document : top.frames[theFrame].document;
		this.page_width = theDoc.body.clientWidth;
		this.page_height = theDoc.body.clientHeight;
	}
	return this;
}

function show_internal_browse (theobj){
	var thescrollY;
	var whaterror;
	theFrame = theobj.frameSubMenu;
	if (theFrame != 'noFrames'){
		if (document.all){
			thescrollY = eval(theFrame + '.document.body.scrollTop');
		} else if (NN || document.getElementById){
			thescrollY = eval(theFrame + '.pageYOffset');
		}
		for (var a = 0;a < (theobj.thenames.length - 1);a++){
			img_name = String(theobj.thenames[a][1]);
			var current_img;
			if (!refL (theobj.thenames[a][0],'',theFrame)){
				alert ('Anchor ' + theobj.thenames[a][0] + ' not found!!');
				return false;
			}
			my_pos = findPosY (theobj.thenames[a][0],'',theFrame);
			my_pos = my_pos[1];
			next_pos = findPosY (theobj.thenames[(a + 1)][0],'',theFrame);
			next_pos = next_pos[1];
			if (my_pos < thescrollY){
				if (next_pos > thescrollY){
					current_img = theobj.thenames[a][2];
					parent.frames[theFrame].document.images[img_name].src = parent.to_load[current_img];
				} else {
					current_img = theobj.thenames[a][4];
					parent.frames[theFrame].document.images[img_name].src = parent.to_load[current_img];
				}
			} else if (my_pos > thescrollY) {
				current_img = theobj.thenames[a][3];
				parent.frames[theFrame].document.images[img_name].src = parent.to_load[current_img];
			} else {
				current_img = theobj.thenames[a][2];
				parent.frames[theFrame].document.images[img_name].src = parent.to_load[current_img];
			}
			img_on = img_name+'_on';
			img_off = img_name+'_off';
			theobj.ImagesList[img_on] = current_img;
			theobj.ImagesList[img_off] = current_img;
		}
		var i = theobj.thenames.length - 1;
		my_pos = findPosY (theobj.thenames[i][0],'',theFrame);
		my_pos = my_pos[1];
		img_name = theobj.thenames[i][1];
		if (my_pos > thescrollY){
			current_img = theobj.thenames[i][3];
			parent.frames[theFrame].document.images[img_name].src = parent.to_load[current_img];
		} else {
			current_img = theobj.thenames[i][2];
			parent.frames[theFrame].document.images[img_name].src = parent.to_load[current_img];
		}
		img_on = img_name+'_on';
		img_off = img_name+'_off';
		theobj.ImagesList[img_on] = current_img;
		theobj.ImagesList[img_off] = current_img;
	} else {
		for (var a = 0;a < (theobj.thenames.length - 1);a++){
			document.images[theobj.thenames[a][1]].src = to_load[theobj.thenames[a][3]];
		}
	}
}

function import_prefs (namePrefs){
	this.addPrefs = eval (namePrefs);
	this.addPrefs ();
}