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 idYouarehere = '';
var tempX;
var tempY;

function Menu (idMenu,m_left,m_top) {
        // PREFS
        this.m_left  = m_left; // Left position
        this.m_top  = m_top; // Top position
        this.m_vertical  = true; // If true menu is vertical
        this.sm_width  = 123; // Width of submenu items
        this.sm_height  = 28; // Height of submenu items
        this.sm_border = 0;
        this.h_offset  = -3; // Horizontal offset in relation to previous menu
        this.v_offset  = 3; // Vertical offset in relation to previous menu
        this.m_align = 'center';
        this.sm_align = null;
        this.l_m_color  = '#99CCCC'; // If sm_border > 0 border color of initial menu
        this.l_sm_color  = '#CCFFFF'; // If sm_border > 0 border color of submenus
        this.m_color  = '#99CCCC'; //  Color of initial menu
        this.m_a_color  = this.m_color;
        this.m_txt_color  = '#000000';
        this.m_txt_a_color  = this.m_txt_color;
        this.m_txt_weight = 900;
        this.m_txt_link_weight = 900;
        this.m_txt_decoration = 'none';
        this.m_txt_link_decoration = 'none';
        this.sm_color  = 'silver'; // Item color of submenus
        this.sm_a_color  = '#669999'; // Item color when mouseOver
        this.txt_color  = 'black';  // Color of initial menu
        this.txt_a_color  = 'white'; // Item color of submenus
        this.txt_i_color  = 'gray'; // Item color of inactive items
        this.txt_weight = 700;
        this.txt_link_weight = 700;
        this.txt_decoration = 'none';
        this.txt_link_decoration = 'underline';
        this.m_bottom_decor = [0,'solid','#000000'];
        this.sm_bottom_decor = [1,'inset','#FFFFFF'];
        this.default_cursor ='default';
        this.link_cursor = 'pointer';
        this.m_dec = ' '; // Right decoration of menu
        this.m_a_dec = ' ';
        this.sm_sep = (NN)? '----------' : 'url(webmill/data/image/trans.gif)'; // Separator Image
        this.sm_arrow = 'url(webmill/data/image/mini_right.gif)'; // Arrow image
        this.sm_a_arrow = 'url(webmill/data/image/mini_a_right.gif)';
        this.sm_left_arrow = 'url(webmill/data/image/mini_left.gif)'; // Left arrow image
        this.sm_a_left_arrow = 'url(webmill/data/image/mini_a_left.gif)';
        this.sm_current = 'url(webmill/data/image/v.gif)'; // Current Image
        this.menu_back_st = (NN)?'NNmenuBackSt':'menuBackSt';               // Style variables of font
        this.submenu_back_st = (NN)?'NNsubmenuBackSt':'submenuBackSt';      //     and another preferences in
        this.menu_st = 'menuSt';                                                             //     mapb_menu_style.css
        this.submenu_st = 'submenuSt';                                      //
        this.submenu_st_inactive = 'submenuStInactive';                     //
        this.zIndx = 10;
        this.iconYouarehere = 'url(./webmill/data/image/iconYouarehere.gif)';
        this.iconYouarenothere = 'url(./webmill/data/image/iconYouarenothere.gif)';
        this.activeYouarehere = false;
        this.sm_direction = 'right';
        this.vertical_adjust = 0;
        this.horizontal_adjust = 0;
        this.positioning = 'absolute';

        this.frameMenu = 'noFrames';
        this.frameSubMenu = 'noFrames';
        frameMenu = this.frameMenu;

        //private variables
        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.c_l[this.lev] = [this.m_left,this.m_top];
        this.mn = new Array();
        this.idYouarehere = idYouarehere;
        this.nextChangeDir = false;

        //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.openHere = openHere;
        this.open_l = open_l;
        this.findPosY = findPosY;

        return this;
}

function genL(positioned,sName, sLeft, sTop,sWdh, sHgt, sVis,sColor,copy,handlers) {
        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="position: '+positioned+';';
                s += ' left: ' + sLeft + 'px;';
                s += ' top: ' + sTop + 'px;';
                s += tWidth;
                s += tHeight;
                s += ' visibility:' + sVis + '; z-Index:' + (++this.zIndx) + '; background:';
                s += (typeof (sColor) == 'number'? imgs_url[sColor] : sColor);
                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
}

