function answerQuestions (state,cat_suffix, cat_version)
{
	try
	{
		Obj("hidden_action").value="start";	
		Obj("hidden_state").value=state;
		Obj("catalogue_suffix").value=cat_suffix;
		Obj("catalogue_version").value=cat_version;
		if (Obj("lb_department")!=null)
			Obj("lb_department").selectedIndex=0;
		if (Obj("lb_category")!=null)
			Obj("lb_category").selectedIndex=0;
		if (Obj("lb_subcategory")!=null)
			Obj("lb_subcategory").selectedIndex=0;
		if (Obj("lb_criteria")!=null)
			Obj("lb_criteria").selectedIndex=0;
	}catch (err)
	{
	}
}
function answerQuestions2 (state,cat_version)
{
	Obj("hidden_action").value="start";	
	Obj("hidden_state").value=state;
	Obj("catalogue_version").value=cat_version;
	if (Obj("lb_department")!=null)
		Obj("lb_department").selectedIndex=0;
	if (Obj("lb_issue_1")!=null)
		Obj("lb_issue_1").selectedIndex=0;
	if (Obj("lb_issue_2")!=null)
		Obj("lb_issue_2").selectedIndex=0;
	if (Obj("lb_issue_3")!=null)
		Obj("lb_issue_3").selectedIndex=0;
}
var lastEventClicked=null;
function showEventPreview(ahref, event_id)
{
	if (lastEventClicked!=null)
		lastEventClicked.style.fontWeight="normal";
	ahref.style.fontWeight="bold";
	lastEventClicked=ahref;
	Obj ("hidden_event_id").value=event_id;
	Obj("form_preview_event").submit();
}
var lastNewsClicked=null;
function showNewsPreview(ahref, news_id)
{
	if (lastNewsClicked!=null)
		lastNewsClicked.style.fontWeight="normal";
	ahref.style.fontWeight="bold";
	lastNewsClicked=ahref;
	var win = window.open("view.aspx?mode=6&news_id=" + String(news_id),"News","width=620,height=500,scrollbars=yes,resizable=yes");
	//if(win!=null)
	//		win.focus();
	
}
function showDocumentPreview(ahref, event_id)
{
	if (lastEventClicked!=null)
		lastEventClicked.style.fontWeight="normal";
	ahref.style.fontWeight="bold";
	lastEventClicked=ahref;
	Obj ("hidden_doc_id").value=event_id;
	Obj ("hidden_mode").value="4";
	Obj("form_preview_event").submit();
}

var lastItemClicked=null;
function showItemPreview(ahref, item_id,idName,mode,form_guid)
{
	if (lastItemClicked!=null)
		lastItemClicked.style.fontWeight="normal";
	ahref.style.fontWeight="bold";
	lastItemClicked=ahref;
	
	
	var win = window.open("view.aspx?popup=true&mode=" + mode + "&" + idName + "=" + String(item_id)+
			(form_guid?"&form_guid=" + form_guid:""),
			"PreviewItem", 
			(!form_guid?"width=600,height=500":"") + ",scrollbars=yes,resizable=yes");
	
}
function showEmployees(wert)
{
	try
	{ 
		var table = Obj("table_inform_employees");
		for(var i=0;i<table.rows.length;i++)
		{
			var tr =table.rows[i];				
			if (wert==0) //Anzeigen
				tr.cells[0].style.display="";
			else
				tr.cells[0].style.display="none";
			
			if (i>0)
				tr.cells[0].firstChild.checked=false;
		}		
	
		
	}catch (err)
	{
		window.status=err.message;
	}
}
function filterHospital(wert)
{
	window.status="";
	undisplayObj(Obj("div_hospitals"));
	
		Obj("KH_GUID").value=wert;		
		var table = document.getElementById("table_inform_employees");
		for(var i=1;i<table.rows.length;i++)
		{
			var tr =table.rows[i];				
			if (wert==-1) //Anzeigen
				tr.style.display="";
			else
			{
				
				var trId = tr.id;
				
				if ( (String(wert) + "_" ) == trId.substr(0, String(wert).length +1))
					tr.style.display="";
				else
					tr.style.display="none";
			}
		}			
	
	
}
function showHospitalList(Event)
{
	var obj = Obj('div_hospitals');

	if (obj.style.display=='') 
	{
		obj.style.display='none';
	}	
	else{
		 
		obj.style.left = Event.srcElement.offsetLeft-93;// + document.body.scrollLeft;
		obj.style.top = Event.srcElement.offsetTop+18; // + document.body.scrollTop;;
		obj.style.display=''; 
	}
}

