

// NAVIGATION AJAX 
function navChange(thismain,thissub,thisdiv,thisDir) {

var navDiv = document.getElementById('id_'+thisNav);
if (navDiv) { navDiv.style.color = '#999999'; }
thisNav = thismain;
var thisnavDiv = document.getElementById('id_'+thismain);
if (thisnavDiv) { thisnavDiv.style.color = '#000000'; }


//alert(thismain+':'+thissub+':'+thisdiv+':'+thisDir);
if (thismain == 'image') {
//offImage = 'navbar';
//document.getElementById('navbar').src = navbar.src;
if ($('#mainImage').length == 1) {
$('#mainImage').fadeOut(1000, function() {
$('#mainImage').attr('src','');
$('#mainImage').attr('src','IMAGES/ALL/'+thissub+'_big.jpg');
$('#mainImage').fadeIn(1000);
});
} else {
$('#mainDiv').fadeOut(1000, function() {
$('#mainDiv').html("<img id='mainImage' src='IMAGES/ALL/"+thissub+"_big.jpg'/>");
$('#mainDiv').fadeIn(1000);
});
}
} else {
offImage = thismain+'on';
$('#mainDiv').fadeOut(1000, function() {
getFile(url+'/ajax_body.cgi?main='+thismain+'&sub='+thissub+'&dir='+thisDir,thisdiv,thismain,thisDir);
});
}
}
// AJAX
var xmlhttp = '';
var async = false;
var imagebar = 'current';
var imagehash = 'current';
function getFile(pURL,thisDiv,thismain,thissub) {
whichDiv = thisDiv;
xmlhttp = getHTTPObject();
if (xmlhttp) {
xmlhttp.open("GET", pURL, async);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status==200) {
if (thisDiv == 'getHash') {
eval(xmlhttp.responseText);
return false;
} else {
document.getElementById(whichDiv).innerHTML=xmlhttp.responseText;
if (thismain != 'image') {
if ((thisDiv != 'imageBar')&&(thismain == 'archive')&&(imagebar != 'archive')) {
getFile(url+'/ajax_body.cgi?main=imageBar&sub=archive','imageBar','archive');
imagebar = 'archive';
//document.getElementById("scroller").scrollLeft = 0;
sPos = 0; clickCnt = 0;
} else if ((thisDiv != 'imageBar')&&(thismain != 'archive')&&(imagebar != 'current')) {
getFile(url+'/ajax_body.cgi?main=imageBar&sub=current','imageBar','current');
imagebar = 'current';
//document.getElementById("scroller").scrollLeft = 0;
sPos = 0; clickCnt = 0;
} else if (imagehash != thismain) {
getFile(url+'/ajax_body.cgi?main=imageHash&sub='+thismain,'getHash','');
imagehash = thismain;
}}}}}}
xmlhttp.send(null);
}}
function getHTTPObject() {
xmlhttp = false;
if(window.XMLHttpRequest) {
if (xmlhttp.overrideMimeType) {
xmlhttp.overrideMimeType('text/xml');
}
async = true;
xmlhttp = new XMLHttpRequest();
} else if(window.ActiveXObject) {
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {
xmlhttp = false;
}}
} else if (window.createRequest) {
try {
xmlhttp = window.createRequest();
} catch (e) {
xmlhttp = false;
}}
return xmlhttp;
}

