function add_f_wwres_event_handlers() {
    toggleLinks();
    if (document.getElementById("cccForm") != null && document.getElementById("cccSelect") != null) {
        document.getElementById("cccForm").onsubmit = cccForm_onSubmit;
        document.getElementById("cccSelect").onchange = cccSelect_onChange;
    }
    }

function toggleLinks(){
   var links = document.getElementsByTagName('a');
  var linksCount = links.length;
    var i=0;
  for(i=0;i<linksCount;i++){
  	if(links[i].href.indexOf("/contact/worldwide")!=-1){
        var val=links[i].href;
       val=val.replace("/contact/worldwide","/console/call");
        links[i].href=val;
          }
      }
    if (document.location.href.search('brandCode=CORP') > 0)
    {
        var obj = document.getElementById('brandShowALL');
        if (obj == null)
            var obj = document.getElementById('countryShowALL')
        if (obj != null)
        {
            var href = obj.getAttribute("href");
            var onclick = obj.getAttribute("onclick");

            obj.setAttribute('onclick', "void(0);");

            obj.removeAttribute('href');
            obj.style.color = "#653C33";
        }

    }
    if (document.location.href.search('brandCode=CORP') < 0)
    {
        var obj = document.getElementById('brandShow');
        if (obj == null)
            var obj = document.getElementById('countryShow')

        if (obj != null)
        {
            var href = obj.getAttribute("href");
            var onclick = obj.getAttribute("onclick");

            obj.setAttribute('onclick', "void(0);");

            obj.removeAttribute('href');
            obj.style.color = "#653C33";
        }
    }
    if (document.location.href.search('country=') < 0)
    {
        if(document.getElementById("conName") != null)
        document.getElementById("conName").className="divHide";
    }
    if (document.location.href.search('country=') > 0) {
      if(document.getElementById("conName") != null)
              document.getElementById('conName').className="countryName";
    }
}

function cccForm_onSubmit() {
    if (document.custContactForm.custContactSelect.value.length > 0) {
        document.location = document.custContactForm.custContactSelect.value;
        return false;
    }
}

function cccSelect_onChange() {
    if (document.custContactForm.custContactSelect.value.length > 0){
        val = document.custContactForm.custContactSelect.value;
            if (val != null) document.location = val.replace(/contact\/worldwide/,"console/call");

    }
}

// Safely adds to the document's onLoad event.
function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            oldonload();
            func();
        }
    }
}
addLoadEvent(add_f_wwres_event_handlers);