function mouseOverRow(row)
{
	if (lastCell==null)
	{
		row.cells[0].firstChild.nextSibling.style.display="";		
	}
	
}
function mouseOutRow(row)
{
	if (lastCell==null)
		row.cells[0].firstChild.nextSibling.style.display="none";
	
}
var lastCell;

function onClickRow2(row, id, action, year, type)
{
	//var cell =row.cells[0];
	//if (lastCell!=null)
	//{
	//	highlight_row(lastCell.parentNode,"white","black");
	///	lastCell.firstChild.nextSibling.style.display="none";
	//}
	//lastCell=cell;
	////cell.firstChild.nextSibling.style.display="";	
	//highlight_row(cell.parentNode,"#778899", "white");	
	//selectRowForEditing(row);
	openEditPopup2(id,action,year,type);
	
}

function onClickRow(row, catalogue_type_suffix, id,action,year)
{
	//selectRowForEditing(row);
	openEditPopup(catalogue_type_suffix, id,action,year);
}
function selectRowForEditing (row)
{
	var cell =row.cells[0];
	
	if (lastCell!=null && lastCell!=cell)
	{
		highlight_row(lastCell.parentNode,"white","black");
		lastCell.firstChild.nextSibling.style.display="none";
	}
	lastCell=cell;
	cell.firstChild.nextSibling.style.display="";	
	lastCell.firstChild.nextSibling.style.display="";
	highlight_row(cell.parentNode,"#778899", "white");	
}
function openEditPopup2(id,action,year,type)
{
	
	var win;
	var link, hospital;
	if (action=="assign")
	{
		win= window.open("","AssigningQuestions2","status=yes,dependent=false,left=300,top=200,width=800,height=500,scrollbars=yes,toolbar=no,resizable=yes");
		//edit_popup.aspx?hidden_action=answering&question_id=" + id + "&lang=" + Obj("lang").value	
		win.status="Hier können Sie die gewählten Themen Mitarbeitern zuweisen";
		link="assignment_popup2.aspx";
		Obj("edit_question_form").target="AssigningQuestions2";
		Obj("question_id").value=id;	
		Obj("edit_question_form").action=link+"?catalogue_type=" + type + "&lang=" + Obj("lang2").value + "&user_id="+ Obj("user_id").value;
		Obj("edit_question_form").submit();
	}
	else
	{
		link="modules/edit_popup2.aspx";
		hospital="";
		if (action=="summarize")
		{
			win= window.open("","SummarizingAnswers2","status=yes,dependent=false,left=300,top=200,width=800,height=500,scrollbars=yes,toolbar=no,resizable=yes");
			//edit_popup.aspx?hidden_action=answering&question_id=" + id + "&lang=" + Obj("lang").value	
			win.status="Hier können Sie die Antworten zusammenfassen";
			link="summarize_popup2.aspx";
			Obj("edit_question_form").target="SummarizingAnswers2";
			Obj("hospital_id").value=Obj("lb_hospital").value;
			Obj("hospital_name").value=Obj("lb_hospital").options[Obj("lb_hospital").selectedIndex].text;
		}
		if (action=="rating")
		{
			win= window.open("","RatingAnswers2","status=yes,dependent=false,left=300,top=200,width=800,height=500,scrollbars=yes,toolbar=no,resizable=yes");
			//edit_popup.aspx?hidden_action=answering&question_id=" + id + "&lang=" + Obj("lang").value	
			win.status="Hier können Sie die Themen bewerten";
			link="rating_popup2.aspx";
			Obj("edit_question_form").target="RatingAnswers2";
			Obj("hospital_id").value=Obj("lb_hospital").value;
			Obj("hospital_name").value=Obj("lb_hospital").options[Obj("lb_hospital").selectedIndex].text;
		}
		else if (action=="answering")
		{
			win= window.open("","EditQuestions","status=yes,dependent=false,left=300,top=200,width=800,height=600,scrollbars=yes,toolbar=no,resizable=yes");
			//edit_popup.aspx?hidden_action=answering&question_id=" + id + "&lang=" + Obj("lang").value	
			win.status="Hier können Sie die Frage beantworten";
			edit_answers_popup_window = win;
			timer_popup_watch = window.setTimeout("checkIfPopupClosed()",1000);
		}
		
		Obj("question_id").value=id;		
		Obj("edit_question_form").action=link+"?catalogue_type=" + type + "&user_id=" + Obj("user_id").value + "&hidden_action=" + action + "&lang=" + Obj("lang").value;
		Obj("edit_question_form").submit();
	}
	win.focus();	
}
function openEditPopup(catalogue_type_suffix,id,action,year)
{
	
	var win;
	var link, hospital;
	if (action=="assign")
	{
			win= window.open("","AssigningQuestions","status=yes,dependent=false,left=300,top=200,width=800,height=440,scrollbars=yes,toolbar=no");
			//edit_popup.aspx?hidden_action=answering&question_id=" + id + "&lang=" + Obj("lang").value	
			win.status="Hier können Sie die gewählten Fragen Mitarbeitern zuweisen";
			link="assignment_popup.aspx";
			Obj("edit_question_form").target="AssigningQuestions";
			Obj("question_id").value=id;	
			Obj("edit_question_form").action=link+"?lang=" + Obj("lang").value + "&user_id="+ Obj("user_id").value;
			Obj("edit_question_form").submit();
			//Obj("hospital_id").value=Obj("lb_hospital").value;
			//Obj("hospital_name").value=Obj("lb_hospital").options[Obj("lb_hospital").selectedIndex].text;
	}
	else 
		{
		link="modules/edit_popup.aspx";
		hospital="";
		
		if (action=="summarize")
		{
			win= window.open("","SummarizingAnswers","status=yes,dependent=false,left=300,top=200,width=800,height=500,scrollbars=yes,toolbar=no,resizable=yes");
			//edit_popup.aspx?hidden_action=answering&question_id=" + id + "&lang=" + Obj("lang").value	
			win.status="Hier können Sie die Antworten zusammenfassen";
			link="summarize_popup.aspx";
			Obj("edit_question_form").target="SummarizingAnswers";
			Obj("hospital_id").value=Obj("lb_hospital").value;
			Obj("hospital_name").value=Obj("lb_hospital").options[Obj("lb_hospital").selectedIndex].text;
		}
		else if (action=="criterion_description")
		{
			win= window.open("","DescribingCriteria","status=yes,dependent=false,left=300,top=200,width=800,height=500,scrollbars=yes,toolbar=no,resizable=yes");
			win.status="Hier können Sie die Kriterien beschreiben";
			link="criterion_description_popup.aspx";
			Obj("edit_question_form").target="DescribingCriteria";
			Obj("hospital_id").value=Obj("lb_hospital").value;
			Obj("year").value=Obj("lb_year").value;
			Obj("criterion_id").value=id;	
			Obj("hospital_name").value=Obj("lb_hospital").options[Obj("lb_hospital").selectedIndex].text;
		}
		
		else
		{
			win= window.open("","EditQuestions","status=yes,dependent=false,left=300,top=200,width=800,height=410,scrollbars=yes,toolbar=no");
			//edit_popup.aspx?hidden_action=answering&question_id=" + id + "&lang=" + Obj("lang").value	
			win.status="Hier können Sie die Frage beantworten";
			edit_answers_popup_window = win;
			timer_popup_watch = window.setTimeout("checkIfPopupClosed()",1000);
			
		}
		
		
		Obj("question_id").value=id;		
		Obj("edit_question_form").action=link+"?user_id=" + Obj("user_id").value + "&hidden_action=" + action + "&lang=" + Obj("lang").value;
		Obj("edit_question_form").submit();
	}
	win.focus();
	
}

