function requestSubjectsByReasonDropdown(sessionID,itemClassID) {
	var rid = document.getElementById('reasonDropdown').value;
	setLoading("subjectDropdownBody");
	if ( rid=="null" ) {
		setItemHeadInactive();
		setSubjectHeadInactive();
		return(null);
	} // end.nothing chosen
	jsRequest_replaceContents( "subjectDropdownBody" , "/+Request/?asyncFunction=subjectChooser&rid=" + rid + "&sessionID=" + sessionID + "&icid=" + itemClassID );
	setSubjectHeadActive();
	setItemHeadInactive();
} // end.requestSubjects

function requestItemsBySubjectDropdown(sessionID,itemClassID) {
	var sid = getSubjectDropdownValue();
	var rid = getReasonDropdownValue();
	setLoading("itemDropdownBody");
	if ( sid=="null" ) {
		setItemHeadInactive();
		return;
	} // end.null
	jsRequest_replaceContents( "itemDropdownBody" , "/+Request/?asyncFunction=itemChooser&sid=" + sid + "&rid=" + rid + "&sessionID=" + sessionID + "&icid=" + itemClassID );
	setItemHeadActive();
} // end.requestItems

function loadItemDetail(sessionID,itemClassID) {
	var sid = getSubjectDropdownValue();
	var rid = getReasonDropdownValue();
	var iid = getItemDropdownValue();
	if ( iid=="null" ) {
		return;
	} // end.nothing chosen
	//alert( "sid: " + sid + "\nrid:" + rid + "\niid:" + iid + "\nsessionid:" + sessionID );
	/* point to the SEO-AUTO_SUBDIR_REDIRECTOR later! */
	window.location = "./_item/?rid=" + rid + "&sid=" + sid + "&iid=" + iid + "&sessionID=" + sessionID + "&icid=" + itemClassID;
} // end.loadItemDetail

function getSubjectDropdownValue() { return( document.getElementById('subjectDropdown').value ); }
function getReasonDropdownValue() { return( document.getElementById('reasonDropdown').value ); }
function getItemDropdownValue() { return( document.getElementById('itemDropdown').value ); }

function setSubjectHeadActive() {
	document.getElementById("subjectHeadNumber").className = "number sprite";
	document.getElementById("subjectHead").className = "head";
} // end.subjectHeadActive

function setSubjectHeadInactive() {
	document.getElementById("subjectHeadNumber").className = "number sprite numberInactive";
	document.getElementById("subjectHead").className = "head headInactive";
	document.getElementById("subjectDropdownBody").innerHTML = "";
} // end.subjectHeadInactive

function setItemHeadActive() {
	document.getElementById("itemHeadNumber").className = "number sprite";
	document.getElementById("itemHead").className = "head";
} // end.subjectHeadActive

function setItemHeadInactive() {
	document.getElementById("itemHeadNumber").className = "number sprite numberInactive";
	document.getElementById("itemHead").className = "head headInactive";
	document.getElementById("itemDropdownBody").innerHTML = "";
} // end.itemHeadInactive

function setLoading(id) {
	document.getElementById(id).innerHTML = "<img style='margin-left: 50px;' src='/+Images/loading.gif' alt='' />";
} // end.setLoading

function deleteCartItem(id,sessionID,ioid) {
	if ( confirm("Soll dieser Wunsch wirklich aus dem Warenkorb entfernt werden?") ) {
		window.location = "/Warenkorb/Entfernen/?iid=" + id + "&sessionID=" + sessionID + "&ioid=" + ioid;
	} // end.confirmed delete
} // end.deleteCartItem

function putToCart(hasOptions,iid,rid,sid,sessionID,icid) {
	//var ioid = (hasOptions) ? document.getElementById("ioid").value : "";
	var ioid = null;
	if ( hasOptions ) {
		var radios = document.getElementsByName("ioid");
		for ( var x=0 ; x<radios.length ; x++ ) {
			if ( radios.item(x).checked == true ) {
				ioid = radios.item(x).value;
			} // end.selected found
		} // end.itor radios
		if ( ioid==null ) {
			alert("option wählen!");
			return;
		} // end.no option
	} // end.hasOptions
	var q = "iid=" + iid + "&rid=" + rid + "&sid=" + sid + "&ioid=" + ioid + "&sessionID=" + sessionID + "&icid=" + icid;
	window.location = "/Bestellung/?" + q;
} // end.putToCart

function optionDescription(id) {
	hideItemOptionDescriptions();
	showItemOptionDescription(id);
} // end.optionDescription

function hideItemOptionDescriptions() {
	var odc = document.getElementById("optionDescriptionContainer");
	var d = odc.getElementsByTagName("div");
	for ( var x=0 ; x<d.length ; x++ ) {
		d.item(x).className = "itemOption";
	} // end.itor divs
} // end.hideItemoptions

function showItemOptionDescription(id) {
	document.getElementById("itemOptionDescription_"+id).className="itemOptionActive";
} // end.showItemOption
