function initclick() {
  if (!document.getElementById) return
  var imgOriginSrc;
  var imgTemp = new Array();
  var imgarr = document.getElementsByTagName('input');
  for (var i = 0; i < imgarr.length; i++) {
    if (imgarr[i].getAttribute('csrc')) {
        imgTemp[i] = new Image();
        imgTemp[i].src = imgarr[i].getAttribute('csrc');
        imgarr[i].onmousedown = function() {
            imgOriginSrc = this.getAttribute('src');
            this.setAttribute('src',this.getAttribute('csrc'))
        }
        imgarr[i].onmouseup = function() {
            this.setAttribute('src',imgOriginSrc)
        }
    }
  }
}

function clearDefault() {
  if (!document.getElementById) return
  var inputs = document.getElementsByTagName('input');
  for (var i=0;i<inputs.length;i++) {
    var input = inputs[i];
    if (("text" == input.getAttribute("type") || "password" == input.getAttribute("type")) && input.defaultValue) {
      input.onfocus = function() {
        if (this.defaultValue == this.value) this.value = '';
      }
      input.onblur = function() {
        if (this.value == '') this.value = this.defaultValue;
      }
    }
  }
}

function repositionHelp() {
  helpDiv = $('help');
//  helpDiv.innerHTML;
  newDiv = document.createElement('div');
  newDiv.innerHTML = helpDiv.innerHTML;
  document.body.removeChild(helpDiv);
  $('imagewrapper').insertBefore(newDiv,$('imagewrapper').firstChild);
  newDiv.setAttribute('id','help');
}

function helpSection() {
  repositionHelp(); // place the help section at the top of the site
  helpEffect = new fx.Height('help',{duration: 300, onComplete: function() {  
    if ($('help').style.height == "1px") {
      $('help').style.display = 'none';
    }
  }});
//  helpEffect.hide();
  if (!document.getElementById) return
  var helpSection = $('help');
  var helpLink = $('helplink'); // Modify the Help Link to display the help section
  helpLink.onmouseover = function() {
    helpEffect.toggle();
  }
  helpLink.onclick = function() {
    helpEffect.toggle();
  }
  if (readCookie('help') != 'seenit') {
    window.setTimeout(function() {helpEffect.toggle() },400);
    createCookie('help','seenit',365);
  }
}

addEvent(window, 'load', initclick);
addEvent(window, 'load', clearDefault);
addEvent(window, 'load', helpSection);

function popup(theURL,width,height) {
	window.open(theURL,'','width='+width+',height='+height+',location=no,menubar=no,toolbar=no,scrollbars=yes,resizeable=yes,left=200,top=100')
}
