url = document.location.href;

//Timer vars
var inittime = new Date();
var logintime = new Date();
var par = 0;

//Checkflags
var CheckLogin = 0;
var CheckKey = 0;
var CheckIP = 0;

function ajax (url) {
	var jsel = document.createElement('SCRIPT');
	jsel.type = 'text/javascript';
	jsel.src = url;

	document.body.appendChild (jsel);
	
	return true;
}

function UpdateVent(){
	ajax('ajaxvent.asp?runtime=' + new Date());
	setTimeout("UpdateVent()", 30000);
}

function UpdateData(){
  ajax('ajax/updatedata.asp?runtime=' + par);
	setTimeout("UpdateData()", 20000);
}

function ShowLatestComments(){
	ajax('ajax/latecom.asp?runtime=' + par);
	setTimeout("ShowLatestComments()", 57000);
}

function ShowGallery(id, Img, ImgIndex){
  ajax('ajax/gallery.asp?gallery=' + id); 
}

function ShowNews(page){
	ajax('ajax/news.asp?page=' + page);
}

function ShowMembers(page){
	ajax('ajax/members.asp?page=' + page);
}

function ShowDownloads(page){
	ajax('ajax/downloads.asp?page=' + page);
}

function ShowLinks(page){
	ajax('ajax/links.asp?page=' + page);
}

function Login(AUser,APass){
	ajax('ajax/login.asp?user=' + AUser + '&pass=' + APass);
}

function SBabe(){
	ajax('ajax/sbabe.asp?runtime=' + par);
}

function Security(){
	ajax('ajax/security.asp');
	setTimeout("Security()", 300000);
}

function InitPage(){
  Debug();
	Security();
	Login('update','');
  ShowNews(1);
	UpdateData();
	ShowLatestComments();
	SBabe();
}

function SetSession(str){
  ajax('ajax/setsession.asp?set=' + str + "&runtime=" + par);  
}

function Debug(){
	document.getElementById('DivDebug').innerHTML = 'CheckLogin = ' + CheckLogin + '; CheckKey = ' + CheckKey + '; CheckIP = ' + CheckIP + ';';
	setTimeout("Debug()", 500);
}
