// iso to utf-8 encoding
iso2utf = function (text) {
    if (text) {
        text = text.replace(/±/g,String.fromCharCode(196,133));
        text = text.replace(/æ/g,String.fromCharCode(196,135));
        text = text.replace(/ê/g,String.fromCharCode(196,153));
        text = text.replace(/³/g,String.fromCharCode(197,130));
        text = text.replace(/ó/g,String.fromCharCode(195,179));
        text = text.replace(/ñ/g,String.fromCharCode(197,132));
        text = text.replace(/¶/g,String.fromCharCode(197,155));
        text = text.replace(/¿/g,String.fromCharCode(197,188));
        text = text.replace(/¼/g,String.fromCharCode(197,186));

        text = text.replace(/¡/g,String.fromCharCode(196,132));
        text = text.replace(/Æ/g,String.fromCharCode(196,134));
        text = text.replace(/Ê/g,String.fromCharCode(196,152));
        text = text.replace(/£/g,String.fromCharCode(197,129));
        text = text.replace(/Ñ/g,String.fromCharCode(197,131));
        text = text.replace(/Ó/g,String.fromCharCode(197,147));
        text = text.replace(/¦/g,String.fromCharCode(197,154));
        text = text.replace(/¯/g,String.fromCharCode(197,187));
        text = text.replace(/¬/g,String.fromCharCode(197,185));
    }
    return text;
};

// utf-8 to iso encoding
utf2iso = function (text) {
    if (text) {
        str = new RegExp (String.fromCharCode(196) + String.fromCharCode(133),"g");
        text = text.replace(str,"±");
        str = new RegExp (String.fromCharCode(196) + String.fromCharCode(135),"g");
        text = text.replace(str,"æ");
        str = new RegExp (String.fromCharCode(196) + String.fromCharCode(153),"g");
        text = text.replace(str,"ê");
        str = new RegExp (String.fromCharCode(313) + String.fromCharCode(130),"g");
        text = text.replace(str,"³");
        str = new RegExp (String.fromCharCode(258) + String.fromCharCode(322),"g");
        text = text.replace(str,"ó");
        str = new RegExp (String.fromCharCode(313) + String.fromCharCode(132),"g");
        text = text.replace(str,"ñ");
        str = new RegExp (String.fromCharCode(313) + String.fromCharCode(155),"g");
        text = text.replace(str,"¶");
        str = new RegExp (String.fromCharCode(313) + String.fromCharCode(378),"g");
        text = text.replace(str,"¿");
        str = new RegExp (String.fromCharCode(313) + String.fromCharCode(351),"g");
        text = text.replace(str,"¼");

        str = new RegExp (String.fromCharCode(196) + String.fromCharCode(132),"g");
        text = text.replace(str,"¡");
        str = new RegExp (String.fromCharCode(196) + String.fromCharCode(134),"g");
        text = text.replace(str,"Æ");
        str = new RegExp (String.fromCharCode(196) + String.fromCharCode(152),"g");
        text = text.replace(str,"Ê");
        str = new RegExp (String.fromCharCode(313) + String.fromCharCode(129),"g");
        text = text.replace(str,"£");
        str = new RegExp (String.fromCharCode(258) + String.fromCharCode(147),"g");
        text = text.replace(str,"Ó");
        str = new RegExp (String.fromCharCode(313) + String.fromCharCode(154),"g");
        text = text.replace(str,"¦");
        str = new RegExp (String.fromCharCode(313) + String.fromCharCode(357),"g");
        text = text.replace(str,"¯");
        str = new RegExp (String.fromCharCode(313) + String.fromCharCode(353),"g");
        text = text.replace(str,"¬");
    }
    return text;
};

// polish chars removal - used in search
pl2en = function (text) {
    if (text) {
        text = text.replace(/¹/ig,"a");
        text = text.replace(/±/ig,"a");
        text = text.replace(/æ/ig,"c");
        text = text.replace(/ê/ig,"e");
        text = text.replace(/³/ig,"l");
        text = text.replace(/ñ/ig,"n");
        text = text.replace(/ó/ig,"o");
        text = text.replace(/œ/ig,"s");
        text = text.replace(/¶/ig,"s");
        text = text.replace(/Ÿ/ig,"z");
        text = text.replace(/¼/ig,"z");
        text = text.replace(/¿/ig,"z");
    }
    return text;
};