function change(pic_name)
{
  document.getElementById(pic_name).style.background = 'url(/images/nav_hi.png)';
  document.getElementById(pic_name+"_raquo").style.color = '#FFFFFF';
};

function change_back(pic_name)
{
  document.getElementById(pic_name).style.background = 'url(/images/nav_low.png)';
  document.getElementById(pic_name+"_raquo").style.color = '#80C31C';
};

function change_subnav(pic_name)
{
  document.getElementById(pic_name).style.background = 'url(/images/subnav_hi.png)';
  document.getElementById(pic_name+"_raquo").style.color = '#FFFFFF';
};

function change_back_subnav(pic_name)
{
  document.getElementById(pic_name).style.background = 'url(/images/no.gif)';
  document.getElementById(pic_name+"_raquo").style.color = '#5B8F0F';
};

function change_ref(pic_name)
{
 window.document.images[pic_name].src="/images_content/"+pic_name+"_hi.gif"; 
};

function change_ref_back(pic_name)
{
 window.document.images[pic_name].src="/images_content/"+pic_name+"_low.gif"; 
};

function set_anjadata_options(option){
  new ajax('includes/anjadata/anjadata_options.php', {postBody: 'request_option='+option, update: $(option)});			
};

function set_anjadata_further_options(option,prod_gruppe_value){
  new ajax('includes/anjadata/anjadata_options.php', {postBody: 'request_option='+option+'&drop_down=1', update: $(prod_gruppe_value)});			
};

function put_anjadata(option,put_anjadata){
	new ajax('includes/anjadata/anjadata_options.php', {postBody: 'request_option='+option+'&drop_down=2', update: $(put_anjadata)});			
};

function mail_confirm(){
	document.getElementsByTagName("div")['mail_confirm'].innerHTML = "<p><span class='font_3'><b>Vielen Dank, Ihre Nachricht wurde versandt!</b></span></p>";
};

function check_mail_kontakt(){
	if (document.kontakt.Email_Adresse.value == '' || document.kontakt.Bemerkungen.value == '') {
	alert('Bitte geben Sie Ihre Email Adresse und eine Anfrage ein.');
	document.kontakt.Email_Adresse.focus();
	} else {	
	document.kontakt.submit();
}
};

function check_mail_lagrestpo(){
	if (document.lagrestpo.Email_Adresse.value == '' || document.lagrestpo.Bemerkungen.value == '') {
	alert('Bitte geben Sie Ihre Email Adresse und eine Anfrage ein.');
	document.lagrestpo.Email_Adresse.focus();
	} else {	
	document.lagrestpo.submit();
}
};

//administration

function admin_save_record(record_no){
	
	var lag_restp_id = document.getElementsByName("id")[record_no].value;
	var lag_restp_produkt = document.getElementsByName("produkt")[record_no].value;
	var lag_restp_typ = document.getElementsByName("typ")[record_no].value;
	var lag_restp_farbe = document.getElementsByName("farbe")[record_no].value;
  var lag_restp_farbnummer = document.getElementsByName("farbnummer")[record_no].value;
	var lag_restp_quantitaet = document.getElementsByName("quantitaet")[record_no].value;
	
	new ajax('includes/modules/inc.del_upd_admin.php', {postBody: 'action=save&id='+lag_restp_id+'&produkt='+lag_restp_produkt+'&typ='+lag_restp_typ+'&farbe='+lag_restp_farbe+'&farbnummer='+lag_restp_farbnummer+'&quantitaet='+lag_restp_quantitaet, update: $('datensatz_'+record_no)});			
};

function admin_delete_record(record_no){
	var lag_restp_id = document.getElementsByName("id")[record_no].value;
	var lag_restp_produkt = document.getElementsByName("produkt")[record_no].value;
	
	Check = confirm("Den Datensatz \""+lag_restp_produkt+"\" wirklich löschen?");
  if (Check == false){
   alert("Datensatz \""+lag_restp_produkt+"\" nicht gelöscht.");
   } else {
	 new ajax('includes/modules/inc.del_upd_admin.php', {postBody: 'action=delete&id='+lag_restp_id, update: $('datensatz_'+record_no)});			
  }
};

function admin_new_record(){
	
	var lag_restp_produkt = escape(document.getElementsByName("produkt_new")[0].value);
	var lag_restp_typ = escape(document.getElementsByName("typ_new")[0].value);
	var lag_restp_farbe = document.getElementsByName("farbe_new")[0].value;
	var lag_restp_farbnummer = document.getElementsByName("farbnummer_new")[0].value;
	var lag_restp_quantitaet = document.getElementsByName("quantitaet_new")[0].value;

	new ajax('includes/modules/inc.del_upd_admin.php', {postBody: 'action=new&produkt='+lag_restp_produkt+'&typ='+lag_restp_typ+'&farbe='+lag_restp_farbe+'&farbnummer='+lag_restp_farbnummer+'&quantitaet='+lag_restp_quantitaet, update: $('datensatz_neu')});			
	
	window.setTimeout("location.reload()", 1000);
};
