  
  /*
  	updatet die amount-Felder von der Warenauswahl über "+" und "-"-Buttons
  */
  // method = "+" or "-"
  function updateAmount(num,method)
  {
  	if (method=="+")
	{
  		$('amount['+num+']').value++;
	}else{
		if ($('amount['+num+']').value>0) $('amount['+num+']').value--;
	}
  }
  
  
  function confirmDelete(txt)
  {
	 if (txt==undefined) var txt = "Wirklich löschen?";
  	 return confirm(txt);

  }
  
  function checkAGB()
  {
		//$('fix_error_box').style.display = "none";
	if ($('agb_accept').checked)
	{
		if(error_box_slide.open) error_box_slide.slideOut();
		return true;
	} else {
		showError('Sie m&uuml;ssen die AGB akzeptieren, um die Bestellung abzuschicken.');
		return false;	
	}
  }
  
  function showError(txt)
  {
	  //$('error_box').styles.visibility = 'visible';
	  $('error_box').innerHTML = txt;
	  error_box_slide.slideIn();  
  }
  
  function showMessage(m)
  {
	  alert(m);
  }
	
	function toggleKats(kat_id)
	{

		eval("slide_box_fx"+kat_id).toggle().chain(function (){switchImg('switch_'+kat_id);});	
	}
	
	
	function switchImg(element)
	{
		var path_array = $(element).src.split("/");
		var old_image = path_array[path_array.length-1];
		var up   = 'right_small.jpg';
		var down = 'down_small.jpg';
		var path = 'img/icons/';
		
		//var img = array( path+up, path+down );
		
		if( up ==  old_image )
		{
			$(element).src = path+down;
		}
		else
		{
			$(element).src = path+up;
		}
		
	}
	
	function openTool(aid)
	{
		
		var toolWin = window.open("tool/index.php?aid="+aid,"Tool","left=0,top=0,width=1000,height=700,resizable=yes");	
		toolWin.focus();
		openLieferterminCheck();
	}
	
	function openLieferterminCheck()
	{
		var lieferterminWin = window.open("cake/lieferdatum_popup/index.php","LieferterminCheck","left=50,top=50,width=580,height=500,resizable=yes");	
		lieferterminWin.focus();
	}
	
	function openVersand()
	{
		var versandWin = window.open("index.php?pg=versandkosten","Versandkosten","width=580,height=450,scrollbars=yes");	
		versandWin.focus();
	}
	
	function pause(millis) {
	        var date = new Date();
	        var curDate = null;


	        do {
	        	curDate = new Date();
	        } while(curDate-date < millis)
	}

  
  
  function jumpUrl(url)
  {
	  location.href = url;
  }

function printPage()
{
	window.print();
}

function showTippsOverlay(images,text)
{
	var images_array = images.split("|");
	var image = images_array[0];
	$('tipps_overlay').style.display = "block";
	$('tipps_image').update('<img src="'+image+'" width ="700px" />');
	$('tipps_text').update(text);
}

function closeTippsOverlay()
{
	$('tipps_overlay').style.display = "none";
}

