var navArray = new Array('about','shows','screenshots','software','botimation')


function navPreload(){

	for (stepper=0;stepper++;stepper==navArray.length){
	loadimg[stepper] = new Image();
	loadimg[stepper].src = "images/button_"+navArray[stepper]+"_on.gif";
	}
}


function Switcher(imgID,whichimg){

		document.images[imgID].src=whichimg;
		
		}
		
		
function navSwitch(imgID){

		whichimg = "images/button_"+imgID+"_on.gif";
		theIMG = imgID+"img";
		theIMGbot = imgID+"img2";
        window.status=imgID;
		document.images[theIMG].src=whichimg;
		document.images[theIMGbot].src=whichimg;
		
		}
		
		
function navSwitchOff(imgID){

		whichimg = "images/button_"+imgID+"_off.gif";
		theIMG = imgID+"img";
		theIMGbot = imgID+"img2";
		document.images[theIMG].src=whichimg;
		document.images[theIMGbot].src=whichimg;
		
		}
		
function imgopen(imagename) { 
	w2 = window.open("", "remote1", 'status=0,menubar=0,top=20,left=10,location=0,directories=0,width=640,height=500'); 
	w2.document.clear();
	w2.document.open();
	w2.document.writeln("<html><head><title>CyberSpaceLand</title></head>");
	w2.document.writeln("<body bgcolor=#d6d6d6 text=#990000 leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>");
	w2.document.writeln("<table width=100% height=100%><TD align=center valign=middle>");
	w2.document.writeln('<a href=\"#\" onclick=\"window\.close()\; return true\;\">');
	w2.document.writeln('<img src=\"images/' + imagename + '\" border\=0></a>');
	w2.document.writeln("</td></table>");
	w2.document.writeln('</body></html>');
	w2.document.close();

}

function zstat(msg){
window.status=msg;
}

function xstat(){
window.status='';
}





// referrer test script
//
//
function referrertest(){
theUrl = 'cyberspaceland'//'cyberspaceland.org'
if (document.referrer.indexOf(theUrl) != -1)
{Switcher('titlegraphic','images/cspaceland_no_anim.gif')
}else{
Switcher('titlegraphic','images/cspaceland.gif')
}
}
//
//
// end referrer test script





// cookie script
//
//

function GetCookie (name) {  
var arg = name + "=";  
var alen = arg.length;  
var clen = document.cookie.length;  
var i = 0;  
while (i < clen) {
var j = i + alen;    
if (document.cookie.substring(i, j) == arg)      
return getCookieVal (j);    
i = document.cookie.indexOf(" ", i) + 1;    
if (i == 0) break;   
}  
return null;
}


function SetCookie (name, value) {  
var argv = SetCookie.arguments;  
var argc = SetCookie.arguments.length;  
var expires = (argc > 2) ? argv[2] : null;  
var path = (argc > 3) ? argv[3] : null;  
var domain = (argc > 4) ? argv[4] : null;  
var secure = (argc > 5) ? argv[5] : false;  
document.cookie = name + "=" + escape (value) + 
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
((path == null) ? "" : ("; path=" + path)) +  
((domain == null) ? "" : ("; domain=" + domain)) +    
((secure == true) ? "; secure" : "");
}


function DeleteCookie (name) {  
var exp = new Date();  
exp.setTime (exp.getTime() - 1);   
var cval = GetCookie (name);  
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

// expiration time in minutes:
//
var expMins = 4;
//
//

var exp = new Date(); 
exp.setTime(exp.getTime() + (expMins*60*1000));


function cookietest(){
var count = GetCookie('count')
if(count == null) {
SetCookie('count','1')
Switcher('titlegraphic','images/cspaceland.gif')
return 1


}
else {
var newcount = parseInt(count) + 1;
DeleteCookie('count')
SetCookie('count',newcount,exp)
Switcher('titlegraphic','images/cspaceland_no_anim.gif')
return count

   }
}


function getCookieVal(offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}

//
//
// end cookie script




