//<summary>
//Copyright 2008, Iron Mountain, Inc. All rights reserved. This computer program is the property of Iron Mountain Inc.,
//and its licensors and contains their confidential trade secrets. Use, examination, copying, transfer and 
//disclosure to others, in whole or in part, are prohibited except with the express prior written consent of Iron Mountain, Inc. 
//</summary>

//Bulids the Html string for check box
function generateCheckBoxType(oQuestionNode, sQuestionNumber, sLevel)
{

	var sHtmlString = "";
	var sQuestionId;
	if (oQuestionNode != null && sQuestionNumber != null)
	{
		sQuestionId = getAttributeValue(oQuestionNode,0);
	
	    var labelNodeList = oQuestionNode.getElementsByTagName("label");
	    var sLabel = getElementValue(labelNodeList[0]); 
	    var sDescription = "";
	    var descriptionNodeList = oQuestionNode.getElementsByTagName("description");
	    
	    if ( descriptionNodeList[0].firstChild != null)
	    {
			sDescription = getElementValue(descriptionNodeList[0]);
		}
		
		var sXpath3 = "value";
		var oValueNodes = getSelectNodes(oQuestionNode, sXpath3, "value");
	
		sHtmlString = "<tr><td class=questionNumber>" + sQuestionNumber + "</td><td colspan='2' class=questionNumber>" + sLabel + "</td></tr>";
		sHtmlString += "<tr><td></td><td class=questionDescription colspan='2'>" + sDescription  + "</td></tr>";
			
		for(i = 0; i < oValueNodes.length; i++ ){
			var sVlue = getElementValue(oValueNodes[i]);	
			sHtmlString += "<tr><td></td><td class=checkbox colspan='2'><input onClick='javascript:updateUI(" + sLevel + ");' type='checkbox' name='" + sQuestionId + "' id='" + getAttributeValue(oValueNodes[i], 0) + "'>" + sVlue + "</input></td></tr>";
		}
	
		sHtmlString += "<tr><td></td><td></td><td>&nbsp;&nbsp;</td></tr>";
	}
	return sHtmlString;
}

//Bulids the Html string for drop down
function generateDropDownType(oQuestionNode, sQuestionNumber, sLevel)
{
	var sHtmlString = "";
	var sQuestionId;
	if (oQuestionNode != null && sQuestionNumber != null)
	{
		sQuestionId = getAttributeValue(oQuestionNode,0);

		var labelNodeList = oQuestionNode.getElementsByTagName("label");
	    var sLabel = getElementValue(labelNodeList[0]); 
	    var sDescription = "";
	    var descriptionNodeList = oQuestionNode.getElementsByTagName("description");
	    
	    if ( descriptionNodeList[0].firstChild != null)
	    {
			sDescription = getElementValue(descriptionNodeList[0]);
		}
	
		var sXpath3 = "value";
		var oValueNodes = getSelectNodes(oQuestionNode, sXpath3, "value");
	
		sHtmlString = "<tr><td class=questionNumber>" + sQuestionNumber + "</td><td colspan='2' class=questionNumber>" + sLabel + "</td></tr>";
		sHtmlString += "<tr><td></td><td class=questionDescription colspan='2'>" + sDescription  + "</td></tr>";
		sHtmlString += "<tr><td></td><td colspan='2'><select onChange='javascript:updateUI(" + sLevel + ");' class=dropdown name='" + sQuestionId + "' size='1'>";
	
		for(i = 0; i < oValueNodes.length; i++ ){
			var sVlue = getElementValue(oValueNodes[i]);
			sHtmlString += "<option value='" + getAttributeValue(oValueNodes[i], 0) + "'>" + sVlue + "</option>";
		}
	
		sHtmlString += "</select></td></tr>";
		sHtmlString += "<tr><td></td><td></td><td>&nbsp;&nbsp;</td></tr>";
	}
	return sHtmlString;
}

//Bulids the Html string for radio button
function generateRadioButtonType(oQuestionNode, sQuestionNumber, sLevel)
{
	var sHtmlString = "";
	var sQuestionId;
	if (oQuestionNode != null && sQuestionNumber != null)
	{
		sQuestionId = getAttributeValue(oQuestionNode,0);
	
		var labelNodeList = oQuestionNode.getElementsByTagName("label");
	    var sLabel = getElementValue(labelNodeList[0]); 
	    var sDescription = "";
	    var descriptionNodeList = oQuestionNode.getElementsByTagName("description");
	    
	    if ( descriptionNodeList[0].firstChild != null)
	    {
			sDescription = getElementValue(descriptionNodeList[0]);
		}
	
		var sXpath3 = "value";
		var oValueNodes = getSelectNodes(oQuestionNode, sXpath3, "value");
	
		sHtmlString = "<tr><td class=questionNumber>" + sQuestionNumber + "</td><td colspan='2' class=questionNumber>" + sLabel + "</td></tr>";
		sHtmlString += "<tr><td></td><td class=questionDescription colspan='2'>" + sDescription  + "</td></tr>";
	
		for(i = 0; i < oValueNodes.length; i++ ){
			var sVlue = getElementValue(oValueNodes[i]);
			sHtmlString += "<tr><td></td><td class=radiobutton colspan='2'><input onClick='javascript:updateUI(" + sLevel + ");' type='radio' name ='" + sQuestionId + "' value='" + getAttributeValue(oValueNodes[i], 0) + "'>" + sVlue + "</input></td></tr>";
		}

		sHtmlString += "<tr><td></td><td></td><td>&nbsp;&nbsp;</td></tr>";
	}
	return sHtmlString;
}
