var sPath = window.location.pathname;
//var sPage = sPath.substring(sPath.lastIndexOf('\\') + 1);
var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);

// Create multiple XMLHttpRequest objects (one for each DIV)

var xmlHttp_one = AJAX();
var xmlHttp_two = AJAX();
var xmlHttp_four = AJAX();
var xmlHttp_six = AJAX();
var xmlHttp_seven = AJAX();
var xmlHttp_eight = AJAX();
var xmlHttp_nine = AJAX();
var xmlHttp_ten = AJAX();
var xmlHttp_eleven = AJAX();
// The AJAX function...

function AJAX(){
try{
xmlHttp=new XMLHttpRequest(); // Firefox, Opera 8.0+, Safari
return xmlHttp;
}
catch (e){
try{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer
return xmlHttp;
}
catch (e){
try{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
return xmlHttp;
}
catch (e){
alert("Your browser does not support AJAX.");
return false;
}
}
}
}

// Timestamp for preventing IE caching the GET request (common function)

function fetch_unix_timestamp()
{
return parseInt(new Date().getTime().toString().substring(0, 10))
}

////////////////////////////////
//
// Refreshing the DIV alzstats
//
////////////////////////////////

function refreshdiv_alzstats(){

// Customise those settings

var seconds = 3;
var divid = "alzstats";
var url = "alzstats.php";

// No cache

var timestamp = fetch_unix_timestamp();
var nocacheurl = url+"?t="+timestamp;

// The code...

xmlHttp_one.onreadystatechange=function(){
if(xmlHttp_one.readyState==4){
document.getElementById(divid).innerHTML=xmlHttp_one.responseText;
setTimeout('refreshdiv_alzstats()',seconds*1000);
}
}
xmlHttp_one.open("GET",nocacheurl,true);
xmlHttp_one.send(null);
}

// Start the refreshing process

window.onload = function startrefresh(){
setTimeout('refreshdiv_alzstats()',seconds*1000);
}

////////////////////////////////
//
// Refreshing the DIV lgstats
//
////////////////////////////////

function refreshdiv_lgstats(){

// Customise those settings

var seconds = 3;
var divid = "lgstats";
var url = "lgstats.php";

// No cache

var timestamp = fetch_unix_timestamp();
var nocacheurl = url+"?t="+timestamp;

// The code...

xmlHttp_two.onreadystatechange=function(){
if(xmlHttp_two.readyState==4){
document.getElementById(divid).innerHTML=xmlHttp_two.responseText;
setTimeout('refreshdiv_lgstats()',seconds*1000);
}
}
xmlHttp_two.open("GET",nocacheurl,true);
xmlHttp_two.send(null);
}

// Start the refreshing process

window.onload = function startrefresh(){
setTimeout('refreshdiv_lgstats()',seconds*1000);
}


////////////////////////////////
//
// Refreshing the DIV staffstats
//
////////////////////////////////

function refreshdiv_staffstats(){

// Customise those settings

var seconds = 3;
var divid = "staffstats";
var url = 'staffstats.php';

// No cache

var timestamp = fetch_unix_timestamp();
var nocacheurl = url+"?t="+timestamp;

// The code...

xmlHttp_four.onreadystatechange=function(){
if(xmlHttp_four.readyState==4){
document.getElementById(divid).innerHTML=xmlHttp_four.responseText;
setTimeout('refreshdiv_staffstats()',seconds*1000);
}
}
xmlHttp_four.open("GET",nocacheurl,true);
xmlHttp_four.send(null);
}

// Start the refreshing process

window.onload = function startrefresh(){
setTimeout('refreshdiv_staffstats()',seconds*1000);
}




////////////////////////////////
//
// Refreshing the DIV dailyschedule
//
////////////////////////////////

function refreshdiv_dailyschedule(){

// Customise those settings

var seconds = 3;
var divid = "dailyschedule";
var url = "dailyschedule2.php";

// No cache

var timestamp = fetch_unix_timestamp();
var nocacheurl = url+"?t="+timestamp;

// The code...

xmlHttp_six.onreadystatechange=function(){
if(xmlHttp_six.readyState==4){
document.getElementById(divid).innerHTML=xmlHttp_six.responseText;
setTimeout('refreshdiv_dailyschedule()',seconds*1000);
}
}
xmlHttp_six.open("GET",nocacheurl,true);
xmlHttp_six.send(null);
}

// Start the refreshing process

window.onload = function startrefresh(){
setTimeout('refreshdiv_dailyschedule()',seconds*1000);
}

////////////////////////////////
//
// Refreshing the DIV tourlist
//
////////////////////////////////

