﻿var vop = 0;
function ira(wobj, wnme) {
    clearTimeout(tim2);
    var wtex = trim(wobj.id);
    if (wnme == 3)
        location.href = "repuestos.aspx?wtex=" + wtex + "&wnme=" + wnme;
    else
        location.href = "catalogo.aspx?wtex=" + wtex + "&wnme=" + wnme;
}
//animacion de la banda de izda a dcha y bajar el menu de fotos
//funciones para el idioma
function idioma(dvi) {
    dvi.style.cursor = 'pointer';
    dvi.style.backgroundColor = "#cc3333";
}
function idiomaoff(dvi) {
    dvi.style.cursor = '';
    dvi.style.backgroundColor = "";
}
function veridioma(wobj) {
    var wid = wobj.id
    location.href = "default.aspx?idioma=" + wid
}
//funciones para el carrusel de imágenes
function aleatorio(inferior, superior) {
    numPosibilidades = superior - inferior
    aleat = Math.random() * numPosibilidades
    aleat = Math.floor(aleat)
    return parseInt(inferior) + aleat
}
var nimag = 5 // numero de imágenes
var img1 = aleatorio(1, nimag)
var img2 = img1
var fimg1
var fimg2
function maq() {
    img1 = img1 + 1;
    img2 = img1 + 1;
    if (img1 == nimag) { img2 = 1; }
    if (img1 == nimag + 1) { img1 = 1; img2 = 2; }
    fimg1 = $("#maq" + img1);
    fimg2 = $("#maq" + img2);
    $(fimg1).fadeIn("slow");
    tim2 = setTimeout("maql()", 3000);
}
function maql() {
        $(fimg1).fadeOut("slow");
        $(fimg2).fadeIn("slow");
        maq();
    }
    
function idi() {
    if (widi == "in") {
        var im1 = document.getElementById("im1");
        im1.src = "images/menu_empresa_in.jpg";

        var im2 = document.getElementById("im2");
        im2.src = "images/menu_segmano_in.jpg";

        var im3 = document.getElementById("im3");
        im3.src = "images/menu_especiales_in.jpg";

        var im4 = document.getElementById("im4");
        im4.src = "images/menu_contacto_in.jpg";

        var im5 = document.getElementById("im5");
        im5.src = "images/menu_novedades_in.jpg";

        var im6 = document.getElementById("im6");
        im6.src = "images/menu_tienda_in.jpg";
    }
    if (widi == "fr") {
        var im1 = document.getElementById("im1");
        im1.src = "images/menu_empresa_fr.jpg";

        var im2 = document.getElementById("im2");
        im2.src = "images/menu_segmano_fr.jpg";

        var im3 = document.getElementById("im3");
        im3.src = "images/menu_especiales_fr.jpg";

        var im4 = document.getElementById("im4");
        im4.src = "images/menu_contacto_fr.jpg";

        var im5 = document.getElementById("im5");
        im5.src = "images/menu_novedades_fr.jpg";

        var im6 = document.getElementById("im6");
        im6.src = "images/menu_tienda_fr.jpg";
    }
}

var ttout;
function cursor_on(obj, wnum) {
    $("#menufam1").hide();
    $("#menufam2").hide();
    $("#menufam3").hide();
    obj.style.cursor = 'pointer';
    var wpos = $(obj).offset();
    var wleft = wpos.left;
    var wtop = wpos.top;
    //$("#menufam [id^=menufam]").hide();
    $("#menufam" + wnum).css('left', wleft - 85 + 'px');
    $("#menufam" + wnum).css('top', wtop + 20 + 'px');
    $("#menufam" + wnum).fadeIn();
}
function cursor_off(obj) {
    obj.style.cursor = '';
    wid = $(obj).attr('id');
    ttout = setTimeout("cursor_cls('" + obj.id + "')", 500);
}
function cursor_cls(wid) {
    clearTimeout(ttout);
    $("#" + wid).hide();
}
function selec(wobj) {
    wobj.style.cursor = 'pointer';
    wobj.style.color = "#663399";
}
function deselec(wobj) {
    wobj.style.cursor = '';
    wobj.style.color = "#cc3333";
}

