function isIE() {
      return /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent);
}


function oncontentready() {

}

function hideCats(){

var a;
var s = parseInt($('#dbformFxstatus').val())-1;

 for (a = 1; a < 6; ++a) {
  if (a > s) {
    $('#dbformImenu_id_'+a).parent().attr('class','hidden');
    $('#dbformFmenu_id_'+a).val('');
  }
  else 
   $('#dbformImenu_id_'+a).parent().attr('class','formRow');
}
}


$(window).load(function() {


});

$(document).ready(function() {

	if ($('#dbformFxstatus').get()) {
		hideCats();
		$('#dbformFxstatus').change(hideCats);
	}
	

	$('input.onclick-clear').each(function() {
		if (this.title != '' && this.value == '') {
			this.value = this.title;
			this.title = '';
		}
		else if (this.title != '' && this.value != '' && this.title != this.value) {
			$(this).removeClass('onclick-clear');
		}
		else if (this.title != '' && this.value != '' && this.title == this.value) {
			this.title = '';
		}		
	});

	
	$('input.onclick-clear').focus(function(){
		if (this.title == '') {
			this.title = this.value;
			this.value = '';
			$(this).removeClass('onclick-clear');
		}

	});

	$('input.onclick-clear').blur(function(){
		if (this.title != '' && this.value == '' ) {
			this.value = this.title;
			this.title = '';
			$(this).addClass('onclick-clear');	
		}
	});



$('#rooms') 
.cycle({ 
    fx:     'fade', 
    speed:  'slow', 
		delay:  0, 

		timeout: 15000, 

    next:   '#next', 
    prev:   '#prev',
pager:  '#navi', 

	before:  function() {
		//$("#kfoto").html(this.firstChild.alt);
	},
	prevNextClick: function() {
			$('#rooms').cycle('pause');
			$('#ao').removeClass('auto');
		}
});

	$('#ao').click(function(){
		if ($(this).hasClass('auto')) {
			$(this).removeClass('auto');
			$('#rooms').cycle('pause');
			//this.src = this.src.replace('-s','-r');
		}
		else {
			$(this).addClass('auto');
			$('#rooms').cycle('resume');
			//this.src = this.src.replace('-r','-s');
		}
		this.blur();
	});

	$('#navi a').click(function(){
			$('#rooms').cycle('pause');
			$('#ao').removeClass('auto');
			this.blur();
	});

});


function pobierz(nazwa) {
    if (document.cookie.length > 0) {
        startc = document.cookie.indexOf(nazwa + "=");
        if (startc != -1) {
            startc += nazwa.length + 1;
            endc = document.cookie.indexOf(";", startc);
            if (endc == -1) {
                endc = document.cookie.length;
            }
            return unescape(document.cookie.substring(startc,endc));
        }
	return false;
    }
    return false;
}

function rejestruj(nazwa, wartosc,dni) {
    var dzisiaj=new Date();
    var wygasnie=new Date();
    !dni ?dni=7 :"";
    wygasnie.setTime(dzisiaj.getTime()+1000*60*60*24*dni);
	document.cookie=nazwa+"="+escape(wartosc)+";expires="+wygasnie.toGMTString();
}
