function goPage()
{
	//window.location="http://localhost/ybgCMS/index.php/ybg/administrator";
  //REMOVE SUDESH
  alert("IMpt : called now search for //REMOVE SUDESH in ybgCMS.js")
}

function previewform1()
{ 
  var element = document.forms[0].elements;
  var length1 = element.length;
  for(i=0;i<length1;i++) { 
    element[i].value;
  }
  var submit1 = document.forms[1].elements;
  length2 =  submit1.length;
  for(j=0;j<length2;j++) {
    submit1[j].click();
  }
}

function confirmdeletemenublock()
{
  var message = "Are You sure you want to remove this menu block";
  deletemenu = confirm(message);
  if(deletemenu==true || deletemenu==1) {
    return true
  } else {
    return false;
  }
}

function confirmdeletemenu()
{ 
  var message = "Are You sure you want to remove this menu";
  deletemenu = confirm(message);
  if(deletemenu==true || deletemenu==1) {
    return true
  } else {
    return false;
  }
}

/*
	manish javascript
*/
function pageredirect()
{
  if(add_path)
  {
    location=add_path;
  }
}

function test(com,grid)
{alert(com);
    if (com=='Select All')
    {
		$('.bDiv tbody tr',grid).addClass('trSelected');
    }
    
    if (com=='Setsectiondefault')
    {
      if(confirm('Do you want to Set this Section as Default')) {

      } else {
      }
    }
    if (com=='DeSelect All')
    {
		$('.bDiv tbody tr',grid).removeClass('trSelected');
    }
    
    if (com=='Delete')
    {
       if($('.trSelected',grid).length>0){
			   if(confirm('Delete ' + $('.trSelected',grid).length + ' items?')){
		            var items = $('.trSelected',grid);
		            var itemlist ='';
		        	for(i=0;i<items.length;i++){
						if (i > 0) {
							itemlist+= ",";
						}
						      itemlist+= items[i].id.substr(3);
					}
					 $.ajax({
					   type: "POST",
					   url: ajax_path,
					   data: "items="+itemlist,
					   success: function(data){
					   	$('#flex1').flexReload();
					  	alert(data);
					   }
					});
				}
			} else {
				return false;
			} 
    }          

    if (com=='DeleteOne')
    {
      if(confirm('Delete 1 item')){
          $.ajax({
                  type: "POST",
                  url: ajax_path,
                  data: "items="+grid,
                  success: function(data){
                    $('#flex1').flexReload();
                    alert(data);
                  }
          });
      } else {
        //return false;
      }
    }
/////////////////////////////////////////
	if (com=='DeleteOneBlock')
    {
      if(confirm('Delete 1 item')){
          $.ajax({
                  type: "POST",
                  url: ajax_path,
                  data: "items="+grid,
                  success: function(data){
                    $('#flex1').flexReload();
                    alert(data);
					location=add_path1;
                  }
          });
      } else {
        //return false;
      }
    }
//////////////////////////////////////////
    if(com=='SetDefault')
    {
      if(confirm('Do you really want to set to default')){
        $.ajax({
                type: "POST",
                url: ajax_path,
                data: "items="+grid,
                success: function(data){
                  $('#flex1').flexReload();
                  alert(data);
                }
        });
      } else {}
    }
} 

