function kbacheck(nr){
  if (nr==2 && document.forms['kbaeingabe'].zu2.value.length==4){
	document.forms['kbaeingabe'].zu3.focus();
	document.forms['kbaeingabe'].zu3.select();
  }	
  if (nr==3 && document.forms['kbaeingabe'].zu3.value.length==3) {
  	document.forms['kbaeingabe'].submit();
  }
}

function popup(seite,w,h,resize) {
	var status;
	
	if (resize == '') {
		resize = false;
	}
	
	// Wenn die aufzurufende Seite gleich der aufrufenden Seite ist, passiert gar nichts!	
	if (seite!=document.URL) {
		if (resize == false) {
			status = "scrollbars=auto,resizable=no,status=no,location=no,toolbar=no,directories=no,menubar=no,copyhistory=no,width=" + w + ",height=" + h;
		} else {
			status = "scrollbars=auto,resizable=yes,status=no,location=no,toolbar=no,directories=no,menubar=no,copyhistory=no,width=" + w + ",height=" + h;
		}
		p = window.open( seite, 'pagel_popup', status);
		p.focus();
	}
	return false;
}


function change_links_set(iconid,size,width,height){
	var fpopup;
	var link;
	
	link = "file?fileID="+iconid+"&fileType=3";
	fpopup = "return popup('"+link+"',"+width+","+height+");";
		
	document.getElementById('produktbild').src='file?fileID='+iconid+'&fileType='+size;
	document.getElementById('produktlink').setAttribute('href',link);
	document.getElementById('produktlink').setAttribute('onclick',fpopup);
	return false;
}

function change_links_remove(iconid,size){
			
	document.getElementById('produktbild').src='file?fileID='+iconid+'&fileType='+size;
	document.getElementById('produktlink').removeAttribute('href');
	document.getElementById('produktlink').removeAttribute('onclick');
	return false;
}



	function make_div_clickable(div) {
		var children = div.childNodes;
		for (var i=0; i < children.length; i++) {
			var item = children.item(i);
			if (item.nodeName && item.nodeName.toLowerCase() == "a") {
				window.location.href=item.href;
			}
		}
		return false;
	}
	
	function pagel_back() {
		history.back();
		return false;
	}	
	
	function show_please_wait() {
		document.getElementById('please-wait').style.display='block';
		timerID = setTimeout("hide_please_wait()", 999999999);
	}
	
	function hide_please_wait() {
		document.getElementById('please-wait').style.display='none';
//		alert("hide");
	}	
	function showdiv(name)
	{
		if (name == 'Adresse')
		{
			document.getElementById('Adresse').style.display='block';
			document.getElementById('login').style.display='none';
		}
		else
		{
			document.getElementById('Adresse').style.display='none';
			document.getElementById('login').style.display='block';			
		}
	}
function senddata()
{
	if (!gesendet)
	{
		gesendet=true;
		show_please_wait();
		document.Bestellung.aktion.value="bestellen";
		document.Bestellung.submit();
	}
}
var wcount=0;
function openw()
{
	var width=800;
	var height=600;
	var left=100;
	var top=50;
	var opt="width="+width+",height="+height+",left="+left+",top="+top+",resizable=no";
	var Bild="http://www.autoteile-guenstig.de/images/metzger/html/produkte.html";
	var Fname="Informationen";
	var wind=window.open(Bild,Fname,opt);
}
function jump(marke)
{
	if (marke!="PayPal")
	{
		document.versandart.action="index.php?phpdat=kasse&schritt=2";
		document.versandart.submit();
	}
	else
	{	
		document.versandart.action="paypal.html";
		document.getElementById('please-waitpp').style.display='block';	
		document.location.href="paypal.html";
	}
}
function jumpplz(marke)
{
	document.Bestellung.action="index.php?phpdat=kasse&schritt=3#"+marke;
	document.Bestellung.submit();
}
function submitw()
{
	document.Bestellung.action="index.php?phpdat=kasse&schritt=2";
	document.Bestellung.submit();	
}
function submitwz1()
{
	document.versandart.action="index.php?phpdat=kasse";
	document.versandart.submit();	
}
function submitz2()
{
	document.Bestellung.action="index.php?phpdat=kasse&schritt=2";
	document.Bestellung.submit();	
}
function submitw2()
{
	document.Bestellung.action="index.php?phpdat=kasse&schritt=4";
	document.Bestellung.submit();	
}
function w_open()
{
	Fenster = window.open('https://www.paypal.com/de/cgi-bin/webscr?cmd=xpt/Marketing/popup/OLCWhatIsPayPal-outside','olcwhatispaypal','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=400, height=500');
  	Fenster.focus();
}
function del_artnr(Artnr)
{
	document.Bestellung.action="index.php?phpdat=kasse&aktion=delete&Artnr="+Artnr;
	document.Bestellung.submit();
}
function update(Anzahl,Artnr)
{
	document.location.href="index.php?phpdat=kasse&aktion=update&Artnr="+Artnr+"&anzahl="+Anzahl;
}

function wopentext(text)
{
	Fenster = window.open('index.php?text='+text,text,'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=900, height=500');
  	Fenster.focus();
}
function wopenimage(imagesrc,wwidth,wheight)
{
	Fenster = window.open(imagesrc,'Bildanzeige','toolbar=no, location=no, directories=no, status=no, menubar=no, left=0, top=0, scrollbars=yes, resizable=yes, width='+wwidth+', height='+wheight);
  	Fenster.resizeTo(wwidth+20,wheight+20);
  	Fenster.focus();
}

