function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function number_format( number, decimals, dec_point, thousands_sep ) {

    var n = number, c = isNaN(decimals = Math.abs(decimals)) ? 2 : decimals;
    var d = dec_point == undefined ? "." : dec_point;
    var t = thousands_sep == undefined ? "," : thousands_sep, s = n < 0 ? "-" : "";
    var i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0;
    
    return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
}

function isInt(x) { 
   var y=parseInt(x); 
   if (isNaN(y)) return false; 
   return x==y && x.toString()==y.toString(); 
}

$(document).ready(function(){
	
	var maxPersons = 10;
	
	$('a[href="?advancedSearch"]').click(function(){
		$('.advanced').show();
		return false;
	});
	
	$('a[href="?basicSearch"]').click(function(){
		$('.advanced').hide();
		return false;
	});
	
	$('#add').click(function(){
		
		if($('#personsNum').val()<=maxPersons){
			nextInt = $('#personsNum').val();
			nextInt++;
			$('#person_'+nextInt).show();
			$('#personsNum').val(nextInt);
		}
		if(nextInt==10){ $('#add').hide(); }
		else{ $('#add').show(); }
		$('#del').show();
	});
	
	$('#del').click(function(){	
		if($('#personsNum').val()>1){
			prevInt = $('#personsNum').val();
			$('#person_'+prevInt).hide(); 
			prevInt--;
			$('#personsNum').val(prevInt);
		}
		if(prevInt==1){ $('#del').hide(); }
		else{ $('#del').show(); }
		$('#add').show();
	});
	
	$('#submitEmail').click(function(){
		$('#newsletter').submit();
	});
	
	$('#emailAddressNewsletter').click(function(){
		if($(this).val() == 'adres@gmail.com'){ $(this).val(''); }
	});
	
	$('#pasek').marquee('pasek').mouseover(function () {
		$(this).trigger('stop');
	}).mouseout(function () {
        $(this).trigger('start');
    }).mousemove(function (event) {
        if ($(this).data('drag') == true) {
        	this.scrollLeft = $(this).data('scrollX') + ($(this).data('x') - event.clientX);
		}
	}).mousedown(function (event) {
		$(this).data('drag', true).data('x', event.clientX).data('scrollX', this.scrollLeft);
    }).mouseup(function () {
		$(this).data('drag', false);
	});
	
	/*
	$('#partnersList').jcarousel();
	*/
});


