// splash.js
//
// environment variables
//
browser="x"; 
if(navigator.appName == 'Netscape')	// test to see if browser is Netscape...
{
	if(navigator.appVersion.indexOf('5') != 0)	// catch 4.x browsers
	{
		browser="NS4";
	}
	else	// for Netscape 5.0+ versions (Netscape 6.x)
	{
		browser="NS6";
	}
}
else		// browser is probably IE if it is not Netscape...
{
	browser="IE5";
}
//
//generic 'modify CSS value'  script
//
function cssMod (whichOne,cssTag,tagValue)
{
	switch(browser) {
		case "IE5":
			eval("document.all."+whichOne+".style."+cssTag+"=\'"+tagValue+"\'"); 
			return true;
		case "NS4":
			eval("document."+whichOne+"."+cssTag+"=\'"+tagValue+"\'"); 
			return true;
		case "NS6":
			eval("document.getElementById(\'"+whichOne+"\').style."+cssTag+"=\'"+tagValue+"\'");
			return true;
		default:
			return true;
	}
}
//
// image moving functions
//
var newLeft;
var newTop;
var stepLeft;
var stepTop;
var iteration;
//
function moveStep (whichOne,stepLeft,stepTop)
{	// obviously neither finished nor in use at the moment...
	// actually moving the image!
	if(iteration > 0)
		{
		newLeft+=stepLeft;
		cssMod(whichOne,'left',newLeft);
		newTop+=stepTop;
		cssMod(whichOne,'top',newTop);
		iteration -= 1;
		}
	else
		{
		clearTimeout();
		}
	return true;
}
//
function moveImage (whichOne,toLeft,toTop,speed)
{		// moves a specific image (whichOne)
		// to a given position (toLeft,toTop)
		// at a particular fps (speed);
		// but we need the initial position of the image first...
	switch(browser) {
		case "IE5":
			fromLeft = document.all[whichOne].style.left;
			fromTop = document.all[whichOne].style.top;
			break;
		case "NS4":
			fromLeft = document[whichOne].left;
			fromTop = document[whichOne].top;
			break;
		case "NS6":
			fromLeft = document.getElementById([whichOne]).style.left;
			fromTop = document.getElementById([whichOne]).style.top;
			break;
		default:
			fromLeft = 0;
			fromTop = 0;
			break;
	}
		// next we get rid of the fscking pixels
	leftEnd=fromLeft.indexOf('px');
	fromLeft=fromLeft.substring(0,leftEnd);
	topEnd=fromTop.indexOf('px');
	fromTop=fromTop.substring(0,topEnd);
		// ...then set the stepping based on the speed
	stepLeft = (toLeft - fromLeft)/speed; 
	stepTop = (toTop - fromTop)/speed; 
		// and finally we actually move the image!
	newLeft=eval(fromLeft);
	newTop=eval(fromTop);
	iteration = speed;
	for(var x = 0; x < speed; x++)
	{
		newLeft+=stepLeft;
		cssMod(whichOne,'left',newLeft);
		newTop+=stepTop;
		cssMod(whichOne,'top',newTop);
// GODDAMMIT!!! WHY DOESN'T JAVASCRIPT HAVE A FSCKING PAUSE FUNCTION?!?!?
	}
// eventually replace for-loop above with the following:
//	setTimeout('moveStep(whichOne,stepLeft,stepTop)',100);
// got it?
	return true;
}
//
// end of functions
