jQuery(document).ready(function(){
	
	jQuery("#id_blog").change( function() {
		window.location.href='?action=default&id=default&subid=choose&back=1&nr='+jQuery(this).val();
	});
	
	jQuery("#id_szablon").change( function() {
		window.location.href='?action=design&id=default&subid=choose&back=1&nr='+jQuery(this).val();
	});
	
	
	jQuery("#notki_data").change(function () {
		document.location.href="?"+zmien({data: jQuery(this).val(), page: 0 });
    });

    jQuery("#notki_user").change(function () {
		document.location.href="?"+zmien({who: jQuery(this).val(), page: 0 });
    });
    
    jQuery("#id_kat_szablon").change( function() {
		window.location.href="?"+zmien({cat: jQuery(this).val(), page: 0});
	});
	
	jQuery("#notki_data").change(function () {
		document.location.href="?"+zmien({data: jQuery(this).val(), page: 0 });
    });

    jQuery("#staty_data").change( function() {
		window.location.href="?"+zmien({data: jQuery(this).val()});
	});

});

//parseurl.js
function parseUri (str) {
	var	o   = parseUri.options,
		m   = o.parser[o.strictMode ? "strict" : "loose"].exec(str),
		uri = {},
		i   = 14;

	while (i--) uri[o.key[i]] = m[i] || "";

	uri[o.q.name] = {};
	uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) {
		if ($1) uri[o.q.name][$1] = $2;
	});

	return uri;
};

parseUri.options = {
	strictMode: false,
	key: ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],
	q:   {
		name:   "queryKey",
		parser: /(?:^|&)([^&=]*)=?([^&]*)/g
	},
	parser: {
		strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
		loose:  /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
	}
};


function zmien(zmienic)
{
	//wejscie tablica [var]:[value]
	var items  = parseUri (document.location.href);
	var teraz = items['queryKey'];
	url=jQuery.extend(teraz, zmienic);
	urlr = new Array();
	jQuery.each(url, function(i, n){
	 //urlr=urlr++"&";
	  urlr.push(i+"="+n);
	});
	return urlr.join("&");
}
//parseurl.js

jQuery.fn.joe_autohide = function() {
        var text = this.val();

        this.focus(function(){
                if(jQuery(this).val()==text) jQuery(this).val('');
                })
        this.blur(function(){
                if(jQuery(this).val()=='') jQuery(this).val(text);
                })
};
