//////////////////////    for non 'getElementById' browsers    //////////////////

if(!window.document.getElementById){
	if(window.document.all)
		window.document.getElementById=function(){
		if(typeof window.document.all[arguments[0]]!="undefined")
			return window.document.all[arguments[0]]
		else
			return null
		}
		else if(window.document.layers)
			window.document.getElementById=function(){
			if(typeof window.document[arguments[0]]!="undefined")
				return window.document[arguments[0]]
		else
			return null
	}
}
//////////////////////    for non 'getElementById' browsers    //////////////////

NotYet=0;
	
StartTime();
SeqNo = STMilli;
	
//	alert('STDay : '+STDay);
	
ScriptD1='<script type="text/javascript" src="';
scriptU1='../CodEl/';
ScriptD2='"></script>';
	
FrontBit="../CodEl/Assets/gifs/";			// variables for preload. 

if(SmallGiff==1) {
	FrontBit="../Assets/gifs/";
}

BackBit=".gif";
SetSelecta();
	
function SetSelecta() {

	if(typeof(ThesePoses) != 'object') {
		if(TextOn==1) {
			TSeq="Story";
			var SeqChoice="TheSeqs/TheSeq";
			var SeqChoice=SeqChoice+TSeq+".txt";
			var ThesePoses= new Array();
			ScrptWrt(SeqChoice);
		}
	
	}
}
	
function AudioSet(TheVar) {
	ThesePoses=TheVar;
}

function NoFunction (SeqsT) {
		alert('SeqsT : '+SeqsT);
		SeqScript='/TheSeqT.js';
		ScrptWrt(SeqScript);
}

function RollLive() {
	var TSeq="1001";
	var SeqChoice="TheSeqs/TheSeq";
	var SeqChoice=SeqChoice+TSeq+".txt";
	var ThesePoses= new Array();
	ScrptWrt(SeqChoice);	
}
	
function checkDone() {
	alert("ThesePoses : " + ThesePoses);
}

function RollPoses() {
	if (AudioOn==0) {
		for(loop=0; loop<ThesePoses.length; loop++) {
			PoseScript=scriptU1+'StrInst/'+ThesePoses[loop]+'.txt';				ScrptWrt(PoseScript);
		}
	}
}

function ScrptWrt(SeqScript) {
		SeqScript=ScriptD1+scriptU1+SeqScript+ScriptD2;
		window.document.writeln(SeqScript);
}
	
////////////////////////////////////////////////////////////
function InfoFrmSW(TheText) {
	window.document.getElementById("WhatSAW").firstChild.value=TheText;
}
////////////////////////////////////////////////////////////
function StartTime() { 
	ST=new Date();
	STDay=ST.getDay();
	STHours=ST.getHours();
	STMinutes=ST.getMinutes();
	STSeconds=ST.getSeconds();
	STMilli=ST.getMilliseconds();
}

function EndTime() {
	ET=new Date();
	ETHours=ET.getHours();
	ETMinutes=ET.getMinutes();
	ETSeconds=ET.getSeconds();
	ETMilli=ET.getMilliseconds();
	MinsWas=STMinutes*60*1000;
	SecsWas=STSeconds*1000;
	MilliWas=STMilli;
	TotalWas=MinsWas+SecsWas+MilliWas;
	MinsNow=ETMinutes*60*1000;
	SecsNow=ETSeconds*1000;
	MilliNow=ETMilli;
	TotalNow=MinsNow+SecsNow+MilliNow;
	ElapsedMilli=TotalNow-TotalWas;
	TotalSeconds=ElapsedMilli/1000;
	return(TotalSeconds);
}
////////////////////////////////////////////////////////////
function PrLNx(aKey) {
	if (GifOn==1) {
		if (parseInt(aKey)!=aKey-0) {
			GifKey=aKey;
		} else {
			GifKey=ThesePoses[aKey];
		}	
		SrcKey=FrontBit+GifKey+BackBit;
		TheNextPIc= new Image;
		TheNextPIc.src=SrcKey;
	
		alert("PrlNx : "+TheNextPIc.src + " : aKey : " + aKey);
	}
}
			
function NextGif(GifSrc) {
	if(GifSrc.indexOf('undefined')<0) {
		ThisSrc= FrontBit + GifSrc + BackBit;
		window.document.getElementById("PoseGif").src=ThisSrc;
		GifsUp=1;
	} else {
		alert(GifSrc);
				
	}
}

////////////////////////////////////////////////////////////
function SetClicker(Way,WSwich) {
	if(Way==1) {
		window.document.getElementById(WSwich).style.display="none";
	} else {
		window.document.getElementById(WSwich).firstChild.nodeValue=Way;
		window.document.getElementById(WSwich).style.display="block";
	}
		window.document.getElementById(WSwich).blur();
}
function AddStr() {

}

var Guide = "Text";
var Connection= "Dialup";

function SetGuide(Choice){
	Guide = Choice;
}	

function SetConnect(Choice){
	Connection=Choice;	
}	

function GetStretchPage(){
	window.document.location=Guide + Connection + ".html"
}
	
function Contact(Addr){
	parent.location.href='mailto:'+ Addr + "@" + "e-stretch.net?subject=e-stretch site";
}
/* ============================================= */

function TempObjectTrial() {
			
	var TheObjectCode="";
	TheObjectCode+="\n";
	TheObjectCode+="<object id='SWAPlayer' CLASSID='clsid:166B1BCA-3F9C-11CF-8075-444553540000' CODEBASE='http://active.macromedia.com/director/cabs/sw.cab#version=6,0,0,0' height='8' width='263' align='top'>"+ "\n";
	TheObjectCode+="<param name='bgcolor' value='#ffffff'>"+ "\n";
	TheObjectCode+="<param name='alt' value='e-stretch audio player, Shockwave movie'>"+ "\n";
	TheObjectCode+="<param name='src' value='../CodEl/SWAPlayer.dcr'>"+ "\n";
	TheObjectCode+="<embed src='../CodEl/SWAPlayer.dcr' align='top' width='263' height='8' type='application/x-director' alt='Director movie' bgcolor='#ffffff' id='SWAPlayer' name='SWAPlayer'>"+ "\n";
	TheObjectCode+="</object>"+ "\n";
	document.getElementById("EmbeddedObj").content=TheObjectCode;
}