function user(com,grid)
{
    if (com=='Ban User')
    {
       if($('.trSelected',grid).length>0){
			   if(confirm('Ban ' + $('.trSelected',grid).length + ' items?')){
		            var items = $('.trSelected',grid);
                var itemlist ='';
		        	for(i=0;i<items.length;i++){
						      itemlist+= items[i].id.substr(3)+",";
					    }
              $.ajax({
                 type: "POST",
                 url: ajax_path,
                 data: "items="+itemlist,
                 success: function(data){
                  $('#flex1').flexReload();
                  alert(data);
                 }
              });
				}
			} else {
				return false;
			} 
    } 
    
    if (com=='Unban User')
    {
      alert("Unban User");
       if($('.trSelected',grid).length>0){
			   if(confirm('Unban ' + $('.trSelected',grid).length + ' users?')){
		            var items = $('.trSelected',grid);
                var itemlist ='';
		        	for(i=0;i<items.length;i++){
						      itemlist+= items[i].id.substr(3)+",";
					    }
              $.ajax({
                 type: "POST",
                 url: ajax_path1,
                 data: "items="+itemlist,
                 success: function(data){
                  $('#flex1').flexReload();
                  alert(data);
                 }
              });
				}
			} else {
				return false;
			} 
    }    
    
    if (com=='Reset Password')
    {
       if($('.trSelected',grid).length>0){
			   if(confirm('Reset Password of ' + $('.trSelected',grid).length + ' users?')){
		            var items = $('.trSelected',grid);
                var itemlist ='';
		        	  for(i=0;i<items.length;i++){
                  if (i > 0) {
                    itemlist+= ",";
                  }
						      itemlist+= items[i].id.substr(3);
					    }
              $.ajax({
                 type: "POST",
                 url: ajax_path2,
                 data: "items="+itemlist,
                 success: function(data){
                  $('#flex1').flexReload();
                  alert(data);
                 }
              });
				}
			} else {} 
    }
    
    if(com=='Unban One User')
    {
      if(confirm('Do u really want to Unban this User?')){
              $.ajax({
                 type: "POST",
                 url: ajax_path1,
                 data: "items="+grid,
                 success: function(data){
                  $('#flex1').flexReload();
                  alert(data);
                 }
              });
				} else {}
    }

    if(com=='Ban One User')
    {
      if(confirm('Do u really want to Ban this User?')){
              $.ajax({
                 type: "POST",
                 url: ajax_path,
                 data: "items="+grid,
                 success: function(data){
                  $('#flex1').flexReload();
                  alert(data);
                 }
              });
				} else {}
    }

    if(com == 'Activate User')
    {
       if($('.trSelected',grid).length>0){
			   if(confirm('Activate ' + $('.trSelected',grid).length + ' users?')){
		            var items = $('.trSelected',grid);
                var itemlist ='';
		        	  for(i=0;i<items.length;i++){
                  if (i > 0) {
                    itemlist+= ",";
                  }
						      itemlist+= items[i].id.substr(3);
                  alert(itemlist);
					    }
              $.ajax({
                 type: "POST",
                 url: ajax_path,
                 data: "items="+itemlist,
                 success: function(data){
                  $('#flex1').flexReload();
                  alert(data);
                 }
              });
				}
			} else {
				return false;
			} 
    }

    if(com=='Activate One User')
    {
      if(confirm('Do u really want to Activate this User?')){
              $.ajax({
                 type: "POST",
                 url: ajax_path,
                 data: "items="+grid,
                 success: function(data){
                  $('#flex1').flexReload();
                  alert(data);
                 }
              });
				} else {}
    }

    if(com == 'Delete Role')
    {
       if($('.trSelected',grid).length>0){
			   if(confirm('Delete ' + $('.trSelected',grid).length + ' roles?')){
		            var items = $('.trSelected',grid);
                var itemlist ='';
		        	  for(i=0;i<items.length;i++){
                  if (i > 0) {
                    itemlist+= ",";
                  }
						      itemlist+= items[i].id.substr(3);
					    }
              $.ajax({
                 type: "POST",
                 url: ajax_path,
                 data: "items="+itemlist,
                 success: function(data){
                  $('#flex1').flexReload();
                  alert(data);
                 }
              });
				}
			} else {
				return false;
			} 
    }

    if(com=='Delete One Role')
    {
      if(confirm('Do u really want to Delete this Role?')){
              $.ajax({
                 type: "POST",
                 url: ajax_path,
                 data: "items="+grid,
                 success: function(data){
                  $('#flex1').flexReload();
                  alert(data);
                 }
              });
				} else {}
    }
}

/*
	manish javascript
*/