<?xml version="1.0" encoding="UTF-8"?>
<document>
 <LimeSurveyDocType>Question</LimeSurveyDocType>
 <DBVersion>184</DBVersion>
 <languages>
  <language>en</language>
 </languages>
 <questions>
  <fields>
   <fieldname>qid</fieldname>
   <fieldname>parent_qid</fieldname>
   <fieldname>sid</fieldname>
   <fieldname>gid</fieldname>
   <fieldname>type</fieldname>
   <fieldname>title</fieldname>
   <fieldname>question</fieldname>
   <fieldname>preg</fieldname>
   <fieldname>help</fieldname>
   <fieldname>other</fieldname>
   <fieldname>mandatory</fieldname>
   <fieldname>question_order</fieldname>
   <fieldname>language</fieldname>
   <fieldname>scale_id</fieldname>
   <fieldname>same_default</fieldname>
   <fieldname>relevance</fieldname>
  </fields>
  <rows>
   <row>
    <qid><![CDATA[949]]></qid>
    <parent_qid><![CDATA[0]]></parent_qid>
    <sid><![CDATA[2]]></sid>
    <gid><![CDATA[29]]></gid>
    <type><![CDATA[;]]></type>
    <title><![CDATA[particpanttype2]]></title>
    <question><![CDATA[<script type="text/javascript" charset="utf-8">
	$(document).ready(function() {
 
		// Text inputs to be replaced by dropdowns
		var dropdownAnswers = $('#answer2X29X949SQ001_SQ001,#answer2X29X949SQ002_SQ001');
 
		// Define the select element (dropdown)
		var select1 = '<select class="select1 insertedSelect"> \
							<option value="">-- Please Choose --</option> \
							<option value="Region">Region</option> \
                                                        <option value="Zone">Zone</option> \
							<option value="Woreda">Woreda</option> \
                                                        <option value="Kebele">Kebele</option> \
						</select>';
 
		// Hide the text inputs
		$(dropdownAnswers).hide();
 
		// Insert the select elements
		$(dropdownAnswers).parents('td').append(select1);
 
		// Initially select an option if the question has already been answered
		$('.insertedSelect').each(function(i) {
			if($(this).parent().find('input[type="text"]').val()) {
				$(this).val($(this).parent().find('input[type="text"]').val())
			}
		});
 
		// Listener on the dropdowns - insert selected values into hidden text inputs
		$('.insertedSelect').change(function() {
			$(this).parent().find('input[type="text"]').val($(this).val());
		});
	});
</script><script type="text/javascript" charset="utf-8">
	$(document).ready(function() {
 
		// Text inputs to be replaced by dropdowns
		var dropdownAnswers = $('#answer2X29X949SQ001_SQ002,#answer2X29X949SQ002_SQ002');
 
		// Define the select element (dropdown)
		var select1 = '<select class="select1 insertedSelect"> \
							<option value="">-- Please Choose --</option> \
							<option value="Expert">Expert</option> \
							<option value="DA">DA</option> \
							<option value="Farmer">Farmer</option> \
						</select>';
 
		// Hide the text inputs
		$(dropdownAnswers).hide();
 
		// Insert the select elements
		$(dropdownAnswers).parents('td').append(select1);
 
		// Initially select an option if the question has already been answered
		$('.insertedSelect').each(function(i) {
			if($(this).parent().find('input[type="text"]').val()) {
				$(this).val($(this).parent().find('input[type="text"]').val())
			}
		});
 
		// Listener on the dropdowns - insert selected values into hidden text inputs
		$('.insertedSelect').change(function() {
			$(this).parent().find('input[type="text"]').val($(this).val());
		});
	});
</script><script type="text/javascript" charset="utf-8">
	$(document).ready(function() {
 
		// Text inputs to be replaced by dropdowns
		var dropdownAnswers = $('#answer2X29X949SQ001_SQ005,#answer2X29X949SQ002_SQ005');
 
		// Define the select element (dropdown)
		var select1 = '<select class="select1 insertedSelect"> \
							<option value="">-- Please Choose --</option> \
							<option value="KfW">KfW</option> \
                                                        <option value="CAN">CAN</option> \
							<option value="WB">WB</option> \
                                                        <option value="EU">EU</option> \
                                                        <option value="PFM">PFM</option> \
						</select>';
 
		// Hide the text inputs
		$(dropdownAnswers).hide();
 
		// Insert the select elements
		$(dropdownAnswers).parents('td').append(select1);
 
		// Initially select an option if the question has already been answered
		$('.insertedSelect').each(function(i) {
			if($(this).parent().find('input[type="text"]').val()) {
				$(this).val($(this).parent().find('input[type="text"]').val())
			}
		});
 
		// Listener on the dropdowns - insert selected values into hidden text inputs
		$('.insertedSelect').change(function() {
			$(this).parent().find('input[type="text"]').val($(this).val());
		});
	});
</script><script type="text/javascript" charset="utf-8">	
 
	$(document).ready(function(){
		var thisQuestion = $('#question{QID}');
		var qID = {QID};
 
		// Add some classes for manipulation
		$('tr.subquestions-list', thisQuestion).each(function(i){
			$('> *', this).each(function(i){
				$(this).addClass('col-'+i+'');
			});
		});
		$('tr.subquestions-list:last', thisQuestion).addClass('last');
		$('tr.subquestions-list:not(.last) .col-2 input[type="text"]', thisQuestion).addClass('final');
		$('tr.subquestions-list:not(.last) .col-3 input[type="text"]', thisQuestion).addClass('percent');
		$('tr.subquestions-list:not(.last) .col-4 input[type="text"]', thisQuestion).addClass('rating');
 
		// Disable the "Rating" inputs
		$('input.rating', thisQuestion).prop('disabled', true);
 
		// Hide the unwanted total inputs
		$('tr.subquestions-list.last input[type="text"]:not(:last)', thisQuestion).hide();
 
		// Initial totals
		$('tr.subquestions-list.last input[type="text"]', thisQuestion).val(0).prop('disabled', true);
		var lastRowCode = $('tr.subquestions-list:last', thisQuestion).attr('id').split('X'+qID)[1];
 
		// Listeners on the "Final" and "Percent" inputs
		$('input.final, input.percent', thisQuestion).change(function(event) {
			handleRating(this);
		});
		$('input.final, input.percent', thisQuestion).keyup(function(event) {
			handleRating(this);
		});		
		function handleRating(thisInput) {
			var thisRow = $(thisInput).closest('tr.subquestions-list');
			var thisFinal = $('input.final', thisRow).val();
			var thisPercent = $('input.percent', thisRow).val();
			if(thisFinal != '' && thisPercent != '') {
				$('input.rating', thisRow).val(thisFinal * thisPercent / 100)
			}
			else {
				$('input.rating', thisRow).val('');
			}
		}
 
		// Listeners on the inputs to load totals
		$('tr.subquestions-list:not(.last) input[type="text"]:not(.rating)', thisQuestion).change(function(event) {
			handleTotals();
		});
		$('tr.subquestions-list:not(.last) input[type="text"]:not(.rating)', thisQuestion).keyup(function(event) {
			handleTotals();
		});	
		function handleTotals() {
			$('tr.subquestions-list.last input[type="text"]', thisQuestion).each(function(i) {
				var thisCode = $(this).attr('id').split('X'+qID+lastRowCode+'_')[1];
				var newTotal = 0;
				$('tr.subquestions-list:not(.last) input[type="text"][id$="_'+thisCode+'"]', thisQuestion).each(function(i) {
					if($.isNumeric($(this).val())) {
						newTotal = newTotal + Number($(this).val());
					}
				});
				$(this).val(newTotal);
			});
		}
 
		// Re-enable the "Rating" inputs on submit
		$('form#limesurvey').submit(function(){			
			$('input.rating, tr.subquestions-list.last input[type="text"]', thisQuestion).prop('disabled', false);
		});
	});
 
</script><script type="text/javascript" charset="utf-8">	
	$(document).ready(function() {
 
		// Identify this question
		var thisQuestion = $('#question{QID}');
 
		// Apply some classes
		$('tr.subquestion-list td.answer-item:last-child', thisQuestion).addClass('last-column-item');
 
		// Insert the datepickers
		$('.last-column-item input[type="text"]', thisQuestion).datepicker({
			dateFormat: "dd/mm/yy"
		});	
 
		// Fix up the datepicker position
		$('.last-column-item input[type="text"]', thisQuestion).on('click focus', function() {
			$("#ui-datepicker-div").position({
				my: "left top",
				at: "left-3 top-3",
				of: $(this)
			});
		});	
	});
</script>]]></question>
    <preg/>
    <help/>
    <other><![CDATA[N]]></other>
    <mandatory><![CDATA[N]]></mandatory>
    <question_order><![CDATA[5]]></question_order>
    <language><![CDATA[en]]></language>
    <scale_id><![CDATA[0]]></scale_id>
    <same_default><![CDATA[0]]></same_default>
    <relevance><![CDATA[((2X29X677.NAOK == "A2"))]]></relevance>
   </row>
  </rows>
 </questions>
 <subquestions>
  <fields>
   <fieldname>qid</fieldname>
   <fieldname>parent_qid</fieldname>
   <fieldname>sid</fieldname>
   <fieldname>gid</fieldname>
   <fieldname>type</fieldname>
   <fieldname>title</fieldname>
   <fieldname>question</fieldname>
   <fieldname>preg</fieldname>
   <fieldname>help</fieldname>
   <fieldname>other</fieldname>
   <fieldname>mandatory</fieldname>
   <fieldname>question_order</fieldname>
   <fieldname>language</fieldname>
   <fieldname>scale_id</fieldname>
   <fieldname>same_default</fieldname>
   <fieldname>relevance</fieldname>
  </fields>
  <rows>
   <row>
    <qid><![CDATA[950]]></qid>
    <parent_qid><![CDATA[949]]></parent_qid>
    <sid><![CDATA[2]]></sid>
    <gid><![CDATA[29]]></gid>
    <type><![CDATA[;]]></type>
    <title><![CDATA[SQ001]]></title>
    <question><![CDATA[1]]></question>
    <other><![CDATA[N]]></other>
    <question_order><![CDATA[1]]></question_order>
    <language><![CDATA[en]]></language>
    <scale_id><![CDATA[0]]></scale_id>
    <same_default><![CDATA[0]]></same_default>
    <relevance><![CDATA[1{(particpanttype2_SQ001_SQ003.value+particpanttype2_SQ001_SQ004.value)}]]></relevance>
   </row>
   <row>
    <qid><![CDATA[955]]></qid>
    <parent_qid><![CDATA[949]]></parent_qid>
    <sid><![CDATA[2]]></sid>
    <gid><![CDATA[29]]></gid>
    <type><![CDATA[;]]></type>
    <title><![CDATA[SQ002]]></title>
    <question><![CDATA[2{(particpanttype2_SQ002_SQ003.value+particpanttype2_SQ002_SQ004.value)}]]></question>
    <other><![CDATA[N]]></other>
    <question_order><![CDATA[2]]></question_order>
    <language><![CDATA[en]]></language>
    <scale_id><![CDATA[0]]></scale_id>
    <same_default><![CDATA[0]]></same_default>
    <relevance><![CDATA[1]]></relevance>
   </row>
   <row>
    <qid><![CDATA[951]]></qid>
    <parent_qid><![CDATA[949]]></parent_qid>
    <sid><![CDATA[2]]></sid>
    <gid><![CDATA[29]]></gid>
    <type><![CDATA[;]]></type>
    <title><![CDATA[SQ001]]></title>
    <question><![CDATA[Orgion]]></question>
    <other><![CDATA[N]]></other>
    <question_order><![CDATA[1]]></question_order>
    <language><![CDATA[en]]></language>
    <scale_id><![CDATA[1]]></scale_id>
    <same_default><![CDATA[0]]></same_default>
    <relevance><![CDATA[1{(particpanttype2_SQ001_SQ003.value+particpanttype2_SQ001_SQ004.value)}]]></relevance>
   </row>
   <row>
    <qid><![CDATA[952]]></qid>
    <parent_qid><![CDATA[949]]></parent_qid>
    <sid><![CDATA[2]]></sid>
    <gid><![CDATA[29]]></gid>
    <type><![CDATA[;]]></type>
    <title><![CDATA[SQ002]]></title>
    <question><![CDATA[Function]]></question>
    <other><![CDATA[N]]></other>
    <question_order><![CDATA[2]]></question_order>
    <language><![CDATA[en]]></language>
    <scale_id><![CDATA[1]]></scale_id>
    <same_default><![CDATA[0]]></same_default>
    <relevance><![CDATA[1]]></relevance>
   </row>
   <row>
    <qid><![CDATA[1007]]></qid>
    <parent_qid><![CDATA[949]]></parent_qid>
    <sid><![CDATA[2]]></sid>
    <gid><![CDATA[29]]></gid>
    <type><![CDATA[;]]></type>
    <title><![CDATA[SQ005]]></title>
    <question><![CDATA[Doner]]></question>
    <other><![CDATA[N]]></other>
    <question_order><![CDATA[3]]></question_order>
    <language><![CDATA[en]]></language>
    <scale_id><![CDATA[1]]></scale_id>
    <same_default><![CDATA[0]]></same_default>
   </row>
   <row>
    <qid><![CDATA[953]]></qid>
    <parent_qid><![CDATA[949]]></parent_qid>
    <sid><![CDATA[2]]></sid>
    <gid><![CDATA[29]]></gid>
    <type><![CDATA[;]]></type>
    <title><![CDATA[SQ003]]></title>
    <question><![CDATA[#female]]></question>
    <other><![CDATA[N]]></other>
    <question_order><![CDATA[4]]></question_order>
    <language><![CDATA[en]]></language>
    <scale_id><![CDATA[1]]></scale_id>
    <same_default><![CDATA[0]]></same_default>
   </row>
   <row>
    <qid><![CDATA[954]]></qid>
    <parent_qid><![CDATA[949]]></parent_qid>
    <sid><![CDATA[2]]></sid>
    <gid><![CDATA[29]]></gid>
    <type><![CDATA[;]]></type>
    <title><![CDATA[SQ004]]></title>
    <question><![CDATA[#Male]]></question>
    <other><![CDATA[N]]></other>
    <question_order><![CDATA[5]]></question_order>
    <language><![CDATA[en]]></language>
    <scale_id><![CDATA[1]]></scale_id>
    <same_default><![CDATA[0]]></same_default>
   </row>
   <row>
    <qid><![CDATA[1145]]></qid>
    <parent_qid><![CDATA[949]]></parent_qid>
    <sid><![CDATA[2]]></sid>
    <gid><![CDATA[29]]></gid>
    <type><![CDATA[T]]></type>
    <title><![CDATA[SQ006]]></title>
    <question><![CDATA[Total]]></question>
    <other><![CDATA[N]]></other>
    <question_order><![CDATA[6]]></question_order>
    <language><![CDATA[en]]></language>
    <scale_id><![CDATA[1]]></scale_id>
    <same_default><![CDATA[0]]></same_default>
    <relevance/>
   </row>
  </rows>
 </subquestions>
 <question_attributes>
  <fields>
   <fieldname>qid</fieldname>
   <fieldname>attribute</fieldname>
   <fieldname>value</fieldname>
   <fieldname>language</fieldname>
  </fields>
  <rows>
   <row>
    <qid><![CDATA[949]]></qid>
    <attribute><![CDATA[hide_tip]]></attribute>
    <value><![CDATA[1]]></value>
   </row>
  </rows>
 </question_attributes>
</document>