/*
Example of
mXtras: {'url':'a.html','target':'atarget','background':'acolororimg','backgroundA':'otherColororImg',
        'txtcolor':'acolor','txtacolor':'yetanotherColor','width': number,'height':number,
        'winOptions':'status=yes,toolbar=yes,resizable=yes,location=yes,scrollbars=auto','onclick':anAction,
         'nextOpenDir':'left or right','onmouseover':'action','onmouseout':'action'}
*/

function addItem (mText,mXtras,isLast) {
    var suf = '',idLayout,theText,theDecor,is_active;
        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;
    theColor = mXtras['Mnbackground'] || mXtras['background'] || this.sm_color;
    theaColor = mXtras['MnAbackground'] || mXtras['backgroundA'] || this.sm_a_color;
    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'] || '';
        overAction = mXtras['onmouseover'] || '';
        overAction = (overAction > '')? escape (overAction): '';
        outAction = mXtras['onmouseout'] || '';
        outAction = (outAction > '')? escape (outAction): '';
        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;
    for (i=0;i <= this.lev; i++){
                suf += '_';
                suf += this.c_a[i][0];
    }
        if (!isLast && this.sm_bottom_decor[0] && this.lev > 0){
                addedStyle = ';border-bottom: '+ this.sm_bottom_decor[0] +'px '+this.sm_bottom_decor[1]+' '+this.sm_bottom_decor[2]+';';
        } else if (!isLast && this.m_bottom_decor[0] && this.lev == 0){
                addedStyle = ';border-bottom: '+ this.m_bottom_decor[0] +'px '+this.m_bottom_decor[1]+' '+this.m_bottom_decor[2]+';';
        }
    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 = this.menu_st;
                                theText = mText;
                                if (String (this.m_dec).indexOf ('src=') > -1 || String (this.m_dec).indexOf ('url(') > -1){
                                        decImg = new 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 = new addToLoad (String (this.m_a_dec));
                                        onImage = decaImg.indx;
                                } else {
                                        onImage = -1;
                                }
                                is_active = true;
                                theColor = mXtras['Mnbackground'] || mXtras['background'] || this.m_color;
                                theaColor = mXtras['MnAbackground'] || mXtras['backgroundA'] || this.m_a_color;
                                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;
                        } else {
                                idLayer = this.pre_l + suf;
                                idLayout = this.c_a[this.lev][5];
                                theClass = this.submenu_st;
                                theText = mText;
                                if (offImage.indexOf ('url(') > -1 || offImage.indexOf ('src=') > -1){
                                        arrImg = new addToLoad (offImage);
                                        offImage = arrImg.indx;
                                }
                                theDecor = offImage;
                                if (onImage.indexOf ('src=') > -1 || onImage.indexOf ('url(') > -1){
                                        activeArr = new addToLoad (onImage);
                                        onImage = activeArr.indx
                                }
                                is_active = true;
                        }
                        if (theColor.indexOf ('url') > -1){
                                offImg = new addToLoad (theColor);
                                theColor = offImg.indx
                        }
                        if (theaColor.indexOf ('url') > -1){
                                activeImg = new addToLoad (theaColor);
                                theaColor = activeImg.indx
                        }
                        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);
                        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.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.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.positioning =! 'relative'){
                                        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 = this.menu_st;
                        is_active = true;
                        theDecor = mXtras['image'] || '';
                        theColor = mXtras['Mnbackground'] || mXtras['background'] || this.m_color;
                        theaColor = mXtras['MnAbackground'] || mXtras['backgroundA'] || this.m_a_color;
                        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;
            } else {
                        theClass = this.submenu_st;
                        is_active = true;
                        theDecor = mXtras['image'] || '';
            }
            if (mText == '-') {
                        idLayout = this.c_a[this.lev][5];
                        if (this.sm_sep.indexOf ('url(') > -1){
                                sepImg = new 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'] || '';
            } 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 = this.submenu_st_inactive;
                                txtColor  = this.txt_i_color;
                                txtAcolor  = this.txt_i_color;
                                is_active = false;
                    } else if (mXtras['url'] == 'a'){
                                clickAction = mXtras['onclick'];
                    } 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 +'\'].location.href = \'' + mXtras['url'] + '\''
                                } else {
                                        clickAction = preAct + 'mapb_openBrWindow (\'' + mXtras['url'] + '\',\''+ theTarget +'\',\''+ winOpts +'\')'
                                }
                    }
                    theText = mText;
            }
            if (theColor.indexOf ('url') > -1){
                        smoffImg = new top.addToLoad (theColor);
                        theColor = smoffImg.indx
            }
            if (theaColor.indexOf ('url') > -1){
                        smactiveImg = new top.addToLoad (theaColor);
                        theaColor = smactiveImg.indx
            }
            if (theDecor.indexOf ('url') > -1){
                        decorImg = new top.addToLoad (theDecor);
                        theDecor = decorImg.indx;
                        offImage = decorImg.indx;
            }
                if (mXtras['imageA']){
                        if (mXtras['imageA'].indexOf ('url(') > -1){
                                activeArr = new addToLoad (mXtras['imageA']);
                                onImage = activeArr.indx;
                        }
                }
                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);
            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; //theHeight;
                    } 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 = '';
    for (var i=0;i < this.sm.length;i++){
                var m;
                if (i == 0){
                        if (!this.m_vertical){
                                theClass = this.menu_back_st;
                                h = ' class="' + theClass + '"';
                                m = '<table border="0" cellpadding="0" cellspacing="0" width="'+ this.mn[i][2] +'" height="' + this.mn[i][3] + '">\n';
                                m += '<tr><td>\n';
                        } else {
                                theClass = this.menu_back_st;
                                h = ' class="' + theClass + '"';
                                m = '<table border="0" cellpadding="0" cellspacing="0" width="' + this.mn[i][2] + '" height="' + this.mn[i][3] + '">';
                                m += '<tr><td>\n';
                        }
                        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,this.l_m_color,m,h);
                } else {
                        h = ' class="' + this.submenu_back_st + '"';
                        m = '<table border="0" cellpadding="0" cellspacing="0" width="'+ this.mn[i][2] +'" height="' + this.mn[i][3] + '">';
                        m += '<tr><td>';
                        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,this.l_sm_color,m,h);
                }
                for (j=0;j < this.sm[i].length;j++){
                        f = (this.sm[i][j][3] == this.menu_st)? this.frameMenu : this.frameSubMenu;
                        txtWeight = (this.sm[i][j][3] == this.menu_st)? this.m_txt_weight : this.txt_weight;
                        txtDec = (this.sm[i][j][3] == this.menu_st)? this.m_txt_decoration : this.txt_decoration;
                        t = (this.frameMenu == 'noFrames')? '': 'parent.';
                        visibleText = this.sm[i][j][4];
                        if (typeof (this.sm[i][j][5]) != 'string'){
                                decoration = '<img src="'+parent.to_load[this.sm[i][j][5]]+'" border="0" id="img_'+ this.pre_sm +this.sm[i][j][0]+'" name="img_'+ this.pre_sm + this.sm[i][j][0]+'">';
                        } else {
                                decoration = this.sm[i][j][5];
                        }
                        acType = (NN)? 'onFocus':  'onclick';
                        actOnClick = (this.sm[i][j][13] > '')? ' ' + acType + '="' + this.sm[i][j][13] + '"' : '';
                        if (theWindow == this.frameSubMenu){
                                if(top.frames[this.frameSubMenu].location.href.indexOf(this.sm[i][j][10]) > -1 && this.sm[i][j][10].indexOf('#') == -1 && this.sm[i][j][10].length > 1){
                                        visibleText = this.sm[i][j][11];
                                        if (this.iconYouarehere.indexOf ('url(') > -1){
                                                startStr = this.iconYouarehere.indexOf ('(') + 1;
                                                endStr = this.iconYouarehere.length - startStr - 1;
                                                this.iconYouarehere = '<img src="'+this.iconYouarehere.substr(startStr,endStr)+'" border="0" id="img_'+ this.pre_sm +this.sm[i][j][0]+'" name="img_'+ this.pre_sm + this.sm[i][j][0]+'">';
                                        }
                                        decoration = this.iconYouarehere;
                                        this.Iamhere = this.sm[i][j][2];
                                        this.idYouarehere = this.sm[i][j][2];
                                        actOnClick = '';
                                }
                        } else {
                                if(location.href.indexOf(this.sm[i][j][10]) > -1 && this.sm[i][j][10].indexOf('#') == -1 && this.sm[i][j][10].length > 1){
                                        visibleText = this.sm[i][j][11];
                                        if (this.iconYouarehere.indexOf ('url(') > -1){
                                                startStr = this.iconYouarehere.indexOf ('(') + 1;
                                                endStr = this.iconYouarehere.length - startStr - 1;
                                                this.iconYouarehere = '<img src="'+this.iconYouarehere.substr(startStr,endStr)+'" border="0" id="img_'+ this.pre_sm +this.sm[i][j][0]+'" name="img_'+ this.pre_sm + this.sm[i][j][0]+'">';
                                        }
                                        decoration = this.iconYouarehere;
                                        this.Iamhere = this.sm[i][j][2];
                                        this.idYouarehere = this.sm[i][j][2];
                                        actOnClick = '';
                                }
                        }
                        xTras ='';
                        for (lm in this.sm[i][j][9]){
                                xTras += (typeof(this.sm[i][j][9][lm]) == 'string'? ',\'' + this.sm[i][j][9][lm] + '\'' : ',' + this.sm[i][j][9][lm]);
                        }
                        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;
                        h = ' onMouseOver="' + t + this.idMenu + '.onOver_sm(\''+ this.sm[i][j][3] + '\',' + hasLink + ',\'' + this.pre_sm + this.sm[i][j][0] +'\',\'';
                        h += this.sm[i][j][1] + '\',\'' + this.pre_l + this.sm[i][j][2] + '\',' + this.sm[i][j][6] + ',\''+ f + '\'';
                        h += xTras + ')"';
                        h += actOnClick;
                        h += ' onMouseOut="' + t + this.idMenu + '.onOut_sm(\''+ this.sm[i][j][3] + '\','+ hasLink +',\'' + this.pre_sm + this.sm[i][j][0] + '\',\'' + this.pre_l + this.sm[i][j][2] + '\',' + this.sm[i][j][6] + ',\''+ f + '\'';
                        h += xTras + ')"';
                        m = '<table border="0" cellspacing="0" cellpadding="3">\n';
                        m += '<tr>';
                        theAlign = this.sm[i][j][17];
                        if (NN){
                                longTD = '<td class="' + this.sm[i][j][3] + '" 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" class="' + this.sm[i][j][3] + '"><font color="'+ this.sm[i][j][9][2] +'">' + decoration + '</font></td>\n':'';
                        } else {
                                longTD = '<td class="' + this.sm[i][j][3] + '" 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] + '"';
                                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 class="' + this.sm[i][j][3] + '"' + tdStyle + this.sm[i][j][16] +'">' + 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];
                        //theposition = (this.sm[i][j][3] == this.menu_st)? this.positioning:'absolute';
                        theL += this.genL ('absolute',layerName,this.sm[i][j][7],this.sm[i][j][8],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></tr>\n';
                theL += '</table>\n';
                theL += endL() + '\n';
                if (this.frameMenu == 'noFrames'){
                        document.writeln(theL);
                        //document.forms[0].elements[0].value += theL;
                } else {
                        if (this.sm[i][0][3] == this.menu_st && theWindow == this.frameMenu){
                                top.frames[this.frameMenu].document.writeln(theL);
                        } else if (this.sm[i][0][3] == this.submenu_st && 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 (open_sm[i][2] != null){
                                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);
        open_sm = new Array ();
        autoHide_on = false;
}

function onOver_sm (classLment,isaURL,what_sm,what_l,parentL,sm_active,theFrame,smColor,smaColor,txtcolor,txtAcolor,thewidth,theheight,overaction,outaction,offimage,onimage) {
    clearInterval (autoHide_var);
        autoHide_pass = 1;
        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 = (classLment == this.menu_st)? this.m_txt_link_weight : this.txt_link_weight;
                                refL(this.pre_td + what_sm,'',theFrame).style.textDecoration = (classLment == this.menu_st)? this.m_txt_link_decoration :  this.txt_link_decoration;
                        }
                        if (onimage != -1){
                                thename = 'img_' + what_sm;
                                if (theFrame == 'noFrames'){
                                        document.images[thename].src = parent.to_load[onimage];
                                } else {
                                        parent.frames[theFrame].document.images[thename].src = parent.to_load[onimage];
                                }
                        }
                }
                if (overaction > ''){
                        foo = window.setTimeout (unescape(overaction),10);
                }
    }
        this.open_l (what_sm,what_l);
}

function onOut_sm (classLment,isaURL,what_sm,what_l,sm_active,theFrame,smColor,smaColor,txtcolor,txtAcolor,thewidth,theheight,overaction,outaction,offimage,onimage){
        autoHide_var = setInterval ("autoHide ()",10);
    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 = (classLment == this.menu_st)? this.m_txt_weight : this.txt_weight;
                                refL(this.pre_td + what_sm,'',theFrame).style.textDecoration = (classLment == this.menu_st)? this.m_txt_decoration : this.txt_decoration;
                        }
                        if (offimage != -1){
                                thename = 'img_' + what_sm;
                                if (theFrame == 'noFrames'){
                                        document.images[thename].src = parent.to_load[offimage];
                                } else {
                                        parent.frames[theFrame].document.images[thename].src = parent.to_load[offimage];
                                }
                        }
                }
                if (outaction > ''){
                        foo = window.setTimeout (unescape(outaction),10);
                }
    }
}

