//This method saves the dashboard layout
function SaveDashBoardLayout(module_layout){
if (module_layout ==null || module_layout.modules ==null){  
return;
}
var modulesList="";
$.each(
		module_layout.modules, function (index, module) {
			if (modulesList == "") {
				modulesList=module.ID;
			}
			else {
				modulesList=modulesList+"|"+module.ID;
			}			
		});
	 AJAXCallForSaveLayout(modulesList);  
}

//This method invokes the command usng AJAX to save the current layout

function AJAXCallForSaveLayout(modulesList){
	$.ajax({
			type: "POST",
		url: 'SaveDashboardLayout',
			dataType: "html",
		data: "modulesList=" + modulesList,
		success: function(responseHtml, textStatus) {},
		error: function(XMLHttpRequest, textStatus, errorThrown) {}
	});
}

//This method is invoked on click of add module to dashboard link

function AJAXCallForAddModule(moduleName) {
	$.ajax({
		url: 'SaveDashboardLayout',
		data: "option=addModule& redirect=false&moduleName=" + moduleName,
		success: function(res) {},
		error: function(res) {}
	});
        }
	
//This method is getting invoked on click of thumbnail images in add more modules section.
function  submitAddModuleForm(moduleName){
	var imgName='#img_'+moduleName;
	$(imgName).hide();
	$('#moduleName').val(moduleName);
	$('#AddModuleForm').submit();
}
