<!-- chef_resources_itemtype.vm, use with org.sakaiproject.tool.content.ResourcesAction.java -->
#macro (custom_dateselectionwidget $yearselect_id $monthselect_id $dayselect_id $earliestYear $latestYear $yearSelected $monthSelected $daySelected $onChangeAction)

	#set($yearList = [$earliestYear .. $latestYear])
	
    <select name="$monthselect_id" id="$monthselect_id" onchange="blur(); $onChangeAction">  
      #if ($monthSelected == 1) <option value="1" selected="selected">$tlang.getString("jan")</option> #else <option value="1">$tlang.getString("jan")</option> #end
        
		#if ($monthSelected == 2) <option value="2" selected="selected">$tlang.getString("feb")</option> #else <option value="2">$tlang.getString("feb")</option> #end
        
		#if ($monthSelected == 3) <option value="3" selected="selected">$tlang.getString("mar")</option> #else <option value="3">$tlang.getString("mar")</option> #end
        
		#if ($monthSelected == 4) <option value="4" selected="selected">$tlang.getString("apr")</option> #else <option value="4">$tlang.getString("apr")</option> #end
        
		#if ($monthSelected == 5) <option value="5" selected="selected">$tlang.getString("may")</option> #else <option value="5">$tlang.getString("may")</option> #end
        
		#if ($monthSelected == 6) <option value="6" selected="selected">$tlang.getString("jun")</option> #else <option value="6">$tlang.getString("jun")</option> #end
        
		#if ($monthSelected == 7) <option value="7" selected="selected">$tlang.getString("jul")</option> #else <option value="7">$tlang.getString("jul")</option> #end
        
		#if ($monthSelected == 8) <option value="8" selected="selected">$tlang.getString("aug")</option> #else <option value="8">$tlang.getString("aug")</option> #end
        
		#if ($monthSelected == 9) <option value="9" selected="selected">$tlang.getString("sep")</option> #else <option value="9">$tlang.getString("sep")</option> #end
        
		#if ($monthSelected == 10) <option value="10" selected="selected">$tlang.getString("oct")</option> #else <option value="10">$tlang.getString("oct")</option> #end
        
		#if ($monthSelected == 11) <option value="11" selected="selected">$tlang.getString("nov")</option> #else <option value="11">$tlang.getString("nov")</option> #end
        
		#if ($monthSelected == 12) <option value="12" selected="selected">$tlang.getString("dec")</option> #else <option value="12">$tlang.getString("dec")</option> #end

    </select>
    
    <select name="$dayselect_id" id="$dayselect_id" onchange="blur(); $onChangeAction">
		
    #foreach($d in [1..31])
        #if($d == $daySelected)
            <option value="$d" selected="selected">$d</option>
        #else
            <option value="$d">$d</option>
        #end
	#end
	
    </select>
    
    <select name="$yearselect_id" id="$yearselect_id" onchange="blur(); $onChangeAction">
		
        #foreach ($y in $yearList)
            #if ($y == $yearSelected)
                    <option value="$y" selected="selected">$y</option>
            #else
                    <option value="$y">$y</option>
            #end
		#end
		
    </select>
	
	#chef_dateselectionwidgetpopup($yearselect_id $monthselect_id $dayselect_id)
	
#end

#macro(custom_timeSelectionWidget $prefix $current_value $onChangeAction)
			#set($time = $current_value.toStringLocalFull())
			#set($hour = $current_value.breakdownLocal().hour)
			#set($minute = $current_value.breakdownLocal().min)
			
			#if($hour > 12)
				#set($hour = $hour - 12)
				#set($timeType = "pm")
			#elseif ($hour == 0)
				#set($hour = 12)
				#set($timeType = "am")
			#end
			
			<select name="${prefix}_hour" id="${prefix}_hour" onchange="hourChange('${prefix}_hour'); $!onChangeAction return false;">
				#if($hour == 1) <option selected="selected" value="1">1</option> #else <option value="1">1</option> #end
				#if($hour == 2) <option selected="selected" value="2">2</option> #else <option value="2">2</option> #end
				#if($hour == 3) <option selected="selected" value="3">3</option> #else <option value="3">3</option> #end
				#if($hour == 4) <option selected="selected" value="4">4</option> #else <option value="4">4</option> #end
				#if($hour == 5) <option selected="selected" value="5">5</option> #else <option value="5">5</option> #end
				#if($hour == 6) <option selected="selected" value="6">6</option> #else <option value="6">6</option> #end 
				#if($hour == 7) <option selected="selected" value="7">7</option> #else <option value="7">7</option> #end
				#if($hour == 8) <option selected="selected" value="8">8</option> #else <option value="8">8</option> #end
				#if($hour == 9) <option selected="selected" value="9">9</option> #else <option value="9">9</option> #end
				#if($hour == 10) <option selected="selected" value="10">10</option> #else <option value="10">10</option> #end
				#if($hour == 11) <option selected="selected" value="11">11</option> #else <option value="11">11</option> #end
				#if($hour == 12) <option selected="selected" value="12">12</option> #else <option value="12">12</option> #end
			</select>
			
			<select name="${prefix}_minute" id="${prefix}_minute" onchange="hourChange('${prefix}_minute'); $!onChangeAction return false;">
				#if($minute == 0) <option selected="selected" value="0">00</option> #else <option value="0">00</option> #end
				#if($minute == 5) <option selected="selected" value="5">05</option> #else <option value="5">05</option> #end
				#if($minute == 10) <option selected="selected" value="10">10</option> #else <option value="10">10</option> #end
				#if($minute == 15) <option selected="selected" value="15">15</option> #else <option value="15">15</option> #end
				#if($minute == 20) <option selected="selected" value="20">20</option> #else <option value="20">20</option> #end
				#if($minute == 25) <option selected="selected" value="25">25</option> #else <option value="25">25</option> #end
				#if($minute == 30) <option selected="selected" value="30">30</option> #else <option value="30">30</option> #end 
				#if($minute == 35) <option selected="selected" value="35">35</option> #else <option value="35">35</option> #end
				#if($minute == 40) <option selected="selected" value="40">40</option> #else <option value="40">40</option> #end
				#if($minute == 45) <option selected="selected" value="45">45</option> #else <option value="45">45</option> #end
				#if($minute == 50) <option selected="selected" value="50">50</option> #else <option value="50">50</option> #end
				#if($minute == 55) <option selected="selected" value="55">55</option> #else <option value="55">55</option> #end
			</select>
		 
			<select name="${prefix}_ampm" id="${prefix}_ampm" onchange="ampmChange('${prefix}_ampm'); $!onChangeAction return false;">
				#if($timeType =="am") <option selected="selected">am</option> #else <option>am</option> #end
				#if($timeType =="pm") <option selected="selected">pm</option> #else <option>pm</option> #end
			</select>
#end

