$(document).ready(function(){
	  $("#submitBulkStatus").click(function() {
		  
			  var formForSubmission = '#formOption';  
		  
			  if($(".ListAll:checked").size()==0)	{
				jAlert(lblSelectItem);
				return false;
			  }   
			  var changeStatus= $('#changeStatus').val();
			  if(changeStatus=='Deleted')	{
				 jConfirm(msgConfirmDelete, 'Alert', function(r) {
					  if(r==true) { $(formForSubmission).submit();	}
				  });
			  } else if(changeStatus=='') {
				  jAlert(msgSelectAStatus);	  
				  return false;		
			  } else	{
				  return true;		
			  }
		  return false;	
		});
	  
	  $(".status-active,.status-inactive").click(function(){
		   
		var obj=$(this);
		var data=new Object();
		
		  	var ajaxUrl = "/productoption/AjaxChangeOptStatus/";  
			var suucessUrl = '/productoption/'; 
			data.customOptionID=$(this).attr('customOptionID');
		   
		if($(this).hasClass('status-active'))
			{
			data.newClass='status-inactive';
			data.status='I';	
			}
		else if($(this).hasClass('status-inactive'))
			{
			data.newClass='status-active';
			data.status='A';	
			}
			$.ajax({
			   type: "POST",
			   url: GLOBAL_BASE_PATH+ajaxUrl,
			   data:data,
			   success: function(msg){			     
			    window.location.href = GLOBAL_BASE_PATH +suucessUrl;
			    }
  			});			
	}); 	
	
	 $("#submitSearch").click(function() {
		if($.trim($('#customOptionName').val())=="" && $.trim($('#status').val())=="")
		{
			jAlert(msgSelectSearchCriteria);
			return false;
		}
		return true;  	 
	 });
	 
	

});
function delsubconfirm(currID,type) {
	
		var delUrl = '/productoption/AjaxDestroyOption/id/'+currID+'/type/'+type;  
		
    jConfirm(msgConfirmDelete, 'Alert',function (r) {
        if (r == true) {
            window.location.href = GLOBAL_BASE_PATH +delUrl;			
        } else {
            return false;
        }
    },okText,cancelText);
}

