

APP = {};
APP.onValueChange = function(input, onChange, emptyValue){

	var el = $(input).first();
	var value = el.val();
	el.val(emptyValue||"suchen ...")
	var timer;
	
	el.bind({
		keyup: function(ev){
			if(this.value!=value){
				value = this.value;
				if(onChange){
					if(timer)
						window.clearTimeout(timer);
					timer = window.setTimeout(function(){
						onChange(value);
					}, 500)
				}
			}
		},
		click: function(){
			if(onChange && this.value!=value){
				value = this.value;
				onChange(value);
			}
		},
		blur: function(){
			if(!value)
				el.val(emptyValue||"suchen ...");
		},
		focus: function(){
			if(!value)
				el.val("");
		}
	})
}

/*
 * custom javascripts if needed goes here
 */

$(document).ready(function(){
	if(typeof(ImageZoomer) != "undefined"){
		ImageZoomer.init(".rtf a");
		ImageZoomer.init(".rtf img.image-zoomer");
	}
})