#############################################  start of getRightsAssignment macro
##
#macro(getRightsAssignment $rightsObj)
	<script type="text/javascript">
		var $!{rightsObj.name}_values = new Object();
		$!{rightsObj.name}_values.terms = "$!{rightsObj.terms}";
		$!{rightsObj.name}_values.myCopyrightYear = "#if("$!{rightsObj.myCopyrightYear}" == "")$!{rightsObj.defaultCopyrightYear}#else$!{rightsObj.myCopyrightYear}#end";
		$!{rightsObj.name}_values.myCopyrightOwner = "#if("$!{rightsObj.myCopyrightOwner}" == "")$!{rightsObj.defaultCopyrightOwner}#else$!{rightsObj.myCopyrightOwner}#end";
		$!{rightsObj.name}_values.otherCopyrightYear = "#if("$!{rightsObj.myCopyrightYear}" == "")$!{rightsObj.defaultCopyrightYear}#else$!{rightsObj.myCopyrightYear}#end";
		$!{rightsObj.name}_values.otherCopyrightOwner = "$!{rightsObj.otherCopyrightOwner}";
		$!{rightsObj.name}_values.offer = "$!{rightsObj.offer}";
		$!{rightsObj.name}_values.modifications = "$!{rightsObj.ccModifications}";
		$!{rightsObj.name}_values.commercialUse = "$!{rightsObj.ccCommercialUse}";
		$!{rightsObj.name}_values.otherModifications = "$!{rightsObj.otherModifications}";
		$!{rightsObj.name}_values.otherCommercialUse = "$!{rightsObj.otherCommercialUse}";
		
		function save_$!{rightsObj.name}_values()
		{
			var termsElementList = document.getElementsByName("$!{rightsObj.fieldNameTerms}");
			for(var i = 0; i < termsElementList.length; i++)
			{
				if(termsElementList[i] && termsElementList[i].checked)
				{
					$!{rightsObj.name}_values.terms = termsElementList[i].value;
				}
			}
			
			var myCopyrightYearElement = document.getElementById("$!{rightsObj.fieldNameMyCopyrightYear}");
			if(myCopyrightYearElement && myCopyrightYearElement.value)
			{
				$!{rightsObj.name}_values.myCopyrightYear = myCopyrightYearElement.value;
			}		
			var myCopyrightOwnerElement = document.getElementById("$!{rightsObj.fieldNameMyCopyrightOwner}");
			if(myCopyrightOwnerElement && myCopyrightOwnerElement.value)
			{
				$!{rightsObj.name}_values.myCopyrightOwner = myCopyrightOwnerElement.value;
			}		
			var otherCopyrightYearElement = document.getElementById("$!{rightsObj.fieldNameOtherCopyrightYear}");
			if(otherCopyrightYearElement && otherCopyrightYearElement.value)
			{
				$!{rightsObj.name}_values.otherCopyrightYear = otherCopyrightYearElement.value;
			}		
			var otherCopyrightOwnerElement = document.getElementById("$!{rightsObj.fieldNameOtherCopyrightOwner}");
			if(otherCopyrightOwnerElement && otherCopyrightOwnerElement.value)
			{
				$!{rightsObj.name}_values.otherCopyrightOwner = otherCopyrightOwnerElement.value;
			}		
			var offerElementList = document.getElementsByName("$!{rightsObj.fieldNameOffer}");
			if(offerElementList && offerElementList.length)
			{
				for(var i = 0; i < offerElementList.length; i++)
				{
					if(offerElementList[i] && offerElementList[i].checked)
					{
						$!{rightsObj.name}_values.offer = offerElementList[i].value;
					}
				}
			}		
			var commercialUseElementList = document.getElementsByName("$!{rightsObj.fieldNameCommercialUse}");
			if(commercialUseElementList && commercialUseElementList.length)
			{
				for(var i = 0; i < commercialUseElementList.length; i++)
				{
					if(commercialUseElementList[i] && commercialUseElementList[i].checked)
					{
						$!{rightsObj.name}_values.commercialUse = commercialUseElementList[i].value;
					}
				}
			}
			var modificationsElementList = document.getElementsByName("$!{rightsObj.fieldNameModifications}");
			if(modificationsElementList && modificationsElementList.length)
			{
				for(var i = 0; i < modificationsElementList.length; i++)
				{
					if(modificationsElementList[i] && modificationsElementList[i].checked)
					{
						$!{rightsObj.name}_values.modifications = modificationsElementList[i].value;
					}
				}
			}
			var otherCommercialUseElementList = document.getElementsByName("$!{rightsObj.fieldNameOtherCommercialUse}");
			if(otherCommercialUseElementList && otherCommercialUseElementList.length)
			{
				for(var i = 0; i < otherCommercialUseElementList.length; i++)
				{
					if(otherCommercialUseElementList[i] && otherCommercialUseElementList[i].checked)
					{
						$!{rightsObj.name}_values.otherCommercialUse = otherCommercialUseElementList[i].value;
					}
				}
			}
			var otherModificationsElementList = document.getElementsByName("$!{rightsObj.fieldNameOtherModifications}");
			if(otherModificationsElementList && otherModificationsElementList.length)
			{
				for(var i = 0; i < otherModificationsElementList.length; i++)
				{
					if(otherModificationsElementList[i] && otherModificationsElementList[i].checked)
					{
						$!{rightsObj.name}_values.otherModifications = otherModificationsElementList[i].value;
					}
				}
			}
		}
		
		function update$!{rightsObj.name}RightsAssignment()
		{
			save_$!{rightsObj.name}_values();
			
			var div0 = document.getElementById("rights_div_0_$!{rightsObj.name}");
			var div1 = document.getElementById("rights_div_1_$!{rightsObj.name}");
			var div2 = document.getElementById("rights_div_2_$!{rightsObj.name}");
			var div3 = document.getElementById("rights_div_3_$!{rightsObj.name}");
		
			var html0 = "&nbsp;";
			var html1 = "";
			var html2 = "";
			var html3 = "";
			var new_focus;
			
			if($!{rightsObj.name}_values.terms && $!{rightsObj.name}_values.terms == "$!{rightsObj.keyMyCopyright}")
			{
				html1 += "<table border=\"0\">\n<tr><td>&nbsp;</td>\n<td>&nbsp;</td>\n<td>&nbsp;</td>\n</tr>\n"
						+ "<tr>\n<td style=\"width:180px;padding-left:1em;vertical-align:top\">\n"
						+ "</td>\n<td style=\"padding-left:1em;vertical-align:top\">\n</td>\n<td style=\"vertical-align:top\">\n"
						+ "<label for=\"$!{rightsObj.fieldNameMyCopyrightYear}\">\n$!{rightsObj.labelMyCopyrightYear}\n</label>\n"
						+ "</td>\n<td style=\"vertical-align:top\">\n<label for=\"$!{rightsObj.fieldNameMyCopyrightOwner}\">\n"
						+ "$!{rightsObj.labelMyCopyrightOwner}\n</label>\n</td>\n</tr>\n<tr>\n"
						+ "<td style=\"width:180px;padding-left:1em;vertical-align:top\">\n</td>\n"
						+ "<td style=\"padding-left:1em;vertical-align:top\">&copy;</td>\n<td style=\"vertical-align:top\">\n" 
						+ "<input type=\"text\" name=\"$!{rightsObj.fieldNameMyCopyrightYear}\" "
						+ "id=\"$!{rightsObj.fieldNameMyCopyrightYear}\" size=\"5\" value=\""
						+ $!{rightsObj.name}_values.myCopyrightYear
						+ "\" />\n</td>\n<td style=\"vertical-align:top\">\n"
						+ "<input type=\"text\" name=\"$!{rightsObj.fieldNameMyCopyrightOwner}\" "
						+ "id=\"$!{rightsObj.fieldNameMyCopyrightOwner}\" size=\"40\" value=\""
						+ $!{rightsObj.name}_values.myCopyrightOwner
						+ "\" />\n</td>\n</tr>\n</table>\n";
				html2 += "<table border=\"0\">\n<tr><td>&nbsp;</td>\n<td>&nbsp;</td>\n<td>&nbsp;</td>\n</tr>\n"
						+ "<tr>\n<td style=\"width:180px;padding-left:1em;vertical-align:top\">\n"
						+ "</td>\n<td style=\"padding-left:1em;vertical-align:top\">\n"
						+ "<input type=\"radio\" name=\"$rightsObj.fieldNameOffer\" "
						+ "id=\"${rightsObj.fieldNameOffer}_${rightsObj.keyFairUse}\" value=\"${rightsObj.keyFairUse}\" "
						+ "onclick=\"javascript:update$!{rightsObj.name}RightsAssignment();\" ";
				if($!{rightsObj.name}_values.offer == "${rightsObj.keyFairUse}")
				{
					html2 += " checked=\"checked\" ";
				}
				html2 += " />\n</td>\n<td>\n$rightsObj.labelFairUse\n</td>\n</tr>\n<tr>\n"
						+ "<td style=\"width:180px;padding-left:1em;vertical-align:top\">\n"
						+ "</td>\n<td style=\"padding-left:1em;vertical-align:top\">\n"
						+ "<input type=\"radio\" name=\"$rightsObj.fieldNameOffer\" "
						+ "id=\"${rightsObj.fieldNameOffer}_${rightsObj.keyNewCreativeCommons}\" "
						+ "value=\"${rightsObj.keyNewCreativeCommons}\" "
						+ "onclick=\"javascript:update$!{rightsObj.name}RightsAssignment();\" ";
				if($!{rightsObj.name}_values.offer == "${rightsObj.keyNewCreativeCommons}")
				{
					html2 += " checked=\"checked\" ";
				}
				html2 += " />\n</td>\n<td>\n$rightsObj.labelNewCreativeCommons\n</td>\n</tr>\n<tr>\n"
						+ "<td style=\"width:180px;padding-left:1em;vertical-align:top\">\n"
						+ "</td>\n<td style=\"padding-left:1em;vertical-align:top\">\n"
						+ "<input type=\"radio\" name=\"$rightsObj.fieldNameOffer\" "
						+ "id=\"${rightsObj.fieldNameOffer}_${rightsObj.keyNewPublicDomain}\" "
						+ "value=\"${rightsObj.keyNewPublicDomain}\" "
						+ "onclick=\"javascript:update$!{rightsObj.name}RightsAssignment();\" ";
				if($!{rightsObj.name}_values.offer == "${rightsObj.keyNewPublicDomain}")
				{
					html2 += " checked=\"checked\" ";
				}
				html2 += " />\n</td>\n<td>\n$rightsObj.labelNewPublicDomain\n</td>\n</tr>\n</table>\n";
				if($!{rightsObj.name}_values.offer == "${rightsObj.keyNewCreativeCommons}")
				{
					html3 += "<table border=\"0\">\n<tr>\n<td>&nbsp;</td>\n<td>&nbsp;</td>\n<td>&nbsp;</td>\n</tr>\n"
							+ "<tr>\n<td style=\"width:180px;padding-left:1em;vertical-align:top\">\n</td>\n"
							+ "<td style=\"padding-left:1em;vertical-align:top\" colspan=\"2\">"
							+ "$rightsObj.labelCommercialUse\n</td>\n</tr>\n<tr>\n"
							+ "<td style=\"width:180px;padding-left:1em;vertical-align:top\">\n</td>\n"
							+ "<td style=\"padding-left:1em;vertical-align:top\">\n"
							+ "<input type=\"radio\" name=\"$rightsObj.fieldNameCommercialUse\" "
							+ "id=\"${rightsObj.fieldNameCommercialUse}_${rightsObj.keyYes}\" value=\"${rightsObj.keyYes}\" ";
					if($!{rightsObj.name}_values.commercialUse == "${rightsObj.keyYes}")
					{
						html3 += " checked=\"checked\" ";
					}
					html3 += " />\n</td>\n<td style=\"vertical-align:top\">\n"
							+ "<label for=\"${rightsObj.fieldNameCommercialUse}_${rightsObj.keyYes}\">\n"
							+ "$rightsObj.labelCommercialUseYes\n</label>\n</td>\n</tr>\n"
							+ "<tr>\n<td style=\"width:180px;padding-left:1em;vertical-align:top\">\n</td>\n"
							+ "<td style=\"padding-left:1em;vertical-align:top\">\n"
							+ "<input type=\"radio\" name=\"$rightsObj.fieldNameCommercialUse\" "
							+ "id=\"${rightsObj.fieldNameCommercialUse}_${rightsObj.keyNo}\" value=\"${rightsObj.keyNo}\" ";
					if($!{rightsObj.name}_values.commercialUse == "${rightsObj.keyNo}")
					{
						html3 += " checked=\"checked\" ";
					}
					html3 += " />\n</td>\n<td style=\"vertical-align:top\">\n"
							+ "<label for=\"${rightsObj.fieldNameCommercialUse}_${rightsObj.keyNo}\">\n"
							+ "$rightsObj.labelCommercialUseNo\n</label>\n</td>\n</tr>\n"
							+ "<tr>\n<td>&nbsp;</td>\n<td>&nbsp;</td>\n<td>&nbsp;</td>\n</tr>\n"
							+ "<tr>\n<td style=\"width:180px;padding-left:1em;vertical-align:top\">\n</td>\n"
							+ "<td style=\"padding-left:1em;vertical-align:top\" colspan=\"2\">"
							+ "$rightsObj.labelModifications</td>\n</tr>\n"
							+ "<tr>\n<td style=\"width:180px;padding-left:1em;vertical-align:top\">\n</td>\n"
							+ "<td style=\"padding-left:1em;vertical-align:top\">\n"
							+ "<input type=\"radio\" name=\"$rightsObj.fieldNameModifications\" "
							+ "id=\"${rightsObj.fieldNameModifications}_${rightsObj.keyYes}\" value=\"${rightsObj.keyYes}\" ";
					if($!{rightsObj.name}_values.modifications == "${rightsObj.keyYes}")
					{
						html3 += " checked=\"checked\" ";
					}
					html3 += " />\n</td>\n<td style=\"vertical-align:top\" colspan=\"2\">\n"
							+ "<label for=\"${rightsObj.fieldNameModifications}_${rightsObj.keyYes}\">\n"
							+ "$rightsObj.labelModificationsYes\n</label>\n</td>\n</tr>\n"
							+ "<tr>\n<td style=\"width:180px;padding-left:1em;vertical-align:top\">\n</td>\n"
							+ "<td style=\"padding-left:1em;vertical-align:top\">\n"
							+ "<input type=\"radio\" name=\"$rightsObj.fieldNameModifications\" "
							+ "id=\"${rightsObj.fieldNameModifications}_${rightsObj.keyShareAlike}\" value=\"${rightsObj.keyShareAlike}\" ";
					if($!{rightsObj.name}_values.modifications == "${rightsObj.keyShareAlike}")
					{
						html3 += " checked=\"checked\" ";
					}
					html3 += " />\n</td>\n<td style=\"vertical-align:top\" colspan=\"2\">\n"
							+ "<label for=\"${rightsObj.fieldNameModifications}_${rightsObj.keyShareAlike}\">\n"
							+ "$rightsObj.labelModificationsShareAlike\n</label>\n</td>\n</tr>\n"
							+ "<tr>\n<td style=\"width:180px;padding-left:1em;vertical-align:top\">\n</td>\n"
							+ "<td style=\"padding-left:1em;vertical-align:top\">\n"
							+ "<input type=\"radio\" name=\"$rightsObj.fieldNameModifications\" "
							+ "id=\"${rightsObj.fieldNameModifications}_${rightsObj.keyNo}\" value=\"${rightsObj.keyNo}\" ";
					if($!{rightsObj.name}_values.modifications == "${rightsObj.keyNo}")
					{
						html3 += " checked=\"checked\" ";
					}
					html3 += " />\n</td>\n<td style=\"vertical-align:top\" colspan=\"2\">\n"
							+ "<label for=\"${rightsObj.fieldNameModifications}_${rightsObj.keyNo}\">\n"
							+ "$rightsObj.labelModificationsNo\n</label>\n</td>\n</tr>\n</table>\n"
				}
				
				new_focus = "$!{rightsObj.fieldNameMyCopyrightYear}";
			}
			else if($!{rightsObj.name}_values.terms && $!{rightsObj.name}_values.terms == "$!{rightsObj.keyOtherCopyright}")
			{
				html1 += "<table border=\"0\">\n<tr><td>&nbsp;</td>\n<td>&nbsp;</td>\n<td>&nbsp;</td>\n</tr>\n"
						+ "<tr>\n<td style=\"width:180px;padding-left:1em;vertical-align:top\">\n"
						+ "</td>\n<td style=\"padding-left:1em;vertical-align:top\">\n</td>\n<td style=\"vertical-align:top\">\n"
						+ "<label for=\"$!{rightsObj.fieldNameOtherCopyrightYear}\">\n$!{rightsObj.labelOtherCopyrightYear}\n</label>\n"
						+ "</td>\n<td style=\"vertical-align:top\">\n<label for=\"$!{rightsObj.fieldNameOtherCopyrightOwner}\">\n"
						+ "$!{rightsObj.labelOtherCopyrightOwner}\n</label>\n</td>\n</tr>\n"
						+ "<tr>\n<td style=\"width:180px;padding-left:1em;vertical-align:top\">\n</td>\n"
						+ "<td style=\"padding-left:1em;vertical-align:top\">&copy;</td>\n<td style=\"vertical-align:top\">\n" 
						+ "<input type=\"text\" name=\"$!{rightsObj.fieldNameOtherCopyrightYear}\" "
						+ "id=\"$!{rightsObj.fieldNameOtherCopyrightYear}\" size=\"5\" value=\""
						+ $!{rightsObj.name}_values.otherCopyrightYear
						+ "\" />\n</td>\n<td style=\"vertical-align:top\">\n"
						+ "<input type=\"text\" name=\"$!{rightsObj.fieldNameOtherCopyrightOwner}\" "
						+ "id=\"$!{rightsObj.fieldNameOtherCopyrightOwner}\" size=\"40\" value=\""
						+ $!{rightsObj.name}_values.otherCopyrightOwner
						+ "\" />\n</td>\n</tr>\n</table>\n";
				html2 += "Other Copyright -- Div 2";
				//html3 += "Other Copyright -- Div 3";
				new_focus = "$!{rightsObj.fieldNameOtherCopyrightYear}";
				
			}
			else if($!{rightsObj.name}_values.terms && $!{rightsObj.name}_values.terms == "$!{rightsObj.keyPublicDomain}")
			{
				//html1 += "Public Domain -- Div 1";
				//html2 += "Public Domain -- Div 2";
				//html3 += "Public Domain -- Div 3";
			}
			else if($!{rightsObj.name}_values.terms && $!{rightsObj.name}_values.terms == "$!{rightsObj.keyCreativeCommons}")
			{
				html1 += "<table border=\"0\">\n<tr>\n<td>&nbsp;</td>\n<td>&nbsp;</td>\n<td>&nbsp;</td>\n</tr>\n"
						+ "<tr>\n<td style=\"width:180px;padding-left:1em;vertical-align:top\">\n</td>\n"
						+ "<td style=\"padding-left:1em;vertical-align:top\" colspan=\"2\">"
						+ "$rightsObj.labelOtherCommercialUse\n</td>\n</tr>\n<tr>\n"
						+ "<td style=\"width:180px;padding-left:1em;vertical-align:top\">\n</td>\n"
						+ "<td style=\"padding-left:1em;vertical-align:top\">\n"
						+ "<input type=\"radio\" name=\"$rightsObj.fieldNameOtherCommercialUse\" "
						+ "id=\"${rightsObj.fieldNameOtherCommercialUse}_${rightsObj.keyYes}\" value=\"${rightsObj.keyYes}\" ";
				if($!{rightsObj.name}_values.otherCommercialUse == "${rightsObj.keyYes}")
				{
					html1 += " checked=\"checked\" ";
				}
				html1 += " />\n</td>\n<td style=\"vertical-align:top\">\n"
						+ "<label for=\"${rightsObj.fieldNameOtherCommercialUse}_${rightsObj.keyYes}\">\n"
						+ "$rightsObj.labelOtherCommercialUseYes\n</label>\n</td>\n</tr>\n"
						+ "<tr>\n<td style=\"width:180px;padding-left:1em;vertical-align:top\">\n</td>\n"
						+ "<td style=\"padding-left:1em;vertical-align:top\">\n"
						+ "<input type=\"radio\" name=\"$rightsObj.fieldNameOtherCommercialUse\" "
						+ "id=\"${rightsObj.fieldNameOtherCommercialUse}_${rightsObj.keyNo}\" value=\"${rightsObj.keyNo}\" ";
				if($!{rightsObj.name}_values.otherCommercialUse == "${rightsObj.keyNo}")
				{
					html1 += " checked=\"checked\" ";
				}
				html1 += " />\n</td>\n<td style=\"vertical-align:top\">\n"
						+ "<label for=\"${rightsObj.fieldNameOtherCommercialUse}_${rightsObj.keyNo}\">\n"
						+ "$rightsObj.labelOtherCommercialUseNo\n</label>\n</td>\n</tr>\n"
						+ "<tr>\n<td>&nbsp;</td>\n<td>&nbsp;</td>\n<td>&nbsp;</td>\n</tr>\n"
						+ "<tr>\n<td style=\"width:180px;padding-left:1em;vertical-align:top\">\n</td>\n"
						+ "<td style=\"padding-left:1em;vertical-align:top\" colspan=\"2\">"
						+ "$rightsObj.labelOtherModifications</td>\n</tr>\n"
						+ "<tr>\n<td style=\"width:180px;padding-left:1em;vertical-align:top\">\n</td>\n"
						+ "<td style=\"padding-left:1em;vertical-align:top\">\n"
						+ "<input type=\"radio\" name=\"$rightsObj.fieldNameOtherModifications\" "
						+ "id=\"${rightsObj.fieldNameOtherModifications}_${rightsObj.keyYes}\" value=\"${rightsObj.keyYes}\" ";
				if($!{rightsObj.name}_values.otherModifications == "${rightsObj.keyYes}")
				{
					html1 += " checked=\"checked\" ";
				}
				html1 += " />\n</td>\n<td style=\"vertical-align:top\" colspan=\"2\">\n"
						+ "<label for=\"${rightsObj.fieldNameOtherModifications}_${rightsObj.keyYes}\">\n"
						+ "$rightsObj.labelOtherModificationsYes\n</label>\n</td>\n</tr>\n"
						+ "<tr>\n<td style=\"width:180px;padding-left:1em;vertical-align:top\">\n</td>\n"
						+ "<td style=\"padding-left:1em;vertical-align:top\">\n"
						+ "<input type=\"radio\" name=\"$rightsObj.fieldNameOtherModifications\" "
						+ "id=\"${rightsObj.fieldNameOtherModifications}_${rightsObj.keyShareAlike}\" value=\"${rightsObj.keyShareAlike}\" ";
				if($!{rightsObj.name}_values.otherModifications == "${rightsObj.keyShareAlike}")
				{
					html1 += " checked=\"checked\" ";
				}
				html1 += " />\n</td>\n<td style=\"vertical-align:top\" colspan=\"2\">\n"
						+ "<label for=\"${rightsObj.fieldNameOtherModifications}_${rightsObj.keyShareAlike}\">\n"
						+ "$rightsObj.labelOtherModificationsShareAlike\n</label>\n</td>\n</tr>\n"
						+ "<tr>\n<td style=\"width:180px;padding-left:1em;vertical-align:top\">\n</td>\n"
						+ "<td style=\"padding-left:1em;vertical-align:top\">\n"
						+ "<input type=\"radio\" name=\"$rightsObj.fieldNameOtherModifications\" "
						+ "id=\"${rightsObj.fieldNameOtherModifications}_${rightsObj.keyNo}\" value=\"${rightsObj.keyNo}\" ";
				if($!{rightsObj.name}_values.otherModifications == "${rightsObj.keyNo}")
				{
					html1 += " checked=\"checked\" ";
				}
				html1 += " />\n</td>\n<td style=\"vertical-align:top\" colspan=\"2\">\n"
						+ "<label for=\"${rightsObj.fieldNameOtherModifications}_${rightsObj.keyNo}\">\n"
						+ "$rightsObj.labelOtherModificationsNo\n</label>\n</td>\n</tr>\n</table>\n"
			}
				
			div0.innerHTML = html0;
			div1.innerHTML = html1;
			div2.innerHTML = html2;
			div3.innerHTML = html3;
			
			if(new_focus)
			{
				var focus_element = document.getElementById(new_focus);
				if(focus_element)
				{
					focus_element.focus();
					focus_element.select();
				}
			}
		}
		function show_info_$!{rightsObj.name}(topic)
		{
			var div0 = document.getElementById("rights_div_0_$!{rightsObj.name}");
			var html0 = "";
			if(topic == "$!{rightsObj.keyMyCopyright}")
			{
				html0 = "<table border=\"0\">\n<tr>\n<td style=\"width:180px;padding-left:1em;vertical-align:top\">"
						+ "&nbsp;</td>\n<td>$rightsObj.titleMyCopyright"
						+ "(<a href=\"#\" onclick=\"javascript:show_info_$!{rightsObj.name}('done')\">$rightsObj.labelDone</a>)"
						+ "</td>\n</tr>\n<tr>\n<td></td>\n<td>$rightsObj.infoMyCopyright</td>\n</tr>\n</table>";
			}		
			else if(topic == "$!{rightsObj.keyOtherCopyright}")
			{
				html0 = "<table border=\"0\">\n<tr>\n<td style=\"width:180px;padding-left:1em;vertical-align:top\">"
						+ "&nbsp;</td>\n<td>$rightsObj.titleOtherCopyright"
						+ "(<a href=\"#\" onclick=\"javascript:show_info_$!{rightsObj.name}('done')\">$rightsObj.labelDone</a>)"
						+ "</td>\n</tr>\n<tr>\n<td></td>\n<td>$rightsObj.infoOtherCopyright</td>\n</tr>\n</table>";
			}		
			else if(topic == "$!{rightsObj.keyCreativeCommons}")
			{
				html0 = "<table border=\"0\">\n<tr>\n<td style=\"width:180px;padding-left:1em;vertical-align:top\">"
						+ "&nbsp;</td>\n<td>$rightsObj.titleCreativeCommons"
						+ "(<a href=\"#\" onclick=\"javascript:show_info_$!{rightsObj.name}('done')\">$rightsObj.labelDone</a>)"
						+ "</td>\n</tr>\n<tr>\n<td></td>\n<td>$rightsObj.infoCreativeCommons</td>\n</tr>\n</table>";
			}		
			else if(topic == "$!{rightsObj.keyPublicDomain}")
			{
				html0 = "<table border=\"0\">\n<tr>\n<td style=\"width:180px;padding-left:1em;vertical-align:top\">"
						+ "&nbsp;</td>\n<td>$rightsObj.titlePublicDomain"
						+ "(<a href=\"#\" onclick=\"javascript:show_info_$!{rightsObj.name}('done')\">$rightsObj.labelDone</a>)"
						+ "</td>\n</tr>\n<tr>\n<td></td>\n<td>$rightsObj.infoPublicDomain</td>\n</tr>\n</table>";
			}
			div0.innerHTML = html0;		
		}
	</script>

	<p class="shorttext">
		<span class="reqStar">*</span>
		<label for="$rightsObj.fieldNameTerms">
			$rightsObj.labelTerms
		</label>
		<table border="0">
			#foreach($key in $rightsObj.keylistTerms)
				<tr>
					<td>
						<input type="radio" name="$rightsObj.fieldNameTerms" id="${rightsObj.fieldNameTerms}_$key" value="$key" 
							#if("$!{rightsObj.terms}" == "$key")checked="checked" #end
							onclick="javascript:update$!{rightsObj.name}RightsAssignment();"
							onkeypress="javascript:update$!{rightsObj.name}RightsAssignment();" />
					</td>
					<td>
						$rightsObj.getString("terms.$key") 
						(<a href="#" onclick="javascript:show_info_$!{rightsObj.name}('$key')">$rightsObj.labelMoreInfo</a>)
					</td>
				</tr>
			#end
		</table>
	</p>
	<div id="rights_div_0_$!{rightsObj.name}">
	</div>
	<div id="rights_div_1_$!{rightsObj.name}">
		#if("$!{rightsObj.terms}" == "$!{rightsObj.keyMyCopyright}")
			<table border="0"> 
				<tr>
					<td>&nbsp;</td>
					<td>&nbsp;</td>
					<td>&nbsp;</td>
					<td>&nbsp;</td>
				</tr>
				<tr> 
					<td style="width:180px;padding-left:1em;vertical-align:top"> 
					</td>
					<td> 
					</td> 
					<td style="vertical-align:top"> 
						<label for="$!{rightsObj.fieldNameMyCopyrightYear}">
							$!{rightsObj.labelMyCopyrightYear}
						</label> 
					</td>
					<td style="vertical-align:top"> 
						<label for="$!{rightsObj.fieldNameMyCopyrightOwner}">
							$!{rightsObj.labelMyCopyrightOwner}
						</label> 
					</td> 
				</tr>
				<tr> 
					<td style="width:180px;padding-left:1em;vertical-align:top"> 
					</td> 
					<td>&copy;</td>
					<td style="vertical-align:top"> 
						<input type="text" name="$!{rightsObj.fieldNameMyCopyrightYear}" id="$!{rightsObj.fieldNameMyCopyrightYear}" size="5" value="#if("$!{rightsObj.myCopyrightYear}" == "")$!{rightsObj.defaultCopyrightYear}#else$!{rightsObj.myCopyrightYear}#end" /> 
					</td> 
					<td style="vertical-align:top"> 
						<input type="text" name="$!{rightsObj.fieldNameMyCopyrightOwner}" id="$!{rightsObj.fieldNameMyCopyrightOwner}" size="40" value="#if("$!{rightsObj.myCopyrightOwner}" == "")$!{rightsObj.defaultCopyrightOwner}#else$!{rightsObj.myCopyrightOwner}#end" /> 
					</td> 
				</tr> 
			</table>
		#elseif("$!{rightsObj.terms}" == "$!{rightsObj.keyOtherCopyright}")
			<table border="0"> 
				<tr>
					<td>&nbsp;</td>
					<td>&nbsp;</td>
					<td>&nbsp;</td>
					<td>&nbsp;</td>
				</tr>
				<tr> 
					<td style="width:180px;padding-left:1em;vertical-align:top"> 
					</td>
					<td> 
					</td> 
					<td style="padding-left:1em;vertical-align:top"> 
						<label for="$!{rightsObj.fieldNameOtherCopyrightYear}">
							$!{rightsObj.labelOtherCopyrightYear}
						</label> 
					</td>
					<td style="vertical-align:top"> 
						<label for="$!{rightsObj.fieldNameOtherCopyrightOwner}">
							$!{rightsObj.labelOtherCopyrightOwner}
						</label> 
					</td> 
				</tr>
				<tr> 
					<td style="width:180px;padding-left:1em;vertical-align:top"> 
					</td> 
					<td style="padding-left:1em;vertical-align:top">&copy;</td>
					<td style="vertical-align:top"> 
						<input type="text" name="$!{rightsObj.fieldNameOtherCopyrightYear}" id="$!{rightsObj.fieldNameOtherCopyrightYear}" size="5" value="#if("$!{rightsObj.otherCopyrightYear}" == "")$!{rightsObj.defaultCopyrightYear}#else$!{rightsObj.otherCopyrightYear}#end" /> 
					</td> 
					<td style="vertical-align:top"> 
						<input type="text" name="$!{rightsObj.fieldNameOtherCopyrightOwner}" id="$!{rightsObj.fieldNameOtherCopyrightOwner}" size="40" value="#if("$!{rightsObj.otherCopyrightOwner}" == "")$!{rightsObj.defaultCopyrightOwner}#else$!{rightsObj.otherCopyrightOwner}#end" /> 
					</td> 
				</tr> 
			</table>
		#elseif("$!{rightsObj.terms}" == "$!{rightsObj.keyPublicDomain}")
			<p class="shorttext"> 
				<span class="reqStar">*</span>
				Public Domain
			</p> 
		#elseif("$!{rightsObj.terms}" == "$!{rightsObj.keyCreativeCommons}")
			<table border="0">
				<tr>
					<td>&nbsp;</td>
					<td>&nbsp;</td>
					<td>&nbsp;</td>
				</tr>
				<tr>
					<td style="width:180px;padding-left:1em;vertical-align:top">
					</td>
					<td style="padding-left:1em;vertical-align:top" colspan="2">
						$rightsObj.labelOtherCommercialUse
					</td>
				</tr>
				<tr>
					<td style="width:180px;padding-left:1em;vertical-align:top">
					</td>
					<td style="padding-left:1em;vertical-align:top">
						<input type="radio" name="$rightsObj.fieldNameOtherCommercialUse" 
							id="${rightsObj.fieldNameOtherCommercialUse}_${rightsObj.keyYes}" 
							value="${rightsObj.keyYes}" 
							#if("$!{rightsObj.otherCommercialUse}" == "${rightsObj.keyYes}")checked="checked" #end />
					</td>
					<td style="vertical-align:top">
						<label for="${rightsObj.fieldNameOtherCommercialUse}_${rightsObj.keyYes}">
							$rightsObj.labelOtherCommercialUseYes
						</label>
					</td>
				</tr>
				<tr>
					<td style="width:180px;padding-left:1em;vertical-align:top">
					</td>
					<td style="padding-left:1em;vertical-align:top">
						<input type="radio" name="$rightsObj.fieldNameOtherCommercialUse" 
							id="${rightsObj.fieldNameOtherCommercialUse}_${rightsObj.keyNo}" 
							value="${rightsObj.keyNo}" 
							#if("$!{rightsObj.otherCommercialUse}" == "${rightsObj.keyNo}")checked="checked" #end />
					</td>
					<td style="vertical-align:top">
						<label for="${rightsObj.fieldNameOtherCommercialUse}_${rightsObj.keyNo}">
							$rightsObj.labelCommercialUseNo
						</label>
					</td>
				</tr>
				<tr>
					<td>&nbsp;</td>
					<td>&nbsp;</td>
					<td>&nbsp;</td>
				</tr>
				<tr>
					<td style="width:180px;padding-left:1em;vertical-align:top">
					</td>
					<td style="padding-left:1em;vertical-align:top" colspan="2">
						$rightsObj.labelOtherModifications
					</td>
				</tr>
				<tr>
					<td style="width:180px;padding-left:1em;vertical-align:top">
					</td>
					<td style="padding-left:1em;vertical-align:top">
						<input type="radio" name="$rightsObj.fieldNameOtherModifications" id="${rightsObj.fieldNameOtherModifications}_${rightsObj.keyYes}" 
							value="${rightsObj.keyYes}" 
							#if("$!{rightsObj.otherModifications}" == "${rightsObj.keyYes}")checked="checked" #end />
					</td>
					<td style="vertical-align:top">
						<label for="${rightsObj.fieldNameOtherModifications}_${rightsObj.keyYes}">
							$rightsObj.labelOtherModificationsYes
						</label>
					</td>
				</tr>
				<tr>
					<td style="width:180px;padding-left:1em;vertical-align:top">
					</td>
					<td style="padding-left:1em;vertical-align:top">
						<input type="radio" name="$rightsObj.fieldNameOtherModifications" id="${rightsObj.fieldNameOtherModifications}_${rightsObj.keyShareAlike}" 
							value="${rightsObj.keyShareAlike}" 
							#if("$!{rightsObj.otherModifications}" == "${rightsObj.keyShareAlike}")checked="checked" #end />
					</td>
					<td style="vertical-align:top">
						<label for="${rightsObj.fieldNameOtherModifications}_${rightsObj.keyShareAlike}">
							$rightsObj.labelOtherModificationsShareAlike
						</label>
					</td>
				</tr>
				<tr>
					<td style="width:180px;padding-left:1em;vertical-align:top">
					</td>
					<td style="padding-left:1em;vertical-align:top">
						<input type="radio" name="$rightsObj.fieldNameOtherModifications" id="${rightsObj.fieldNameOtherModifications}_${rightsObj.keyNo}" 
							value="${rightsObj.keyNo}" 
							#if("$!{rightsObj.otherModifications}" == "${rightsObj.keyNo}")checked="checked" #end />
					</td>
					<td style="vertical-align:top">
						<label for="${rightsObj.fieldNameOtherModifications}_${rightsObj.keyNo}">
							$rightsObj.labelOtherModificationsNo
						</label>
					</td>
				</tr>
			</table>
		#end
	</div>
	<div id="rights_div_2_$!{rightsObj.name}">
		#if("$!{rightsObj.terms}" == "$!{rightsObj.keyMyCopyright}")
			<table border="0">
				<tr>
					<td>&nbsp;</td>
					<td>&nbsp;</td>
					<td>&nbsp;</td>
				</tr>
				<tr>
					<td style="width:180px;padding-left:1em;vertical-align:top">
					</td>
					<td style="padding-left:1em;vertical-align:top">
						<input type="radio" name="$rightsObj.fieldNameOffer" id="${rightsObj.fieldNameOffer}_${rightsObj.keyFairUse}" 
							value="${rightsObj.keyFairUse}" 
							onclick="javascript:update$!{rightsObj.name}RightsAssignment();"
							#if("$!{rightsObj.offer}" == "${rightsObj.keyFairUse}")checked="checked" #end />
					</td>
					<td>
						<label for="${rightsObj.fieldNameOffer}_${rightsObj.keyFairUse}">
							$rightsObj.labelFairUse
						</label>
					</td>
				</tr>
				<tr>
					<td style="width:180px;padding-left:1em;vertical-align:top">
					</td>
					<td style="padding-left:1em;vertical-align:top">
						<input type="radio" name="$rightsObj.fieldNameOffer" id="${rightsObj.fieldNameOffer}_${rightsObj.keyNewCreativeCommons}" 
							value="${rightsObj.keyNewCreativeCommons}" 
							onclick="javascript:update$!{rightsObj.name}RightsAssignment();"
							#if("$!{rightsObj.offer}" == "${rightsObj.keyNewCreativeCommons}")checked="checked" #end />
					</td>
					<td>
						<label for="${rightsObj.fieldNameOffer}_${rightsObj.keyNewCreativeCommons}">
							$rightsObj.labelNewCreativeCommons
						</label>
					</td>
				</tr>
				<tr>
					<td style="width:180px;padding-left:1em;vertical-align:top">
					</td>
					<td style="padding-left:1em;vertical-align:top">
						<input type="radio" name="$rightsObj.fieldNameOffer" id="${rightsObj.fieldNameOffer}_${rightsObj.keyNewPublicDomain}" 
							value="${rightsObj.keyNewPublicDomain}" 
							onclick="javascript:update$!{rightsObj.name}RightsAssignment();"
							#if("$!{rightsObj.offer}" == "${rightsObj.keyNewPublicDomain}")checked="checked" #end />
					</td>
					<td>
						<label for="${rightsObj.fieldNameOffer}_${rightsObj.keyNewPublicDomain}">
							$rightsObj.labelNewPublicDomain
						</label>
					</td>
				</tr>
			</table>
		#end
	</div>
	<div id="rights_div_3_$!{rightsObj.name}">
		#if("$!{rightsObj.terms}" == "$!{rightsObj.keyMyCopyright}")
			#if("$!{rightsObj.offer}" == "$!{rightsObj.keyNewCreativeCommons}")
				<table border="0">
					<tr>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
					</tr>
					<tr>
						<td style="width:180px;padding-left:1em;vertical-align:top">
						</td>
						<td style="padding-left:1em;vertical-align:top" colspan="2">
							$rightsObj.labelCommercialUse
						</td>
					</tr>
					<tr>
						<td style="width:180px;padding-left:1em;vertical-align:top">
						</td>
						<td style="padding-left:1em;vertical-align:top">
							<input type="radio" name="$rightsObj.fieldNameCommercialUse" 
								id="${rightsObj.fieldNameCommercialUse}_${rightsObj.keyYes}" 
								value="${rightsObj.keyYes}" 
								#if("$!{rightsObj.ccCommercialUse}" == "${rightsObj.keyYes}")checked="checked" #end />
						</td>
						<td style="vertical-align:top">
							<label for="${rightsObj.fieldNameCommercialUse}_${rightsObj.keyYes}">
								$rightsObj.labelCommercialUseYes
							</label>
						</td>
					</tr>
					<tr>
						<td style="width:180px;padding-left:1em;vertical-align:top">
						</td>
						<td style="padding-left:1em;vertical-align:top">
							<input type="radio" name="$rightsObj.fieldNameCommercialUse" 
								id="${rightsObj.fieldNameCommercialUse}_${rightsObj.keyNo}" 
								value="${rightsObj.keyNo}" 
								#if("$!{rightsObj.ccCommercialUse}" == "${rightsObj.keyNo}")checked="checked" #end />
						</td>
						<td style="vertical-align:top">
							<label for="${rightsObj.fieldNameCommercialUse}_${rightsObj.keyNo}">
								$rightsObj.labelCommercialUseNo
							</label>
						</td>
					</tr>
					<tr>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
					</tr>
					<tr>
						<td style="width:180px;padding-left:1em;vertical-align:top">
						</td>
						<td style="padding-left:1em;vertical-align:top" colspan="2">
							$rightsObj.labelModifications
						</td>
					</tr>
					<tr>
						<td style="width:180px;padding-left:1em;vertical-align:top">
						</td>
						<td style="padding-left:1em;vertical-align:top">
							<input type="radio" name="$rightsObj.fieldNameModifications" id="${rightsObj.fieldNameModifications}_${rightsObj.keyYes}" 
								value="${rightsObj.keyYes}" 
								#if("$!{rightsObj.ccModifications}" == "${rightsObj.keyYes}")checked="checked" #end />
						</td>
						<td style="vertical-align:top">
							<label for="${rightsObj.fieldNameModifications}_${rightsObj.keyYes}">
								$rightsObj.labelModificationsYes
							</label>
						</td>
					</tr>
					<tr>
						<td style="width:180px;padding-left:1em;vertical-align:top">
						</td>
						<td style="padding-left:1em;vertical-align:top">
							<input type="radio" name="$rightsObj.fieldNameModifications" id="${rightsObj.fieldNameModifications}_${rightsObj.keyShareAlike}" 
								value="${rightsObj.keyShareAlike}" 
								#if("$!{rightsObj.ccModifications}" == "${rightsObj.keyShareAlike}")checked="checked" #end />
						</td>
						<td style="vertical-align:top">
							<label for="${rightsObj.fieldNameModifications}_${rightsObj.keyShareAlike}">
								$rightsObj.labelModificationsShareAlike
							</label>
						</td>
					</tr>
					<tr>
						<td style="width:180px;padding-left:1em;vertical-align:top">
						</td>
						<td style="padding-left:1em;vertical-align:top">
							<input type="radio" name="$rightsObj.fieldNameModifications" id="${rightsObj.fieldNameModifications}_${rightsObj.keyNo}" 
								value="${rightsObj.keyNo}" 
								#if("$!{rightsObj.ccModifications}" == "${rightsObj.keyNo}")checked="checked" #end />
						</td>
						<td style="vertical-align:top">
							<label for="${rightsObj.fieldNameModifications}_${rightsObj.keyNo}">
								$rightsObj.labelModificationsNo
							</label>
						</td>
					</tr>
				</table>
					
			#end
		#end
	</div>
