var curMenu
var curMain
var nav = new Array()
var clearCurrent = true
var clearReset

// <<<----------------------- Controla los Menus Desplegables ----------------------->>> \\
function prepBrowser(path) {
	if (document.images) {
		nav[1] = new mnuDropDown("main_Quienes", path + "quienesoff.gif", path + "quieneson.gif", 'SubQuienes');
		nav[2] = new mnuDropDown("main_Servicios", path + "serviciosoff.gif", path + "servicioson.gif", 'SubServicios');
		nav[3] = new mnuDropDown("main_Sugerencias", path + "sugerenciasoff.gif", path + "sugerenciason.gif", 'SubSugerencias');
		nav[4] = new mnuDropDown("main_Clientes", path + "clientesoff.gif", path + "clienteson.gif", 'SubClientes')
		nav[5] = new mnuDropDown("main_Cotizaciones", path + "cotizacionesoff.gif", path + "cotizacioneson.gif", 'SubCotizaciones');
                                    nav[6] = new mnuDropDown("main_About", path + "aboutoff.gif", path + "abouton.gif", 'SubAbout');
                                    nav[7] = new mnuDropDown("main_Services", path + "servicesoff.gif", path + "serviceson.gif", 'SubServices');
                                    nav[8] = new mnuDropDown("main_Recommendations", path + "recommendationsoff.gif", path + "recommendationson.gif", 'SubRecommendations');
                                    nav[9] = new mnuDropDown("main_Ourclients", path + "ourclientsoff.gif", path + "ourclientson.gif", 'SubOurclients');
                                    nav[10] = new mnuDropDown("main_Quotations", path + "quotationsoff.gif", path + "quotationson.gif", 'SubQuotations');
									nav[12] = new mnuDropDown("main_Bienvenidos", path + "bienvenidoson.gif", path + "bienvenidosoff.gif", '');
									nav[13] = new mnuDropDown("main_Welcome", path + "welcomeon.gif", path + "welcomeoff.gif", '');
		                               
                               
	}
//	OnLoad()
}

function mnuDropDown(loc, on, off, sub) {
	if (document.images) {
		this.loc = loc;
		this.on = new Image();
		this.off = new Image();
		this.on.src = on;
		this.off.src = off;
		this.sub = sub
	}
}

function on_image(pos) {
	if (document.images && typeof nav[pos] != 'undefined') {
		document.images[nav[pos].loc].src = nav[pos].on.src;
		if (curMenu) {

			document.getElementById(curMenu).style.visibility = 'hidden'
		}
		if (curMain) {
			if (curMain != pos) {
				document.images[nav[curMain].loc].src = nav[curMain].off.src;
				clearCurrent = false
			}
		}
		//if (document.layers || document.all) {
			if (nav[pos].sub != "") {
				document.getElementById(nav[pos].sub).style.visibility = 'visible';
				curMenu = nav[pos].sub;
				clearCurrent = false
			}
		//}
		curMain = pos
	}
}

function off_image(pos) {
	if (document.images) {
		clearCurrent = true;
		setTimeout('clrTimer()',100)
	}
}

function onPoint() {
	clearCurrent = false
}

function offPoint() {
	clrDrop()
}

function clrDrop() {
	clearCurrent = true;
	setTimeout('clrTimer()',100)
}

function clrCur() {
	if (curMenu) {
		document.getElementById(curMenu).style.visibility = 'hidden'
	}
	if (curMain) {
		document.images[nav[curMain].loc].src = nav[curMain].off.src
	}
}

function clrTimer() {
	if (clearCurrent) {
		clrCur()
	}
}

function noClear() {
	if (curMenu) {
		clearCurrent = false
	}
}

function colorMe(src,col)
{
	if (col == 0) {
		src.className = 'clsLite'
	} else {
		src.className = 'clsNorm'
	}
}

// <<<----------------------- Contrlola la Posicion del Menu ----------------------->>> \\
var bNetscape4plus = (navigator.appName == "Netscape" && navigator.appVersion.substring(0,1) >= "4");
var bExplorer4plus = (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.substring(0,1) >= "4");