function highlight_row (row, bgColor, fgColor)
{
	for(var i=1;i<row.cells.length;i++)
	{
		row.cells[i].bgColor=bgColor;
		row.cells[i].style.color=fgColor;
		
	}	
}
function setHospital(idx)
{
	Obj("hidden_action").value="preselection";
	Obj("hidden_changed").value="hospital";
	
	Obj("start_form").submit();
}
function setHospitalForRtfBrochure(idx)
{
	try
	{
		Obj("document").value="brochure";
		Obj("document_type").value="";
		Obj("form_print_version").submit();
	}catch (er)
	{
		//alert(er.message);
	}
}
function showOldAnswers()
{
	var win = window.open("summarize_popup.aspx?action=show_rest&question_id=" + 
		Obj("question_id").value + "&hospital_id=" + Obj("hospital_id").value +
		"&user_id=" + Obj("user_id").value ,
		"Old_Answers","width=600,height=500,resizable=yes,scrollbars=yes");
	win.focus();
}
function setHospital2(idx)
{
	Obj("hidden_action").value="preselection";
	Obj("hidden_changed").value="hospital";
	Obj("start_form").submit();
}
function setReport(idx)
{
	Obj("hidden_action").value="preselection";
	Obj("hidden_changed").value="report_name";
	Obj("start_form").submit();
}
function setDepartment(idx)
{
	Obj("hidden_action").value="preselection";
	Obj("hidden_changed").value="department";
	Obj("start_form").submit();
}
function setEmployee(idx)
{
	Obj("hidden_action").value="preselection";
	Obj("hidden_changed").value="employee";
	Obj("start_form").submit();
}
function setUserGroup(idx)
{
	Obj("hidden_action").value="preselection";
	Obj("hidden_changed").value="user_group";
	Obj("start_form").submit();
}
function resetListBox(id,selectedIndex)
{
	if ($(id)!=null)
		$(id).selectedIndex = (selectedIndex==null?0:selectedIndex);
}
function setCatalogueType(idx)
{
	Obj("hidden_action").value="preselection";
	Obj("hidden_changed").value="catalogue_type";
	if($("lb_catalogue_version")!=null)
		$("lb_catalogue_version").selectedIndex = 0;
	Obj("start_form").submit();
}
function setCatalogueVersion(idx)
{
	Obj("hidden_action").value="preselection";
	Obj("hidden_changed").value="catalogue_version";
	Obj("start_form").submit();
}
function setIssue2(idx)
{
	Obj("hidden_action").value="preselection";
	Obj("hidden_changed").value="cat";
	Obj("start_form").submit();
}
function unselectSubItems2(level)
{
	for (var i=Number(level)+1; i<10; i++)
	{
		if($("lb_issue_" + i)!=null)
			$("lb_issue_" + i).selectedIndex = 0;
			
	}
}
function setCategory(idx)
{
	Obj("hidden_action").value="preselection";
	Obj("hidden_changed").value="cat";
	Obj("start_form").submit();
}
function setSubcategory(idx)
{
	Obj("hidden_action").value="preselection";
	Obj("hidden_changed").value="subcat";
	Obj("start_form").submit();
}
function setCriteria(idx)
{
	//Obj("hidden_criteria_idx").value=idx;	
	Obj("hidden_action").value="preselection";
	Obj("hidden_changed").value="crit";
	Obj("start_form").submit();
}
function setQuestions(idx)
{
	
	
}
function setPhase(idx)
{
	/*Obj("hidden_action").value="preselection";
	Obj("hidden_changed").value="phase";
	Obj("start_form").submit();*/
}
function setAmount(idx)
{
	//Obj("hidden_amount_idx").value=idx;	
}
function assignQuestions()
{
	/*Obj("hidden_action").value="assignment";
	Obj("hidden_table_id").value=24;
	Obj("cms_form").submit();*/
	Obj("form_assign_questions").submit();
	//editTable(24);
}
function assignIQMSQuestions()
{
	/*Obj("hidden_action").value="assignment";
	Obj("hidden_table_id").value=24;
	Obj("cms_form").submit();*/
	Obj("form_assign_iqms_questions").submit();
	//editTable(24);
}
function setAssignQuestionStatus(idx)
{
	//Obj("hidden_amount_idx").value=idx;	
}
function setEditAction(action)
{
	Obj("hidden_action").value=action;
	
}
//Used in criterion description
function navigateTo2(id)
{
	unlock_table = false;
	if (answer_has_been_changed)
	{
		var res=confirm("Möchten Sie wirklich fortfahren, ohne die Änderungen zu speichern?");
		if (!res)
			return false;
	}
	Obj("hidden_action").value="answering";
	Obj("criterion_id").value=id;	
	
	//Obj("actions").submit();
}

