var agent = navigator.userAgent.toLowerCase();
var notOpera = agent.indexOf('opera') == -1;

function element(eId) {
   if (document.getElementById) return document.getElementById(eId);
   else if (document.all) return document.all[eId];
   else if (document.layers) return document[eId];
   return null;
}

function getIframeById(fId) {
   if (document.frames && notOpera) {
     // this is for IE5 Mac, because it will only allow access to the document object
     // of the IFrame if we access it through the document.frames array
     return document.frames[fId];
   }
   else {
      return element(fId);
   }
}

function getIframeDoc(iFrame) {
  var iFrameDoc;        
  if (iFrame.contentDocument) {
    // For NS6
    iFrameDoc = iFrame.contentDocument; 
  } else if (iFrame.contentWindow) {
    // For IE5.5 and IE6
    iFrameDoc = iFrame.contentWindow.document;
  } else if (iFrame.document) {
    // For IE5
    iFrameDoc = iFrame.document;
  }
  return iFrameDoc;
}

function setField(name, value) {
    var nameField = element(name);
    if (nameField) {
        nameField.value = value;
    }
}

function clearValue(name) {
   if (!name) return;
   var elm = element(name);
   if (elm && elm.value) elm.value="";
}

function setClass(name, classname) {
   if (!name || !classname) return;
   var elm = element(name);
   if (elm) elm.className = classname;
}

function setInnerContent(name, content) {
   if (!name || !content) return;
   var elm = element(name);
   if (elm) elm.innerHTML = content;
}

