function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
		var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
			if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src='img/'+a[i];
	}}
	return true;
}
function _over(id, extra){
	var img = document.getElementById(extra==undefined? id : id+extra);
	img.src = 'img/'+id+'_on.gif';
}
function _out(id, extra){      
	var img = document.getElementById(extra==undefined? id : id+extra);
	img.src = 'img/'+id+'.gif';
}
function show_div(id, bool){
	var o = document.getElementById(id);
	//o.style.visibility = bool ? 'visible' : 'hidden';
	o.style.display = bool ? 'block' : 'none';
}
function show_video(vid){
	// internal: h = 256
	// external: h = 293
	var settings='width=544,height=293,location=no,resizable=no,toolbar=no,status=no,menubar=no,scrollbars=no';
	popwin=window.open('pop_video.php?vid='+vid, "video", settings);
	if (popwin) popwin.focus();
	return false;
}
function show_pw_reminder(){
	var settings='width=370,height=155,location=no,resizable=no,toolbar=no,status=no,menubar=no,scrollbars=no';
	popwin=window.open('pop_pw_reminder.php', "password", settings);
	if (popwin) popwin.focus();
	return false;
}
function show_rechte_cover(src,quer) {
	// internal: h = 256
	// external: h = 293
	var settings='width=320,height=448,location=no,resizable=no,toolbar=no,status=no,menubar=no,scrollbars=no';
	if (quer) var settings='width=448,height=320,location=no,resizable=no,toolbar=no,status=no,menubar=no,scrollbars=no';
	popwin = window.open('pop_cover.php?src='+src, "deutsche", settings);
	if (popwin) popwin.focus();
//	return false;
}


function checkForm(){
	var l=checkForm.arguments;
	var o=l[0];
	var bool=1;
	
	for (var i=1;i<l.length;i++) {
	
		var e=o[l[i]];
		//var val=(e.options && !e.value)?e.options[e.selectedIndex].value:e.value;//NS4, select
		var val = e.value;
		if (val==''){
			e.focus();
			alert("Bitte alle erforderlichen Felder ausfüllen!");
			return false;
		} else if ((l[i]=='email') && (!isEmail(e.value))){
			e.focus();
			e.select();
			alert("Bitte eine korrekte Email-Adresse eingeben!");
			return false;
		} else if ((l[i]=='datum') && (!isDate(e.value))){
			e.focus();
			e.select();
			alert("Bitte eine korrektes Datum eingeben!");
			return false;
		}        
	}
	return true;
}
function isEmail(email) {
	reg = /^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@([a-zA-Z0-9-]+\.)+([a-zA-Z]{2,3})$/;
	return reg.exec(email);
}
function checkOrderForm(f){
	// rg_land_id
	if (!checkForm(f, 'rg_nachname','rg_vorname','rg_strasse','rg_hausnr','rg_plz','rg_ort','email'))
		return false;
		
	if (!f.lf_ident_flag.checked)
	// lf_land_id
		if (!checkForm(f, 'lf_nachname','lf_vorname','lf_strasse','lf_hausnr','lf_plz','lf_ort'))
			return false;
			
//	if(f.bezahl_modus[1].checked)
//		if (!checkForm(f, 'ls_name','ls_bank','ls_kontonr','ls_blz'))
//			return false;

	if (!f.agb_ok.checked){
		alert('Bitte bestätigen Sie, dass Sie die Geschäfts- und Lieferbedingungen akkzeptieren!');
		return false;
	}
	
	return true;
}