function validate(form){
  var name = eval("document.getElementById('name')");
  var email = eval("document.getElementById('email')");
  var verify_email = eval("document.getElementById('verify')");
  var querystring = 'action='+form+'&name='+name.value+'&email='+email.value;
  if(form == 'contact_us'){
   var phone = eval("document.getElementById('phone')");
   var other = eval("document.getElementById('other')");
   querystring = querystring+'&phone='+phone.value+'&other='+other.value;
  }
  if(name.value && email.value && verify_email.value && (email.value == verify_email.value)){
    //submit
    $.ajax({ type:'POST', url: 'sendmail.cgi', data: querystring, complete: function(data,statusText){  document.getElementById('interior-copy').innerHTML = "<div>"+data.responseText+"</div>"; } });
  }else {
    if(!name.value){
      alert("Please enter your name.");
      document.getElementById('name').style.backgroundColor = "#f69fc3";
    }else if(!email.value){
      alert("Please enter your e-mail.");
      document.getElementById('email').style.backgroundColor =  "#f69fc3";
    }else if(!verify_email.value){
      alert("Please verify your e-mail.");
      document.getElementById('verify').style.backgroundColor =  "#f69fc3";
    }else if(email.value != verify_email.value){
      alert("The e-mail addresses you entered do not match. Please try again.");
    }
  }
}
function validate2(form){
  var name = eval("document.getElementById('name')");
  var address = eval("document.getElementById('address')");
  var email = eval("document.getElementById('email')");
  var verify_email = eval("document.getElementById('verify')");
  var querystring = 'action='+form+'&name='+name.value+'&address='+address.value+'&email='+email.value;
  if(form == 'win50'){
   var phone = eval("document.getElementById('phone')");
   var high = eval("document.getElementById('high')");
   var recieve = 0;
   if(document.getElementById('recieve').checked == true){
    recieve = eval("document.getElementById('recieve')");
   }
   querystring = querystring+'&phone='+phone.value+'&high='+high.value+'&recieve='+recieve.value;
  }
  if(name.value && email.value && address.value && high.value && verify_email.value && (email.value == verify_email.value)){
    //submit
    //alert(querystring);
    $.ajax({ type:'POST', url: 'sendmail.cgi', data: querystring, complete: function(data,statusText){  document.getElementById('interior-copy').innerHTML = "<div>"+data.responseText+"</div>"; } });
  }else {
    if(!name.value){
      alert("Please enter your name.");
      document.getElementById('name').style.backgroundColor = "#f69fc3";
    }else if(!address.value){
      alert("Please enter your address.");
      document.getElementById('address').style.backgroundColor = "#f69fc3";
    }else if(!email.value){
      alert("Please enter your e-mail.");
      document.getElementById('email').style.backgroundColor =  "#f69fc3";
    }else if(!verify_email.value){
      alert("Please verify your e-mail.");
      document.getElementById('verify').style.backgroundColor =  "#f69fc3";
    }else if(email.value != verify_email.value){
      alert("The e-mail addresses you entered do not match. Please try again.");
    }else if(!high.value){
        alert("Please enter your high school.")
        document.getElementById('high').style.backgroundColor = "#f69fc3";
    }
  }
}
function validate_story(type){
  var first_name = eval("document.getElementById('first_name')");
  var last_name = eval("document.getElementById('last_name')");
  var email = eval("document.getElementById('email')");
  var phone = eval("document.getElementById('phone')");
  var address = eval("document.getElementById('address')");
  var story = eval("document.getElementById('story')");
  var city = eval("document.getElementById('city')");
  var zipcode = eval("document.getElementById('zipcode')");
  if(first_name.value && last_name.value && email.value && phone.value && address.value && story.value && city.value && zipcode.value){
    eval("document."+type+"_story_form.submit()");
  }else if(!first_name.value){
    alert("Please enter your First Name.");
    first_name.style.backgroundColor = '#f69fc3';
  }else if(!last_name.value){
    alert("Please enter your Last Name.");
    last_name.style.backgroundColor = '#f69fc3';
  }else if(!email.value){
    alert("Please enter your E-mail address.");
    email.style.backgroundColor = '#f69fc3';
  }else if(!phone.value){
    alert("Please enter your Phone number.");
    phone.style.backgroundColor = '#f69fc3';
  }else if(!address.value){
    alert("Please enter your Address.");
    address.style.backgroundColor = '#f69fc3';
  }else if(!story.value){
    alert("Please enter your Story.");
    story.style.backgroundColor = '#f69fc3';
  }else if(!city.value){
    alert("Please enter your City.");
    city.style.backgroundColor = '#f69fc3';
  }else if(!zipcode.value){
    alert("Please enter your Zip Code.");
    zipcode.style.backgroundColor = '#f69fc3';
  }
}
function validate_consultation(){
    var occasion_date = eval("document.getElementById('occasion_date')");
    var location = eval("document.getElementById('location')");
    var address1 = eval("document.getElementById('address1')");
    var address2 = eval("document.getElementById('address2')");
    var first = eval("document.getElementById('first_name')");
    var last = eval("document.getElementById('last_name')");
    var email = eval("document.getElementById('email')");
    var city = eval("document.getElementById('city')");
    var state = eval("document.getElementById('state')");
    var zip = eval("document.getElementById('zip')");
    var phone = eval("document.getElementById('phone')");
    var alt_phone = eval("document.getElementById('alternate_phone')");
    var requested_date = eval("document.getElementById('requested_date')");
    var best_time = eval("document.getElementById('best_time')");
    var type = eval("document.getElementById('type')");
    var other = eval("document.getElementById('other')");
    var dress_size = eval("document.getElementById('dress_size')");
    var chest_size = eval("document.getElementById('chest_size')");
    var waist_size = eval("document.getElementById('waist_size')");
    var hip_size = eval("document.getElementById('hip_size')");
    var num_bridesmaids = eval("document.getElementById('num_bridesmaids')");
    var num_tuxes = eval("document.getElementById('num_tuxes')");
    var comments = eval("document.getElementById('comments')");
    if(first.value && last.value && email.value && city.value && zip.value && phone.value && best_time.value && occasion_date.value && location.value && address1.value && requested_date.value && dress_size.value){
        var querystring = "action=do_consultation&first_name="+first.value+
	                  "&last_name="+last.value+"&email="+email.value+
			  "&city="+city.value+"&state="+state.value+
			  "&zip="+zip.value+"&phone="+phone.value+
			  "&best_time="+best_time.value+"&type="+type.value+
			  "&other="+other.value+"&occasion_date="+occasion_date.value+
			  "&location="+location.value+"&address1="+address1.value+
			  "&address2="+address2.value+"&alternate_phone="+alt_phone.value+
			  "&requested_date="+requested_date.value+"&dress_size="+dress_size.value+
			  "&chest_size="+chest_size.value+"&waist_size="+waist_size.value+"&hip_size="+hip_size.value+
			  "&num_bridesmaids="+num_bridesmaids.value+"&num_tuxes="+num_tuxes.value+
			  "&comments="+comments.value;
        $.ajax({ type:'POST', url: 'sendmail.cgi', data: querystring, complete: function(data,statusText){  document.getElementById('interior-copy').innerHTML = "<div>"+data.responseText+"</div>"; } });
    }else if(!first.value){
        alert("Please enter your First Name.");
        first.style.backgroundColor = '#f69fc3';
    }else if(!last.value){
        alert("Please enter your Last Name.");
        last.style.backgroundColor = '#f69fc3';
    }else if(!email.value){
        alert("Please enter your E-mail address.");
        email.style.backgroundColor = '#f69fc3';
    }else if(!city.value){
        alert("Please enter your City.");
        city.style.backgroundColor = '#f69fc3';
    }else if(!zip.value){
        alert("Please enter your Zip Code.");
        zip.style.backgroundColor = '#f69fc3';
    }else if(!phone.value){
        alert("Please enter your Contact Number.");
        phone.style.backgroundColor = '#f69fc3';
    }else if(!best_time.value){
        alert("Please enter the best time to reach you.");
        best_time.style.backgroundColor = '#f69fc3';
    }else if(!occasion_date.value){
        alert("Please enter the Date of the Occasion.");
	occasion_date.style.backgroundColor = '#f69fc3';
    }else if(!address1.value){
        alert("Please enter your Address.");
	address1.style.backgroundColor = '#f69fc3';
    }else if(!requested_date.value){
        alert("Please enter the Requested Date.");
        requested_date.style.backgroundColor = '#f69fc3';
    }else if(!dress_size.value){
        alert("Please enter your Regular Dress Size.");
	dress_size.style.backgroundColor = '#f69fc3';
    }
}
function show_hide_div(id){
    if(document.getElementById(id).style.display == 'none'){
      document.getElementById(id).style.display = 'block';
    }else{
      document.getElementById(id).style.display = 'none';    
    }
}