function AJAXRequest(className, methodName, jsonData, successFunc, errorFunc){
    var JSONOString = JSON.stringify(jsonData);
    $.ajax({	   
		type : 'POST',
		url  : document.domain,
		dataType : 'json',
		data: {
		  JSON        : JSONOString,
          AJAXRequest : true,
          className   : className,
          methodName  : methodName
		},
		success : successFunc,
		error : errorFunc
	});

	return false;
}

function AJAXBlockLoad(BlockID, params, successFunc, errorFunc){
    var JSONOString = JSON.stringify(params);
    $.ajax({
		type : 'POST',
		url  : document.domain,
		dataType : 'json',
		data: {
		  JSON        : JSONOString,
      AJAXRequest : true,
      BlockId     : BlockID
		},
		success : successFunc,
		error : errorFunc
	});

	return false;
}



/*
 * request example
 */
function sendRequest() {
    
    JSONOObject = {key1 : 'value1', key2 : {key3 :'value3', key4 : 'value4'}};
    
    /*you can also use arry*/
    someArray = Array(1,2,3);
    
    var JSONOString = JSON.stringify(JSONOObject);
    
    AJAXRequest(
        'xGalleryRating', 
        'changeRating', 
        JSONOString, 
        function log(data) {
           // //console.log(data);
        }
    );
}

function lockDisplay(opac, speed) {
  if(opac <= 0.4){
      $("#loader").attr('src', $('#light').html());      
      $("#blockUI").css({'background-color': ''});      
  } else{
    $("#blockUI").css({opacity: opac});
  }
  if ($('#blockUI') != undefined) {
    $('#blockUI').fadeIn(speed);
  }
}

function unlockDisplay(speed, message) {
  if ($('blockUI') != undefined) {
    $('#blockUI').fadeOut(speed, function() {      
      showMessage(message);
    }); 
  } else {    
      showMessage(message);
  } 
}
/*
function unlockDisplay(speed) {
  if ($('blockUI') != undefined) {
    $('#blockUI').fadeOut(speed, function() {            
    }); 
  } 
}
*/