function navigateTo(id)
{
	unlock_table = false;
	if (answer_has_been_changed)
	{
		var res=confirm("Möchten Sie wirklich fortfahren, ohne die Änderungen zu speichern?");
		if (!res)
			return false;
	}
	Obj("hidden_action").value="answering";
	Obj("question_id").value=id;	
	
	//Obj("actions").submit();
}
var answer_has_been_changed=false;
function answerChanged()
{
	answer_has_been_changed=true;
	window.status="Speichern Sie Ihre Änderungen!";
	if (Obj("answer_state")!=null)
	{
		//Obj("answer_state").selectedIndex=2;
		//Obj('span_question').style.color='green'
	}
}
function answerChanged2(txtarea)
{
	answer_has_been_changed=true;
		
	if(txtarea!=null && Trim (txtarea.value)== ""  && Obj("answer_state").selectedIndex!=2)
	{
			Obj("answer_state").selectedIndex=0;
			if(Obj("btnSaveAnswer")!=null)
				Obj("btnSaveAnswer").disabled = true;
			//if(Obj('span_question')!=null)
			//	Obj('span_question').style.color='red';
		return;
	}
	else
	{
		if(Obj("btnSaveAnswer")!=null)
			Obj("btnSaveAnswer").disabled = false;
		window.status="Speichern Sie Ihre Änderungen!";
		Obj("answer_state").selectedIndex=2;
		//if(Obj('span_question')!=null)
		//	Obj('span_question').style.color='green';
	}
			
	
}
function displayChangedAnswer(id, text)
{
	var row=document.getElementById ("row_" + id);	
	if (row!=null)
	{
		row.cells[2].innerHtml = text;
		row.cells[3].firstChild.style.bgColor="green";
	}
	
}
function saveAnswer(id, text)
{
	if (Obj("valid_for_year")!=null && Obj("valid_for_year").value=="")
	{
		alert ("Bitte geben Sie zuerst das Jahr an, für welches diese Antwort gelten soll!");
		return false;
	}
	Obj('hidden_action').value='saving_answer';
	
	//window.opener.displayChangedAnswer(id, text);
}
function saveAssigning()
{
	Obj('hidden_action').value='saving_answer';
	var select = Obj("multiple_selected_items");
	
	if(select==null) 
	{
		select = document.getElementsByName("multiple_selected_items")[0];
		
	}
	if(select==null) return false;
	var res="";
	
	for (var i=0; i<select.length;i++)
	{
		res += select[i].value + ",";	
		
	}
	res = res.substr(0,res.length-1);
	Obj("selected_mas").value=res;
	
}
function printVersionMyQuestions()
{
	return printVersion ("questions");
}
function printVersionRecherche()
{
	return printVersion ("recherche");	
}
function printVersionEmployees()
{
	var str="";
	if (Obj("hidden_department")!=null && Obj("hidden_department_name")!=null)
		str+="&department=" + Obj("hidden_department").value +
			"&department_name=" + Obj("hidden_department_name").value;			
	if (Obj("hidden_kh")!=null && Obj("hidden_kh_name")!=null)
		str+="&hospital_idx=" + Obj("hidden_kh").value +
			"&hospital_name=" + Obj("hidden_kh_name").value;			
	
	var win=window.open("modules/print.aspx?user_id=" + Obj("user_id").value + "&document=employees" + str,"PrintVersion","width=650,height=600,scrollbars=yes,toolbar=no,location=no");
	win.focus();
	return false;
}
function printVersionOpenQuestions()
{
	var str="";
	if (Obj("lb_catalogue_type")!=null)
		str+="&catalogue_suffix=" + Obj("lb_catalogue_type").value;
	if (Obj("lb_catalogue_version")!=null)
		str+="&catalogue_version=" + Obj("lb_catalogue_version").value;	
	if (Obj("lb_hospital")!=null)
		str+="&hospital_idx=" + Obj("lb_hospital").value;
	if (Obj("lb_hospital")!=null)
		str+="&hospital_name=" + Obj("lb_hospital").options[Obj("lb_hospital").selectedIndex].text;
	if (Obj("lb_department")!=null)
		str+="&department=" + Obj("lb_department").value;
	
	
	
	
	var win=window.open("print.aspx?user_id=" + Obj("user_id").value + "&document=open_questions" + str,"PrintVersion","width=650,height=600,scrollbars=yes,toolbar=no,location=no");
	win.focus();
	return false;
}
function printVersionQuestionsPerEmployee()
{
	var str="";
	if (Obj("lb_catalogue_type")!=null)
		str+="&catalogue_suffix=" + Obj("lb_catalogue_type").value;
	if (Obj("lb_catalogue_version")!=null)
		str+="&catalogue_version=" + Obj("lb_catalogue_version").value;	
	if (Obj("lb_hospital")!=null)
		str+="&hospital_idx=" + Obj("lb_hospital").value;
	if (Obj("lb_hospital")!=null)
		str+="&hospital_name=" + Obj("lb_hospital").options[Obj("lb_hospital").selectedIndex].text;
	if (Obj("lb_department")!=null)
		str+="&department=" + Obj("lb_department").value;
	if (Obj("lb_department")!=null)
		str+="&department_name=" + Obj("lb_department").options[Obj("lb_department").selectedIndex].text;	
	if (Obj("lb_employee")!=null)
		str+="&employee_idx=" + Obj("lb_employee").value;
	if (Obj("lb_employee")!=null)
		str+="&employee_name=" + Obj("lb_employee").options[Obj("lb_employee").selectedIndex].text;
	if (Obj("lb_category")!=null)
		str+="&category=" + Obj("lb_category").value +
			"&category_name=" + Obj("lb_category").options[Obj("lb_category").selectedIndex].innerHTML;			
	if (Obj("lb_subcategory")!=null)
		str+="&subcategory=" + Obj("lb_subcategory").value + 
			"&subcategory_name=" + Obj("lb_subcategory").options[Obj("lb_subcategory").selectedIndex].innerHTML;
	if (Obj("lb_criteria")!=null)
		str+="&criteria=" + Obj("lb_criteria").value+ 
			"&criterion_name=" + Obj("lb_criteria").options[Obj("lb_criteria").selectedIndex].innerHTML;
	if (Obj("lb_phase")!=null)
		str+="&phase=" + Obj("lb_phase").value+ 
			"&phase_name=" + Obj("lb_phase").options[Obj("lb_phase").selectedIndex].innerHTML;
	
	
	var win=window.open("print.aspx?user_id=" + Obj("user_id").value + "&document=open_questions_per_employee" + str,"PrintVersion","width=650,height=600,scrollbars=yes,toolbar=no,location=no");
	win.focus();
	return false;
}

