var last_stu;
var last_stu_coms;
var last_status_infos;

function show_error(err_no, design, err_file) {

document.getElementById('thm_____header_toolbar_notif').innerHTML = '<img id="thm_____header_toolbar_notifications" src="img/'+design+'/img/thm_header-toolbar-icon-alert.png" alt="" />';
document.getElementById('thm_____header_toolbar_notif').style.margin = '0';
document.getElementById('thm_____header_toolbar_notif').style.padding = '0';
document.getElementById('thm_____header_toolbar_notif').style.border = '0';
document.getElementById('thm_____header_toolbar_notif').style.background = 'transparent';
document.getElementById('thm_____header_toolbar_notif').style.display = 'inline';
document.getElementById('thm_____header_toolbar_friends').src = 'img/'+design+'/img/thm_header-toolbar-icon-alert.png';

document.getElementById('thm_____erreurs_ajax').style.display = 'block';

document.getElementById('thm_____erreurs_ajax_errno').innerHTML = 'Erreur #'+err_no;
document.getElementById('thm_____erreurs_ajax_errfile').innerHTML = err_file;

document.getElementById('thm_____erreurs_ajax_text').innerHTML = '<br /> <img src="img/'+design+'/img/thm_icon-loading.gif" style="vertical-align:middle" alt="" /> Chargement...';

if(err_no != 1000) {

var xhr; document.getElementById('thm_____header_loading').style.display = 'block';
if (window.XMLHttpRequest) xhr = new XMLHttpRequest();
else if (window.ActiveXObject) xhr = new ActiveXObject('Microsoft.XMLHTTP');
else
{
return;
}
xhr.open('POST','lib/js/ajax.php',true); 
xhr.onreadystatechange = function() 
{
if (xhr.readyState == 4)
{
if(xhr.responseText == '') show_error(1000, design, 'lib/js/ajax.php');
else if(xhr.responseText.match('{ERR_')) { show_error(xhr.responseText.replace('{ERR_', '').replace('}', ''), design, 'lib/js/ajax.php'); }
else { document.getElementById('thm_____header_loading').style.display = 'none'; 

document.getElementById('thm_____erreurs_ajax_text').innerHTML = xhr.responseText;

}

document.body.style.cursor = 'default';
}
}
xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded'); 
var data = 'action=show_error&design='+design+'&err_no='+err_no+'&err_file='+err_file;
xhr.send(data); 

}
else {

document.getElementById('thm_____erreurs_ajax_text').innerHTML = '<br />Impossible d\'accéder au fichier, vérifiez votre connexion internet.';

}

}