function refreshdiv_tourlist(){

// Customise those settings

var seconds = 3;
var divid = "tourlist";
var url = 'tourneyadmin2.php';

// No cache

var timestamp = fetch_unix_timestamp();
var nocacheurl = url+"?t="+timestamp;

// The code...

xmlHttp_seven.onreadystatechange=function(){
if(xmlHttp_seven.readyState==4){
document.getElementById(divid).innerHTML=xmlHttp_seven.responseText;
setTimeout('refreshdiv_tourlist()',seconds*1000);
}
}
xmlHttp_seven.open("GET",nocacheurl,true);
xmlHttp_seven.send(null);
}

// Start the refreshing process

window.onload = function startrefresh(){
setTimeout('refreshdiv_tourlist()',seconds*1000);
}

////////////////////////////////
//
// Refreshing the DIV chat
//
////////////////////////////////

function refreshdiv_chat(){

// Customise those settings

var seconds = 3;
var divid = "chat";
var url = "chat.php";

// No cache

var timestamp = fetch_unix_timestamp();
var nocacheurl = url+"?t="+timestamp;

// The code...

xmlHttp_eight.onreadystatechange=function(){
if(xmlHttp_eight.readyState==4){
document.getElementById(divid).innerHTML=xmlHttp_eight.responseText;
setTimeout('refreshdiv_chat()',seconds*1000);
}
}
xmlHttp_eight.open("GET",nocacheurl,true);
xmlHttp_eight.send(null);
}

// Start the refreshing process

window.onload = function startrefresh(){
setTimeout('refreshdiv_chat()',seconds*1000);
}

///////////////

////////////////////////////////
//
// Refreshing the DIV shoutbox
//
////////////////////////////////

function refreshdiv_shoutbox(){

// Customise those settings

var seconds = 3;
var divid = "shoutbox";
var url = "shoutbox3.php";

// No cache

var timestamp = fetch_unix_timestamp();
var nocacheurl = url+"?t="+timestamp;

// The code...

xmlHttp_nine.onreadystatechange=function(){
if(xmlHttp_nine.readyState==4){
document.getElementById(divid).innerHTML=xmlHttp_nine.responseText;
setTimeout('refreshdiv_shoutbox()',seconds*1000);
}
}
xmlHttp_nine.open("GET",nocacheurl,true);
xmlHttp_nine.send(null);
}

// Start the refreshing process

window.onload = function startrefresh(){
setTimeout('refreshdiv_shoutbox()',seconds*1000);
}

///////////////

////////////////////////////////
//
// Refreshing the DIV mockwarsheet
//
////////////////////////////////

function refreshdiv_mockwarsheet(){

// Customise those settings

var seconds = 15;
var divid = "mockwarsheet";
var url = "mockwarsheet2.php";

// No cache

var timestamp = fetch_unix_timestamp();
var nocacheurl = url+"?t="+timestamp;

// The code...

xmlHttp_ten.onreadystatechange=function(){
if(xmlHttp_ten.readyState==4){
document.getElementById(divid).innerHTML=xmlHttp_ten.responseText;
setTimeout('refreshdiv_mockwarsheet()',seconds*1000);
}
}
xmlHttp_ten.open("GET",nocacheurl,true);
xmlHttp_ten.send(null);
}

// Start the refreshing process

window.onload = function startrefresh(){
setTimeout('refreshdiv_mockwarsheet()',seconds*1000);
}

///////////////


////////////////////////////////
//
// Refreshing the DIV recenthits
//
////////////////////////////////

function refreshdiv_recenthits(){

// Customise those settings

var seconds = 5;
var divid = "recenthits";
var url = "recenthits2.php";

// No cache

var timestamp = fetch_unix_timestamp();
var nocacheurl = url+"?t="+timestamp;

// The code...

xmlHttp_eleven.onreadystatechange=function(){
if(xmlHttp_eleven.readyState==4){
document.getElementById(divid).innerHTML=xmlHttp_eleven.responseText;
setTimeout('refreshdiv_recenthits()',seconds*1000);
}
}
xmlHttp_eleven.open("GET",nocacheurl,true);
xmlHttp_eleven.send(null);
}

// Start the refreshing process

window.onload = function startrefresh(){
setTimeout('refreshdiv_recenthits()',seconds*1000);
}

///////////////




function PreviewForm(content){

var preview = open("", "Preview",'scrollbars=yes,resizeable=yes,width=1024,height=768');

var content = (document.getElementById(content).value);

preview.document.open();

preview.document.write(content);

preview.document.close();

}



function PreviewForm(content2){

var preview = open("", "Preview",'scrollbars=yes,resizeable=yes,width=1024,height=768');

var content2 = (document.getElementById(content2).value);

preview.document.open();

preview.document.write(content2);

preview.document.close();

}



if (sPage == 'techarea.php')
{
document.getElementById('DivFrame').innerHTML="";
document.getElementById('StaffFrame').innerHTML="";
document.getElementById('MemberFrame').innerHTML="";
document.getElementById('AttackBar').innerHTML="";
}