function printVersion(area)
{
	var str="";
	if ($("actual_hospital"))
		str+="&hospital_idx=" + $("actual_hospital").value;
	if ($("actual_hospital"))
		str+="&hospital_name=" + $("actual_hospital").options [$("actual_hospital").selectedIndex].text;	
		
	if(Obj("catalogue_suffix")!=null)
		str+="&catalogue_suffix=" + Obj("catalogue_suffix").value;
	if(Obj("catalogue_version")!=null)
		str+="&catalogue_version=" + Obj("catalogue_version").value;
	if (Obj("lb_department")!=null)
		str+="&department=" + Obj("lb_department").value +
			"&department_name=" + Obj("lb_department").options[Obj("lb_department").selectedIndex].innerHTML;			
	if (Obj("lb_category")!=null)
		str+="&category=" + Obj("lb_category").value +
			"&category_name=" + Obj("lb_category").options[Obj("lb_category").selectedIndex].innerHTML;			
	if (Obj("lb_subcategory")!=null)
		str+="&subcategory=" + Obj("lb_subcategory").value + 
			"&subcategory_name=" + Obj("lb_subcategory").options[Obj("lb_subcategory").selectedIndex].innerHTML;
	if (Obj("lb_criteria")!=null)
		str+="&criteria=" + Obj("lb_criteria").value+ 
			"&criterion_name=" + Obj("lb_criteria").options[Obj("lb_criteria").selectedIndex].innerHTML;
	if (Obj("lb_phase")!=null)
		str+="&phase=" + Obj("lb_phase").value+ 
			"&phase_name=" + Obj("lb_phase").options[Obj("lb_phase").selectedIndex].innerHTML;
	if (Obj("lb_amount")!=null)
		str+="&amount=" + Obj("lb_amount").value+ 
			"&amount_name=" + Obj("lb_amount").options[Obj("lb_amount").selectedIndex].innerHTML;
	if (Obj("hidden_state")!=null)
		str+="&state=" + Obj("hidden_state").value;
			
	var win=window.open("modules/print" + (area=="recherche" ? "Catalogue" : "") + ".aspx?user_id=" + Obj("user_id").value + "&document=" + area + str,"PrintVersion","width=650,height=600,scrollbars=yes,toolbar=no,location=no");
	win.focus();
	//Obj("hidden_action").value="print_version";
	return false;
}
function showLastAnswers()
{
	
	var obj = Obj("div_last_answers");
	if (obj.style.display == "none")
		obj.style.display = "";
	else
		obj.style.display = "none";
	obj.style.left = "0px";
	obj.style.top  = "-125px";
}
function showLastIQMSAnswers()
{
	
	var obj = Obj("div_last_answers");
	if (obj.style.display == "none")
		obj.style.display = "";
	else
		obj.style.display = "none";
	obj.style.left = "0px";
	obj.style.top  = "25px";
}
function showLastSummarizedAnswers(EVENT,iqms)
{
	
	var obj = Obj("div_last_answers");
	if (obj.style.display == "none")
		obj.style.display = "";
	else
		obj.style.display = "none";
	if(isMS())
	{	
		obj.style.position = "absolute";
		
		
		if(iqms)
		{
			obj.style.top  ="10px";// "155px";
			obj.style.left = "10px";
		}
		else
		{
			obj.style.top  = "-125px";
			obj.style.left = "0px";
		
		}
	}
	else
	{
		var x = EVENT.pageX;
		var y = EVENT.pageY;
		obj.style.left = "0px";
		obj.style.top  = (y -150)+ "px";
	}
	
}
function showAnswersOfMyDepartment
()
{
	var obj = Obj("div_answers_of_my_department");
	if (obj.style.display == "none")
		obj.style.display = "";
	else
		obj.style.display = "none";
	obj.style.left = "260px";
	obj.style.top  = "-125px";
}

