function openTellFriend(uri, pageUri, theLocale, site) {	
  if (window.location.search != "") {
    pageUri += window.location.search;		
  }
  pageUri = encodeURIComponent(pageUri); 
  pageUri = "?__locale=" + theLocale + "&uri=" + pageUri + "&site=" + site;
  window.open(uri + pageUri, "tellfriend", "width=600,height=420,dependent=yes,status=no,toolbar=no,location=no,scrollbars=yes,resizable=yes");
}

function switchHeader2Image(imageURL) {
  if(!document.getElementById || !document.getElementsByTagName)
    return;
  var ca = document.getElementById('ContentArea');
  var h1s = ca.getElementsByTagName('h1');
  if(h1s != null && h1s.length > 0) {
    var h1 = h1s[0];
    var img = document.createElement('img');
    img.src=imageURL;
    img.alt=h1.firstChild.nodeValue;
    img.className='h1Img';
    //h1.parentNode.replaceChild();
    h1.parentNode.insertBefore(img, h1);
    h1.parentNode.removeChild(h1);
  }
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

function cd_mobfuscate(dom, name) {
  document.write(name+"@"+dom);
}
function cd_m2obfuscate_l(dom, name, subj, pre, txt, post) {
  document.write("<a href='mailto:");
  document.write(name+"@"+dom);
  if(subj!=null && subj.length > 0)
    document.write("?"+subj);
  document.write("'>"+pre+(txt==null ? (name+"@"+dom) : txt)+post+"</a>");
}
function cd_m2obfuscate(dom, name) {
  cd_m2obfuscate_l(dom, name, null, '', null, '');
}
function cd_m2obfuscate1(dom, name, subj) {
  document.write("<a href='mailto:");
  document.write(name+"@"+dom);
  if(subj!=null && subj.length > 0)
    document.write("?"+subj);
  document.write("'>");
}
function cd_m2obfuscate2(dom, name) {
  document.write(name+"@"+dom);
}
function cd_m2obfuscate3() {
  document.write("</a>");
}
