var f,fokX,URL;
fok2=0;
pp_handle='';eml1='ma';eml2='il';eml3='to:';
bStr='';
if(typeof(URLs)!='undefined') {
	for(i=0;i<URLs.length;i++) {if(location.href.indexOf(URLs[i])>-1) {URL='http://'+URLs[i]+'/'}}
} else {
	bStr='../';
}
function init00() {
	for(var i=0;i<E1;i++) {elS('N1_'+i).top=18*i+'px'}
//	elS('PP').top=18*i+'px';
//	zeige('PP',1);
}
function init0() {
	f=document.forms.form1;
	if(anmd==1&&f.EMail) f.EMail.focus();
	klx('','Seite geladen','',location.href,'','','','');
	try	{initSound()} catch(ii) {}
}
function k0(n) {
	klx('','NAV 1','','',L0[n],elI('N0_'+n).firstChild.data,'','');
	document.location.href='./?'+L0[n];
}
function k1(n) {
	klx('','NAV 2','','',L1[n],elI('N1_'+n).firstChild.data,'','');
	document.location.href='./?'+L1[n];
}
function elI(v) {return document.getElementById(v)}
function elS(v) {return elI(v).style}
function zeige(v,s) {elS(v).visibility=(s==1)?'visible':'hidden'}

function anmelden(v) {
	klx('','LogIn','',v,'','','','');
	if(SPW==1) v=v+'&SPWS=1';
	location.href=Lnk1+'&anmd='+v;
}
function logout() {
	klx('','LogOut','',1,'','','','');
	location.href=Lnk1+'&Logout=1';
}
function bildgross(bild,text,w,h) {
	klx('','BildGross','Open',bild,'','','','');
	maxB=screen.width-40;
	maxH=screen.height-100;
	scr='';
	if(w>maxB) {w=maxB;scr=',scrollbars=yes'}
	if(h>maxH) {h=maxH;scr=',scrollbars=yes'}
	if(pp()) {
		pp_close();
		setTimeout('bildgross("'+bild+'","'+text+'","'+w+'","'+h+'")',20);
	} else {
		eval('pp_handle=window.open("'+URL+'as/bildgross.php?Bild='+bild+'&Text='+text+'","bildgross","width='+w+',height='+h+',left=20,top=20'+scr+'")');
	}
}
function pp_close() {if(pp()) {pp_handle.close();pp_handle=''}}
function pp() {
	if(typeof pp_handle=='object') return true;
	return false;
}
function hM(t1,t2,t3) {
	location.href=eml1+eml2+eml3+t1+String.fromCharCode(13+51)+t2+'.'+t3;
}
function mov(id) {
	elS(id).color='yellow';
}
function mou(id) {
	elS(id).color='white';
}

