newsletter_default_value = "e-mail";
newsletter_value_changed = false;

function onloadFunction() {
	if(jQuery("#newsletter_email").size())
	{
		jQuery("#newsletter_email").attr("value", newsletter_default_value);

		jQuery("#newsletter_email").focus(onNewsletterFocus);
		jQuery("#newsletter_email").keyup(function() { newsletter_value_changed = true; });
		jQuery("#newsletter_email").blur(onNewsletterBlur);
	}
}

function print_this_page() {
	var panel_main = jQuery("#" + panel_main_id);
	if (panel_main.size()) {
		var WindowObject = window.open("about:blank", "PrintingPage", "width=420,height=225,top=250,left=345,toolbars=no,scrollbars=yes,status=yes,resizable=yes", true);
		//WindowObject.stop();
			WindowObject.document.open();
			WindowObject.document.write("<html><head>" + jQuery("head").html() + "</head><body>" + panel_main.html() + "</body></html>");
			//WindowObject.document.write(jQuery("head").html());
			//WindowObject.document.write("</head><body>");
			//WindowObject.document.write(panel_main.html());
			//WindowObject.document.write("</body></html>");
			//var closeDoc = function() {
			//		WindowObject.document.close();
			//		WindowObject.focus();
			//		WindowObject.print();
			//};
			jQuery(WindowObject).load(on_close_doc);
			WindowObject.setTimeout("on_close_doc()", 1000);
		//WindowObject.close();
	}
}

function on_close_doc()
{
	self.document.close();
	self.focus();
	self.print();
}

function onLoginClick() {
	jQuery("#password_md").val(MD5(jQuery("#password").val()));
	return true;
}

function onNewsletterFocus(){
	if(jQuery("#newsletter_email").size())
	{
		if (jQuery("#newsletter_email").attr("value")==newsletter_default_value){
			jQuery("#newsletter_email").attr("value", "");
		}
	}
}

function onNewsletterBlur(){
	if(jQuery("#newsletter_email").size())
	{
		if (jQuery("#newsletter_email").attr("value")==""){
			jQuery("#newsletter_email").attr("value", newsletter_default_value);
		}
	}
}


function login_submit(f) {
    f['password'].value = MD5(f['password_plain'].value);
    f['password_plain'].value = '';
    return true;
}

function bookmark(anchor){
	var tytul = anchor.getAttribute('title'); 
	var adres = anchor.getAttribute('href'); 
	//FireFox 
	if (window.sidebar || (window.opera && window.print)) {
		window.sidebar.addPanel(tytul, adres, ""); 
	}
	//IE 
	else if (window.external) {
		window.external.AddFavorite(adres, tytul); 
	}
	//Opera 
	/*else if (window.opera && window.print) { 
		var a = document.createElement('a'); 
		a.setAttribute('href', adres); 
		a.setAttribute('title', tytul); 
		a.setAttribute('rel','sidebar'); 
		a.click(); 
	}*/
	return false;
}

function onRegisterFormSubmit()
{
	jQuery("#register_password").val(MD5(jQuery("#register_password").val()));
	jQuery("#register_password1").val(MD5(jQuery("#register_password1").val()));
	return true;
}

function onChangePasswordFormSubmit(form)
{
	if(!form)
		form = this;
	jQuery("#old_password").val(MD5(jQuery("#old_password").val()));
	jQuery("#password").val(MD5(jQuery("#password").val()));
	jQuery("#password1").val(MD5(jQuery("#password1").val()));
	return true;
}

function displayWindow(url, width, height, title) {
    var Win = window.open(url,"displayWindow",'width=' + width + ',height=' + height + ',resizable=0,scrollbars=no,menubar=no' );
}