#end 
## end of getRightsAssignment macro

############################################# macro getPropertyValues 
##
#macro(getPropertyValues $tags)
	#foreach($tag in $tags)
		#if($tag && $tag.label && "$!{tag.label}" != "")
			#set($indent = "")
			#if($tag.depth > 0)
				#set($indent = " indnt$!{tag.depth}")
			#end
			#if("$!NESTED" == "$!tag.widget")
				<div class="fakelabel$!{indent}">
					#if($tag.minCardinality > 0)<span class="reqStar">*</span>#end
					$tag.label
					#if($tag.canAddInstances())
						[<a href="#" onclick="javascript: document.getElementById('flow').value='addInstance'; document.getElementById('field').value='$!{tag.dottedname}'; submitform('createForm'); return false;" onkeypress="javascript: document.getElementById('flow').value='addInstance'; document.getElementById('field').value='$!{tag.dottedname}'; submitform('createForm'); return false;"  title="$tlang.getString("gen.add") $tag.label">+</a>]
					#end
					<input type="hidden"
						name="$!{tag.dottedname}" 
						id="$validator.escapeJavascript("$!{tag.dottedname}")" 
						value="" />
				</div>
			#else
				<div class="shorttext$!{indent}">
					<label for ="$validator.escapeJavascript("$!{tag.dottedname}")">
						#if($tag.minCardinality > 0)<span class="reqStar">*</span>#end
						$tag.label
						#if($tag.canAddInstances())
							[<a href="#" onclick="javascript: document.getElementById('flow').value='addInstance'; document.getElementById('field').value='$!{tag.dottedname}'; submitform('createForm'); return false;" onkeypress="javascript: document.getElementById('flow').value='addInstance'; document.getElementById('field').value='$!{tag.dottedname}'; submitform('createForm'); return false;"  title="$tlang.getString("gen.add") $tag.label">+</a>]
						#end
					</label>
					#if("$!tag.widget" == "$!STRING")
						<input type="text" size="$!{tag.length}"
							name="$!{tag.dottedname}" 
							id="$validator.escapeJavascript("$!{tag.dottedname}")" 
							value="$!{tag.value}" />
					#elseif("$!tag.widget" == "$!TEXTAREA")
						<textarea rows="4" cols="60" 
							name="$!{tag.dottedname}" 
							id="$validator.escapeJavascript("$!{tag.dottedname}")" >$validator.escapeHtmlTextarea($!{tag.value})</textarea>
					#elseif("$!tag.widget" == "$!WYSIWYG")
						<table><tr><td>
						<textarea rows="30" cols="80" 
							name="$!{tag.dottedname}" 
							id="$validator.escapeJavascript("$!{tag.dottedname}")" >$validator.escapeHtmlTextarea($!{tag.value}) </textarea>
						#chef_setupformattedtextarea("$validator.escapeJavascript($!{tag.dottedname})")
						</td></tr></table>
					#elseif("$!tag.widget" == "$!DATE")
						<input type="hidden" id="$validator.escapeJavascript("$!{tag.dottedname}")" value="" />
						#if($!{tag.value})
							#set($theValue = $!{tag.value})
						#else
							#set($theValue = $today)
						#end 
						#prop_dateSelectionWidget("${tag.dottedname}" $theValue)
					#elseif("$!tag.widget" == "$!DATETIME")
						<input type="hidden" id="$validator.escapeJavascript("$!{tag.dottedname}")" value="" />
						#if($!{tag.value})
							#set($theValue = $!{tag.value})
						#else
							#set($theValue = $today)
						#end 
						#prop_dateSelectionWidget("$!{tag.dottedname}" $theValue)
						#prop_timeSelectionWidget("$!{tag.dottedname}" $theValue)
					#elseif("$!tag.widget" == "$!TIME")
						<input type="hidden" id="$validator.escapeJavascript("$!{tag.dottedname}")" value="" />
						#if($!{tag.value})
							#set($theValue = $!{tag.value})
						#else
							#set($theValue = $today)
						#end 
						#prop_timeSelectionWidget("$!{tag.dottedname}" $theValue)
					#elseif("$!tag.widget" == "$!ENUM")
						<select name="$!{tag.dottedname}" 
							id="$validator.escapeJavascript("$!{tag.dottedname}")">
							#foreach($enum in $tag.enumeration)
								<option value="$enum"#if("$!{tag.value}" == "$enum") selected="selected"#end>$enum</option>
							#end
						</select>
					#elseif("$!tag.widget" == "$!BOOLEAN")
						<input type="checkbox" 
							name="$!{tag.dottedname}" 
							id="$validator.escapeJavascript("$!{tag.dottedname}")"
							#if("$!{tag.value}" == "$TRUE")checked="checked"#end
							value="true" />
					#elseif("$!tag.widget" == "$!INTEGER")
						<input type="text" size="$!{tag.length}"
							name="$!{tag.dottedname}" 
							id="$validator.escapeJavascript("$!{tag.dottedname}")" 
							value="$!{tag.value}" />
					#elseif("$!tag.widget" == "$!DOUBLE")
						<input type="text" size="$!{tag.length}"
							name="$!{tag.dottedname}" 
							id="$validator.escapeJavascript("$!{tag.dottedname}")" 
							value="$!{tag.value}" />
					#elseif("$!tag.widget" == "$!ANYURI")
						#set ($size = 0)
						#if (!$tag.values.isEmpty())
							#set ($props = false)
							#set ($size = $tag.values.size())
							<ul class="attachList">
								#foreach ($attachment in $tag.values)
									#set ($props = $attachment.Properties)
									#if (!$props)
										#if ($size > 0) #set ($size = $size - 1) #end
									#else
										#if ($props.getBooleanProperty($props.NamePropIsCollection))
											<li><img src = "#imageLink($contentTypeImageService.getContentTypeImage("folder"))" border="0" />
										#else
											<li><img src = "#imageLink($contentTypeImageService.getContentTypeImage($props.getProperty($props.NamePropContentType)))" border="0" />
										#end
										#set ($copyflag = false)
										#if ($props.getProperty("CHEF:copyrightalert"))
											#if ($props.getBooleanProperty("CHEF:copyrightalert"))
												#set ($copyflag = true)
											#end
										#end
				
										#if ($copyflag)
											## if there is a copyright alert, show the alert page first
											<a href="" onclick="openCopyrightWindow('${attachment.url}','copyrightAlertWindow','scrollbars=yes,menubar=yes,height=600,width=800,resizable=yes,toolbar=yes,location=yes,status=yes');return false">
											$validator.escapeHtml($attachment.Properties.getPropertyFormatted("DAV:displayname"))</a>&#169;
										#else
											<a href="$attachment.Url" target="_blank">
											$validator.escapeHtml($attachment.Properties.getPropertyFormatted("DAV:displayname"))</a>
										#end
										
										#if (!$props.getBooleanProperty($props.NamePropIsCollection))
												($props.getPropertyFormatted($props.NamePropContentLength))
										#end
									#end
									</li>
									#set ($props = false)
								#end
							</ul>
						#end
						#if ($size == 0) 
							## $tlang.getString("gen.noattach")
							<div class="act">
								<a href="#" onclick="javascript:document.getElementById('createForm').action='#toolLinkParam("ResourcesAction" "doCreateitem" "special=upload&flow=linkResource&field=$validator.escapeUrl($tag.dottedname)")';submitform('createForm');">Link to a resource</a>
							</div>
						#else
							<div class="act">
								<a href="#" onclick="javascript:document.getElementById('createForm').action='#toolLinkParam("ResourcesAction" "doCreateitem" "special=upload&flow=linkResource&field=$validator.escapeUrl($tag.dottedname)")';submitform('createForm');">Link to a resource</a>
							</div>
						#end
						
					#else
						$tag.dottedname<br />
						$tag.widget<br />
						"$!{tag.value}"<br />
					#end
				</div>
			#end
		#end
	#end
