/* Funktion zur Datei data/orders.php */
function newOrder(param) {
   var params = param.split("/");
   if (params[0] == "month" || params[0] == "lastmonth" || params[0] == "year" || params[0] == "intervall") {
   		document.period.datum.value = params[0];
   } else if (params[0] == "interpret" || params[0] == "itemtitel" || params[0] == "preisdm") {
   		document.period.order_param.value = params[0];
   		document.period.updown.value = params[1];
   		document.period.datum.value = "intervall";
   } else if (params[0] == "wk") {
	    document.period.datum.value = "intervall";
	    document.period.show_old.value = params[2];
   		document.period.wk.value = params[1];
   }

   document.period.submit();
}

/* Funktion zur Datei data/dispatch.php */
function newDispatch(param) {
	document.period.datum.value = param;
	document.period.submit();
}

/* Funktion zur Datei admin_data/admin_wk.php */
function newWKS(param) {
	document.period.datum.value = param;
	document.period.submit();
}

/* Funktion zur Datei admin_data/article.php */
function newArticle(param) {
	document.period.datum.value = param;
	document.period.submit();
}

/* Funktion zur Datei data/welcome.php */
function changeDates(param) {
	if (param == "day" || param == "week") {
		document.orderform.day.disabled = false;
		document.orderform.month.disabled = false;
		document.orderform.end_day.disabled = false;
		document.orderform.end_month.disabled = false;
	}

	if (param == "month") {
		document.orderform.day.disabled = true;
		document.orderform.month.disabled = false;
		document.orderform.end_day.disabled = true;
		document.orderform.end_month.disabled = false;
	}

	if (param == "year") {
		document.orderform.day.disabled = true;
		document.orderform.month.disabled = true;
		document.orderform.end_day.disabled = true;
		document.orderform.end_month.disabled = true;
	}
}

/* Funktion zur Datei data/dam_search.php */
function send() {
	document.ok.search_string.value = document.choice.search_string.value;
	document.ok.medium.value = document.choice.medium.value;
	document.ok.category.value = document.choice.category.value;
	if(document.choice.showimage.checked) {
		document.ok.showimage.value = document.choice.showimage.value;
	}
	document.ok.sub_category.value = document.choice.sub_category.value;
}


/* Funktion zur Datei data/dam_custom.php */
function openColorWindow (typ, side) {
  	content = "data/colorwindow.php?name=" + typ;
  	if(side == "rechts") {
  		colorwindow = window.open(content, "Farbauswahl", "width=420,height=420,left=550,top=320");
	} else {
		colorwindow = window.open(content, "Farbauswahl", "width=420,height=420,left=175,top=320");
	}
  	colorwindow.focus();
}