function checkform(theform){
	var why = "";
	 
	if(theform.txtInput.value == ""){
		why += "- Security code should not be empty.\n";
	}
	if(theform.txtInput.value != ""){
		if(ValidCaptcha(theform.txtInput.value) == false){
			why += "- Security code did not match.\n";
		}
	}
	if(why != ""){
		alert(why);
		return false;
	}
}
function ValidCaptcha(){
	var str1 = removeSpaces(document.getElementById('txtCaptcha').value);
	var str2 = removeSpaces(document.getElementById('txtInput').value);
	if (str1 == str2){
		return true;	
	}else{
		return false;
	}
}

function removeSpaces(string){
	return string.split(' ').join('');
}


//If using image buttons as controls, Set image buttons' image preload here true
//(use false for no preloading and for when using no image buttons as controls):
var preload_ctrl_images=false;

//And configure the image buttons' images here:
var previmg='';
var stopimg='';
var playimg='';
var nextimg='';

var slides=[]; //FIRST SLIDESHOW
//configure the below images and descriptions to your own. 
slides[0] = ["images/oregon_helical_piers.jpg", "", ""];
slides[1] = ["images/oregon_foundation_repair_contractors.jpg", "", ""];
slides[2] = ["images/oregon_retaining_wall_contractors.jpg", "", ""];
slides[3] = ["images/oregon_concrete_slab_leveling.jpg", "", ""];

//optional properties for these images:
slides.no_descriptions=1; //use for no descriptions displayed
slides.pause=0; //use for pause onmouseover
slides.no_controls=1; //use for controls
slides.image_controls=0; //use images for controls
slides.nofade=0; //use for no fade-in, fade-out effect for this show
slides.button_highlight='#4BAC28'; //onmouseover background-color for image buttons (requires image_controls=1)
slides.random=1; //set a random slide sequence on each page load
slides.manual_start=0; //start show in manual mode (stopped)
slides.no_added_linebreaks=0; //use for no added line breaks in formatting of texts and controls
slides.delay=8000 //will set miliseconds delay between slides for a given show, may also be set in the call as the last parameter


$(document).ready(function(){

  
  $( "#estimateForm" ).validate();
   
  var a = Math.ceil(Math.random() * 9)+ '';
  var b = Math.ceil(Math.random() * 9)+ '';       
  var c = Math.ceil(Math.random() * 9)+ '';  
  var d = Math.ceil(Math.random() * 9)+ '';  
  var e = Math.ceil(Math.random() * 9)+ '';  
	
  var code = a + b + c + d + e;
  document.getElementById("txtCaptcha").value = code;
  document.getElementById("txtCaptchaDiv").innerHTML = code;	
  

});



