secimg_file = 'secimg.php';

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

addLoadEvent(changeSecImg);
addLoadEvent(setup_change_secimg);

function setup_change_secimg() {
	if(!document.getElementById) return;
	el = document.getElementById('change_secimg');
	el.href = location.href;
	el.onclick = changeSecImg;
}


function changeSecImg() {
  img = (document.images && document.images.secimg) ? document.images.secimg :
        (document.getElementById && document.getElementById('secimg')) ? document.getElementById(secimg) :
        (document.getElementsByName && document.getElementsByName('secimg').length > 0) ? document.getElementsByName('secimg')[0] :
        (document.all && document.all['secimg']) ? document.all['secimg'] : '';
  if(img) {
    id = randomvalue(0,0xFFFFFF);
    img.src = secimg_file + '?id=' + id;
    document.contact_form.secid.value = id;
    document.contact_form.sectxt.value = "";
  }
  return false;
}
function randomvalue(low, high) { return Math.floor(Math.random() * (1 + high - low) + low); }
