$(document).ready(function(){
	$("#searchSubmittedDate").daterangepicker({ arrows: false,dateFormat: datePickerDateFormat});
	
	$(document).on('click','.changeStatus',function(){
		var ajax_href		=	$(this).attr("ajax_href");
		$.ajax({
			type: "GET",
			url: GLOBAL_BASE_PATH +ajax_href,
			success: function(msg){ 
				location.reload();
			 }
		 });  			
	});
	
	
	
	$(document).on('click','.elements',function(){
		if(show[$(this).data('element')]){
			show[$(this).data('element')]=false;
		}
		else{
			show[$(this).data('element')]=true;
		}
		switchTemplates();
	});
	
	$("#frmContentList").submit(function(){
		if($("[name='submissions[]']:checked").length>0){
			if($("#submissionStatus").val()!=''){
				return true;
			}else{
				jAlert(lblSelectStatus);
				return false;
			}
		}else{
			jAlert(msgSelectItem);
			return false;
		}
	});
	
	$("#submitBulkStatus").click(function () {
		var ListAllCheckedCount = $(".ListAll:checked").size();
		var status = $('#submissionStatus').val();
		if ($(".ListAll:checked").size() == 0) {
			jAlert(msgSelectItem);
			return false;
		} else if (status == "") {
			jAlert(lblSelectAction);
			return false;
		}
		if (status == 'Deleted') {
			jConfirm(msgDeleteItem, lblAlert, function (r) {
				if (r == true) {
					$('#frmContentList').submit();
				}
			});
		} else {
			return true;
		}
		return false;
	});		
	
	
	$(document).on('click',".main-strip",function() {
		if($(this).siblings(".list-box").is(':visible')){
			$(this).parent(".tool-tip02").removeClass("active");	
			$(".list-box").hide();	
		}
		else{
			$(".list-box").hide();
			$(this).siblings(".list-box").slideDown("fast");
			$(".tool-tip02").removeClass("active");
			$(this).parent(".tool-tip02").addClass("active");	
		}
    });
	$('body').click(function (e) {
        if ($(".tool-tip02").has(e.target).length === 0) {
           $(".tool-tip02").removeClass('active');
		   $(".list-box").hide();
        }		
    });

});