
/****************************************************
*	        DOM Image rollover:
*		by Chris Poole
*		http://chrispoole.com
*               Script featured on http://www.dynamicdrive.com
*		Keep this notice intact to use it :-)
****************************************************/

function init_rollover() 
{
  if (!document.getElementById) return
  var imgOriginSrc;
  var imgTemp = new Array();
  var imgarr = document.getElementsByTagName('img');
  var imgarrlen = imgarr.length;
  for (var i = 0; i < imgarrlen; i++) 
  {
    if (imgarr[i].getAttribute('hsrc')) 
    {
        imgTemp[i] = new Image();
        imgTemp[i].src = imgarr[i].getAttribute('hsrc');
        imgarr[i].onmouseover = function() 
        {
            imgOriginSrc = this.getAttribute('src');
            this.setAttribute('src',this.getAttribute('hsrc'))
        }
        imgarr[i].onmouseout = function() 
        {
            this.setAttribute('src',imgOriginSrc)
        }
    }
  }

  imgarr = document.getElementsByTagName('input');
  for (var j = 0; j < imgarr.length; j++) 
  {
    i = j + imgarrlen;
    if (imgarr[j].getAttribute('hsrc')) 
    {
        imgTemp[i] = new Image();
        imgTemp[i].src = imgarr[j].getAttribute('hsrc');
        imgarr[j].onmouseover = function() 
        {
            imgOriginSrc = this.getAttribute('src');
            this.setAttribute('src',this.getAttribute('hsrc'))
        }
        imgarr[j].onmouseout = function() 
        {
            this.setAttribute('src',imgOriginSrc)
        }
    }
  }

}

/****************************************************
*	        Button simulation:
*		by Neil Watkins
****************************************************/
function high(EID)
{
  document.getElementById(EID).style.backgroundColor = "#DDFFCC";
  document.getElementById(EID).style.borderColor = "#777777 #EEEEEE #EEEEEE #777777";
}

function low(EID)
{
  document.getElementById(EID).style.backgroundColor = "#CCDDFF";
  document.getElementById(EID).style.borderColor = "#EEEEEE #777777 #777777 #EEEEEE";
}

/****************************************************
*	        Row highlighting:
*		by Neil Watkins
****************************************************/
function emphh(EID)
{
  document.getElementById(EID).style.backgroundColor = '#FF7777';
  document.getElementById('xframe').style.backgroundColor = '#FF0000';
}

function unemphh(EID)
{
  document.getElementById(EID).style.backgroundColor = '#DDDDDD';
  document.getElementById('xframe').style.backgroundColor = '#C9C9C9';
}

function emph(EID)
{
  document.getElementById(EID).style.backgroundColor = '#FFDDDD';
}

function unemph(EID)
{
  document.getElementById(EID).style.backgroundColor = '#E7E7E7';
}

/****************************************************
*     To check for excessive characters on input
*****************************************************/


function chk_fldlen(src,max)
{
  curlen = src.value.length;
  if(curlen == max)
    src.style.backgroundColor = '#FFE401';
  else 
  {
    if(curlen > max)
      src.style.backgroundColor = '#FF7777';
    else
    {
      if(src.className == 'appfield')
        src.style.backgroundColor = '#FFFFDD';
      else
        src.style.backgroundColor = '#FFFFFF';
    }
  }
}

function rst_fldsbg(src)
{
  for(i=0;i<src.length;i++)
  {
    obj = src.elements[i];
    if(obj.type == 'text' || obj.type == 'textarea' || obj.type == 'password')
    {
      if(obj.className == 'appfield')
        obj.style.backgroundColor = '#FFFFDD';
      else
      {
        if(obj.className == 'townfield')
          obj.style.backgroundColor = '#DDFFDD';
        else
          obj.style.backgroundColor = '#FFFFFF';
      }
    }
  }
}

/****************************************************
*	        Input button highlighting:
*		by Neil Watkins
****************************************************/

function btnup(z)
{
  z.style.backgroundColor='#DDDDDD';
  z.style.color = '#000000';
}

function btndwn(z)
{
  z.style.backgroundColor='#AAAAAA';
  z.style.color = '#FFFFFF';
}



function init_buttons() 
{
  if (!document.getElementById) return;

  var btnarr = document.getElementsByTagName('input');
  var btnarrlen = btnarr.length;
  for (var i = 0; i < btnarrlen; i++) 
  {
    if (btnarr[i].getAttribute("className")) 
    {
        if(btnarr[i].getAttribute('className') == 'button')
        {
          btnarr[i].onmouseover = function() 
          {
            if(this.style.backgroundColor!='#ff7777')
            {
              this.style.backgroundColor = '#C6A56B';
              this.style.color = '#ffffff';
            }
            else
            {
              this.style.backgroundColor = '#dc0000';
              this.style.color = '#ffffff';
            }

          }
          btnarr[i].onmouseout = function() 
          {
            if(this.style.backgroundColor!='#dc0000')
            {
              this.style.backgroundColor = '#EBE0C9';
              this.style.color = '#000000';
            }
            else
            {
              this.style.backgroundColor = '#ff7777';
              this.style.color = '#000000';
            }

          }
        }
    }
  }
}

function initall()
{
  init_rollover();
  init_buttons();
}

onload=initall;

