$(document).ready(function(){
	setAdminDesc();
        
	$(".slidingDiv").hide();
        $(".show_hide").show();

	$('.show_hide').click(function(){
	  if ($(".slidingDiv").text().trim().length == '0')
	  {
	  $.ajax({type : 'POST',
		  url : 'resource/php/getWartParSys.php',
		  dataType : 'json',
		  data: {
				name : 'OPIS'
			},success : function(data){
			  $(".slidingDiv").text(data.msg);
				/*$('#waiting').hide(500);
				$('#message').removeClass().addClass((data.error === true) ? 'error' : 'success')
					.text(data.msg).show(500);
				if (data.error === true)
					$('#demoForm').show(500);*/
			}});
	  }
	  $(".slidingDiv").slideToggle();
	});

});

function doLogin(){
  $.ajax({url: 'resource/php/login.php',
	  type: 'POST',
	  dataType : 'json',
	  data: {
		  operation: 'login',
		  login: $('#login').attr("value"),
		  pass:  $('#pass').attr("value")
	        },
					   success: function(data){
						if (!data.error)
						  window.location.reload();
							}
					  });
  }
  
  
function doExit(){
  $.ajax({url: 'resource/php/login.php',
	  type: 'POST',
	  dataType : 'json',
	  data: {
		  operation: 'exit',
		  login: 'x',
		  pass:  'x'
	        },
					   success: function(data){
					     if (!data.error)
						window.location.reload();
							}
					  });
  }
 
function setAdminDesc(){
  	  $.ajax({type : 'POST',
		  url : 'resource/php/getWartParSys.php',
		  dataType : 'json',
		  data: {
				name : 'OPIS'
			},success : function(data){
			  $("#taOpis").val(data.msg);
			}});
}  


function setDescript(){
	  $.ajax({type : 'POST',
		  url : 'resource/php/setWartParSys.php',
		  dataType : 'json',
		  data: {
				name : 'OPIS',
				value : $("#taOpis").val()
			},success : function(data){
			  $(".slidingDiv").text(data.msg);
			}});
  
}







