function preloadImages(){
  imgArray = ["homeButtonOver.jpg","aboutButtonOver.jpg","testimonialsButtonOver.jpg","agentsButtonOver.jpg","linksButtonOver.jpg","programsOver.jpg","homestayOver.jpg","chatOver.jpg","winnipegOver.jpg","photosOver.jpg","appButtonOver.jpg"];
  for(j=0;j<imgArray.length;j++){
    tempImage = new Image();
    tempImage.src = "images/" + imgArray[j];
  }
}

function imageWindow(imgName,w,h,imageTitle, imageDescript){
  pathString = "images/" + imgName;
  w = (w<500)?500:w;
  writeString="<html><head>\n<title>" + imageTitle + "</title>\n";
  writeString+="<style>\n p {font-family: helvetica, arial, sans-serif}\n";
  writeString+=".heading {font-size: 18px; line-height: 120%; font-weight: bold; color: #570009}\n";
  writeString+=".bodycopy {font-size: 12px; line-height: 130%; text-align: justify";
  writeString+="; color: #000000}\n</style>\n";
  writeString+="</head>\n";
  writeString+="<body style='background: #ffffff url(images/pageBackground.jpg) repeat-x;'><center><img src = '" + pathString + "' alt='" + imageTitle + " Image'><br>";
  writeString+="<table style='margin-top:30px;' width=" + (w-100) + "><tr><td>";
  writeString+="<p class='heading'>" +imageTitle +"</p>";
  writeString+="<p class='bodycopy'>" +imageDescript +"</p>";
  writeString+="</td></tr></table>";
  writeString+="</center></body></html>";
  h+=Math.round(130+((imageDescript.length/((w-120)/6) + 1)*16));
  windowString="toolbar=no,width=" + (w + 24) + ",height=" + h;
  newWin = window.open('','newWin', windowString);
  newWin.window.document.open("text/html");
  newWin.window.document.writeln(writeString);
  newWin.window.document.close();
  newWin.focus();
}

function validateForm(){
  fieldArray = ["fname","lname","phoneH","street","city","country"];
  for(i = 0; i < fieldArray.length; i++){
    if (eval("document.form1." + fieldArray[i] + ".value") == ""){
      alertUser(i);
      return false;
    }
  }
  return true;
}

function validateInfoForm(){
  fieldArray = ["fname","email"];
  for(i = 0; i < fieldArray.length; i++){
    if (eval("document.form1." + fieldArray[i] + ".value") == ""){
      alertUser2(i);
      return false;
    }
  }
  return true;
} 

function alertUser(fieldIndex){
  errorArray = new Array();
  errorArray[0] = "The First Name field is required; please enter your first name.";
  errorArray[1] = "The Last Name field is required; please enter your last name.";
  errorArray[2] = "The Phone Number field is required; please enter a a phone number where we can reach you.";
  errorArray[3] = "The Street field is required; please enter a street or mailing address.";
  errorArray[4] = "The City field is required; please enter the name of the city you live in.";
  errorArray[5] = "The Country field is required; please enter the name of the country you live in.";
  alert(errorArray[fieldIndex]);
}

function alertUser2(fieldIndex){
  errorArray = new Array();
  errorArray[0] = "The Name field is required; please enter your name.";
  errorArray[1] = "The Email field is required; please enter your email address.";
  alert(errorArray[fieldIndex]);
}












