var offImgList = new Array(13);
var onImgList = new Array(13);

offImgList[0] = new Image();
offImgList[0].src = "img/brochure_off.gif";
offImgList[1] = new Image();
offImgList[1].src = "img/leftMenu1_off.gif";
offImgList[2] = new Image();
offImgList[2].src = "img/leftMenu2_off.gif";
offImgList[3] = new Image();
offImgList[3].src = "img/leftMenu3_off.gif";
offImgList[4] = new Image();
offImgList[4].src = "img/home_off.gif";
offImgList[5] = new Image();
offImgList[5].src = "img/topMenu1_off.gif";
offImgList[6] = new Image();
offImgList[6].src = "img/topMenu2_off.gif";
offImgList[7] = new Image();
offImgList[7].src = "img/subMenu1_off.gif";
offImgList[8] = new Image();
offImgList[8].src = "img/subMenu2_off.gif";
offImgList[9] = new Image();
offImgList[9].src = "img/subMenu3_off.gif";
offImgList[10] = new Image();
offImgList[10].src = "img/subMenu4_off.gif";
offImgList[11] = new Image();
offImgList[11].src = "img/submit_off.gif";
offImgList[12] = new Image();
offImgList[12].src = "img/cancel_off.gif";

onImgList[0] = new Image();
onImgList[0].src = "img/brochure_on.gif";
onImgList[1] = new Image();
onImgList[1].src = "img/leftMenu1_on.gif";
onImgList[2] = new Image();
onImgList[2].src = "img/leftMenu2_on.gif";
onImgList[3] = new Image();
onImgList[3].src = "img/leftMenu3_on.gif";
onImgList[4] = new Image();
onImgList[4].src = "img/home_on.gif";
onImgList[5] = new Image();
onImgList[5].src = "img/topMenu1_on.gif";
onImgList[6] = new Image();
onImgList[6].src = "img/topMenu2_on.gif";
onImgList[7] = new Image();
onImgList[7].src = "img/subMenu1_on.gif";
onImgList[8] = new Image();
onImgList[8].src = "img/subMenu2_on.gif";
onImgList[9] = new Image();
onImgList[9].src = "img/subMenu3_on.gif";
onImgList[10] = new Image();
onImgList[10].src = "img/subMenu4_on.gif";
onImgList[11] = new Image();
onImgList[11].src = "img/submit_on.gif";
onImgList[12] = new Image();
onImgList[12].src = "img/cancel_on.gif";

function showFlash(fileName, width, height) {
  if (navigator.appName == "Netscape") {
    document.write("<object type=\"application/x-shockwave-flash\" data=\"flash/" + fileName + "\" width=\"" + width + "\" height=\"" + height + "\"></object>");
  }
  else if (navigator.appName == "Opera") {
    document.write("<embed src=\"flash/" + fileName + "\" quality=\"high\" width=\"" + width + "\" height=\"" + height + "\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />");
  }
  else {
    document.write("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"" + width + "\" height=\"" + height + "\"><param name=\"movie\" value=\"flash/" + fileName + "\" /><param name=\"quality\" value=\"high\" /></object>");
  }
}

function imgSwap(imgName, targetID, type) {
  if(type == 0) {
    imgName.src = offImgList[targetID].src;
  }
  else {
    imgName.src = onImgList[targetID].src;
  }
}

function openRequestForm() {
  window.open('request.php','','scrollbars=no,menubar=no,width=500,height=700,resizable=no,toolbar=no,location=no,status=no');
}

function submitForm() {
  var emailValidator = /\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
  
  if (document.requestFrm.contactName.value == "") {
    alert("Please enter contact name.");
    document.requestFrm.contactName.focus();
  }
  else if (document.requestFrm.companyName.value == "") {
    alert("Please enter company name.");
    document.requestFrm.companyName.focus();
  }
  else if (document.requestFrm.telePhone.value == "") {
    alert("Please enter telephone.");
    document.requestFrm.telePhone.focus();
  }
  else if (document.requestFrm.emailAddress.value == "") {
    alert("Please enter e-mail address.");
    document.requestFrm.emailAddress.focus();
  }
  else if (emailValidator.test(document.requestFrm.emailAddress.value) == false) {
    alert("Please enter correct e-mail address.");
    document.requestFrm.emailAddress.focus();
  }
  else if (!document.requestFrm.phone.checked && !document.requestFrm.email.checked && !document.requestFrm.nomatter.checked) {
    alert("Please choose at least one of preferred method of contacts.");
	document.requestFrm.phone.focus();
  }
  else if (!document.requestFrm.cibi.checked && !document.requestFrm.website.checked && 
           !document.requestFrm.editorai.checked && !document.requestFrm.advertising.checked && 
		   !document.requestFrm.package.checked && !document.requestFrm.other.checked) {
    alert("Please choose at least one of design works required.");
	document.requestFrm.cibi.focus();
  }
  else if (!document.requestFrm.start[0].checked && !document.requestFrm.start[1].checked && !document.requestFrm.start[2].checked) {
    alert("Please choose when you would like the design project to start.");
	document.requestFrm.start[0].focus();
  }
  else {
    document.requestFrm.submit();
  }
}