var VideoSearchClass = Class.create();
VideoSearchClass.prototype = {
	initialize: function(form) {

		this.categories = '';
		this.brand = '';
		this.model = '';
		this.keyword = '';

		if (form['slowo'] && form['slowo'].value != '') {
			this.keyword = form['slowo'].value;
		}
		if (form['marka'] && form['marka'].selectedIndex) {
			this.brand = form['marka'].options[form['marka'].selectedIndex].innerHTML;
		}
		if (form['model'] && form['model'].selectedIndex) {
			if (form['model'].options.length > 0) {
				this.model = form['model'].options[form['model'].selectedIndex].innerHTML;
			}
		}

		if (form['categories[]']) {
			$A(form['categories[]']).each( function (item) {
				if (item.checked) {
					this.categories += item.value + ',';
				}
			}.bind(this));
		}
		var url = '/szukaj/filmy' +
 				  ( this.keyword ? '/slowo/' + this.keyword.replace(/\s/g,'_') : '' ) +
 				  ( this.brand ? '/marka/' + this.brand : '' ) +
 				  ( this.model ? '/model/' + this.model : '' ) +
				  '/kategorie/' + this.categories;
		document.location = url;
	}


}