/* START applesearch object */
		
if (!applesearch)	var applesearch = {};

applesearch.init = function () {
	// add applesearch css for non-safari, dom-capable browsers
// 	if ( navigator.userAgent.toLowerCase().indexOf('safari') < 0  && document.getElementById ) {
// 		this.clearBtn = false;
// 		// add style sheet if not safari
// 		var dummy = document.getElementById("dummy_css");
// 		if (dummy)	dummy.href = "../_c/applesearch.css";
// 	}
	
	var fld = document.getElementById('srch_fld');
	fld.value = 'Suchen...';
}

// called when on user input - toggles clear fld btn
applesearch.onChange = function (fldID, btnID) {
	// check whether to show delete button
	var fld = document.getElementById( fldID );
	var btn = document.getElementById( btnID );
	if (fld.value.length > 0 && !this.clearBtn) {
		btn.style.background = "#fff url(/_p/srch-bgs.png) no-repeat 0 -40px";
		btn.fldID = fldID; // btn remembers it's field
		btn.onclick = this.clearBtnClick;
		this.clearBtn = true;
	} else if ((fld.value.length == 0 && this.clearBtn) || fld.value == 'Suchen...') {
		btn.style.background = "#fff url(/_p/srch-bgs.png) no-repeat 0 0";
		btn.onclick = null;
		this.clearBtn = false;
	}
}

applesearch.onFocus = function (fldID) {
	// check whether to show delete button
	var fld = document.getElementById( fldID );
	if (fld.value == 'Suchen...') {
		fld.value = '';
	}
}

applesearch.onBlur = function (fldID) {
	// check whether to show delete button
	var fld = document.getElementById( fldID );
	if (fld.value == '') {
		fld.value = 'Suchen...';
	}
}


// clears field
applesearch.clearFld = function (fldID,btnID) {
	var fld = document.getElementById( fldID );
	fld.value = 'Suchen...';
	this.onChange(fldID,btnID);
}

// called by btn.onclick event handler - calls clearFld for this button
applesearch.clearBtnClick = function () {
	applesearch.clearFld(this.fldID, this.id);
}

/* END applesearch object */