#end
############################################# end of macro getPropertyValues 

##
############################################# macro prop_dateSelection 
#macro(prop_dateSelectionWidget $propName $propValue)
	
## Setup a date selection widget
#set($theDate = $propValue.breakdownLocal())
#set($year = $theDate.year)
#set($earliestYear = $year - 10)
#set($latestYear = $year + 10)	
#set($month = $theDate.month)
#set($day = $theDate.day)

#chef_dateselectionwidget("${propName}_year" "${propName}_month" "${propName}_day" $earliestYear $latestYear $year $month $day)

#end
############################################# end of macro prop_dateSelection 

##
############################################# macro prop_timeSelection 
#macro(prop_timeSelectionWidget $propName $propValue)

## Setup a time selection widget
#set($theTime = $propValue.breakdownLocal())
#set($hour = $theTime.hour)
#set($minute = $theTime.min)
#set($second = $theTime.sec)
#set($timeType = "am")
#if($hour == 12 && $minute > 0)
#set($timeType = "pm")
#end
#if($hour == 0 && $minute == 0)
#set($timeType = "pm")
#end
#if($hour>12)
#set($hour = $hour - 12)
#set($timeType = "pm")
#elseif ($hour == 0)
#set($hour = 12)
#end
<select name="${propName}_hour" id="${propName}_hour">
#foreach($hr in [1..12])
	<option#if($hr == $hour) selected="selected"#end value="$hr">$hr</option>
