// (C) Agni Yoga 2003 : http://www.agniyoga.nl

tr_cont="";empty="De winkelmand is leeg.";tr_cyfr=0

function summ(val){
	value=stz[val]
	stp=value.split('|||')[1]*1
	value=value.split('|||')[0]
	
	//alert('debug: summ/str='+str);
	//alert('debug: summ/value='+value);
	if(str.indexOf(value+' - ') != -1) {
	//if(str!=str.split(value)) {
		alert(count_n+" Dit boek is aanwezig in Uw winkelmand!")
	}
	else{if(much=="1"){s="1"}
	else{s=prompt('Hoeveel exemplaren "'+value+'"?','1')}
	if(s==null){}else{if(s==""){
	alert("U moet tenminste een cijfer invoeren!!!")}
	else{if(s!=s.split(",")[0]||s!=s.split(".")[0]||s<=0){
	alert("Hoeveel?!!")}
	else{if(isFinite(s)==false){alert("Voer een cijfer in!!!")}
	else{
	str=str+'• '+value+' - '+s+' st. ('+s+'*'+stp+'='+s*stp+' '+valut+') •BrEkK'
	//alert('debug:summ.str='+str)
	no_cook=str.split('BrEkK')[0]
	save()
	read()
	if(str=="")
	{if(window.confirm('Uw browser instellingen kennen geen opslaan optie voor bestanden Cookie.\n\Moet Uw bestelling '+count_g+' toch verzonden worden zonder het in de winkelmand te plaatsen?'))
	{location='mailto:'+mail_adress+'?subject='+mail_subject+'&body='+no_cook}
	}}
	if(much!=1){refresh()}
	else{
	var tooltip = open('','Tooltip','width=210,height=50,left=1px,top=1px')
	tooltip_window = tooltip
	tooltip.document.write('<html><head><title>Meer boeken</title><style>BODY{font-family:sans-serif;font-size:10pt}</style></head><body bgcolor=#ffffff><center><h4>Meer boeken zijn toegevoegd</h4></center></body></html>')
	tooltip.document.close()
	tooltip.focus()
	setTimeout("posle_pause()",500)
}}}}}}

function posle_pause(){
	refresh()
	tooltip_window.close()
}

function refresh(){
	window.location="pingpong.htm"
}

function stop(){
	if(str==""){
		alert(empty)
	}
	else{
		if(window.confirm('Weet u zeker dat u de winkelmand leeg wilt maken?')){
			str=""
			refresh()
		}
	}
}

function preobraz(){
	fin_3="";fin_4="";fin_5="";d=""
	if(str==""){alert(empty)}
	else{for(i=0;d!=null;i++){
	d=str.split('BrEkK')[i]
	if(d!=null){
	fin_3=fin_3+'<br>'+d
	fin_4=fin_4+'&#13;&#10;'+d
	fin_5=fin_5+'\n'+d
}}}}

function check(){
	preobraz()
	if(str==""){}
	else{
	alert('Nu in de winkelmand:\n\n'+fin_5+'\n\nTotaal bedrag: '+stp_2+' '+valut)
}}

function read_a(val2,val){
	//if(str!=str.split( stz[val].split('|||')[0] ) [0]) {
	if( str.indexOf( stz[val].split('|||')[0]+' - ') != -1) {
		//alert('debug: read_a/str='+str);
		//* Oneindigheid II - 1 st. ...
		//alert('debug: read_a/stz='+stz[val].split('|||')[0]);
		//Oneindigheid I
		val2.filters.alpha.opacity=20
	}
	else {
		val2.filters.alpha.opacity=100
	}
}

function dell(val){
	value=stz[val].split('|||')[0]
	del_2=str.split(value)[1]
	if(del_2==null){
		alert(count_g+'is niet in de winkelmand!')
	}
	else{ if(window.confirm('Weet u zeker dat u het \"'+value+'\" wilt verwijderen?')){
		for(y=0;del_2.charAt(y)!='•';y++) {
		  del_3=del_2.substr(y)
		}
		str=str.split('• '+value)[0]+del_3.substr(7)
		stp_2=stp_2-del_2.split('=')[1].split(' '+valut+')')[0]
		refresh()
	     }
	else{}}
}

function save(){
	sav=""
	for(y=1;y<end_stz;y++) {
		//if(stz[y]!='' && stz[y]!=null && str!=str.split(stz[y].split('|||')[0])) {
		if(stz[y]!='' && stz[y]!=null && (str.indexOf(stz[y].split('|||')[0]+' - ')) != -1 ) {
		        //alert('debug:stz='+stz[y].split('|||')[0]);
			//alert('debug:str='+str);
			spliter=str.split(stz[y].split('|||')[0])[1]
			sav=sav+"n"+y+"s"+spliter.split('(')[1].split('*')[0]+"p"+spliter.split('=')[1].split(' ')[0]
			//alert('debug:sav='+sav)
		}
	}
	var date=new Date()
	date.setTime(date.getTime()+60000*(cook_time))
	document.cookie=cook_name+"="+sav+";expires="+date.toGMTString()+";path=/"
}
	
	str=""

