//
var currentdate = 0
var core = 0

function StringArray (n) {
  this.length = n;
  for (var i =1; i <= n; i++) {
    this[i] = ' '

  }
}

image = new StringArray(4)
image[0] = '/headerImages/head-image1.jpg'
image[1] = '/headerImages/head-image2.jpg'
image[2] = '/headerImages/head-image3.jpg'
image[3] = '/headerImages/head-image4.jpg'

var ran = 60/image.length

function ranimage() {
  currentdate = new Date()
  core = currentdate.getSeconds()
  core = Math.floor(core/ran)
    return(image[core])
}

document.write("<style type=\"text/css\">#header {background: url('" +ranimage()+ "') no-repeat;}</style>");
//


function validate_required(field){
	
	with (field){	
		if (value==null||value==""){ document.getElementById(field.name+'Empty').style.display = 'block'; return false}
		else { 
			document.getElementById(field.name+'Empty').style.display = 'none'; 
			document.getElementById(field.name+'Req').style.display = 'none';
			return true}
	}
}

function validate_email(field)
{
  with (field)
  {
    apos=value.indexOf("@")
    dotpos=value.lastIndexOf(".")
    if (apos<1||dotpos-apos<2){ document.getElementById(field.name+'Error').style.display = 'block'; return false}
    else { document.getElementById(field.name+'Error').style.display = 'none'; return true}
  }
}

function checkContact(thisform)
{ 
  with (thisform)
  {
    if (validate_required(name)==false)
      {name.focus();return false}
    if (validate_required(email)==false)
      {email.focus();return false}
	if (validate_email(email)==false)
      {email.focus();return false}
	if (validate_required(message)==false)
      {message.focus();return false}

  }
}

function checkClients(thisform)
{ 
  with (thisform)
  {
	
    if (validate_required(login)==false)
      {login.focus();return false}
	if (validate_required(pass)==false)
      {pass.focus();return false}
    

  }
}
