function loadAttribute()
{		
	in_list=false;
	for(var i = 0;i < attributes.length;i++){ 
		if (attributes[i]==document.edit.attributes_select.value) 
			in_list=true;
	} 
	txt_val=document.edit.attributes_select.options[document.edit.attributes_select.selectedIndex].text;		
	if (document.edit.attributes_select.value!='' && !in_list){
		cnt=document.edit.cnt_attributes.value;
		text="<span id='attr_"+document.edit.attributes_select.value+"'><input type='checkbox' name='attribute_req["+cnt+"]' value='Y' ";
		if (document.getElementById('required').checked==true)
			text=text+" checked ";
		text=text+" ><input type='hidden' name='attribute["+cnt+"]' value='"+document.edit.attributes_select.value+"'>"+txt_val+"&nbsp;&nbsp;<a href='javascript:deleteAttribute("+document.edit.attributes_select.value+")'>Remove</a><br></span>";
		document.edit.cnt_attributes.value=Number(cnt)+1;
		attributes[cnt]=document.edit.attributes_select.value;
		document.getElementById('attributes_error').innerHTML='';
		document.getElementById('all_attributes').innerHTML=document.getElementById('all_attributes').innerHTML+text;
	}
	else if (in_list)  {
		document.getElementById('attributes_error').innerHTML="Attribute '"+txt_val+"' is already in list!"
	}
}
function deleteAttribute(attr_id)
{		
	document.getElementById('attributes_error').innerHTML='';
	idname="attr_"+attr_id;
	document.getElementById(idname).innerHTML='';
	document.getElementById(idname).id="temp";
	for(var i = 0;i < attributes.length;i++){ 
		if (attributes[i]==attr_id){ 
			attributes.splice(i,1);
			break;
		}
	} 
}
function RTloadAttributeAdd()
{		
	in_list=false;
	for(var i = 0;i < attributes.length;i++){ 
		if (attributes[i]==document.RT_add.attributes_select.value) 
			in_list=true;
	} 
	txt_val=document.RT_add.attributes_select.options[document.RT_add.attributes_select.selectedIndex].text;		
	if (document.RT_add.attributes_select.value!='' && !in_list){
		cnt=document.RT_add.cnt_attributes.value;
		text="<span id='attr_"+document.RT_add.attributes_select.value+"'><input type='checkbox' name='attribute_req["+cnt+"]' onClick='changeCheckValue(this);' ";
		if (document.getElementById('required').checked==true)
			text=text+" checked value='Y' ";
		else text=text+" value='N' ";
		text=text+" ><input type='hidden' name='attribute["+cnt+"]' value='"+document.RT_add.attributes_select.value+"'>"+txt_val+"&nbsp;&nbsp;<a href='javascript:deleteAttribute("+document.RT_add.attributes_select.value+")'>Remove</a><br></span>";
		//text="<span id='attr_"+document.add.attributes_select.value+"'><input type='hidden' name='attribute["+cnt+"]' value='"+document.add.attributes_select.value+"'>"+txt_val+"&nbsp;&nbsp;<a href='javascript:deleteAttribute("+document.add.attributes_select.value+")'>Remove</a><br></span>";
		document.RT_add.cnt_attributes.value=Number(cnt)+1;
		attributes[cnt]=document.RT_add.attributes_select.value;
		document.getElementById('attributes_error').innerHTML='';
		document.getElementById('all_attributes').innerHTML=document.getElementById('all_attributes').innerHTML+text;
	}
	else if (in_list)  {
		document.getElementById('attributes_error').innerHTML="Attribute '"+txt_val+"' is already in list!"
	}
}
