TYPE_SEN		= 1;
TYPE_INV		= 2;
TYPE_STR		= 3;
TYPE_ENE		= 4;
TYPE_EXP		= 5;
TYPE_LOG		= 6;
TYPE_INP		= 7;
TYPE_COM		= 8;


function getIndex(path)
{			
	window.location.href = getRootPath(path);
}
//----------------------------------------------------------------------		
		
function getRootPath(path)
{			
	var path = location.protocol +"//" + location.hostname + path;
		
	path += (!location.port) ?
			"/" :
			":" + location.port + "/";
		
	return path;
}
//----------------------------------------------------------------------		

/******************************** 
 *  Navigation bar with calendar
 ********************************/
function loadNavigate() 
{
	$.ajax({
		type: "GET",
		url: 'include/navigate.php',
		async: false,
		success: function(html) {
			$('#include').append(html);
		}
	});
}
//----------------------------------------------------------------------		

/********************* 
 *  Graph menu
 **********************/
function loadEnergy(id, height, type) 
{
	$.ajax({
		type: "GET",
		url: "include/power.php",
		data:"id=" + id + "&type=" + type,
		async: false,						
		success: function(html){
			$('#include').append(html);
		}
	});
	
	$('#graph_power').css('height', (height - 60) + 'px');
	$('.power_area').addClass("img_" + height);
}
 //----------------------------------------------------------------------	

function loadInverters(id, inv_id) 
{
	$.ajax({
		type: "GET",
		url: "include/inverters.php",
		data:"id=" + id + "&inv_id=" + inv_id,
		async: false,						
		success: function(html){					
			$("#include").append(html);
		}
	});
}
//----------------------------------------------------------------------	

function loadSensors(id) 
{
	$.ajax({
		type: "GET",
		url: "include/sensors.php",
		data:"id=" + id,
		async: false,						
		success: function(html){					
			$("#include").append(html);
		}
	});
}
//----------------------------------------------------------------------	

function loadAudit(id) 
{
	$.ajax({
		type: "GET",
		url: "include/audits.php",
		data:"id=" + id,
		async: false,
		success: function(html){
			$('#include').append(html);
		}
	});
}
//----------------------------------------------------------------------	

function loadStrBoxTable(id) 
{
	$.ajax({
		type: "GET",
		url: "include/strbox_table.php",
		data:"id=" + id,
		async: false,
		success: function(html){
			$('#include').append(html);
		}
	});
}
//----------------------------------------------------------------------	

function loadInverterTable(id) 
{
	$.ajax({
		type: "GET",
		url: "include/inverter_table.php",
		data:"id=" + id,
		async: false,
		success: function(html){
			$('#include').append(html);
		}
	});
}
//----------------------------------------------------------------------	

/********************* 
 *  Alarm menu
 **********************/
function loadAlarms(id, type) 
{
	$.ajax({
		type: "GET",
		url: "include/alarms.php",
		data: "id=" + id + "&type=" + type,
		async: false,
		success: function(html){
			$('#include').append(html);
		}
	});
}
//----------------------------------------------------------------------	

/********************* 
 *  Export menu
 **********************/
function loadExport(id, type) 
{
	$.ajax({
		type: "GET",
		url: "include/export.php",
		data: "id=" + id + "&type=" + type,
		async: false,
		success: function(html){
			$('#include').append(html);
		}
	});
}
//----------------------------------------------------------------------	

/********************* 
 *  Info menu
 **********************/
function loadInfo(id) 
{
	$.ajax({
		type: "GET",
		url: "include/info.php",
		data:"id=" + id,
		async: false,						
		success: function(html){					
			$("#include").append(html);
		}
	});
}
//----------------------------------------------------------------------	

function loadInfoInvs(id) 
{
	$.ajax({
		type: "GET",
		url: "include/info_invs.php",
		data:"id=" + id,
		async: false,						
		success: function(html){					
			$("#include").append(html);
		}
	});
}
//----------------------------------------------------------------------	

function loadInfoSens(id) 
{
	$.ajax({
		type: "GET",
		url: "include/info_sens.php",
		data:"id=" + id,
		async: false,						
		success: function(html){					
			$("#include").append(html);
		}
	});
}
//----------------------------------------------------------------------	

function loadInfoUnits(id) 
{
	$.ajax({
		type: "GET",
		url: "include/info_units.php",
		data:"id=" + id,
		async: false,						
		success: function(html){					
			$("#include").append(html);
		}
	});
}
//----------------------------------------------------------------------	

function loadInfoStrboxes(id) 
{
	$.ajax({
		type: "GET",
		url: "include/info_strsets.php",
		data:"id=" + id,
		async: false,						
		success: function(html){					
			$("#include").append(html);
		}
	});
}
//----------------------------------------------------------------------	

/*********************
 * Invoice
 *********************/
function loadInvoice(id)
{
	$.ajax({
		type: "GET",
		url: "include/invoice/invoice.php",
		data:"id=" + id,
		async: false,						
		success: function(html){					
			$("#include").append(html);
		}
	});	
}
//--------------------------------------

/********************* 
 *  Settings menu
 **********************/
 
function loadSetInvoice(id)
{
	$.ajax({
		type: "GET",
		url: "include/invoice/set_invoice.php",
		data: "id=" + id,
		async: false,
		success: function(html){
			$('#include').append(html);	
		}
	});
}
//----------------------------------------------------------------------	

function loadSetLogin(id, idu) 
{
	$.ajax({
		type: "GET",
		url: "include/set_login.php",
		data:"id=" + id + "&idu=" + idu,
		async: false,
		success: function(html){
			$('#include').append(html);
		}
	});
}
//----------------------------------------------------------------------	

function loadSetAudit(id) 
{
	$.ajax({
		type: "GET",
		url: "include/set_audit.php",
		data: "id=" + id,
		async: false,
		success: function(html){
			$('#include').append(html);
		}
	});
}
//----------------------------------------------------------------------	

function loadSetInfo(id) 
{
	$.ajax({
		type: "GET",
		url: "include/set_overview.php",
		data: "id=" + id,
		async: false,
		success: function(html){
			$('#include').append(html);
		}
	});
}
//----------------------------------------------------------------------	

function loadSettings(id, name)
{
	$.ajax({
		type: "GET",
		url: "include/setting.php",
		async: false,
		data: "id=" + id + "&name=" + name,
		success: function(html){
			$("#include").append(html);
		}
	});	
}
//-------------------------------------------------------------------------------

function loadAdministration()	// global setup pro Administrator
{
	$.ajax({
		type: "GET",
		url: "resource/include/setup.php",
		success: function(html){
			$('#dynamic').html("");
			$('#include').append(html);
		}
	});		
}		
//----------------------------------------------------------------------		


function loadLogs(id) 
{
	$.ajax({
		type: "GET",
		url: "include/log_table.php",
		data: "id=" + id + "&type=1",
		async: false,
		success: function(html){
			$('#include').append(html);
		}
	});
}
//----------------------------------------------------------------------	


