// JavaScript Document
var btn_process = new Image();
btn_process = "/images/nav/btn_process.jpg";
var btn_process_x = new Image();
btn_process_x = "/images/nav/btn_process_x.jpg";
var btn_guarantee = new Image();
btn_guarantee = "/images/nav/btn_guarantee.jpg";
var btn_guarantee_x = new Image();
btn_guarantee_x = "/images/nav/btn_guarantee_x.jpg";
var btn_showcase = new Image();
btn_showcase = "/images/nav/btn_showcase.jpg";
var btn_showcase_x = new Image();
btn_showcase_x = "/images/nav/btn_showcase_x.jpg";
var btn_contactus = new Image();
btn_contactus = "/images/nav/btn_contactus.jpg";
var btn_contactus_x = new Image();
btn_contactus_x = "/images/nav/btn_contactus_x.jpg";

function chgImg(imgID,btnID){  
  var currImage = eval("document." + btnID); //current image
  var newImage = eval("btn_" + imgID); //new image
  currImage.src = newImage;  //image swap
}

function dmController(mainForm){
  var tmpDM = mainForm.domain.value;
  var dmCheck = tmpDM.toLowerCase(); 

  if(isEmpty(dmCheck)){
     alert("Please enter your domain name.");
	 mainForm.domain.focus();
	 return false;
  }else if(dmCheck == "longleafdesigns.com"){
     mainForm.action = "http://www.longleafdesigns.com/admin/";
  }else if(dmCheck == "funkymonkeyhandbags.com"){
	 mainForm.action = "http://www.longleafdesigns.com/funky_monkey/";
  }else if(dmCheck == "funkymonkeykids.com"){
	 mainForm.action = "http://www.longleafdesigns.com/funky_monkey/";
  }else{
     alert("We do not have a match for that account. Please check the spelling of your domain name and make sure you included your top level domain (i.e. .com). If you believe the domain you've entered is correct, please contact us.");
	 mainForm.domain.focus();
	 return false;	  
  }
}

// Checks string to ensure that data exists. Also checks to ensure data presented is not just spaces
function isEmpty(str){
  if (str == null){
	return false;
  }
  for (var intLoop = 0; intLoop < str.length; intLoop++){
    if (" " != str.charAt(intLoop)){
      return false;		    
    }
  }
  return true;
}