//------------------------------
// F I L M E
//------------------------------
//------------------------------
//get the Data of the Comboboxes
//------------------------------
function getData_Filme()
{
	var data = "";
	var dataArray = new Array("sortTitel", "sortGenre", "sortAmount");
	for(i = 0; i < dataArray.length; i++)
	{
		var currentValue = new String();
		var currentValue = document.getElementById(dataArray[i]).value;
		
		if(currentValue!="")
		{
			if ("" == data)
			{
				data = dataArray[i]+"="+currentValue;
			} else {
			    data = data+'&'+ dataArray[i]+"="+currentValue;
			}
		}
	}

	return data;
}

//------------------------------
// sort Filme
//------------------------------
function sortFilme(url)
{
	var sortArray = getData_Filme();
	window.location.href = url + "&" + sortArray;
}

//------------------------------
// S P I E L E
//------------------------------
//------------------------------
//get the Data of the Comboboxes
//------------------------------
function getData_Spiele()
{
	var data = "";
	var dataArray = new Array("sortTitel", "sortCategory", "sortGenre", "sortAmount");
	for(i = 0; i < dataArray.length; i++)
	{
		var currentValue = new String();
		var currentValue = document.getElementById(dataArray[i]).value;
		
		if(currentValue!="")
		{
			if ("" == data)
			{
				data = dataArray[i]+"="+currentValue;
			} else {
			    data = data+'&'+ dataArray[i]+"="+currentValue;
			}
		}
	}

	return data;
}

//------------------------------
// sort Games
//------------------------------
function sortGames(url)
{
	var sortArray = getData_Spiele();
	window.location.href = url + "&" + sortArray;
}

//------------------------------
//get the Data of the Comboboxes
//------------------------------
function getValueOfDropDownBox(DropDownBox)
{
	var currentValue = document.getElementById(DropDownBox).value;
	return currentValue;
}


//------------------------------
// S N A C K S   A N D   D R I N K S
//------------------------------
//------------------------------
//get the Data of the Comboboxes
//------------------------------
function getData_Snacks()
{
	var data = "";
	var dataArray = new Array("sortTitel", "sortCategory", "sortAmount");
	for(i = 0; i < dataArray.length; i++)
	{
		var currentValue = new String();
		var currentValue = document.getElementById(dataArray[i]).value;
		
		if(currentValue!="")
		{
			if ("" == data)
			{
				data = dataArray[i]+"="+currentValue;
			} else {
			    data = data+'&'+ dataArray[i]+"="+currentValue;
			}
		}
	}

	return data;
}
//------------------------------
// sort Snacks And Drinks
//------------------------------
function sortSnacks(url)
{
	var sortArray = getData_Snacks();
	window.location.href = url + "&" + sortArray;
}

//------------------------------
// O R D E R
//------------------------------
//------------------------------
//get the Data of the Comboboxes
//------------------------------
function getData_Order()
{
	var currentValue = document.getElementById("deliverDate").value;
	return currentValue;
}
function sortOrder(url)
{
	var currentValue = document.getElementById("deliverDate").value;
	window.location.href = url + "&currentDate=" + currentValue;
}

//------------------------------
// V O R S C H A U
//------------------------------
//------------------------------
//get the Data of the Comboboxes
//------------------------------
function getData_Vorschau()
{
	var data = "";
	var dataArray = new Array("sortTitel", "sortCategory", "sortGenre", "sortAmount");
	for(i = 0; i < dataArray.length; i++)
	{
		var currentValue = new String();
		var currentValue = document.getElementById(dataArray[i]).value;
		
		if(currentValue!="")
		{
			if ("" == data)
			{
				data = dataArray[i]+"="+currentValue;
			} else {
			    data = data+'&'+ dataArray[i]+"="+currentValue;
			}
		}
	}

	return data;
}

//------------------------------
// sort Vorschau
//------------------------------
function sortVorschau(url)
{
	var sortArray = getData_Vorschau();
	window.location.href = url + "&" + sortArray;
}
//------------------------------
//get the Data of the Comboboxes
//------------------------------
function getValueOfDropDownBox(DropDownBox)
{
	var currentValue = document.getElementById(DropDownBox).value;
	return currentValue;
}
//------------------------------
// R E D I R E C T
//------------------------------
function sortSite(element, url)
{
	value = getValueOfDropDownBox(element);
	window.location.href = url + "&" + element + "=" + value;
}
//------------------------------
// S W I T C H   C H E C K B O X
//------------------------------
function switchCheckbox(checked_element, unchecked_elements)
{
	//all is checked
	if(checked_element == "all")
	{
		//uncheck the other checkboxes
		for(i = 0; i < unchecked_elements.length; i++)
		{
			document.getElementById(unchecked_elements[i]).checked = false;
			document.getElementById(unchecked_elements[i]).value = 0;
		}
	
	//single checkbox is checked
	} else
	{
		//first uncheck the all checkbox
		document.getElementById("all").checked = false;
		document.getElementById("all").value = 0;
		
		//check the selected checkbox
		document.getElementById(checked_element).value = 1;
		
		var checked_boxes = new Array();
		
		//check how many checkboxes are checked
		for(i = 0; i < unchecked_elements.length; i++)
		{
			if(document.getElementById(unchecked_elements[i]).checked == true)
			{
				checked_boxes.push(unchecked_elements[i]);
			}	
		}
		
		//if all then switch all checkbox
		if(checked_boxes.length == unchecked_elements.length)
		{
			for(i = 0; i < unchecked_elements.length; i++)
			{
				document.getElementById(unchecked_elements[i]).checked = false;
				document.getElementById(unchecked_elements[i]).value = 0;
			}
			
			//the check all checkbox
			document.getElementById("all").checked = true;
			document.getElementById("all").value = 1;
		}
	}
}

//------------------------------
// H I D E   M A I L
//------------------------------
var user;
var domain;
var suffix;
var stylename;

function hideMail(suffix, user, domain, stylename)
{
	document.write('<a href="' + 'mailto:' + user + '@' + domain + '.' + suffix + '" class="' + stylename + '">' + user + '@' + domain + '.' + suffix + '</a>');
}

