var IE = false, IE6 = false, IE7 = false,
FIREFOX = false, FIREFOX1 = false, FIREFOX2 = false,
NETSCAPE7 = false, NETSCAPE = false,
OPERA9 = false, OPERA = false,
AUTRE = false;
var strChUserAgent = navigator.userAgent;
var intSplitStart = strChUserAgent.indexOf("(",0);
var intSplitEnd = strChUserAgent.indexOf(")",0);
var strChStart = strChUserAgent.substring(0,intSplitStart);
var strChMid = strChUserAgent.substring(intSplitStart, intSplitEnd);
var strChEnd = strChUserAgent.substring(strChEnd);
if(strChMid.indexOf("MSIE") != -1)
IE = true;
if(strChMid.indexOf("MSIE 7") != -1)
IE7 = true;
else if(strChMid.indexOf("MSIE 6") != -1)
IE6 = true;
else if(strChEnd.indexOf("Firefox/2") != -1)
{ FIREFOX2 = true; FIREFOX = true; }
else if(strChEnd.indexOf("Firefox") != -1)
{ FIREFOX1 = true; FIREFOX = true; }
else if(strChEnd.indexOf("Netscape") != -1)
NETSCAPE = true;
else if(strChStart.indexOf("Opera") != -1)
OPERA = true;
else
AUTRE = true;
var reg = new RegExp('^http://([_a-zA-Z0-9]+)\.easyblogs\.([_a-zA-Z]+)(/.*)$', 'g'); //\.easyblogs\.([a-z]+)/
var blog_url = location.href;
blog_url = blog_url.replace(reg, 'http://$1.easyblogs.$2');
//alert('URL: ' + blog_url + "\r\n");
function LaunchAjaxNav()
{
setInterval(CheckHash, 200);
}
function AjaxUpdateLink()
{
//var content = document.getElementById('top').innerHTML;
//var reg = new RegExp(' href="([^"]+)"', 'g');
//content = content.replace(reg, ' href="#1" OnClick="ajax_loading(\'$1\');"');
//document.getElementById('top').innerHTML = content;
var body = document.getElementById('top');
var link_list = document.getElementsByTagName('a');
var msg = '';
msg += link_list.length;
for(var i = 0; i < link_list.length; i++){
if (link_list[i].target != '_blank' && link_list[i].target != '_top' &&
(link_list[i].href.substring(0, 7) != 'http://' || link_list[i].href.substring(0, blog_url.length) == blog_url) &&
link_list[i].href.substring(0, 11).toLowerCase() != 'javascript:')
{
if (IE) {
link_list[i].onclick = function () {
top.location = blog_url + '/#/' + this.href.substring(blog_url.length + 8);
//alert(top.location);
};
if (link_list[i].href.substring(blog_url.length, blog_url.length + 8) != '/silent-')
link_list[i].href= blog_url + '/silent-' + link_list[i].href.substring(blog_url.length + 1);
link_list[i].target = 'nav_frame';
}
else
{
if (link_list[i].href.substring(blog_url.length, blog_url.length + 3) != '/#/')
link_list[i].href = blog_url + '/#/' + link_list[i].href.substring(blog_url.length + 1);
link_list[i].target = '';
}
}
}
}
var old_hash;
if (IE) old_hash = 'about:blank';
else old_hash = location.hash;
//alert(old_hash);
function CheckHash()
{
if (IE) {
if (document.getElementById('nav_frame').contentWindow.document.location.href != old_hash) {
old_hash = document.getElementById('nav_frame').contentWindow.document.location.href;
//alert(old_hash);
document.getElementById('content_cell').innerHTML = 'Chargement...';
var res = httprequest(blog_url + '/ajax-' + old_hash.substring(blog_url.length + 8));
document.getElementById('content_cell').innerHTML = res;
top.location = blog_url + '/#/' + old_hash.substring(blog_url.length + 8);
AjaxUpdateLink();
}
//setInterval(CheckHash, 200);
}
else {
if (location.hash != old_hash) {
//alert('hash change');
old_hash = location.hash;
document.getElementById('content_cell').innerHTML = 'Chargement...';
var res = httprequest(blog_url + '/ajax-' + location.hash.substring(2));
document.getElementById('content_cell').innerHTML = res;
//document.getElementById('content_cell').innerHTML = blog_url + '/ajax-' + location.hash.substring(2);
AjaxUpdateLink();
}
}
}
function isNumeric(Data)
{
numChars = '.0123456789';
var isNum = true;
var index = 0;
while ((index < Data.length) && (isNum)) {
isNum = (numChars.indexOf(Data.charAt(index)) != -1);
index ++;
}
return isNum;
}
moduleopenimg = new Image();
moduleopenimg.src = "common/images/open.gif";
news_open = new Image();
news_open.src = "common/images/arbo_open.gif";
arbo_close = new Image();
arbo_close.src = "common/images/arbo_close.gif";
msg_infos = new Image();
msg_infos.src = "common/images/infos.jpg";
msg_notice = new Image();
msg_notice.src = "common/images/notice.png";
msg_error = new Image();
msg_error.src = "common/images/error.jpg";
function logon(login, passwd) {
var result, text;
result = httprequest_GET('../common/httprequest/logon.php?log=' + login + '&pass=' + passwd, '', 'loginform_msg', '
', false);
text = '';
if (result == 'Ok') {
text += ' | Bienvenue ' + login + ', Vous allez être redirigé vers la page de votre choix dans quelques secondes.';
var refresh_logon_timeoutID = window.setTimeout('window.refresh_logon()', 3000);
}
else text += ' | ' + result;
text += ' |
';
document.getElementById('loginform_msg').innerHTML = text;
}
function refresh_logon() {
top.location=top.location;
}
function confirmSubmit(message) {
var agree=confirm(message);
if (agree) return true ;
else return false ;
}
function aff_msg(msg, type) {
var html = '';
html += '';
if (type == 1) html += ' ';
else if (type == 2) html += ' ';
else if (type == 3) html += ' ';
html += ' | ' + msg + ' |
';
return html;
}
function popup(page,popupname,height,width) {
var topPosition = (screen.height - height) / 2;
var leftPosition = (screen.width - width) / 2;
var windowprops = "width=" + width + ",height=" + height + ",top=" + topPosition + ",left=" + leftPosition + ",location=no,menubar=no,toolbar=no,scrollbars=yes,resizable=no,status=no";
newWindow = window.open(page,popupname,windowprops);
}
var internal_popup_open = false;
var internal_popup_x_scroll = 0;
var internal_popup_y_scroll = 0;
function OpenInternalPopup(url, name, width, height)
{
var screen_filter = document.getElementById('screen_filter');
var screen_popup = document.getElementById('screen_popup');
var popup_window = document.getElementById('popup_window');
res = httprequest_GET(url, '', '', '', '');
popup_window.innerHTML = res;
if (internal_popup_open == false)
{
window.onscroll=LockScrollbars;
//popup_window.style.height = height;
popup_window.style.width = width;
if (document.all) internal_popup_y_scroll = document.body.scrollTop;
else internal_popup_y_scroll = window.pageYOffset;
screen_filter.style.top = internal_popup_y_scroll;
screen_popup.style.top = internal_popup_y_scroll;
if (document.all) internal_popup_x_scroll = document.body.scrollLeft;
else internal_popup_x_scroll = window.pageXOffset;
screen_filter.style.left = internal_popup_x_scroll;
screen_popup.style.left = internal_popup_x_scroll;
screen_filter.style.display = 'block';
screen_popup.style.display = 'block';
internal_popup_open=true;
}
//alert(url);
}
function CloseInternalPopup()
{
var screen_filter = document.getElementById('screen_filter');
var screen_popup = document.getElementById('screen_popup');
window.onscroll='';
screen_filter.style.display = 'none';
screen_popup.style.display = 'none';
internal_popup_open=false;
}
function LockScrollbars()
{
window.scroll(internal_popup_x_scroll,internal_popup_y_scroll);
return false;
}
function GetXhrObject()
{
if(window.XMLHttpRequest) xhr_object = new XMLHttpRequest(); // Firefox
else if(window.ActiveXObject) xhr_object = new ActiveXObject('Microsoft.XMLHTTP'); // Internet Explorer
else { // XMLHttpRequest non supporté par le navigateur
alert('Votre navigateur ne supporte pas les objets XMLHTTPRequest...');
return;
}
return xhr_object;
}
function httprequest(url)
{
xhr_object = GetXhrObject();
xhr_object.open('GET', url, false);
//xhr_object.setRequestHeader('Content-type', 'application/x-www-form-urlencoded; charset=iso-8859-1');
xhr_object.send(null);
if(xhr_object.readyState == 4) return xhr_object.responseText;
else return false;
}
function httprequest_p(url, param)
{
xhr_object = GetXhrObject();
xhr_object.open('POST', url, false);
//xhr_object.setRequestHeader('Content-type', 'application/x-www-form-urlencoded; charset=iso-8859-1');
xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhr_object.send(param);
if(xhr_object.readyState == 4) return unescape(xhr_object.responseText);
else return false;
}
function httprequest_POST(url, param, div, div_text, text) {
xhr_object = GetXhrObject();
if (div_text != '') document.getElementById(div_text).innerHTML = text;
xhr_object.open('POST', url, true);
xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhr_object.send(param);
xhr_object.onreadystatechange = function() {
if(xhr_object.readyState == 4) {
document.getElementById(div).innerHTML = xhr_object.responseText;
httprequest_POST_valid();
}
}
}
function httprequest_GET(url, div, div_text, text, valid_fct)
{
if (div_text != '') document.getElementById(div_text).innerHTML = text;
xhr_object = GetXhrObject();
xhr_object.open('GET', url, false);
xhr_object.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
xhr_object.send(null);
if(xhr_object.readyState == 4) {
if (div != '') document.getElementById(div).innerHTML = xhr_object.responseText;
if (valid_fct == true) httprequest_GET_valid();
return xhr_object.responseText;
}
else return false;
}
function ShowNote(blog_id, note)
{
for(i=0; i<5; i++)
{
if (i + 1 == note) document.getElementById(blog_id + '_' + i).src = 'common/images/note_hi.png';
else if (i < note) document.getElementById(blog_id + '_' + i).src = 'common/images/note_on.png';
else document.getElementById(blog_id + '_' + i).src = 'common/images/note_off.png';
}
}
function ResetNote(blog_id, note)
{
for(i=0; i<5; i++)
{
if (i < note) document.getElementById(blog_id + '_' + i).src = 'common/images/note_on.png';
else document.getElementById(blog_id + '_' + i).src = 'common/images/note_off.png';
}
}
function SetNote(blog_id, note)
{
res = httprequest('request.php?httprequest=note&blog_id=' + blog_id + '¬e=' + note);
alert(res);
}