var siteversion = '2.0.1';
var reload = '0';
var sendReq = getXmlHttpRequestObject();
var receiveReq = getXmlHttpRequestObject();
var addnew = 1;
var journalcomment = '0';
var uploadpicsactive = '0';
var deletemode = '0';
var scrOfX = 0, scrOfY = 0;
var createpage = '0';
var myWidth = 0, myHeight = 0;
var imagetarget = 'imagebrowser';
var searchtimer;
var fade = '0';
var host = window.location.hostname;
var saveimg = '0';
var newuploads = 0;
var photodiraction = '';
var photodiractionid = '';
var config = 'general';
var edittexts = '0';
var saved = '1';
var selcover = '0';
var doclose = 0;
Position.includeScrollOffsets = true;
if( typeof( window.innerWidth ) == 'number' ) {
//Non-IE
myWidth = window.innerWidth;
myHeight = window.innerHeight;
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
//IE 6+ in 'standards compliant mode'
myWidth = document.documentElement.clientWidth;
myHeight = document.documentElement.clientHeight;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
//IE 4 compatible
myWidth = document.body.clientWidth;
myHeight = document.body.clientHeight;
}
var myHeightLimit = myHeight - 100;
function keepfocus() {
var focus = document.activeElement;
focus.focus();
}
function cleartoolbarstatus() {
document.getElementById('toolbarstatus').innerHTML = '';
}
function clearJstatus() {
document.getElementById('jstatus').innerHTML = '';
}
function setCookieRes()
{
var today = new Date();
var the_date = new Date("August 31, 2020");
var the_cookie_date = the_date.toGMTString();
var the_cookie = "res="+ myWidth +"x"+ myHeight;
var the_cookie = the_cookie + ";expires=" + the_cookie_date;
document.cookie=the_cookie
}
setCookieRes();
function saveJournal() {
document.getElementById('jstatus').innerHTML = 'Saving...';
var text = document.getElementById('edit').contentWindow.document.body.innerHTML;
var title = document.getElementById('journaltitle').value;
if(document.getElementById('publish').checked == '1') { var publish = '1'; } else { var publish = '0'; }
if(document.getElementById('delete').checked == '1') { var jdelete = '1'; } else { var jdelete = '0'; }
sendReq.open("POST", '/inc/ajax/journal_edit.php?id=' + document.getElementById('journalid').value, true);
sendReq.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
sendReq.onreadystatechange = handleSaveJournal;
var param = 'text=' + encodeURIComponent(text);
param += '&title=' + encodeURIComponent(title);
param += '&publish=' + publish;
param += '&delete=' + jdelete;
sendReq.send(param);
}
function handleSaveJournal() {
if(sendReq.readyState == 4)
{
if(document.getElementById('delete').checked == '1') { location.href='/journal/'; }
document.getElementById('jstatus').innerHTML = 'Changes saved';
setTimeout('clearJstatus();',3000);
}
}
function saveCloseCustomPage() {
doclose = 1;
saveCustomPage();
}
function saveCustomPage() {
document.getElementById('toolbarstatus').innerHTML = 'Saving...';
var text = document.getElementById('edit').contentWindow.document.body.innerHTML;
sendReq.open("POST", '/inc/ajax/page_edit.php?id=' + document.getElementById('pageid').value, true);
sendReq.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
sendReq.onreadystatechange = handleSaveCustomPage;
var param = 'text=' + encodeURIComponent(text);
sendReq.send(param);
}
function handleSaveCustomPage() {
if(sendReq.readyState == 4)
{
document.getElementById('toolbarstatus').innerHTML = 'Changes saved';
setTimeout('cleartoolbarstatus();',3000);
if(doclose == 1)
{
location.href=document.getElementById('pageurl').value;
}
}
}
function deleteJournal() {
if(document.getElementById('delete').checked == true)
{
alert("Your journal will be permanently deleted if you click \"Save\".");
}
}
function deleteComment(id) {
var agree=confirm("Are you sure you want to delete the comment?");
if(agree) {
if (receiveReq.readyState == 4 || receiveReq.readyState == 0) {
receiveReq.open("GET", '/inc/ajax/delcomment.php?pic=' + document.getElementById('picid').value + '&id=' + id, true);
receiveReq.onreadystatechange = handleDeleteComment;
receiveReq.send(null);
}
}
}
function cDelComment() {
var agree=confirm("Are you sure you want to delete the comment?");
if (agree)
return true ;
else
return false ;
}
function deleteJComment(journal,id) {
var agree=confirm("Are you sure you want to delete the comment?");
if(agree) {
if (receiveReq.readyState == 4 || receiveReq.readyState == 0) {
receiveReq.open("GET", '/inc/ajax/deljcomment.php?journal=' + journal + '&id=' + id, true);
receiveReq.onreadystatechange = handleDeleteJComment;
receiveReq.send(null);
journalcomment = journal;
}
}
}
function handleDeleteComment() {
if (receiveReq.readyState == 4)
{
getComments();
}
}
function handleDeleteJComment() {
if (receiveReq.readyState == 4)
{
getJComments();
}
}
function addJComment(journal) {
if(document.getElementById('journal_name-' + journal) != null && document.getElementById('journal_name-' + journal).value == 'Your name') {
document.getElementById('commentspan-' + journal).innerHTML = 'You must write your name';
} else {
if(document.getElementById('journal_comment-' + journal).value != '' && document.getElementById('journal_comment-' + journal).value != 'Write a comment')
{
if(document.getElementById('journal_name-' + journal) != null) { var name = encodeURIComponent(document.getElementById('journal_name-' + journal).value); } else { var name = ''; }
sendReq.open("POST", '/inc/ajax/addcommentj.php?id=' + journal, true);
sendReq.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
sendReq.onreadystatechange = handleAddJComment;
var param = 'message=' + encodeURIComponent(document.getElementById('journal_comment-' + journal).value);
param += '&reply_to=' + document.getElementById('reply_to-' + journal).value;
param += '&viewhandler=a';
param += '&name=' + name;
sendReq.send(param);
journalcomment = journal;
} else {
document.getElementById('commentspan-' + journal).innerHTML = 'You must write a comment';
}
}
}
function handleAddJComment() {
if (sendReq.readyState == 4)
{
document.getElementById('journal_comment-' + journalcomment).value = 'Write a comment';
if(document.getElementById('journal_name-' + journalcomment) != null)
{
document.getElementById('journal_name-' + journalcomment).value = 'Your name';
}
document.getElementById('commentspan-' + journalcomment).innerHTML = '';
document.getElementById('reply_to-' + journalcomment).value = '0';
document.getElementById('replycomment-' + journalcomment).innerHTML = '';
getJComments();
}
}
function addComment() {
if(document.getElementById('img_name') != null && document.getElementById('img_name').value == 'Your name') {
document.getElementById('commentspan').innerHTML = 'You must write your name';
} else {
if(document.getElementById('img_comment').value != '' && document.getElementById('img_comment').value != 'Write a comment')
{
if(document.getElementById('img_name') != null) { var name = encodeURIComponent(document.getElementById('img_name').value); } else { var name = ''; }
sendReq.open("POST", '/inc/ajax/addcomment.php?id=' + document.getElementById('picid').value, true);
sendReq.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
sendReq.onreadystatechange = handleAddComment;
var param = 'message=' + encodeURIComponent(document.getElementById('img_comment').value);
param += '&reply_to=' + document.getElementById('reply_to').value;
param += '&viewhandler=a';
param += '&name=' + name;
sendReq.send(param);
} else {
document.getElementById('commentspan').innerHTML = 'You must write a comment';
}
}
}
function handleAddComment() {
if (sendReq.readyState == 4)
{
document.getElementById('img_comment').value = 'Write a comment';
if(document.getElementById('img_name') != null)
{
document.getElementById('img_name').value = 'Your name';
}
document.getElementById('commentspan').innerHTML = '';
document.getElementById('reply_to').value = '0';
document.getElementById('replycomment').innerHTML = '';
getComments();
}
}
function doReply(id,from) {
document.getElementById('reply_to').value = id;
name = document.getElementById('name-' + id).innerHTML;
comment = document.getElementById('comment-' + id).innerHTML;
document.getElementById('replycomment').innerHTML = 'Replying to a comment from ' + name + ': ' + comment;
document.getElementById('img_comment').focus();
}
function doJReply(journal,id,from) {
document.getElementById('reply_to-' + journal).value = id;
name = document.getElementById('name-' + id + '-' + journal).innerHTML;
comment = document.getElementById('comment-' + id + '-' + journal).innerHTML;
document.getElementById('replycomment-' + journal).innerHTML = 'Replying to a comment from ' + name + ': ' + comment;
}
function toggleEditTexts() {
if(edittexts == '0')
{
edittexts = '1';
document.getElementById('edittexts').innerHTML = 'Stop editing texts';
} else {
stopEditTexts();
edittexts = '0';
document.getElementById('edittexts').innerHTML = 'Edit texts';
}
}
function editDiv(id) {
var destroydrag = 'dragable_' + id;
var label = 'edit-' + id;
var object = 'object-' + id;
document.getElementById('objecttext-' + id).contentEditable='true';
}
function enableURL(id) {
var field = 'url-' + id;
var box = 'visible-' + id;
if(document.getElementById(box).checked == '1')
{
document.getElementById(field).style.display = 'block';
} else {
// document.getElementById(field).style.display = 'none';
}
}
function nullAction() {
void(0);
}
function cpAddPage() {
}
function checkShortname() {
if (receiveReq.readyState == 4 || receiveReq.readyState == 0) {
receiveReq.open("GET", '/inc/ajax/checkshortname.php?shortname=' + document.getElementById('cp_edit_url').value + '&page=' + document.getElementById('cp_edit_id').value, true);
receiveReq.onreadystatechange = handleCheckShortname;
receiveReq.send(null);
}
}
function handleCheckShortname() {
if (receiveReq.readyState == 4) {
var xmldoc = receiveReq.responseXML;
var topnavi_nodes = xmldoc.getElementsByTagName("checkshortname");
var n_messages = topnavi_nodes.length;
var put = '';
for (k = 0; k < n_messages; k++) {
var shortname_node = topnavi_nodes[k].getElementsByTagName("shortname");
var status_node = topnavi_nodes[k].getElementsByTagName("status");
document.getElementById('cp_edit_url').value = shortname_node[0].firstChild.nodeValue;
}
}
}
function addFavorite() {
if (receiveReq.readyState == 4 || receiveReq.readyState == 0) {
receiveReq.open("GET", '/inc/ajax/favorite.php?action=add&id=' + document.getElementById('picid').value, true);
receiveReq.onreadystatechange = handleFavorites;
receiveReq.send(null);
}
}
function delFavorite() {
if (receiveReq.readyState == 4 || receiveReq.readyState == 0) {
receiveReq.open("GET", '/inc/ajax/favorite.php?action=del&id=' + document.getElementById('picid').value, true);
receiveReq.onreadystatechange = handleFavorites;
receiveReq.send(null);
}
}
function handleFavorites() {
if (receiveReq.readyState == 4) {
getFavorites();
}
}
var getnewsfrom = 0;
function getOlderNews() {
if (receiveReq.readyState == 4 || receiveReq.readyState == 0) {
getnewsfrom = getnewsfrom + 15;
receiveReq.open("GET", '/inc/ajax/newsfeed.php?from=' + getnewsfrom, true);
receiveReq.onreadystatechange = handleGetOlderNews;
receiveReq.send(null);
}
}
function handleGetOlderNews() {
if (receiveReq.readyState == 4)
{
var xmldoc = receiveReq.responseXML;
var topnavi_nodes = xmldoc.getElementsByTagName("newsfeed");
var n_messages = topnavi_nodes.length;
var put = '
';
for (k = 0; k < n_messages; k++) {
var message_node = topnavi_nodes[k].getElementsByTagName("message");
put += message_node[0].firstChild.nodeValue;
}
put += '
';
document.getElementById('newsfeedtarget').innerHTML += put;
}
}
function getNews() {
if (receiveReq.readyState == 4 || receiveReq.readyState == 0) {
receiveReq.open("GET", '/inc/ajax/newsfeed.php', true);
receiveReq.onreadystatechange = handleGetNews;
receiveReq.send(null);
}
}
function handleGetNews() {
if (receiveReq.readyState == 4)
{
var xmldoc = receiveReq.responseXML;
var topnavi_nodes = xmldoc.getElementsByTagName("newsfeed");
var n_messages = topnavi_nodes.length;
var put = '
';
for (k = 0; k < n_messages; k++) {
var message_node = topnavi_nodes[k].getElementsByTagName("message");
put += message_node[0].firstChild.nodeValue;
}
put += '
';
document.getElementById('newsfeedtarget').innerHTML = put;
}
}
function getFavorites() {
if (receiveReq.readyState == 4 || receiveReq.readyState == 0) {
receiveReq.open("GET", '/inc/ajax/favorites.php?id=' + document.getElementById('picid').value, true);
receiveReq.onreadystatechange = handleGetFavorites;
receiveReq.send(null);
}
}
function handleGetFavorites() {
if (receiveReq.readyState == 4)
{
var xmldoc = receiveReq.responseXML;
var topnavi_nodes = xmldoc.getElementsByTagName("fav");
var n_messages = topnavi_nodes.length;
var put = '';
for (k = 0; k < n_messages; k++) {
var favorite_node = topnavi_nodes[k].getElementsByTagName("favorite");
put += favorite_node[0].firstChild.nodeValue;
}
document.getElementById('favorites').innerHTML = put;
}
}
function getJComments() {
if (journalcomment != '0') {
if (receiveReq.readyState == 4 || receiveReq.readyState == 0) {
receiveReq.open("GET", '/inc/ajax/commentsj.php?id=' + journalcomment, true);
receiveReq.onreadystatechange = handleGetJComments;
receiveReq.send(null);
}
}
}
function handleGetJComments() {
if (receiveReq.readyState == 4)
{
var xmldoc = receiveReq.responseXML;
var topnavi_nodes = xmldoc.getElementsByTagName("cc");
var n_messages = topnavi_nodes.length;
var put = '';
for (k = 0; k < n_messages; k++) {
var comment_node = topnavi_nodes[k].getElementsByTagName("comment");
put += comment_node[0].firstChild.nodeValue;
}
document.getElementById('comments-' + journalcomment).innerHTML = put;
journalcomment = '0';
}
}
function getComments() {
if (receiveReq.readyState == 4 || receiveReq.readyState == 0) {
receiveReq.open("GET", '/inc/ajax/comments.php?id=' + document.getElementById('picid').value, true);
receiveReq.onreadystatechange = handleGetComments;
receiveReq.send(null);
}
}
function handleGetComments() {
if (receiveReq.readyState == 4)
{
var xmldoc = receiveReq.responseXML;
var topnavi_nodes = xmldoc.getElementsByTagName("cc");
var n_messages = topnavi_nodes.length;
var put = '';
for (k = 0; k < n_messages; k++) {
var comment_node = topnavi_nodes[k].getElementsByTagName("comment");
put += comment_node[0].firstChild.nodeValue;
}
document.getElementById('comments').innerHTML = put;
}
}
function cpEditPage(id) {
if (receiveReq.readyState == 4 || receiveReq.readyState == 0) {
Effect.Appear('editpage', { duration: 0.2 });
document.getElementById('pages_1').style.opacity = '0.2';
document.getElementById('savesettings').style.opacity = '0.2';
receiveReq.open("GET", '/inc/ajax/page.php?id=' + id, true);
receiveReq.onreadystatechange = handleCpEditPage;
receiveReq.send(null);
}
}
function handleCpEditPage() {
if (receiveReq.readyState == 4) {
var xmldoc = receiveReq.responseXML;
var topnavi_nodes = xmldoc.getElementsByTagName("page");
var n_messages = topnavi_nodes.length;
var put = '';
for (k = 0; k < n_messages; k++) {
var masterid_node = topnavi_nodes[k].getElementsByTagName("masterid");
var title_node = topnavi_nodes[k].getElementsByTagName("title");
var type_node = topnavi_nodes[k].getElementsByTagName("type");
var published_node = topnavi_nodes[k].getElementsByTagName("published");
var shortname_node = topnavi_nodes[k].getElementsByTagName("shortname");
var topnavi_node = topnavi_nodes[k].getElementsByTagName("topnavi");
var showtitle_node = topnavi_nodes[k].getElementsByTagName("showtitle");
if(published_node[0].firstChild.nodeValue == '1')
{
var publishstate = ' checked';
} else {
var publishstate = '';
}
if(topnavi_node[0].firstChild.nodeValue == '1')
{
var topnavistate = ' checked';
} else {
var topnavistate = '';
}
if(showtitle_node[0].firstChild.nodeValue == '1')
{
var showtitle = ' checked';
} else {
var showtitle = '';
}
put += '
Page title
Change the page title (visible in the title bar of the browser and in the navigation)..
Show the title at the top of the page
';
if(type_node[0].firstChild.nodeValue == '1')
{
put += '
Page shortname
The shortname is visible in the web address (URL) to the page. It cannot be more than 20 characters long, and must only contain letters between a-z.
http://' + host + '/p/
';
}
put += '
Publish
Only you will be able to access a page that is not published.
Publish this page
';
put += '
Top navigation
You can publish this in the top navigation if you want your visitors to be able to find the page without you linking to it.
Checked images are not selected for your gallery. Click on them to add them to the gallery. The reversed procedure will remove an image from the gallery.
';
document.getElementById('galleryorder').innerHTML = put;
Sortable.create('master');
for(sortloop = 0; sortloop < mySortables.length; sortloop++) {
Sortable.create(mySortables[sortloop]);
}
for(droploop = 0; droploop < myDroppables.length; droploop++) {
Droppables.add(myDroppables[droploop], {
accept: 'gallerydrop',
hoverclass: 'gallerydropdivhover',
onDrop: function(dragged, dropped, event) {
galleryMove(dragged.id,dropped.id);
}
});
}
}
}
function uninstall(id,app) {
var agree=confirm("Are you sure you want to uninstall this application?");
if(agree)
{
if (receiveReq.readyState == 4 || receiveReq.readyState == 0) {
receiveReq.open("GET", '/inc/ajax/uninstall.php?app=' + id, true);
receiveReq.onreadystatechange = handleInstall;
receiveReq.send(null);
document.getElementById('appssplash').innerHTML = 'Application "' + app + '" is now uninstalled.
';
}
}
}
function install(id,app) {
if (receiveReq.readyState == 4 || receiveReq.readyState == 0) {
receiveReq.open("GET", '/inc/ajax/install.php?app=' + id, true);
receiveReq.onreadystatechange = handleInstall;
receiveReq.send(null);
document.getElementById('appssplash').innerHTML = 'Application "' + app + '" is now successfully installed. You must publish the page for this application before the visitors can see it (do it in the Pages-tab).
';
}
}
function handleInstall() {
if (receiveReq.readyState == 4) {
getApps();
setTimeout('getPages();',500);
}
}
function handleGetApps()
{
if (receiveReq.readyState == 4) {
var xmldoc = receiveReq.responseXML;
var topnavi_nodes = xmldoc.getElementsByTagName("apps");
var n_messages = topnavi_nodes.length;
var installed = '
Installed applications
';
var notinstalled = '
Not installed applications
';
var cinstalled = 0;
var cnotinstalled = 0;
for (k = 0; k < n_messages; k++) {
var masterid_node = topnavi_nodes[k].getElementsByTagName("masterid");
var title_node = topnavi_nodes[k].getElementsByTagName("title");
var type_node = topnavi_nodes[k].getElementsByTagName("type");
var developer_node = topnavi_nodes[k].getElementsByTagName("developer");
var desc_node = topnavi_nodes[k].getElementsByTagName("desc");
var shortname_node = topnavi_nodes[k].getElementsByTagName("shortname");
var installed_node = topnavi_nodes[k].getElementsByTagName("installed");
if(installed_node[0].firstChild.nodeValue == '1')
{
installed += '
';
document.getElementById('appsdiv').innerHTML = installed;
document.getElementById('appsdiv').innerHTML += notinstalled;
}
}
function handleGetPages()
{
var editpage = '';
if (receiveReq.readyState == 4) {
var xmldoc = receiveReq.responseXML;
var topnavi_nodes = xmldoc.getElementsByTagName("page");
var n_messages = topnavi_nodes.length;
var put = '
Publish
';
for (k = 0; k < n_messages; k++) {
var masterid_node = topnavi_nodes[k].getElementsByTagName("masterid");
var title_node = topnavi_nodes[k].getElementsByTagName("title");
var type_node = topnavi_nodes[k].getElementsByTagName("type");
var published_node = topnavi_nodes[k].getElementsByTagName("published");
var shortname_node = topnavi_nodes[k].getElementsByTagName("shortname");
put += '
' + title_node[0].firstChild.nodeValue + 'PROPERTIES';
if(type_node[0].firstChild.nodeValue == '1')
{
put += ' EDIT PAGE';
}
put += '
http://' + host;
if(type_node[0].firstChild.nodeValue == '1')
{
put += '/p/' + shortname_node[0].firstChild.nodeValue + ' - custom designed page';
} else {
put += '/' + shortname_node[0].firstChild.nodeValue + ' - application';
}
put += '