﻿<!-- Original:  Lefteris Haritou --> 
<!-- Web Site:  lef@writeme.com> www.geocities.com/~lef -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

var base= new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9","A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z","a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z")
var pass=""
var z=23;
var y=28;
var f= new Array();
var K= new Array();

for (x=0; x<10; x++){
	f[x]=x<<9
	f[x]+=23
}

for (x=10; x<36; x++){
	y=y<<1
	v= Math.sqrt(y)
	v = parseInt(v,16)
	v+=5
	f[x]=v
	y++
}

for (x=36; x<62; x++){
	z=z<<1
	v= Math.sqrt(z)
	v = parseInt(v,16)
	v+=74
	f[x]=v
	z++
}

var iCounter = 3

function inc(){
	iCounter--
	if (iCounter > 0)
	{
		if (confirm("\nPassword is incorrect.\n\n\n\nRetry?"))
			Check()
		//else
		//	alert('Password incorrect.');
		//history.go(0);
	}
	else{
		alert('Your three tries are up.  Access Denied.');
		iCounter = 3
	}
	//history.go(-1);
}

function Check(){
	pass = prompt("Enter your password.","")
	if(pass==null || pass==""){
		history.go(0)}
	else{
		var lpass=(pass.length)+1
		for (l=1; l<lpass; l++){
			K[l]=pass.charAt(l)
		}
		var code=0;
		for (y=1; y<lpass; y++){
			for(x=0; x<62; x++){
				if (K[y]==base[x]){
					code+=f[x]
					code*=y
				}
			}
		}
	
		if (code==1332498)
			go()
		else
			inc()
	}
}

function go(){
	location.href=pass+".html";
}






function popup(mylink, windowname)
{
	if (!window.focus) return true;

	var href;
	if (typeof(mylink) == 'string')
	   href=mylink;
	else
	   href=mylink.href;

	window.open(href, windowname, 'width=500,height=300,left=50,top=100,location=no,menubar=no,scrollbars=no,resizable=no');

	return false;
}



// based on script by Joe Maller
// protected email script by Joe Maller
// JavaScripts available at http://www.joemaller.com
// this script is free to use and distribute
// but please credit me and/or link to my site
function makeEmailAddr(sName,sDomain,kShowAddrOption) {				
	var emailE=(sName + sDomain);
	switch (kShowAddrOption) {
		case 0:
			document.write('<a href="mailto:' + emailE + '">e-mail</a>');
			break;
		case 1:
			document.write('<a class="ext" href="mailto:' + emailE + '">' + emailE + '</a>');
			break;
		case 2:
			document.write('<a href="mailto:' + emailE + '">' + emailE + '</a>');
			break;
		default:
			document.write('<a class="ext" href="mailto:' + emailE + '">' + emailE + '</a>');
			break;
	}
		
}


// 2006-05-29: backToTop() code posted at http://web-graphics.com/mtarchive/001659.php
function backToTop() {
    var x1 = x2 = x3 = 0;
    var y1 = y2 = y3 = 0;

    if (document.documentElement) {
        x1 = document.documentElement.scrollLeft || 0;
        y1 = document.documentElement.scrollTop || 0;
    }

    if (document.body) {
        x2 = document.body.scrollLeft || 0;
        y2 = document.body.scrollTop || 0;
    }

    x3 = window.scrollX || 0;
    y3 = window.scrollY || 0;

    var x = Math.max(x1, Math.max(x2, x3));
    var y = Math.max(y1, Math.max(y2, y3));

    window.scrollTo(Math.floor(x / 2), Math.floor(y / 2));

    if (x > 0 || y > 0) {
        window.setTimeout("backToTop()", 25);
    }
}


function makeFooterDivOpenTag(nOffset){
	var nTop = document.getElementById('content_left').offsetTop + document.getElementById('txt_left').offsetTop;
	var nHeight = document.getElementById('txt_left').offsetHeight;	
	var nBottom_Left = nTop + nHeight;

	var nTop = document.getElementById('content_mid').offsetTop + document.getElementById('txt_mid').offsetTop;
	var nHeight = document.getElementById('txt_mid').offsetHeight;	
	var nBottom_Mid = nTop + nHeight;

	var nTop = document.getElementById('content_right').offsetTop + document.getElementById('txt_right').offsetTop;
	var nHeight = document.getElementById('txt_right').offsetHeight;	
	var nBottom_Right = nTop + nHeight;

    var nBottom = Math.max(nBottom_Left, Math.max(nBottom_Mid, nBottom_Right));
    
	var nTop_Footer = nBottom + nOffset;

	document.write('<div class="footer" style="top: ' + nTop_Footer + 'px;">');
}

function makeFooterDivCloseTag(){
	document.write('</div>');
}





// Following JavaScript taken from JavaScript: The Definitive Guide (4th Ed) by David Flanagan, p. 238-9.

var numOfFrames = 20;
var aniframes = new Array(numOfFrames);
var numLoadedImages = 0;

// This function is used as an event handler.  It counts how many images
// have been loaded and, when all have been loaded, it starts the animation.
function countImages() {
	if (++numLoadedImages == aniframes.length) animate();
}


// Create a bunch of offscreen images, and pre-fetch the "frames"
// of the animation into them so that they're cached when we need them.
// Assign the image URLs. Also assign an event handler to each image so we can track
// how many images have been loaded. Note that we assign the handler before the URL, because
// otherwise the image might finish loading (e.g., if it is already cached) before
// we assign the handler, and then the handler would never be triggered.
for(var i=0; i< numOfFrames; i++) {
	aniframes[i] = new Image();							// Create an offscreen image
	aniframes[i].onload = countImages;					// Assign the event handler
	aniframes[i].src = "img/join_img_" + i + ".jpg";	// Tell it what URL to load
}

var frame = 0;			// The frame counter: keeps track of current frame
var	timeout_id = null;	//

// This function performs the animation. Call it once to start.
// Note that we refer to the onscreen image using its name attribute.
function animate() {
	document.joinImg.src = aniframes[frame].src;	// Display the current frame
	frame = (frame + 1)%numOfFrames;				// Update the frame counter
	timeout_id = setTimeout("animate()", 2500);		// Display the next frame later
}			
