/* This is more how it should work. I'll test it later. -MJO
mHover = function() {
	var sfEls = document.getElementById("mm").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].attachEvent("onmouseover",function() { this.className+=" mhover"; });
		sfEls[i].attachEvent("onmouseout",function() { this.className=this.className.replace(new RegExp(" mhover\\b"), ""); });
	}
}
if (window.attachEvent) window.attachEvent("onload", mHover);
function setStatus(s) { // People still use this even though they shouldn't, but it's missing from some places
   status=s;
}
*/

mHover = function() {
   var mm=document.getElementById("mm");
   if(mm) {
         var countrysel = document.getElementById('countrysel');
         if(countrysel && !document.getElementById('fakeCountrySel')){
            var fakeCountrySel = document.createElement('div');
            fakeCountrySel.id = 'fakeCountrySel';
            fakeCountrySel.style.display='none';
            countrysel.parentNode.insertBefore(fakeCountrySel, countrysel);
         }
         var sfEls = mm.getElementsByTagName("LI");
         for (var i=0; i<sfEls.length; i++) {
            sfEls[i].onmouseover=function() {
               this.className+=" mhover";
               var countrysel = document.getElementById('countrysel');
               if(countrysel){
                  countrysel.blur();
                  if(this.className.indexOf('hideCountry') >= 0){
                     countrysel.style.visibility='hidden';
                     fakeCountrySel = document.getElementById('fakeCountrySel');
                     fakeCountrySel.innerHTML = '<div>'+countrysel.options[countrysel.selectedIndex].text+'</div>';
                     fakeCountrySel.style.display='block';
                  }
               }
            }
            sfEls[i].onmouseout=function() {
               this.className=this.className.replace(new RegExp(" mhover\\b"), "");
               if(this.className.indexOf('hideCountry') >= 0){
                  var countrysel = document.getElementById('countrysel');
                  if(countrysel){
                     countrysel.style.visibility='visible';
                     document.getElementById('fakeCountrySel').style.display='none';
                  }
               }
            }
         }
   }
}

if (window.attachEvent) window.attachEvent("onload", mHover);


function setStatus(s) { // People still use this, but it's missing from some places
   status=s;
}
function cf(action) {
   var f = document.createElement("FORM");
   f.method="POST";
   f.action=action;
   document.body.appendChild(f);
   return f;
}
function cfi(parentForm,name,value) {
   var i = document.createElement("INPUT");
   i.type="hidden";
   i.name=name;
   i.value=value;
   parentForm.appendChild(i);
}
var SID;
function postLink(a) {
   var url = a.href;
   var f = cf(url);
   cfi(f,"SID",SID);
   f.submit();
   return false;
}
