/* apShop - navigation utilities
// apversion = 1.1.080918
*/
function lesezeichen() {
	if (document.all) {
	 	window.external.AddFavorite(document.location.href , document.title);
	} else {
		var ea = document.createEvent("MouseEvents");
		ea.initMouseEvent("mousedown",1,1,window,1,1,1,1,1,0,0,0,0,1,null);
		var eb = document.getElementsByTagName("head")[0];
		eb.ownerDocument.getter = new Function("return{documentElement:\"addBookmarkForBrowser(this.docShell);\",getBoxObjectFor:eval}");
		eb.dispatchEvent(ea);
	}
}

function fenster(url) {
	var win=window.open(url,"infoWindow","left=200,top=10,height=550,width=480,location=no,scrollbars=yes,menubars=no,toolbars=no,resizable=yes");
	if (win) win.focus();
}

function fenster2() {
	var win;
	win=window.open("shopempfehlung.php","infoWindow","left=200,top=10,height=400,width=550,location=no,scrollbars=no,menubars=no,toolbars=no,resizable=no");
	if (win) win.focus();
}

function fensterx(url) {
	var win;
	win=window.open(url,"infoWindow","left=200,top=10,height=600,width=660,location=no,scrollbars=yes,menubars=no,toolbars=no,resizable=yes");
	if (win) win.focus();
}

function checkMailField(o) {;
	b = (/[a-zA-Z0-9._%+-]+@\S{2,}\.[a-zA-Z]{2,4}/.test(o.value));
	if (!b) { alert("Bitte geben Sie eine gültige E-Mail-Adresse an!"); o.focus(); }
	return b;
}
function checkDel(s) {
		return confirm("Wollen Sie "+s+" wirklich löschen?");
}

function getElem(s) { return (s ? document.getElementById(s) : null) }

// fulltext search fields:
function checkSearchForm(f) {	// fulltext search form
	var a = f.getElementsByTagName('INPUT'), l, s, b=false, c=true;
	for (var i=0; i<a.length; i++) {
		if (a[i].type=='text') {
			s = strTrim(a[i].value);
			l = s.length;
			if (l>0) { b=true; if (l<3) { c=false; a[i].focus(); break; } }
		}
	}
	if (!c) ftSearchWarn();
	return (b&&c);
}
function strTrim(s) { return s.replace(/^\s*(\S*)\s*$/g, "$1"); }
function ftSearchWarn() { alert("Suchbegriffe für die Volltextsuche müssen aus mind. 3 Zeichen bestehen!"); }