function initDateTimePicker(node) {
	node.find('.se_type-date').parent().datetimepicker({
		format: "YYYY-MM-DD"
		, locale: 'pl'
		, showTodayButton: true
	});
	node.find('.se_type-datetime').parent().datetimepicker({
		format: 'YYYY-MM-DD HH:mm'
		, locale: 'pl'
	});
	node.find('.se_type-time').parent().datetimepicker({
		format: 'HH:mm:ss'
		, locale: 'pl'
	});
}
jQuery(document).ready(function(){
	initDateTimePicker(jQuery(document));
});

function ClearAllFind() {
	var ElementsObj=document.forms["FILTER_SEARCH"] ;
	var ElementsArr=ElementsObj.elements ;

	for (var myprop in ElementsArr){

		if(ElementsArr[myprop]) {
			if((ElementsArr[myprop].type=="text")||(ElementsArr[myprop].type=="select-one")){
				var MyEval="var My"+ElementsArr[myprop].name+"=document.getElementById('"+ElementsArr[myprop].name+"\');";
				eval(MyEval);
				var MyEval="My"+ElementsArr[myprop].name+".value=\"%\"";
				eval(MyEval);
			}
		}
	}
}

function resetForm(n) {
	for (i = 0; i < n.form.elements.length; i++) {
		switch (n.form.elements[i].type.toLowerCase()){
			case 'text':
				n.form.elements[i].value='%';
				break;
			case 'select-one':
//				n.form.elements[i].options[0].selected = true;
//				break;
			case 'select-multiple':
				for (z = 0; z < n.form.elements[i].options.length; z++) {
					n.form.elements[i].options[z].selected = false;
					if (n.form.elements[i].options[z].hasAttribute('selected')) {
						n.form.elements[i].options[z].removeAttribute('selected');
					}
				}
				// select first element
				n.form.elements[i].options[0].selected = true;
				n.form.elements[i].options[0].setAttribute('selected', 'selected');
				break;
			default:

		}
	}
	return false;
}

global.initDateTimePicker = initDateTimePicker
global.ClearAllFind = ClearAllFind
global.resetForm = resetForm