function showFullSummarizeAnswer(td,show)
{
	if (td==null || full_mode_activated) return;
	var tooltip=null, inner=null;
	
	tooltip = td.title;
	inner = td.innerHTML;
	if (tooltip!=null) td.innerHTML = tooltip;
	td.title = inner;
		
}
function reuseOldAnswer (id)
{
	
	var td = Obj(id);
	if (td==null) return;
	var val = "";
	if (Obj("antwort")!=null && Obj("antwort").style.display!="none")
	{
		
		val = new String((td.title && String (td.title).length> String (td.innerHTML).length ? td.title : td.innerHTML));
		val = val.replace(/<br>/ig,"\n");
		val = Trim(val);		
		Obj("antwort").value = val;
	}
	else if(Obj("editorDivantwort")!=null && Obj("editorDivantwort").style.display!="none")
	{
		Obj("editorDivantwort").innerHTML = td.innerHTML;
		if(Obj("antwort")!=null)
			Obj("antwort").value = td.innerHTML;
	}
	
	answerChanged();
	if(typeof(checkTextLength)!="undefined")
		checkTextLength();
}

var full_mode_activated=false;
function showCompleteText (img)
{
	if (img.style.border=="") //Kompakt anzeigen
	{
		img.src = "../images/show_compact.gif";
		img.title="Kompakt anzeigen";
		img.style.border="solid 1px gray";
		var t = Obj("aspTableAnswers");
		if (t==null) return;
		if (t.rows.length==0) return;
		for (var i=0; i<t.rows.length;i++)
		{
			showFullSummarizeAnswer(t.rows[i].cells[1],true);
		}
		full_mode_activated=true;
		
	}
	else					//Komplett anzeigen
	{
		full_mode_activated=false;
		img.src = "../images/show_complete.gif";
		img.title="Ganzen Text anzeigen";		
		img.style.border="";
		var t = Obj("aspTableAnswers");
		if (t==null) return;
		for (var i=0; i<t.rows.length;i++)
		{
			showFullSummarizeAnswer(t.rows[i].cells[1],false);
		}
		
		
	}
}

function selectAllEmployees(b)
{
	var cb = document.getElementsByName("selected_employees");
	for(var i=0; i<cb.length;i++)
	{
		cb[i].checked=b.checked;
	}

}
function criterionDescription()
{
	Obj("form_criterion_description").submit();
}

function informEmployees ()
{
	Obj("form_inform_employees").submit();
}
function summarize()
{
	Obj("form_summarize").submit();
}
function summarizeIQMS()
{
	Obj("form_summarize_iqms").submit();
	
}
