dom = (document.getElementById) ? true : false;
nn4 = (document.layers) ? true : false;
ie = (document.all) ? true : false;
ie4 = (!dom && ie)?  true : false;
ie5 = document.all && document.getElementById;
ns6 = document.getElementById && !document.all;

function WriteLayer(Layer, Code, Doc)
{
  if(!Doc)
    Doc = 'document';
  if(nn4)
  {
    layer.document.open();
    layer.document.write(Code);
    layer.document.close();
  }
  else if(ie4)
    Layer.innerHTML = Code;
  else if(dom)
    Layer.innerHTML = Code;
}

function FindObject(ID, Doc)
{
  var i;
  if(!Doc)
    Doc = document;
  if(dom)
    return Doc.getElementById(ID);
  else if(ie4)
    return Doc.all[ID];
  for(i = 0; i<Doc.forms.length; i++)
    for(j = 0; j<Doc.forms[i].elements.length; j++)
      if(Doc.forms[i].elements[j].name==ID)
        return Doc.forms[i].elements[j];
  for(i = 0; i<Doc.images.length; i++)
    if(Doc.images[i].name==ID)
      return Doc.images[i];
  if(!Doc.layers)
    return null;
  for(i = 0; i<Doc.layers.length; i++)
  {
    if(doc.layers[i].name==ID)
      return Doc.layers[i];
    var x = FindObject(ID, Doc.layers[i].document );
    if(x)
      return x;
  } 
  return null;
}

function GetWindowWidth()
{
  return ns6 ? window.innerWidth-20 : document.body.clientWidth;
}

function GetWindowHeight()
{
  return ns6 ? window.innerHeight-20 : document.body.clientHeight;
}

function GetRadioValue(RadioButton)
{
  for(var i = 0; i < RadioButton.length; i++)
    if(RadioButton[i].checked)
      return RadioButton[i].value;
}

function SetRadioValue(RadioButton, Value)
{
  for(var i = 0; i < RadioButton.length; i++)
    if(RadioButton[i].value == Value)
    {
      RadioButton[i].checked = true;
      break;
    }
  return false;
}

function PopupPic(sPicURL) { 
				window.open("p.html?"+sPicURL, "", "resizable=1,HEIGHT=40,WIDTH=40");
			}
