$(document).ready(function(){

	
$('.ui-daterangepicker-dateRange').addClass('ui-state-active');	
$(document).ready(function(){
$('.main_menu li a[rel=Manageproduct]').addClass('active');
 });
	$(".out-stock").hover(function () {
		$(this).parent().find(".tooltip").show();
	}, function () {
		$(this).parent().find(".tooltip").hide();
	});
   //check box validation to update status
        $("#submitProduct").click(function(){		
				   var changeStatus= $('#changeStatus').val();
				   
		   if($(".ListAll:checked").size()==0){
			   jAlert(msgSelectItem);
                           return false;
		   } else if(changeStatus==""){
			   jAlert(lblSelectAction);
                           return false; 
		   }
         if(changeStatus=='Deleted')
                    {
			jConfirm(msgConfirmDelete, 'Alert', function(r) {
                                            if(r==true) {
                                                    $('#formProduct').submit();
                                            }
                                    });
                    } else	{
			$('#formProduct').submit();
                    }
                    return false;

         }); 	
});

$(document).ready(function(){
	if($(".clone,.setpriority").length>0)
	{
		$(".clone,.setpriority").colorbox({iframe:true, innerWidth:"80%", innerHeight:"80%"});
	}
	 setSideMenu();
$("#submit").click(function()
	{
	var repflag=1;
	if(($('#salesRepEnable').val()=='Yes' &&  $('ul.chzn-choices li').length == 1)|| ($('#salesRepEnable').val()==''))
	{
	  repflag = 0;	
	}
          if(jQuery.trim($('#searchProductName').val())=="" &&jQuery.trim($('#brandID').val())=="" && $('#searchProductDate').val()=="" )
		  {

				  if($("[name='multiselect_searchProductCategory']:checked").length == 0 && $('#productStatus').val()=="" && $('#searchPriceFrom').val()=='' && $('#searchPriceUpto').val()=='' &&
				     $('#searchDiscountFrom').val()=='' && $('#searchDiscountTo').val()=='' && $('#searchQuantityBelow').val()==''){
					      jAlert(msgSelectSearchCriteria); 
				 return false;
					  }
					  else
					  {
					return true;	
					  }
				 
		}                  
                            return true;     

         }); 
});

$(".deleteproduct").click(function(){    
		var ID=$(this).attr('productid');		
		jConfirm(msgConfirmDeletepdt,'Alert', function(r) {
	   		if(r==true){
				$.ajax({
				type: "POST",
				url: GLOBAL_BASE_PATH+"/product/ajaxChangeStatus/",
				data: "did="+ID,
				success: function(msg){
					location.reload();
				}
			   });  
				}
			});
	});
 
    
   $("#searchLink").click(function(){    
     
           if($(this).attr('rel')=='basic')
           {
            $(this).text(lblAdvanceSearch);
            $('#searchOption').val('basic');
             $(this).attr('rel','advance');            
            $(".advanceSearch").hide();
           } 
           else
           {
           
            $(this).text(lblBasicSearch);
            $('#searchOption').val('advance');
             $(this).attr('rel','basic');
             $(".advanceSearch").show();
           }
    
    });
 $(document).on("click",".add01",function () {
	$(this).removeClass("add01")
	$(this).addClass("minus01")
	var rel = $(this).attr('rel');
	 $(".details_"+rel).show();
});
$(document).on("click",".minus01",function () {
	var rel = $(this).attr('rel');
	 $(".details_"+rel).fadeOut();
	 $(this).removeClass("minus01")
	$(this).addClass("add01")
});
 $(document).on('click', ".ListStatusLinkCheckbox", function () {
        if ($(this).prop("checked") == true) {
            $(".ListAll").prop("checked", true);
        } else {
            $(".ListAll").prop("checked", false);
        }
    });
 $(document).on('click', ".editbox", function () {
        $(".buttonsSection").show();
    });	   
    
    
    
    