$(function(){
	$('.menu').droppy({speed: 100});
	$('.calendar').calendar({
		dateFormat: '%d-%m-%Y'
	});
	
	$('.tooltip').each(function(){
		$(this).aToolTip();
	});
	
	$('.list').find('tbody').each( function(){
		var odd = 1;
		$(this).find('tr').each(function(){
			if( odd == 1 ) 
				$(this).addClass('odd');
			else
				$(this).addClass('even');
			
			if( odd == 1 ) 
				odd = 0;
			else 
				odd = 1;
		});
	});
});

Array.prototype.inArray = function(v){
  for(var i in this){if(this[i] == v){return true;}}return false;
}

function ProductVisibleOff( idProduct ) {
	$.ajax({
		type: 'POST',
		url: 'ajax/change_product_visible.ajax.php',
		data: 'idProduct='+idProduct+'&to=0'
	});
	$('.productrow'+idProduct).find('.visiblecell').empty().html(
		$( '<img src=\'static/images/visible-off.png\' alt=\'Pokaż\' onclick=\'javascript:ProductVisibleOn('+idProduct+');\' class=\'visiblechange\' />' )
	);
};

function ProductVisibleOn( idProduct ) {
	$.ajax({
		type: 'POST',
		url: 'ajax/change_product_visible.ajax.php',
		data: 'idProduct='+idProduct+'&to=1'
	});
	$('.productrow'+idProduct).find('.visiblecell').empty().html(
		$( '<img src=\'static/images/visible-on.png\' alt=\'Ukryj\' onclick=\'javascript:ProductVisibleOff('+idProduct+');\' class=\'visiblechange\' />' )
	);
};function ProductSliderOff( idProduct ) {	$.ajax({		type: 'POST',		url: 'ajax/change_product_slider.ajax.php',		data: 'idProduct='+idProduct+'&to=0'	});	$('.productrow'+idProduct+' .slidercell').html(		$( '<img src=\'static/images/visible-off.png\' alt=\'Pokaż\' onclick=\'javascript:ProductSliderOn('+idProduct+');\' class=\'visiblechange\' />' )	);};function ProductSliderOn( idProduct ) {	$.ajax({		type: 'POST',		url: 'ajax/change_product_slider.ajax.php',		data: 'idProduct='+idProduct+'&to=1'	});	$('.productrow'+idProduct+' .slidercell').html(		$( '<img src=\'static/images/visible-on.png\' alt=\'Ukryj\' onclick=\'javascript:ProductSliderOff('+idProduct+');\' class=\'visiblechange\' />' )	);};