#end
</select>
:
<select name="${propName}_minute" id="${propName}_minute">
#foreach($min in [0..59])
	<option value="$min"#if($min == $minute) selected="selected"#end>#if($min < 10)0#end$min</option>
#end
</select>
:
<select name="${propName}_second" id="${propName}_second">
#foreach($sec in [0..59])
	<option value="$sec"#if($sec == $second) selected="selected"#end>#if($sec < 10)0#end$sec</option>
#end
</select>
<select name="${propName}_ampm" id="${propName}_ampm">
    #if($timeType =="am") <option selected="selected">am</option> #else <option>am</option> #end
    #if($timeType =="pm") <option selected="selected">pm</option> #else <option>pm</option> #end
</select>
#end
############################################# end of macro prop_timeSelection 
##

<script type="text/javascript" language="JavaScript">
	<!--
	function submitform(id)
	{
		var theForm = document.getElementById(id);
		if(theForm && theForm.onsubmit)
		{
			theForm.onsubmit();
		}
		if(theForm && theForm.submit)
		{
			theForm.submit();
		}
	}
	function seedValue(obj_seed, id, trim)
	{
		var theElement = document.getElementById(id);
		if(theElement && obj_seed && obj_seed.value)
		{
			var nonWhitespaceChar = /\S/;
			if(theElement.value.search(nonWhitespaceChar))
			{
				var filename = obj_seed.value;
				if(trim)
				{
					var delimiters = new Array('/', '\\', ':');
					
					for(var i = 0; i < delimiters.length; i++)
					{
						var delimiter = delimiters[i];
						if(filename.lastIndexOf(delimiter) > -1)
						{
							filename = filename.substring(filename.lastIndexOf(delimiter) + 1);
						}
					}
				}
				theElement.value = filename;
			}
			theElement.focus();
			theElement.select();
		}
	}
	function openSampleCopyrightWindow() 
	{ 
	  window.open("$copyright_alert_url","SampleCopyrightAlert","scrollbars=no,menubar=no,height=400,width=700,resizable=no,toolbar=no,location=no,status=no");
	  return false;
	}
	function enableNewCopyright(obj_mycopyright, obj_newcopyright)
	{
		obj_mycopyright.checked = false;
		obj_newcopyright.checked = true;
	}

	function clearNewCopyright(obj_textarea)
	{
		obj_textarea.value = "";
	}
	
	function checkItem(copyrightIndex)
	{
		var obj_alert_name="copyrightAlert";
		var obj_alert_item=document.getElementById(obj_alert_name);
		var obj_newcopyright_name="newcopyright";
		var obj_newcopyright_item=document.getElementById(obj_newcopyright_name);
		if (copyrightIndex == 0)
		{
			obj_alert_item.checked=false;
			obj_newcopyright_item.disabled=true;
		}
		else if (copyrightIndex < 5)
		{
			obj_alert_item.checked=true;
			obj_newcopyright_item.disabled=true;
		}
		else if (copyrightIndex == 5)
		{
			obj_alert_item.checked=true;
			obj_newcopyright_item.disabled=false;
		}
	}
	function submitWithNumberOfItems(formName, element)
	{
		var theForm = document.getElementById(formName);
		var theNumber = element.value;
		
		theForm.action="#toolLinkParam("ResourcesAction" "doCreateitem" "special=upload&flow=updateNumber")&numberOfItems=" + theNumber;
		if(theForm && theForm.onsubmit)
		{
			theForm.onsubmit();
		}
		if(theForm && theForm.submit)
		{
			theForm.submit();
		}
	}
	function updateCopyright(element, index)
	{
		var cr_div = document.getElementById("copyright_status_" + index);
		var new_value = element.value;
		var cr_element = document.getElementById("newcopyright" + index);
		var cr_value = cr_element.value;
		
		var inner_html = "";
		if(new_value == "$!{USE_THIS_COPYRIGHT}")
		{
			document.getElementById("copyright_status_" + index).style.display='block';
			inner_html = "<p class=\"shorttext\">\n<span class=\"reqStar\">*</span>\n<label for=\"newcopyright" + index + "\">\n$tlang.getString("edit.cinfo")\n</label>\n"
						+ "<textarea name=\"newcopyright" + index +"\" id=\"newcopyright" + index + "\" rows=\"2\" cols=\"40\" wrap=\"virtual\" ></textarea>\n</p>\n";	
		}
		else
		{
			document.getElementById("copyright_status_" + index).style.display='none';
			inner_html = "<input type=\"hidden\"  name=\"newcopyright" + index + "\" id=\"newcopyright" + index + "\" value=\"\" />";
		}
		cr_div.innerHTML = inner_html;
		setMainFrameHeight('$validator.escapeJavascript("Main$pid")');
		cr_element = document.getElementById("newcopyright" + index);
		cr_element.value = cr_value;
		cr_element.select();
		if(new_value == "$!{USE_THIS_COPYRIGHT}")
		{
			cr_element.focus();
		}
		else
		{
			element.focus();
		}
	}
	
	function toggleSelectAll(element, item_name)
	{
		var checkboxes = document.getElementsByName(item_name);
		for(var i = 0; i < checkboxes.length; i++)
		{
			if(element.checked)
			{
				checkboxes[i].checked = true;
			}
			else
			{
				checkboxes[i].checked = false;
			}
		}
	}
	//-->
