$(document).ready(function() {
						   
	//sort categories
	if(document.getElementById('sortCat')){
		$("#sortCat ul").sortable({ opacity: 0.6, cursor: 'move', update: function() {
			var order = $(this).sortable("serialize") + '&action=updateRecordsListings'; 
			$.post("categorii-liveUpdate.php", order, function(theResponse){
				$("#sortResponse").html(theResponse);
			}); 															 
		}								  
		});
	}
	
	//sort prod
	if(document.getElementById('sortProd')){
		$("#sortProd ul").sortable({ opacity: 0.6, cursor: 'move', update: function() {
			var order = $(this).sortable("serialize") + '&action=updateRecordsListings'; 
			$.post("producatori-liveUpdate.php", order, function(theResponse){
				$("#sortResponse").html(theResponse);
			}); 															 
		}								  
		});
	}
	
	//sort product
	if(document.getElementById('sortProduct')){
		var idCategorie = document.getElementById('idCategorie').value;
		
		$("#sortProduct ul").sortable({ opacity: 0.6, cursor: 'move', update: function() {
			var order = $(this).sortable("serialize") + '&action=updateRecordsListings&idCategorie=' + idCategorie; 
			$.post("produse-aranjare-liveUpdate.php", order, function(theResponse){
				$("#sortResponse").html(theResponse);
			}); 															 
		}								  
		});
	}
	
	//sortValoriAtribut
	if(document.getElementById('sortValoriAtribut')){
		$("#sortValoriAtribut ul").sortable({ opacity: 0.6, cursor: 'move', update: function() {
			var order = $(this).sortable("serialize") + '&action=updateRecordsListings'; 
			$.post("atribute-valori-liveUpdate.php", order, function(theResponse){
				$("#sortResponse").html(theResponse);
			}); 															 
		}								  
		});
	}
	
	
	// hide AND show with toggle (ex: http://www.learningjquery.com/2006/09/slicker-show-and-hide)
	$('a#slick-slidetoggle').click(function() {
    	$('#slickbox').slideToggle(400);
    	return false;
	});
	
	$('a#slick-slidetoggle2').click(function() {
    	$('#slickbox2').slideToggle(400);
    	return false;
	});
	
	$('a#slick-slidetoggle3').click(function() {
    	$('#slickbox3').slideToggle(400);
    	return false;
	});
	
	$('a#slick-show-span').click(function() {
    	$('#slickbox').show().css("display", "");
		$('#slick-show-span').hide();
    	return false;
	});
	
	
	//More Showing, More Hiding (http://www.learningjquery.com/2007/02/more-showing-more-hiding)
    $('div.demo-show:eq(0)> div').hide();  
	$('div.demo-show:eq(0)> h3').click(function() {
		$(this).next().slideToggle('fast');
	});


	$('div.laDistributie:eq(0)> p span').hide();  
	$('div.laDistributie:eq(0)> p a').click(function() {
		$(this).hide().next().show();
	});
	
		//pt COS
		if(document.getElementById ('persoanaJ')){
			$('#persoanaJ').change(function() {
				$('#datePersJ').show('slow');
				$('#datePersF').hide('slow');
				//document.getElementById('ordinPlata').checked = 'checked';
				return false;
			});
		}
		if(document.getElementById ('persoanaF')){
			$('#persoanaF').change(function() {
				$('#datePersF').show('slow');
				$('#datePersJ').hide('slow');
					//if(document.getElementById('ramburs')) {	document.getElementById('ramburs').checked = 'checked'; }
					//if(document.getElementById('numerar')) {	document.getElementById('numerar').checked = 'checked'; }
				return false;
			});
		}
		//if(document.getElementById ('ordinPlata')){
			//$('#ordinPlata').change(function() {
				//$('#datePersJ').show('slow');
				//$('#livrareCNP').hide('slow');
				//document.getElementById('persoanaJ').checked = 'checked';
				//return false;
			//});
		//}
		//if(document.getElementById ('ramburs')){
			//$('#ramburs').change(function() {
				//$('#datePersJ').hide('slow');
				//$('#livrareCNP').show('slow');
				//document.getElementById('persoanaF').checked = 'checked';
				//return false;
			//});
		//}
		//if(document.getElementById ('numerar')){
			//$('#numerar').change(function() {
				//$('#datePersJ').hide('slow');
				//$('#livrareCNP').show('slow');
				//document.getElementById('persoanaF').checked = 'checked';
				//return false;
			//});
		//}

	
		
		
		
	//view PIC
	$().piroBox({
			my_speed: 400, //animation speed
			bg_alpha: 0.1, //background opacity
			slideShow : true, // true == slideshow on, false == slideshow off
			slideSpeed : 4, //slideshow duration in seconds(3 to 6 Recommended)
			close_all : '.piro_close,.piro_overlay'// add class .piro_overlay(with comma)if you want overlay click close piroBox

	});



	// SLIDE
	$('#BannerFade')
		.after('<div id="navBannerFade">')
		.cycle({
			fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
			speed:  'slow',
			timeout: 3000,
			pause: 1,
			pager:  '#navBannerFade'
	});

	


});