function CheckUIElements()
{
        var yMenuFrom, yMenuTo, yButtonFrom, yButtonTo, yOffset, timeoutNextCheck;

        if ( bNetscape4plus ) {
                yMenuFrom = document["divMenu"].top;
                yMenuTo   = top.pageYOffset + 50;
        }
        else if ( bExplorer4plus ) {
                yMenuFrom = parseInt (divMenu.style.top, 10);
                yMenuTo   = document.body.scrollTop + 50;
        }

        timeoutNextCheck = 500;

        if ( Math.abs (yButtonFrom - (yMenuTo + 152)) < 6 && yButtonTo < yButtonFrom ) {
                setTimeout ("CheckUIElements()", timeoutNextCheck);
                return;
        }


        if ( yButtonFrom != yButtonTo ) {
                yOffset = Math.ceil( Math.abs( yButtonTo - yButtonFrom ) / 10 );
                if ( yButtonTo < yButtonFrom )
                        yOffset = -yOffset;

                if ( bNetscape4plus )
                        document["divLinkButton"].top += yOffset;
                else if ( bExplorer4plus )
                        divLinkButton.style.top = parseInt (divLinkButton.style.top, 10) + yOffset;

                timeoutNextCheck = 10;
        }
        if ( yMenuFrom != yMenuTo ) {
                yOffset = Math.ceil( Math.abs( yMenuTo - yMenuFrom ) / 20 );
                if ( yMenuTo < yMenuFrom )
                        yOffset = -yOffset;

                if ( bNetscape4plus )
		{
                        document["divMenu"].top += yOffset;
                        document["SubMySpace"].top += yOffset + 18;
                        document["SubEntertainment"].top += yOffset + 41;
                        document["SubLiterature"].top += yOffset + 80;
                        document["SubDownloads"].top += yOffset + 99;
			document["Bottom"].top = document["Texto"].top + document["Texto"].height;
		}
                else if ( bExplorer4plus )
		{
                        divMenu.style.top = parseInt (divMenu.style.top, 10) + yOffset;
			SubMySpace.style.top = parseInt (divMenu.style.top, 10) + yOffset + 18;
			SubEntertainment.style.top = parseInt (divMenu.style.top, 10) + yOffset + 41;
			SubLiterature.style.top = parseInt (divMenu.style.top, 10) + yOffset + 80;
			SubDownloads.style.top = parseInt (divMenu.style.top, 10) + yOffset + 99;
			Bottom.style.top = parseInt (Texto.style.top) + parseInt (Texto.style.height);
		}
                timeoutNextCheck = 10;
        }

        setTimeout ("CheckUIElements()", timeoutNextCheck);
}

function OnLoad()
{
        var y;

        // we're not gonna be loaded in frames
        if ( top.frames.length )
                top.location.href = self.location.href;

        // setting initial UI elements positions
        if ( bNetscape4plus ) {
                document["divMenu"].top = top.pageYOffset + 50;
                document["divMenu"].visibility = "visible";
		document["Bottom"].top = document["Texto"].top + document["Texto"].height;
		document["Bottom"].width = top.innerWidth;
		document["Texto"].width = top.innerWidth - 150;
        }
        else if ( bExplorer4plus ) {
                divMenu.style.top = document.body.scrollTop + 50;
                divMenu.style.visibility = "visible";
		Bottom.style.top = parseInt (Texto.style.top) + parseInt (Texto.style.height);
		Bottom.style.width = document.body.clientWidth;
		Texto.style.width = document.body.clientWidth - 150;
        }

        // initializing UI update timer
        CheckUIElements();
        return true;
}

// <<<----------------------- Contrlola el click derecho del mouse ----------------------->>> \\
function click() {
  if (event.button==2) {
      alert('Error 3025.  No se puede visualizar documento, reinicie e intente de nuevo.');
  }
}
