var currentLocation = 'news';
var reloading = '0';
var JSFoptions = {
target: '#contentBox',
beforeSerialize: preSubmit,
cache: false,
success: pageLoaded
};
var Postoptions = {
clearForm: true,
beforeSubmit: preChat,
success: postChat,
cache: false
};
$.ajaxSetup ({
// Disable caching of AJAX responses */
cache: false
});
function preChat ()
{
$(".chatField").attr("disabled", true);
}
function postChat ()
{
$(".chatField").attr("disabled", false);
}
function preSubmit (formData, form, options) {
if ( $('.mceEditor').length > 0 ) {
$('.mceEditor').tinymce().remove();
}
prepPage();
}
function prepPage(loading,reload)
{
scroll(0,0);
if ( loading!=false )
loading = true;
if ( loading ) {
$("#loadingBox").show();
//$("#contentBox").hide();
}
reloading = 1;
}
var hash;
var wreload = 0;
function reload()
{
changeContent(currentLocation);
}
wreload = 0;
var refreshHash = setInterval(function()
{
if ( wreload != 2 && hash != window.location.hash && window.location.hash != '' && window.location.hash != '#' && window.location.hash != '#bottom' || wreload == 1) {
changeContent(window.location.hash.substring(1,window.location.hash.length));
hash = window.location.hash;
wreload = 0;
}
}, 1000);
function updateHash(url)
{
window.location.hash = "#"+url;
wreload = 1;
}
function pageLoaded()
{
$("#loadingBox").hide();
//$("#contentBox").show();
updateTimers();
nd();
$('#mailLogo').load('ajax/mailbox.php').fadeIn("slow");
$('#statsBox').load('ajax/stats.php').fadeIn("slow");
$('#slidebox').hide();
$('a#slidelink').click(function() {
$('#slidebox').slideToggle('normal');
return false;
});
$('form:not(.noAjax)').ajaxForm(JSFoptions);
$('.postBoxf').ajaxForm(Postoptions);
$("#autoUsername").autocomplete('ajax/ajax_username.php');
$("#autoUsernamed").autocomplete('ajax/ajax_usernamed.php');
$(".chatbox").each(function() {
var tsTimeStamp = new Date().getTime();
reloading = 0;
$.getScript( 'ajax/ajax_chatMessage.php?divID='+$(this).attr('id')+'&jQtime='+tsTimeStamp );
});
if ( $('.mceEditor').length > 0 ) {
$('.mceEditor').tinymce({
script_url : 'includes/javascript/tiny_mce/tiny_mce.js',
mode : "textareas",
editor_selector : "mceEditor",
width : "200px",
height : "200px",
theme : "advanced",
plugins : "safari,pagebreak,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras",
// Theme options
theme_advanced_buttons1 : "bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,image,|,forecolor,backcolor,|,hr,charmap,sub,sup",
theme_advanced_buttons2 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,emotions,|,fontselect,fontsizeselect ",
theme_advanced_buttons3 : "",
theme_advanced_buttons4 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "center",
theme_advanced_statusbar_location : "",
theme_advanced_resizing : true,
// Example content CSS (should be your site CSS)
content_css : "includes/javascript/tiny_mce/themes/advanced/skins/default/content.css",
// Drop lists for link/image/media/template dialogse
template_external_list_url : "lists/template_list.js",
external_link_list_url : "lists/link_list.js",
external_image_list_url : "lists/image_list.js",
media_external_list_url : "lists/media_list.js"
});
}
}
function insertText(html) {
$('.mceEditor').tinymce().execCommand('mceInsertContent',false,html);
}
function confirmd(cmessage)
{
return confirm(cmessage);
}
function confirml()
{
return confirm("Are you sure you want to leave your gang?");
}
function changeContent(fragment)
{
currentLocation = fragment;
if ( $('#contentBox').length < 1 ) return true;
prepPage();
$('#contentBox').load('ajax/page_content.php?'+fragment, function() {
pageLoaded();
});
return false;
}
function updateTimers() {
lastTimersUpdate = new Date().getTime();
var tsTimeStamp = new Date().getTime();
$.getScript( 'ajax/timers.php?jQtime='+tsTimeStamp );
return true;
}
$('#mailLogo').load('ajax/mailbox.php');
var refreshId = setInterval(function()
{
$('#mailLogo').load('ajax/mailbox.php').fadeIn("slow");
updateTimers();
}, 20000);
$('#statsBox').load('ajax/stats.php');
var refreshId = setInterval(function()
{
$('#statsBox').load('ajax/stats.php').fadeIn("slow");
}, 60000);
$('#usersOnline').load('ajax/usersonline.php');
var refreshId = setInterval(function()
{
$('#usersOnline').load('ajax/usersonline.php').fadeIn("slow");
}, 120000);
$('#midlink').load('ajax/mid.php');
var refreshId = setInterval(function()
{
$('#midlink').load('ajax/mid.php').fadeIn("slow");
}, 60000);
$('#helpdeskLink').load('ajax/helpdesk.php');
var refreshId = setInterval(function()
{
$('#helpdeskLink').load('ajax/helpdesk.php').fadeIn("slow");
}, 100000);
$('form').ajaxForm(JSFoptions);
day_name=new Array(7);
day_name[0]="Sun";
day_name[1]="Mon";
day_name[2]="Tue";
day_name[3]="Wed";
day_name[4]="Thu";
day_name[5]="Fri";
day_name[6]="Sat";
month=new Array(12);
month[0]="Jan";
month[1]="Feb";
month[2]="Mar";
month[3]="Apr";
month[4]="May";
month[5]="Jun";
month[6]="Jul";
month[7]="Aug";
month[8]="Sep";
month[9]="Oct";
month[10]="Nov";
month[11]="Dec";
function Clock() {
var time = new Date();
var year = time.getYear();
if(year < 1000){
year += 1900;
}
year = (year+"").substring(2,4);
var gmtMS = time.getTime() + (time.getTimezoneOffset() * 60000);
var gmtTime = new Date(gmtMS);
var hour = gmtTime.getHours() + 1
if ( hour > 24 ){
hour = 0;
}
var minute = gmtTime.getMinutes();
var second = gmtTime.getSeconds();
var temp = "" + ((hour < 10) ? "0" : "") + hour;
temp += ((minute < 10) ? ":0" : ":") + minute;
//temp += ((second < 10) ? ":0" : ":") + second;
// document.getElementById( 'Clock' ).innerHTML = day_name[time.getDay()]+' '+time.getDate()+' '+month[time.getMonth()]+' '+year+' '+temp;
// document.getElementById( 'Clock' ).innerHTML = temp;
$('#Clock').html( day_name[time.getDay()]+' '+time.getDate()+' '+month[time.getMonth()]+' '+year+' '+temp );
}
Clock();
setInterval("Clock()", 60000);
function logout()
{
return confirm("Are you sure you wish to logout?");
}
//-->
function StartCountDown(myDiv,myTargetDate, myCurrentDate)
{
var dthen = new Date(myTargetDate);
var dnow = new Date(myCurrentDate);
ddiff = new Date(dthen-dnow);
gsecs = Math.floor(ddiff.valueOf()/1000);
CountBack(myDiv,gsecs,lastTimersUpdate);
}
function CountBack(myDiv, secs, Update)
{
//log( 'countback' );
if ( Update < lastTimersUpdate ) {
return false;
}
if( secs > 0 ) {
var hours = Math.floor(secs/3600);
var hoursi = hours * 3600;
var minutes = Math.floor((secs - hoursi)/60);
var seconds = Math.floor((secs - hoursi) - (minutes*60));
minutes = (minutes < 10) ? "0" + minutes : minutes;
seconds = (seconds < 10) ? "0" + seconds : seconds;
$('#'+myDiv).html( ''+hours+':'+minutes+':'+seconds+'' );
setTimeout("CountBack('" + myDiv + "'," + (secs-1) + ", " + Update + ");", 995);
} else {
$('#'+myDiv).html('00:00:00');
}
}
function pup(mylink, windowname, width, height)
{
if ( width < 1 ) width = 300;
if ( height < 1 ) height = 250;
var href;
if (typeof(mylink) == 'string')
href=mylink;
else
href=mylink.href;
string = 'width='+width+',height='+height+',scrollbars=yes';
window.open(href, windowname, string);
return false;
}
function updateTxtFrame(thestring)
{
$('#txtFrame').attr('src', thestring);
return true;
}
function submitForm ()
{
$(this).ajaxSubmit();
return false;
}