/*----------------------------------------------------------------
Write status text to browser status bar on bottom
----------------------------------------------------------------*/
function setStatusBarText(strText){
  var strText;
  
  window.defaultStatus = "Personal Computing - Home Technologies";  
  window.status = strText;
  
}

/*----------------------------------------------------------------
Replace the current URI of any web page with a new one using the
following function
----------------------------------------------------------------*/
function directUser(refURL){
  var refURL;
  
  location.replace(refURL);
}


/*----------------------------------------------------------------
Verify if the email address value passed is valid.
We are not using an SMTP validation. We cann't control totally
what people actually write down as email addresses
----------------------------------------------------------------*/
function isEmail(refEmail){
  var refEmail;
  
  if(refEmail.indexOf("@") == -1 || refEmail.indexOf(".") == -1){
     return false;
    }
  return true;
}


/*----------------------------------------------------------------
Validate form input on the contact us form <content_contact.php>
----------------------------------------------------------------*/
function validateForm(refForm){
  var refForm;
  var objForm;
  
  objForm = eval("document." + refForm);
  
  if(objForm.last_name && objForm.last_name.value == ""){
    alert("Please enter your Last Name!");
	objForm.last_name.focus();
    return false
  }
  
  if(objForm.first_name && objForm.first_name.value == ""){
    alert("Please enter your First Name!");
	objForm.first_name.focus();
    return false
  }
  
  if(objForm.address1 && objForm.address1.value == ""){
    alert("Please enter your Street Address!");
	objForm.address1.focus();
    return false
  }
  
  if(objForm.city && objForm.city.value == ""){
    alert("Please enter your City Name!");
	objForm.city.focus();
    return false
  }
  
  if(objForm.state && objForm.state.value == "NA"){
    alert("Please select your State Name!");
	objForm.state.focus();
    return false
  }
   
  if(objForm.zip_code && objForm.zip_code.value == ""){
    alert("Please Enter your Zip Code!");
	objForm.zip_code.focus();
    return false
  }
  
  if(objForm.country && objForm.country.value == "NA"){
    alert("Please select your Country Name!");
	objForm.country.focus();
    return false
  }
  
  if(objForm.phone && objForm.phone.value == ""){
    alert("Please enter your Phone Number!");
	objForm.phone.focus();
    return false
  }
  
  if((objForm.email && objForm.email.value == "") || !isEmail(objForm.email.value)){
    alert("Please enter your Email Account!");
	objForm.email.focus();
    return false
  }
  return true; 
}

//---------------------------------------------------------------------------------------------------------
/* 
  swap images by placing off/on flags according to what reference is passed 0/1 
*/

if(document.images){
	  about_us_on     = new Image();
	  about_us_on.src = "images/about_us_on.gif";
	  about_us        = new Image();
	  about_us.src    = "images/about_us.gif";
	  	 
	  contact_on     = new Image();
	  contact_on.src = "images/contact_on.gif";
	  contact        = new Image();
	  contact.src    = "images/contact.gif";
	  
	  corporations_on     = new Image();
	  corporations_on.src = "images/corporations_on.gif";
	  corporations        = new Image();
	  corporations.src    = "images/corporations.gif";	  	 
	  
	  desktops_on     = new Image();
	  desktops_on.src = "images/desktops_on.gif";
	  desktops        = new Image();
	  desktops.src    = "images/desktops.gif";	  	 
	  
	  home_technologies_on     = new Image();
	  home_technologies_on.src = "images/home_technologies_on.gif";
	  home_technologies        = new Image();
	  home_technologies.src    = "images/home_technologies.gif";
	  
	  notebooks_on     = new Image();
	  notebooks_on.src = "images/notebooks_on.gif";
	  notebooks        = new Image();
	  notebooks.src    = "images/notebooks.gif";
	 
	  servers_on     = new Image();
	  servers_on.src = "images/servers_on.gif";
	  servers        = new Image();
	  servers.src    = "images/servers.gif"; 
	  
	  small_business_on     = new Image();
	  small_business_on.src = "images/small_business_on.gif";
	  small_business        = new Image();
	  small_business.src    = "images/small_business.gif"; 
}

function rollOver(imageName, ref){
  var imageName, ref;
	var image_obj;
	
	image_obj = eval("document." + imageName);
	
	switch (ref){
	  case 1: image_obj.src = eval(imageName + "_on"+ ".src"); break;
	  case 0: image_obj.src = eval(imageName + "" + ".src"); break;
	  default: // do nothing here . . . . 
	}
}