var theImages = new Array()

//Random-loading images
theImages[0] = 'http://phlawfirm.com/practice_areas/capcay/capcay1.jpg' // replace with names of images
theImages[1] = 'http://phlawfirm.com/practice_areas/capcay/capcay2.jpg' // replace with names of images
theImages[2] = 'http://phlawfirm.com/practice_areas/capcay/capcay3.jpg' // replace with names of images
theImages[3] = 'http://phlawfirm.com/practice_areas/capcay/capcay4.jpg' // replace with names of images
theImages[4] = 'http://phlawfirm.com/practice_areas/capcay/capcay5.jpg'
theImages[5] = 'http://phlawfirm.com/practice_areas/capcay/capcay6.jpg'
theImages[6] = 'http://phlawfirm.com/practice_areas/capcay/capcay7.jpg'
theImages[7] = 'http://phlawfirm.com/practice_areas/capcay/capcay8.jpg'
theImages[8] = 'http://phlawfirm.com/practice_areas/capcay/capcay9.jpg'


var j = 0
var p = theImages.length;
var preBuffer = new Array()

for (i = 0; i < p; i++){
preBuffer[i] = new Image()
preBuffer[i].src = theImages[i]
}
var whichImage = Math.round(Math.random()*(p-1));

function showImage(){
if(whichImage==0){
document.write('<img src="'+theImages[whichImage]+'"');
}
else if(whichImage==1){
document.write('<img src="'+theImages[whichImage]+'"');
}
else if(whichImage==2){
document.write('<img src="'+theImages[whichImage]+'"');
}
else if(whichImage==3){
document.write('<img src="'+theImages[whichImage]+'"');
}
else if(whichImage==4){
document.write('<img src="'+theImages[whichImage]+'"');
}
else if(whichImage==5){
document.write('<img src="'+theImages[whichImage]+'"');
}
else if(whichImage==6){
document.write('<img src="'+theImages[whichImage]+'"');
}
else if(whichImage==7){
document.write('<img src="'+theImages[whichImage]+'"');
}
else if(whichImage==8){
document.write('<img src="'+theImages[whichImage]+'"');
}


}



function validateForm()
{
if (whichImage==0){
var verif="phlaw";
}
else if (whichImage==1){
var verif="lawfirm";
}
else if (whichImage==2 ){
var verif="lawsuit";
}
else if (whichImage==3){
var verif="attorney";
}
else if (whichImage==4){
var verif="civil";
}
else if (whichImage==5){
var verif="case";
}
else if (whichImage==6){
var verif="surgery";
}
else if (whichImage==7){
var verif="injury";
}
else if (whichImage==8){
var verif="lawyer";
}

var x=document.forms["myForm"]["fname"].value
if (x==null || x=="")
  {
  alert("Name must be filled out");
  return false;
  }
  
  var x=document.forms["myForm"]["email"].value
  if (x==null || x=="")
    {
  alert("Email must be filled out");
  return false;
  }
  
  var x=document.forms["myForm"]["phone"].value
  if (x==null || x=="")
    {
  alert("Phone must be filled out");
  return false;
  }
  var x=document.forms["myForm"]["verification"].value
  if (x==null || x=="")
    {
  alert("Please type the Image Verification");
  return false;
  }
  
  var x=document.forms["myForm"]["verification"].value
  if (x!=verif)
    {
  alert("Please type the Correct Image Verification");
  return false;
  }
}
