﻿
    function teclaCercador(e){
    /*
        var key;
        if(document.all) key = event.keyCode; 
        else key = e.keyCode;
        if (key==13 || key==9) 
        { 
            var oHidden = document.getElementById("hIdBotoCercar");
            if (oHidden != null){
                var oLinkBoto = document.getElementById(oHidden.value);
                var sClick = oLinkBoto.attributes.getNamedItem("onclick").value;
                eval(sClick.replace(/return /,"var res = "));
                if (res){
                    var sHref = oLinkBoto.attributes.getNamedItem("href").value;
                    eval(sHref.replace(/javascript:/,""));
                }
                return res;
            }
        }
    */
    }
    
    function cercar(sCerca){
        //document.location = "cercador.aspx?cerca=" + escape(sCerca);

        var oIdioma = $("#ctl00_hIdioma");
        var idioma = oIdioma.val();
        document.location = "cercador.aspx?cerca=" + encodeURI(sCerca) + "&idioma=" + idioma;
    }
    function cutShortDesc(niMaxCharacters) {
        $(".shortDesc").each(function(i) {
            var oJQ = $(this);
            var text = oJQ.html();
            if (text.length > niMaxCharacters) {
                text = text.substring(0, niMaxCharacters) + "...";
            }
            $("#" + oJQ.attr("id").replace("div", "p")).html(text);
            oJQ.remove();
        });

    }
    function changeLanguage(idCombo) {
        var combo = $("#" + idCombo);
        if (combo.length > 0) {
            if (combo[0].value.length > 0) {
                document.location = combo[0].value.replace("http://xxx.x", "http://c");
            }
        }
    }
    function getIEVersionNumber() {
        var ua = navigator.userAgent;
        var MSIEOffset = ua.indexOf("MSIE ");

        if (MSIEOffset == -1) {
            return 0;
        } else {
            return parseFloat(ua.substring(MSIEOffset + 5, ua.indexOf(";", MSIEOffset)));
        }
    }

    function ampliarfoto(sUrl, $img) {
        var width = 800;
        var height = 600;
        var left = parseInt(screen.width / 2) - parseInt(width / 2);
        var top = parseInt(screen.height / 2) - parseInt(height / 2);
        window.open(sUrl, "_blank", "width=" + width + ",height=" + height + ",toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,left=" + left + ",top=" + top);
    }