function detail(z) {
	var id=(typeof(z)!='string')?arrIDArtikel[z]:z;
	klx(id,'MusikDetail','','','','','','');
	location.href=Lnk1+'&DO=MusikDetail&IDArtikel='+id;
}
function detail_eBook(id) {
	klx(id,'eBookDetail','','','','','','');
	location.href=Lnk1+'&DO=EBookDetail&IDArtikel='+id;
}
function einkaufswagen() {
	klx('','EKW','','','','','','');
	location.href=Lnk1+'&DO=EKWListe';
}
function editEKW(v,id) {
	klx(id,'EKW','Edit',v.value,'','','','');
	location.href=Lnk1+'&DO=editEKW&IDArtikel='+id+'&AnzahlArtikel='+v.value;
}
function zuEKW(id,n) {
	if(angemeldet!=1) {
		klx(id,'EKW','In den','','','','Meldung',tEKW3);
		alert(tEKW3);
		anmelden(1);
		return;
	}
	klx(id,'EKW','In den',n,'','','','');
	location.href=Lnk1+'&DO=zuEKW&IDArtikel='+id+'&AnzahlArtikel='+n;
}
function ausEKW(id,bez) {
	if(confirm(tEKW2a+' "'+bez+'" '+tEKW2b)==false) {
		klx(id,'EKW','Entfernen','Abbruch','','','','');
		return;
	}
	klx(id,'EKW','Entfernen','','','','','');
	location.href=Lnk1+'&DO=EKWListe&DO2=ausEKW&IDArtikel='+id;
}
function ekw_leeren() {
	if(confirm(tEKW1)==false) {
		klx('','EKW','Leeren','Abbruch','','','','');
		return;
	}
	klx('','EKW','Leeren','','','','','');
	location.href=Lnk1+'&DO=EKWleeren';
}
function ekForts(o) {
	klx('','Einkauf fortsetzen','','',o.href,'','','');
}
function zurKasse(summe,guthaben) {
	if(summe>0) {
		for(var i=0;i<AnzPosEKW;i++) {
			var f=document.forms.form1;
			var z=f.elements['a'+i].value;
			if(z<1) {
				klx('','ZurKasse','','Abbruch','','','','Fehler',tEKW4);
				alert(tEKW4);
				return;
			}
		}
		if(ArtikelPerPost==1&&AdresseOK==0) {
			klx('','ZurKasse','KeineAdresse->perPost','','','','','');
			anmelden(3);
			return;
		}
		klx('','ZurKasse','','','','','','');
		location.href=Lnk1+'&DO=zurKasse';
	} else {
		klx('','ZurKasse','','Abbruch','','','Fehler',tEKW5);
		alert(tEKW5);
		return;
	}
}
function ueberweisung(id) {
	klx('','Ueberweisung','',id,'','','','');
	location.href=Lnk1+'&DO=Ueberweisung&IDBestellung='+id;
}
function testapi(id,VP,PG) {
	location.href='http://localhost/loadnread.com/micropayment/api.php?title=Bestellung '+id+'&function=billing'+'&VP='+VP+'&PG='+PG;
}
function ueberweisen(id) {
	klx('','Ueberweisen','',id,'','','','');
	location.href=Lnk1+'&DO=ueberweisen&IDBestellung='+id;
}
function zumDownload() {
	klx('','Zur Download-Seite','','','','','','');
	location.href='./?SEITE=Musik_Download&lang='+document.form1.lang.value+'&page=1662449df15dfd62c3';
}


// AJAX
// ====
var resObj=null;
function backup() {
	resObj.open('GET','ajax/send-backup.php',true);
	resObj.onreadystatechange=hResp;
	resObj.send(null);
}
function klick(v1,v2,v3,v4,v5,v6,v7,v8,v9,v10) {
	resObj.open('GET',bStr+'ajax/click.php?v1='+v1+'&v2='+encodeURIComponent(v2)+'&v3='+encodeURIComponent(v3)+'&v4='+encodeURIComponent(v4)+'&v5='+encodeURIComponent(v5)+'&v6='+encodeURIComponent(v6)+'&v7='+encodeURIComponent(v7)+'&v8='+encodeURIComponent(v8)+'&v9='+encodeURIComponent(v9)+'&v10='+v10,true);
	resObj.onreadystatechange=hResp;
	resObj.send(null);
}
function klx(v1,v2,v3,v4,v6,v7,v8,v9) {
	var v5=(typeof(SEITE)=='undefined')?'':SEITE;
	var v10=(typeof(LKEY)=='undefined')?'XX':LKEY;
	klick(v1,v2,v3,v4,v5,v6,v7,v8,v9,v10);
}
function klickBildClose(o,b) {
//	klick('','BildGross','Schliessen',b,'','','','','',LKEY);
	window.close();
}
function klickL(o) {
	klx('','Link','',location.href,o.href,o.innerHTML,'','');
}
function klickEMail(o,v1,v2,v3,v4) {
	var e=v1+'@'+v2+'.'+v3;
	v4=(v4=='e')?e:o.innerHTML;
	klx('','Link EMail','','',e,v4,'','');
	hM(v1,v2,v3);
}
function klickTop() {
	klx('','TopButton','','','','','','');
}
function erzReq() {
	var resObj=null;
	try {resObj=new ActiveXObject('Microsoft.XMLHTTP')}
	catch(Error) {
		try {resObj=new ActiveXObject('MSXML2.XMLHTTP')}
		catch(Error) {
			try {resObj=new XMLHttpRequest()}
			catch(Error) {/*alert('!!')*/}
		}
	}
	return resObj;
}
function hResp() {
	if(resObj.readyState==4) {
//		var rA=document.getElementById('reqAntwort');
//		rA.innerHTML=rA.innerHTML+'R '+resObj.responseText;
	}
}
resObj=erzReq();