function open_l (what_sm,what_l){
    if (what_l != ''){
                theLayer = new refLcomplet (what_l+'_0','',this.frameSubMenu);
                var initialY = theLayer.theTop;
                var initialX = theLayer.theLeft;
                if (this.frameMenu != 'noFrames'){
                        if (document.all){
                                tempY = eval(this.frameSubMenu + '.document.body.scrollTop');
                                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){
                                tempY = eval(this.frameSubMenu + '.pageYOffset');
                                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.idMenu + '_ref','',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++){
            if (open_sm[this.i][0].indexOf(this.idMenu) == -1 || (open_sm[this.i][0].length > what_sm.length && open_sm[this.i][0].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 () {
        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,my_image){
        theonimage = (my_image)? my_image : this.iconYouarehere;
        if (theonimage.indexOf ('url(') > -1){
        } else if (this.iconYouarehere.indexOf ('src') > -1){
                firstposoff = theonimage.indexOf ('src="') + 5;
                endposoff = theonimage.indexOf ('"',firstposoff);
                theonimage = theonimage.substring (firstposoff,endposoff);
        }
        theonimage = '<img src="'+theonimage+'" border="0">';
        startStr = this.iconYouarenothere.indexOf ('(') + 1;
        endStr = this.iconYouarenothere.length - startStr - 1;
        theoffimage = this.iconYouarenothere.substr(startStr,endStr);
        theoffimage = '<img src="'+theoffimage+'" border="0">';
        if(this.frameSubMenu == 'noFrames'){
            if (this.idYouarehere == ''){
                        my_aText = '<table border="0" cellspacing="0" width="' + my_width + '"><tr><td align="right">';
                        my_aText += theoffimage;
                        my_aText += '</td><td align="left"><span style="color: gray; font-size: 11px;font-family: sans-serif; cursor: default">'+ theText +'</span></td></tr></table>';
                        aText = genL('absolute',myname,my_left,my_top,my_width,my_height,showName,my_color,my_aText);
                        aText +=  endL();
            } else {
                        my_aText = '<table border="0" cellspacing="0" width="' + my_width + '"><tr><td align="right">';
                        my_aText += theonimage;
                        my_aText += '</td><td align="left"><span style="font-size: 11px;font-family: sans-serif; cursor: default">'+ theText +'</span></td></tr></table>';
                        aHand = ' onMouseOver="' + this.idMenu + '.openHere ()" onMouseOut="' + this.idMenu + '.hideMenus ()"';
                        aText = genL('absolute',myname,my_left,my_top,my_width,my_height,showName,my_color,my_aText,aHand);
                        aText +=  endL();
            }
            document.writeln (aText)
        } else {
            if (this.idYouarehere == ''){
                        my_aText = '<table border="0" cellspacing="0" width="' + my_width + '"><tr><td align="right">';
                        my_aText += theoffimage;
                        my_aText += '</td><td align="left"><span  style="color: gray; font-size: 11px;font-family: sans-serif; cursor: default">'+ theText +'</span></td></tr></table>';
                        aText = genL('absolute',myname,my_left,my_top,my_width,my_height,showName,my_color,my_aText);
                        aText +=  endL();
            } else {
                        my_aText = '<table border="0" cellspacing="0" width="' + my_width + '"><tr><td align="right">';
                        my_aText += theonimage;
                        my_aText += '</td><td align="left"><span style="font-size: 11px;font-family: sans-serif; cursor: default">'+ theText +'</span></td></tr></table>';
                        aHand = ' onMouseOver="parent.' + this.idMenu + '.openHere ()" onMouseOut="parent.' + this.idMenu + '.hideMenus ()"';
                        aText = genL('absolute',myname,my_left,my_top,my_width,my_height,showName,my_color,my_aText,aHand);
                        aText +=  endL();
            }
            top.frames[this.frameSubMenu].document.writeln (aText)
        }
}

function openHere (){
    if (this.idYouarehere.length > 2){
                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 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('+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] = extractURL;
            imgs_url[self.imgs_url.length] = searchedString;
            addNewImg (extractURL)
        }
        this.indx = i;
    } else {
                to_load[0] = extractURL;
                imgs_url[0] = searchedString;
                addNewImg (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=auto');
    }
}

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;
}