        $(function(){
            //initially hide the textbox
            $("#other_clearance").hide();
			$("#percentage").hide();
			$(".duration").hide();
			
            $('#clearance').change(function() {
              if($(this).find('option:selected').val() == "Other"){
                $("#other_clearance").show();
              }else{
                $("#other_clearance").hide();
              }
            });
			
            $('#disability').change(function() {
              if($(this).find('option:selected').val() == "Yes (Service Connected)" || $(this).find('option:selected').val() == "Yes (Other)"){
                $("#percentage").show();
              }else{
                $("#percentage").hide();
              }
            });
			
            $('#geo_duration').change(function() {
              if($(this).find('option:selected').val() == "Other"){
                $(".duration").show();
              }else{
                $(".duration").hide();
              }
            });
			
        });


	// More Positions
	var posCounter = 1;
	var posLimit = 20;
	function moreposition(divName){
		 if (posCounter == posLimit)  {
			  alert("You have reached the posLimit of adding " + posCounter + " positions");
		 }
		 else {
			  var newdiv = document.createElement('div');
			  newdiv.innerHTML = "Position " + (posCounter + 1) + "<br/><textarea name=\"position[]\" rows=\"4\" cols=\"40\" onfocus=\"this.rows=10; this.cols=56;\"></textarea>";
			  document.getElementById(divName).appendChild(newdiv);
			  posCounter++;
		 }
	}
	
	// More Language
	var langCounter = 1;
	var langLimit = 20;
	function morelanguage(divName){
		 if (langCounter == langLimit)  {
			  alert("You have reached the langLimit of adding " + langCounter + " languages");
		 }
		 else {
			  var newdiv = document.createElement('div');
			  newdiv.innerHTML = "Language " + (langCounter + 1) + '<br/><input type="text" name="language[]" placeholder="Language" /><select name="speaking[]"><option value="" disabled>Speaking</option><option value="Basic">Basic</option><option value="Intermediate">Intermediate</option><option value="Fluent">Fluent</option><option value="Native">Native</option></select><select name="reading[]"><option value="" disabled>Reading</option><option value="Basic">Basic</option><option value="Intermediate">Intermediate</option><option value="Fluent">Fluent</option><option value="Native">Native</option></select><select name="writing[]"><option value="" disabled>Writing</option><option value="Basic">Basic</option><option value="Intermediate">Intermediate</option><option value="Fluent">Fluent</option><option value="Native">Native</option></select>';
			  document.getElementById(divName).appendChild(newdiv);
			  langCounter++;
		 }
	}
	
	// More GeoLocation
	var geoCounter = 0;
	var geoLimit = 20;
	function moregeo(divName){
		 if (geoCounter == geoLimit)  {
			  alert("You have reached the geoLimit of adding " + geoCounter + " geographical location");
		 }
		 else {
			  var newdiv = document.createElement('div');
			  newdiv.innerHTML = "Geolocation " + (geoCounter) + '<br /><input type="text" placeholder="Location" name="geo_location[]" /><select name="geo_duration[]" id="geo_duration-' + geoCounter + '"><option value="1-4 weeks">1-4 weeks</option><option value="3 months">3 months</option>	<option value="6 months">6 months</option><option value="1 year">1 year</option><option value="Other">Other</option></select><input class="duration-' + geoCounter + '" name="duration[]" type="text" placeholder="Specify" />';
			  document.getElementById(divName).appendChild(newdiv);
			  $(".duration-" + geoCounter).hide();
			  $('#geo_duration-' + geoCounter).change(function() {
              if($(this).find('option:selected').val() == "Other"){
                $(".duration-" + geoCounter).show();
              }else{
                $(".duration-" + geoCounter).hide();
              }
			  geoCounter++;
            });
		 }
	}
	
	// More Location - Job
	var locCounter = 1;
	var locLimit = 20;
	function morelocation(divName){
		 if (locCounter == locLimit)  {
			  alert("You have reached the locLimit of adding " + locCounter + " location");
		 }
		 else {
			  var newdiv = document.createElement('div');
			  newdiv.innerHTML = "Location " + (locCounter + 1) + '<br /><input type="text" name="locname[]" placeholder="Location" /> <input type="text" name="loctravel[]" placeholder="Percent of Travel" />';
			  document.getElementById(divName).appendChild(newdiv);
			  locCounter++;
		 }
	}
	
	// More POC
	var pocCounter = 1;
	var pocLimit = 20;
	function morepoc(divName){
		 if (pocCounter == pocLimit)  {
			  alert("You have reached the pocLimit of adding " + pocCounter + " point of contact");
		 }
		 else {
			  var newdiv = document.createElement('div');
			  newdiv.innerHTML = "Point of Contact " + (pocCounter + 1) + '<br /><input type="text" name="pocname[]" placeholder="Name" /> <input type="text" name="pocphone[]" placeholder="Phone number" /> <input type="text" name="pocemail[]" placeholder="Email" />';
			  document.getElementById(divName).appendChild(newdiv);
			  pocCounter++;
		 }
	}
	
	
	window.onload = function(){
		new JsDatePick({
			useMode:2,
			target:"availfrom",
			dateFormat:"%F %d, %Y"
			/*selectedDate:{				This is an example of what the full configuration offers.
				day:5,						For full documentation about these settings please see the full version of the code.
				month:9,
				year:2006
			},
			yearsRange:[1978,2020],
			limitToToday:false,
			cellColorScheme:"beige",
			dateFormat:"%m-%d-%Y",
			imgPath:"img/",
			weekStartDay:1*/
		});
		
		new JsDatePick({
			useMode:2,
			target:"availto",
			dateFormat:"%F %d, %Y"
			/*selectedDate:{				This is an example of what the full configuration offers.
				day:5,						For full documentation about these settings please see the full version of the code.
				month:9,
				year:2006
			},
			yearsRange:[1978,2020],
			limitToToday:false,
			cellColorScheme:"beige",
			dateFormat:"%m-%d-%Y",
			imgPath:"img/",
			weekStartDay:1*/
		});
	};
