## version: $Id:  $
<!-- chef_resources_edit.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 editPropertyValues 
##
#macro(editPropertyValues $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('propertyForm'); 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('propertyForm'); 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('propertyForm').action='#toolLinkParam("ResourcesAction" "doSavechanges" "special=upload&flow=linkResource&field=$validator.escapeUrl($tag.dottedname)")';submitform('propertyForm');">Link to a resource</a>
							</div>
						#else
							<div class="act">
								<a href="#" onclick="javascript:document.getElementById('propertyForm').action='#toolLinkParam("ResourcesAction" "doSavechanges" "special=upload&flow=linkResource&field=$validator.escapeUrl($tag.dottedname)")';submitform('propertyForm');">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 editPropertyValues 
##
############################################# 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 language="JavaScript" type="text/javascript">
	<!--
	function submitform(id)
	{
		var theForm = document.getElementById(id);
		if(theForm && theForm.onsubmit)
		{
			theForm.onsubmit();
		}
		if(theForm && theForm.submit)
		{
			theForm.submit();
		}
	}
	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 changeMimeType(category, subtype)
	{
		var mime_widget_div = document.getElementById('mime_widget');
		var select_category = "<select name=\"mime_category\" id=\"mime_category\" onchange=\"javascript:changeMimeCategory(this);\">\n";
		for(var i = 0; i < mimeCategories.length; i++)
		{
			if(category == mimeCategories[i])
			{
				select_category += "<option selected=\"selected\">" + mimeCategories[i] + "</option>\n";				
			}
			else
			{
				select_category += "<option>" + mimeCategories[i] + "</option>\n";
			}
		}
		select_category += "</select>\n";
		var select_subtype = "<span id=\"mime_subtype\">\n<select name=\"mime_subtype\">\n";
		for(var i = 0; i < mimeSubtypes[category].length; i++)
		{
			if(subtype == mimeSubtypes[category][i])
			{
				select_subtype += "<option selected=\"selected\">" + mimeSubtypes[category][i] + "</option>\n";				
			}
			else
			{
				select_subtype += "<option>" + mimeSubtypes[category][i] + "</option>\n";
			}
		}
		select_subtype += "</select>\n</span>\n";

		mime_widget_div.innerHTML = select_category + "/" + select_subtype;
	}
	function changeMimeCategory(element)
	{
		var subtype_widget_div = document.getElementById("mime_subtype");
		var mime_warning_div = document.getElementById("mime_warning");
		var category = element.options[element.selectedIndex].text;
		// var category = element.value;
		var select_subtype = "<select name=\"mime_subtype\">\n";
		for(var i in mimeSubtypes[category])
		{
			if(i == 0)
			{
				select_subtype += "<option selected=\"selected\">" + mimeSubtypes[category][i] + "</option>\n";				
			}
			else
			{
				select_subtype += "<option>" + mimeSubtypes[category][i] + "</option>\n";
			}
		}
		select_subtype += "</select>\n";
		subtype_widget_div.innerHTML = select_subtype;
		if(category == "text")
		{
			mime_warning_div.innerHTML = "<div class=\"alertMessage\">$tlang.getString("gen.alert") $tlang.getString("edit.mime")</div>\n";
		}
		else
		{
			mime_warning_div.innerHTML = "";
		}
	}
	function updateCopyright(element)
	{
		var cr_div = document.getElementById("copyright_status");
		var new_value = element.value;
		var cr_element = document.getElementById("newcopyright");
		var cr_value = cr_element.value;
		
		var inner_html = "";
		if(new_value == "$USE_THIS_COPYRIGHT")
		{
			inner_html = "<p class=\"shorttext\">\n<span class=\"reqStar\">*</span>\n" 
						+ "<label for=\"newcopyright\">\n$tlang.getString("edit.cinfo")\n</label>\n"
						+ "<textarea name=\"newcopyright\" id=\"newcopyright\" rows=\"2\" cols=\"40\" wrap=\"virtual\" ></textarea>\n</p>\n";	
		}
		else
		{
			inner_html = "<input type=\"hidden\" name=\"newcopyright\" id=\"newcopyright\" value=\"\" />";
		}
		cr_div.innerHTML = inner_html;
		setMainFrameHeight('$validator.escapeJavascript("Main$pid")');	
		cr_element = document.getElementById("newcopyright");
		cr_element.value = cr_value;
		if(new_value == "$USE_THIS_COPYRIGHT")
		{
			cr_element.select();
			cr_element.focus();
		}
	}
	function checkForFile(elementId)
	{
		var element = document.getElementById(elementId);
		var check = document.getElementById("check_" + elementId);
		if(element && element.value && element.value != "" && check)
		{
			check.value = "true";
		}
		else if(check)
		{
			check.value = "false";
		}
	}
	

	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">
	<h3>
		#if($helper_title)
			$helper_title
		#elseif($item.isFolder())
			$tlang.getString("edit.folder")
		#else
			$tlang.getString("edit.edit") 
		#end
	</h3>
	
	#if ($alertMessage)<div class="alertMessage">$tlang.getString("gen.alert") $validator.escapeHtml($alertMessage)</div>#end
	#if($helper_instruction)
		<p class="instruction">
			$helper_instruction
		</p>
	#end
	<p class="instruction">
		$tlang.getString("edit.instr") <span class="reqStarInline">*</span>
	</p>
	<div class ="breadCrumb">
		<h3>
		$tlang.getString("gen.location")
		<img src = "#imageLink($contentTypeImageService.getContentTypeImage("folder"))" border="0" alt="" />
		#foreach ($element in $collectionPath)
			#if ($dropboxMode && $element.id==$homeCollectionId)
				$siteTitle $tlang.getString("gen.drop")
			#elseif($element.id==$homeCollectionId)
				$siteTitle $tlang.getString("gen.reso")
			#else
				$validator.escapeHtml($element.name)
			#end
			#if(! $element.isLast())
				/
			#end
		#end
		</h3>
	</div>	
	#if($item.isFileUpload() || "$REPLACE" == "$intent")
   		<form name="propertyForm" id="propertyForm" action="#toolLinkParam("ResourcesAction" "doSavechanges" "special=upload&flow=update")" method="post" enctype="multipart/form-data">
	#else
	   <form name="propertyForm" id="propertyForm" action="#toolLinkParam("ResourcesAction" "doSavechanges" "flow=update")" method="post">
	#end
		<input type="hidden" name="sakai_action" value="doSavechanges" />
		<input type="hidden" name="flow" id="flow" value="update" />
		<input type="hidden" name="collectionId" value="$validator.escapeHtml($collectionId)" />
		<input type="hidden" name="stateName" value = "list" />
		<input type="hidden" name="from" value="list" />
		<input type="hidden" name="option" id="option" value="replace" />
		<input type="hidden" name="metadataGroup" id="metadataGroup" value="" />
		<input type="hidden" name="ContentType" value="$item.MimeType" />
		<input type="hidden" name="itemType" id="itemType" value="$item.type" />
		<!-- $item.type $item.MimeType -->
		<input type="hidden" name="field"  id="field" value="no value" />
		<input type="hidden" name="index" id="index" value="0" />
		
		<p class="shorttext">
			#if (! $atHome)						 
				<span class="reqStar">*</span>
			#end
			<label for="name">
				$tlang.getString("gen.title") 
			</label>
			#if (! $atHome)						 
				<input type="text" size="40" id="name" name="name" value="$validator.escapeHtml("$!item.name")" />
			#else
				$!item.name
				<input type="hidden" name="name" id="name" value="$validator.escapeUrl("$!item.name")" />
			#end
		</p>	
		#if (! $item.isFolder()) 
			#if ($item.isUrl())
				<p class="shorttext">
					<label for="Url">$tlang.getString("edit.replace2")</label>
					<input type="text" name="Url" id="Url" size="60" value="$!{item.contentstring}" />
				</p>
			#elseif ($item.isPlaintext() || $item.isHtml())
				<p class="shorttext">
					<label for="intent">$tlang.getString("gen.content")</label>
					<select name="intent" id="intent" onchange="javascript: document.getElementById('propertyForm').action='#toolLinkParam("ResourcesAction" "doSavechanges" "special=upload&flow=intentChanged")'; submitform('propertyForm');">
						<option id="intent-revise" value="revise"#if("$intent" == "$REVISE") selected="selected"#end>Revise document contents below</option>
						<option id="intent-replace" value="replace"#if("$intent" == "$REPLACE") selected="selected"#end>Replace with document from my computer</option>
					</select>
				</p>
				#if("$REVISE" == "$intent")
					#if ($item.isPlaintext()) 
						<p class="longtext"> 
							<textarea name="content" id="content" rows="10" cols="60" wrap="virtual">$validator.escapeHtmlTextarea("$!{item.contentstring}")</textarea>
						</p>
					#elseif ($item.isHtml())
						<div class="longtext"> 
							<table border="0"><tr><td>
								<textarea name="content" id="content" rows="30" cols="80" wrap="virtual">$validator.escapeHtmlTextarea("$!{item.contentstring}")</textarea>
								#chef_setupformattedtextarea("content")
							</td></tr></table>
						</div>
					#end
				#else
					<table class="itemSummary" border="0" style="clear:both;margin:left:.7em">
						<tr> 
							<td style="width:180px;padding-left:.7em"> 
								<label>$tlang.getString("edit.filename")</label>
							</td>
							<td>
								$validator.escapeHtml("$!item.filename")
							</td>
						</tr>
					</table>
					<p class="shorttext">
						<label for="fileName">$tlang.getString("rep.thisfile")</label>
						<input type="file" name="fileName" id="fileName" class="upload" onchange="javascript:checkForFile('fileName');" />
						<input type="hidden" name="check_fileName" id="check_fileName" value="false" /> 
					</p>
				#end
			#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('propertyForm');">
								<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	
					#editPropertyValues($item.properties)
				#end
			#else
				<table class="itemSummary" border="0" style="clear:both;margin:left:.7em">
					<tr> 
						<td style="width:180px;padding-left:.7em"> 
							<label>$tlang.getString("edit.filename")</label>
						</td>
						<td>
							$validator.escapeHtml("$!item.filename")
						</td>
					</tr>
				</table>
				<p class="shorttext">
					<label for="fileName">$tlang.getString("rep.thisfile")</label>
					<input type="file" name="fileName" id="fileName"  class ="upload" onchange="javascript:checkForFile('fileName');" />
					<input type="hidden" name="check_fileName" id="check_fileName" value="false" /> 
				</p>
			#end
		#end
		######################## ================ Properties of Item ================ ########################
		<p class="discTria">
			$tlang.getString("add.props")
		</p>
		<p class="shorttext">
			<label for="description">
				$tlang.getString("gen.description")
			</label>
			<textarea id="description" name="description" 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">
						$tlang.getString("edit.cstatus")
					</label>	
					<select name="copyright" id ="copyright" onchange="javascript:updateCopyright(this);">
						#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">
					#if($item.copyrightStatus == $USE_THIS_COPYRIGHT)
						<p class="shorttext">
							<span class="reqStar">*</span>
							<label for="newcopyright">
								$tlang.getString("edit.cinfo")
							</label>	
							<textarea name="newcopyright" id="newcopyright" rows="2" cols="40" wrap="virtual" >$validator.escapeHtmlTextarea("$!item.copyrightInfo")</textarea>
						</p>	
					#else
						<input type="hidden" name="newcopyright" id="newcopyright" value="$!item.copyrightInfo" />
					#end
				</div>
				<table border="0">
					<tr>
						<td style="width:180px;padding-left:1em;vertical-align:top">
							<label for="copyrightAlert">
								$tlang.getString("edit.calert")
							</label>
						</td>
						<td style="vertical-align:top">
							<input type="checkbox" name="copyrightAlert" id ="copyrightAlert" value="true" #if($item.hasCopyrightAlert())checked="checked"#end style="border:none" />
							$tlang.getString("edit.display1")
							<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")
						</td>
					</tr>
				</table>
			#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" id="hidden_false" value="false" #if(!$item.isHidden())checked="checked" #end/>
					</td>
					<td colspan="4">
						<label for="hidden_false">
							$tlang.getString("avail.show")
						</label>
					</td>
				</tr>
				<tr>
					<td>
					</td>
					<td>
						<input type="checkbox" name="use_start_date" id="use_start_date" value="true" #if($item.useReleaseDate())checked="checked" #end/>
					</td>
					<td colspan="3">
						<label for="use_start_date">
							$tlang.getString("avail.start")
						</label>
					</td>
				</tr>
				<tr>
					<td>
					</td>
					<td>
					</td>
					<td>
					</td>
					<td>
						<label for="release_year">Date:</label>
					</td>
					<td>
						<label for="release_hour">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" "release_month" "release_day" $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" $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" id="use_end_date" value="true" #if($item.useRetractDate())checked="checked" #end/>
					</td>
					<td colspan="4">
						<label for="use_end_date">
							$tlang.getString("avail.end")
						</label>
					</td>
				</tr>
				<tr>
					<td>
					</td>
					<td>
					</td>
					<td>
					</td>
					<td>
						<label for="retract_year">Date:</label>
					</td>
					<td>
						<label for="retract_time">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" "retract_month" "retract_day" $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" $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" id="hidden_true" value="true" #if($item.isHidden())checked="checked" #end/>
					</td>
					<td colspan="4">
						<label for="hidden_true">
							$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" id="access_mode_hidden" value="$INHERITED_ACCESS" />
			#elseif($item.isSingleGroupInherited())
				<h4>$item.singleGroupTitle</h4>
				<input type="hidden" name="access_mode" id="access_mode_hidden" value="$INHERITED_ACCESS" />
			#elseif($item.isSiteOnly())
				<h4>$tlang.getString("access.title3")</h4>
				<input type="hidden" name="access_mode" 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" id="access_mode_public" value="public" #if($!item.isPubview()) checked="checked"#end  style="border:none" onclick="javascript:document.getElementById('groupTable').style.display='none';" onkeypress="javascript:document.getElementById('groupTable').style.display='none';" />
							<label for="access_mode_public">$tlang.getString("edit.access2")</label>
						</p>
					#end
					<p class="checkbox">
						<input type="radio" name="access_mode" id="access_mode_$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').style.display='none';" onkeypress="javascript:document.getElementById('groupTable').style.display='none';" />
						<label for="access_mode_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" id="access_mode_$GROUP_ACCESS" value="$GROUP_ACCESS" #if("$!item.access" == "$GROUP_ACCESS") checked="checked"#end  style="border:none" onclick="javascript:document.getElementById('groupTable').style.display='block';" onkeypress="javascript:document.getElementById('groupTable').style.display='block';" />
							<label for="access_mode_$GROUP_ACCESS">$tlang.getString("edit.access4")</label>
						</p>
					#end
				</div>
			#end
			#if($item.isGroupPossible())
				<table id="groupTable" 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" style="width:2em;padding-left:.4em">
							<input type="checkbox" id="selectall" title="toggle select all" onclick="javascript:toggleSelectAll(this, 'access_groups')" onkeypress="javascript:toggleSelectAll(this, 'access_groups')" />
						</th>
						<th id="groupname">
							$tlang.getString("edit.group1")
						</th>
						<th id ="groupdescription">
							$tlang.getString("edit.group2")
						</th>
					</tr>
					#set($theGroups = $item.allSiteGroups)
					#foreach ($group in $!{theGroups})
						#if($item.isPossible($group))
							<tr>
								<td headers="selected" style="padding-bottom:0;" style="width:2em">
									#if($item.allowedRemove($group))
										<input type="checkbox" name="access_groups" id="access_groups_$group.Id" title="$group.title" value="$group.Id" #if($item.isLocal($group) || $item.isGroupInherited()) checked="checked"#end />
									#else
										<img src="#imageLink("sakai/checkon.gif")" border="0" width="17" height="13" align="top" />
									#end
								</td>
								<td headers="name" style="padding-bottom:0;" class="checkbox">
									<label for="access_groups_$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($item.canSetQuota())
			<p class="shorttext">
				<label for="hasQuota">
					$tlang.getString("gen.quota") ($tlang.getString("gen.kb")):
				</label>	
				<input type="hidden" name="setQuota" value="true" />
				<input type="checkbox" name="hasQuota" id="hasQuota" value="true"#if($item.hasQuota()) checked="checked" #end style="border:none" />
				<input type="text" size="10" name="quota" id="quota" value="$!item.quota" />
			</p>	
		#end
		<table class="itemSummary" border="0" style="clear:both;margin:left:.7em">
			#if (!($dropboxMode && $collectionId==$homeCollectionId))
				<tr> 
					<td style="width:180px;padding-left:.7em"> 
						<label>$tlang.getString("gen.created")</label>
					</td>
					<td>
						$validator.escapeHtml("$item.createdBy")
					</td>
				</tr>
			#end
			<tr> 
				<td style="width:180px;padding-left:.7em"> 
					<label>$tlang.getString("gen.creatime")</label>
				</td>
				<td>
					$validator.escapeHtml("$item.createdTime")
				</td>
			</tr>
			<tr> 
				<td style="width:180px;padding-left:.7em"> 
					<label>$tlang.getString("gen.last")</label>
				</td>
				<td>
					$validator.escapeHtml("$item.modifiedTime")
				</td>
			</tr>
			#if (!($dropboxMode && $atHome))
				<tr>
					<td style="width:180px;padding-left:.7em"> 
						<label>$tlang.getString("gen.lastby")</label>
					</td>
					<td>
						$validator.escapeHtml("$item.modifiedBy")
					</td>
				</tr>
			#end
			#if (! $item.isStructuredArtifact())
				<tr> 
					<td style="width:180px;padding-left:.7em"> 
						<label>$tlang.getString("gen.stored")</label>
					</td>
					<td>
						<a href="$item.url" target="_blank"   title="[$tlang.getString('gen.newwin')]">$item.url</a>
					</td>
				</tr>
				#if(! $item.isUrl())
					<tr> 
						<td style="width:180px;padding-left:.7em"> 
							<label>$tlang.getString("gen.type")</label>
						</td>
						<td>
							<span id="mime_warning"></span>
							<span id="mime_widget">
								$item.MimeType
								<input type="hidden" name="mime_category" id="mime_category" value="$item.mimeCategory" />  
								<input type="hidden" name="mime_subtype" id="mime_subtype" value="$item.mimeSubtype" />
								<input type="button" value="Change File Type" onclick="javascript:changeMimeType('$item.mimeCategory', '$item.mimeSubtype')" />
							</span>
						</td>
					</tr>
				#end
				<tr> 
					<td  style="width:180px;padding-left:.7em"> 
						<label>$tlang.getString("gen.size")</label>
					</td>
					<td>
						$item.size 
					</td>
				</tr>
			#end
		</table> 
		#if (!$dropboxMode)
			#if (!$item.isFolder())
				#if ($notification)
					<p class="shorttext">
						<label for="notify">
							$tlang.getString("gen.email1")
						</label>	
						<select name="notify" id="notify">
							<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
		
	
		############################################# this is the section to edit metadata  
		#if($metadataGroups)
			#foreach($group in $metadataGroups)				  
				#if ($group.isShowing())
					<p class="discTria">
						<a href="#" onclick="javascript:document.getElementById('propertyForm').action='#toolLinkParam("ResourcesAction" "doSavechanges" "special=upload&flow=hideMetadata&metadataGroup=$validator.escapeUrl($group.name)")';submitform('propertyForm');" 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.escapeJsQuoted("$!tag.fullname")">
									$tag.label
								</label>
								<input type="text" size="40"
									name="$!tag.fullname" 
									id="$validator.escapeJsQuoted("$!tag.fullname")" 
									value="$!item.metadata.get("$tag.fullname")" 
								/>
							#elseif("$!tag.widget" == "$!TEXTAREA")
								<label for ="$validator.escapeJsQuoted("$!tag.fullname")">
									$tag.label
								</label>
								<textarea rows="4" cols="30" 
									name="$!tag.fullname" 
									id="$validator.escapeJsQuoted("$!tag.fullname")" >$validator.escapeHtmlTextarea($item.metadata.get("$tag.fullname"))</textarea>
	
							#elseif("$!tag.widget" == "$!DATE")
								<label for ="$validator.escapeJsQuoted("$!tag.fullname")">
									$tag.label
								</label>
								<input type="hidden" id="$validator.escapeJsQuoted("$!tag.fullname")" value="" />
								#if($!item.metadata.get("$tag.fullname"))
									#set($theValue = $!item.metadata.get("$tag.fullname"))
								#else
									#set($theValue = $today)
								#end 
								#prop_dateSelectionWidget(${tag.fullname} $theValue)
							#elseif("$!tag.widget" == "$!DATETIME")
								<label for ="$validator.escapeJsQuoted("$!tag.fullname")">
									$tag.label
								</label>
								<input type="hidden" id="$validator.escapeJsQuoted("$!tag.fullname")" value="" />
								#if($!item.metadata.get("$tag.fullname"))
									#set($theValue = $!item.metadata.get("$tag.fullname"))
								#else
									#set($theValue = $today)
								#end 
								#prop_dateSelectionWidget(${tag.fullname} $theValue)
								#prop_timeSelectionWidget(${tag.fullname} $theValue)
							#elseif("$!tag.widget" == "$!TIME")
								<label for ="$validator.escapeJsQuoted("$!tag.fullname")">
									$tag.label
								</label>
								<input type="hidden" id="$validator.escapeJsQuoted("$!tag.fullname")" value="" />
								#if($!item.metadata.get("$tag.fullname"))
									#set($theValue = $!item.metadata.get("$tag.fullname"))
								#else
									#set($theValue = $today)
								#end 
								#prop_timeSelectionWidget(${tag.fullname} $theValue)
	
							#else
								$tag.fullname<br />
								$tag.widget<br />
								$!item.metadata.get("$tag.fullname")<br />
							#end
						</p>
					#end
					
				#else
					<p class="discTria">
						##<a href="#" onclick="javascript: document.getElementById('flow').value='showMetadata'; document.getElementById('metadataGroup').value='$validator.escapeUrl($group.name)'; submitform('propertyForm'); return false;" title="$tlang.getString("edit.hide") $metadataGroup.name">	
						<a href="#" onclick="javascript:document.getElementById('propertyForm').action='#toolLinkParam("ResourcesAction" "doSavechanges" "special=upload&flow=showMetadata&metadataGroup=$validator.escapeUrl($group.name)")';submitform('propertyForm');" title="$tlang.getString("edit.show") $group.name">
							<img src="#imageLink("sakai/expand.gif")" alt="$tlang.getString("edit.show") $group.name" border="0" width="15" height="15" align="top" />
						</a>
						$validator.escapeHtml($group.name)
					</p>
				#end
			#end
		#end
		############################################# end of section to show metadata 
	
		<p class="act">
	##if("$itemType" == "$TYPE_UPLOAD") 
	#if($item.isFileUpload())
			<input type="button" class="active" name="doSavechanges" onclick="document.getElementById('propertyForm').action='#toolLinkParam("ResourcesAction" "doSavechanges" "special=upload&flow=update")';submitform('propertyForm');" value="$tlang.getString("edit.update")" accesskey="s" />
	#else
			<input type="button" class="active" name="doSavechanges" onclick="document.getElementById('propertyForm').action='#toolLinkParam("ResourcesAction" "doSavechanges" "flow=update")';submitform('propertyForm');" value="$tlang.getString("edit.update")" accesskey="s" />
	#end
			<input type="button" name="doCancel" onclick="javascript:document.getElementById('propertyForm').action='#toolLinkParam("ResourcesAction" "doSavechanges" "flow=cancel")';submitform('propertyForm');" value="$tlang.getString("gen.cancel")" accesskey="x" />
		</p>
		
	</form>
</div>
<script type="text/javascript">
<!--
	var mimeCategories = new Array();
#set($count = 0)
#foreach($category in $contentTypeImageService.MimeCategories)
	mimeCategories[$count] = "$category";
#set($count = $count + 1)
#end
	var mimeSubtypes = new Array();
#foreach($category in $contentTypeImageService.MimeCategories)
	mimeSubtypes["$category"] = new Array();
#set($count = 0)
#foreach($subtype in $contentTypeImageService.getMimeSubtypes("$category"))
	mimeSubtypes["$category"][$count] = "$subtype"
#set($count = $count + 1)
#end
#end
-->
</script>

