function makeKeywords(){
	document.forms['articleform'].formAction.value='makeKeyWords';
	document.forms['articleform'].submit();
}

function removeSubjects(){
	p=document.getElementById('new_subject');
	q=document.getElementById('subject_list');
	for(i=0;i<q.options.length;i++){
		if(q.options[i].selected){
			l=p.options.length;
			p.options[l]=new Option(q.options[q.options.selectedIndex].text,q.options[q.options.selectedIndex].value);
			q.options[i]=null;
		}
	}
}

function addSubject(){
	p=document.getElementById('new_subject');
	q=document.getElementById('subject_list');
	l=q.options.length;
	q.options[l]=new Option(p.options[p.options.selectedIndex].text,p.options[p.options.selectedIndex].value);
	p.options[p.options.selectedIndex]=null;
	p.options.selectedIndex=0;
}

function removeCities(){
	p=document.getElementById('new_city');
	q=document.getElementById('city_list');
	for(i=0;i<q.options.length;i++){
		if(q.options[i].selected){
			l=p.options.length;
			p.options[l]=new Option(q.options[q.options.selectedIndex].text,q.options[q.options.selectedIndex].value);
			q.options[i]=null;
		}
	}
}

function addCity(){
	p=document.getElementById('new_city');
	q=document.getElementById('city_list');
	l=q.options.length;
	q.options[l]=new Option(p.options[p.options.selectedIndex].text,p.options[p.options.selectedIndex].value);
	p.options[p.options.selectedIndex]=null;
	p.options.selectedIndex=0;
}

function removePeople(){
	p=document.getElementById('new_person');
	q=document.getElementById('people_list');
	for(i=0;i<q.options.length;i++){
		if(q.options[i].selected){
			l=p.options.length;
			p.options[l]=new Option(q.options[q.options.selectedIndex].text,q.options[q.options.selectedIndex].value);
			q.options[i]=null;
		}
	}
}

function addPerson(){
	p=document.getElementById('new_person');
	q=document.getElementById('people_list');
	l=q.options.length;
	q.options[l]=new Option(p.options[p.options.selectedIndex].text,p.options[p.options.selectedIndex].value);
	p.options[p.options.selectedIndex]=null;
	p.options.selectedIndex=0;
}

function saveArticle(){
	q=document.getElementById('subject_list');
	for(i=0;i<q.options.length;i++){
		q.options[i].selected=true;
	}
	q=document.getElementById('city_list');
	for(i=0;i<q.options.length;i++){
		q.options[i].selected=true;
	}
	q=document.getElementById('people_list');
	for(i=0;i<q.options.length;i++){
		q.options[i].selected=true;
	}
	document.forms['articleform'].formAction.value='updateArticle';
	document.forms['articleform'].action='index.php?type=menu&id=".ARTICLE_LIST."'
	document.forms['articleform'].submit();
}

function deleteArticle(){
	document.forms['articleform'].action='index.php?type=menu&id=".ARTICLE_LIST."'
	document.forms['articleform'].formAction.value='deleteArticle';
	document.forms['articleform'].submit();
}

function new_subject(){
	var newdiv = document.createElement('div');
	newdiv.setAttribute('id','DivName');
	newdiv.style.width = 135;
	newdiv.style.left = 855;
	newdiv.style.padding = 5;
	newdiv.style.top = 235;
	newdiv.style.position = 'absolute';
	newdiv.style.background = '#d0d0d0';
	newdiv.zOrder=1000;

	newdiv.innerHTML = '<form name=addSubject>new subjec<input class=add_cat_input type=text name=new_cat><br><div><a href=javascript:addNewSubject(document.forms[\"addSubject\"].new_cat.value)>Add</a></div></form>'
	document.body.appendChild(newdiv);
}

function new_city(){
	var newdiv = document.createElement('div');
	newdiv.setAttribute('id','DivName');
	newdiv.style.width = 135;
	newdiv.style.left = 855;
	newdiv.style.padding = 5;
	newdiv.style.top = 380;
	newdiv.style.position = 'absolute';
	newdiv.style.background = '#d0d0d0';
	newdiv.zOrder=1000;

	newdiv.innerHTML = '<form name=addCity>new city<input class=add_cat_input type=text name=new_cat><br><div><a href=javascript:addNewCity(document.forms[\"addCity\"].new_cat.value)>Add</a></div></form>';
	document.body.appendChild(newdiv);
}

function new_person(){
	var newdiv = document.createElement('div');
	newdiv.setAttribute('id','DivName');
	newdiv.style.width = 135;
	newdiv.style.left = 855;
	newdiv.style.top = 513;
	newdiv.style.padding = 5;
	newdiv.style.position = 'absolute';
	newdiv.style.background = '#d0d0d0';
	newdiv.zOrder=1000;

	newdiv.innerHTML = '<form name=addPerson>new person<input class=add_cat_input type=text name=new_cat><br><div><a href=javascript:addNewPerson(document.forms[\"addPerson\"].new_cat.value)>Add</a></div></form>';
	document.body.appendChild(newdiv);
}
function addNewSubject(val){
	q=document.getElementById('subject_list');
	l=q.options.length;
	q.options[l]=new Option(val,'#'+val);
	newdiv=document.getElementById('DivName');
	document.body.removeChild(newdiv);
}
function addNewCity(val){
	q=document.getElementById('city_list');
	l=q.options.length;
	q.options[l]=new Option(val,'#'+val);
	newdiv=document.getElementById('DivName');
	document.body.removeChild(newdiv);
}
function addNewPerson(val){
	q=document.getElementById('people_list');
	l=q.options.length;
	q.options[l]=new Option(val,'#'+val);
	newdiv=document.getElementById('DivName');
	document.body.removeChild(newdiv);
}
