/**
 * Concatenates the values of a variable into an easily readable string
 * by Matt Hackett [scriptnode.com]
 * @param {Object} x The variable to debug
 * @param {Number} max The maximum number of recursions allowed (keep low, around 5 for HTML elements to prevent errors) [default: 10]
 * @param {String} sep The separator to use between [default: a single space ' ']
 * @param {Number} l The current level deep (amount of recursion). Do not use this parameter: it's for the function's own use
 */
function print_r(x, max, sep, l) {

	l = l || 0;
	max = max || 10;
	sep = sep || ' ';

	if (l > max) {
		return "[WARNING: Too much recursion]\n";
	}

	var
		i,
		r = '',
		t = typeof x,
		tab = '';

	if (x === null) {
		r += "(null)\n";
	} else if (t == 'object') {

		l++;

		for (i = 0; i < l; i++) {
			tab += sep;
		}

		if (x && x.length) {
			t = 'array';
		}

		r += '(' + t + ") :\n";

		for (i in x) {
			try {
				r += tab + '[' + i + '] : ' + print_r(x[i], max, sep, (l + 1));
			} catch(e) {
				return "[ERROR: " + e + "]\n";
			}
		}

	} else {

		if (t == 'string') {
			if (x == '') {
				x = '(empty)';
			}
		}

		r += '(' + t + ') ' + x + "\n";

	}

	return r;

};
var_dump = print_r;


function sprawdz(f,count,label)
{


	if( $('input[name="mocowanie"]').length>0 && $('input[name="mocowanie"]:checked').val()==undefined)
		{
		alert(label);
		return false;
		}

	var color='';
	for(var i=1;i<=count;i++)
	{
		color=$('input[name="get_color'+i+'"]:checked').val();
		if(color==undefined){
			alert(label);
			return false;
		}
	}
	return true;
	
}


$(document).ready(function() {
	
	$('.wal').click(function(){
		if(!$(this).hasClass('active')) {
			$('.waluta').fadeIn('fast');
			$(this).addClass('active');
			$('.jezyk').fadeOut('fast');
			$('.lang').removeClass('active');
			
		} else {
			$('.waluta').fadeOut('fast');
			$(this).removeClass('active');
		}
	});
	$('.lang').click(function(){
		if(!$(this).hasClass('active')) {
			$('.jezyk').fadeIn('fast');
			$(this).addClass('active');
			$('.waluta').fadeOut('fast');
			$('.wal').removeClass('active');
			
		}
		else {
			$('.jezyk').fadeOut('fast');
			$(this).removeClass('active');
		}
	});

	
	$('.zoom').lightBox();
	
	/* WTF?! */
	var zIndexNumber = 1500;
	$('div').each(function() {
		$(this).css('zIndex', zIndexNumber);
		zIndexNumber -= 10;
	});
	
	$('.color_list h4').click(function() {
		
		if ($(this).next('div').hasClass("active")) {
			$('.active').slideToggle('fast').removeClass('active');
		} else {
			$('.active').slideToggle('fast').removeClass('active');
			$(this).next('div').slideToggle('fast').addClass('active');
		}
	});
	
	$('.color_list label input[type=radio]').click(function(){
		if($(this).is(':checked')) $('.active:not(:animated)').hide().removeClass('active');
	});

	$('.color_list label input[type=radio]').change(function() {
		
		var c_name = $(this).attr('name');
		var color = $(this).attr('title');

		$('.'+c_name+' .color_b').css({'background':  color.replace(/[0-9]{3}-(#.+)-.+/,'$1')});
		$('.'+c_name).next('div').hide().removeClass('active');
	});
	
	$('.opcje_zakupu h2').click(function() {
		if ($(this).next('div').hasClass("active")) {
			$('.active').slideToggle('slow').removeClass('active');
		} else {
			$('.active').slideToggle('slow').removeClass('active');
			$(this).next('div').slideToggle('slow').addClass('active');
		}
	});

/*
if($.browser.msie) {
	addEvent(window, 'load', initCorners);
	function initCorners() {
		var settings = {
				tl: { radius: 5 },
				tr: { radius: 5 },
				bl: { radius: 5 },
				br: { radius: 5 },
				antiAlias: true
		}
		curvyCorners(settings, ".img_r");
		curvyCorners(settings, ".basket_border");
		curvyCorners(settings, ".w_k");
	}
}
*/

});
	function captcha_reload(id)
	{
	$('#'+id).attr('src','func/securimage/securimage_show.php?'+(Math.random()*101));

	}

