//<!--

function mkMail(alias,domain,tld) {
 document.write(alias+'@'+domain+'.'+tld);
}

function mkMailto(alias,domain,tld) {
 document.write('mailto:');
 mkMail(alias,domain,tld)
}

function mkMailLink(alias,domain,tld,text) {
 document.write('<a href="');
 mkMailto(alias,domain,tld);
 document.write('">'+text+'</a>')
}

function mkMailLinkTip(alias,domain,tld,text,tip) {
 document.write('<a class="tip" href="');
 mkMailto(alias,domain,tld);
 document.write('">'+text+'<span>'+tip+'</span></a>')
}

function mkAddr(h,s,a,c,st,z) {
 document.write(h+' '+s+' '+a+'<br />'+c+', '+st+' '+z);
}

function mkPhone(country,city,number) {
 document.write('+'+country+'('+city+')'+number);
}

function mkPhoneto(country,city,number) {
 document.write('callto:');
 mkPhone(country,city,number)
}

function mkPhoneLink(country,city,number,text) {
 document.write('<a href="');
 mkPhoneto(country,city,number);
 document.write('">'+text+'</a>')
}

function mkPhoneLinkTip(country,city,number,text,tip) {
 document.write('<a class="tip" href="');
 mkPhoneto(country,city,number);
 document.write('">'+text+'<span>'+tip+'</span></a>')
}

function mkSkype(alias,feature) {
 document.write(alias+'?'+feature);
}

function mkSkypeto(alias,feature) {
 document.write('skype:');
 mkSkype(alias,feature)
}

function mkSkypeLink(alias,feature,text) {
 document.write('<a href="');
 mkSkypeto(alias,feature);
 document.write('">'+text+'</a>')
}

function mkSkypeLinkTip(alias,feature,text,tip) {
 document.write('<a class="tip" href="');
 mkSkypeto(alias,feature);
 document.write('">'+text+'<span>'+tip+'</span></a>')
}

function mkLinkTip(url1,url2,text,tip) {
 document.write('<a class="tip" href="'+url1+url2+'">'+text+'<span>'+tip+'</span></a>')
}

function mkLinkTipExt(url1,url2,text,tip) {
 document.write('<a class="tip" href="'+url1+url2+'" target="_blank">'+text+'<span>'+tip+'</span></a>')
}

function mkTip(text,tip) {
 document.write('<span class="tip">'+text+'<span>'+tip+'</span></span>')
}

function dispBlock(obj) {
 document.getElementById(obj).style.display = 'block';
}

function toggleDisplay(obj) {
 var e = document.getElementById(obj);
 if (e.style.display == 'block') {
  e.style.display = 'none';
 } else {
  e.style.display = 'block';
 }
}

function showItem(item,id) {
 document.getElementById(item+id).style.display = 'block';
}

function toggleItem(item,id) {
 var e = document.getElementById(item+id);
 if (e.style.display == 'block') {
  e.style.display = 'none';
 } else if (e.style.display == 'none') {
  e.style.display = 'block';
 }
}

function toggle(item) {
 var e = document.getElementById(item);
 if (e.style.display == 'block') {
  e.style.display = 'none';
 } else if (e.style.display == 'none') {
  e.style.display = 'block';
 }
}

function toggleTopic(item1,item2) {
 var e1 = document.getElementById(item1);
 var e2 = document.getElementById(item2);
 if (e1.style.display == 'block') {
  e1.style.display = 'none';
  e2.style.display = 'block';
 } else if (e1.style.display == 'none') {
  e1.style.display = 'block';
  e2.style.display = 'none';
 }
}

function utf8_decode(str) {
    // Converts a UTF-8 encoded string to ISO-8859-1  
    // Code adopted from PHP source in xml.c
    var newbuf = [], s = 0, newlen = 0, c = 0;
    var pos = str.length;
    var unknown = '?'.charCodeAt(0); // unknown character
    
    str += '';
    
    while (pos > 0) {
      c = str.charCodeAt(s);
      if (c >= 0xf0) {        // 4 byte encoded
        if (pos-4 >= 0) { // make sure we're far enough in the string
          c = ((c&7)<<18) 
              | ((str.charCodeAt(s+1)&63)<<12) 
              | ((str.charCodeAt(s+2)&63)<<6) 
              | (str.charCodeAt(s+3)&63);
        } else {
          c = unknown;
        }
        s += 4;
        pos -= 4;
      } else if (c >= 0xe0) { // 3 byte encoded
        if (pos-3 >= 0) { // make sure we're far enough in the string
          c = ((c&63)<<12) 
              | ((str.charCodeAt(s+1)&63)<<6) 
              | (str.charCodeAt(s+2)&63);
        } else {
          c = unknown;
        }
        s += 3;
        pos -= 3;
      } else if (c >= 0xc0) { // 2 byte encoded
        if (pos-2 >= 0) { // make sure we're far enough in the string
          c = ((c&63)<<6) 
              | (str.charCodeAt(s+1)&63);
        } else {
          c = unknown;
        }
        s += 2;
        pos -= 2;
      } else {
        ++s;
        --pos;
      }
      newbuf[newlen++] = String.fromCharCode(c);
    } 
    return newbuf.join('');
}

// -->
