//javascript on
$('head').append('<link rel="stylesheet" type="text/css" href="/styles/javascript.css" media="all">');
	$(function(){
	//place holder
		$("form input.placeHolder[type$='text']").each(function(i){
			$(this).attr("autocomplete","off");//dla firefoxa zabezpieczenie
			if($(this).val()=='')$(this).val($(this).attr('title')); //jeżeli kotś podaje var
			$(this).focus(function(){
				if($(this).val()==$(this).attr('title'))$(this).val('');		
			}).blur(function(){
				if($(this).val()=='')$(this).val($(this).attr('title'));
			});
		});
		$('form').submit(function(){
			$(this).find("input.placeHolder[type$='text']").each(function(i){
				if($(this).val()==$(this).attr('title'))$(this).val('');	
			});
		});
	//rollover images
		$("form input.rollover[type$='image']").each(function(){
			var img= new Image();
			var uri=$(this).attr('src');
			img.src=uri.replace('.','Over.');
		}).hover(function(){
			var uri=$(this).attr('src');
			uri=uri.replace('Over','');
			uri=uri.replace('.','Over.');
			$(this).attr('src',uri);
		},function(){
			var uri=$(this).attr('src');
			uri=uri.replace('Over','');
			$(this).attr('src',uri);	
		});
	// submit form when user changed value
		$('.onChange').change(function(){
			this.form.submit();
		});
	// popup window 
	$('a.popup').click(function(){
		window.open(
			$(this).attr('href'),
			$(this).text(), 
			'height=600,width=900,resizable=no,scrollbars=yes,status=no,top=50%,left=50%'
		); 
		return false;
	});
	
	});

/* by Scott Andrew (http://www.scottandrew.com/) */
function createCookie(name, value, days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }  else expires = "";
  document.cookie = name + "=" + value + expires + "; path=/";
};

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1, c.length);
    if (c.indexOf(nameEQ) == 0)return c.substring(nameEQ.length, c.length);
  };
  return null;
};

function eraseCookie(name) {
	createCookie(name,"",-1);
};