</script>
<div class="portletBody">
	#if("$itemType" == "$TYPE_UPLOAD")
		<form name="createForm" id="createForm" action="#toolLinkParam("ResourcesAction" "doCreateitem" "special=upload&flow=create&itemType=$itemType")" method="post" enctype="multipart/form-data">
	#else
		<form name="createForm" id="createForm" action="#toolLink("ResourcesAction" "doCreateitem")" method="post" >
	#end
		<input type="hidden" name="sakai_action" value="doCreateitem" />
		<input type="hidden" name="flow" id="flow" value="create" />
		<input type="hidden" name="collectionId" value="$validator.escapeHtml($collectionId)" />
		<input type="hidden" name="itemType" id="itemType" value="$itemType" />
		<input type="hidden" name="twiggleNumber" id="twiggleNumber" value="-1" />
		<input type="hidden" name="metadataGroup" id="metadataGroup" value="*" />
		<input type="hidden" name="field"  id="field" value="no value" />
		<input type="hidden" name="index" id="index" value="0" />
		#if($attaching_this_item)
			<input type="hidden" name="attach_me" value="true" />
		#end
		#if($max_number > 1 && ("$itemType" == "$TYPE_UPLOAD" || "$itemType" == "$TYPE_FOLDER" || "$itemType" == "$TYPE_URL"))
			<p class="shorttext">
				#if("$itemType" == "$TYPE_FOLDER")
					<label for="numberOfItems">$tlang.getString("add.numfldrs")</label>
				#elseif("$itemType" == "$TYPE_UPLOAD")
					<label for="numberOfItems">$tlang.getString("add.numfiles")</label>
				#elseif("$itemType" == "$TYPE_URL")
					<label for="numberOfItems">$tlang.getString("add.numurls")</label>
				#end
				<span class="skip">$tlang.getString("addi.selectmessage")</span>
				#if("$itemType" == "$TYPE_UPLOAD")
					<select name="numberOfItems" id="numberOfItems" onchange="javascript:submitWithNumberOfItems('createForm', this);">
				#else
					<select name="numberOfItems" id="numberOfItems" onchange="javascript:document.getElementById('flow').value='updateNumber';submitform('createForm');">
				#end
					#foreach ($i in [1 .. $max_number])
						#if ("$i" == "$numberOfItems")
							<option value="$i" selected="selected">$i</option>
						#else
							<option value="$i">$i</option>
						#end
					#end
				</select>
			</p>	
			<br />
		#else
			<input type="hidden" name="numberOfItems" value="$numberOfItems" />
		#end
		#foreach($n in [1 .. $numberOfItems])
			#set($i = $n - 1)
			######################## ================ Title Bar for Item ================ ########################
			<h4>
				#if($helper_subtitle)
					$helper_subtitle
				#elseif("$itemType" == "$TYPE_UPLOAD")
					$tlang.getString("addi.upload")
				#elseif("$itemType" == "$TYPE_URL")
					$tlang.getString("addi.url")
				#elseif("$itemType" == "$TYPE_HTML")
					$tlang.getString("addi.txthtml")
				#elseif("$itemType" == "$TYPE_TEXT")
					$tlang.getString("addi.txttxt")
				#elseif("$itemType" == "$TYPE_FOLDER")
					$tlang.getString("gen.folder1")
				#elseif("$itemType" == "$TYPE_FORM")
					$tlang.getString("addi.meta")
				#end
				#if($numberOfItems > 1)
					 ($n of $numberOfItems)
				#end
			</h4>
			#if ($itemAlertMessage)
				<div class="alertMessage">$tlang.getString("gen.alert") $validator.escapeHtml($itemAlertMessage)</div>
				<div style="display:block;clear:both" ></div>
			#end
			#set($item = $new_items.get($i))
			######################## ================ Content of Item ================ ########################
			#if ($item.isFolder())
				#if($!{item.isMissing("name")})
					<p class="shorttext validation">
				#else
					<p class="shorttext">
				#end
					<span class="reqStar">*</span>
					<label for="name$i">
						$tlang.getString("gen.title") 
					</label>
					<input type="text" size="40" id="name$i" name="name$i" value="$validator.escapeHtml("$!item.name")" />
				</p>	
			#elseif ($item.isUrl())
				#if($!{item.isMissing("Url")})
					<p class="shorttext validation">
				#else
					<p class="shorttext">
						<span class="reqStar">*</span>
				#end
					<label for="Url$i">$tlang.getString("gen.url")</label>
					<input type="text" name="Url$i" id="Url$i" size="60" value="$!validator.escapeHtml("$!item.filename")" onchange="javascript:seedValue(this, 'name$i', false);" />
				</p>
			#elseif ($item.isPlaintext()) 
				#if($!{item.isMissing("content")})
					<p class="longtext validation">
				#else
					<p class="longtext">
				#end
					<textarea name="content$i" id="content$i" rows="10" cols="60" wrap="virtual">$!validator.escapeHtmlTextarea($!{item.contentstring})</textarea>
				</p>
			#elseif ($item.isHtml())
				#if($!{item.isMissing("content")})
					<div class="longtext validation">
				#else
					<div class="longtext">
				#end
					<table border="0"><tr><td>
						<textarea name="content$i" id="content$i" rows="30" cols="80" wrap="virtual">$validator.escapeHtmlTextarea("$!{item.contentstring}")</textarea>
						#chef_setupformattedtextarea("content$i")
					</td></tr></table>
				</div>
			#elseif($item.isStructuredArtifact())
				#if($homes.isEmpty())
					<p class="shorttext validation">
						$tlang.getString("add.noforms")
					</p>
				#else
					#if($formtype_readonly)
						<p class="shorttext">
							<label for="formtype">$tlang.getString("add.ftype")</label>
							$!rootname
							<input type="hidden" name="formtype" id="formtype" value="$!formtype" />
						</p>
					#else
						#if($missing.contains("formtype"))
							<p class="shorttext validation">
						#else
							<p class="shorttext">
						#end
							<label for="formtype">$tlang.getString("add.formtype")</label>
							<select id="formtype" name="formtype" onchange="javascript:document.getElementById('flow').value='updateDocType';submitform('createForm');">
								<option value=""#if("$!item.formtype" == "") selected="selected"#end></option>
								#foreach($home in $homes)
									<option value="$home.type.id"#if("$!home.type.id" == "$!item.formtype") selected="selected"#end>$home.type.description</option>
								#end
							</select>
						</p>
					#end
					#if($!item.instruction && $item.instruction != "")
						<p class="instruction">
							$item.instruction
						</p>
					#end
					#getPropertyValues($item.properties)
				#end
			#else
				#if("$!{item.Filename}" == "")
					#if($!{item.isMissing("fileName")})
						<p class="shorttext validFail">
					#else
						<p class="shorttext">
					#end
						<span class="reqStar">*</span>
						<label for="fileName$i">$tlang.getString("gen.choose") $tlang.getString("add.afile")</label>
						<input type="file" name="fileName$i" id="fileName$i"  class ="upload" onchange="javascript:seedValue(this, 'name$i', true)" />
					</p>
				#else
					<p class="shorttext">
						<label for="fileName">$tlang.getString("addi.upload")</label>
						$validator.escapeHtml("$!item.filename")
					</p>
					<p class="shorttext">
						<label for="fileName">$tlang.getString("rep.thisfile")</label>
						<input type="file" name="fileName$i" id="fileName$i"  class ="upload" />
					</p>
				#end
			#end
			######################## ================ Properties of Item ================ ########################
			<p class="discTria">
				$tlang.getString("add.props")
			</p>
			#if(! $item.isFolder())
				#if($!{item.isMissing("name")})
					<p class="shorttext validFail">
				#else
					<p class="shorttext">
				#end
					<span class="reqStar">*</span>
					<label for="name$i">
						$tlang.getString("gen.title") 
					</label>
					<input type="text" size="40" id="name$i" name="name$i" value="$validator.escapeHtml("$!item.name")" />
				</p>	
			#end
			<p class="shorttext">
				<label for="description$i">
					$tlang.getString("gen.description")
				</label>
				<textarea id="description$i" name="description$i" rows="2" cols="40" wrap="virtual">$validator.escapeHtmlTextarea("$!item.description")</textarea>
			</p>	
			#if ($item.isFileUpload() || $item.isHtml() || $item.isPlaintext())
				##getRightsAssignment($item.rights)
				
					#if ($!copyrightTypes)
						<p class="shorttext">
							<span class="reqStar">*</span>
							<label for="copyright$i">
								$tlang.getString("edit.cstatus")
							</label>	
							<select name="copyright$i" id ="copyright$i" onchange="javascript:updateCopyright(this, '$i');">
								#foreach ($copyright in $copyrightTypes)
									<option value="$copyright"#if($item.copyrightStatus == $copyright) selected="selected"#end>$copyright</option>
								#end
							</select>
							#if ($!fairuseurl)
								(<a href="$fairuseurl" target="_blank" title="[$tlang.getString('gen.newwin')]"><span class="skip"> [$tlang.getString('gen.newwin')]</span>$tlang.getString("edit.fairuse")</a>)
							#end
						</p>
						<div id="copyright_status_$i">
							#if($item.copyrightStatus == $USE_THIS_COPYRIGHT)
								<p class="shorttext">
									<span class="reqStar">*</span>
									<label for="newcopyright$i">
										$tlang.getString("edit.cinfo")
									</label>	
									<textarea name="newcopyright$i" id="newcopyright$i" rows="2" cols="40" wrap="virtual" >$validator.escapeHtmlTextarea("$!item.copyrightInfo")</textarea>
								</p>	
							#else
								<input type="hidden" name="newcopyright$i" id="newcopyright$i" value="$!item.copyrightInfo" />
							#end
						</div>
						<div class="checkbox labelindnt">
							<input type="checkbox" name="copyrightAlert$i" id ="copyrightAlert$i" value="true" #if($item.hasCopyrightAlert())checked="checked"#end style="border:none" />
							<label for="copyrightAlert$i">$tlang.getString("edit.display1")</label>
							<a href="#" onclick="javascript:openSampleCopyrightWindow();" onkeypress="javascript:openSampleCopyrightWindow();"   title="[$tlang.getString('gen.newwin')]"><span class="skip">[$tlang.getString('gen.newwin')]</span>$tlang.getString("edit.display2")</a>
							$tlang.getString("edit.display3")
					</div>
					#end
				
			#end
			######### begin availability section ##########
			#if($availability_is_enabled &&  !$item.isInWorkspace() && !$dropboxMode)
			<h4>$tlang.getString("avail.title")</h4>
			<div  class="labelindnt">
				<table>
					<tr>
						<td>
							<input type="radio" name="hidden$i" id="hidden_false$i" value="false" #if(!$item.isHidden())checked="checked" #end/>
						</td>
						<td colspan="4">
							<label for="hidden_false$i">
								$tlang.getString("avail.show")
							</label>
						</td>
					</tr>
					<tr>
						<td>
						</td>
						<td>
							<input type="checkbox" name="use_start_date$i" id="use_start_date$i" value="true" #if($item.useReleaseDate())checked="checked" #end/>
						</td>
						<td colspan="3">
							<label for="use_start_date$i">
								$tlang.getString("avail.start")
							</label>
						</td>
					</tr>
					<tr>
						<td>
						</td>
						<td>
						</td>
						<td>
						</td>
						<td>
							<label for="release_year$i">Date:</label>
						</td>
						<td>
							<label for="release_time$i">Time:</label>
						</td>
					</tr>
					#set($yearX = $item.releaseDate.breakdownLocal().year)
					#set($year0 = $yearX - 4)
					#set($yearN = $yearX + 4)
					#set($monthX = $item.releaseDate.breakdownLocal().month)
					#set($dayX = $item.releaseDate.breakdownLocal().day)
					<tr>
						<td>
						</td>
						<td>
						</td>
						<td>
						</td>
						<td>
							#custom_dateselectionwidget("release_year$i" "release_month$i" "release_day$i" $year0 $yearN $yearX $monthX $dayX "document.getElementById('hidden_true$i').checked=false;document.getElementById('hidden_false$i').checked=true;document.getElementById('use_start_date$i').checked=true;")
						</td>
						<td>
							#custom_timeSelectionWidget("release$i" $item.releaseDate "document.getElementById('hidden_true$i').checked=false;document.getElementById('hidden_false$i').checked=true;document.getElementById('use_start_date$i').checked=true;")
						</td>
					</tr>
					<tr>
						<td>
						</td>
						<td>
							<input type="checkbox" name="use_end_date$i" id="use_end_date$i" value="true" #if($item.useRetractDate())checked="checked" #end/>
						</td>
						<td colspan="4">
							<label for="use_end_date$i">
								$tlang.getString("avail.end")
							</label>
						</td>
					</tr>
					<tr>
						<td>
						</td>
						<td>
						</td>
						<td>
						</td>
						<td>
							<label for="retract_year$i">Date:</label>
						</td>
						<td>
							<label for="retract_time$i">Time:</label>
						</td>
					</tr>
					#set($yearX = $item.retractDate.breakdownLocal().year)
					#set($year0 = $yearX - 4)
					#set($yearN = $yearX + 4)
					#set($monthX = $item.retractDate.breakdownLocal().month)
					#set($dayX = $item.retractDate.breakdownLocal().day)
					<tr>
						<td>
						</td>
						<td>
						</td>
						<td>
						</td>
						<td>
							#custom_dateselectionwidget("retract_year$i" "retract_month$i" "retract_day$i" $year0 $yearN $yearX $monthX $dayX "document.getElementById('hidden_true$i').checked=false;document.getElementById('hidden_false$i').checked=true;document.getElementById('use_end_date$i').checked=true;")
						</td>
						<td>
							#custom_timeSelectionWidget("retract$i" $item.retractDate "document.getElementById('hidden_true$i').checked=false;document.getElementById('hidden_false$i').checked=true;document.getElementById('use_end_date$i').checked=true;")
						</td>
					</tr>
					<tr>
						<td>
							<input type="radio" name="hidden$i" id="hidden_true$i" value="true" #if($item.isHidden())checked="checked" #end/>
						</td>
						<td colspan="4">
							<label for="hidden_true$i">
								$tlang.getString("avail.hide")
							</label>
						</td>
					</tr>
				</table>
			</div>
			#end
			######### end availability section ##########
		
			######### begin access section ##########
			## Should initial access to this resource or collection be determined
			## for "site" (standard sakai permissions), "grouped" or "public"?
			## do not show any access options if in dropbox
			#if(!$dropboxMode)
				#set ($listDisplay="none")
				## show access options only if public view is allowed or there are groups in the site
				#if($item.isPubviewInherited())
					<h4>$tlang.getString("access.title2")</h4>
					<input type="hidden" name="access_mode$i" id="access_mode_hidden" value="$INHERITED_ACCESS" />
				#elseif($item.isSingleGroupInherited())
					<h4>$item.singleGroupTitle</h4>
					<input type="hidden" name="access_mode$i" id="access_mode_hidden" value="$INHERITED_ACCESS" />
					#set($theGroups = $item.possibleGroups)
					#foreach ($group in $!{theGroups})
						<input type="hidden" name="access_groups$i" id="access_groups${i}_$group.Id" value="$group.Id" />
					#end
				#elseif($item.isSiteOnly())
					<h4>$tlang.getString("access.title3")</h4>
					<input type="hidden" name="access_mode$i" id="access_mode_hidden" value="$INHERITED_ACCESS" />
				#elseif(!$item.isSitePossible())
					<h4>$tlang.getString("access.title5")</h4>
					#set ($listDisplay="block")
				#else
					<h4>$tlang.getString("access.title1")</h4>
					<div  class="labelindnt">
						#if($item.isPubviewPossible())
							<p class="checkbox">
								<input type="radio" name="access_mode$i" id="access_mode${i}_public" value="public" #if($!item.isPubview()) checked="checked"#end  style="border:none" onclick="javascript:document.getElementById('groupTable$i').style.display='none';" onkeypress="javascript:document.getElementById('groupTable$i').style.display='none';" />
								<label for="access_mode${i}_public">$tlang.getString("edit.access2")</label>
							</p>
						#end
						<p class="checkbox">
							<input type="radio" name="access_mode$i" id="access_mode${i}_$INHERITED_ACCESS" value="$INHERITED_ACCESS" #if(!$item.isPubview() && ("$!item.access" == "$SITE_ACCESS" || "$!item.access" == "$INHERITED_ACCESS")) checked="checked"#end  style="border:none" onclick="javascript:document.getElementById('groupTable$i').style.display='none';" onkeypress="javascript:document.getElementById('groupTable$i').style.display='none';" />
							<label for="access_mode${i}_site">$tlang.getString("edit.access3")</label>
						</p>
						
						#if($item.isGroupPossible())
							#if("$!item.access" == "$GROUP_ACCESS")
								#set ($listDisplay="block")
							#else
								#set ($listDisplay="none")
							#end
							<p class="checkbox">
								<input type="radio" name="access_mode$i" id="access_mode${i}_$GROUP_ACCESS" value="$GROUP_ACCESS" #if("$!item.access" == "$GROUP_ACCESS") checked="checked"#end  style="border:none" onclick="javascript:document.getElementById('groupTable$i').style.display='block';" onkeypress="javascript:document.getElementById('groupTable$i').style.display='block';" />
								<label for="access_mode${i}_grouped">$tlang.getString("edit.access4")</label>
							</p>
						#end
					</div>
				#end
				#if($item.isGroupPossible())
					<table id="groupTable${i}" class="listHier lines labelindnt" border="0" style="width:80%;display:$listDisplay" cellspacing="0" summary="$tlang.getString("edit.group3")">
						<caption class="skip" style="display:none">$tlang.getString("edit.access4")</caption>
						<tr>
							<th id="selectAllGroups${i}" style="width:2em;padding-left:.4em">
								<input type="checkbox" id="selectall${i}" title="toggle select all" onclick="javascript:toggleSelectAll(this, 'access_groups${i}')" onkeypress="javascript:toggleSelectAll(this, 'access_groups${i}')" />
							</th>
							<th id="groupname${i}">
								$tlang.getString("edit.group1")
							</th>
							<th id ="groupdescription${i}">
								$tlang.getString("edit.group2")
							</th>
						</tr>
						#set($theGroups = $item.allSiteGroups)
						#foreach ($group in $!{theGroups})
							#if($item.isPossible($group) && $item.allowedAdd($group))
								<tr>
									<td headers="selected" style="padding-bottom:0;" style="width:2em">
										<input type="checkbox" name="access_groups${i}" id="access_groups${i}_$group.Id" title="$group.title" value="$group.Id" #if($item.isLocal($group)) checked="checked"#end />
									</td>
									<td headers="name" style="padding-bottom:0;" class="checkbox">
										<label for="access_groups${i}_$group.Id">
											$group.Title
										</label>	
									</td>
									<td headers="description" width="100%"> ##mozilla does not resize table children dynamically , so set here
										#set($description = "")
										#if($group.Description)
											#set($description = $group.Description)
										#end
										$!description
									</td>
								</tr>
							#end
						#end
					</table>
				#end
			#end
			########## end access section ###########
			#if($setQuota)
				<p class="shorttext">
					<label for="hasQuota$i">
						$tlang.getString("gen.quota") ($tlang.getString("gen.kb")):
					</label>	
					<input type="hidden" name="setQuota$i" value="true" />
					<input type="checkbox" name="hasQuota$i" id="hasQuota$i" value="true" #if ($hasQuota) checked="checked" #end />
					<input type="text" size="10" name="quota" id="quota" value="$!quota" />
				</p>	
			#end
			#if (!$dropboxMode)
				#if (!$item.isFolder())
					#if ($notification)
						<p class="shorttext">
							<label for="notify$i">
								$tlang.getString("gen.email1")
							</label>	
							<select name="notify$i" id="notify$i">
								<option value="r">$tlang.getString("gen.email2")</option>
								<option value="o">$tlang.getString("gen.email3")</option>
								<option value="n" selected="selected">$tlang.getString("gen.email4")</option>
							</select>
						</p>	
					#end
				#end
			#end
			
			######################## ================ Optional Properties of Item ================ ########################
			#if($metadataGroups)
				#foreach($group in $metadataGroups)				  
					#if ($item.isGroupShowing($group.name))
						<p class="discTria">
							#if("$itemType" == "$TYPE_UPLOAD")
								<a href="#" onclick="javascript:document.getElementById('createForm').action='#toolLinkParam("ResourcesAction" "doCreateitem" "special=upload&flow=hideOptional&metadataGroup=$validator.escapeUrl($group.name)&twiggleNumber=$i")';submitform('createForm');" onkeypress="javascript:document.getElementById('createForm').action='#toolLinkParam("ResourcesAction" "doCreateitem" "special=upload&flow=hideOptional&metadataGroup=$validator.escapeUrl($group.name)&twiggleNumber=$i")';submitform('createForm');"  title="$tlang.getString("edit.hide") $group.name">
							#else
								<a href="#" onclick="javascript:document.getElementById('flow').value='hideOptional';document.getElementById('metadataGroup').value='$validator.escapeUrl($group.name)'; document.getElementById('twiggleNumber').value='$i';submitform('createForm');" onkeypress="javascript:document.getElementById('flow').value='hideOptional';document.getElementById('metadataGroup').value='$validator.escapeUrl($group.name)'; document.getElementById('twiggleNumber').value='$i';submitform('createForm');"  title="$tlang.getString("edit.hide") $group.name">
							#end
							##<a href="#" onclick="javascript: document.getElementById('flow').value='hideOptional'; document.getElementById('metadataGroup').value='$validator.escapeUrl($group.name)'; document.getElementById('twiggleNumber').value='$i'; submitform('createForm'); return false;" title="$tlang.getString("edit.hide") $group.name">
								<img src="#imageLink("sakai/collapse.gif")" alt="$tlang.getString("edit.hide") $group.name" border="0" width="13" height="13" align="top" />
							</a>
							$validator.escapeHtml($group.name)
						</p>
						#foreach($tag in $group)
							<p class="shorttext">
								#if("$!tag.widget" == "$!STRING")
				 					<label for ="$validator.escapeJavascript("$!{tag.fullname}_$i")">
										$tag.label
									</label>
									<input type="text" size="40"
										name="$!{tag.fullname}_$i" 
										id="$validator.escapeJavascript("$!{tag.fullname}_$i")" 
										value="$!item.metadata.get("$tag.fullname")" 
									/>
								#elseif("$!tag.widget" == "$!TEXTAREA")
									<label for ="$validator.escapeJavascript("$!{tag.fullname}_$i")">
										$tag.label
									</label>
									<textarea rows="4" cols="30" 
										name="$!{tag.fullname}_$i" 
										id="$validator.escapeJavascript("$!{tag.fullname}_$i")" >$validator.escapeHtmlTextarea($item.metadata.get("$tag.fullname"))</textarea>
								#elseif("$!tag.widget" == "$!DATE")
									<label for ="$validator.escapeJavascript("$!{tag.fullname}_$i")">
										$tag.label
									</label>
									<input type="hidden" id="$validator.escapeJavascript("$!{tag.fullname}_$i")" value="" />
									#if($!item.metadata.get("$tag.fullname"))
										#set($theValue = $!item.metadata.get("$tag.fullname"))
									#else
										#set($theValue = $today)
									#end 
									#prop_dateSelectionWidget("${tag.fullname}_$i" $theValue)
								#elseif("$!tag.widget" == "$!DATETIME")
									<label for ="$validator.escapeJavascript("$!{tag.fullname}_$i")">
										$tag.label
									</label>
									<input type="hidden" id="$validator.escapeJavascript("$!{tag.fullname}_$i")" value="" />
									#if($!item.metadata.get("$tag.fullname"))
										#set($theValue = $!item.metadata.get("$tag.fullname"))
									#else
										#set($theValue = $today)
									#end 
									#prop_dateSelectionWidget("$!{tag.fullname}_$i" $theValue)
									#prop_timeSelectionWidget("$!{tag.fullname}_$i" $theValue)
								#elseif("$!tag.widget" == "$!TIME")
									<label for ="$validator.escapeJavascript("$!{tag.fullname}_$i")">
										$tag.label
									</label>
									<input type="hidden" id="$validator.escapeJavascript("$!{tag.fullname}_$i")" value="" />
									#if($!item.metadata.get("$tag.fullname"))
										#set($theValue = $!item.metadata.get("$tag.fullname"))
									#else
										#set($theValue = $today)
									#end 
									#prop_timeSelectionWidget("$!{tag.fullname}_$i" $theValue)
		
								#else
									$tag.fullname<br />
									$tag.widget<br />
									$!item.metadata.get("$tag.fullname")<br />
								#end
							</p>
						#end
						
					#else
						<p class="discTria">
							#if("$itemType" == "$TYPE_UPLOAD")
								<a href="#" onclick="javascript:document.getElementById('createForm').action='#toolLinkParam("ResourcesAction" "doCreateitem" "special=upload&flow=showOptional&metadataGroup=$validator.escapeUrl($group.name)&twiggleNumber=$i")';submitform('createForm');"  onkeypress="javascript:document.getElementById('createForm').action='#toolLinkParam("ResourcesAction" "doCreateitem" "special=upload&flow=showOptional&metadataGroup=$validator.escapeUrl($group.name)&twiggleNumber=$i")';submitform('createForm');" title="$tlang.getString("edit.show") $group.name">
							#else
								<a href="#" onclick="javascript:document.getElementById('flow').value='showOptional';document.getElementById('metadataGroup').value='$validator.escapeUrl($group.name)'; document.getElementById('twiggleNumber').value='$i';submitform('createForm');" onkeypress="javascript:document.getElementById('flow').value='showOptional';document.getElementById('metadataGroup').value='$validator.escapeUrl($group.name)'; document.getElementById('twiggleNumber').value='$i';submitform('createForm');"  title="$tlang.getString("edit.show") $group.name">
							#end
							##<a href="#" onclick="javascript: document.getElementById('flow').value='showOptional'; document.getElementById('metadataGroup').value='$validator.escapeUrl($group.name)'; document.getElementById('twiggleNumber').value='$i'; submitform('createForm'); return false;" title="$tlang.getString("edit.show") $group.name">	
								<img src="#imageLink("sakai/expand.gif")" alt="$tlang.getString("edit.show") $group.name" border="0" width="13" height="13" align="top" />
							</a>
							$validator.escapeHtml($group.name)
						</p>
					#end
				#end
			#end
			############################################# end of section to show metadata 
	
		#end
		################# end of foreach $i in 0 .. $numberOfItems

		######################## ================ Add Button, Cancel Button ================ ########################
		<p class="act">
				<input type="button" class="active" name="savechanges" id="saveChanges" onclick="javascript:showNotif('submitnotif','saveChanges','createForm');document.getElementById('flow').value='create'; submitform('createForm');" onkeypress="javascript:showNotif('submitnotif','saveChanges','createForm');document.getElementById('flow').value='attach'; submitform('createForm');"  value="$tlang.getString("gen.add")" accesskey="s" />
				<input type="button" name="cancel" onclick="javascript:document.getElementById('createForm').action='#toolLinkParam("ResourcesAction" "doCreateitem" "flow=cancel")';submitform('createForm');" onkeypress="javascript:document.getElementById('createForm').action='#toolLinkParam("ResourcesAction" "doCreateitem" "flow=cancel")';submitform('createForm');"  value="$tlang.getString("gen.cancel")" accesskey="x" />
				<span id="submitnotif" style="visibility:hidden">$tlang.getString("gen.proces")</span>
		</p>
		#if("$itemType" == "$TYPE_UPLOAD")
			<p class="shorttext">
				$tlang.getString("gen.note")
				$tlang.getString("gen.onlyup1")
				$!max_upload_size
				$tlang.getString("gen.onlyup2")
			</p>
		#end
	</form>
</div>

## start of creative-commons scripts
## end of creative-commons scripts


