//email validator
function isemail(s)
{      
    var i = 1;
    var sLength = s.length;
    while ((i < sLength) && (s.charAt(i) != "@"))
    { i++
    }
    if ((i >= sLength) || (s.charAt(i) != "@")) return false;
    else i += 2;
    while ((i < sLength) && (s.charAt(i) != "."))
    { i++
    }
    if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
    else return true;
}

function checkform ( form )
{
  if (form.ContactName.value == "" || form.ContactName.value == "*Contact Name") {
    alert( "Please enter your Name." );
    form.ContactName.focus();
	form.ContactName.style.border = "1px solid red";
    return false ;
  }
  if (form.ContactEmail.value == "" || form.ContactEmail.value == "*Contact Email") {
    alert( "Please enter your Email address." );
    form.ContactEmail.focus();
	form.ContactEmail.style.border = "1px solid red";
    return false ;
  }
  if (!isemail(document.enquiry.ContactEmail.value))
  {
	window.alert("Please enter a valid Email address (eg. user@company.com)");
	document.enquiry.ContactEmail.focus();
	form.ContactEmail.style.border = "1px solid red";
	return false;
  }
  if (form.Project.value == "" || form.Project.value == "*Brief description of the project") {
    alert( "Please enter a project description." );
    form.Project.focus();
	form.Project.style.border = "1px solid red";
    return false ;
  }
  // ** END **
  return true ;
}


//ie flicker bug
try {
  document.execCommand('BackgroundImageCache', false, true);
} catch(e) {}


//preload images
var imgs = new Array(8)
for (x=0;x<8;x++)
{
	imgs[x] = new Image();
	imgs[x].src= "/images/lea-image-" + (x+1) +".jpg"
}


function loadTab(i)
{

for (x=1;x<9;x++)
{
    document.getElementById('imageControlInfo'+x).style.display='none';
}
document.getElementById('imageControlInfo'+i).style.display='block';
document.getElementById('imageControl').style.backgroundImage="url(../images/lea-image-" + i +".jpg)";


}