function read(){
	var c=document.cookie
	if(c.indexOf(cook_name)==-1) { 
		str="";
		stp_2=0
	}
	else {
		start=c.indexOf(cook_name)+cook_name.length+1
		for(end=start;end<c.length;end++) {
			if(c.charAt(end)==";")
				break
		}
		sav=c.substring(start,end)
		stp_2=0;
		str=""
		for(y=1;sav.split('n')[y]!=null;y++) {
			strok=sav.split('n')[y]
			num=strok.split('s')[0]*1
			cifr=strok.split('s')[1].split('p')[0]*1
			price=stz[num].split('|||')[1]
			stp_2=stp_2+cifr*price
			str=str+'• '+stz[num].split('|||')[0]+' - '+cifr+' st. ('+cifr+'*'+price+'='+cifr*price+' '+valut+') •BrEkK'
			tr_cont=tr_cont+'- <a class="tr_list_a" href="'+ur[num]+'">'+stz[num].split('|||')[0]+'</a>'+' (<span class="tr_list_end">'+cifr+'&nbsp;st.)</span><br>'
			//tr_cont=tr_cont+'<span class="tr_list_a">'+' - '+stz[num].split('|||')[0]+'</span>'+' (<span class="tr_list_end">'+cifr+' st.)</span><br>'
			tr_cyfr=y
		}
	}
}

function trash_content(){
	read()
	if(tr_cont=="")
	{document.write('<span class="tr_none">'+empty+'</span>')}
	else{document.write('<span class="tr_cont_head">Nu in de winkelmand:</span><br>'+tr_cont)}
}

function winnew(val){
	//window.open(val,"podr")
	window.open(val, "podr", "resizable=no,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,width=720,height=365")
}

function finder(){
	document.write('<a name="findblock"></a><span id="find_title">'+find_titl+'</span><br><br><form action="#findblock" 	method="GET"><span id="texfind"><input type="Text" name="find_f" id="find_area"><input type="Submit" id="find_buton" 	value="'+find_buton_name+'"></span></form>')
	geter=window.location.search.split('find_f=')[1]
	if(geter=="+"||geter==""||isFinite(geter)==true){alert('Typ een woord in')}
	else{
	if(geter!=null){
	smb=geter.charAt(0)
	str_f="";esc_key=3;smb_un=""
	for(b=0;smb!="";b++){
	smb=geter.charAt(b)
	if(smb=="+"){smb=" "}
	if(smb=="%"){esc_key=0}
	esc_key=esc_key+1
	if(esc_key<4){smb_un=smb_un+smb}
	else{str_f=str_f+smb}
	if(esc_key==3){
		z_w="%C0|%C1|%C2|%C3|%C4|%C5|%C6|%C7|%C8|%C9|%CA|%CB|%CC|%CD|%CE|%CF|%D0|%D1|%D2|%D3|%D4|%D5|%D6|%D7|%D8|%D9|%DA|%DB|%DC|%DD|%DE|%DF|%E0|%E1|%E2|%E3|%E4|%E5|%B8|%E6|%E7|%E8|%E9|%EA|%EB|%EC|%ED|%EE|%EF|%F0|%F1|%F2|%F3|%F4|%F5|%F6|%F7|%F8|%F9|%FA|%FB|%FC|%FD|%FE|%FF"
		z_h="A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z"
		s_w=z_w.split("|")
	i_k=0
	for(i=0;i<65;i++){
	if(smb_un==s_w[i]){
	smb=z_h.split("|")[i]
	i_k=1
	}
	if(i_k==0){smb=unescape(smb_un)}
	}
	smb_un=""
	str_f=str_f+smb+""
	}}
	fndd=''
	for(g=1;g<end_stz;g++){
	if(stz[g]!=null&&stz[g].split(str_f)!=stz[g]){
	fndd=fndd+'<li><a href="'+ur[g]+'">'+stz[g].split("|||")[0]+'</a>'
	}}
	if(fndd==""){fndd="<br><br>..."}
	fndd=fndd.split(str_f)
	fndd=fndd.join("<b>"+str_f+"</b>")
	document.write('<ol><b>Gevonden:</b>'+fndd+'</ol>')
	}}
}

function comand(val){
	read()
	//if(str!=str.split(stz[val].split('|||')[0])){
	if( str.indexOf( stz[val].split('|||')[0]+' - ') != -1) {
		document.write('<a href="javascript:dell('+val+')">Verwijderen uit de winkelmand</a>')}
	else {
		document.write('<a href="javascript:summ('+val+')">Toevoegen aan de winkelmand</a>')
	}
}

function metka(val){
	read()
	//if(str!=str.split(stz[val].split('|||')[0])) {
	if( str.indexOf( stz[val].split('|||')[0]+' - ') != -1) {
		//alert('debug / metka: str'+str);
		//alert('debug / metka: stz: '+stz[val].split('|||')[0]);
		document.write(metka_yes)}
	else {
		document.write(metka_no)
	}
}