function like(stu_id, stu_like, stu_who_like, design, there_is_two)
{


var xhr; document.getElementById('thm_____header_loading').style.display = 'block';
if (window.XMLHttpRequest) xhr = new XMLHttpRequest();
else if (window.ActiveXObject) xhr = new ActiveXObject('Microsoft.XMLHTTP');
else
{
return;
}
xhr.open('POST','lib/js/ajax.php',true); 
xhr.onreadystatechange = function() 
{
if (xhr.readyState == 4)
{
if(xhr.responseText == '') show_error(1000, design, 'lib/js/ajax.php');
else if(xhr.responseText.match('{ERR_')) { show_error(xhr.responseText.replace('{ERR_', '').replace('}', ''), design, 'lib/js/ajax.php'); }
else { document.getElementById('thm_____header_loading').style.display = 'none'; 

document.getElementById('stuLike'+stu_id).innerHTML = xhr.responseText;
if(there_is_two) document.getElementById('stu2Like'+stu_id).innerHTML = xhr.responseText;

}

document.body.style.cursor = 'default';
}
}
xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded'); 
var data = 'action=like&design='+design+'&stu_id='+stu_id+'&stu_like='+stu_like+'&stu_who_like='+stu_who_like;
xhr.send(data); 
}
function dontLike(stu_id, stu_like, stu_who_like, design, there_is_two)
{


var xhr; document.getElementById('thm_____header_loading').style.display = 'block';
if (window.XMLHttpRequest) xhr = new XMLHttpRequest();
else if (window.ActiveXObject) xhr = new ActiveXObject('Microsoft.XMLHTTP');
else
{
return;
}
xhr.open('POST','lib/js/ajax.php',true); 
xhr.onreadystatechange = function() 
{
if (xhr.readyState == 4)
{
if(xhr.responseText == '') show_error(1000, design, 'lib/js/ajax.php');
else if(xhr.responseText.match('{ERR_')) { show_error(xhr.responseText.replace('{ERR_', '').replace('}', ''), design, 'lib/js/ajax.php'); }
else { document.getElementById('thm_____header_loading').style.display = 'none'; 

document.getElementById('stuLike'+stu_id).innerHTML = xhr.responseText;
if(there_is_two) document.getElementById('stu2Like'+stu_id).innerHTML = xhr.responseText;

}

document.body.style.cursor = 'default';

}
}
xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded');
var data = 'action=dontLike&design='+design+'&stu_id='+stu_id+'&stu_like='+stu_like+'&stu_who_like='+stu_who_like;
xhr.send(data); 
}
function changeStu(usr_id, design, usr_showname, usr_avatar)
{


last_stu = document.getElementById('myStu').innerHTML;
last_stu_coms = document.getElementById('myStuComs').innerHTML;
last_status_infos = document.getElementById('myLastStatusInfos').innerHTML;

var xhr; document.getElementById('thm_____header_loading').style.display = 'block';
if (window.XMLHttpRequest) xhr = new XMLHttpRequest();
else if (window.ActiveXObject) xhr = new ActiveXObject('Microsoft.XMLHTTP');
else
{
return;
}
xhr.open('POST','lib/js/ajax.php',true); 
xhr.onreadystatechange = function() 
{
if (xhr.readyState == 4)
{

if(xhr.responseText == '') show_error(1000, design, 'lib/js/ajax.php');
else if(xhr.responseText.match('{ERR_')) { show_error(xhr.responseText.replace('{ERR_', '').replace('}', ''), design, 'lib/js/ajax.php'); }
else { document.getElementById('thm_____header_loading').style.display = 'none'; 

document.getElementById('myBox').id = 'myBox_ajax';
document.getElementById('myStu').innerHTML = xhr.responseText;

document.getElementById('myLastStatusInfos').innerHTML = 'Joindre : <a href="#join_link" onclick="join_link();"><img src="img/'+design+'/img/status_icon_join_link.png" alt="" style="vertical-align:middle;" /> un lien</a>&nbsp;&nbsp;<a href="#join_picture" onclick="join_picture();"><img src="img/'+design+'/img/status_icon_join_picture.png" alt="" style="vertical-align:middle;" /> une image</a>';

document.getElementById('myStuComs').innerHTML = '<a href="./" onclick="cancel_changeStu('+design+');return (false);"><img src="img/'+design+'/img/status_icon_cancel_change.png" style="height:38px;width:38px;" alt="" /></a>';
document.getElementById('myStuComs').style.margin = '-10px 0 0';
document.getElementById('myStuComs').style.background = 'none';

}

document.body.style.cursor = 'default';
}
}
xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded'); 
var data = 'action=changeStu&design='+design+'&usr_id='+usr_id+'&usr_showname='+usr_showname+'&usr_avatar='+usr_avatar;
xhr.send(data); 
}
function cancel_changeStu(design)
{


document.getElementById('myStu').innerHTML = last_stu;
document.getElementById('myLastStatusInfos').innerHTML = last_status_infos;

document.getElementById('myStuComs').style.margin = '0 0 0';
document.getElementById('myStuComs').innerHTML = last_stu_coms;
document.getElementById('myStuComs').style.background = 'url(img/'+design+'/img/status_icon_comments.png)';

document.getElementById('myBox_ajax').id = 'myBox';
document.body.style.cursor = 'default';

}
function sendStu(usr_id, design, usr_showname, usr_avatar, add)
{

document.body.style.cursor = 'wait';	
if(!add) add = '';
var stu_text = add+' '+document.getElementById('form_stu').value;

var xhr; document.getElementById('thm_____header_loading').style.display = 'block';
if (window.XMLHttpRequest) xhr = new XMLHttpRequest();
else if (window.ActiveXObject) xhr = new ActiveXObject('Microsoft.XMLHTTP');
else
{
return;
}
xhr.open('POST','lib/js/ajax.php',true); 
xhr.onreadystatechange = function() 
{
if (xhr.readyState == 4)
{
if(xhr.responseText == '') show_error(1000, design, 'lib/js/ajax.php');
else if(xhr.responseText.match('{ERR_')) { show_error(xhr.responseText.replace('{ERR_', '').replace('}', ''), design, 'lib/js/ajax.php'); }
else { document.getElementById('thm_____header_loading').style.display = 'none'; 

dynamicStatus(usr_id, design, usr_avatar);

}

document.body.style.cursor = 'default';

}
}
xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded'); 
var data = 'action=sendStu&design='+design+'&usr_id='+usr_id+'&usr_showname='+usr_showname+'&usr_avatar='+usr_avatar+'&stu_text='+stu_text;
xhr.send(data); 
}
function load_average()
{
document.getElementById('thm_____header_loading').style.display = 'block';
document.getElementById('load_average').src = 'lib/php/graph.load_average.php?random='+Math.floor((99999999)*Math.random());
document.getElementById('thm_____header_loading').style.display = 'none'; 			
}
function online_average()
{
document.getElementById('thm_____header_loading').style.display = 'block';
document.getElementById('online_average').src = 'lib/php/graph.online_average.php?random='+Math.floor((99999999)*Math.random());
document.getElementById('thm_____header_loading').style.display = 'none'; 			
}
function querys_average()
{
document.getElementById('thm_____header_loading').style.display = 'block';
document.getElementById('querys_average').src = 'lib/php/graph.querys_average.php?random='+Math.floor((99999999)*Math.random());
document.getElementById('thm_____header_loading').style.display = 'none'; 			
}
function querys_total()
{
document.getElementById('thm_____header_loading').style.display = 'block';
document.getElementById('querys_total').src = 'lib/php/graph.querys_total.php?random='+Math.floor((99999999)*Math.random());
document.getElementById('thm_____header_loading').style.display = 'none'; 			
}
function sql_time()
{
document.getElementById('thm_____header_loading').style.display = 'block';
document.getElementById('sql_time').src = 'lib/php/graph.sql_time_average.php?random='+Math.floor((99999999)*Math.random());
document.getElementById('thm_____header_loading').style.display = 'none'; 			
}
function ping()
{
document.getElementById('thm_____header_loading').style.display = 'block';
document.getElementById('ping').src = 'lib/php/graph.ping.php?random='+Math.floor((99999999)*Math.random());
document.getElementById('thm_____header_loading').style.display = 'none'; 			
}
function load_average_details(lang, design)
{

var xhr; document.getElementById('thm_____header_loading').style.display = 'block';
if (window.XMLHttpRequest) xhr = new XMLHttpRequest();
else if (window.ActiveXObject) xhr = new ActiveXObject('Microsoft.XMLHTTP');
else
{
return;
}
xhr.open('POST','lib/js/ajax.php',true); 
xhr.onreadystatechange = function() 
{
if (xhr.readyState == 4)
{

if(xhr.responseText == '') show_error(1000, design, 'lib/js/ajax.php');
else if(xhr.responseText.match('{ERR_')) { show_error(xhr.responseText.replace('{ERR_', '').replace('}', ''), design, 'lib/js/ajax.php'); }
else { document.getElementById('thm_____header_loading').style.display = 'none'; 

document.getElementById('details').innerHTML = xhr.responseText;
document.getElementById('graph').src = 'lib/php/graph.load_average.max.php?random='+Math.floor((99999999)*Math.random());

}

}
}

xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded'); 
var data = 'action=load_average_details&lang='+lang+'&design='+design;
xhr.send(data); 

}
function showComments(stu_id, design, usr_avatar)
{

alert('Error has occured in /lib/js/ajax.js : 0x03544687964');
/*var last_corps = document.getElementById('thm_____corps_text').innerHTML;
var xhr; document.getElementById('thm_____header_loading').style.display = 'block';
if (window.XMLHttpRequest) xhr = new XMLHttpRequest();
else if (window.ActiveXObject) xhr = new ActiveXObject('Microsoft.XMLHTTP');
else
{
return;
}
xhr.open('POST','lib/js/ajax.php',true); 
xhr.onreadystatechange = function() 
{
if (xhr.readyState == 4)
{

if(xhr.responseText == '') show_error(1000, design, 'lib/js/ajax.php');
else if(xhr.responseText.match('{ERR_')) { show_error(xhr.responseText.replace('{ERR_', '').replace('}', ''), design, 'lib/js/ajax.php'); }
else { document.getElementById('thm_____header_loading').style.display = 'none'; 

document.getElementById('thm_____corps_text').innerHTML = xhr.responseText;

}

document.body.style.cursor = 'default';

}
}
xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded'); 
var data = 'action=showComments&design='+design+'&last_corps='+last_corps+'&stu_id='+stu_id+'&usr_avatar='+usr_avatar;
xhr.send(data); */
}
function dynamicStatus(usr_id, design, usr_avatar)
{

var xhr; document.getElementById('thm_____header_loading').style.display = 'block';
if (window.XMLHttpRequest) xhr = new XMLHttpRequest();
else if (window.ActiveXObject) xhr = new ActiveXObject('Microsoft.XMLHTTP');
else
{
return;
}
xhr.open('POST','lib/js/ajax.php',true); 
xhr.onreadystatechange = function() 
{
if (xhr.readyState == 4)
{

if(xhr.responseText == '') show_error(1000, design, 'lib/js/ajax.php');
else if(xhr.responseText.match('{ERR_')) { show_error(xhr.responseText.replace('{ERR_', '').replace('}', ''), design, 'lib/js/ajax.php'); }
else { document.getElementById('thm_____header_loading').style.display = 'none'; 

	if(document.getElementById('statusBox').innerHTML = xhr.responseText) { }
	else { location.refresh(true); }

}
}
}
xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded'); 
var data = 'action=dynamicStatus&design='+design+'&usr_id='+usr_id+'&usr_avatar='+usr_avatar;
xhr.send(data); 
}
function dynamicMyStatus(usr_id, design)
{

var xhr; document.getElementById('thm_____header_loading').style.display = 'block';
if (window.XMLHttpRequest) xhr = new XMLHttpRequest();
else if (window.ActiveXObject) xhr = new ActiveXObject('Microsoft.XMLHTTP');
else
{
return;
}
xhr.open('POST','lib/js/ajax.php',true); 
xhr.onreadystatechange = function() 
{
if (xhr.readyState == 4)
{

if(xhr.responseText == '') show_error(1000, design, 'lib/js/ajax.php');
else if(xhr.responseText.match('{ERR_')) { show_error(xhr.responseText.replace('{ERR_', '').replace('}', ''), design, 'lib/js/ajax.php'); }
else { document.getElementById('thm_____header_loading').style.display = 'none'; 

document.getElementById('myBox').innerHTML = xhr.responseText;

}

}
}
xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded'); 
var data = 'action=dynamicMyStatus&design='+design+'&usr_id='+usr_id;
xhr.send(data); 
}
function sendCom(stu_id, stu_coms, design, usr_avatar)
{

var xhr; document.getElementById('thm_____header_loading').style.display = 'block';
var com_text = document.getElementById('form_stu').value;

if (window.XMLHttpRequest) xhr = new XMLHttpRequest();
else if (window.ActiveXObject) xhr = new ActiveXObject('Microsoft.XMLHTTP');
else
{
return;
}
xhr.open('POST','lib/js/ajax.php',true); 
xhr.onreadystatechange = function() 
{
if (xhr.readyState == 4)
{

if(xhr.responseText == '') show_error(1000, design, 'lib/js/ajax.php');
else if(xhr.responseText.match('{ERR_')) { show_error(xhr.responseText.replace('{ERR_', '').replace('}', ''), design, 'lib/js/ajax.php'); }
else { document.getElementById('thm_____header_loading').style.display = 'none'; 

location.reload(true);


}

}
}
xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded'); 
var data = 'action=sendCom&design='+design+'&stu_id='+stu_id+'&stu_coms='+stu_coms+'&com_text='+com_text;
xhr.send(data); 
}
function deleteCom(stu_id, com_id, stu_coms, design, usr_avatar)
{

var xhr; document.getElementById('thm_____header_loading').style.display = 'block';

if (window.XMLHttpRequest) xhr = new XMLHttpRequest();
else if (window.ActiveXObject) xhr = new ActiveXObject('Microsoft.XMLHTTP');
else
{
return;
}
xhr.open('POST','lib/js/ajax.php',true); 
xhr.onreadystatechange = function() 
{
if (xhr.readyState == 4)
{

if(xhr.responseText == '') show_error(1000, design, 'lib/js/ajax.php');
else if(xhr.responseText.match('{ERR_')) { show_error(xhr.responseText.replace('{ERR_', '').replace('}', ''), design, 'lib/js/ajax.php'); }
else { document.getElementById('thm_____header_loading').style.display = 'none'; 

showComments(stu_id, design, usr_avatar);


}

}
}
xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded'); 
var data = 'action=deleteCom&design='+design+'&stu_id='+stu_id+'&com_id='+com_id+'&stu_coms='+stu_coms;
xhr.send(data); 
}
function mailbox(usr_id, design)
{

var xhr; document.getElementById('thm_____header_loading').style.display = 'block';

if (window.XMLHttpRequest) xhr = new XMLHttpRequest();
else if (window.ActiveXObject) xhr = new ActiveXObject('Microsoft.XMLHTTP');
else
{
return;
}
xhr.open('POST','lib/js/ajax.php',true); 
xhr.onreadystatechange = function() 
{
if (xhr.readyState == 4)
{

if(xhr.responseText == '') show_error(1000, design, 'lib/js/ajax.php');
else if(xhr.responseText.match('{ERR_')) { show_error(xhr.responseText.replace('{ERR_', '').replace('}', ''), design, 'lib/js/ajax.php'); }
else { document.getElementById('thm_____header_loading').style.display = 'none'; 

if(xhr.responseText != '0') document.getElementById('mailbox_nb').innerHTML = ' <strong>('+xhr.responseText+')</strong>';

}

}
}
xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded'); 
var data = 'action=mailbox&design='+design+'&usr_id='+usr_id;
xhr.send(data); 
}
function add_friend(usr_id, friend_id, design)
{

var xhr; document.getElementById('thm_____header_loading').style.display = 'block';

if (window.XMLHttpRequest) xhr = new XMLHttpRequest();
else if (window.ActiveXObject) xhr = new ActiveXObject('Microsoft.XMLHTTP');
else
{
return;
}
xhr.open('POST','lib/js/ajax.php',true); 
xhr.onreadystatechange = function() 
{
if (xhr.readyState == 4)
{

if(xhr.responseText == '') show_error(1000, design, 'lib/js/ajax.php');
else if(xhr.responseText.match('{ERR_')) { show_error(xhr.responseText.replace('{ERR_', '').replace('}', ''), design, 'lib/js/ajax.php'); }
else { document.getElementById('thm_____header_loading').style.display = 'none'; 

document.getElementById('add_friend').innerHTML = xhr.responseText;
document.getElementById('add_friend').onclick = '';
document.getElementById('add_friend').href = '';

}

}
}
xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded'); 
var data = 'action=add_friend&design='+design+'&usr_id='+usr_id+'&friend_id='+friend_id;
xhr.send(data); 
}
function del_friend(usr_id, friend_id, design)
{

var xhr; document.getElementById('thm_____header_loading').style.display = 'block';

if (window.XMLHttpRequest) xhr = new XMLHttpRequest();
else if (window.ActiveXObject) xhr = new ActiveXObject('Microsoft.XMLHTTP');
else
{
return;
}
xhr.open('POST','lib/js/ajax.php',true); 
xhr.onreadystatechange = function() 
{
if (xhr.readyState == 4)
{

if(xhr.responseText == '') show_error(1000, design, 'lib/js/ajax.php');
else if(xhr.responseText.match('{ERR_')) { show_error(xhr.responseText.replace('{ERR_', '').replace('}', ''), design, 'lib/js/ajax.php'); }
else { document.getElementById('thm_____header_loading').style.display = 'none'; 

document.getElementById('del_friend').innerHTML = xhr.responseText;
document.getElementById('del_friend').onclick = '';
document.getElementById('del_friend').href = '';

}

}
}
xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded'); 
var data = 'action=del_friend&design='+design+'&usr_id='+usr_id+'&friend_id='+friend_id;
xhr.send(data); 
}
function confirm_friend(usr_id, friend_id, design)
{

var xhr; document.getElementById('thm_____header_loading').style.display = 'block';

if (window.XMLHttpRequest) xhr = new XMLHttpRequest();
else if (window.ActiveXObject) xhr = new ActiveXObject('Microsoft.XMLHTTP');
else
{
return;
}
xhr.open('POST','lib/js/ajax.php',true); 
xhr.onreadystatechange = function() 
{
if (xhr.readyState == 4)
{

if(xhr.responseText == '') show_error(1000, design, 'lib/js/ajax.php');
else if(xhr.responseText.match('{ERR_')) { show_error(xhr.responseText.replace('{ERR_', '').replace('}', ''), design, 'lib/js/ajax.php'); }
else { document.getElementById('thm_____header_loading').style.display = 'none'; 

document.getElementById('confirm_friend').innerHTML = xhr.responseText;
document.getElementById('confirm_friend').onclick = '';
document.getElementById('confirm_friend').href = '';

document.getElementById('refuser_friend').style.display = 'none';
document.getElementById('sidebar_profil_icon_del_friend').style.display = 'none';


}

}
}
xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded'); 
var data = 'action=confirm_friend&design='+design+'&usr_id='+usr_id+'&friend_id='+friend_id;
xhr.send(data); 
}
function refuser_friend(usr_id, friend_id, design)
{

var xhr; document.getElementById('thm_____header_loading').style.display = 'block';

if (window.XMLHttpRequest) xhr = new XMLHttpRequest();
else if (window.ActiveXObject) xhr = new ActiveXObject('Microsoft.XMLHTTP');
else
{
return;
}
xhr.open('POST','lib/js/ajax.php',true); 
xhr.onreadystatechange = function() 
{
if (xhr.readyState == 4)
{

if(xhr.responseText == '') show_error(1000, design, 'lib/js/ajax.php');
else if(xhr.responseText.match('{ERR_')) { show_error(xhr.responseText.replace('{ERR_', '').replace('}', ''), design, 'lib/js/ajax.php'); }
else { document.getElementById('thm_____header_loading').style.display = 'none'; 

document.getElementById('refuser_friend').innerHTML = xhr.responseText;
document.getElementById('refuser_friend').onclick = '';
document.getElementById('refuser_friend').href = '';

document.getElementById('confirm_friend').style.display = 'none';
document.getElementById('sidebar_profil_icon_add_friend').style.display = 'none';

}

}
}
xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded'); 
var data = 'action=refuser_friend&design='+design+'&usr_id='+usr_id+'&friend_id='+friend_id;
xhr.send(data); 
}
function online(design, load_start)
{

var xhr; document.getElementById('thm_____header_loading').style.display = 'block';

if (window.XMLHttpRequest) xhr = new XMLHttpRequest();
else if (window.ActiveXObject) xhr = new ActiveXObject('Microsoft.XMLHTTP');
else
{
return;
}
xhr.open('POST','lib/js/ajax.php',true); 
xhr.onreadystatechange = function() 
{
if (xhr.readyState == 4)
{

if(xhr.responseText == '') show_error(1000, design, 'lib/js/ajax.php');
else if(xhr.responseText.match('{ERR_')) { show_error(xhr.responseText.replace('{ERR_', '').replace('}', ''), design, 'lib/js/ajax.php'); }
else { document.getElementById('thm_____header_loading').style.display = 'none'; 

document.getElementById('thm_____footer_connectes').innerHTML = xhr.responseText;

}

}
}
xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded'); 
var data = 'action=online&design='+design+'&load_start='+load_start;
xhr.send(data); 
}
function show_notifications(usr_id, design)
{

if(document.getElementById('thm_____header_toolbar_notif_box').style.visibility != 'visible') {

var xhr; document.getElementById('thm_____header_loading').style.display = 'block';

if (window.XMLHttpRequest) xhr = new XMLHttpRequest();
else if (window.ActiveXObject) xhr = new ActiveXObject('Microsoft.XMLHTTP');
else
{
return;
}
xhr.open('POST','lib/js/ajax.php',true); 
xhr.onreadystatechange = function() 
{
if (xhr.readyState == 4)
{

if(xhr.responseText == '') show_error(1000, design, 'lib/js/ajax.php');
else if(xhr.responseText.match('{ERR_')) { show_error(xhr.responseText.replace('{ERR_', '').replace('}', ''), design, 'lib/js/ajax.php'); }
else { document.getElementById('thm_____header_loading').style.display = 'none'; 

document.getElementById('thm_____header_toolbar_notif_box').innerHTML = xhr.responseText;
document.getElementById('thm_____header_toolbar_notif_box').style.visibility = 'visible';
document.getElementById('thm_____header_toolbar_notif').style.background = "#0497d4";
document.getElementById('thm_____header_toolbar_notif').innerHTML = 0;

}

}
}
xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded'); 
var data = 'action=show_notifications&usr_id='+usr_id+'&design='+design;
xhr.send(data); 

} else {

document.getElementById('thm_____header_toolbar_notif_box').style.visibility = 'hidden';

}
}
function maj_nb_notifs(usr_id, design) {

var xhr; document.getElementById('thm_____header_loading').style.display = 'block';

if (window.XMLHttpRequest) xhr = new XMLHttpRequest();
else if (window.ActiveXObject) xhr = new ActiveXObject('Microsoft.XMLHTTP');
else
{
return;
}
xhr.open('POST','lib/js/ajax.php',true); 
xhr.onreadystatechange = function() 
{
if (xhr.readyState == 4)
{

if(xhr.responseText == '') show_error(1000, design, 'lib/js/ajax.php');
else if(xhr.responseText.match('{ERR_')) { show_error(xhr.responseText.replace('{ERR_', '').replace('}', ''), design, 'lib/js/ajax.php'); }
else { document.getElementById('thm_____header_loading').style.display = 'none'; 

if(xhr.responseText > 0) document.getElementById('thm_____header_toolbar_notif').style.background = "#FD0000";
else document.getElementById('thm_____header_toolbar_notif').style.background = '#0497d4';

document.getElementById('thm_____header_toolbar_notif').style.margin = '1.5px 1.5px 0px 3px';
document.getElementById('thm_____header_toolbar_notif').style.padding = '0';
document.getElementById('thm_____header_toolbar_notif').style.border = '1px solid #fff';
document.getElementById('thm_____header_toolbar_notif').style.display = 'block';

document.getElementById('thm_____header_toolbar_notif').innerHTML = xhr.responseText;

}

}
}
xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded'); 
var data = 'action=maj_nb_notifs&usr_id='+usr_id+'&design='+design;
xhr.send(data); 

}
function edit_page(usr_id, page, usr_droits, design) {

var xhr; document.getElementById('thm_____header_loading').style.display = 'block';

if (window.XMLHttpRequest) xhr = new XMLHttpRequest();
else if (window.ActiveXObject) xhr = new ActiveXObject('Microsoft.XMLHTTP');
else
{
return;
}
xhr.open('POST','lib/js/ajax.php',true); 
xhr.onreadystatechange = function() 
{
if (xhr.readyState == 4)
{

if(xhr.responseText == '') show_error(1000, design, 'lib/js/ajax.php');
else if(xhr.responseText.match('{ERR_')) { show_error(xhr.responseText.replace('{ERR_', '').replace('}', ''), design, 'lib/js/ajax.php'); }
else { document.getElementById('thm_____header_loading').style.display = 'none'; 

document.getElementById('thm_____corps_text').innerHTML = xhr.responseText;

}

}
}
xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded'); 
var data = 'action=edit_page&usr_id='+usr_id+'&page='+page+'&usr_droits='+usr_droits+'&design='+design;
xhr.send(data); 

}